UNPKG

@shopgate/engage

Version:
31 lines (30 loc) 729 B
import { i18n } from '@shopgate/engage/core'; import { generateCustomerAttributesFields } from '@shopgate/engage/account/helper/form'; /** * Generates form configuration. * @param {Object} params Additional parameters * @returns {Object} */ const generateFormConfig = ({ customerAttributes, isGuest, supportedCountries, countrySortOrder, userLocation }) => ({ fields: { ...(!isGuest ? { marketingOptIn: { type: 'checkbox', label: i18n.text('registration.marketing_opt_in_label') } } : {}), ...generateCustomerAttributesFields({ customerAttributes, supportedCountries, countrySortOrder, userLocation }) } }); export default generateFormConfig;