@shopgate/engage
Version:
Shopgate's ENGAGE library.
5 lines • 1.09 kB
JavaScript
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{i18n}from'@shopgate/engage/core';import{generateCustomerAttributesFields}from'@shopgate/engage/account/helper/form';/**
* Generates form configuration.
* @param {Object} params Additional parameters
* @returns {Object}
*/var generateFormConfig=function generateFormConfig(_ref){var customerAttributes=_ref.customerAttributes,isGuest=_ref.isGuest,supportedCountries=_ref.supportedCountries,countrySortOrder=_ref.countrySortOrder,userLocation=_ref.userLocation;return{fields:_extends({},!isGuest?{marketingOptIn:{type:'checkbox',label:i18n.text('registration.marketing_opt_in_label')}}:{},{},generateCustomerAttributesFields({customerAttributes:customerAttributes,supportedCountries:supportedCountries,countrySortOrder:countrySortOrder,userLocation:userLocation}))};};export default generateFormConfig;