- Integrated CheckoutRegistrationModule into the application for handling checkout-related functionalities. - Updated router configuration to include the new CheckoutRegistrationModule for API routing. - Enhanced SalesforceAccountService with methods for account creation and email lookup to support checkout registration. - Implemented public contact form functionality in SupportController, allowing unauthenticated users to submit inquiries. - Added rate limiting to the public contact form to prevent spam submissions. - Updated CatalogController and CheckoutController to allow public access for browsing and cart validation without authentication.
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
/**
|
|
* Feature Flags Configuration
|
|
*
|
|
* Controls gradual rollout of new features.
|
|
* Initially uses environment variables, can be replaced with a feature flag service.
|
|
*/
|
|
|
|
export const FEATURE_FLAGS = {
|
|
/**
|
|
* Enable public catalog (browse without login)
|
|
*/
|
|
PUBLIC_CATALOG: process.env.NEXT_PUBLIC_FEATURE_PUBLIC_CATALOG !== "false",
|
|
|
|
/**
|
|
* Enable unified checkout (checkout with registration)
|
|
*/
|
|
UNIFIED_CHECKOUT: process.env.NEXT_PUBLIC_FEATURE_UNIFIED_CHECKOUT !== "false",
|
|
|
|
/**
|
|
* Enable checkout registration (create accounts during checkout)
|
|
*/
|
|
CHECKOUT_REGISTRATION: process.env.NEXT_PUBLIC_FEATURE_CHECKOUT_REGISTRATION !== "false",
|
|
|
|
/**
|
|
* Enable public support (FAQ and contact without login)
|
|
*/
|
|
PUBLIC_SUPPORT: process.env.NEXT_PUBLIC_FEATURE_PUBLIC_SUPPORT !== "false",
|
|
} as const;
|
|
|
|
/**
|
|
* Hook to check if a feature is enabled
|
|
*/
|
|
export function useFeatureFlag(flag: keyof typeof FEATURE_FLAGS): boolean {
|
|
return FEATURE_FLAGS[flag];
|
|
}
|
|
|
|
/**
|
|
* Check if a feature is enabled (for use outside React components)
|
|
*/
|
|
export function isFeatureEnabled(flag: keyof typeof FEATURE_FLAGS): boolean {
|
|
return FEATURE_FLAGS[flag];
|
|
}
|