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,oBACtCnF,EAAyB5C,GACftzB,IAAS00B,GAAmB8D,mBACtCL,GAAuB,GACvBuQ,KACU1oC,IAAS00B,GAAmBkE,kBACtCT,GAAuB,GACvBwQ,KACU3oC,IAAS00B,GAAmB4G,kBACtC4N,GAAU,GACAlpC,IAAS00B,GAAmB6G,mBACtCpD,GAAuB,GACvB6Q,GAA2B,GAC3BF,GAA4B,GAC5BI,GAAU,IACAlpC,IAAS00B,GAAmB6F,iBACtCpC,GAAuB,GACvByQ,KACU5oC,IAAS00B,GAAmBuG,eACtC9C,GAAuB,KAK1B,MAAO,KACN6C,MAEC,CAAC0N,EAAqBC,EAAoBC,EAAmB7F,IAEzD,CACNtX,SACA0d,uBAAwBN,GAA4BE,IAA4BxV,EAChFA,sBACA6V,4BAA8BP,EAE1BE,OAEA/xB,EADAtM,EAAmB2+B,qCAFpB3+B,EAAmBqoB,iCAItBuW,gCAAiC3lB,EAAS,GAAKqU,IAA4B+K,EAC3EzP,wBACAG,oBCjEF8V,GAAA","sources":["webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/Localization.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/amex.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/discover.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/mastercard.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/visa.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/trash.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/paypal.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/jcb.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/unionpay.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/discover-partner.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/stripe-generic.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/diners-club.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/trash-disabled.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/sprites/svg/info-icon.svg","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/sharedStyled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-profiles/styled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-profiles/billing-profile.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-summary/styled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-summary/billing-summary.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-summary/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/address-form/typings/AddressFieldKind.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/address-form/components/styled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/address-form/components/useLocale.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/address-form/components/address-form.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/address-form/components/useSelectStyles.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/address-form/components/useAddressFormData.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/address-form/index.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/request.js","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/typings/locations/AddressFieldKind.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/typings/locations/AddressFormatMapper.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/locations-client.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/utilities/nameof.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/utilities/credit-card-utils.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/shipping-address-form/styled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/shipping-address-form/shipping-address-form.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/shipping-address-form/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/typings/orders/ErrorMapper.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/typings/orders/IErrorsDto.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/orders-client.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/typings/orders/IErrors.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/mappers/BillingProfileMapper.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-profiles/paypal-profile.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-profiles/edit-credit-card-info.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-profiles/edit-credit-card-form.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-profiles/stripe-profile.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/clients/payfac-client.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/typings/LogLevel.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/stripe-locales-by-locale/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/styled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/utils.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/billing-address.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/payment-methods.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/utilities/convert-to-minor-unities.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-method-event-handler.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/add-payment-method.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/use-billing-address-profile-handler.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/use-payment-form-handler.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/setup-mode/styled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/setup-mode/add-payment-method.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/add-payment-method.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/billing-profiles/billing-profiles.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/index.js","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/payment-methods.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/stripe-entry-form/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/stripe-cart-status-checker/styled.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/stripe-cart-status-checker/index.tsx","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/components/payment-methods/stripe/payment-mode/use-payment-form-client-handler.ts","webpack://@logos/commerceweb-frontend/./Scripts/site/packages/payment-methods/index.js"],"sourcesContent":["import { GetTypedLocalization } from '@faithlife/react-ui';\nimport ILocalizedResources from './typings/ILocalizedResources';\n\nconst { LocalizationProvider, Localize, Text, useLocalization } = GetTypedLocalization<ILocalizedResources>();\n\nexport { LocalizationProvider, Localize, Text, useLocalization };\n","var _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgAmex = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  viewBox: \"0 0 48 32\"\n}, props), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"none\",\n  fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"rect\", {\n  width: 47,\n  height: 31,\n  x: 0.5,\n  y: 0.5,\n  stroke: \"#C7C7C7\",\n  rx: 3\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#007AC6\",\n  fillRule: \"nonzero\",\n  d: \"M10.533 16.429h2.33l-1.165-2.857-1.165 2.857ZM43 11h-5.969l-1.456 1.571L34.264 11H21.598l-1.165 2.571L19.268 11h-5.096v1.143L13.59 11H9.222L5 21h5.096l.582-1.571h1.456L12.716 21h5.678v-1.143L18.831 21h2.912l.437-1.286V21h11.648l1.456-1.571L36.594 21h5.969l-3.785-5L43 11Zm-17.617 8.571h-1.602V14l-2.475 5.571H19.85L17.375 14v5.571h-3.349L13.444 18H9.95l-.582 1.571H7.475l3.057-7.143h2.475l2.766 6.714v-6.714h2.766l2.184 4.857 2.038-4.857h2.766v7.143h-.144Zm14.414 0h-2.184l-1.893-2.429-2.184 2.429h-6.552v-7.143h6.697l2.038 2.286 2.184-2.286h2.038L36.739 16l3.058 3.571Zm-11.211-5.714v1.286h3.64v1.429h-3.64V18h4.077l1.893-2.143-1.747-2h-4.223Z\"\n}))));\nexport default SvgAmex;","var _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgDiscover = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  viewBox: \"0 0 48 32\"\n}, props), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"none\",\n  fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"rect\", {\n  width: 47,\n  height: 31,\n  x: 0.5,\n  y: 0.5,\n  stroke: \"#C7C7C7\",\n  rx: 3\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#FA7000\",\n  fillRule: \"nonzero\",\n  d: \"M25.004 13C23.346 13 22 14.325 22 15.961 22 17.701 23.287 19 25.004 19A2.97 2.97 0 0 0 28 15.994 2.96 2.96 0 0 0 25.004 13Z\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#444\",\n  fillRule: \"nonzero\",\n  d: \"M7.74 13H6v6h1.73c.92 0 1.585-.216 2.167-.694A3 3 0 0 0 11 16.002C10.999 14.23 9.66 13 7.74 13Zm1.385 4.506c-.376.332-.856.477-1.623.477h-.317v-3.968h.318c.767 0 1.228.136 1.623.485.408.36.653.918.653 1.493-.001.578-.245 1.155-.654 1.513ZM11 13h1v6h-1zM15.334 15.305c-.68-.247-.878-.413-.878-.724 0-.363.355-.638.842-.638.338 0 .617.135.913.464l.587-.767A2.523 2.523 0 0 0 15.1 13c-1.024 0-1.805.71-1.805 1.648 0 .797.363 1.201 1.422 1.585.442.153.667.258.782.33a.685.685 0 0 1 .337.593c0 .469-.373.814-.877.814-.537 0-.972-.268-1.232-.77l-.727.702c.52.759 1.144 1.098 2.003 1.098C16.175 19 17 18.22 17 17.106c.001-.917-.382-1.333-1.666-1.8Z\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#444\",\n  fillRule: \"nonzero\",\n  d: \"M17 16.002C17 17.692 18.196 19 19.735 19c.434 0 .807-.095 1.265-.335v-1.32c-.405.451-.76.63-1.22.63-1.018 0-1.739-.817-1.739-1.98 0-1.1.744-1.972 1.693-1.972.48 0 .846.188 1.265.646V13.35c-.443-.248-.806-.351-1.244-.351C18.226 13 17 14.334 17 16.002ZM30.993 16.929 29.329 13H28l2.648 6h.653L34 13h-1.318zM34 19h3v-1.017h-1.941v-1.619h1.867v-1.016h-1.867v-1.333H37V13h-3zM41.523 14.77c0-1.123-.703-1.77-1.936-1.77H38v6h1.07v-2.412h.14L40.685 19H42l-1.723-2.53c.805-.178 1.246-.78 1.246-1.7Zm-2.141.99h-.31v-1.815h.327c.667 0 1.025.308 1.025.892 0 .6-.358.923-1.042.923Z\"\n}))));\nexport default SvgDiscover;","var _defs, _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgMastercard = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  xmlnsXlink: \"http://www.w3.org/1999/xlink\",\n  viewBox: \"0 0 48 32\"\n}, props), _defs || (_defs = /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"rect\", {\n  id: \"mastercard-a\",\n  width: 18,\n  height: 18,\n  y: 0.813,\n  rx: 9\n}))), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"none\",\n  fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"rect\", {\n  width: 47,\n  height: 31,\n  x: 0.5,\n  y: 0.5,\n  stroke: \"#C7C7C7\",\n  rx: 3\n}), /*#__PURE__*/React.createElement(\"g\", {\n  transform: \"translate(10 6.188)\"\n}, /*#__PURE__*/React.createElement(\"rect\", {\n  width: 18,\n  height: 18,\n  x: 10,\n  y: 0.813,\n  fill: \"#F79F1A\",\n  rx: 9\n}), /*#__PURE__*/React.createElement(\"mask\", {\n  id: \"mastercard-b\",\n  fill: \"#fff\"\n}, /*#__PURE__*/React.createElement(\"use\", {\n  xlinkHref: \"#mastercard-a\"\n})), /*#__PURE__*/React.createElement(\"use\", {\n  fill: \"#EA001B\",\n  xlinkHref: \"#mastercard-a\"\n}), /*#__PURE__*/React.createElement(\"rect\", {\n  width: 18,\n  height: 18,\n  x: 10,\n  y: 0.813,\n  fill: \"#FF5F01\",\n  mask: \"url(#mastercard-b)\",\n  rx: 9\n})))));\nexport default SvgMastercard;","var _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgVisa = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  viewBox: \"0 0 48 32\"\n}, props), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"none\",\n  fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"#1E91D6\"\n}, /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M26.902 12a5.13 5.13 0 0 1 1.856.337l-.28 1.738-.187-.092a3.64 3.64 0 0 0-1.55-.308c-.811 0-1.186.357-1.186.69-.006.376.439.623 1.163.994 1.195.572 1.747 1.265 1.74 2.18-.017 1.663-1.431 2.738-3.608 2.738-.929-.01-1.824-.204-2.307-.427l.29-1.795.266.127c.681.3 1.122.42 1.95.42.596 0 1.235-.245 1.24-.782.004-.351-.267-.603-1.075-.995-.785-.383-1.826-1.026-1.813-2.179.012-1.558 1.453-2.646 3.5-2.646Zm7.169.148 1.676 8.013h-1.922s-.19-.922-.253-1.201l-2.372-.004h-.28c-.081.216-.436 1.205-.436 1.205H28.31l3.075-7.348c.218-.523.59-.665 1.086-.665h1.6Zm-11.53-.008-1.296 8.018h-2.071l1.295-8.018h2.071Zm-2.91.006-3.262 8.004-2.192.001-1.854-7.013c1.315.696 2.49 2.084 2.869 3.364l.217 1.111 2.027-5.467h2.195Zm12.985 2.163c-.105.3-.288.786-.275.765 0 0-.654 1.78-.825 2.241h1.719l-.452-2.185-.027-.13Z\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M13.454 12h-3.426l-.028.173c2.666.693 4.43 2.367 5.161 4.379l-.744-3.846c-.129-.53-.502-.688-.963-.706\"\n})), /*#__PURE__*/React.createElement(\"rect\", {\n  width: 47,\n  height: 31,\n  x: 0.5,\n  y: 0.5,\n  stroke: \"#C7C7C7\",\n  rx: 3\n}))));\nexport default SvgVisa;","var _defs, _use;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgTrash = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  xmlnsXlink: \"http://www.w3.org/1999/xlink\",\n  viewBox: \"0 0 18 18\"\n}, props), _defs || (_defs = /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"path\", {\n  id: \"a\",\n  d: \"M2.5 14A1.5 1.5 0 0 1 1 12.5V3h10v9.5A1.5 1.5 0 0 1 9.5 14h-7zM12 1v2H0V1h3.5l1-1h3l1 1H12zM7 4v7h1.5V4H7zM3.5 4v7H5V4H3.5z\"\n}))), _use || (_use = /*#__PURE__*/React.createElement(\"use\", {\n  fill: \"#7A7A7A\",\n  fillRule: \"evenodd\",\n  transform: \"translate(3 2)\",\n  xlinkHref: \"#a\"\n})));\nexport default SvgTrash;","var _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgPaypal = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  viewBox: \"0 0 48 32\"\n}, props), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"none\",\n  fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"rect\", {\n  width: 47,\n  height: 31,\n  x: 0.5,\n  y: 0.5,\n  stroke: \"#C7C7C7\",\n  rx: 3\n}), /*#__PURE__*/React.createElement(\"g\", {\n  fillRule: \"nonzero\"\n}, /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#009EE3\",\n  d: \"M30.29 11h-2.8a.389.389 0 0 0-.383.328l-1.132 7.18a.234.234 0 0 0 .23.27h1.438a.273.273 0 0 0 .269-.23l.32-2.036a.389.389 0 0 1 .385-.328h.886c1.844 0 2.909-.893 3.187-2.662.125-.774.005-1.382-.357-1.807-.4-.467-1.105-.715-2.042-.715Zm.324 2.623c-.153 1.005-.921 1.005-1.663 1.005h-.422l.296-1.877a.234.234 0 0 1 .23-.197c.616 0 1.156-.025 1.424.288.147.173.19.428.135.781Z\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#113984\",\n  d: \"M10.319 11h-2.8a.389.389 0 0 0-.384.328l-1.132 7.18a.234.234 0 0 0 .23.27h1.338a.389.389 0 0 0 .384-.328l.306-1.937a.389.389 0 0 1 .384-.328h.886c1.844 0 2.909-.893 3.187-2.662.125-.774.005-1.382-.357-1.807-.4-.468-1.105-.716-2.042-.716zm.323 2.623c-.153 1.005-.921 1.005-1.663 1.005h-.423l.296-1.877a.234.234 0 0 1 .23-.197h.195c.505 0 .983 0 1.229.288.147.173.192.428.136.781zm8.047-.032h-1.341a.234.234 0 0 0-.231.197l-.06.375c-.13-.189-.388-.698-1.677-.698-1.481 0-2.747 1.123-2.993 2.697-.128.785.054 1.536.499 2.06.409.481.993.682 1.689.682 1.194 0 1.856-.767 1.856-.767l-.06.373a.234.234 0 0 0 .23.27h1.209a.389.389 0 0 0 .384-.328l.725-4.59a.234.234 0 0 0-.23-.271zm-1.87 2.61a1.494 1.494 0 0 1-1.512 1.28c-.39 0-.7-.125-.9-.362-.198-.235-.273-.569-.21-.942a1.501 1.501 0 0 1 1.503-1.29c.38 0 .69.126.894.365.204.241.285.578.226.949z\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#009EE3\",\n  d: \"M38.66 13.591h-1.34a.234.234 0 0 0-.231.197l-.06.375c-.13-.189-.388-.698-1.677-.698-1.481 0-2.747 1.123-2.993 2.697-.128.785.054 1.536.499 2.06.409.481.993.682 1.689.682 1.194 0 1.856-.767 1.856-.767l-.06.373a.234.234 0 0 0 .23.27h1.209a.389.389 0 0 0 .384-.328l.725-4.59a.233.233 0 0 0-.23-.271Zm-1.868 2.61c-.13.766-.738 1.28-1.513 1.28-.39 0-.7-.125-.9-.362-.198-.235-.273-.569-.21-.942a1.501 1.501 0 0 1 1.503-1.29c.38 0 .69.126.894.365.204.241.285.578.226.949Z\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#113984\",\n  d: \"M25.83 13.591h-1.348a.39.39 0 0 0-.322.171L22.3 16.5l-.787-2.631a.39.39 0 0 0-.373-.278h-1.325a.233.233 0 0 0-.221.309l1.484 4.356-1.396 1.97a.233.233 0 0 0 .19.368h1.346a.391.391 0 0 0 .32-.167l4.482-6.469a.233.233 0 0 0-.19-.367Z\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#009EE3\",\n  d: \"m40.24 11.198-1.148 7.312a.234.234 0 0 0 .23.27h1.157a.389.389 0 0 0 .384-.328l1.133-7.18a.234.234 0 0 0-.231-.27H40.47a.23.23 0 0 0-.23.196Z\"\n})))));\nexport default SvgPaypal;","var _style, _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgJcb = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlSpace: \"preserve\",\n  viewBox: \"0 0 48 32\",\n  y: 0,\n  x: 0,\n  id: \"\\\\u30EC\\\\u30A4\\\\u30E4\\\\u30FC_1\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}, props), _style || (_style = /*#__PURE__*/React.createElement(\"style\", {\n  id: \"style6319\",\n  type: \"text/css\"\n}, \".st0{fill:#fff}\")), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  id: \"rectangle-outline\",\n  stroke: \"#a8a8a8\",\n  strokeWidth: 7.45,\n  fill: \"#fff\",\n  transform: \"matrix(.13603 0 0 .13465 -.618 -.613)\"\n}, /*#__PURE__*/React.createElement(\"g\", {\n  id: \"Group\"\n}, /*#__PURE__*/React.createElement(\"rect\", {\n  id: \"Rectangle-3\",\n  x: 7.83,\n  y: 7.83,\n  width: 346.5,\n  height: 231.511,\n  rx: 15.66\n})))), /*#__PURE__*/React.createElement(\"g\", {\n  transform: \"matrix(.13859 0 0 .13859 2.149 13.286)\",\n  id: \"g6321\"\n}, /*#__PURE__*/React.createElement(\"g\", {\n  transform: \"matrix(1.82152 0 0 1.82152 -8.544 -109.837)\",\n  id: \"g6323\"\n}, /*#__PURE__*/React.createElement(\"g\", {\n  id: \"g6327\"\n}, /*#__PURE__*/React.createElement(\"linearGradient\", {\n  gradientTransform: \"translate(-11.976 -13.861) scale(1.125)\",\n  y2: 81.399,\n  x2: 157.33,\n  y1: 81.399,\n  x1: 117.386,\n  gradientUnits: \"userSpaceOnUse\",\n  id: \"SVGID_1_\"\n}, /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6330\",\n  style: {\n    stopColor: \"#007940\"\n  },\n  offset: 0\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6332\",\n  style: {\n    stopColor: \"#00873f\"\n  },\n  offset: 0.229\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6334\",\n  style: {\n    stopColor: \"#40a737\"\n  },\n  offset: 0.743\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6336\",\n  style: {\n    stopColor: \"#5cb531\"\n  },\n  offset: 1\n})), /*#__PURE__*/React.createElement(\"path\", {\n  style: {\n    fill: \"url(#SVGID_1_)\"\n  },\n  id: \"path6338\",\n  d: \"M129 82.5h10.5c.3 0 1-.1 1.3-.1 2-.4 3.7-2.2 3.7-4.7 0-2.4-1.7-4.2-3.7-4.7-.3-.1-.9-.1-1.3-.1H129Z\"\n}), /*#__PURE__*/React.createElement(\"linearGradient\", {\n  gradientTransform: \"translate(-11.976 -13.861) scale(1.125)\",\n  y2: 75.171,\n  x2: 157.332,\n  y1: 75.171,\n  x1: 117.384,\n  gradientUnits: \"userSpaceOnUse\",\n  id: \"SVGID_2_\"\n}, /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6341\",\n  style: {\n    stopColor: \"#007940\"\n  },\n  offset: 0\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6343\",\n  style: {\n    stopColor: \"#00873f\"\n  },\n  offset: 0.229\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6345\",\n  style: {\n    stopColor: \"#40a737\"\n  },\n  offset: 0.743\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6347\",\n  style: {\n    stopColor: \"#5cb531\"\n  },\n  offset: 1\n})), /*#__PURE__*/React.createElement(\"path\", {\n  style: {\n    fill: \"url(#SVGID_2_)\"\n  },\n  id: \"path6349\",\n  d: \"M138.3 16.2c-10 0-18.2 8.1-18.2 18.2v18.9h25.7c.6 0 1.3 0 1.8.1 5.8.3 10.1 3.3 10.1 8.5 0 4.1-2.9 7.6-8.3 8.3v.2c5.9.4 10.4 3.7 10.4 8.8 0 5.5-5 9.1-11.6 9.1H120v37h26.7c10 0 18.2-8.1 18.2-18.2V16.2Z\"\n}), /*#__PURE__*/React.createElement(\"linearGradient\", {\n  gradientTransform: \"translate(-11.976 -13.861) scale(1.125)\",\n  y2: 68.399,\n  x2: 157.331,\n  y1: 68.399,\n  x1: 117.385,\n  gradientUnits: \"userSpaceOnUse\",\n  id: \"SVGID_3_\"\n}, /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6352\",\n  style: {\n    stopColor: \"#007940\"\n  },\n  offset: 0\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6354\",\n  style: {\n    stopColor: \"#00873f\"\n  },\n  offset: 0.229\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6356\",\n  style: {\n    stopColor: \"#40a737\"\n  },\n  offset: 0.743\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6358\",\n  style: {\n    stopColor: \"#5cb531\"\n  },\n  offset: 1\n})), /*#__PURE__*/React.createElement(\"path\", {\n  style: {\n    fill: \"url(#SVGID_3_)\"\n  },\n  id: \"path6360\",\n  d: \"M143.2 63.1c0-2.4-1.7-4-3.7-4.3-.2 0-.7-.1-1-.1H129v8.8h9.5c.3 0 .9 0 1-.1 2-.3 3.7-1.9 3.7-4.3z\"\n})), /*#__PURE__*/React.createElement(\"linearGradient\", {\n  gradientTransform: \"translate(-11.976 -13.861) scale(1.125)\",\n  y2: 75.171,\n  x2: 68.522,\n  y1: 75.171,\n  x1: 27.959,\n  gradientUnits: \"userSpaceOnUse\",\n  id: \"SVGID_4_\"\n}, /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6363\",\n  style: {\n    stopColor: \"#1f286f\"\n  },\n  offset: 0\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6365\",\n  style: {\n    stopColor: \"#004e94\"\n  },\n  offset: 0.475\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6367\",\n  style: {\n    stopColor: \"#0066b1\"\n  },\n  offset: 0.826\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6369\",\n  style: {\n    stopColor: \"#006fbc\"\n  },\n  offset: 1\n})), /*#__PURE__*/React.createElement(\"path\", {\n  style: {\n    fill: \"url(#SVGID_4_)\"\n  },\n  id: \"path6371\",\n  d: \"M37.7 16.2c-10 0-18.2 8.1-18.2 18.2v44.9c5.1 2.5 10.4 4.1 15.7 4.1 6.3 0 9.7-3.8 9.7-9V53.2h15.6v21.1c0 8.2-5.1 14.9-22.4 14.9-10.5 0-18.7-2.3-18.7-2.3v38.3h26.7c10 0 18.2-8.1 18.2-18.2V16.2Z\"\n}), /*#__PURE__*/React.createElement(\"linearGradient\", {\n  gradientTransform: \"translate(-11.976 -13.861) scale(1.125)\",\n  y2: 75.171,\n  x2: 111.855,\n  y1: 75.171,\n  x1: 72.46,\n  gradientUnits: \"userSpaceOnUse\",\n  id: \"SVGID_5_\"\n}, /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6374\",\n  style: {\n    stopColor: \"#6c2c2f\"\n  },\n  offset: 0\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6376\",\n  style: {\n    stopColor: \"#882730\"\n  },\n  offset: 0.173\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6378\",\n  style: {\n    stopColor: \"#be1833\"\n  },\n  offset: 0.573\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6380\",\n  style: {\n    stopColor: \"#dc0436\"\n  },\n  offset: 0.859\n}), /*#__PURE__*/React.createElement(\"stop\", {\n  id: \"stop6382\",\n  style: {\n    stopColor: \"#e60039\"\n  },\n  offset: 1\n})), /*#__PURE__*/React.createElement(\"path\", {\n  style: {\n    fill: \"url(#SVGID_5_)\"\n  },\n  id: \"path6384\",\n  d: \"M88 16.2c-10 0-18.2 8.1-18.2 18.2v23.8c4.6-3.9 12.6-6.4 25.5-5.8 6.9.3 14.3 2.2 14.3 2.2v7.7c-3.7-1.9-8.1-3.6-13.8-4-9.8-.7-15.7 4.1-15.7 12.5 0 8.5 5.9 13.3 15.7 12.5 5.7-.4 10.1-2.2 13.8-4V87s-7.3 1.9-14.3 2.2c-12.9.6-20.9-1.9-25.5-5.8v42h26.7c10 0 18.2-8.1 18.2-18.2v-91z\"\n}))));\nexport default SvgJcb;","var _rect, _path, _path2, _path3, _path4;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgUnionpay = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  viewBox: \"0 0 48 32\",\n  preserveAspectRatio: \"xMidYMid\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}, props), _rect || (_rect = /*#__PURE__*/React.createElement(\"rect\", {\n  x: 7.83,\n  y: 7.83,\n  width: 346.5,\n  height: 231.511,\n  rx: 15.66,\n  transform: \"matrix(.13556 0 0 .134 -.538 -.574)\",\n  stroke: \"#a8a8a8\",\n  strokeWidth: 7.45,\n  fill: \"#fff\"\n})), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M12.345 4.034h9.576c1.337 0 2.169 1.09 1.857 2.43l-4.459 19.143c-.314 1.336-1.653 2.427-2.99 2.427H6.752c-1.335 0-2.168-1.09-1.856-2.427l4.46-19.142c.312-1.341 1.65-2.431 2.988-2.431\",\n  fill: \"#e21836\"\n})), _path2 || (_path2 = /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M21.125 4.034h11.012c1.337 0 .734 1.09.42 2.43l-4.458 19.143c-.313 1.336-.215 2.427-1.555 2.427H15.532c-1.34 0-2.169-1.09-1.854-2.427l4.458-19.142c.316-1.341 1.651-2.431 2.989-2.431\",\n  fill: \"#00447c\"\n})), _path3 || (_path3 = /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M31.7 4.034h9.577c1.338 0 2.17 1.09 1.855 2.43l-4.457 19.143c-.315 1.336-1.654 2.427-2.993 2.427H26.11c-1.34 0-2.17-1.09-1.856-2.427l4.458-19.142c.312-1.341 1.65-2.431 2.988-2.431\",\n  fill: \"#007b84\"\n})), _path4 || (_path4 = /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M14.846 10.168c-.985.01-1.276 0-1.369-.022-.035.17-.7 3.236-.702 3.238-.143.62-.247 1.062-.6 1.348a1.07 1.07 0 0 1-.707.246c-.437 0-.691-.217-.734-.628l-.008-.141.133-.836s.697-2.793.822-3.163a.27.27 0 0 0 .01-.042c-1.357.012-1.598 0-1.615-.022-.009.03-.042.204-.042.204l-.713 3.148-.06.267-.119.874c0 .259.05.47.152.65.325.566 1.25.651 1.774.651.674 0 1.307-.143 1.735-.405.742-.438.936-1.124 1.11-1.733l.08-.313s.718-2.901.84-3.279c.005-.02.007-.032.013-.042zm2.445 2.341c-.174 0-.49.042-.774.181-.104.053-.201.114-.304.175l.093-.335-.051-.056c-.603.122-.738.138-1.295.216l-.047.031c-.064.537-.122.94-.361 1.994-.092.388-.186.78-.281 1.168l.025.049c.571-.03.744-.03 1.24-.022l.04-.044c.063-.323.072-.398.211-1.052.066-.31.202-.991.27-1.234.124-.057.246-.114.363-.114.278 0 .244.243.233.34-.012.162-.113.692-.217 1.147l-.07.293c-.047.217-.1.428-.149.643l.021.043c.563-.03.734-.03 1.215-.022l.056-.044c.087-.504.113-.639.267-1.373l.077-.337c.15-.66.226-.995.112-1.268-.12-.305-.41-.379-.674-.379zm2.73.691c-.299.058-.49.096-.679.12-.188.03-.371.058-.66.098l-.023.02-.02.017c-.031.216-.052.402-.092.62a11.36 11.36 0 0 1-.17.853c-.066.283-.1.381-.137.48-.037.1-.077.197-.15.475l.017.025.014.024c.27-.013.447-.022.628-.024.182-.006.37 0 .66.002l.026-.02.027-.024c.042-.25.049-.318.074-.44.026-.131.07-.313.177-.798.051-.228.108-.455.16-.687.055-.232.113-.46.167-.688l-.008-.027zm.007-.932c-.272-.16-.749-.11-1.07.112-.32.217-.356.525-.085.688.267.156.745.11 1.063-.114.32-.222.36-.527.092-.686zm1.643 3.714c.55 0 1.113-.151 1.537-.601.326-.365.476-.907.528-1.13.169-.74.037-1.087-.128-1.297-.25-.321-.694-.424-1.153-.424-.276 0-.935.027-1.449.501-.37.342-.54.806-.643 1.251-.104.454-.223 1.27.527 1.573.232.1.566.127.78.127zm-.043-1.666c.127-.56.276-1.031.658-1.031.3 0 .321.35.188.913-.024.124-.133.589-.28.786-.104.146-.226.235-.36.235-.041 0-.28 0-.284-.355a2.415 2.415 0 0 1 .078-.548zm3.482 1.594.043-.044c.06-.323.07-.398.206-1.052.067-.31.207-.991.272-1.234.125-.057.245-.114.365-.114.276 0 .243.243.232.34-.01.162-.111.692-.217 1.146l-.066.294c-.05.217-.105.428-.153.643l.021.043c.564-.03.73-.03 1.213-.022l.058-.044c.085-.504.108-.639.266-1.373l.076-.337c.151-.66.228-.995.116-1.268-.124-.305-.415-.379-.677-.379-.173 0-.491.042-.774.181a5.147 5.147 0 0 0-.302.175l.087-.335-.047-.057c-.602.123-.74.139-1.296.217l-.043.031c-.067.537-.122.94-.362 1.994-.091.388-.186.78-.28 1.168l.025.049c.571-.03.742-.03 1.237-.022zm4.147.022c.035-.173.246-1.2.248-1.2 0 0 .18-.753.19-.78 0 0 .057-.079.113-.11h.083c.785 0 1.67 0 2.364-.51.472-.35.795-.868.939-1.496a2.26 2.26 0 0 0 .065-.52c0-.241-.049-.48-.188-.665-.354-.495-1.059-.504-1.872-.508l-.401.004c-1.041.012-1.459.009-1.63-.012l-.042.21-.373 1.732-.935 3.848c.91-.01 1.282-.01 1.439.007zm.691-3.071.395-1.719.012-.088.006-.068.159.017.837.072c.322.125.455.447.363.867a1.261 1.261 0 0 1-.654.862c-.264.133-.587.144-.92.144h-.214zm2.47 1.487c-.106.447-.226 1.263.52 1.554.239.101.452.131.669.12.229-.012.441-.127.638-.292l-.054.204.034.043a19.88 19.88 0 0 1 1.286-.018l.053-.04c.085-.5.165-.985.385-1.94.108-.458.215-.911.326-1.367l-.017-.05c-.601.111-.762.135-1.34.217l-.044.036-.017.135a.826.826 0 0 0-.421-.346c-.257-.101-.86.029-1.38.501-.364.338-.54.8-.639 1.243zm1.261.027c.129-.55.276-1.016.66-1.016.241 0 .369.223.343.604-.02.095-.043.195-.07.309-.038.163-.08.325-.12.488a1.184 1.184 0 0 1-.141.286c-.099.14-.333.226-.468.226-.038 0-.274 0-.282-.349a2.393 2.393 0 0 1 .078-.548zm6.59-1.818-.047-.053c-.594.12-.702.14-1.248.214l-.04.04-.007.025-.002-.009c-.406.938-.394.736-.725 1.475l-.004-.09-.083-1.602-.052-.053c-.623.12-.637.14-1.213.214l-.044.04c-.007.019-.007.04-.01.063l.003.008c.072.367.055.285.127.865.034.285.079.571.112.852.057.47.089.702.158 1.42-.388.64-.48.883-.854 1.446l.002.005-.263.417c-.03.044-.058.074-.096.087a.397.397 0 0 1-.172.024h-.146l-.217.721.744.013c.437-.002.711-.206.859-.48l.468-.802h-.008l.05-.057c.314-.677 2.708-4.783 2.708-4.783zm-7.852 9.473h-.315l1.168-3.863h.387l.123-.398.012.442c-.015.274.2.516.766.476h.654l.225-.744h-.246c-.142 0-.207-.035-.2-.112l-.011-.45h-1.21v.002c-.392.008-1.561.038-1.798.1-.286.074-.588.292-.588.292l.119-.399H30.37l-.236.79-1.184 3.923h-.23l-.225.739h2.256l-.075.246h1.111l.074-.246h.312zm-.925-3.078c-.182.05-.52.202-.52.202l.3-.987h.9l-.216.72s-.278.015-.464.065zm.017 1.41s-.283.036-.469.078c-.183.055-.527.23-.527.23l.31-1.027h.905zm-.504 1.677h-.903l.262-.867h.9zm2.173-2.396h1.301l-.186.605h-1.319l-.198.662h1.154l-.874 1.23a.36.36 0 0 1-.177.148.518.518 0 0 1-.234.067h-.32l-.22.725h.837c.435 0 .692-.198.882-.457l.599-.82.129.832c.027.156.139.247.215.283.084.042.17.114.293.125.13.005.225.01.289.01h.41l.248-.812h-.162c-.094 0-.254-.015-.281-.044-.028-.036-.028-.09-.042-.174l-.13-.834h-.535l.234-.279h1.316l.202-.662h-1.218l.19-.605h1.214l.226-.747H33.4zM22.19 22.208l.303-1.01h1.248l.228-.752H22.72l.19-.622h1.222l.226-.727h-3.055l-.221.727h.694l-.185.622h-.696l-.23.764h.693l-.405 1.337c-.054.177.026.244.077.326.052.08.104.133.223.164.122.027.206.043.32.043h1.407l.25-.832-.623.085c-.12 0-.454-.014-.417-.125zm.143-4.836-.317.571c-.067.125-.128.203-.183.238-.048.03-.144.043-.283.043h-.165l-.22.731h.548c.263 0 .466-.096.562-.145.104-.055.131-.023.212-.101l.185-.16h1.711l.227-.762h-1.252l.218-.415zm2.526 4.85c-.029-.042-.008-.116.037-.27l.467-1.548h1.665c.242-.003.417-.006.531-.014.122-.013.255-.057.4-.135a.749.749 0 0 0 .291-.269c.072-.099.188-.316.288-.65l.587-1.96-1.726.01s-.532.079-.766.165c-.236.097-.574.367-.574.367l.156-.537h-1.067l-1.493 4.952a3.055 3.055 0 0 0-.097.416c-.003.09.114.18.19.247.09.068.221.057.348.068.133.01.323.016.585.016h.82l.25-.85-.733.07a.193.193 0 0 1-.159-.078zm.806-2.864h1.748l-.111.349c-.016.008-.053-.018-.23.003h-1.514zm.35-1.168h1.763l-.127.42s-.83-.008-.964.016c-.585.101-.927.414-.927.414zm1.326 2.683a.186.186 0 0 1-.07.107c-.035.023-.092.031-.178.031h-.249l.015-.424h-1.036l-.042 2.074c-.002.15.013.236.122.305.11.087.447.098.901.098h.65l.234-.776-.566.03-.187.012c-.026-.011-.05-.021-.078-.049-.024-.023-.064-.009-.057-.158l.004-.532.593-.024c.32 0 .456-.104.573-.204.112-.095.148-.204.19-.352l.1-.47h-.815z\",\n  fill: \"#fefefe\"\n})));\nexport default SvgUnionpay;","var _path;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgDiscoverPartner = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  width: 18,\n  height: 18,\n  viewBox: \"0 0 18 18\"\n}, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#7A7A7A\",\n  fillRule: \"evenodd\",\n  d: \"M17 5v8a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2Zm-1 1H2v3h14V6ZM3 11v1h6v-1H3Z\"\n})));\nexport default SvgDiscoverPartner;","var _path;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgStripeGeneric = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  width: 18,\n  height: 18,\n  viewBox: \"0 0 18 18\"\n}, props), _path || (_path = /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#7A7A7A\",\n  fillRule: \"evenodd\",\n  d: \"M17 5v8a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2Zm-1 1H2v3h14V6ZM3 11v1h6v-1H3Z\"\n})));\nexport default SvgStripeGeneric;","var _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgDinersClub = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  viewBox: \"0 0 48 32\"\n}, props), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  fill: \"none\",\n  fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"rect\", {\n  width: 47,\n  height: 31,\n  x: 0.5,\n  y: 0.5,\n  stroke: \"#C7C7C7\",\n  rx: 3\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 26,\n  cy: 16,\n  r: 10,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 25,\n  cy: 16,\n  r: 10,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 24,\n  cy: 16,\n  r: 10,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 23,\n  cy: 16,\n  r: 10,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 22,\n  cy: 16,\n  r: 10,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 21,\n  cy: 16,\n  r: 10,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 21,\n  cy: 16,\n  r: 9,\n  fill: \"#fff\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 20,\n  cy: 16,\n  r: 5,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"circle\", {\n  cx: 22,\n  cy: 16,\n  r: 5,\n  fill: \"#38457a\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n  fill: \"#fff\",\n  d: \"M19 10h4v12h-4z\"\n}))));\nexport default SvgDinersClub;","var _defs, _use;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgTrashDisabled = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  xmlns: \"http://www.w3.org/2000/svg\",\n  xmlnsXlink: \"http://www.w3.org/1999/xlink\",\n  viewBox: \"0 0 18 18\"\n}, props), _defs || (_defs = /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"path\", {\n  id: \"a\",\n  d: \"M2.5 14A1.5 1.5 0 0 1 1 12.5V3h10v9.5A1.5 1.5 0 0 1 9.5 14h-7zM12 1v2H0V1h3.5l1-1h3l1 1H12zM7 4v7h1.5V4H7zM3.5 4v7H5V4H3.5z\"\n}))), _use || (_use = /*#__PURE__*/React.createElement(\"use\", {\n  fill: \"#b3b1b1\",\n  fillRule: \"evenodd\",\n  transform: \"translate(3 2)\",\n  xlinkHref: \"#a\"\n})));\nexport default SvgTrashDisabled;","var _g;\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nimport * as React from \"react\";\nconst SvgInfoIcon = props => /*#__PURE__*/React.createElement(\"svg\", _extends({\n  width: 17,\n  height: 17,\n  viewBox: \"0 0 17 17\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n}, props), _g || (_g = /*#__PURE__*/React.createElement(\"g\", {\n  transform: \"translate(1 -2)\",\n  fill: \"none\",\n  fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"circle\", {\n  stroke: \"#979797\",\n  cx: 7.5,\n  cy: 10.5,\n  r: 7.5\n}), /*#__PURE__*/React.createElement(\"path\", {\n  d: \"M7.896 7.524c0-.624.48-1.164 1.08-1.164.372 0 .684.24.684.72 0 .624-.468 1.188-1.056 1.188-.384 0-.708-.252-.708-.744Zm.852 6.912v.456c-.252.084-.78.204-1.308.204-.84 0-1.26-.348-1.26-.948 0-.156.024-.348.096-.552l.936-2.916c.132-.42-.036-.588-.876-.636v-.48l2.7-.132-1.284 4.044c-.072.252-.12.42-.12.552 0 .36.3.432 1.116.408Z\",\n  fill: \"#979797\"\n}))));\nexport default SvgInfoIcon;","import styled from 'styled-components';\n\nexport const Label = styled.label`\n\t&&& {\n\t\tfont-size: 16px;\n\t\tfont-weight: normal;\n\t\tcolor: ${({ theme }) => theme.colors.gray54};\n\t\twidth: 100%;\n\t}\n`;\n\nexport const LabelText = styled.p`\n\t&&& {\n\t\tpadding-bottom: 6px;\n\t\tmargin: 0;\n\t}\n`;\n\nexport const InfoRow = styled.div`\n\tdisplay: flex;\n\tpadding-bottom: 12px;\n`;\n","import { Box, Button, Checkbox as UnstyledCheckbox } from '@faithlife/styled-ui';\nimport styled from 'styled-components';\nimport InfoSvgUnstyled from '../../sprites/svg/info-icon.svg';\n\nexport * from '../sharedStyled';\n\nexport const BillingAddressInfoSection = styled.div`\n\tpadding-top: 8px;\n`;\n\nexport const BillingProfiles = styled(Box)`\n\toverflow-y: auto;\n\toverflow-x: hidden;\n\tborder: 1px solid ${({ theme }) => theme.colors.borderColor};\n\tborder-radius: 3px;\n`;\n\nexport const BillingProfilesContainer = styled.div`\n\tfont-family: 'Source Sans Pro', sans-serif;\n`;\n\nexport const BillingProfilesSection = styled.div`\n\tmargin-top: 14px;\n`;\n\nexport const CancelButton = styled(Button).attrs({ variant: 'secondary', size: 'small' })`\n\torder: 2;\n\tmargin-left: auto;\n\tmargin-right: 16px;\n`;\n\nexport const CardLogoContainer = styled.div`\n\twidth: 38px;\n\theight: 26px;\n\tmargin-left: 16px;\n\tbackground: white;\n\tborder-radius: 5px;\n`;\n\nexport const CardNumber = styled.div`\n\tpadding-left: 6px;\n`;\n\nexport const Checkbox = styled(UnstyledCheckbox).attrs({\n\ttype: 'button',\n})`\n\tmargin: ${({ theme }) => theme.space[3]} 0;\n\tword-wrap: normal;\n`;\n\nexport const CreateButton = styled(Button).attrs({ variant: 'primary', size: 'small' })`\n\torder: 1;\n`;\n\nexport const CreditCardRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\n\tborder-bottom: 1px solid ${({ theme }) => theme.colors.borderColor};\n\n\theight: 45px;\n\n\tfont-size: 16px;\n\tline-height: 1.25;\n\tletter-spacing: 0.16px;\n\tcolor: ${({ theme }) => theme.colors.foregroundPrimary};\n\n\tpadding: 0 16px;\n`;\n\nexport const LoadingSpinnerRow = styled(CreditCardRow)`\n\tjustify-content: center;\n\toverflow: hidden;\n`;\n\nexport const Delete = styled.div<{ isDeleting?: boolean }>`\n\tpadding-left: ${({ isDeleting }) => (isDeleting ? '11px' : '16px')};\n`;\n\nexport const DeleteButton = styled(Button).attrs({ variant: 'danger', size: 'small' })``;\n\nexport const DeleteButtonContainer = styled.div`\n\torder: 3;\n`;\n\nexport const Dots = styled.div`\n\tpadding-left: 8px;\n`;\n\nexport const EditButton = styled(Button).attrs({\n\tvariant: 'link',\n\tsize: 'small',\n})`\n\tmargin-left: auto;\n`;\n\nexport const EditCreditCardFormSection = styled.div`\n\tbackground-color: ${({ theme }) => theme.colors.gray4};\n\tdisplay: flex;\n\tflex-direction: column;\n\tfont-family: 'Source Sans Pro';\n\tpadding: ${({ theme }) => theme.space[5]};\n\tborder-bottom: 1px solid ${({ theme }) => theme.colors.borderColor};\n`;\n\nexport const EditText = styled.div`\n\tpadding-left: 8px;\n`;\n\nexport const ExpirationContainer = styled.div`\n\twidth: 81px;\n`;\n\nexport const ExpiredCardWarning = styled.div`\n\tcolor: ${({ theme }) => theme.colors.red4};\n\tfont-weight: ${({ theme }) => theme.fontWeights.semibold};\n\tfont-size: 14px;\n\tletter-spacing: 0.16px;\n\tline-height: 1.43;\n\tmargin-left: auto;\n`;\n\nexport const Name = styled.div`\n\tpadding-left: ${({ theme }) => theme.space[3]};\n`;\n\nexport const NewProfileButtons = styled.div`\n\tpadding-top: 12px;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\tflex-direction: row-reverse;\n`;\n\nexport const PaypalButton = styled(Button).attrs({\n\tvariant: `primary`,\n\tsize: `small`,\n})`\n\tmargin-left: auto;\n\tfont-size: 16px;\n`;\n\nexport const PayPalCopy = styled(Box).attrs({ marginBottom: 1 })``;\n\nexport const PayPalDelete = styled(Delete)`\n\tmargin-left: auto;\n`;\n\nexport const PayPalRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tborder-bottom: 1px solid ${({ theme }) => theme.colors.borderColor};\n\n\theight: auto;\n\n\tfont-size: 14px;\n\tline-height: 1.25;\n\tletter-spacing: 0.16px;\n\tcolor: ${({ theme }) => theme.colors.foregroundPrimary};\n\n\tpadding: 6px 16px;\n`;\n\nexport const StripeElementsItemContainer = styled(Box).attrs({ marginBottom: 4 })``;\n\nexport const StripeRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tborder-bottom: 1px solid ${({ theme }) => theme.colors.borderColor};\n\n\theight: auto;\n\n\tfont-size: 14px;\n\tline-height: 1.25;\n\tletter-spacing: 0.16px;\n\tcolor: ${({ theme }) => theme.colors.foregroundPrimary};\n\n\tpadding: 6px 16px;\n`;\n\nexport const RadioLabel = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n`;\n\nexport const SecurityCodeContainer = styled.div`\n\twidth: 105px;\n\tpadding-left: 8px;\n`;\n\nexport const Title = styled.div`\n\tfont-size: 16px;\n\tfont-weight: ${({ theme }) => theme.fontWeights.semibold};\n\tline-height: 1.33;\n\tcolor: ${({ theme }) => theme.colors.gray52};\n\tpadding: ${({ theme }) => theme.thickness3} ${({ theme }) => theme.space[6]} ${({ theme }) => theme.space[2]} 0;\n\ttext-align: center;\n\ttext-transform: uppercase;\n`;\n\nexport const InfoSvgContainer = styled.div`\n\tdisplay: flex;\n\theight: 100%;\n\tmargin-left: 6px;\n`;\n\nexport const InfoSvg = styled(InfoSvgUnstyled)`\n\tmargin: auto;\n`;\n\nexport const ToolTipContentContainer = styled.div`\n\tmax-width: 300px;\n`;\n\nexport const ToolTipContentTopParagraph = styled.p`\n\tmargin-top: 0;\n`;\n\nexport const Row = styled.div`\n\tdisplay: flex;\n`;\n","import React from 'react';\nimport { Radio } from '@faithlife/styled-ui';\nimport IBillingProfileDto from '../../clients/typings/orders/IBillingProfileDto';\nimport { useLocalization } from '../../Localization';\nimport { Amex, Discover, Mastercard, Visa, JCB, UnionPay, DiscoverPartner, DinersClub } from '../../sprites/svg';\nimport * as Styled from './styled';\n\nexport const SupportedBillingProfileTypes = ['PayFacCreditCard', 'CreditCard'].map(s => s.toLowerCase());\n\ninterface IBillingProfileProps {\n\tbillingProfile: IBillingProfileDto;\n\tonUpdate: Function;\n\tisSelected: boolean;\n\tonSelected: Function;\n\tindex: number;\n\tisEditing: boolean;\n}\n\nconst BillingProfile: React.FunctionComponent<IBillingProfileProps> = ({\n\tbillingProfile,\n\tonUpdate,\n\tisSelected,\n\tonSelected,\n\tindex,\n\tisEditing,\n}) => {\n\tconst now = new Date();\n\tconst strings = useLocalization();\n\n\t// Date.getMonth() is zero-indexed\n\tconst isExpired =\n\t\tbillingProfile.cardInfo &&\n\t\t(billingProfile.cardInfo.expirationYear < now.getFullYear() ||\n\t\t\t(billingProfile.cardInfo.expirationYear === now.getFullYear() &&\n\t\t\t\tbillingProfile.cardInfo.expirationMonth <= now.getMonth()));\n\n\tconst isHalfProfile = billingProfile.type === 'PayFacCreditCard';\n\n\tif (!SupportedBillingProfileTypes.includes(billingProfile.type.toLowerCase())) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Styled.CreditCardRow data-testid=\"credit-card-row\" data-test-index={index}>\n\t\t\t{/* TODO: make address-only profiles display properly. */}\n\t\t\t<Radio onClick={onSelected} isChecked={isSelected} type=\"button\" disabled={isExpired || isHalfProfile}>\n\t\t\t\t<Styled.RadioLabel>\n\t\t\t\t\t{billingProfile.cardInfo && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Styled.CardLogoContainer>\n\t\t\t\t\t\t\t\t{cardToSVG[billingProfile.cardInfo.creditCardProvider.toLowerCase()]}\n\t\t\t\t\t\t\t</Styled.CardLogoContainer>\n\t\t\t\t\t\t\t<Styled.Dots>{'••••'}</Styled.Dots>\n\t\t\t\t\t\t\t<Styled.CardNumber>{billingProfile.cardInfo.creditCardNumber}</Styled.CardNumber>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</Styled.RadioLabel>\n\t\t\t</Radio>\n\n\t\t\t{isExpired && (\n\t\t\t\t<Styled.ExpiredCardWarning data-testid=\"expired-label\">{strings.expired}</Styled.ExpiredCardWarning>\n\t\t\t)}\n\t\t\t{isHalfProfile && (\n\t\t\t\t<Styled.ExpiredCardWarning data-testid=\"half-profile-label\">{strings.invalid}</Styled.ExpiredCardWarning>\n\t\t\t)}\n\t\t\t{!isEditing && (\n\t\t\t\t<Styled.EditButton data-testid=\"edit-button-container\" onClick={() => onUpdate(billingProfile)}>\n\t\t\t\t\t<Styled.EditText>{strings.edit}</Styled.EditText>\n\t\t\t\t</Styled.EditButton>\n\t\t\t)}\n\t\t</Styled.CreditCardRow>\n\t);\n};\n\nexport const cardToSVG: Record<string, React.ReactElement> = {\n\tmastercard: <Mastercard className={''} />,\n\tvisa: <Visa className={''} />,\n\tamex: <Amex className={''} />,\n\tdiscover: <Discover className={''} />,\n\tjcb: <JCB className={''} />,\n\tunionpay: <UnionPay className={''} />,\n\tdiscoverpartner: <DiscoverPartner className={''} />,\n\tdinersclub: <DinersClub className={''} />,\n};\n\nexport default BillingProfile;\n","import styled from 'styled-components';\n\nexport const CreditCardRow = styled.div`\n\tfont-family: 'Source Sans Pro', Arial, Helvetica, sans-serif;\n\tdisplay: flex;\n\talign-items: center;\n\n\theight: 45px;\n\n\tfont-size: 16px;\n\tline-height: 1.25;\n\tletter-spacing: 0.16px;\n\tcolor: ${({ theme }) => theme.colors.foregroundPrimary};\n`;\n\nexport const CardLogoContainer = styled.div`\n\twidth: 38px;\n\theight: 26px;\n\tbackground: white;\n\tborder-radius: 5px;\n`;\n\nexport const CardInfoContainer = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tpadding-left: ${({ theme }) => theme.space[3]};\n`;\n\nexport const CardNumberContainer = styled.div`\n\tdisplay: flex;\n`;\n\nexport const CardNumber = styled.div`\n\tpadding-left: 6px;\n`;\n\nexport const Name = styled.div`\n\tpadding-left: ${({ theme }) => theme.space[3]};\n`;\n\nexport const ExpiredCardWarning = styled.div`\n\tcolor: ${({ theme }) => theme.colors.red4};\n\tfont-weight: ${({ theme }) => theme.fontWeights.semibold};\n\tfont-size: 14px;\n\tletter-spacing: 0.16px;\n\tline-height: 1.43;\n`;\n\nexport const Expiration = styled.div`\n\tfont-size: 12px;\n\tcolor: ${({ theme }) => theme.colors.gray52};\n`;\n","import React from 'react';\nimport { IBillingProfileDto } from '../../clients/typings/orders';\nimport { useLocalization } from '../../Localization';\nimport { PayPal } from '../../sprites/svg';\nimport { cardToSVG } from '../billing-profiles/billing-profile';\nimport * as Styled from './styled';\n\ninterface IBillingSummaryProps {\n\tbillingProfile: IBillingProfileDto;\n}\nconst BillingSummary: React.FunctionComponent<IBillingSummaryProps> = ({ billingProfile }) => {\n\tconst now = new Date();\n\tconst strings = useLocalization();\n\n\tconst isExpired =\n\t\tbillingProfile.cardInfo &&\n\t\t(billingProfile.cardInfo.expirationYear < now.getFullYear() ||\n\t\t\t(billingProfile.cardInfo.expirationYear === now.getFullYear() &&\n\t\t\t\tbillingProfile.cardInfo.expirationMonth <= now.getMonth()));\n\n\tif (billingProfile.type.toLowerCase() === 'paypal') {\n\t\treturn (\n\t\t\t<Styled.CreditCardRow data-testid=\"billing-summary\">\n\t\t\t\t<Styled.CardLogoContainer>\n\t\t\t\t\t<PayPal />\n\t\t\t\t</Styled.CardLogoContainer>\n\t\t\t\t<Styled.Name>{billingProfile.nameOnCard}</Styled.Name>\n\t\t\t</Styled.CreditCardRow>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.CreditCardRow data-testid=\"billing-summary\">\n\t\t\t<Styled.CardLogoContainer>\n\t\t\t\t{billingProfile.cardInfo ? cardToSVG[billingProfile.cardInfo.creditCardProvider.toLowerCase()] : null}\n\t\t\t</Styled.CardLogoContainer>\n\t\t\t<Styled.CardInfoContainer>\n\t\t\t\t<Styled.CardNumberContainer>\n\t\t\t\t\t<div>{'••••'}</div>\n\t\t\t\t\t<Styled.CardNumber>\n\t\t\t\t\t\t{billingProfile.cardInfo ? billingProfile.cardInfo.creditCardNumber : null}\n\t\t\t\t\t</Styled.CardNumber>\n\t\t\t\t</Styled.CardNumberContainer>\n\t\t\t\t{isExpired ? (\n\t\t\t\t\t<Styled.ExpiredCardWarning data-testid=\"expired-label\">{strings.expired}</Styled.ExpiredCardWarning>\n\t\t\t\t) : (\n\t\t\t\t\tbillingProfile.cardInfo && (\n\t\t\t\t\t\t<Styled.Expiration>\n\t\t\t\t\t\t\t{strings.expires} {billingProfile.cardInfo.expirationMonth.toString()}\n\t\t\t\t\t\t\t{'/'}\n\t\t\t\t\t\t\t{billingProfile.cardInfo.expirationYear.toString().slice(-2)}\n\t\t\t\t\t\t</Styled.Expiration>\n\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</Styled.CardInfoContainer>\n\t\t</Styled.CreditCardRow>\n\t);\n};\n\nexport default BillingSummary;\n","import React from 'react';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport { ThemeProvider } from 'styled-components';\nimport { theme as styledUITheme } from '@faithlife/styled-ui';\nimport BillingSummary from './billing-summary';\nimport { LocalizationProvider } from '../../Localization';\nimport ILocalizedResources from '../../typings/ILocalizedResources';\nimport defaultResources from '../../locales/en-US/resources.json';\nimport { IBillingProfileDto } from '../../clients/typings/orders';\n\ninterface IBillingSummaryProps {\n\tlocalizedResources: ILocalizedResources;\n\tbillingProfile: IBillingProfileDto;\n\ttheme?: any;\n}\n\nconst BillingSummaryWrapper: React.FunctionComponent<IBillingSummaryProps> = ({\n\tlocalizedResources,\n\tbillingProfile,\n\ttheme,\n}) => {\n\tconst resources = { ...defaultResources, ...localizedResources };\n\tconst queryClient = new QueryClient({\n\t\tdefaultOptions: {\n\t\t\tqueries: {\n\t\t\t\trefetchOnWindowFocus: false,\n\t\t\t},\n\t\t},\n\t});\n\n\treturn (\n\t\t<LocalizationProvider localizedResources={resources}>\n\t\t\t<ThemeProvider theme={() => ({ ...styledUITheme, ...theme })}>\n\t\t\t\t<QueryClientProvider client={queryClient}>\n\t\t\t\t\t<BillingSummary billingProfile={billingProfile}></BillingSummary>\n\t\t\t\t</QueryClientProvider>\n\t\t\t</ThemeProvider>\n\t\t</LocalizationProvider>\n\t);\n};\n\nexport default BillingSummaryWrapper;\n","enum AddressFieldKind {\n\tAddress1 = 'Address1',\n\tAddress2 = 'Address2',\n\tAddress3 = 'Address3',\n\tCity = 'City',\n\tSuburb = 'Suburb',\n\tPostalCode = 'PostalCode',\n\tState = 'State',\n}\n\nexport default AddressFieldKind;\n","import { Input as UnstyledInput } from '@faithlife/styled-ui';\nimport CleaveUnstyled from 'cleave.js/react';\nimport styled, { css } from 'styled-components';\n\n// Keep in sync with selectStyles in ./useSelectStyles.ts\nconst sharedInputStyles = css`\n\tdisplay: block;\n\tfont-size: 16px;\n\tline-height: 1.2;\n\tletter-spacing: 0.2px;\n\tbackground-color: ${({ theme }) => theme.colors.input.background};\n\tcolor: ${({ theme }) => theme.colors.input.foreground};\n\tborder: 1px solid ${({ theme }) => theme.colors.input.border};\n\tborder-radius: 3px;\n\tbox-sizing: border-box;\n\theight: 32px;\n\twidth: 100%;\n\tmargin: 0;\n\tpadding: 0 ${({ theme }) => theme.space[3]};\n\tfont-family: 'Source Sans Pro', sans-serif;\n\n\t&::placeholder {\n\t\tcolor: ${({ theme }) => theme.colors.input.placeholderForeground};\n\t}\n\n\t&:focus {\n\t\toutline: 0;\n\t\tbox-shadow: 0 0 0 2px ${({ theme }) => theme.colors.input.shadowFocused};\n\t}\n`;\n\nconst getSharedInvalidInputStyles = (isValid: boolean, theme: Record<string, any>) =>\n\t!isValid &&\n\tcss`\n\t\tborder-color: ${theme.colors.red4} !important;\n\t\tbox-shadow: 0 0 0 2px ${theme.colors.red2} !important;\n\n\t\t&:hover {\n\t\t\toutline: 1px auto ${theme.colors.red3};\n\t\t}\n\t`;\n\nexport const Cleave = styled(CleaveUnstyled)`\n\t&&& {\n\t\t${sharedInputStyles}\n\n\t\t// https://github.com/Faithlife/styled-ui/blob/4271e7c2905be725501d33790b7a982654703b0a/components/input/Input.jsx#L147\n\t\tbackground-color: ${({ disabled, theme }) =>\n\t\t\tdisabled ? theme.colors.input.backgroundReadOnly : theme.colors.input.background};\n\t\t// https://github.com/Faithlife/styled-ui/blob/f750db8eda9ea52fbaa915f313456f8ad88203e1/components/input/Input.jsx#L143\n\t\topacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n\n\t\t${({ $isValid, theme }) => getSharedInvalidInputStyles($isValid, theme)}};\n\t}\n`;\n\nexport const Input = styled(UnstyledInput)`\n\t&&& {\n\t\t${sharedInputStyles}\n\n\t\t${({ isValid, theme }) => getSharedInvalidInputStyles(isValid, theme)}\n\t}\n`;\n\nexport const InfoRow = styled.div`\n\tdisplay: flex;\n\tpadding-bottom: 16px;\n`;\n\nexport const AddressRow = styled.div`\n\tdisplay: flex;\n\tpadding-bottom: 12px;\n`;\n\nexport const AddressFormContainer = styled.div`\n\tpadding-top: 8px;\n`;\n\nexport const LabelText = styled.p`\n\t&&& {\n\t\tpadding-bottom: 6px;\n\t\tmargin: 0;\n\t}\n`;\n\nexport const Label = styled.label`\n\t&&& {\n\t\tfont-size: 16px;\n\t\tfont-weight: normal;\n\t\tcolor: ${({ theme }) => theme.shade70};\n\t\twidth: 100%;\n\t}\n`;\n\nexport const Asterisk = styled.span`\n\tcolor: #e97732;\n`;\n\nexport const CenteredContent = styled.div`\n\tdisplay: flex;\n\tjustify-content: center;\n`;\n","import deDE from '../locales/de-DE/resources.json';\nimport enUS from '../locales/en-US/resources.json';\nimport esMX from '../locales/es-MX/resources.json';\nimport frFR from '../locales/fr-FR/resources.json';\nimport koKR from '../locales/ko-KR/resources.json';\nimport ptBR from '../locales/pt-BR/resources.json';\nimport zhCN from '../locales/zh-CN/resources.json';\nimport zhTW from '../locales/zh-TW/resources.json';\nimport ILocalizedAddressFormResources from '../typings/ILocalizedAddressFormResources';\nimport Locales from '../typings/Locales';\n\nconst localesByName: { [key in Locales]: ILocalizedAddressFormResources } = {\n\t'de-DE': deDE,\n\t'en-US': enUS,\n\t'es-MX': esMX,\n\t'fr-FR': frFR,\n\t'ko-KR': koKR,\n\t'pt-BR': ptBR,\n\t'zh-CN': zhCN,\n\t'zh-TW': zhTW,\n};\n\nexport const useLocale = (locale: string): ILocalizedAddressFormResources => {\n\tif (!Object.keys(localesByName).includes(locale)) {\n\t\treturn enUS;\n\t}\n\n\treturn localesByName[locale as Locales];\n};\n","import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { components, createFilter } from 'react-select';\nimport { LoadingSpinner } from '@faithlife/styled-ui';\nimport { Select } from '@faithlife/styled-ui/text-input';\nimport AddressFieldKind from '../typings/AddressFieldKind';\nimport IAddressFormatItem from '../typings/IAddressFormatItem';\nimport IAddressInfo from '../typings/IAddressInfo';\nimport ICountry from '../typings/ICountry';\nimport ISelectOption from '../typings/ISelectOption';\nimport IState from '../typings/IState';\nimport nameof from '../utilities/nameof';\nimport * as Styled from './styled';\nimport { useSelectStyles } from './useSelectStyles';\nimport { useLocale } from './useLocale';\n\ninterface IAddressFormProps {\n\tinitialAddressInfo?: {\n\t\tcountryId?: string | null;\n\t\tstateId?: string | null;\n\t\tpostalCode?: string | null;\n\t};\n\taddressInfo: IAddressInfo;\n\tcountries: ICountry[];\n\tstatesByCountryId: Record<string, IState[]>;\n\tonSelectedCountryChanged: (countryId: string) => Promise<void>;\n\tupdateAddressInfo: (event: { target: { name: string; value: string } }) => void;\n\taddressFormatItems: IAddressFormatItem[];\n\tdefaultCountryOption?: {\n\t\tlabel: string;\n\t\tvalue: string;\n\t};\n\terrorByFieldName: any;\n\tlocale?: string;\n\tisReadOnly?: boolean;\n\thasLoadedAddressInfo: boolean;\n}\n\nconst CountryInput = ({ ...props }) => <components.Input {...props} autoComplete=\"country-name\" />;\n\nconst StateInput = ({ ...props }) => <components.Input {...props} autoComplete=\"address-level1\" />;\n\nconst toCamelCase = (source: string) => source.charAt(0).toLowerCase() + source.slice(1);\n\nconst AddressForm: React.FunctionComponent<IAddressFormProps> = ({\n\tinitialAddressInfo,\n\taddressInfo,\n\tcountries,\n\tstatesByCountryId,\n\tonSelectedCountryChanged,\n\tupdateAddressInfo,\n\taddressFormatItems,\n\tdefaultCountryOption = { label: 'United States', value: '840' },\n\terrorByFieldName,\n\tlocale = 'en-US',\n\tisReadOnly = false,\n\thasLoadedAddressInfo,\n}) => {\n\tconst [isCountryMenuOpen, setIsCountryMenuOpen] = useState<boolean>(false);\n\tconst [isStateMenuOpen, setIsStateMenuOpen] = useState<boolean>(false);\n\tconst [shouldCloseStateSelect, setShouldCloseStateSelect] = useState<boolean>(false);\n\tconst strings = useLocale(locale);\n\n\tconst initialCountryOption =\n\t\tinitialAddressInfo?.countryId &&\n\t\tcountries &&\n\t\tcountries\n\t\t\t.map(country => ({ label: country.name, value: country.countryId }))\n\t\t\t.find(country => country.value === initialAddressInfo.countryId);\n\n\tconst [stateOption, setStateOption] = useState<{ label: string; value: string }>({\n\t\tlabel: '',\n\t\tvalue: '',\n\t});\n\n\tconst [countryOption, setCountryOption] = useState<{ label: string; value: string }>(\n\t\tinitialCountryOption || defaultCountryOption\n\t);\n\n\t// Update `initialCountryOption` if `countries` hasn't loaded by the time this component renders.\n\tuseEffect(() => {\n\t\tif (\n\t\t\thasLoadedAddressInfo &&\n\t\t\tinitialCountryOption &&\n\t\t\tcountryOption === defaultCountryOption &&\n\t\t\tinitialCountryOption !== defaultCountryOption\n\t\t) {\n\t\t\tsetCountryOption(initialCountryOption);\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [hasLoadedAddressInfo]);\n\n\tconst mapStateToOption = useCallback(\n\t\t(state: IState) => ({\n\t\t\tabbreviation: state.abbreviation,\n\t\t\tlabel: state.name,\n\t\t\tvalue: state.stateId,\n\t\t}),\n\t\t[]\n\t);\n\n\tuseEffect(() => {\n\t\tconst initialStateOption =\n\t\t\tinitialAddressInfo?.countryId &&\n\t\t\tstatesByCountryId &&\n\t\t\tObject.prototype.hasOwnProperty.call(statesByCountryId, initialAddressInfo.countryId)\n\t\t\t\t? statesByCountryId[initialAddressInfo.countryId]\n\t\t\t\t\t\t.map(mapStateToOption)\n\t\t\t\t\t\t.find(stateDto => stateDto.value === initialAddressInfo.stateId)\n\t\t\t\t: null;\n\n\t\tif (initialStateOption) {\n\t\t\tsetStateOption(initialStateOption);\n\t\t}\n\t}, [initialAddressInfo?.countryId, initialAddressInfo?.stateId, statesByCountryId, mapStateToOption]);\n\n\tconst useStateSelector =\n\t\tObject.prototype.hasOwnProperty.call(statesByCountryId, addressInfo.countryId) &&\n\t\tstatesByCountryId[addressInfo.countryId] &&\n\t\tstatesByCountryId[addressInfo.countryId].length > 0;\n\n\tconst stateAddressFormat =\n\t\taddressFormatItems &&\n\t\t(addressFormatItems.find(\n\t\t\titem => item.kind === AddressFieldKind.State || item.kind === AddressFieldKind.Suburb\n\t\t) as IAddressFormatItem);\n\n\tconst postalCodeAddressFormat =\n\t\taddressFormatItems &&\n\t\t(addressFormatItems.find(item => item.kind === AddressFieldKind.PostalCode) as IAddressFormatItem);\n\n\tconst cityAddressFormat =\n\t\taddressFormatItems && (addressFormatItems.find(item => item.kind === AddressFieldKind.City) as IAddressFormatItem);\n\n\tuseEffect(() => {\n\t\tif (shouldCloseStateSelect) {\n\t\t\tsetShouldCloseStateSelect(false);\n\t\t}\n\t}, [shouldCloseStateSelect]);\n\n\tconst countryOptions = useMemo<ISelectOption[]>(\n\t\t() => countries.map(c => ({ label: c.name, value: c.countryId })).sort((a, b) => a.label.localeCompare(b.label)),\n\t\t[countries]\n\t);\n\n\tconst countriesByName = useMemo<Record<string, ICountry>>(\n\t\t() =>\n\t\t\tcountries.reduce<Record<string, ICountry>>((prev, cur) => {\n\t\t\t\tprev[cur.name.toLowerCase()] = cur;\n\n\t\t\t\treturn prev;\n\t\t\t}, {}),\n\t\t[countries]\n\t);\n\n\tconst stateOptions = useMemo(\n\t\t() =>\n\t\t\tObject.prototype.hasOwnProperty.call(statesByCountryId, addressInfo.countryId) &&\n\t\t\tstatesByCountryId[addressInfo.countryId]\n\t\t\t\t? statesByCountryId[addressInfo.countryId].map(mapStateToOption).sort((a, b) => a.label.localeCompare(b.label))\n\t\t\t\t: [],\n\t\t[addressInfo.countryId, statesByCountryId, mapStateToOption]\n\t);\n\n\tconst optionByState = useMemo(\n\t\t() =>\n\t\t\tObject.prototype.hasOwnProperty.call(statesByCountryId, addressInfo.countryId) &&\n\t\t\tstatesByCountryId[addressInfo.countryId]\n\t\t\t\t? statesByCountryId[addressInfo.countryId].reduce<\n\t\t\t\t\t\tRecord<string, { abbreviation: string; label: string; value: string }>\n\t\t\t\t\t>((acc, cur) => {\n\t\t\t\t\t\tconst option = mapStateToOption(cur);\n\t\t\t\t\t\tacc[cur.abbreviation.toLowerCase()] = option;\n\t\t\t\t\t\tacc[cur.name.toLowerCase()] = option;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {})\n\t\t\t\t: {},\n\t\t[addressInfo.countryId, statesByCountryId, mapStateToOption]\n\t);\n\n\tconst isValidField = useCallback(\n\t\t(fieldName: keyof IAddressInfo): boolean =>\n\t\t\tObject.prototype.hasOwnProperty.call(errorByFieldName, fieldName) ? false : true,\n\t\t[errorByFieldName]\n\t);\n\n\tconst { selectStyles } = useSelectStyles();\n\n\tuseEffect(() => {\n\t\t// Remove stateId if the country doesn't have states or doesn't have this state.\n\t\t// Guard with hasOwnProperty to ensure states have actually been fetched for this\n\t\t// country first — hasLoadedAddressInfo can briefly be true before statesByCountryId\n\t\t// is populated (react-query's isFetched updates separately from the onSuccess state\n\t\t// update), so we must not clear a valid stateId during that transient window.\n\t\tconst hasLoadedStatesForCountry = Object.prototype.hasOwnProperty.call(statesByCountryId, addressInfo.countryId);\n\t\tif (\n\t\t\thasLoadedAddressInfo &&\n\t\t\thasLoadedStatesForCountry &&\n\t\t\t((!useStateSelector && addressInfo.stateId) ||\n\t\t\t\t(addressInfo.stateId && !stateOptions.some(option => option.value === addressInfo.stateId)))\n\t\t) {\n\t\t\tupdateAddressInfo({\n\t\t\t\ttarget: {\n\t\t\t\t\tname: nameof<IAddressInfo>('stateId'),\n\t\t\t\t\tvalue: '',\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// Preserve \"suburb\" (Province) as the State when changing the country dropdown\n\t\tconst selectedOption = optionByState[addressInfo.suburb.toLocaleLowerCase()];\n\t\tif (!selectedOption || selectedOption.value === stateOption.value) {\n\t\t\treturn;\n\t\t}\n\t\tsetStateOption(selectedOption);\n\t\tupdateAddressInfo({\n\t\t\ttarget: {\n\t\t\t\tname: nameof<IAddressInfo>('suburb'),\n\t\t\t\tvalue: '',\n\t\t\t},\n\t\t});\n\t\tupdateAddressInfo({\n\t\t\ttarget: {\n\t\t\t\tname: nameof<IAddressInfo>('stateId'),\n\t\t\t\tvalue: selectedOption.value,\n\t\t\t},\n\t\t});\n\t}, [\n\t\taddressInfo.countryId,\n\t\taddressInfo.suburb,\n\t\taddressInfo.stateId,\n\t\toptionByState,\n\t\tstateOptions,\n\t\tstateOption.value,\n\t\tupdateAddressInfo,\n\t\tuseStateSelector,\n\t\thasLoadedAddressInfo,\n\t\tstatesByCountryId,\n\t]);\n\n\treturn (\n\t\t<Styled.AddressFormContainer>\n\t\t\t<Styled.InfoRow data-testid=\"country-selector-container\">\n\t\t\t\t<Styled.Label>\n\t\t\t\t\t<Styled.LabelText>{strings.country}</Styled.LabelText>\n\t\t\t\t\t<Select\n\t\t\t\t\t\tname={nameof<IAddressInfo>('countryId')}\n\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\tInput: CountryInput,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tplaceholder={strings.country}\n\t\t\t\t\t\tonChange={(option: any, { action, name }: { action: string; name: string }) => {\n\t\t\t\t\t\t\tif (action === 'select-option') {\n\t\t\t\t\t\t\t\tsetCountryOption(option);\n\t\t\t\t\t\t\t\tonSelectedCountryChanged(option.value);\n\t\t\t\t\t\t\t\tupdateAddressInfo({\n\t\t\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\tvalue: option.value,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonInputChange={(value: string, { action }: { action: string }) => {\n\t\t\t\t\t\t\tif (action === 'input-change') {\n\t\t\t\t\t\t\t\tconst country = countriesByName[value.toLowerCase()];\n\t\t\t\t\t\t\t\tif (country) {\n\t\t\t\t\t\t\t\t\tsetCountryOption({ label: country.name, value: country.countryId });\n\t\t\t\t\t\t\t\t\tonSelectedCountryChanged(country.countryId);\n\t\t\t\t\t\t\t\t\tupdateAddressInfo({\n\t\t\t\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\t\t\t\tname: nameof<IAddressInfo>('countryId'),\n\t\t\t\t\t\t\t\t\t\t\tvalue: country.countryId,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (!isCountryMenuOpen) {\n\t\t\t\t\t\t\t\t\t\tsetIsCountryMenuOpen(true);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\toptions={countryOptions}\n\t\t\t\t\t\tdefaultValue={initialCountryOption || defaultCountryOption}\n\t\t\t\t\t\tvalue={countryOption}\n\t\t\t\t\t\tstyles={selectStyles(\n\t\t\t\t\t\t\t!Object.prototype.hasOwnProperty.call(errorByFieldName, nameof<IAddressInfo>('countryId')),\n\t\t\t\t\t\t\tisReadOnly\n\t\t\t\t\t\t)}\n\t\t\t\t\t\taria-required=\"true\"\n\t\t\t\t\t\tisDisabled={isReadOnly}\n\t\t\t\t\t/>\n\t\t\t\t</Styled.Label>\n\t\t\t</Styled.InfoRow>\n\t\t\t<Styled.AddressRow>\n\t\t\t\t<Styled.Label>\n\t\t\t\t\t<Styled.LabelText>{strings.streetAddress}</Styled.LabelText>\n\t\t\t\t\t<Styled.Input\n\t\t\t\t\t\tname={nameof<IAddressInfo>('addressLine1')}\n\t\t\t\t\t\tautoComplete=\"address-line1\"\n\t\t\t\t\t\tisValid={isValidField('addressLine1')}\n\t\t\t\t\t\tdata-testid=\"address1\"\n\t\t\t\t\t\tonChange={updateAddressInfo}\n\t\t\t\t\t\tvalue={addressInfo.addressLine1}\n\t\t\t\t\t\tmaxLength=\"80\"\n\t\t\t\t\t\taria-required=\"true\"\n\t\t\t\t\t\tdisabled={isReadOnly}\n\t\t\t\t\t/>\n\t\t\t\t</Styled.Label>\n\t\t\t</Styled.AddressRow>\n\t\t\t<Styled.AddressRow>\n\t\t\t\t<Styled.Input\n\t\t\t\t\tname={nameof<IAddressInfo>('addressLine2')}\n\t\t\t\t\tautoComplete=\"address-line2\"\n\t\t\t\t\tisValid={isValidField('addressLine2')}\n\t\t\t\t\tdata-testid=\"address2\"\n\t\t\t\t\tonChange={updateAddressInfo}\n\t\t\t\t\tvalue={addressInfo.addressLine2}\n\t\t\t\t\tmaxLength=\"80\"\n\t\t\t\t\tdisabled={isReadOnly}\n\t\t\t\t/>\n\t\t\t</Styled.AddressRow>\n\t\t\t<Styled.InfoRow>\n\t\t\t\t<Styled.Input\n\t\t\t\t\tname={nameof<IAddressInfo>('addressLine3')}\n\t\t\t\t\tautoComplete=\"address-line3\"\n\t\t\t\t\tisValid={isValidField('addressLine3')}\n\t\t\t\t\tdata-testid=\"address3\"\n\t\t\t\t\tonChange={updateAddressInfo}\n\t\t\t\t\tvalue={addressInfo.addressLine3}\n\t\t\t\t\tmaxLength=\"80\"\n\t\t\t\t\tdisabled={isReadOnly}\n\t\t\t\t/>\n\t\t\t</Styled.InfoRow>\n\t\t\t<Styled.InfoRow>\n\t\t\t\t{cityAddressFormat && !cityAddressFormat.isOptional && (\n\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t<Styled.LabelText>{strings.city}</Styled.LabelText>\n\t\t\t\t\t\t<Styled.Input\n\t\t\t\t\t\t\tname={nameof<IAddressInfo>('city')}\n\t\t\t\t\t\t\tautoComplete=\"address-level2\"\n\t\t\t\t\t\t\tisValid={isValidField('city')}\n\t\t\t\t\t\t\tdata-testid=\"city\"\n\t\t\t\t\t\t\tonChange={updateAddressInfo}\n\t\t\t\t\t\t\tvalue={addressInfo.city}\n\t\t\t\t\t\t\taria-required=\"true\"\n\t\t\t\t\t\t\tdisabled={isReadOnly}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Styled.Label>\n\t\t\t\t)}\n\t\t\t</Styled.InfoRow>\n\t\t\t{hasLoadedAddressInfo && (\n\t\t\t\t<>\n\t\t\t\t\t<Styled.InfoRow>\n\t\t\t\t\t\t{useStateSelector && stateAddressFormat ? (\n\t\t\t\t\t\t\t<Styled.Label data-testid=\"state-selector-container\">\n\t\t\t\t\t\t\t\t<Styled.LabelText>\n\t\t\t\t\t\t\t\t\t{(strings as unknown as Record<string, string>)[toCamelCase(stateAddressFormat.name)]}\n\t\t\t\t\t\t\t\t</Styled.LabelText>\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tname={nameof<IAddressInfo>('stateId')}\n\t\t\t\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\t\t\t\tInput: StateInput,\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tplaceholder=\"—\"\n\t\t\t\t\t\t\t\t\tmenuIsOpen={isStateMenuOpen}\n\t\t\t\t\t\t\t\t\tdata-testid=\"state\"\n\t\t\t\t\t\t\t\t\tfilterOption={filterOption}\n\t\t\t\t\t\t\t\t\tonMenuOpen={() => setIsStateMenuOpen(true)}\n\t\t\t\t\t\t\t\t\tonMenuClose={() => setIsStateMenuOpen(false)}\n\t\t\t\t\t\t\t\t\tonChange={(option: any, { action, name }: { action: string; name: string }) => {\n\t\t\t\t\t\t\t\t\t\tif (action === 'select-option') {\n\t\t\t\t\t\t\t\t\t\t\tsetStateOption(option);\n\t\t\t\t\t\t\t\t\t\t\tupdateAddressInfo({\n\t\t\t\t\t\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: option.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonBlur={(e: any) => {\n\t\t\t\t\t\t\t\t\t\t// HACK: close the menu after the browser auto-fills the address\n\t\t\t\t\t\t\t\t\t\t// see https://github.com/JedWatson/react-select/issues/765\n\t\t\t\t\t\t\t\t\t\tif (!isStateMenuOpen) {\n\t\t\t\t\t\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsStateMenuOpen(false);\n\t\t\t\t\t\t\t\t\t\t\t\tif (document?.activeElement && document.activeElement instanceof HTMLElement) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdocument.activeElement.blur();\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}, 0);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst selectedOption = optionByState[e.target.value.toLowerCase()];\n\t\t\t\t\t\t\t\t\t\tif (!selectedOption) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetStateOption(selectedOption);\n\t\t\t\t\t\t\t\t\t\tupdateAddressInfo({\n\t\t\t\t\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\t\t\t\t\tname: nameof<IAddressInfo>('stateId'),\n\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedOption.value,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonFocus={() => setIsStateMenuOpen(true)}\n\t\t\t\t\t\t\t\t\toptions={stateOptions}\n\t\t\t\t\t\t\t\t\tvalue={stateOption}\n\t\t\t\t\t\t\t\t\tstyles={selectStyles(\n\t\t\t\t\t\t\t\t\t\t!Object.prototype.hasOwnProperty.call(errorByFieldName, nameof<IAddressInfo>('stateId')),\n\t\t\t\t\t\t\t\t\t\tisReadOnly\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\taria-required=\"true\"\n\t\t\t\t\t\t\t\t\tisDisabled={isReadOnly}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Styled.Label>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tstateAddressFormat &&\n\t\t\t\t\t\t\t!stateAddressFormat.isOptional && (\n\t\t\t\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t\t\t\t<Styled.LabelText>\n\t\t\t\t\t\t\t\t\t\t{(strings as unknown as Record<string, string>)[toCamelCase(stateAddressFormat.name)]}\n\t\t\t\t\t\t\t\t\t</Styled.LabelText>\n\t\t\t\t\t\t\t\t\t<Styled.Input\n\t\t\t\t\t\t\t\t\t\tname={nameof<IAddressInfo>('suburb')}\n\t\t\t\t\t\t\t\t\t\tautoComplete=\"address-level1\"\n\t\t\t\t\t\t\t\t\t\tisValid={isValidField('suburb')}\n\t\t\t\t\t\t\t\t\t\tonChange={updateAddressInfo}\n\t\t\t\t\t\t\t\t\t\tvalue={addressInfo.suburb}\n\t\t\t\t\t\t\t\t\t\taria-required=\"true\"\n\t\t\t\t\t\t\t\t\t\tdisabled={isReadOnly}\n\t\t\t\t\t\t\t\t\t></Styled.Input>\n\t\t\t\t\t\t\t\t</Styled.Label>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Styled.InfoRow>\n\t\t\t\t\t<Styled.InfoRow>\n\t\t\t\t\t\t{postalCodeAddressFormat && !postalCodeAddressFormat.isOptional && (\n\t\t\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t\t\t<Styled.LabelText>\n\t\t\t\t\t\t\t\t\t{(strings as unknown as Record<string, string>)[toCamelCase(postalCodeAddressFormat.name)]}\n\t\t\t\t\t\t\t\t</Styled.LabelText>\n\t\t\t\t\t\t\t\t<Styled.Input\n\t\t\t\t\t\t\t\t\tname={nameof<IAddressInfo>('postalCode')}\n\t\t\t\t\t\t\t\t\tautoComplete=\"postal-code\"\n\t\t\t\t\t\t\t\t\tisValid={isValidField('postalCode')}\n\t\t\t\t\t\t\t\t\tdata-testid=\"postal-code\"\n\t\t\t\t\t\t\t\t\tplaceholder={strings.placeholders.postalCode}\n\t\t\t\t\t\t\t\t\tonChange={updateAddressInfo}\n\t\t\t\t\t\t\t\t\tvalue={addressInfo.postalCode}\n\t\t\t\t\t\t\t\t\taria-required=\"true\"\n\t\t\t\t\t\t\t\t\tdisabled={isReadOnly}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Styled.Label>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Styled.InfoRow>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{hasLoadedAddressInfo ? null : (\n\t\t\t\t<Styled.CenteredContent>\n\t\t\t\t\t<LoadingSpinner variant=\"small\" />\n\t\t\t\t</Styled.CenteredContent>\n\t\t\t)}\n\t\t</Styled.AddressFormContainer>\n\t);\n};\n\nconst filterOptionByFullName = createFilter({\n\tmatchFrom: 'start',\n});\n\nconst filterOptionByAbbreviation = createFilter({\n\tmatchFrom: 'start',\n\tstringify(option: any) {\n\t\treturn option.data.abbreviation ?? '';\n\t},\n});\n\nfunction filterOption(option: any, input: any) {\n\treturn filterOptionByFullName(option, input) || filterOptionByAbbreviation(option, input);\n}\n\nexport default AddressForm;\n","import { useCallback } from 'react';\nimport { useTheme } from '@faithlife/styled-ui';\n\n// Keep in sync with Cleave an Input in ./styled.tsx\nexport const useSelectStyles = () => {\n\tconst theme = useTheme();\n\n\tconst selectStyles = useCallback(\n\t\t(isValid: boolean, isDisabled: boolean) => ({\n\t\t\tcontrol: (base: Record<string, unknown>) => {\n\t\t\t\treturn isValid\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...base,\n\t\t\t\t\t\t\tbackgroundColor: isDisabled ? theme.colors.input.backgroundReadOnly : theme.colors.input.background,\n\n\t\t\t\t\t\t\tborder: `1px solid ${theme.colors.gray34}`,\n\t\t\t\t\t\t\topacity: isDisabled ? 0.5 : base.opacity,\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...base,\n\t\t\t\t\t\t\tborder: `1px solid ${theme.colors.red4} !important`,\n\t\t\t\t\t\t\tboxShadow: `0 0 0 2px ${theme.colors.red2}`,\n\t\t\t\t\t\t\t'&:hover': {\n\t\t\t\t\t\t\t\toutline: `1px auto ${theme.colors.red3}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t},\n\t\t\tdropdownIndicator: (base: Record<string, unknown>) => ({\n\t\t\t\t...base,\n\t\t\t\tpaddingLeft: '6px',\n\t\t\t\tpaddingRight: '6px',\n\t\t\t}),\n\t\t\tsingleValue: (base: Record<string, unknown>) => ({\n\t\t\t\t...base,\n\t\t\t\tcolor: 'unset',\n\t\t\t}),\n\t\t}),\n\t\t[\n\t\t\ttheme.colors.input.background,\n\t\t\ttheme.colors.input.backgroundReadOnly,\n\t\t\ttheme.colors.red2,\n\t\t\ttheme.colors.red3,\n\t\t\ttheme.colors.red4,\n\t\t\ttheme.colors.gray34,\n\t\t]\n\t);\n\n\treturn { selectStyles };\n};\n","import { useCallback, useState } from 'react';\nimport { useQuery } from 'react-query';\nimport IAddressFormatItem from '../typings/IAddressFormatItem';\nimport ICountry from '../typings/ICountry';\nimport IState from '../typings/IState';\nimport { useLocale } from './useLocale';\n\nexport const useAddressFormData = (\n\tgetCountries: (proxyRoutePrefix?: string) => Promise<ICountry[]>,\n\tgetStatesForCountry: (countryId: string, proxyRoutePrefix?: string) => Promise<IState[]>,\n\tgetAddressFormatForCountry: (\n\t\tcountryId: string,\n\t\tproxyRoutePrefix?: string | null | undefined\n\t) => Promise<IAddressFormatItem[]>,\n\tactAndHandleException: (action: () => Promise<any>, actionDescription: string) => Promise<any>,\n\tlocale: string,\n\tproxyRoutePrefix = '',\n\tinitialCountryId?: string\n) => {\n\tconst unitedStatesCountryId = '840';\n\t// TODO: get from IP address if not provided\n\tconst [countryId, setCountryId] = useState<string>(initialCountryId || unitedStatesCountryId);\n\tconst [statesByCountryId, setStatesByCountryId] = useState<Record<string, IState[]>>({});\n\tconst strings = useLocale(locale);\n\n\tconst { data: countries = [], isFetched: hasLoadedCountries } = useQuery(\n\t\t'getCountries',\n\t\tasync () => await getCountries(proxyRoutePrefix),\n\t\t{\n\t\t\tstaleTime: Infinity,\n\t\t\tonError: error =>\n\t\t\t\tactAndHandleException(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t}, strings.fetchCountries),\n\t\t}\n\t);\n\n\tconst { isFetched: hasLoadedStates } = useQuery(\n\t\t['getStatesForCountry', countryId],\n\t\tasync () => await getStatesForCountry(countryId, proxyRoutePrefix),\n\t\t{\n\t\t\tstaleTime: Infinity,\n\t\t\tonSuccess: data => {\n\t\t\t\tif (!Object.prototype.hasOwnProperty.call(statesByCountryId, countryId)) {\n\t\t\t\t\tsetStatesByCountryId(prev => ({\n\t\t\t\t\t\t...prev,\n\t\t\t\t\t\t[countryId]: data,\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t},\n\t\t\tonError: error =>\n\t\t\t\tactAndHandleException(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t}, strings.failedToFetchStates),\n\t\t}\n\t);\n\n\tconst { data: addressFormatItems = [], isFetched: hasLoadedAddressFormat } = useQuery(\n\t\t['getAddressFormatForCountry', countryId],\n\t\tasync () => {\n\t\t\tif (!isNaN(Number(countryId))) {\n\t\t\t\treturn await getAddressFormatForCountry(countryId, proxyRoutePrefix);\n\t\t\t}\n\t\t\treturn [];\n\t\t},\n\t\t{\n\t\t\tstaleTime: Infinity,\n\t\t\tonError: error =>\n\t\t\t\tactAndHandleException(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t}, strings.failedToFetchAddressFormat),\n\t\t}\n\t);\n\n\tconst handleCountryChanged = useCallback(async (countryId: string) => setCountryId(countryId), []);\n\n\treturn {\n\t\tcountries,\n\t\tstatesByCountryId,\n\t\thandleCountryChanged,\n\t\taddressFormatItems,\n\t\thasLoadedAddressInfo: hasLoadedCountries && hasLoadedStates && hasLoadedAddressFormat,\n\t};\n};\n","import AddressForm from './components/address-form';\nimport { useAddressFormData } from './components/useAddressFormData';\nimport { Cleave, Input } from './components/styled';\n\nconst Styled = {\n\tCleave,\n\tInput,\n};\n\nexport { AddressForm, useAddressFormData, Styled };\n","export async function fetchJson(\n\turl,\n\t{ credentials = 'same-origin', method = 'GET', body = null, query = null, headers = {} } = {}\n) {\n\tconst queryString = query\n\t\t? Object.keys(query)\n\t\t\t\t.filter(key => !!query[key])\n\t\t\t\t.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)\n\t\t\t\t.join('&')\n\t\t: '';\n\tconst separator = queryString ? '?' : '';\n\n\tconst response = await fetch(`${url}${separator}${queryString}`, {\n\t\tmethod,\n\t\theaders: { 'Content-Type': 'application/json', Accept: 'application/json', ...headers },\n\t\tbody,\n\t\tcredentials,\n\t});\n\tif (!response.ok) {\n\t\tlet errorJson;\n\t\ttry {\n\t\t\terrorJson = await response.json();\n\t\t} catch (_) {\n\t\t\tconst error = new Error(`Request failed with code: ${response.status}`);\n\t\t\terror.response = response;\n\t\t\tthrow error;\n\t\t}\n\t\tthrow errorJson;\n\t}\n\n\treturn response.status !== 204 ? response.json() : null;\n}\n","enum AddressFieldKind {\n\tAddress1 = 'Address1',\n\tAddress2 = 'Address2',\n\tAddress3 = 'Address3',\n\tCity = 'City',\n\tSuburb = 'Suburb',\n\tPostalCode = 'PostalCode',\n\tState = 'State',\n}\n\nexport default AddressFieldKind;\n","import AddressFieldKind from './AddressFieldKind';\nimport IAddressFormatItem from './IAddressFormatItem';\nimport IAddressFormatItemDto from './IAddressFormatItemDto';\n\nexport default class AddressFormatMapper {\n\tpublic static mapAddressFormatItems(formatItems: IAddressFormatItemDto[]): IAddressFormatItem[] {\n\t\treturn formatItems.map(item => this.mapAddressFormatItem(item));\n\t}\n\n\tprivate static mapAddressFormatItem(item: IAddressFormatItemDto): IAddressFormatItem {\n\t\t// LocationsApi returns an AddressFormatItem whose kind and name appear to be inverted. We swap them here to help them be semantically correct\n\t\treturn {\n\t\t\tname: item.kind,\n\t\t\tkind: this.mapAddressFieldKind(item.name),\n\t\t\tformat: item.format || null,\n\t\t\tisOptional: item.name === 'PostalCode' ? false : item.isOptional,\n\t\t};\n\t}\n\n\tprivate static mapAddressFieldKind(kind: string) {\n\t\tif (!Object.values(AddressFieldKind).includes(kind as AddressFieldKind)) {\n\t\t\tthrow new Error('Address field kind out of range');\n\t\t}\n\n\t\treturn AddressFieldKind[kind as keyof typeof AddressFieldKind];\n\t}\n}\n","import { fetchJson } from './request';\nimport AddressFormatMapper from './typings/locations/AddressFormatMapper';\nimport IAddressFormatItem from './typings/locations/IAddressFormatItem';\nimport ICountriesDto from './typings/locations/ICountriesDto';\nimport ICountryDto from './typings/locations/ICountryDto';\nimport IStateDto from './typings/locations/IStateDto';\nimport IStatesDto from './typings/locations/IStatesDto';\nimport ProxyRoutePrefix from './typings/shared/ProxyRoutePrefix';\n\nclass LocationsClient {\n\tpublic static async getCountries(proxyRoutePrefix: ProxyRoutePrefix = ''): Promise<ICountryDto[]> {\n\t\tconst countries: ICountriesDto = await fetchJson(`${proxyRoutePrefix || ''}/proxy/locations/v1/countries`);\n\t\treturn countries.countries;\n\t}\n\n\tpublic static async getStatesForCountry(\n\t\tcountryId: string,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IStateDto[]> {\n\t\tconst states: IStatesDto = await fetchJson(\n\t\t\t`${proxyRoutePrefix || ''}/proxy/locations/v1/countries/${countryId}/states`\n\t\t);\n\t\treturn states.states;\n\t}\n\n\tpublic static async getAddressFormatForCountry(\n\t\tcountryId: string,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IAddressFormatItem[]> {\n\t\tconst addressFormatItems: any = await fetchJson(\n\t\t\t`${proxyRoutePrefix || ''}/proxy/locations/v1/addresses/${countryId}/format`\n\t\t);\n\t\treturn AddressFormatMapper.mapAddressFormatItems(addressFormatItems.orderedAddressFormatItems);\n\t}\n}\n\nexport { LocationsClient };\n","export default function nameof<T>(key: keyof T): keyof T {\n\treturn key;\n}\n","import CreditCardDetector from 'cleave.js/src/shortcuts/CreditCardDetector';\nimport IAddressFormatItem from '../clients/typings/locations/IAddressFormatItem';\nimport AddressFieldKind from '../clients/typings/locations/AddressFieldKind';\nimport IStateDto from '../clients/typings/locations/IStateDto';\nimport { IBillingProfileDto } from '../clients/typings/orders';\nimport ICreditCardDto from '../clients/typings/orders/ICreditCardDto';\nimport IError from '../clients/typings/orders/IError';\nimport IEditBillingProfile from '../typings/IEditBillingProfile';\nimport IEditCardInfo from '../typings/IEditCardInfo';\nimport IEditShippingProfile from '../typings/IEditShippingProfile';\nimport nameof from './nameof';\n\n// more-or-less from https://github.com/nosir/cleave.js/blob/f3e5d715109b9a51a36219d2751bb7b94734f066/src/shortcuts/CreditCardDetector.js#L21\n// jcb intentionally left out as the prefix could be 2131/1800/35\nconst cardNumberPrefixByType: Record<string, string> = {\n\tamex: '3',\n\tdiners: '3',\n\tdiscover: '6',\n\tinstapayment: '6',\n\tmir: '22',\n\tuatp: '1',\n\tunionPay: '62',\n\tvisa: '4',\n};\n\nexport const formatMaskedCardNumber = (maskedCardNumber: string, provider: string) => {\n\tconst maskCharacter = '•';\n\tconst lowercaseProvider = provider.toLowerCase();\n\n\tif (Object.prototype.hasOwnProperty.call(CreditCardDetector.blocks, lowercaseProvider)) {\n\t\tlet cardNumberPrefix = '';\n\t\tif (Object.prototype.hasOwnProperty.call(cardNumberPrefixByType, lowercaseProvider)) {\n\t\t\tcardNumberPrefix = cardNumberPrefixByType[lowercaseProvider];\n\t\t}\n\n\t\tconst blocks = CreditCardDetector.blocks[lowercaseProvider];\n\n\t\tconst firstSegment = `${cardNumberPrefix}${maskCharacter.repeat(blocks[0] - cardNumberPrefix.length)}`;\n\n\t\tconst middleSegments = [] as string[];\n\t\tfor (const block of blocks.slice(1, -1)) {\n\t\t\tmiddleSegments.push(maskCharacter.repeat(block));\n\t\t}\n\n\t\tconst lastSegment = `${maskCharacter.repeat(blocks.slice(-1) - maskedCardNumber.length)} ${maskedCardNumber}`;\n\n\t\t// regular spaces don't get rendered\n\t\tconst enspace = ' ';\n\t\treturn `${firstSegment}${enspace}${middleSegments.join(enspace)}${enspace}${lastSegment}`;\n\t}\n\n\treturn `xxxxxxxxxxxx${maskedCardNumber}`;\n};\n\nexport const areExpirationDatesValid = (expirationMonth: number, expirationYear: number) => {\n\tconst now = new Date();\n\tconst currentMonth = now.getMonth() + 1;\n\tconst currentYear = parseInt(now.getFullYear().toString().slice(-2));\n\n\treturn expirationYear > currentYear || (expirationYear === currentYear && expirationMonth >= currentMonth);\n};\n\nexport const normalizeExpiration = (expiration: string): string => {\n\tlet normalizedExpiration = expiration.replace(/ /, '');\n\n\tif (normalizedExpiration.includes('/')) {\n\t\tconst [expirationMonth, expirationYear] = normalizedExpiration.split('/');\n\n\t\tconst exampleDate = '12/34';\n\n\t\tif (normalizedExpiration.length > exampleDate.length) {\n\t\t\tnormalizedExpiration = `${expirationMonth}/${expirationYear.slice(-2)}`;\n\t\t}\n\t} else if (normalizedExpiration.length === '1234'.length) {\n\t\tnormalizedExpiration = `${normalizedExpiration.slice(0, 2)}/${normalizedExpiration.slice(-2)}`;\n\t}\n\n\treturn normalizedExpiration;\n};\n\nexport const isExpirationValid = (expiration: string) => {\n\tconst normalizedExpiration = normalizeExpiration(expiration);\n\n\tconst [expirationMonth, expirationYear] = normalizedExpiration.split('/');\n\n\treturn areExpirationDatesValid(Number.parseInt(expirationMonth), Number.parseInt(expirationYear));\n};\n\nconst editPropertyByOrdersProperty = {\n\t[nameof<IBillingProfileDto>('address1')]: nameof<IEditBillingProfile>('addressLine1'),\n\t[nameof<IBillingProfileDto>('address2')]: nameof<IEditBillingProfile>('addressLine2'),\n\t[nameof<IBillingProfileDto>('city')]: nameof<IEditBillingProfile>('city'),\n\t[nameof<IBillingProfileDto>('countryId')]: nameof<IEditBillingProfile>('countryId'),\n\t[nameof<IBillingProfileDto>('stateId')]: nameof<IEditBillingProfile>('stateId'),\n\t[nameof<IBillingProfileDto>('nameOnCard')]: nameof<IEditCardInfo>('nameOnCard'),\n\t[nameof<IBillingProfileDto>('postalCode')]: nameof<IEditCardInfo>('postalCode'),\n\t[nameof<ICreditCardDto>('expirationYear')]: nameof<IEditCardInfo>('expiration'),\n};\n\nexport const mapOrdersPropertyToEditProperty = (error: IError): IError => {\n\treturn {\n\t\tcode: error.code,\n\t\tmessage: error.message,\n\t\tproperty: editPropertyByOrdersProperty[error.property as string],\n\t};\n};\n\nexport const validateBillingProfile = (\n\tisEditingExistingProfile: boolean,\n\tbillingProfile: IEditBillingProfile,\n\tstatesByCountryId: Record<string, IStateDto[]>,\n\taddressFormatItems: IAddressFormatItem[]\n): IError[] => {\n\tconst countrySpecificFields = [\n\t\tAddressFieldKind.City,\n\t\tAddressFieldKind.Suburb,\n\t\tAddressFieldKind.State,\n\t\tAddressFieldKind.PostalCode,\n\t];\n\n\tconst requiredFieldsForCountry = addressFormatItems\n\t\t.filter(i => countrySpecificFields.includes(i.kind) && !i.isOptional)\n\t\t.map(i => mapAddressFieldKindToProfileProperty(i.kind));\n\n\tconst errors: IError[] = validateSimpleMissingValues(billingProfile, [\n\t\t'nameOnCard',\n\t\t'expiration',\n\t\t'addressLine1',\n\t\t'countryId',\n\t\t...requiredFieldsForCountry,\n\t]);\n\n\tif (\n\t\t!isEditingExistingProfile &&\n\t\t(billingProfile.cardInfo.cardNumber === null ||\n\t\t\t(billingProfile.cardInfo.cardNumber as number).toString().trim().length < 14)\n\t) {\n\t\terrors.push(missingValue('cardNumber'));\n\t}\n\n\tif (\n\t\t!isEditingExistingProfile &&\n\t\t(billingProfile.cardInfo.securityCode === null ||\n\t\t\t(billingProfile.cardInfo.securityCode as number).toString().trim().length < 3)\n\t) {\n\t\terrors.push(missingValue('securityCode'));\n\t}\n\n\tif (\n\t\t!isNullOrWhitespace(billingProfile.countryId as string) &&\n\t\tisNullOrWhitespace(billingProfile.stateId as string) &&\n\t\tObject.prototype.hasOwnProperty.call(statesByCountryId, billingProfile.countryId as string) &&\n\t\tstatesByCountryId[billingProfile.countryId as string].length > 0\n\t) {\n\t\terrors.push(missingValue('stateId'));\n\t}\n\n\tif (\n\t\t!isNullOrWhitespace(billingProfile.cardInfo.nameOnCard as string) &&\n\t\t(billingProfile.cardInfo.nameOnCard as string).match(potentialCardNumberPattern) !== null\n\t) {\n\t\terrors.push(badValue('nameOnCard', 'Name on card cannot be a credit card number'));\n\t}\n\n\tif (\n\t\t!isNullOrWhitespace(billingProfile.cardInfo.expiration as string) &&\n\t\t!isExpirationValid(billingProfile.cardInfo.expiration as string)\n\t) {\n\t\terrors.push(badValue('expiration', 'Expiration date is invalid'));\n\t}\n\n\tif (\n\t\t!isNullOrWhitespace(billingProfile.city as string) &&\n\t\t(billingProfile.city as string).match(potentialCardNumberPattern) !== null\n\t) {\n\t\terrors.push(badValue('city', 'City cannot be a credit card number'));\n\t}\n\n\treturn errors;\n};\n\nconst mapAddressFieldKindToProfileProperty = (\n\taddressFieldKind: AddressFieldKind\n): keyof IEditBillingProfile | keyof IEditCardInfo => {\n\tswitch (addressFieldKind) {\n\t\tcase AddressFieldKind.Address1:\n\t\t\treturn 'addressLine1';\n\t\tcase AddressFieldKind.Address2:\n\t\t\treturn 'addressLine2';\n\t\tcase AddressFieldKind.Address3:\n\t\t\treturn 'addressLine3';\n\t\tcase AddressFieldKind.City:\n\t\t\treturn 'city';\n\t\tcase AddressFieldKind.PostalCode:\n\t\t\treturn 'postalCode';\n\t\tcase AddressFieldKind.Suburb:\n\t\t\treturn 'suburb';\n\t\tcase AddressFieldKind.State:\n\t\t\treturn 'stateId';\n\t\tdefault:\n\t\t\tthrow new Error(`Unmapped AddressFieldKind: ${addressFieldKind}`);\n\t}\n};\n\nexport const validatePayFacBillingProfile = (\n\tuncommittedProfile: IEditBillingProfile,\n\tstatesByCountryId: Record<string, IStateDto[]>\n): IError[] => {\n\tconst errors: IError[] = validateSimpleMissingValues(uncommittedProfile, [\n\t\t'addressLine1',\n\t\t'city',\n\t\t'countryId',\n\t\t'postalCode',\n\t]);\n\n\tif (\n\t\t!isNullOrWhitespace(uncommittedProfile.countryId as string) &&\n\t\tisNullOrWhitespace(uncommittedProfile.stateId as string) &&\n\t\tObject.prototype.hasOwnProperty.call(statesByCountryId, uncommittedProfile.countryId as string) &&\n\t\tstatesByCountryId[uncommittedProfile.countryId as string].length > 0\n\t) {\n\t\terrors.push(missingValue('stateId'));\n\t}\n\treturn errors;\n};\n\nexport const validateShippingProfile = (\n\tuncommittedShippingProfile: IEditShippingProfile,\n\tstatesByCountryId: Record<string, IStateDto[]>,\n\tformatItems: IAddressFormatItem[]\n): IError[] => {\n\tconst errors: IError[] = validateSimpleMissingShippingAddressValues(uncommittedShippingProfile, [\n\t\tnameof<IEditShippingProfile>('name'),\n\t\tnameof<IEditShippingProfile>('addressLine1'),\n\t\tnameof<IEditShippingProfile>('countryId'),\n\t]);\n\n\tif (\n\t\t!isNullOrWhitespace(uncommittedShippingProfile.countryId) &&\n\t\tisNullOrWhitespace(uncommittedShippingProfile.stateId) &&\n\t\tstatesByCountryId[uncommittedShippingProfile.countryId as string]?.length > 0\n\t) {\n\t\terrors.push(missingValue(nameof<IEditShippingProfile>('stateId')));\n\t}\n\n\tfor (const formatItem of formatItems) {\n\t\tconst shippingProfileProperty = editShippingProfileKindsByFormatItemKinds[formatItem.kind];\n\t\tconst shippingProfilePropertyValue = uncommittedShippingProfile[shippingProfileProperty];\n\n\t\tif (!formatItem.isOptional && isNullOrWhitespace(shippingProfilePropertyValue)) {\n\t\t\terrors.push(missingValue(shippingProfileProperty));\n\t\t}\n\n\t\tif (\n\t\t\t!isNullOrWhitespace(formatItem.format) &&\n\t\t\t!isNullOrWhitespace(shippingProfilePropertyValue) &&\n\t\t\t!(shippingProfilePropertyValue as string).match(formatItem.format as string)\n\t\t) {\n\t\t\terrors.push(badValue(shippingProfileProperty, `value must be of format ${formatItem.format}.`));\n\t\t}\n\t}\n\n\treturn errors;\n};\n\nconst editShippingProfileKindsByFormatItemKinds = {\n\t[AddressFieldKind.Address1]: nameof<IEditShippingProfile>('addressLine1'),\n\t[AddressFieldKind.Address2]: nameof<IEditShippingProfile>('addressLine2'),\n\t[AddressFieldKind.Address3]: nameof<IEditShippingProfile>('addressLine3'),\n\t[AddressFieldKind.City]: nameof<IEditShippingProfile>('city'),\n\t[AddressFieldKind.Suburb]: nameof<IEditShippingProfile>('suburb'),\n\t[AddressFieldKind.PostalCode]: nameof<IEditShippingProfile>('postalCode'),\n\t[AddressFieldKind.State]: nameof<IEditShippingProfile>('stateId'),\n};\n\n// from https://github.com/LogosBible/Hermes/blob/d9ef2bde608f4514209753e7ace4377af4bbecdf/src/Hermes.Utility/CreditCardUtility.cs#L30\nconst potentialCardNumberPattern = /(?:18|60|[34]\\d|5[1-5]|2[0-1]|86)(?:\\d[\\W_]?){8,11}\\d{3}/gi;\n\nconst isNullOrWhitespace = (s: string | null | undefined): boolean => s === undefined || s === null || s.trim() === '';\n\nconst validateSimpleMissingValues = (\n\tprofile: IEditBillingProfile,\n\tproperties: (keyof IEditBillingProfile | keyof IEditCardInfo)[]\n): IError[] => {\n\tconst errors = [] as any;\n\tfor (const property of properties) {\n\t\tlet value = '';\n\t\tif (Object.prototype.hasOwnProperty.call(profile, property)) {\n\t\t\tvalue = (profile as Record<string, any>)[property as string];\n\t\t} else if (Object.prototype.hasOwnProperty.call(profile.cardInfo, property)) {\n\t\t\tvalue = (profile.cardInfo as Record<string, any>)[property as string];\n\t\t}\n\t\tif (isNullOrWhitespace(value)) {\n\t\t\terrors.push(missingValue(property));\n\t\t}\n\t}\n\treturn errors;\n};\n\nconst validateSimpleMissingShippingAddressValues = (\n\tprofile: IEditShippingProfile,\n\tproperties: (keyof IEditShippingProfile)[]\n): IError[] => {\n\tconst errors = [] as any;\n\tfor (const property of properties) {\n\t\tlet value = '';\n\t\tif (Object.prototype.hasOwnProperty.call(profile, property)) {\n\t\t\tvalue = profile[property] as string;\n\t\t}\n\n\t\tif (isNullOrWhitespace(value)) {\n\t\t\terrors.push(missingValue(property));\n\t\t}\n\t}\n\treturn errors;\n};\n\nconst missingValue = (property: keyof IEditBillingProfile | keyof IEditCardInfo | keyof IEditShippingProfile) => ({\n\tcode: 'MissingValue',\n\tproperty,\n});\n\nconst badValue = (\n\tproperty: keyof IEditBillingProfile | keyof IEditCardInfo | keyof IEditShippingProfile,\n\tmessage: string\n) => ({\n\tcode: 'BadValue',\n\tproperty,\n\tmessage,\n});\n","import { Button, Checkbox as UnstyledCheckbox } from '@faithlife/styled-ui';\nimport styled from 'styled-components';\n\nexport const ShippingAddressContainer = styled.div<{ isLoading: boolean }>`\n\tfont-family: 'Source Sans Pro', Arial, Helvetica, sans-serif;\n\tmax-width: 327px;\n\toverflow-y: auto;\n\toverflow-x: hidden;\n\tborder: 1px solid ${({ theme }) => theme.colors.gray4};\n\tborder-radius: 3px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tbackground-color: #f5f5f5;\n\n\t&&& {\n\t\t${props =>\n\t\t\tprops.isLoading && {\n\t\t\t\talignItems: 'center',\n\t\t\t\toverflowY: 'hidden',\n\t\t\t\tpadding: '16px',\n\t\t\t}}\n\t}\n`;\n\nexport const Form = styled.div`\n\tpadding: ${({ theme }) => theme.space[5]};\n`;\n\nexport const Row = styled.div`\n\tdisplay: flex;\n\tpadding-bottom: 12px;\n`;\n\nexport const Label = styled.label`\n\t&&& {\n\t\tfont-size: 16px;\n\t\tfont-weight: normal;\n\t\tcolor: ${({ theme }) => theme.colors.gray52};\n\t\twidth: 100%;\n\t}\n`;\n\nexport const Checkbox = styled(UnstyledCheckbox)`\n\tmargin: ${({ theme }) => theme.space[3]} 0;\n`;\n\nexport const LabelText = styled.p`\n\t&&& {\n\t\tpadding-bottom: 6px;\n\t\tmargin: 0;\n\t}\n`;\n\nexport const ButtonContainer = styled.div`\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tflex-wrap: wrap;\n`;\n\nexport const CancelButton = styled(Button).attrs({ variant: 'secondary', size: 'small' })`\n\tmargin-top: ${({ theme }) => theme.space[5]};\n`;\n\nexport const NextButton = styled(Button).attrs({ variant: 'primary', size: 'small' })`\n\tmargin-top: ${({ theme }) => theme.space[5]};\n\tmargin-left: ${({ theme }) => theme.space[5]};\n`;\n","import { LoadingSpinner } from '@faithlife/styled-ui';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { AddressForm, useAddressFormData, Styled as SharedStyled } from '../../../address-form';\nimport { LocationsClient } from '../../clients/locations-client';\nimport IError from '../../clients/typings/orders/IError';\nimport { useLocalization } from '../../Localization';\nimport IEditBillingProfile from '../../typings/IEditBillingProfile';\nimport { IBillingProfileDto } from '../../clients/typings/orders';\nimport IEditShippingProfile from '../../typings/IEditShippingProfile';\nimport { ISystemMessage } from '../../typings/ISystemMessage';\nimport { mapOrdersPropertyToEditProperty, validateShippingProfile } from '../../utilities/credit-card-utils';\nimport nameof from '../../utilities/nameof';\nimport * as Styled from './styled';\n\nconst unitedStatesCountryId = '840';\nconst defaultCountryOption = { label: 'United States', value: unitedStatesCountryId };\n\ninterface IShippingAddressFormProps {\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tactAndHandleException: (action: () => Promise<any>, actionDescription: string) => Promise<any>;\n\tbillingProfile?: IEditBillingProfile;\n\tstripeBillingProfile?: IBillingProfileDto;\n\tshippingProfile?: IEditShippingProfile;\n\tonCancelClicked?: () => void;\n\tonCommitClicked: (profile: IEditShippingProfile) => Promise<void>;\n\tproxyRoutePrefix?: string;\n\tlocale: string;\n}\n\nconst ShippingAddressForm: React.FunctionComponent<IShippingAddressFormProps> = ({\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tsetSystemMessage: _setSystemMessage,\n\tactAndHandleException,\n\tbillingProfile,\n\tstripeBillingProfile,\n\tshippingProfile,\n\tonCancelClicked,\n\tonCommitClicked,\n\tproxyRoutePrefix = '',\n\tlocale,\n}) => {\n\tconst [useBilling, setUseBilling] = useState<boolean>(true);\n\tconst [clientValidationErrors, setClientValidationErrors] = useState<IError[]>([]);\n\tconst [isProcessing, setIsProcessing] = useState<boolean>(false);\n\n\tconst initialShippingProfile = billingProfile\n\t\t? {\n\t\t\t\tname: (billingProfile.cardInfo && billingProfile.cardInfo.nameOnCard) || null,\n\t\t\t\torganization: null,\n\t\t\t\taddressLine1: billingProfile.addressLine1,\n\t\t\t\taddressLine2: billingProfile.addressLine2,\n\t\t\t\taddressLine3: billingProfile.addressLine3,\n\t\t\t\tpostalCode: (billingProfile.cardInfo && billingProfile.cardInfo.postalCode) || null,\n\t\t\t\tcity: billingProfile.city,\n\t\t\t\tsuburb: billingProfile.suburb,\n\t\t\t\tstateId: billingProfile.stateId,\n\t\t\t\tcountryId: billingProfile.countryId,\n\t\t\t}\n\t\t: stripeBillingProfile\n\t\t\t? {\n\t\t\t\t\tname: stripeBillingProfile.nameOnCard,\n\t\t\t\t\torganization: null,\n\t\t\t\t\taddressLine1: stripeBillingProfile.address1,\n\t\t\t\t\taddressLine2: stripeBillingProfile.address2,\n\t\t\t\t\taddressLine3: stripeBillingProfile.address3,\n\t\t\t\t\tpostalCode: stripeBillingProfile.postalCode,\n\t\t\t\t\tcity: stripeBillingProfile.city,\n\t\t\t\t\tsuburb: null,\n\t\t\t\t\tstateId: stripeBillingProfile.stateId.toString(),\n\t\t\t\t\tcountryId: stripeBillingProfile.countryId.toString(),\n\t\t\t\t}\n\t\t\t: shippingProfile\n\t\t\t\t? {\n\t\t\t\t\t\tname: shippingProfile.name,\n\t\t\t\t\t\torganization: shippingProfile.organization,\n\t\t\t\t\t\taddressLine1: shippingProfile.addressLine1,\n\t\t\t\t\t\taddressLine2: shippingProfile.addressLine2,\n\t\t\t\t\t\taddressLine3: shippingProfile.addressLine3,\n\t\t\t\t\t\tpostalCode: shippingProfile.postalCode,\n\t\t\t\t\t\tcity: shippingProfile.city,\n\t\t\t\t\t\tsuburb: shippingProfile.suburb,\n\t\t\t\t\t\tstateId: shippingProfile.stateId,\n\t\t\t\t\t\tcountryId: shippingProfile.countryId,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tname: null,\n\t\t\t\t\t\torganization: null,\n\t\t\t\t\t\taddressLine1: null,\n\t\t\t\t\t\taddressLine2: null,\n\t\t\t\t\t\taddressLine3: null,\n\t\t\t\t\t\tpostalCode: null,\n\t\t\t\t\t\tcity: null,\n\t\t\t\t\t\tsuburb: null,\n\t\t\t\t\t\tstateId: null,\n\t\t\t\t\t\tcountryId: defaultCountryOption.value,\n\t\t\t\t\t};\n\n\tconst [uncommittedShippingProfile, setUncommittedShippingProfile] =\n\t\tuseState<IEditShippingProfile>(initialShippingProfile);\n\n\tconst isMounted = useRef(false);\n\n\tuseEffect(() => {\n\t\tisMounted.current = true;\n\n\t\treturn () => {\n\t\t\tisMounted.current = false;\n\t\t};\n\t}, []);\n\n\tconst strings = useLocalization();\n\tconst { addressFormatItems, countries, handleCountryChanged, statesByCountryId, hasLoadedAddressInfo } =\n\t\tuseAddressFormData(\n\t\t\tLocationsClient.getCountries,\n\t\t\tLocationsClient.getStatesForCountry,\n\t\t\tLocationsClient.getAddressFormatForCountry,\n\t\t\tactAndHandleException,\n\t\t\tlocale,\n\t\t\tproxyRoutePrefix,\n\t\t\tinitialShippingProfile.countryId || undefined\n\t\t);\n\n\tconst serverValidationErrors: IError[] = [];\n\n\t// TODO: test serverValidationErrors\n\tconst errorByFieldName = serverValidationErrors\n\t\t.map(mapOrdersPropertyToEditProperty)\n\t\t.concat(clientValidationErrors)\n\t\t.reduce<Record<string, string>>((acc, cur) => {\n\t\t\tacc[cur.property || ''] = cur.code;\n\t\t\treturn acc;\n\t\t}, {});\n\n\tconst updateShippingProfile = useCallback((event: { target: { name: string; value: string } }) => {\n\t\tconst name = event.target.name;\n\t\tconst value = event.target.value;\n\t\tsetUncommittedShippingProfile(prevState => ({\n\t\t\t...prevState,\n\t\t\t[name]: value,\n\t\t}));\n\t}, []);\n\n\tconst handleCommitClicked = useCallback(async () => {\n\t\tsetIsProcessing(true);\n\t\tconst errors = validateShippingProfile(uncommittedShippingProfile, statesByCountryId, addressFormatItems);\n\t\tsetClientValidationErrors(errors);\n\n\t\tif (errors.length === 0) {\n\t\t\tconst shippingAddress = {\n\t\t\t\t...uncommittedShippingProfile,\n\t\t\t\tcountryAlpha2: countries.find(country => country.countryId === uncommittedShippingProfile.countryId)?.alpha2,\n\t\t\t\tstate: statesByCountryId[uncommittedShippingProfile.countryId as string]?.find(\n\t\t\t\t\tstate => state.stateId === uncommittedShippingProfile.stateId\n\t\t\t\t)?.abbreviation,\n\t\t\t};\n\n\t\t\tawait onCommitClicked(shippingAddress);\n\t\t}\n\n\t\tif (isMounted.current) {\n\t\t\tsetIsProcessing(false);\n\t\t}\n\t}, [uncommittedShippingProfile, statesByCountryId, countries, onCommitClicked, addressFormatItems]);\n\n\tconst handleUseBillingChange = useCallback(() => {\n\t\tsetUncommittedShippingProfile(\n\t\t\tuseBilling\n\t\t\t\t? {\n\t\t\t\t\t\tname: null,\n\t\t\t\t\t\torganization: null,\n\t\t\t\t\t\taddressLine1: null,\n\t\t\t\t\t\taddressLine2: null,\n\t\t\t\t\t\taddressLine3: null,\n\t\t\t\t\t\tpostalCode: null,\n\t\t\t\t\t\tcity: null,\n\t\t\t\t\t\tstateId: null,\n\t\t\t\t\t\tcountryId: defaultCountryOption.value,\n\t\t\t\t\t}\n\t\t\t\t: billingProfile\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tname: billingProfile?.cardInfo?.nameOnCard || null,\n\t\t\t\t\t\t\torganization: null,\n\t\t\t\t\t\t\taddressLine1: billingProfile?.addressLine1 || null,\n\t\t\t\t\t\t\taddressLine2: billingProfile?.addressLine2 || null,\n\t\t\t\t\t\t\taddressLine3: billingProfile?.addressLine3 || null,\n\t\t\t\t\t\t\tpostalCode: billingProfile?.cardInfo?.postalCode || null,\n\t\t\t\t\t\t\tcity: billingProfile?.city || null,\n\t\t\t\t\t\t\tstateId: billingProfile?.stateId || null,\n\t\t\t\t\t\t\tcountryId: billingProfile?.countryId || null,\n\t\t\t\t\t\t}\n\t\t\t\t\t: stripeBillingProfile\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tname: stripeBillingProfile.nameOnCard,\n\t\t\t\t\t\t\t\torganization: null,\n\t\t\t\t\t\t\t\taddressLine1: stripeBillingProfile.address1,\n\t\t\t\t\t\t\t\taddressLine2: stripeBillingProfile.address2,\n\t\t\t\t\t\t\t\taddressLine3: stripeBillingProfile.address3,\n\t\t\t\t\t\t\t\tpostalCode: stripeBillingProfile.postalCode,\n\t\t\t\t\t\t\t\tcity: stripeBillingProfile.city,\n\t\t\t\t\t\t\t\tstateId: stripeBillingProfile.stateId.toString(),\n\t\t\t\t\t\t\t\tcountryId: stripeBillingProfile.countryId.toString(),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tname: null,\n\t\t\t\t\t\t\t\torganization: null,\n\t\t\t\t\t\t\t\taddressLine1: null,\n\t\t\t\t\t\t\t\taddressLine2: null,\n\t\t\t\t\t\t\t\taddressLine3: null,\n\t\t\t\t\t\t\t\tpostalCode: null,\n\t\t\t\t\t\t\t\tcity: null,\n\t\t\t\t\t\t\t\tstateId: null,\n\t\t\t\t\t\t\t\tcountryId: defaultCountryOption.value,\n\t\t\t\t\t\t\t}\n\t\t);\n\t\tsetUseBilling(!useBilling);\n\t}, [useBilling, billingProfile, stripeBillingProfile]);\n\n\treturn (\n\t\t<Styled.ShippingAddressContainer isLoading={!hasLoadedAddressInfo}>\n\t\t\t{!hasLoadedAddressInfo && <LoadingSpinner variant=\"medium\" />}\n\t\t\t<Styled.Form style={!hasLoadedAddressInfo ? { display: 'none' } : {}}>\n\t\t\t\t{!shippingProfile &&\n\t\t\t\t\t((stripeBillingProfile !== null && stripeBillingProfile !== undefined) || billingProfile) && (\n\t\t\t\t\t\t<Styled.Row>\n\t\t\t\t\t\t\t<Styled.Checkbox\n\t\t\t\t\t\t\t\tonClick={handleUseBillingChange}\n\t\t\t\t\t\t\t\tisChecked={useBilling}\n\t\t\t\t\t\t\t\ttitle={strings.sameAsBilling}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Styled.Row>\n\t\t\t\t\t)}\n\t\t\t\t<Styled.Row>\n\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t<Styled.LabelText>{strings.name}</Styled.LabelText>\n\t\t\t\t\t\t<SharedStyled.Input\n\t\t\t\t\t\t\tname={'name'}\n\t\t\t\t\t\t\tautoComplete=\"name\"\n\t\t\t\t\t\t\tonChange={updateShippingProfile}\n\t\t\t\t\t\t\tisValid={!errorByFieldName[nameof<IEditShippingProfile>('name')]}\n\t\t\t\t\t\t\tdata-testid=\"name\"\n\t\t\t\t\t\t\tvalue={uncommittedShippingProfile.name}\n\t\t\t\t\t\t\tborder={'1px solid #a8a8a8'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Styled.Label>\n\t\t\t\t</Styled.Row>\n\t\t\t\t<Styled.Row>\n\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t<Styled.LabelText>{strings.organization}</Styled.LabelText>\n\t\t\t\t\t\t<SharedStyled.Input\n\t\t\t\t\t\t\tname={'organization'}\n\t\t\t\t\t\t\tautoComplete=\"organization\"\n\t\t\t\t\t\t\tonChange={updateShippingProfile}\n\t\t\t\t\t\t\tisValid={!errorByFieldName[nameof<IEditShippingProfile>('organization')]}\n\t\t\t\t\t\t\tvalue={uncommittedShippingProfile.organization}\n\t\t\t\t\t\t\tborder={'1px solid #a8a8a8'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Styled.Label>\n\t\t\t\t</Styled.Row>\n\t\t\t\t<AddressForm\n\t\t\t\t\tinitialAddressInfo={{\n\t\t\t\t\t\tcountryId: initialShippingProfile.countryId,\n\t\t\t\t\t\tpostalCode: initialShippingProfile.postalCode,\n\t\t\t\t\t\tstateId: initialShippingProfile.stateId,\n\t\t\t\t\t}}\n\t\t\t\t\taddressInfo={{\n\t\t\t\t\t\taddressLine1: uncommittedShippingProfile.addressLine1 || '',\n\t\t\t\t\t\taddressLine2: uncommittedShippingProfile.addressLine2 || '',\n\t\t\t\t\t\taddressLine3: uncommittedShippingProfile.addressLine3 || '',\n\t\t\t\t\t\tcity: uncommittedShippingProfile.city || '',\n\t\t\t\t\t\tcountryId: uncommittedShippingProfile.countryId || '',\n\t\t\t\t\t\tpostalCode: uncommittedShippingProfile.postalCode || '',\n\t\t\t\t\t\tstateId: uncommittedShippingProfile.stateId || '',\n\t\t\t\t\t\tsuburb: uncommittedShippingProfile.suburb || '',\n\t\t\t\t\t}}\n\t\t\t\t\tcountries={countries}\n\t\t\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\t\t\tonSelectedCountryChanged={handleCountryChanged}\n\t\t\t\t\tupdateAddressInfo={updateShippingProfile}\n\t\t\t\t\taddressFormatItems={addressFormatItems}\n\t\t\t\t\tdefaultCountryOption={defaultCountryOption}\n\t\t\t\t\terrorByFieldName={errorByFieldName}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t\thasLoadedAddressInfo={hasLoadedAddressInfo}\n\t\t\t\t/>\n\t\t\t\t<Styled.ButtonContainer>\n\t\t\t\t\t{onCancelClicked && (\n\t\t\t\t\t\t<Styled.CancelButton onClick={onCancelClicked} disabled={isProcessing}>\n\t\t\t\t\t\t\t{strings.cancel}\n\t\t\t\t\t\t</Styled.CancelButton>\n\t\t\t\t\t)}\n\t\t\t\t\t<Styled.NextButton\n\t\t\t\t\t\tdata-testid=\"submit-address-form-button\"\n\t\t\t\t\t\tonClick={handleCommitClicked}\n\t\t\t\t\t\tdisabled={isProcessing}\n\t\t\t\t\t>\n\t\t\t\t\t\t{billingProfile || shippingProfile || stripeBillingProfile ? strings.save : strings.create}\n\t\t\t\t\t</Styled.NextButton>\n\t\t\t\t</Styled.ButtonContainer>\n\t\t\t</Styled.Form>\n\t\t</Styled.ShippingAddressContainer>\n\t);\n};\n\nexport { ShippingAddressForm };\n","import { theme as styledUITheme } from '@faithlife/styled-ui';\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport { ThemeProvider } from 'styled-components';\nimport defaultResources from '../../locales/en-US/resources.json';\nimport { LocalizationProvider } from '../../Localization';\nimport IEditBillingProfile from '../../typings/IEditBillingProfile';\nimport IEditShippingProfile from '../../typings/IEditShippingProfile';\nimport ILocalizedResources from '../../typings/ILocalizedResources';\nimport { ISystemMessage } from '../../typings/ISystemMessage';\nimport { ShippingAddressForm } from './shipping-address-form';\nimport { IBillingProfileDto } from '../../clients/typings/orders';\n\ninterface IShippingProps {\n\t/** Called when component needs to display a message to user after actions were taken. */\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tlocalizedResources: ILocalizedResources;\n\t/** Called in functions that have network calls that could fail. */\n\tactAndHandleException: (action: () => Promise<any>, actionDescription: string) => Promise<any>;\n\tonCancelClicked?: () => void;\n\tonCommitClicked: (profile: IEditShippingProfile) => Promise<void>;\n\tbillingProfile?: IEditBillingProfile;\n\tstripeBillingProfile?: IBillingProfileDto;\n\tshippingProfile?: IEditShippingProfile;\n\ttheme?: any;\n\tproxyRoutePrefix?: string;\n\tlocale: string;\n}\n\nconst ShippingForm: React.FunctionComponent<IShippingProps> = ({\n\tsetSystemMessage,\n\tlocalizedResources,\n\tactAndHandleException,\n\tonCancelClicked,\n\tonCommitClicked,\n\tbillingProfile,\n\tstripeBillingProfile,\n\tshippingProfile,\n\ttheme = {},\n\tproxyRoutePrefix = '',\n\tlocale,\n}) => {\n\tconst resources = { ...defaultResources, ...localizedResources };\n\tconst queryClient = new QueryClient({\n\t\tdefaultOptions: {\n\t\t\tqueries: {\n\t\t\t\trefetchOnWindowFocus: false,\n\t\t\t},\n\t\t},\n\t});\n\n\treturn (\n\t\t<LocalizationProvider localizedResources={resources}>\n\t\t\t<ThemeProvider theme={() => ({ ...styledUITheme, ...theme })}>\n\t\t\t\t<QueryClientProvider client={queryClient}>\n\t\t\t\t\t<ShippingAddressForm\n\t\t\t\t\t\tsetSystemMessage={setSystemMessage}\n\t\t\t\t\t\tactAndHandleException={actAndHandleException}\n\t\t\t\t\t\tonCancelClicked={onCancelClicked}\n\t\t\t\t\t\tonCommitClicked={onCommitClicked}\n\t\t\t\t\t\tbillingProfile={billingProfile}\n\t\t\t\t\t\tstripeBillingProfile={stripeBillingProfile}\n\t\t\t\t\t\tshippingProfile={shippingProfile}\n\t\t\t\t\t\tproxyRoutePrefix={proxyRoutePrefix}\n\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t/>\n\t\t\t\t</QueryClientProvider>\n\t\t\t</ThemeProvider>\n\t\t</LocalizationProvider>\n\t);\n};\n\nexport default ShippingForm;\n","import IErrors from './IErrors';\nimport IErrorsDto from './IErrorsDto';\nimport IError from './IError';\nimport IErrorDto from './IErrorDto';\n\nexport default class ErrorMapper {\n\tpublic static mapErrors(errors: IErrorsDto): IErrors {\n\t\treturn { errors: errors.errors.map(ErrorMapper.mapError) };\n\t}\n\n\tpublic static mapError(error: IErrorDto): IError {\n\t\treturn {\n\t\t\tcode: error.errorCode,\n\t\t\tproperty: error.property,\n\t\t};\n\t}\n}\n","import IErrorDto from './IErrorDto';\n\nexport default interface IErrorsDto {\n\terrors: IErrorDto[];\n}\n\nexport const isErrorsDto = (response: any): response is IErrorsDto => {\n\treturn (response as IErrorsDto).errors !== undefined;\n};\n","import { fetchJson } from './request';\nimport {\n\tIBillingProfilesDto,\n\tIBillingProfileDto,\n\tICreateOrdersBillingProfileDto,\n\tErrorMapper,\n\tIBillingProfileChangeSetDto,\n\tIProcessCartDto,\n\tIOrderDto,\n\tIPendingActionDto,\n\tICartChangeSetDto,\n} from './typings/orders';\nimport IErrors from './typings/orders/IErrors';\nimport { isErrorsDto } from './typings/orders/IErrorsDto';\nimport ProxyRoutePrefix from './typings/shared/ProxyRoutePrefix';\n\nexport default class OrdersClient {\n\tstatic async getBillingProfiles(\n\t\tproxyRoutePrefix: ProxyRoutePrefix = '',\n\t\tshouldIncludePayPal?: boolean,\n\t\tshouldIncludeAdyenAddressOnly?: boolean,\n\t\tshouldIncludeStripe?: boolean\n\t): Promise<IBillingProfilesDto> {\n\t\tconst response = await fetchJson(`${proxyRoutePrefix || ''}/proxy/orders/v3/billingprofiles/payfac`, {\n\t\t\tmethod: 'GET',\n\t\t\tquery: {\n\t\t\t\tfields: '*',\n\t\t\t\tshouldIncludePayPal,\n\t\t\t\tshouldIncludeAdyenAddressOnly,\n\t\t\t\tshouldIncludeStripe,\n\t\t\t},\n\t\t});\n\n\t\treturn response;\n\t}\n\n\tstatic async getBillingProfile(id: string, proxyRoutePrefix: ProxyRoutePrefix = ''): Promise<IBillingProfileDto> {\n\t\tconst response = await fetchJson(`${proxyRoutePrefix || ''}/proxy/orders/v3/billingprofiles/${id}`, {\n\t\t\tmethod: 'GET',\n\t\t});\n\n\t\treturn response;\n\t}\n\n\tstatic async createOrdersBillingProfile(\n\t\tcreateBillingProfileDto: ICreateOrdersBillingProfileDto,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IBillingProfileDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IBillingProfileDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/orders/v3/billingprofiles`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: JSON.stringify(createBillingProfileDto),\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t} else if (e.response.status === 409) {\n\t\t\t\treturn { errors: [{ code: '409' }] };\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tstatic async createStripeBillingProfile(\n\t\tsetupIntentId: string,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IBillingProfileDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IBillingProfileDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/orders/v3/billingprofiles/stripe/${setupIntentId}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tstatic async updateOrdersBillingProfile(\n\t\tbillingProfileId: string,\n\t\tbillingProfileChangeSet: IBillingProfileChangeSetDto,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IBillingProfileDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IBillingProfileDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/orders/v3/billingprofiles/${billingProfileId}`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'PATCH',\n\t\t\t\t\tbody: JSON.stringify(billingProfileChangeSet),\n\t\t\t\t}\n\t\t\t);\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t} else if (e.response.status === 409) {\n\t\t\t\treturn { errors: [{ code: '409' }] };\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tstatic async deleteOrdersBillingProfile(\n\t\tbillingProfileId: string,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<void | IErrors> {\n\t\ttry {\n\t\t\tawait fetchJson(`${proxyRoutePrefix || ''}/proxy/orders/v3/billingprofiles/${billingProfileId}`, {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t});\n\t\t} catch (e: any) {\n\t\t\tif (e.response.status === 409) {\n\t\t\t\treturn { errors: [{ code: '409' }] };\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tstatic async updateCart(\n\t\tcartToken: string,\n\t\tcartChangeSet: ICartChangeSetDto,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<void> {\n\t\tawait fetchJson(`${proxyRoutePrefix || ''}/proxy/orders/v3/carts/${cartToken}`, {\n\t\t\tmethod: 'PATCH',\n\t\t\tbody: JSON.stringify(cartChangeSet),\n\t\t});\n\t}\n\n\tstatic async prepareCartForStripeRedirect(\n\t\tcartToken: string,\n\t\tpaymentIntentId: string,\n\t\tamount: number,\n\t\tproxyRoutePrefix: string | undefined\n\t): Promise<void> {\n\t\tconst url = `${proxyRoutePrefix ?? ''}/proxy/orders/v3/carts/${cartToken}/stripe/prepareforredirect`;\n\t\tconst response = await fetch(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tbody: JSON.stringify({ amount, paymentIntentId }),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Failed to prepare Stripe cart for redirect: ${response.statusText}`);\n\t\t}\n\t}\n\n\tstatic async processCart(\n\t\tcartToken: string,\n\t\tprocessCartDto: IProcessCartDto,\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IOrderDto | IPendingActionDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IOrderDto | IPendingActionDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/orders/v3/carts/${cartToken}/process`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: JSON.stringify(processCartDto),\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t} else if (e.response.status === 409) {\n\t\t\t\treturn { errors: [{ code: '409' }] };\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\t// NOTE: fields specified must not include non-persisted discount info if getPendingCart = true. See https://faithlife.slack.com/archives/C03R24VCERG/p1780429099624729\n\tstatic async getCartByTokenAsync(cartToken: string, proxyRoutePrefix: ProxyRoutePrefix = ''): Promise<any> {\n\t\tconst response = await fetchJson(\n\t\t\t`${proxyRoutePrefix ?? ''}/proxy/orders/v3/carts/${cartToken}?getProcessedCart=true&getPendingCart=true&fields=orderId`,\n\t\t\t{\n\t\t\t\tmethod: 'GET',\n\t\t\t}\n\t\t);\n\n\t\treturn response;\n\t}\n}\n","import IError from './IError';\n\nexport default interface IErrors {\n\terrors: IError[];\n}\n\nexport const isErrors = (response: any): response is IErrors => {\n\treturn (response as IErrors).errors !== undefined;\n};\n","import {\n\tIBillingProfileChangeSetDto,\n\tIBillingProfileDto,\n\tICreateOrdersBillingProfileDto,\n} from '../clients/typings/orders';\nimport IEditBillingProfile from '../typings/IEditBillingProfile';\n\nexport default class BillingProfileMapper {\n\tpublic static mapForCreatingInOrdersApi(profile: IEditBillingProfile): ICreateOrdersBillingProfileDto {\n\t\tconst {\n\t\t\tnameOnCard,\n\t\t\tpostalCode,\n\t\t\taddressLine1: address1,\n\t\t\taddressLine2: address2,\n\t\t\taddressLine3: address3,\n\t\t\tcity,\n\t\t\tstateId,\n\t\t\tcountryId,\n\t\t\tsuburb,\n\t\t\tmakeDefault,\n\t\t\tuseOnPendingPreorders,\n\t\t\tuseOnActiveSubscriptions,\n\t\t\tuseOnOutstandingPaymentPlans,\n\t\t\tuseOnActiveBids,\n\t\t} = {\n\t\t\t...profile,\n\t\t\t...profile.cardInfo,\n\t\t};\n\n\t\tconst ordersBillingProfile: ICreateOrdersBillingProfileDto = {\n\t\t\taddress1: address1 || '',\n\t\t\taddress2: address2 || '',\n\t\t\taddress3: address3 || undefined,\n\t\t\tcity: city || '',\n\t\t\tstateId: stateId || '',\n\t\t\tsuburb: suburb || '',\n\t\t\tcountryId: countryId || '',\n\t\t\tcardInfo: undefined,\n\t\t\tnameOnCard: nameOnCard || '',\n\t\t\tpostalCode: postalCode || '',\n\t\t\tmakeDefault: makeDefault || false,\n\t\t\tuseOnPendingPrepubs: useOnPendingPreorders || false,\n\t\t\tuseOnActiveSubscriptions: useOnActiveSubscriptions || false,\n\t\t\tuseOnOutstandingPaymentPlans: useOnOutstandingPaymentPlans || false,\n\t\t\tuseOnActiveBids: useOnActiveBids || false,\n\t\t};\n\n\t\treturn ordersBillingProfile;\n\t}\n\n\tpublic static mapForEditing(profile: IBillingProfileDto): IEditBillingProfile {\n\t\tconst expirationMonth = profile.cardInfo?.expirationMonth.toString().slice(-2).padStart(2, '0');\n\t\tconst expirationYear = profile.cardInfo?.expirationYear.toString().slice(-2);\n\n\t\treturn {\n\t\t\tprofileId: profile.profileId,\n\t\t\taddressLine1: profile.address1,\n\t\t\taddressLine2: profile.address2,\n\t\t\taddressLine3: profile.address3,\n\t\t\tcardInfo: {\n\t\t\t\tcardNumber: profile.cardInfo ? parseInt(profile.cardInfo.creditCardNumber) : undefined,\n\t\t\t\texpiration: profile.cardInfo ? `${expirationMonth}${expirationYear}` : undefined,\n\t\t\t\tnameOnCard: profile.nameOnCard,\n\t\t\t\tpostalCode: profile.postalCode,\n\t\t\t\tsecurityCode: null,\n\t\t\t\tprovider: profile.cardInfo?.creditCardProvider,\n\t\t\t},\n\t\t\tcity: profile.city,\n\t\t\tsuburb: profile.suburb,\n\t\t\tcountryId: profile.countryId.toString(),\n\t\t\tstateId: profile.stateId ? profile.stateId.toString() : '',\n\t\t\tusageInfo: {\n\t\t\t\tpendingPreorderCount: profile.usageInfo?.pendingPrepubCount || 0,\n\t\t\t\tactiveSubscriptionCount: profile.usageInfo?.activeSubscriptionCount || 0,\n\t\t\t\toutstandingPaymentPlansCount: profile.usageInfo?.outstandingPaymentPlansCount || 0,\n\t\t\t\tactiveBidCount: profile.usageInfo?.activeBidCount || 0,\n\t\t\t},\n\t\t\tisDefault: profile.isDefault,\n\t\t};\n\t}\n\n\tpublic static mapForUpdating(profile: IEditBillingProfile): IBillingProfileChangeSetDto {\n\t\tconst sanitizedExpiration = (profile.cardInfo.expiration || '').replace(/ \\//g, '');\n\n\t\treturn {\n\t\t\taddress1: profile.addressLine1 || '',\n\t\t\taddress2: profile.addressLine2 || '',\n\t\t\taddress3: profile.addressLine3 || undefined,\n\t\t\taddress4: undefined,\n\t\t\tcity: profile.city || '',\n\t\t\tsuburb: profile.suburb,\n\t\t\tcountryId: profile.countryId || '',\n\t\t\texpirationMonth: parseInt(sanitizedExpiration.slice(0, 2)),\n\t\t\texpirationYear: parseInt(new Date().getFullYear().toString().substr(0, 2) + sanitizedExpiration.slice(-2)),\n\t\t\tnameOnCard: profile.cardInfo.nameOnCard || '',\n\t\t\tpostalCode: profile.cardInfo.postalCode || '',\n\t\t\tstateId: profile.stateId || '',\n\t\t\tmakeDefault: profile.makeDefault,\n\t\t\tuseOnPendingPrepubs: profile.useOnPendingPreorders,\n\t\t\tuseOnActiveSubscriptions: profile.useOnActiveSubscriptions,\n\t\t\tuseOnOutstandingPaymentPlans: profile.useOnOutstandingPaymentPlans,\n\t\t\tuseOnActiveBids: profile.useOnActiveBids,\n\t\t};\n\t}\n}\n","import { Button, LoadingSpinner, Radio } from '@faithlife/styled-ui';\nimport React, { useCallback, useState } from 'react';\nimport { Tooltip } from '@faithlife/styled-ui';\nimport IBillingProfileDto from '../../clients/typings/orders/IBillingProfileDto';\nimport { PayPal, Trash, TrashDisabled } from '../../sprites/svg';\nimport { useLocalization } from '../../Localization';\nimport * as Styled from './styled';\n\nexport const SupportedBillingProfileTypes = ['Paypal'].map(s => s.toLowerCase());\n\ninterface IPayPalProfileProps {\n\tbillingProfile: IBillingProfileDto;\n\tonDelete: Function;\n\tisSelected: boolean;\n\tonSelected: Function;\n\tindex: number;\n}\n\nconst PayPalProfile: React.FunctionComponent<IPayPalProfileProps> = ({\n\tbillingProfile,\n\tonDelete,\n\tisSelected,\n\tonSelected,\n\tindex,\n}) => {\n\tconst strings = useLocalization();\n\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst trashDisabled =\n\t\tbillingProfile.usageInfo &&\n\t\t(billingProfile.usageInfo.activeSubscriptionCount > 0 ||\n\t\t\tbillingProfile.usageInfo.outstandingPaymentPlansCount > 0 ||\n\t\t\tbillingProfile.usageInfo.pendingPrepubCount > 0);\n\n\tconst deleteBillingProfile = useCallback(() => {\n\t\tsetIsDeleting(true);\n\t\tonDelete(billingProfile.profileId);\n\t}, [billingProfile.profileId, onDelete]);\n\n\tif (!SupportedBillingProfileTypes.includes(billingProfile.type.toLowerCase())) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Styled.CreditCardRow data-testid=\"credit-card-row\" data-test-index={index}>\n\t\t\t<Radio onClick={onSelected} isChecked={isSelected} type=\"button\">\n\t\t\t\t<Styled.RadioLabel>\n\t\t\t\t\t<Styled.CardLogoContainer>\n\t\t\t\t\t\t<PayPal />\n\t\t\t\t\t</Styled.CardLogoContainer>\n\t\t\t\t\t<Styled.Name>{billingProfile.nameOnCard}</Styled.Name>\n\t\t\t\t</Styled.RadioLabel>\n\t\t\t</Radio>\n\t\t\t<Styled.PayPalDelete data-testid=\"delete-button-container\">\n\t\t\t\t{trashDisabled ? (\n\t\t\t\t\t<Tooltip placement=\"top\" content={strings.associatedUsage}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"minorTransparent\"\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={isDeleting ? <LoadingSpinner height={18} /> : <TrashDisabled height={18} />}\n\t\t\t\t\t\t\tonClick={deleteBillingProfile}\n\t\t\t\t\t\t\tdisabled={trashDisabled}\n\t\t\t\t\t\t\tdata-testid=\"paypal-trash\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) : (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"minorTransparent\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\ticon={isDeleting ? <LoadingSpinner height={18} /> : <Trash height={18} />}\n\t\t\t\t\t\tonClick={deleteBillingProfile}\n\t\t\t\t\t\tdisabled={trashDisabled}\n\t\t\t\t\t\tdata-testid=\"paypal-trash\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Styled.PayPalDelete>\n\t\t</Styled.CreditCardRow>\n\t);\n};\n\nexport default PayPalProfile;\n","import { CommandSentence } from '@faithlife/command-sentence-control';\nimport { Tooltip } from '@faithlife/styled-ui';\nimport React, { useCallback, useState } from 'react';\nimport { Styled as SharedStyled } from '../../../address-form';\nimport { useLocalization } from '../../Localization';\nimport IEditBillingProfile from '../../typings/IEditBillingProfile';\nimport IEditCardInfo from '../../typings/IEditCardInfo';\nimport {\n\tareExpirationDatesValid,\n\tformatMaskedCardNumber,\n\tisExpirationValid,\n\tnormalizeExpiration,\n} from '../../utilities/credit-card-utils';\nimport nameof from '../../utilities/nameof';\nimport * as Styled from './styled';\n\ninterface IEditCreditCardInfoProps {\n\tbillingProfile?: IEditBillingProfile;\n\tuncommittedBillingProfile: IEditBillingProfile;\n\tisEditingExistingProfile: boolean;\n\tisValidField: (fieldName: keyof IEditCardInfo) => boolean;\n\tsaveForLater: boolean;\n\tusageInfo: {\n\t\tpendingPrepubCount: number;\n\t\tactiveSubscriptionCount: number;\n\t\toutstandingPaymentPlansCount: number;\n\t\tactiveBidCount: number;\n\t};\n\thandleSaveForLaterChange?: () => void;\n\tupdateBillingProfile: (event: any) => void;\n\toptions: {\n\t\tisMakingDefaultEnabled: boolean;\n\t\tisMovingSubscriptionsEnabled: boolean;\n\t\tisMovingPrepubsAndBidsEnabled: boolean;\n\t\tisMovingPaymentPlansEnabled: boolean;\n\t};\n}\n\nconst EditCreditCardInfo: React.FunctionComponent<IEditCreditCardInfoProps> = ({\n\tbillingProfile,\n\tuncommittedBillingProfile,\n\tisEditingExistingProfile,\n\tisValidField,\n\tsaveForLater,\n\tusageInfo,\n\thandleSaveForLaterChange,\n\tupdateBillingProfile,\n\toptions,\n}) => {\n\tconst strings = useLocalization();\n\n\tconst [isCardExpired, setIsCardExpired] = useState<boolean>(\n\t\tisEditingExistingProfile && !isExpirationValid((billingProfile && billingProfile.cardInfo.expiration) || '')\n\t);\n\n\tconst updateExpirationDate = useCallback(\n\t\t(event: any) => {\n\t\t\tconst normalizedExpiration = normalizeExpiration(event.target.value);\n\t\t\tconst exampleExpiration = '12/34';\n\t\t\tconst [expirationMonth, expirationYear] = normalizedExpiration.split('/');\n\t\t\tsetIsCardExpired(\n\t\t\t\tnormalizedExpiration.length === exampleExpiration.length &&\n\t\t\t\t\t!areExpirationDatesValid(Number.parseInt(expirationMonth), Number.parseInt(expirationYear))\n\t\t\t);\n\n\t\t\tconst normalizedEvent = {\n\t\t\t\t...event,\n\t\t\t\ttarget: {\n\t\t\t\t\tname: event.target.name,\n\t\t\t\t\tvalue: normalizedExpiration,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tupdateBillingProfile(normalizedEvent);\n\t\t},\n\t\t[updateBillingProfile]\n\t);\n\n\tconst getUncommittedBillingProfileBoolOrDefault = useCallback(\n\t\t(propertyName: keyof IEditBillingProfile) => {\n\t\t\treturn (uncommittedBillingProfile && uncommittedBillingProfile[propertyName]) || false;\n\t\t},\n\t\t[uncommittedBillingProfile]\n\t);\n\n\tconst getUncommittedCardInfoValueOrDefault = (propertyName: keyof IEditCardInfo) => {\n\t\treturn (\n\t\t\t(uncommittedBillingProfile &&\n\t\t\t\tuncommittedBillingProfile.cardInfo &&\n\t\t\t\tuncommittedBillingProfile.cardInfo[propertyName]) ||\n\t\t\t''\n\t\t);\n\t};\n\n\tconst showMakeDefault =\n\t\toptions.isMakingDefaultEnabled &&\n\t\t(!billingProfile || (billingProfile && !billingProfile.isDefault && saveForLater));\n\n\tconst showMoveSubscriptions =\n\t\toptions.isMovingSubscriptionsEnabled &&\n\t\t((!billingProfile && usageInfo.activeSubscriptionCount > 0) ||\n\t\t\t(billingProfile && billingProfile.usageInfo.activeSubscriptionCount < usageInfo.activeSubscriptionCount));\n\n\tconst showMovePreordersAndBids =\n\t\toptions.isMovingPrepubsAndBidsEnabled &&\n\t\t((!billingProfile && usageInfo.pendingPrepubCount > 0) ||\n\t\t\t(billingProfile && billingProfile.usageInfo.pendingPreorderCount < usageInfo.pendingPrepubCount) ||\n\t\t\t(!billingProfile && usageInfo.activeBidCount > 0) ||\n\t\t\t(billingProfile && billingProfile.usageInfo.activeBidCount < usageInfo.activeBidCount));\n\n\tconst showMovePaymentPlans =\n\t\toptions.isMovingPaymentPlansEnabled &&\n\t\t((!billingProfile && usageInfo.outstandingPaymentPlansCount > 0) ||\n\t\t\t(billingProfile &&\n\t\t\t\tbillingProfile.usageInfo.outstandingPaymentPlansCount < usageInfo.outstandingPaymentPlansCount));\n\n\tconst updateFieldToDefault = useCallback(\n\t\t(propertyName: keyof IEditBillingProfile) => {\n\t\t\tupdateBillingProfile({\n\t\t\t\ttarget: {\n\t\t\t\t\tname: nameof<IEditBillingProfile>(propertyName),\n\t\t\t\t\tvalue: !getUncommittedBillingProfileBoolOrDefault('makeDefault'),\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t\t[getUncommittedBillingProfileBoolOrDefault, updateBillingProfile]\n\t);\n\n\tconst makeCurrentProfileDefault = useCallback(() => {\n\t\tupdateFieldToDefault('makeDefault');\n\t\tif (showMoveSubscriptions) {\n\t\t\tupdateFieldToDefault('useOnActiveSubscriptions');\n\t\t}\n\t\tif (showMovePaymentPlans) {\n\t\t\tupdateFieldToDefault('useOnOutstandingPaymentPlans');\n\t\t}\n\t\tif (showMovePreordersAndBids) {\n\t\t\tupdateFieldToDefault('useOnPendingPreorders');\n\t\t\tupdateFieldToDefault('useOnActiveBids');\n\t\t}\n\t}, [showMovePaymentPlans, showMovePreordersAndBids, showMoveSubscriptions, updateFieldToDefault]);\n\n\treturn (\n\t\t<>\n\t\t\t<div>\n\t\t\t\t<Styled.InfoRow>\n\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t<Styled.LabelText>{strings.cardNumber}</Styled.LabelText>\n\t\t\t\t\t\t<SharedStyled.Cleave\n\t\t\t\t\t\t\tname={nameof<IEditCardInfo>('cardNumber')}\n\t\t\t\t\t\t\tautoComplete=\"cc-number\"\n\t\t\t\t\t\t\tpattern={isEditingExistingProfile ? 'x*[0-9 ]*' : '[0-9 ]*'}\n\t\t\t\t\t\t\t$isValid={isValidField('cardNumber')}\n\t\t\t\t\t\t\tplaceholder=\"0000 0000 0000 0000\"\n\t\t\t\t\t\t\tdata-testid=\"card-number\"\n\t\t\t\t\t\t\tonChange={(e: any) =>\n\t\t\t\t\t\t\t\tupdateBillingProfile({\n\t\t\t\t\t\t\t\t\t...e,\n\t\t\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\t\t\tname: e.target.name,\n\t\t\t\t\t\t\t\t\t\tvalue: e.target.value.replace(/ /g, ''),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\toptions={{\n\t\t\t\t\t\t\t\tcreditCard: !isEditingExistingProfile,\n\t\t\t\t\t\t\t\tcreditCardStrictMode: !isEditingExistingProfile,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tdisabled={isEditingExistingProfile}\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tisEditingExistingProfile\n\t\t\t\t\t\t\t\t\t? formatMaskedCardNumber(\n\t\t\t\t\t\t\t\t\t\t\t(uncommittedBillingProfile.cardInfo.cardNumber || '').toString(),\n\t\t\t\t\t\t\t\t\t\t\tuncommittedBillingProfile.cardInfo.provider || ''\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: getUncommittedCardInfoValueOrDefault('cardNumber')\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Styled.Label>\n\t\t\t\t</Styled.InfoRow>\n\t\t\t\t<Styled.InfoRow>\n\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t<Styled.LabelText>{strings.nameOnCard}</Styled.LabelText>\n\t\t\t\t\t\t<SharedStyled.Input\n\t\t\t\t\t\t\tname={nameof<IEditCardInfo>('nameOnCard')}\n\t\t\t\t\t\t\tautoComplete=\"cc-name\"\n\t\t\t\t\t\t\tisValid={isValidField('nameOnCard')}\n\t\t\t\t\t\t\tdata-testid=\"name-on-card\"\n\t\t\t\t\t\t\tonChange={updateBillingProfile}\n\t\t\t\t\t\t\tvalue={getUncommittedCardInfoValueOrDefault('nameOnCard')}\n\t\t\t\t\t\t\tborder={'1px solid #a8a8a8'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Styled.Label>\n\t\t\t\t</Styled.InfoRow>\n\t\t\t\t<Styled.InfoRow>\n\t\t\t\t\t<Styled.ExpirationContainer>\n\t\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t\t<Styled.LabelText>{strings.expiration}</Styled.LabelText>\n\t\t\t\t\t\t\t<SharedStyled.Cleave\n\t\t\t\t\t\t\t\tname={nameof<IEditCardInfo>('expiration')}\n\t\t\t\t\t\t\t\tautoComplete=\"cc-exp\"\n\t\t\t\t\t\t\t\tautoFocus={isCardExpired}\n\t\t\t\t\t\t\t\tpattern=\"[0-9 /]*\"\n\t\t\t\t\t\t\t\t$isValid={isCardExpired ? false : isValidField('expiration')}\n\t\t\t\t\t\t\t\tdata-testid=\"expiration\"\n\t\t\t\t\t\t\t\ttitle={isCardExpired ? strings.expirationDateError : ''}\n\t\t\t\t\t\t\t\tplaceholder={strings.placeholders.expiration}\n\t\t\t\t\t\t\t\tonBlur={() =>\n\t\t\t\t\t\t\t\t\tuncommittedBillingProfile.cardInfo &&\n\t\t\t\t\t\t\t\t\tuncommittedBillingProfile.cardInfo.expiration &&\n\t\t\t\t\t\t\t\t\tsetIsCardExpired(!isExpirationValid(uncommittedBillingProfile.cardInfo.expiration))\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={updateExpirationDate}\n\t\t\t\t\t\t\t\toptions={{ date: true, datePattern: ['m', 'Y'], delimiter: ' / ' }}\n\t\t\t\t\t\t\t\tvalue={getUncommittedCardInfoValueOrDefault('expiration')}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Styled.Label>\n\t\t\t\t\t</Styled.ExpirationContainer>\n\t\t\t\t\t<Styled.SecurityCodeContainer>\n\t\t\t\t\t\t<Styled.Label>\n\t\t\t\t\t\t\t<Styled.LabelText>{strings.securityCode}</Styled.LabelText>\n\t\t\t\t\t\t\t<SharedStyled.Cleave\n\t\t\t\t\t\t\t\tname={nameof<IEditCardInfo>('securityCode')}\n\t\t\t\t\t\t\t\tautoComplete=\"cc-csc\"\n\t\t\t\t\t\t\t\tpattern={isEditingExistingProfile ? 'xxxx' : '[0-9]*'}\n\t\t\t\t\t\t\t\t$isValid={isValidField('securityCode')}\n\t\t\t\t\t\t\t\tdata-testid=\"security-code\"\n\t\t\t\t\t\t\t\tplaceholder={strings.placeholders.securityCode}\n\t\t\t\t\t\t\t\tonChange={updateBillingProfile}\n\t\t\t\t\t\t\t\toptions={isEditingExistingProfile ? {} : { numericOnly: true, blocks: [4] }}\n\t\t\t\t\t\t\t\tdisabled={isEditingExistingProfile}\n\t\t\t\t\t\t\t\tvalue={isEditingExistingProfile ? 'xxxx' : getUncommittedCardInfoValueOrDefault('securityCode')}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Styled.Label>\n\t\t\t\t\t</Styled.SecurityCodeContainer>\n\t\t\t\t</Styled.InfoRow>\n\t\t\t</div>\n\t\t\t{handleSaveForLaterChange && (\n\t\t\t\t<div data-testid=\"remember-this-card-checkbox\">\n\t\t\t\t\t<Styled.Checkbox\n\t\t\t\t\t\tonClick={handleSaveForLaterChange}\n\t\t\t\t\t\tisChecked={saveForLater}\n\t\t\t\t\t\ttitle={strings.rememberThisCard}\n\t\t\t\t\t></Styled.Checkbox>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{showMakeDefault && saveForLater && (\n\t\t\t\t<Styled.Row>\n\t\t\t\t\t<Styled.Checkbox\n\t\t\t\t\t\tonClick={makeCurrentProfileDefault}\n\t\t\t\t\t\tisChecked={getUncommittedBillingProfileBoolOrDefault('makeDefault')}\n\t\t\t\t\t\ttitle={strings.makeDefault}\n\t\t\t\t\t></Styled.Checkbox>\n\t\t\t\t\t<Tooltip\n\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t<Styled.ToolTipContentContainer>\n\t\t\t\t\t\t\t\t<Styled.ToolTipContentTopParagraph>\n\t\t\t\t\t\t\t\t\t{strings.makeDefaultInfoFuturePurchases}\n\t\t\t\t\t\t\t\t</Styled.ToolTipContentTopParagraph>\n\t\t\t\t\t\t\t\t<CommandSentence template={strings.makeDefaultInfoExistingPlans}>\n\t\t\t\t\t\t\t\t\t<CommandSentence.Field name=\"WILLNOTCHANGE\">\n\t\t\t\t\t\t\t\t\t\t<b>{strings.makeDefaultInfoWillNotChange}</b>\n\t\t\t\t\t\t\t\t\t</CommandSentence.Field>\n\t\t\t\t\t\t\t\t</CommandSentence>\n\t\t\t\t\t\t\t</Styled.ToolTipContentContainer>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttoggleOnClick={true}\n\t\t\t\t\t\tmodifiers={[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'preventOverflow',\n\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\tpadding: 12,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t]}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Styled.InfoSvgContainer>\n\t\t\t\t\t\t\t<Styled.InfoSvg></Styled.InfoSvg>\n\t\t\t\t\t\t</Styled.InfoSvgContainer>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t</Styled.Row>\n\t\t\t)}\n\t\t\t{showMoveSubscriptions && (\n\t\t\t\t<Styled.Checkbox\n\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\tupdateBillingProfile({\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\tname: nameof<IEditBillingProfile>('useOnActiveSubscriptions'),\n\t\t\t\t\t\t\t\tvalue: !getUncommittedBillingProfileBoolOrDefault('useOnActiveSubscriptions'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\tisChecked={getUncommittedBillingProfileBoolOrDefault('useOnActiveSubscriptions')}\n\t\t\t\t\ttitle={strings.moveSubscriptions}\n\t\t\t\t></Styled.Checkbox>\n\t\t\t)}\n\t\t\t{showMovePaymentPlans && (\n\t\t\t\t<Styled.Checkbox\n\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\tupdateBillingProfile({\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\tname: nameof<IEditBillingProfile>('useOnOutstandingPaymentPlans'),\n\t\t\t\t\t\t\t\tvalue: !getUncommittedBillingProfileBoolOrDefault('useOnOutstandingPaymentPlans'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\tisChecked={getUncommittedBillingProfileBoolOrDefault('useOnOutstandingPaymentPlans')}\n\t\t\t\t\ttitle={strings.movePaymentPlans}\n\t\t\t\t></Styled.Checkbox>\n\t\t\t)}\n\t\t\t{showMovePreordersAndBids && (\n\t\t\t\t<Styled.Checkbox\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tupdateBillingProfile({\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\tname: nameof<IEditBillingProfile>('useOnPendingPreorders'),\n\t\t\t\t\t\t\t\tvalue: !getUncommittedBillingProfileBoolOrDefault('useOnPendingPreorders'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdateBillingProfile({\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\tname: nameof<IEditBillingProfile>('useOnActiveBids'),\n\t\t\t\t\t\t\t\tvalue: !getUncommittedBillingProfileBoolOrDefault('useOnActiveBids'),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}}\n\t\t\t\t\tisChecked={\n\t\t\t\t\t\tgetUncommittedBillingProfileBoolOrDefault('useOnPendingPreorders') ||\n\t\t\t\t\t\tgetUncommittedBillingProfileBoolOrDefault('useOnActiveBids')\n\t\t\t\t\t}\n\t\t\t\t\ttitle={strings.movePreorders}\n\t\t\t\t></Styled.Checkbox>\n\t\t\t)}\n\t\t\t<Styled.Title>{strings.billingAddress}</Styled.Title>\n\t\t</>\n\t);\n};\n\nexport default EditCreditCardInfo;\n","import { LoadingSpinner, Modal } from '@faithlife/styled-ui';\nimport React, { useCallback, useState } from 'react';\nimport { AddressForm } from '../../../address-form';\nimport IAddressFormatItem from '../../clients/typings/locations/IAddressFormatItem';\nimport ICountryDto from '../../clients/typings/locations/ICountryDto';\nimport IStateDto from '../../clients/typings/locations/IStateDto';\nimport IError from '../../clients/typings/orders/IError';\nimport IUsageInfoDto from '../../clients/typings/orders/UsageInfoDto';\nimport { useLocalization } from '../../Localization';\nimport IEditBillingProfile from '../../typings/IEditBillingProfile';\nimport IEditCardInfo from '../../typings/IEditCardInfo';\nimport { mapOrdersPropertyToEditProperty, validateBillingProfile } from '../../utilities/credit-card-utils';\nimport ICreditCardOptionsDto from '../../clients/typings/orders/ICreditCardOptionsDto';\nimport EditCreditCardInfo from './edit-credit-card-info';\nimport * as Styled from './styled';\n\ninterface IEditCreditCardFormProps {\n\tbillingProfile?: IEditBillingProfile;\n\tonCommitBillingProfile: (profile: IEditBillingProfile, onBillingProfileCommittedCb: Function) => Promise<void>;\n\tonCancelEditingBillingProfile?: () => void;\n\tserverValidationErrors: IError[];\n\tcountries: ICountryDto[];\n\tstatesByCountryId: Record<string, IStateDto[]>;\n\tonSelectedCountryChanged: (countryId: string) => Promise<void>;\n\tusageInfo?: IUsageInfoDto;\n\taddressFormatItems: IAddressFormatItem[];\n\tonDelete?: (billingProfileId: string) => void;\n\thandleSaveForLaterChange?: () => void;\n\tsaveForLater?: boolean;\n\tcreateButtonText?: string;\n\tlocale: string;\n\thasLoadedAddressInfo: boolean;\n\tcreditCardOptions?: ICreditCardOptionsDto;\n}\n\nconst unitedStatesCountryId = '840';\nconst defaultCountryOption = { label: 'United States', value: unitedStatesCountryId };\n\nconst EditCreditCardForm: React.FunctionComponent<IEditCreditCardFormProps> = ({\n\tbillingProfile,\n\tonCommitBillingProfile,\n\tonCancelEditingBillingProfile,\n\tserverValidationErrors,\n\tcountries,\n\tstatesByCountryId,\n\tonSelectedCountryChanged,\n\taddressFormatItems,\n\thandleSaveForLaterChange,\n\tsaveForLater = true,\n\tcreateButtonText,\n\tonDelete,\n\tusageInfo = {\n\t\tpendingPrepubCount: 0,\n\t\tactiveSubscriptionCount: 0,\n\t\toutstandingPaymentPlansCount: 0,\n\t\tactiveBidCount: 0,\n\t},\n\tlocale,\n\thasLoadedAddressInfo,\n\tcreditCardOptions = {\n\t\tisMakingDefaultEnabled: true,\n\t\tisMovingSubscriptionsEnabled: true,\n\t\tisMovingPrepubsAndBidsEnabled: true,\n\t\tisMovingPaymentPlansEnabled: true,\n\t},\n}) => {\n\tconst [uncommittedBillingProfile, setUncommittedBillingProfile] = useState<IEditBillingProfile>(\n\t\tbillingProfile\n\t\t\t? {\n\t\t\t\t\t...billingProfile,\n\t\t\t\t\tcountryId: billingProfile.countryId === '-1' ? defaultCountryOption.value : billingProfile.countryId,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\taddressLine1: '',\n\t\t\t\t\taddressLine2: '',\n\t\t\t\t\tcardInfo: {\n\t\t\t\t\t\tcardNumber: null,\n\t\t\t\t\t\texpiration: null,\n\t\t\t\t\t\tnameOnCard: null,\n\t\t\t\t\t\tpostalCode: null,\n\t\t\t\t\t\tsecurityCode: null,\n\t\t\t\t\t\tprovider: null,\n\t\t\t\t\t},\n\t\t\t\t\tcity: '',\n\t\t\t\t\tstateId: '',\n\t\t\t\t\tcountryId: defaultCountryOption.value,\n\t\t\t\t\tusageInfo: {\n\t\t\t\t\t\toutstandingPaymentPlansCount: 0,\n\t\t\t\t\t\tactiveSubscriptionCount: 0,\n\t\t\t\t\t\tpendingPreorderCount: 0,\n\t\t\t\t\t\tactiveBidCount: 0,\n\t\t\t\t\t},\n\t\t\t\t\tisDefault: false,\n\t\t\t\t}\n\t);\n\tconst [isProcessing, setIsProcessing] = useState<boolean>(false);\n\tconst [isDeleting, setIsDeleting] = useState(false);\n\tconst [trashDisabled, setTrashDisabled] = useState(\n\t\tbillingProfile &&\n\t\t\t(billingProfile.usageInfo?.activeSubscriptionCount > 0 ||\n\t\t\t\tbillingProfile.usageInfo?.outstandingPaymentPlansCount > 0 ||\n\t\t\t\tbillingProfile.usageInfo?.pendingPreorderCount > 0 ||\n\t\t\t\tbillingProfile.usageInfo?.activeBidCount > 0)\n\t);\n\tconst [showErrorModal, setShowErrorModal] = useState(false);\n\n\tconst [clientValidationErrors, setClientValidationErrors] = useState<IError[]>([]);\n\n\tconst isEditingExistingProfile = !!billingProfile;\n\n\tconst handleModalClose = useCallback(() => setShowErrorModal(false), [setShowErrorModal]);\n\n\tconst updateBillingProfile = useCallback(\n\t\t(event: { target: { name: string; value: string } }) => {\n\t\t\tsetIsProcessing(false);\n\t\t\t// need to make local copies in case the event gets nullified before the useState function is called\n\t\t\tconst name = event.target.name;\n\t\t\tconst value = event.target.value;\n\n\t\t\tif (Object.prototype.hasOwnProperty.call(uncommittedBillingProfile.cardInfo, name)) {\n\t\t\t\tsetUncommittedBillingProfile(prevState => ({\n\t\t\t\t\t...prevState,\n\t\t\t\t\tcardInfo: {\n\t\t\t\t\t\t...prevState.cardInfo,\n\t\t\t\t\t\t[name]: value,\n\t\t\t\t\t},\n\t\t\t\t}));\n\t\t\t} else {\n\t\t\t\tsetUncommittedBillingProfile(prevState => ({\n\t\t\t\t\t...prevState,\n\t\t\t\t\t[name]: value,\n\t\t\t\t}));\n\t\t\t}\n\t\t},\n\t\t[uncommittedBillingProfile.cardInfo]\n\t);\n\n\tconst deleteBillingProfile = useCallback(() => {\n\t\tsetTrashDisabled(true);\n\t\tsetIsDeleting(true);\n\n\t\tif (billingProfile?.profileId && onDelete) {\n\t\t\tonDelete(billingProfile.profileId);\n\t\t}\n\t\tsetIsDeleting(false);\n\t}, [billingProfile, onDelete]);\n\n\tconst errorByFieldName = serverValidationErrors\n\t\t.map(mapOrdersPropertyToEditProperty)\n\t\t.concat(clientValidationErrors)\n\t\t.reduce<Record<string, string>>((acc, cur) => {\n\t\t\tacc[cur.property || ''] = cur.code;\n\t\t\treturn acc;\n\t\t}, {});\n\n\tconst isValidCreditCardField = useCallback(\n\t\t(fieldName: keyof IEditCardInfo): boolean =>\n\t\t\tObject.prototype.hasOwnProperty.call(errorByFieldName, fieldName) ? false : true,\n\t\t[errorByFieldName]\n\t);\n\n\tconst onCommitClicked = useCallback(async () => {\n\t\tsetIsProcessing(true);\n\t\tconst errors = validateBillingProfile(\n\t\t\tisEditingExistingProfile,\n\t\t\tuncommittedBillingProfile,\n\t\t\tstatesByCountryId,\n\t\t\taddressFormatItems\n\t\t);\n\t\tsetClientValidationErrors(errors);\n\t\tif (errors.length === 0) {\n\t\t\tawait onCommitBillingProfile(uncommittedBillingProfile, () => setIsProcessing(false));\n\t\t} else {\n\t\t\tsetIsProcessing(false);\n\t\t}\n\t}, [\n\t\tisEditingExistingProfile,\n\t\tonCommitBillingProfile,\n\t\tstatesByCountryId,\n\t\taddressFormatItems,\n\t\tuncommittedBillingProfile,\n\t]);\n\n\tconst strings = useLocalization();\n\n\treturn (\n\t\t<Styled.EditCreditCardFormSection data-testid=\"edit-credit-card-form\">\n\t\t\t<EditCreditCardInfo\n\t\t\t\tbillingProfile={billingProfile}\n\t\t\t\tuncommittedBillingProfile={uncommittedBillingProfile}\n\t\t\t\tisEditingExistingProfile={isEditingExistingProfile}\n\t\t\t\tisValidField={isValidCreditCardField}\n\t\t\t\tsaveForLater={saveForLater}\n\t\t\t\tusageInfo={usageInfo}\n\t\t\t\thandleSaveForLaterChange={handleSaveForLaterChange}\n\t\t\t\tupdateBillingProfile={updateBillingProfile}\n\t\t\t\toptions={creditCardOptions}\n\t\t\t/>\n\t\t\t<AddressForm\n\t\t\t\tinitialAddressInfo={{\n\t\t\t\t\tcountryId: billingProfile?.countryId,\n\t\t\t\t\tstateId: billingProfile?.stateId,\n\t\t\t\t\tpostalCode: billingProfile?.cardInfo?.postalCode,\n\t\t\t\t}}\n\t\t\t\taddressInfo={{\n\t\t\t\t\taddressLine1: uncommittedBillingProfile.addressLine1 || '',\n\t\t\t\t\taddressLine2: uncommittedBillingProfile.addressLine2 || '',\n\t\t\t\t\taddressLine3: uncommittedBillingProfile.addressLine3 || '',\n\t\t\t\t\tcity: uncommittedBillingProfile.city || '',\n\t\t\t\t\tcountryId: uncommittedBillingProfile.countryId || '',\n\t\t\t\t\tpostalCode: uncommittedBillingProfile.cardInfo.postalCode || '',\n\t\t\t\t\tstateId: uncommittedBillingProfile.stateId || '',\n\t\t\t\t\tsuburb: uncommittedBillingProfile.suburb || '',\n\t\t\t\t}}\n\t\t\t\tcountries={countries}\n\t\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\t\tonSelectedCountryChanged={onSelectedCountryChanged}\n\t\t\t\tupdateAddressInfo={updateBillingProfile}\n\t\t\t\taddressFormatItems={addressFormatItems}\n\t\t\t\tdefaultCountryOption={defaultCountryOption}\n\t\t\t\terrorByFieldName={errorByFieldName}\n\t\t\t\tlocale={locale}\n\t\t\t\thasLoadedAddressInfo={hasLoadedAddressInfo}\n\t\t\t/>\n\t\t\t<Styled.NewProfileButtons>\n\t\t\t\t{onDelete && billingProfile && (\n\t\t\t\t\t<Styled.DeleteButtonContainer data-testid=\"delete-button-container\">\n\t\t\t\t\t\t<Styled.DeleteButton\n\t\t\t\t\t\t\ticon={isDeleting && <LoadingSpinner height={18} />}\n\t\t\t\t\t\t\tdisabled={isDeleting}\n\t\t\t\t\t\t\tonClick={trashDisabled ? () => setShowErrorModal(true) : deleteBillingProfile}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{strings.delete}\n\t\t\t\t\t\t</Styled.DeleteButton>\n\t\t\t\t\t\t{trashDisabled && (\n\t\t\t\t\t\t\t<Modal isOpen={showErrorModal} onClose={handleModalClose}>\n\t\t\t\t\t\t\t\t<Modal.Header title={strings.beforeRemoving}></Modal.Header>\n\t\t\t\t\t\t\t\t<Modal.Content width={['100vw', 400]}>\n\t\t\t\t\t\t\t\t\t{billingProfile.usageInfo.activeSubscriptionCount > 0 && (\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{'- '}\n\t\t\t\t\t\t\t\t\t\t\t{strings.moveSubscriptionsToAlternate}\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{billingProfile.usageInfo.outstandingPaymentPlansCount > 0 && (\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{'- '}\n\t\t\t\t\t\t\t\t\t\t\t{strings.movePaymentPlansToAlternate}\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{billingProfile.usageInfo.pendingPreorderCount > 0 && (\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{'- '}\n\t\t\t\t\t\t\t\t\t\t\t{strings.movePreordersToAlternate}\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{billingProfile.usageInfo.activeBidCount > 0 && (\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{'- '}\n\t\t\t\t\t\t\t\t\t\t\t{strings.moveCommunityPricingBidsToAlternate}\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</Modal.Content>\n\t\t\t\t\t\t\t\t<Modal.Footer>\n\t\t\t\t\t\t\t\t\t<Modal.FooterButtons cancelButton={{ text: 'Cancel', onClick: () => setShowErrorModal(false) }} />\n\t\t\t\t\t\t\t\t</Modal.Footer>\n\t\t\t\t\t\t\t</Modal>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Styled.DeleteButtonContainer>\n\t\t\t\t)}\n\t\t\t\t{onCancelEditingBillingProfile && (\n\t\t\t\t\t<Styled.CancelButton onClick={onCancelEditingBillingProfile}>{strings.cancel}</Styled.CancelButton>\n\t\t\t\t)}\n\t\t\t\t<Styled.CreateButton\n\t\t\t\t\tdata-testid=\"create-billing-profile-button\"\n\t\t\t\t\tonClick={onCommitClicked}\n\t\t\t\t\tdisabled={isProcessing || !hasLoadedAddressInfo}\n\t\t\t\t>\n\t\t\t\t\t{createButtonText || strings.save}\n\t\t\t\t</Styled.CreateButton>\n\t\t\t</Styled.NewProfileButtons>\n\t\t</Styled.EditCreditCardFormSection>\n\t);\n};\n\nexport default EditCreditCardForm;\n","import React from 'react';\nimport { Radio } from '@faithlife/styled-ui';\nimport IBillingProfileDto from '../../clients/typings/orders/IBillingProfileDto';\nimport {\n\tAmex,\n\tDiscover,\n\tMastercard,\n\tVisa,\n\tJCB,\n\tUnionPay,\n\tDiscoverPartner,\n\tDinersClub,\n\tStripeGeneric,\n} from '../../sprites/svg';\nimport { useLocalization } from '../../Localization';\nimport * as Styled from './styled';\n\nexport const SupportedBillingProfileTypes = ['Stripe'].map(s => s.toLowerCase());\n\ninterface IStripeProfileProps {\n\tbillingProfile: IBillingProfileDto;\n\tisSelected: boolean;\n\tonSelected: Function;\n\tindex: number;\n\tisEditing: boolean;\n\tonUpdate: Function;\n}\n\nconst StripeProfile: React.FunctionComponent<IStripeProfileProps> = ({\n\tbillingProfile,\n\tisSelected,\n\tonSelected,\n\tindex,\n\tisEditing,\n\tonUpdate,\n}) => {\n\tconst strings = useLocalization();\n\n\tif (!SupportedBillingProfileTypes.includes(billingProfile.type.toLowerCase())) {\n\t\treturn null;\n\t}\n\n\tconst now = new Date();\n\tconst isExpired =\n\t\tbillingProfile.cardInfo &&\n\t\t(billingProfile.cardInfo.expirationYear < now.getFullYear() ||\n\t\t\t(billingProfile.cardInfo.expirationYear === now.getFullYear() &&\n\t\t\t\tbillingProfile.cardInfo.expirationMonth <= now.getMonth()));\n\n\treturn (\n\t\t<Styled.CreditCardRow data-testid=\"credit-card-row\" data-test-index={index}>\n\t\t\t<Radio onClick={onSelected} isChecked={isSelected} type=\"button\" disabled={isExpired}>\n\t\t\t\t<Styled.RadioLabel>\n\t\t\t\t\t{billingProfile.cardInfo && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Styled.CardLogoContainer>\n\t\t\t\t\t\t\t\t{cardToSVG(billingProfile.cardInfo.creditCardProvider.toLowerCase())}\n\t\t\t\t\t\t\t</Styled.CardLogoContainer>\n\t\t\t\t\t\t\t<Styled.Dots>{'••••'}</Styled.Dots>\n\t\t\t\t\t\t\t<Styled.CardNumber>{billingProfile.cardInfo.creditCardNumber}</Styled.CardNumber>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</Styled.RadioLabel>\n\t\t\t</Radio>\n\t\t\t{isExpired && (\n\t\t\t\t<Styled.ExpiredCardWarning data-testid=\"expired-label\">{strings.expired}</Styled.ExpiredCardWarning>\n\t\t\t)}\n\t\t\t{!isEditing && (\n\t\t\t\t<Styled.EditButton data-testid=\"edit-button-container\" onClick={() => onUpdate(billingProfile)}>\n\t\t\t\t\t<Styled.EditText>{strings.edit}</Styled.EditText>\n\t\t\t\t</Styled.EditButton>\n\t\t\t)}\n\t\t</Styled.CreditCardRow>\n\t);\n};\n\nexport const cardToSVG = (cardType: string) => {\n\tswitch (cardType) {\n\t\tcase 'mastercard':\n\t\t\treturn <Mastercard />;\n\t\tcase 'visa':\n\t\t\treturn <Visa />;\n\t\tcase 'amex':\n\t\t\treturn <Amex />;\n\t\tcase 'discover':\n\t\t\treturn <Discover />;\n\t\tcase 'jcb':\n\t\t\treturn <JCB />;\n\t\tcase 'unionpay':\n\t\t\treturn <UnionPay />;\n\t\tcase 'discoverpartner':\n\t\t\treturn <DiscoverPartner />;\n\t\tcase 'dinersclub':\n\t\t\treturn <DinersClub />;\n\t\tdefault:\n\t\t\treturn <StripeGeneric />;\n\t}\n};\n\nexport default StripeProfile;\n","import { fetchJson } from './request';\nimport { ErrorMapper } from './typings/orders';\nimport IErrors from './typings/orders/IErrors';\nimport { isErrorsDto } from './typings/orders/IErrorsDto';\nimport IStripePaymentIntentResponseDto from './typings/orders/IStripePaymentIntentResponseDto';\nimport IStripeSetupIntentResponseDto from './typings/orders/IStripeSetupIntentResponseDto';\nimport IStripeCustomerSessionResponseDto from './typings/orders/IStripeCustomerSessionResponseDto';\nimport ProxyRoutePrefix from './typings/shared/ProxyRoutePrefix';\n\nexport default class PayFacClient {\n\tstatic async createStripeSetupIntent(\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IStripeSetupIntentResponseDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IStripeSetupIntentResponseDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/payfac/v1/stripe/setupIntent`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: JSON.stringify({}),\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tstatic async createStripePaymentModeCustomerSession(\n\t\tproxyRoutePrefix: ProxyRoutePrefix = ''\n\t): Promise<IStripeCustomerSessionResponseDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IStripeCustomerSessionResponseDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/payfac/v1/stripe/paymentModeCustomerSession`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: JSON.stringify({}),\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tstatic async createStripePaymentIntent(\n\t\tproxyRoutePrefix: ProxyRoutePrefix = '',\n\t\tamount: number,\n\t\tcurrencyCode: string,\n\t\treturnUrl: string,\n\t\tconfirmationToken?: string\n\t): Promise<IStripePaymentIntentResponseDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IStripePaymentIntentResponseDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/payfac/v1/stripe/paymentIntent`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tamount,\n\t\t\t\t\t\tcurrencyCode,\n\t\t\t\t\t\treturnUrl,\n\t\t\t\t\t\tconfirmationToken,\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tstatic async updateStripePaymentIntent(\n\t\tproxyRoutePrefix: ProxyRoutePrefix = '',\n\t\tpaymentIntentId: string,\n\t\tamount: number\n\t): Promise<IStripePaymentIntentResponseDto | IErrors> {\n\t\ttry {\n\t\t\tconst response: IStripePaymentIntentResponseDto = await fetchJson(\n\t\t\t\t`${proxyRoutePrefix || ''}/proxy/payfac/v1/stripe/paymentIntent/${paymentIntentId}/update`,\n\t\t\t\t{\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tamount,\n\t\t\t\t\t}),\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn response;\n\t\t} catch (e: any) {\n\t\t\tif (isErrorsDto(e)) {\n\t\t\t\treturn ErrorMapper.mapErrors(e);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n}\n","enum LogLevel {\n\tInfo = 'Info',\n\tError = 'Error',\n}\n\nexport default LogLevel;\n","import { StripeElementLocale } from '@stripe/stripe-js';\nimport Locale from '../../locales/Locale';\n\nconst StripeLocalesByLocale: Record<Locale, StripeElementLocale> = Object.freeze({\n\t'de-DE': 'de',\n\t'en-US': 'en',\n\t'es-MX': 'es-419',\n\t'fr-FR': 'fr-FR',\n\t'ko-KR': 'ko',\n\t'pt-BR': 'pt-BR',\n\t'zh-CN': 'zh',\n\t'zh-TW': 'zh-TW',\n});\n\nexport default StripeLocalesByLocale;\n","import { Box, Button } from '@faithlife/styled-ui';\nimport { ErrorCircle } from '@faithlife/styled-ui/icons/12px';\nimport styled from 'styled-components';\n\nexport * from '../../../sharedStyled';\n\nexport const LoadingSpinnerOverlay = styled.div`\n\tposition: absolute;\n\ttop: -5px;\n\tleft: -16px;\n\twidth: calc(100% + 32px);\n\theight: calc(100% + 10px);\n\tz-index: 10;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\n\t/* Semi-transparent background */\n\t&::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tbackground-color: ${({ theme }) => theme.colors.loadingSpinner.outerColor};\n\t\topacity: 0.3;\n\t\tz-index: 0;\n\t\tpointer-events: none;\n\t}\n\n\t/* Spinner above the overlay */\n\t> * {\n\t\tposition: relative;\n\t\tz-index: 1;\n\t\topacity: 1 !important;\n\t}\n`;\n\nexport const AddPaymentMethodContainer = styled.div`\n\tposition: relative;\n\tmin-height: 100px;\n`;\n\nexport const BillingAddressSummary = styled.div`\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: end;\n\tborder-bottom: 1px solid ${({ theme }) => theme.colors.borderColor};\n\tpadding: 12px 0;\n`;\n\nexport const BillingAddressForm = styled.div<{ isHidden?: boolean }>`\n\tdisplay: ${props => (props.isHidden ? 'none' : 'flex')};\n\tflex-direction: column;\n\tgap: 4px;\n`;\n\nexport const BillingAddressFormControls = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: flex-end;\n\tgap: 8px;\n\tmargin-top: 12px;\n\ttext-align: right;\n`;\n\nexport const EnterAddressFirstMessageContainer = styled.div`\n\tborder-radius: 4px;\n\tborder-left: 4px solid ${({ theme }) => theme.colors.red4};\n\tpadding: 8px;\n\tbackground-color: ${({ theme }) => theme.colors.red1};\n\tdisplay: flex;\n\tflex-direction: row;\n`;\n\nexport const EnterAddressFirstMessage = styled.div`\n\tmargin-left: 4px;\n`;\n\nexport const ErrorCircleIcon = styled(ErrorCircle)`\n\tmargin-right: 4px;\n\twidth: 24px;\n\theight: 18px;\n\t& svg,\n\t& path,\n\t& circle {\n\t\tfill: ${({ theme }) => theme.colors.red4} !important;\n\t}\n`;\n\nexport const BillingAddressNameRow = styled.div`\n\tfont-weight: bolder;\n`;\n\nexport const CancelButton = styled(Button).attrs({ variant: 'secondary', size: 'small' })`\n\torder: 2;\n\tmargin-left: auto;\n\tmargin-right: 16px;\n`;\n\nexport const CreateButton = styled(Button).attrs({ variant: 'primary', size: 'small' })`\n\torder: 1;\n`;\n\nexport const EditButton = styled(Button).attrs({\n\tvariant: 'link',\n\tsize: 'small',\n})`\n\tmargin-left: auto;\n`;\n\nexport const NewProfileButtons = styled.div`\n\tpadding-top: 12px;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\tflex-direction: row-reverse;\n`;\n\nexport const StripeElementsItemContainer = styled(Box).attrs({ marginBottom: 4 })``;\n","import ICountry from '../../../../../address-form/typings/ICountry';\nimport IStateDto from '../../../../../address-form/typings/IState';\nimport { IBillingProfileDto, ICreateOrdersBillingProfileDto } from '../../../../clients/typings/orders';\nimport IOrdersBillingProfileChangeSetDto from '../../../../clients/typings/orders/IBillingProfileChangeSetDto';\nimport { StripeBillingAddress } from './types';\n\nconst getLocationItemsFromIds = (\n\tcountryId: number,\n\tcountries: ICountry[],\n\tstateId: number,\n\tstatesByCountryId: Record<string, IStateDto[]>\n) => {\n\tconst country = countries.find(c => parseInt(c.countryId) === countryId);\n\n\tif (!country) {\n\t\tthrow new Error(`Country with id ${countryId} not found.`);\n\t}\n\n\tconst state =\n\t\tstateId && statesByCountryId\n\t\t\t? statesByCountryId[country.countryId]?.find(s => parseInt(s.stateId) === stateId)\n\t\t\t: null;\n\n\treturn { country, state };\n};\n\nconst getLocationItemsFromCodes = (\n\tcountryCode: string,\n\tcountries: ICountry[],\n\tstateAbbr?: string,\n\tstatesByCountryId?: Record<string, IStateDto[]>\n) => {\n\tconst country = countryCode && countries.find(c => c.alpha2.toLowerCase() === countryCode.toLowerCase());\n\n\tif (!country) {\n\t\tthrow new Error(`Country with code ${countryCode} not found`);\n\t}\n\n\tif (!stateAbbr || !statesByCountryId) {\n\t\treturn { country, state: null, suburb: null };\n\t}\n\n\tconst state = stateAbbr\n\t\t? (statesByCountryId[country.countryId] ?? statesByCountryId[countryCode.toUpperCase()])?.find(\n\t\t\t\ts => s.abbreviation.toLowerCase() === stateAbbr.toLowerCase()\n\t\t\t)\n\t\t: null;\n\n\tconst suburb = !state ? stateAbbr : null;\n\n\treturn { country, state, suburb };\n};\n\nconst getLocationItemsForStripe = (\n\tcountryId: number,\n\tcountries: ICountry[],\n\tstateId: number,\n\tstatesByCountryId: Record<string, IStateDto[]>,\n\tsuburb?: string\n) => {\n\tconst { country, state } = getLocationItemsFromIds(countryId, countries, stateId, statesByCountryId);\n\n\treturn {\n\t\tcountry: country.alpha2.toLowerCase(),\n\t\tstate: state?.abbreviation.toUpperCase() ?? suburb,\n\t};\n};\n\nconst mapToStripeBillingAddress: (\n\tbillingProfile: IBillingProfileDto,\n\tcountries: ICountry[],\n\tstatesByCountryId: Record<string, IStateDto[]>\n) => StripeBillingAddress = (\n\tbillingProfile: IBillingProfileDto,\n\tcountries: ICountry[],\n\tstatesByCountryId: Record<string, IStateDto[]>\n) => {\n\tconst { country, state } = getLocationItemsForStripe(\n\t\tbillingProfile.countryId,\n\t\tcountries,\n\t\tbillingProfile.stateId,\n\t\tstatesByCountryId,\n\t\tbillingProfile.suburb\n\t);\n\n\treturn {\n\t\tname: billingProfile.nameOnCard ?? undefined,\n\t\taddress: {\n\t\t\tline1: billingProfile.address1 ?? '',\n\t\t\tline2: billingProfile.address2 ?? '',\n\t\t\tcity: billingProfile.city ?? '',\n\t\t\tstate: state ?? '',\n\t\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t\tpostal_code: billingProfile.postalCode ?? '',\n\t\t\tcountry: country ?? '',\n\t\t},\n\t};\n};\n\nconst mapToCreateOrdersBillingProfileDto: (\n\tbillingAddress: StripeBillingAddress,\n\tcountries: ICountry[],\n\tstatesByCountryId: Record<string, IStateDto[]>\n) => ICreateOrdersBillingProfileDto = (\n\tbillingAddress: StripeBillingAddress,\n\tcountries: ICountry[],\n\tstatesByCountryId: Record<string, IStateDto[]>\n) => {\n\tconst { country, state, suburb } = getLocationItemsFromCodes(\n\t\tbillingAddress.address.country,\n\t\tcountries,\n\t\tbillingAddress.address.state,\n\t\tstatesByCountryId\n\t);\n\n\treturn {\n\t\tnameOnCard: billingAddress.name,\n\t\taddress1: billingAddress.address.line1,\n\t\taddress2: billingAddress.address.line2 ?? '',\n\t\tcity: billingAddress.address.city ?? '',\n\t\tcountryId: country.countryId,\n\t\tstateId: state?.stateId ?? '',\n\t\tpostalCode: billingAddress.address.postal_code,\n\t\tsuburb: suburb ?? '',\n\t\tisAdyenProfile: true,\n\t\tmakeDefault: false,\n\t\tuseOnPendingPrepubs: false,\n\t\tuseOnActiveSubscriptions: false,\n\t\tuseOnOutstandingPaymentPlans: false,\n\t\tuseOnActiveBids: false,\n\t};\n};\n\nconst mapToOrdersBillingProfileChangeSetDto: (\n\tbillingAddress: StripeBillingAddress,\n\tcountries: ICountry[],\n\tstatesByCountryId: Record<string, IStateDto[]>\n) => IOrdersBillingProfileChangeSetDto = (\n\tbillingAddress: StripeBillingAddress,\n\tcountries: ICountry[],\n\tstatesByCountryId: Record<string, IStateDto[]>\n) => {\n\tconst { country, state, suburb } = getLocationItemsFromCodes(\n\t\tbillingAddress.address.country,\n\t\tcountries,\n\t\tbillingAddress.address.state,\n\t\tstatesByCountryId\n\t);\n\n\treturn {\n\t\tnameOnCard: billingAddress.name,\n\t\texpirationMonth: 0,\n\t\texpirationYear: 0,\n\t\taddress1: billingAddress.address.line1,\n\t\taddress2: billingAddress.address.line2 ?? '',\n\t\tcity: billingAddress.address.city ?? '',\n\t\tcountryId: country.countryId,\n\t\tstateId: state?.stateId ?? '',\n\t\tpostalCode: billingAddress.address.postal_code,\n\t\tsuburb: suburb ?? '',\n\t\tisAdyenProfile: true,\n\t};\n};\n\nexport {\n\tgetLocationItemsFromCodes,\n\tgetLocationItemsForStripe,\n\tmapToStripeBillingAddress,\n\tmapToCreateOrdersBillingProfileDto,\n\tmapToOrdersBillingProfileChangeSetDto,\n};\n","import React, { useCallback, useEffect, useState } from 'react';\nimport { AddressElement, useElements } from '@stripe/react-stripe-js';\nimport { StripeAddressElementOptions, StripeAddressElementChangeEvent } from '@stripe/stripe-js';\nimport IAddressFormatItem from '../../../../../address-form/typings/IAddressFormatItem';\nimport ICountry from '../../../../../address-form/typings/ICountry';\nimport IStateDto from '../../../../../address-form/typings/IState';\nimport { StripeBillingAddress } from './types';\nimport * as Styled from './styled';\nimport ILocalizedResources from '../../../../typings/ILocalizedResources';\nimport AddressFieldKind from '../../../../clients/typings/locations/AddressFieldKind';\nimport { IBillingProfileDto } from '../../../../clients/typings/orders';\nimport { getLocationItemsFromCodes, mapToStripeBillingAddress } from './utils';\n\nconst validationTimeoutMs = 5 * 1000;\n\nenum BillingAddressMode {\n\tCheck,\n\tView,\n\tEdit,\n}\n\ninterface IBillingAddressProps {\n\tbillingAddressProfile: IBillingProfileDto | null;\n\tdefaultCountryCode: string;\n\tcountries: ICountry[];\n\tonCountryCodeChange: (countryCode: string) => void;\n\tonSubmitBillingAddress: (billingAddress: StripeBillingAddress, onSaveBillingAddressComplete: () => void) => void;\n\tonEditBillingAddress: () => void;\n\tisCancelPaymentAllowed: boolean;\n\tonCancelPayment?: () => void | undefined;\n\tonCancelEditingBillingAddress: () => void;\n\taddressFormatItems: IAddressFormatItem[];\n\tstatesByCountryId: Record<string, IStateDto[]>;\n\tisFirstTimeProfile?: boolean;\n\tresources: ILocalizedResources;\n}\n\nconst mapToAddressElementOptions = (\n\tbillingAddress: StripeBillingAddress | null,\n\tdefaultCountryCode: string\n): StripeAddressElementOptions => ({\n\tmode: 'billing',\n\tdefaultValues: billingAddress ?? {\n\t\taddress: {\n\t\t\tline2: ' ',\n\t\t\tcountry: defaultCountryCode,\n\t\t\tstate: '---',\n\t\t},\n\t},\n\tfields: { phone: 'never' },\n\tdisplay: { name: 'full' },\n\tautocomplete: { mode: 'disabled' },\n});\n\nconst BillingAddress = ({\n\tbillingAddressProfile,\n\tdefaultCountryCode,\n\tcountries,\n\tonCountryCodeChange,\n\tonSubmitBillingAddress,\n\tonEditBillingAddress,\n\tisCancelPaymentAllowed,\n\tonCancelPayment,\n\tonCancelEditingBillingAddress,\n\taddressFormatItems,\n\tstatesByCountryId,\n\tisFirstTimeProfile,\n\tresources,\n}: IBillingAddressProps) => {\n\tconst [isFormReady, setIsFormReady] = useState(false);\n\tconst [mode, setMode] = useState(BillingAddressMode.Check);\n\tconst [isValid, setIsValid] = useState(false);\n\tconst [billingAddress, setBillingAddress] = useState<StripeBillingAddress | null>(\n\t\tbillingAddressProfile ? mapToStripeBillingAddress(billingAddressProfile, countries, statesByCountryId) : null\n\t);\n\tconst [billingAddressFormVersion, setBillingAddressFormVersion] = useState(0);\n\n\tconst elements = useElements();\n\n\tconst handleAddressElementChange = useCallback(\n\t\t(event: StripeAddressElementChangeEvent) => {\n\t\t\tconst countryCode = event.value?.address?.country;\n\t\t\tif (countryCode) {\n\t\t\t\tonCountryCodeChange(countryCode);\n\t\t\t}\n\n\t\t\tsetIsValid(event.complete);\n\t\t},\n\t\t[onCountryCodeChange]\n\t);\n\n\tconst handleEditAddress = useCallback(() => {\n\t\tsetMode(BillingAddressMode.Edit);\n\t\tonEditBillingAddress();\n\t}, [onEditBillingAddress]);\n\n\tconst handleSubmitAddress = useCallback(async () => {\n\t\tconst billingAddressEvent = await elements?.getElement('address')?.getValue();\n\t\tif (billingAddressEvent?.complete) {\n\t\t\tconst billingAddressValue = billingAddressEvent.value;\n\t\t\tonSubmitBillingAddress(billingAddressValue, () => {\n\t\t\t\tsetBillingAddress(billingAddressValue);\n\t\t\t\tsetMode(BillingAddressMode.View);\n\t\t\t});\n\t\t}\n\t}, [elements, onSubmitBillingAddress]);\n\n\tconst handleCancelEditingBillingAddress = useCallback(() => {\n\t\tsetBillingAddressFormVersion(version => version + 1);\n\t\tonCancelEditingBillingAddress();\n\t\tsetMode(BillingAddressMode.View);\n\t}, [onCancelEditingBillingAddress]);\n\n\tuseEffect(() => {\n\t\tlet validationTimeoutId: NodeJS.Timeout | undefined;\n\t\tif (mode === BillingAddressMode.Check && billingAddress && isFormReady) {\n\t\t\tvalidationTimeoutId = setTimeout(() => {\n\t\t\t\telements?.getElement('address')?.getValue();\n\t\t\t}, validationTimeoutMs);\n\t\t}\n\t\treturn () => {\n\t\t\tif (validationTimeoutId) {\n\t\t\t\tclearTimeout(validationTimeoutId);\n\t\t\t}\n\t\t};\n\t}, [mode, billingAddress, isFormReady, elements]);\n\n\tuseEffect(() => {\n\t\tif (billingAddressProfile && billingAddress && mode === BillingAddressMode.Check) {\n\t\t\tif (!billingAddress.address.state) {\n\t\t\t\tconst enhancedBillingAddress = mapToStripeBillingAddress(billingAddressProfile, countries, statesByCountryId);\n\n\t\t\t\tif (enhancedBillingAddress.address.state) {\n\t\t\t\t\tsetBillingAddress(enhancedBillingAddress);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [billingAddress, billingAddressProfile, countries, mode, statesByCountryId]);\n\n\tuseEffect(() => {\n\t\tif (billingAddress) {\n\t\t\tsetBillingAddressFormVersion(version => version + 1);\n\t\t}\n\t}, [billingAddress]);\n\n\tconst isNewBillingAddress = !billingAddressProfile;\n\n\treturn (\n\t\t<Styled.StripeElementsItemContainer>\n\t\t\t{mode === BillingAddressMode.View && billingAddress?.address && (\n\t\t\t\t<Styled.BillingAddressSummary>\n\t\t\t\t\t<FormattedBillingAddress\n\t\t\t\t\t\tbillingAddress={billingAddress}\n\t\t\t\t\t\taddressFormatItems={addressFormatItems}\n\t\t\t\t\t\tcountries={countries}\n\t\t\t\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\t\t\t/>\n\t\t\t\t\t<Styled.EditButton onClick={handleEditAddress}>{resources.edit}</Styled.EditButton>\n\t\t\t\t</Styled.BillingAddressSummary>\n\t\t\t)}\n\t\t\t<Styled.BillingAddressForm isHidden={mode === BillingAddressMode.View}>\n\t\t\t\t<AddressElement\n\t\t\t\t\tkey={billingAddressFormVersion}\n\t\t\t\t\toptions={mapToAddressElementOptions(billingAddress, defaultCountryCode)}\n\t\t\t\t\tonChange={handleAddressElementChange}\n\t\t\t\t\tonReady={() => setIsFormReady(true)}\n\t\t\t\t/>\n\t\t\t\t{isFormReady && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Styled.BillingAddressFormControls>\n\t\t\t\t\t\t\t{isCancelPaymentAllowed && isNewBillingAddress && !isFirstTimeProfile && (\n\t\t\t\t\t\t\t\t<Styled.CancelButton onClick={onCancelPayment}>{resources.cancel}</Styled.CancelButton>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{!isNewBillingAddress && mode !== BillingAddressMode.Check && (\n\t\t\t\t\t\t\t\t<Styled.CancelButton onClick={handleCancelEditingBillingAddress}>\n\t\t\t\t\t\t\t\t\t{resources.cancel}\n\t\t\t\t\t\t\t\t</Styled.CancelButton>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<Styled.CreateButton\n\t\t\t\t\t\t\t\tdata-testid=\"stripe-billing-address-continue\"\n\t\t\t\t\t\t\t\tdisabled={!isValid}\n\t\t\t\t\t\t\t\tonClick={handleSubmitAddress}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{resources.continue}\n\t\t\t\t\t\t\t</Styled.CreateButton>\n\t\t\t\t\t\t</Styled.BillingAddressFormControls>\n\t\t\t\t\t\t{!isValid && (\n\t\t\t\t\t\t\t<Styled.EnterAddressFirstMessageContainer>\n\t\t\t\t\t\t\t\t<Styled.ErrorCircleIcon />\n\t\t\t\t\t\t\t\t<Styled.EnterAddressFirstMessage>\n\t\t\t\t\t\t\t\t\t{resources.enterBillingAddressBeforePayment}\n\t\t\t\t\t\t\t\t</Styled.EnterAddressFirstMessage>\n\t\t\t\t\t\t\t</Styled.EnterAddressFirstMessageContainer>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Styled.BillingAddressForm>\n\t\t</Styled.StripeElementsItemContainer>\n\t);\n};\n\nconst stripeAddressFormatItems = [\n\tAddressFieldKind.City,\n\tAddressFieldKind.State,\n\tAddressFieldKind.PostalCode,\n\tAddressFieldKind.Suburb,\n];\n\nconst stripeAddressFormatItemMappings: Record<string, (...args: any[]) => any> = {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t[AddressFieldKind.City]: (billingAddress: StripeBillingAddress, _state: IStateDto, _suburb: string) =>\n\t\tbillingAddress.address.city,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t[AddressFieldKind.State]: (billingAddress: StripeBillingAddress, state: IStateDto, _suburb: string) =>\n\t\tstate?.abbreviation.toUpperCase(),\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t[AddressFieldKind.PostalCode]: (billingAddress: StripeBillingAddress, _state: IStateDto, _suburb: string) =>\n\t\tbillingAddress.address.postal_code,\n\t[AddressFieldKind.Suburb]: (billingAddress: StripeBillingAddress, state: IStateDto, suburb: string) => suburb,\n};\n\ninterface IFormattedBillingAddressProps {\n\tbillingAddress: StripeBillingAddress;\n\taddressFormatItems: IAddressFormatItem[];\n\tcountries: ICountry[];\n\tstatesByCountryId: Record<string, IStateDto[]>;\n}\n\nconst FormattedBillingAddress = ({\n\tbillingAddress,\n\taddressFormatItems,\n\tcountries,\n\tstatesByCountryId,\n}: IFormattedBillingAddressProps) => {\n\tconst { country, state, suburb } = getLocationItemsFromCodes(\n\t\tbillingAddress.address.country,\n\t\tcountries,\n\t\tbillingAddress.address.state,\n\t\tstatesByCountryId\n\t);\n\n\treturn (\n\t\t<div>\n\t\t\t<Styled.BillingAddressNameRow>{billingAddress.name}</Styled.BillingAddressNameRow>\n\t\t\t<div>{billingAddress.address.line1}</div>\n\t\t\t{billingAddress.address.line2 && <div>{billingAddress.address.line2}</div>}\n\t\t\t<div>\n\t\t\t\t{addressFormatItems\n\t\t\t\t\t.filter(field => stripeAddressFormatItems.includes(field.kind))\n\t\t\t\t\t.map(field => stripeAddressFormatItemMappings[field.kind](billingAddress, state, suburb))\n\t\t\t\t\t.filter(item => !!item)\n\t\t\t\t\t.join(' ')}\n\t\t\t</div>\n\t\t\t<div>{country.name}</div>\n\t\t</div>\n\t);\n};\n\nexport default BillingAddress;\n","import React, { useCallback, useState } from 'react';\nimport { PaymentElement } from '@stripe/react-stripe-js';\nimport { StripePaymentElementChangeEvent, StripePaymentElementOptions } from '@stripe/stripe-js';\nimport ILocalizedResources from '../../../../typings/ILocalizedResources';\nimport * as Styled from './styled';\n\ninterface IPaymentMethodsProps {\n\tselectedPaymentMethod: string | undefined;\n\tisProcessingPayment: boolean;\n\tonPaymentMethodChange: (paymentMethod: string, isComplete: boolean) => void;\n\tisCancelPaymentAllowed: boolean;\n\tonCancelPayment?: () => void;\n\tonSubmitPayment: (event: any) => void;\n\tresources: ILocalizedResources;\n\tisFirstTimeProfile?: boolean;\n}\n\nconst getPaymentElementOptions: StripePaymentElementOptions = {\n\tlayout: {\n\t\ttype: 'accordion',\n\t\tdefaultCollapsed: false,\n\t\tradios: false,\n\t\tspacedAccordionItems: true,\n\t},\n};\n\nconst PaymentMethods = ({\n\tselectedPaymentMethod,\n\tisProcessingPayment,\n\tonPaymentMethodChange,\n\tisCancelPaymentAllowed,\n\tonCancelPayment,\n\tonSubmitPayment,\n\tresources,\n\tisFirstTimeProfile,\n}: IPaymentMethodsProps) => {\n\tconst [isPaymentSubmitEnabled, setIsPaymentSubmitEnabled] = useState(false);\n\n\tconst handlePaymentElementChange = useCallback(\n\t\t(event: StripePaymentElementChangeEvent) => {\n\t\t\tonPaymentMethodChange(event.value.type, event.complete);\n\t\t\tsetIsPaymentSubmitEnabled(event.complete);\n\t\t},\n\t\t[onPaymentMethodChange]\n\t);\n\n\tconst isSubmitButtonDisabled = !isPaymentSubmitEnabled || isProcessingPayment;\n\n\treturn (\n\t\t<Styled.StripeElementsItemContainer>\n\t\t\t<PaymentElement options={getPaymentElementOptions} onChange={handlePaymentElementChange} />\n\t\t\t<Styled.NewProfileButtons>\n\t\t\t\t{isCancelPaymentAllowed && !isFirstTimeProfile && (\n\t\t\t\t\t<Styled.CancelButton onClick={onCancelPayment}>{resources.cancel}</Styled.CancelButton>\n\t\t\t\t)}\n\t\t\t\t<Styled.CreateButton\n\t\t\t\t\tonClick={onSubmitPayment}\n\t\t\t\t\tdisabled={isSubmitButtonDisabled}\n\t\t\t\t\tclassName=\"place-order\"\n\t\t\t\t\tdata-testid=\"place-order-payment-mode\"\n\t\t\t\t\tdata-paymentmethod={selectedPaymentMethod}\n\t\t\t\t>\n\t\t\t\t\t{selectedPaymentMethod === 'external_paypal'\n\t\t\t\t\t\t? resources.continueToPayPal\n\t\t\t\t\t\t: selectedPaymentMethod === 'klarna'\n\t\t\t\t\t\t\t? resources.proceed\n\t\t\t\t\t\t\t: resources.placeOrder}\n\t\t\t\t</Styled.CreateButton>\n\t\t\t</Styled.NewProfileButtons>\n\t\t</Styled.StripeElementsItemContainer>\n\t);\n};\n\nexport default PaymentMethods;\n","// Copied from adyen-payment-methods\nconst minorUnitDecimalsByCurrencyCode: Record<string, number> = { USD: 2 };\n\nexport const convertToMinorUnits = (amount: number, currencyCode: string) => {\n\tconst minorUnitDecimals = minorUnitDecimalsByCurrencyCode[currencyCode.toUpperCase()];\n\n\tif (!minorUnitDecimals) {\n\t\tthrow new Error(`Unsupported currency ${currencyCode}`);\n\t}\n\n\tconst multiplier = Math.pow(10, minorUnitDecimals);\n\treturn Math.round(amount * multiplier);\n};\n","export enum PaymentMethodEvent {\n\tPaymentProcessing = 'payment:processing',\n\tPaymentProcessed = 'payment:processed',\n\tPaymentSubmit = 'payment:submit',\n\tPaymentCanceled = 'payment:canceled',\n\tBillingAddressProfileUpdated = 'billingAddressProfile:updated',\n\tBillingAddressComplete = 'billingAddress:complete',\n\tBillingAddressRequired = 'billingAddress:required',\n\tPaymentMethodComplete = 'paymentMethod:complete',\n\tPaymentMethodRequired = 'paymentMethod:required',\n\tPaymentMethodChange = 'paymentMethod:change',\n\tPaymentFormOpened = 'paymentForm:opened',\n\tPaymentFormClosed = 'paymentForm:closed',\n}\n\nexport interface PaymentMethodEventPayload {\n\ttype: PaymentMethodEvent;\n\tbillingAddressProfileId?: string;\n\tselectedPaymentMethod?: string;\n}\n\nexport type PaymentMethodEventListener = (payload: PaymentMethodEventPayload) => void;\n\nclass PaymentMethodEventHandler {\n\tprivate listeners: PaymentMethodEventListener[] = [];\n\n\tpublic emit(typeOrPayload: PaymentMethodEvent | PaymentMethodEventPayload) {\n\t\tlet payload: PaymentMethodEventPayload;\n\t\tif (typeof typeOrPayload === 'string') {\n\t\t\tpayload = { type: typeOrPayload as PaymentMethodEvent };\n\t\t} else {\n\t\t\tpayload = typeOrPayload;\n\t\t}\n\t\tthis.listeners.forEach(listener => listener(payload));\n\t}\n\n\tpublic subscribe(listener: PaymentMethodEventListener) {\n\t\tthis.listeners.push(listener);\n\t\treturn () => {\n\t\t\tthis.listeners = this.listeners.filter(l => l !== listener);\n\t\t};\n\t}\n}\n\nexport const paymentMethodEventHandler = new PaymentMethodEventHandler();\n","import React, { useCallback, useEffect, useState, useMemo } from 'react';\nimport { Elements } from '@stripe/react-stripe-js';\nimport { StripeElementsOptions } from '@stripe/stripe-js';\nimport { loadStripe } from '@stripe/stripe-js/pure';\nimport { ProgressIndicator } from '@faithlife/commerce-components';\nimport { useMutation } from 'react-query';\nimport IStateDto from '../../../../../address-form/typings/IState';\nimport ICountry from '../../../../../address-form/typings/ICountry';\nimport IAddressFormatItem from '../../../../../address-form/typings/IAddressFormatItem';\nimport { ISystemMessage } from '../../../../typings/ISystemMessage';\nimport StripeEnvironmentKind from '../../../../typings/StripeEnvironmentKind';\nimport PayFacClient from '../../../../clients/payfac-client';\nimport { IBillingProfileDto } from '../../../../clients/typings/orders';\nimport { useLocalization } from '../../../../Localization';\nimport LogLevel from '../../../../typings/LogLevel';\nimport Locale from '../../../../locales/Locale';\nimport StripeLocalesByLocale from '../../../stripe-locales-by-locale';\nimport BillingAddress from './billing-address';\nimport PaymentMethods from './payment-methods';\nimport useBillingAddressProfileHandler from './use-billing-address-profile-handler';\nimport { StripeBillingAddress } from './types';\nimport IStripeCustomerSessionResponseDto from '../../../../clients/typings/orders/IStripeCustomerSessionResponseDto';\nimport { convertToMinorUnits } from '../../../../utilities/convert-to-minor-unities';\nimport usePaymentMethodsFormEvents from './use-payment-form-handler';\nimport { getLocationItemsFromCodes } from './utils';\nimport * as Styled from './styled';\n\ninterface IAddPaymentMethodWrapperProps {\n\treturnUrl: string;\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tonCancelEditingBillingProfile?: () => void;\n\tenvironment: StripeEnvironmentKind;\n\tproxyRoutePrefix?: string;\n\tlog?: (logLevel: LogLevel, message: string, details?: Record<string, any>) => void;\n\tlocale?: Locale;\n\tdarkMode?: boolean;\n\tcurrencyCode: string;\n\tcountryCode: string;\n\tonSubmitBeforeRedirect?: () => void;\n\tonPaymentModePaymentSuccess?: (orderId: string, cartToken: string) => void;\n\tamount?: number;\n\tcartToken?: string | null;\n\tdoPaypalRedirect?: () => void;\n\tonBillingAddressChange?: (profileId: string, onAmountChanged: (amount: number) => void) => Promise<void>;\n\taddressFormatItems: IAddressFormatItem[];\n\tcountries: ICountry[];\n\tstatesByCountryId: Record<string, IStateDto[]>;\n\thandleCountryChanged: (countryId: string) => void;\n\thasLoadedAddressInfo: boolean;\n\tisFirstTimeProfile?: boolean;\n}\n\nconst AddPaymentMethodWrapper: React.FunctionComponent<IAddPaymentMethodWrapperProps> = props => {\n\tconst stripePublishableKey =\n\t\tprops.environment === 'test'\n\t\t\t? 'pk_test_51OtyM0Ekx18uXxbJgF5GwdsWe7f6a9pDyG8Uv9QioQaEZkZUCp1wUbXcDzGf7Ipi36CdbiBDvZ8bKK3Kqq3Y7IU800k1dKzWpm'\n\t\t\t: 'pk_live_51OtyM0Ekx18uXxbJLgVlqLFe8nzhf2pE3XwzjZTAAVLZbWFxmprOiGbhQSXSME3V0K4OH9BSEha7OpsRnp8A810h007ZqDP4yQ';\n\n\tconst stripePromise = useMemo(\n\t\t() =>\n\t\t\tloadStripe(stripePublishableKey, {\n\t\t\t\tlocale: props.locale && StripeLocalesByLocale[props.locale],\n\t\t\t}),\n\t\t[stripePublishableKey, props.locale]\n\t);\n\tconst strings = useLocalization();\n\tconst [customerSessionClientSecret, setCustomerSessionClientSecret] = useState<string | undefined>(undefined);\n\tconst [paymentMethodConfigurationId, setPaymentMethodConfigurationId] = useState<string | undefined>(undefined);\n\n\tconst { mutate: createCustomerSession, isLoading: isCreateCustomerSessionLoading } = useMutation<\n\t\tany,\n\t\tIStripeCustomerSessionResponseDto,\n\t\tvoid\n\t>(\n\t\tasync () => {\n\t\t\treturn await PayFacClient.createStripePaymentModeCustomerSession(props.proxyRoutePrefix);\n\t\t},\n\t\t{\n\t\t\tonSuccess: response => {\n\t\t\t\tsetCustomerSessionClientSecret(response.customerSessionClientSecret);\n\t\t\t\tsetPaymentMethodConfigurationId(response.paymentMethodConfigurationId);\n\t\t\t},\n\t\t\tonError: () =>\n\t\t\t\tprops.setSystemMessage({\n\t\t\t\t\tmessage: strings.billingUpdateError,\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t}),\n\t\t}\n\t);\n\n\t// Stripe matches the case of the currency code, so we convert it to lowercase\n\tconst currencyCode = props.currencyCode?.toLowerCase() || 'usd';\n\n\tconst elementsOptions: StripeElementsOptions | null = useMemo(() => {\n\t\tif (!customerSessionClientSecret || !paymentMethodConfigurationId) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst externalPaymentMethodTypes = props.doPaypalRedirect ? ['external_paypal'] : [];\n\n\t\tif (!props.amount || props.amount === 0) {\n\t\t\tthrow new Error('Amount must be provided and greater than 0 for payment mode');\n\t\t}\n\n\t\treturn {\n\t\t\tamount: convertToMinorUnits(props.amount, currencyCode),\n\t\t\tcurrency: currencyCode,\n\t\t\tmode: 'payment',\n\t\t\tcaptureMethod: 'automatic', // This must match the server-side payment intent creation\n\t\t\texternalPaymentMethodTypes,\n\t\t\tcustomerSessionClientSecret: customerSessionClientSecret,\n\t\t\tappearance: {\n\t\t\t\ttheme: props.darkMode ? 'night' : 'stripe',\n\t\t\t},\n\t\t\tpaymentMethodConfiguration: paymentMethodConfigurationId,\n\t\t};\n\t}, [\n\t\tprops.darkMode,\n\t\tprops.amount,\n\t\tprops.doPaypalRedirect,\n\t\tcurrencyCode,\n\t\tcustomerSessionClientSecret,\n\t\tpaymentMethodConfigurationId,\n\t]);\n\n\tuseEffect(() => createCustomerSession(), [createCustomerSession]);\n\n\treturn (\n\t\t<Styled.AddPaymentMethodContainer className=\"payment-form\">\n\t\t\t{isCreateCustomerSessionLoading ? (\n\t\t\t\t<Styled.LoadingSpinnerOverlay>\n\t\t\t\t\t<ProgressIndicator className=\"h-12 w-12\" />\n\t\t\t\t</Styled.LoadingSpinnerOverlay>\n\t\t\t) : elementsOptions ? (\n\t\t\t\t<Elements stripe={stripePromise} options={elementsOptions}>\n\t\t\t\t\t<AddPaymentMethod {...props} currencyCode={currencyCode} />\n\t\t\t\t</Elements>\n\t\t\t) : null}\n\t\t</Styled.AddPaymentMethodContainer>\n\t);\n};\n\nconst AddPaymentMethod: React.FunctionComponent<IAddPaymentMethodWrapperProps> = ({\n\treturnUrl,\n\tsetSystemMessage,\n\tproxyRoutePrefix,\n\tlog,\n\tonCancelEditingBillingProfile,\n\tcountryCode: initialCountryCode,\n\tcurrencyCode,\n\tamount: initialAmount,\n\tcartToken,\n\tonSubmitBeforeRedirect,\n\tdoPaypalRedirect,\n\tonPaymentModePaymentSuccess,\n\tonBillingAddressChange,\n\taddressFormatItems,\n\tcountries,\n\tstatesByCountryId,\n\thandleCountryChanged,\n\tisFirstTimeProfile,\n}) => {\n\tconst strings = useLocalization();\n\n\tconst [amount, setAmount] = useState<number | undefined>(initialAmount);\n\n\tuseEffect(() => setAmount(initialAmount), [initialAmount]);\n\n\tconst [arePaymentMethodsVisible, setArePaymentMethodsVisible] = useState(false);\n\n\tconst handleError = useCallback(\n\t\t(message: string) => {\n\t\t\tsetSystemMessage({ status: 'error', message: message });\n\t\t},\n\t\t[setSystemMessage]\n\t);\n\n\tconst [selectedPaymentMethod, setSelectedPaymentMethod] = useState<string | undefined>(undefined);\n\n\tconst handleCountryCodeChange = useCallback(\n\t\t(countryCode: string) => {\n\t\t\tconst { country } = getLocationItemsFromCodes(countryCode, countries);\n\t\t\thandleCountryChanged(country.countryId);\n\t\t},\n\t\t[handleCountryChanged, countries]\n\t);\n\n\tconst handleBillingAddressProfileSaved = useCallback(\n\t\tasync (billingAddressProfile: IBillingProfileDto) => {\n\t\t\tif (!onBillingAddressChange) {\n\t\t\t\tsetArePaymentMethodsVisible(true);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait onBillingAddressChange(billingAddressProfile.profileId, amount => {\n\t\t\t\t\tsetAmount(amount);\n\t\t\t\t\tsetArePaymentMethodsVisible(true);\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tlog?.(LogLevel.Error, 'Failed to recalculate amount after billing address change', { error });\n\t\t\t\thandleError(strings.billingUpdateError);\n\t\t\t}\n\t\t},\n\t\t[onBillingAddressChange, log, handleError, strings.billingUpdateError]\n\t);\n\n\tconst handleSaveBillingAddressProfileError = useCallback(\n\t\t(error: any) => {\n\t\t\tlog?.(LogLevel.Error, 'Failed to save billing address profile', {\n\t\t\t\terrors: error,\n\t\t\t});\n\t\t\thandleError(strings.failedToProcessBillingAddress);\n\t\t},\n\t\t[log, handleError, strings.failedToProcessBillingAddress]\n\t);\n\n\tconst { billingAddressProfile, loadBillingAddressProfile, saveBillingAddressProfile } =\n\t\tuseBillingAddressProfileHandler(\n\t\t\thandleBillingAddressProfileSaved,\n\t\t\thandleSaveBillingAddressProfileError,\n\t\t\tproxyRoutePrefix,\n\t\t\tlog\n\t\t);\n\n\tconst { onPaymentMethodChange, onSubmitPayment, onCancelPayment, isProcessingPayment } = usePaymentMethodsFormEvents({\n\t\tlog,\n\t\thandleError,\n\t\tsetSystemMessage,\n\t\tproxyRoutePrefix,\n\t\tcartToken,\n\t\treturnUrl,\n\t\tamount,\n\t\tcurrencyCode,\n\t\tselectedPaymentMethod,\n\t\tarePaymentMethodsVisible,\n\t\tbillingAddressProfileId: billingAddressProfile?.profileId,\n\t\tdoPaypalRedirect,\n\t\tonPaymentModePaymentSuccess,\n\t\tonSubmitBeforeRedirect,\n\t});\n\n\tconst handleSubmitPayment = useCallback(\n\t\t(event: React.FormEvent) => {\n\t\t\tevent.preventDefault();\n\t\t\tonSubmitPayment();\n\t\t},\n\t\t[onSubmitPayment]\n\t);\n\n\tconst handlePaymentMethodChange = useCallback(\n\t\t(paymentMethod: string, isComplete: boolean) => {\n\t\t\tsetSelectedPaymentMethod(paymentMethod);\n\t\t\tonPaymentMethodChange(isComplete);\n\t\t},\n\t\t[onPaymentMethodChange]\n\t);\n\n\tconst handleEditBillingAddress = useCallback(() => setArePaymentMethodsVisible(false), []);\n\tconst handleCancelEditingBillingAddress = useCallback(() => setArePaymentMethodsVisible(true), []);\n\n\tconst handleSubmitBillingAddress = useCallback(\n\t\tasync (billingAddress: StripeBillingAddress, onSaveBillingAddressComplete: () => void) => {\n\t\t\tif (!billingAddress?.address) {\n\t\t\t\tthrow new Error('Billing address is null');\n\t\t\t}\n\n\t\t\tconst success = await saveBillingAddressProfile(billingAddress, countries, statesByCountryId);\n\t\t\tif (success) {\n\t\t\t\tonSaveBillingAddressComplete();\n\t\t\t}\n\t\t},\n\t\t[saveBillingAddressProfile, countries, statesByCountryId]\n\t);\n\n\tconst [isFormReady, setIsFormReady] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!isFormReady) {\n\t\t\tconst fetchInitialBillingAddressProfile = async () => {\n\t\t\t\tawait loadBillingAddressProfile();\n\t\t\t\tsetIsFormReady(true);\n\t\t\t};\n\n\t\t\thandleCountryCodeChange(initialCountryCode);\n\t\t\tfetchInitialBillingAddressProfile();\n\t\t}\n\t}, [isFormReady, loadBillingAddressProfile, handleCountryCodeChange, initialCountryCode]);\n\n\tconst handleCancelPayment = useCallback(() => {\n\t\tonCancelPayment();\n\t\tonCancelEditingBillingProfile?.();\n\t}, [onCancelPayment, onCancelEditingBillingProfile]);\n\n\tconst isCancelPaymentAllowed = !!onCancelEditingBillingProfile;\n\n\treturn (\n\t\t<>\n\t\t\t{isFormReady && (\n\t\t\t\t<>\n\t\t\t\t\t<BillingAddress\n\t\t\t\t\t\tbillingAddressProfile={billingAddressProfile}\n\t\t\t\t\t\tdefaultCountryCode={initialCountryCode}\n\t\t\t\t\t\tcountries={countries}\n\t\t\t\t\t\tonCountryCodeChange={handleCountryCodeChange}\n\t\t\t\t\t\tonSubmitBillingAddress={handleSubmitBillingAddress}\n\t\t\t\t\t\tonEditBillingAddress={handleEditBillingAddress}\n\t\t\t\t\t\tisCancelPaymentAllowed={isCancelPaymentAllowed}\n\t\t\t\t\t\tonCancelPayment={handleCancelPayment}\n\t\t\t\t\t\tonCancelEditingBillingAddress={handleCancelEditingBillingAddress}\n\t\t\t\t\t\taddressFormatItems={addressFormatItems}\n\t\t\t\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\t\t\t\tisFirstTimeProfile={isFirstTimeProfile}\n\t\t\t\t\t\tresources={strings}\n\t\t\t\t\t/>\n\t\t\t\t\t{arePaymentMethodsVisible && (\n\t\t\t\t\t\t<PaymentMethods\n\t\t\t\t\t\t\tselectedPaymentMethod={selectedPaymentMethod}\n\t\t\t\t\t\t\tisProcessingPayment={isProcessingPayment}\n\t\t\t\t\t\t\tonPaymentMethodChange={handlePaymentMethodChange}\n\t\t\t\t\t\t\tisCancelPaymentAllowed={isCancelPaymentAllowed}\n\t\t\t\t\t\t\tonCancelPayment={handleCancelPayment}\n\t\t\t\t\t\t\tonSubmitPayment={handleSubmitPayment}\n\t\t\t\t\t\t\tresources={strings}\n\t\t\t\t\t\t\tisFirstTimeProfile={isFirstTimeProfile}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nexport default AddPaymentMethodWrapper;\n","import { useCallback, useState } from 'react';\nimport ICountry from '../../../../../address-form/typings/ICountry';\nimport IStateDto from '../../../../../address-form/typings/IState';\nimport OrdersClient from '../../../../clients/orders-client';\nimport { IBillingProfileDto } from '../../../../clients/typings/orders';\nimport { isErrors } from '../../../../clients/typings/orders/IErrors';\nimport LogLevel from '../../../../typings/LogLevel';\nimport { mapToCreateOrdersBillingProfileDto, mapToOrdersBillingProfileChangeSetDto } from './utils';\nimport { StripeBillingAddress } from './types';\n\nconst useBillingAddressProfileHandler = (\n\tonBillingAddressProfileSaved: (createdBillingAddresProfile: IBillingProfileDto) => Promise<void> | void,\n\tonSaveBillingAddressProfileError: (error: any) => void,\n\tproxyRoutePrefix?: string,\n\tlog?: (logLevel: LogLevel, message: string, details?: Record<string, any>) => void\n) => {\n\tconst [billingAddressProfile, setBillingAddressProfile] = useState<IBillingProfileDto | null>(null);\n\n\tconst createBillingAddressProfile = useCallback(\n\t\tasync (\n\t\t\tbillingAddress: StripeBillingAddress,\n\t\t\tcountries: ICountry[],\n\t\t\tstatesByCountryId: Record<string, IStateDto[]>\n\t\t) => {\n\t\t\ttry {\n\t\t\t\tconst response = await OrdersClient.createOrdersBillingProfile(\n\t\t\t\t\tmapToCreateOrdersBillingProfileDto(billingAddress, countries, statesByCountryId),\n\t\t\t\t\tproxyRoutePrefix\n\t\t\t\t);\n\n\t\t\t\tif (!isErrors(response)) {\n\t\t\t\t\tsetBillingAddressProfile(response);\n\t\t\t\t\tawait onBillingAddressProfileSaved(response);\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\tonSaveBillingAddressProfileError(response);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tonSaveBillingAddressProfileError(e);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\t[onBillingAddressProfileSaved, onSaveBillingAddressProfileError, proxyRoutePrefix]\n\t);\n\n\tconst updateBillingAddressProfile = useCallback(\n\t\tasync (\n\t\t\tbillingAddress: StripeBillingAddress,\n\t\t\tcountries: ICountry[],\n\t\t\tstatesByCountryId: Record<string, IStateDto[]>\n\t\t) => {\n\t\t\ttry {\n\t\t\t\tif (!billingAddressProfile) {\n\t\t\t\t\tthrow new Error('No billing address profile to update');\n\t\t\t\t}\n\n\t\t\t\tconst response = await OrdersClient.updateOrdersBillingProfile(\n\t\t\t\t\tbillingAddressProfile.profileId,\n\t\t\t\t\tmapToOrdersBillingProfileChangeSetDto(billingAddress, countries, statesByCountryId),\n\t\t\t\t\tproxyRoutePrefix\n\t\t\t\t);\n\n\t\t\t\tif (!isErrors(response)) {\n\t\t\t\t\tsetBillingAddressProfile(response);\n\t\t\t\t\tawait onBillingAddressProfileSaved(response);\n\t\t\t\t\treturn true;\n\t\t\t\t} else {\n\t\t\t\t\tonSaveBillingAddressProfileError(response);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tonSaveBillingAddressProfileError(e);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\t[billingAddressProfile, onBillingAddressProfileSaved, onSaveBillingAddressProfileError, proxyRoutePrefix]\n\t);\n\n\tconst loadBillingAddressProfile = useCallback(async () => {\n\t\ttry {\n\t\t\tconst shouldIncludePaypal = false;\n\t\t\tconst shouldIncludeStripe = false;\n\t\t\tconst shouldIncludeAdyenAddressOnly = true;\n\n\t\t\tconst response = await OrdersClient.getBillingProfiles(\n\t\t\t\tproxyRoutePrefix,\n\t\t\t\tshouldIncludePaypal,\n\t\t\t\tshouldIncludeAdyenAddressOnly,\n\t\t\t\tshouldIncludeStripe\n\t\t\t);\n\n\t\t\tconst billingAddressProfile = response?.billingProfiles?.[0] ?? null;\n\t\t\tsetBillingAddressProfile(billingAddressProfile);\n\t\t} catch (e) {\n\t\t\tlog?.(LogLevel.Error, 'Exception while loading billing profile', { errors: e });\n\t\t}\n\t}, [log, proxyRoutePrefix]);\n\n\treturn {\n\t\tbillingAddressProfile,\n\t\tloadBillingAddressProfile,\n\t\tsaveBillingAddressProfile: billingAddressProfile ? updateBillingAddressProfile : createBillingAddressProfile,\n\t};\n};\n\nexport default useBillingAddressProfileHandler;\n","import { useCallback, useEffect, useState } from 'react';\nimport { useStripe, useElements } from '@stripe/react-stripe-js';\nimport { useQuery } from 'react-query';\nimport OrdersClient from '../../../../clients/orders-client';\nimport { ErrorMapper, IOrderDto, IPendingActionDto, IProcessCartDto } from '../../../../clients/typings/orders';\nimport LogLevel from '../../../../typings/LogLevel';\nimport { useLocalization } from '../../../../Localization';\nimport { isErrorsDto } from '../../../../clients/typings/orders/IErrorsDto';\nimport { PaymentMethodEvent, paymentMethodEventHandler } from '../payment-method-event-handler';\nimport { ISystemMessage } from '../../../../typings/ISystemMessage';\n\ninterface IPaymentMethodFormProps {\n\tlog?: (level: LogLevel, message: string, meta?: any) => void;\n\thandleError: (message: string) => void;\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tproxyRoutePrefix?: string;\n\tcartToken: string | null | undefined;\n\treturnUrl: string;\n\tamount: number | undefined;\n\tcurrencyCode: string;\n\tselectedPaymentMethod: string | undefined;\n\tarePaymentMethodsVisible: boolean;\n\tbillingAddressProfileId?: string;\n\tdoPaypalRedirect?: () => void;\n\tonPaymentModePaymentSuccess?: (orderTxnId: string, cartToken: string) => void;\n\tonSubmitBeforeRedirect?: () => void;\n}\n\nconst usePaymentFormHandler = ({\n\tlog,\n\thandleError,\n\tsetSystemMessage,\n\tproxyRoutePrefix,\n\tcartToken,\n\treturnUrl,\n\tamount,\n\tcurrencyCode,\n\tselectedPaymentMethod,\n\tarePaymentMethodsVisible,\n\tbillingAddressProfileId,\n\tdoPaypalRedirect,\n\tonPaymentModePaymentSuccess,\n\tonSubmitBeforeRedirect,\n}: IPaymentMethodFormProps) => {\n\tconst stripe = useStripe();\n\tconst elements = useElements();\n\tconst strings = useLocalization();\n\n\tconst [isProcessingPayment, setIsProcessingPayment] = useState(false);\n\tconst [shouldPollCart, setShouldPollCart] = useState(false);\n\n\tconst handleSubmitPayment = useCallback(async () => {\n\t\tif (!stripe) {\n\t\t\tlog?.(LogLevel.Error, \"Stripe.js hasn't yet loaded.\");\n\t\t\thandleError(strings.failedToProcessPayment);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!elements || elements === null) {\n\t\t\tlog?.(LogLevel.Error, \"Elements hasn't loaded, this shouldn't be possible.\");\n\t\t\thandleError(strings.failedToProcessPayment);\n\t\t\treturn;\n\t\t}\n\n\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentProcessing);\n\t\tsetIsProcessingPayment(true);\n\n\t\t// Trigger form validation and wallet collection\n\t\tconst { error: submitError } = await elements.submit();\n\t\tif (submitError) {\n\t\t\tsetSystemMessage({\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: strings.failedToProcessPayment,\n\t\t\t});\n\t\t\tlog?.(LogLevel.Info, `Elements submit aborted or errored: ${submitError.message || 'unknown'}`);\n\t\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentProcessed);\n\t\t\tsetIsProcessingPayment(false);\n\t\t\treturn;\n\t\t}\n\n\t\tif (selectedPaymentMethod === 'external_paypal') {\n\t\t\tif (!doPaypalRedirect) {\n\t\t\t\tthrow new Error('doPaypalRedirect is required when PayPal is enabled.');\n\t\t\t}\n\n\t\t\tdoPaypalRedirect();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tif (!cartToken) {\n\t\t\t\tthrow new Error('cartToken is required for payment mode.');\n\t\t\t}\n\n\t\t\tif (amount === undefined) {\n\t\t\t\tthrow new Error('amount is required for payment mode, but was undefined.');\n\t\t\t}\n\n\t\t\tif (amount === null) {\n\t\t\t\tthrow new Error('amount is required for payment mode, but was null.');\n\t\t\t}\n\n\t\t\tif (!currencyCode) {\n\t\t\t\tthrow new Error('currencyCode is required for payment mode.');\n\t\t\t}\n\n\t\t\tif (!onPaymentModePaymentSuccess) {\n\t\t\t\tthrow new Error('onPaymentModePaymentSuccess is required for payment mode.');\n\t\t\t}\n\n\t\t\tconst { error, confirmationToken } = await stripe.createConfirmationToken({\n\t\t\t\telements,\n\t\t\t\tparams: {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t\t\t\treturn_url: returnUrl,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (error) {\n\t\t\t\tlog?.(\n\t\t\t\t\tLogLevel.Error,\n\t\t\t\t\t`Error while creating a confirmation token, ${error.message}: code ${error.code}, type: ${error.type}`\n\t\t\t\t);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (!confirmationToken) {\n\t\t\t\tthrow new Error('Confirmation token was not created');\n\t\t\t}\n\n\t\t\t// Extract billing address from confirmation token\n\t\t\tconst billingDetails = confirmationToken.payment_method_preview?.billing_details;\n\t\t\tconst billingAddress = billingDetails?.address;\n\n\t\t\tconst processCartDto: IProcessCartDto = {\n\t\t\t\tbillingAddress: billingAddress\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tname: billingDetails?.name || '',\n\t\t\t\t\t\t\taddress1: billingAddress.line1 || '',\n\t\t\t\t\t\t\taddress2: billingAddress.line2 || '',\n\t\t\t\t\t\t\tcity: billingAddress.city || '',\n\t\t\t\t\t\t\tpostalCode: billingAddress.postal_code || '',\n\t\t\t\t\t\t\tstateAbbrev: billingAddress.state || '',\n\t\t\t\t\t\t\tcountryAbbrev: billingAddress.country || '',\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\tstripePaymentModeContext: {\n\t\t\t\t\tconfirmationToken: confirmationToken.id,\n\t\t\t\t\tamount: amount,\n\t\t\t\t\tcurrencyCode: currencyCode.toUpperCase(),\n\t\t\t\t\treturnUrl: returnUrl,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst response = await OrdersClient.processCart(cartToken, processCartDto, proxyRoutePrefix);\n\n\t\t\tif (isErrorsDto(response)) {\n\t\t\t\tconst errors = ErrorMapper.mapErrors(response);\n\n\t\t\t\tif (errors.errors.every(e => e.code === 'PaymentUnsuccessful')) {\n\t\t\t\t\tsetSystemMessage({\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\tmessage: strings.failedToProcessPayment,\n\t\t\t\t\t});\n\t\t\t\t\tlog?.(LogLevel.Info, 'Payment failed: card declined or requires new payment method');\n\t\t\t\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentProcessed);\n\t\t\t\t\tsetIsProcessingPayment(false);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlog?.(LogLevel.Error, 'Failed to process cart', {\n\t\t\t\t\terrors: response,\n\t\t\t\t});\n\t\t\t\tthrow new Error('Failed to process cart');\n\t\t\t}\n\n\t\t\tconst orderDto = response as IOrderDto;\n\t\t\tconst pendingActionDto = response as IPendingActionDto;\n\n\t\t\tif (orderDto.orderTxnId) {\n\t\t\t\tonPaymentModePaymentSuccess?.(orderDto.orderTxnId, cartToken);\n\t\t\t} else if (pendingActionDto.stripePendingAction) {\n\t\t\t\tconst isNextActionRedirect = pendingActionDto.stripePendingAction.isNextActionRedirect;\n\n\t\t\t\tif (isNextActionRedirect && onSubmitBeforeRedirect) {\n\t\t\t\t\tonSubmitBeforeRedirect();\n\t\t\t\t}\n\n\t\t\t\tconst { error: nextActionError, paymentIntent } = await stripe.handleNextAction({\n\t\t\t\t\tclientSecret: pendingActionDto.stripePendingAction.clientSecret || '',\n\t\t\t\t});\n\n\t\t\t\tconst markCartAsActive = async () => {\n\t\t\t\t\tawait OrdersClient.updateCart(cartToken, { status: null }, proxyRoutePrefix);\n\t\t\t\t};\n\n\t\t\t\tconst paymentIntentStatus = paymentIntent?.status;\n\t\t\t\tconst requiresPendingCartProcessing = pendingActionDto.stripePendingAction.requiresPendingCartProcessing;\n\t\t\t\tif (\n\t\t\t\t\tpaymentIntentStatus === 'succeeded' ||\n\t\t\t\t\t(paymentIntentStatus === 'requires_capture' && requiresPendingCartProcessing)\n\t\t\t\t) {\n\t\t\t\t\t// For payment methods such as WeChat that are confirmed elsewhere (i.e. user mobile device)\n\t\t\t\t\tsetShouldPollCart(true);\n\t\t\t\t} else if (nextActionError) {\n\t\t\t\t\tif (isNextActionRedirect || requiresPendingCartProcessing) {\n\t\t\t\t\t\tawait markCartAsActive();\n\t\t\t\t\t}\n\t\t\t\t\tthrow nextActionError;\n\t\t\t\t} else {\n\t\t\t\t\tawait markCartAsActive();\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Unknown state, nextActionError was not set but else condition was triggered for paymentIntent ${paymentIntent?.id} `\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlog?.(LogLevel.Error, 'Failed processing Stripe payment mode.', { error });\n\t\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentProcessed);\n\t\t\tsetIsProcessingPayment(false);\n\t\t\thandleError(strings.failedToProcessPayment);\n\t\t}\n\t}, [\n\t\tstripe,\n\t\telements,\n\t\tlog,\n\t\thandleError,\n\t\tsetSystemMessage,\n\t\tproxyRoutePrefix,\n\t\tcartToken,\n\t\treturnUrl,\n\t\tamount,\n\t\tcurrencyCode,\n\t\tselectedPaymentMethod,\n\t\tdoPaypalRedirect,\n\t\tonPaymentModePaymentSuccess,\n\t\tonSubmitBeforeRedirect,\n\t\tstrings.failedToProcessPayment,\n\t]);\n\n\tconst handleCancelPayment = useCallback(() => paymentMethodEventHandler.emit(PaymentMethodEvent.PaymentCanceled), []);\n\n\tuseQuery(\n\t\t['getCartByToken', cartToken],\n\t\tasync () => {\n\t\t\tif (!cartToken) {\n\t\t\t\tthrow new Error('Cart token is required');\n\t\t\t}\n\t\t\treturn await OrdersClient.getCartByTokenAsync(cartToken);\n\t\t},\n\t\t{\n\t\t\tenabled: shouldPollCart && !!cartToken,\n\t\t\tstaleTime: 0,\n\t\t\tretry: false,\n\t\t\trefetchInterval: data => {\n\t\t\t\treturn data?.orderId ? false : 2000;\n\t\t\t},\n\t\t\tonSuccess: data => {\n\t\t\t\tif (data?.orderId && cartToken) {\n\t\t\t\t\tonPaymentModePaymentSuccess?.(data.orderId, cartToken);\n\t\t\t\t\tsetShouldPollCart(false);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonError: () => {\n\t\t\t\tsetShouldPollCart(false);\n\t\t\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentProcessed);\n\t\t\t\tsetIsProcessingPayment(false);\n\t\t\t\thandleError(strings.failedToProcessPayment);\n\t\t\t},\n\t\t}\n\t);\n\n\tconst handlePaymentMethodChange = useCallback((isComplete: boolean) => {\n\t\tpaymentMethodEventHandler.emit(\n\t\t\tisComplete ? PaymentMethodEvent.PaymentMethodComplete : PaymentMethodEvent.PaymentMethodRequired\n\t\t);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst unsubscribe = paymentMethodEventHandler.subscribe(({ type }) => {\n\t\t\tif (type === PaymentMethodEvent.PaymentSubmit) {\n\t\t\t\thandleSubmitPayment();\n\t\t\t}\n\t\t});\n\n\t\treturn () => {\n\t\t\tunsubscribe();\n\t\t};\n\t}, [handleSubmitPayment]);\n\n\tuseEffect(() => {\n\t\tpaymentMethodEventHandler.emit(\n\t\t\tarePaymentMethodsVisible ? PaymentMethodEvent.BillingAddressComplete : PaymentMethodEvent.BillingAddressRequired\n\t\t);\n\t}, [arePaymentMethodsVisible, billingAddressProfileId]);\n\n\tuseEffect(() => {\n\t\tpaymentMethodEventHandler.emit({\n\t\t\ttype: PaymentMethodEvent.BillingAddressProfileUpdated,\n\t\t\tbillingAddressProfileId: billingAddressProfileId,\n\t\t});\n\t}, [billingAddressProfileId]);\n\n\tuseEffect(\n\t\t() =>\n\t\t\tpaymentMethodEventHandler.emit({\n\t\t\t\ttype: PaymentMethodEvent.PaymentMethodChange,\n\t\t\t\tselectedPaymentMethod: selectedPaymentMethod,\n\t\t\t}),\n\t\t[selectedPaymentMethod]\n\t);\n\n\tuseEffect(() => {\n\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentFormOpened);\n\n\t\treturn () => {\n\t\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentFormClosed);\n\t\t};\n\t}, []);\n\n\treturn {\n\t\tonPaymentMethodChange: handlePaymentMethodChange,\n\t\tonSubmitPayment: handleSubmitPayment,\n\t\tonCancelPayment: handleCancelPayment,\n\t\tisProcessingPayment,\n\t};\n};\n\nexport default usePaymentFormHandler;\n","import { Box, Button } from '@faithlife/styled-ui';\nimport styled from 'styled-components';\n\nexport const LoadingSpinnerOverlay = styled.div`\n\tposition: absolute;\n\ttop: -5px;\n\tleft: -16px;\n\twidth: calc(100% + 32px);\n\theight: calc(100% + 10px);\n\tz-index: 10;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\n\t/* Semi-transparent background */\n\t&::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tbackground-color: ${({ theme }) => theme.colors.loadingSpinner.outerColor};\n\t\topacity: 0.3;\n\t\tz-index: 0;\n\t\tpointer-events: none;\n\t}\n\n\t/* Spinner above the overlay */\n\t> * {\n\t\tposition: relative;\n\t\tz-index: 1;\n\t\topacity: 1 !important;\n\t}\n`;\n\nexport const AddPaymentMethodContainer = styled.div`\n\tposition: relative;\n\tmin-height: 100px;\n`;\n\nexport const StripeElementsItemContainer = styled(Box).attrs({ marginBottom: 4 })``;\n\nexport const StripeRow = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tborder-bottom: 1px solid ${({ theme }) => theme.colors.borderColor};\n\n\theight: auto;\n\n\tfont-size: 14px;\n\tline-height: 1.25;\n\tletter-spacing: 0.16px;\n\tcolor: ${({ theme }) => theme.colors.foregroundPrimary};\n\n\tpadding: 6px 16px;\n`;\n\nexport const CancelButton = styled(Button).attrs({ variant: 'secondary', size: 'small' })`\n\torder: 2;\n\tmargin-left: auto;\n\tmargin-right: 16px;\n`;\n\nexport const CreateButton = styled(Button).attrs({ variant: 'primary', size: 'small' })`\n\torder: 1;\n`;\n\nexport const NewProfileButtons = styled.div`\n\tpadding-top: 12px;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\tflex-direction: row-reverse;\n`;\n","import React, { useCallback, useEffect, useState, useMemo } from 'react';\nimport { Elements, PaymentElement, AddressElement, useStripe, useElements } from '@stripe/react-stripe-js';\nimport {\n\tStripeElementsOptions,\n\tStripeAddressElementOptions,\n\tStripeAddressElementChangeEvent,\n\tStripePaymentElementChangeEvent,\n\tStripeAddressElement,\n\tStripePaymentElementOptions,\n} from '@stripe/stripe-js';\nimport { loadStripe } from '@stripe/stripe-js/pure';\nimport { ProgressIndicator } from '@faithlife/commerce-components';\nimport { useMutation } from 'react-query';\nimport { ISystemMessage } from '../../../../typings/ISystemMessage';\nimport StripeEnvironmentKind from '../../../../typings/StripeEnvironmentKind';\nimport OrdersClient from '../../../../clients/orders-client';\nimport PayFacClient from '../../../../clients/payfac-client';\nimport { IBillingProfileDto } from '../../../../clients/typings/orders';\nimport { useLocalization } from '../../../../Localization';\nimport LogLevel from '../../../../typings/LogLevel';\nimport IStripeSetupIntentResponseDto from '../../../../clients/typings/orders/IStripeSetupIntentResponseDto';\nimport Locale from '../../../../locales/Locale';\nimport StripeLocalesByLocale from '../../../stripe-locales-by-locale';\nimport * as Styled from './styled';\n\ninterface IAddPaymentMethodProps {\n\treturnUrl: string;\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tonBillingProfileCreated?: (createdBillingProfile: IBillingProfileDto) => void;\n\tonCancelEditingBillingProfile?: () => void;\n\tenvironment: StripeEnvironmentKind;\n\tproxyRoutePrefix?: string;\n\tlog?: (logLevel: LogLevel, message: string, details?: Record<string, any>) => void;\n\tclientSecret?: string;\n\tlocale?: Locale;\n\tdarkMode?: boolean;\n\tcurrencyCode?: string;\n\tcountryCode?: string;\n\tdoPaypalRedirect?: () => void;\n\tonPaymentMethodFormLoaded?: () => void;\n}\n\nconst AddPaymentMethodWrapper: React.FunctionComponent<IAddPaymentMethodProps> = props => {\n\tconst [isLoading, setIsLoading] = useState(true);\n\n\tconst stripePublishableKey =\n\t\tprops.environment === 'test'\n\t\t\t? 'pk_test_51OtyM0Ekx18uXxbJgF5GwdsWe7f6a9pDyG8Uv9QioQaEZkZUCp1wUbXcDzGf7Ipi36CdbiBDvZ8bKK3Kqq3Y7IU800k1dKzWpm'\n\t\t\t: 'pk_live_51OtyM0Ekx18uXxbJLgVlqLFe8nzhf2pE3XwzjZTAAVLZbWFxmprOiGbhQSXSME3V0K4OH9BSEha7OpsRnp8A810h007ZqDP4yQ';\n\n\tconst stripePromise = useMemo(\n\t\t() =>\n\t\t\tloadStripe(stripePublishableKey, {\n\t\t\t\tlocale: props.locale && StripeLocalesByLocale[props.locale],\n\t\t\t}),\n\t\t[stripePublishableKey, props.locale]\n\t);\n\tconst strings = useLocalization();\n\tconst [clientSecret, setClientSecret] = useState<string | undefined>(undefined);\n\n\tconst { mutate: createSetupIntent, isLoading: isCreateSetupIntentLoading } = useMutation<\n\t\tany,\n\t\tIStripeSetupIntentResponseDto,\n\t\tvoid\n\t>(async () => await PayFacClient.createStripeSetupIntent(props.proxyRoutePrefix), {\n\t\tonSuccess: response => {\n\t\t\tsetClientSecret(response.setupIntent.clientSecret);\n\t\t},\n\t\tonError: () =>\n\t\t\tprops.setSystemMessage({\n\t\t\t\tmessage: strings.billingUpdateError,\n\t\t\t\tstatus: 'error',\n\t\t\t}),\n\t});\n\n\t// Stripe matches the case of the currency code, so we convert it to lowercase\n\tconst currencyCode = props.currencyCode?.toLowerCase() || 'usd';\n\n\tconst elementsOptions: StripeElementsOptions | null = useMemo(() => {\n\t\tconst externalPaymentMethodTypes = props.doPaypalRedirect ? ['external_paypal'] : [];\n\n\t\tif (!clientSecret) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn {\n\t\t\tclientSecret: clientSecret,\n\t\t\tcurrency: currencyCode,\n\t\t\texternalPaymentMethodTypes,\n\t\t\tappearance: {\n\t\t\t\ttheme: props.darkMode ? 'night' : 'stripe',\n\t\t\t},\n\t\t};\n\t}, [props.darkMode, props.doPaypalRedirect, currencyCode, clientSecret]);\n\n\tuseEffect(() => createSetupIntent(), [createSetupIntent]);\n\n\tconst handlePaymentMethodFormLoaded = useCallback(() => setIsLoading(false), []);\n\n\treturn (\n\t\t<Styled.AddPaymentMethodContainer>\n\t\t\t{(isLoading || isCreateSetupIntentLoading) && (\n\t\t\t\t<Styled.LoadingSpinnerOverlay>\n\t\t\t\t\t<ProgressIndicator className=\"h-12 w-12\" />\n\t\t\t\t</Styled.LoadingSpinnerOverlay>\n\t\t\t)}\n\t\t\t{elementsOptions && (\n\t\t\t\t<Elements stripe={stripePromise} options={elementsOptions}>\n\t\t\t\t\t<AddPaymentMethod\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\tclientSecret={clientSecret}\n\t\t\t\t\t\tcurrencyCode={currencyCode}\n\t\t\t\t\t\tonPaymentMethodFormLoaded={handlePaymentMethodFormLoaded}\n\t\t\t\t\t/>\n\t\t\t\t</Elements>\n\t\t\t)}\n\t\t</Styled.AddPaymentMethodContainer>\n\t);\n};\n\nconst paymentElementOptions: StripePaymentElementOptions = {\n\tlayout: {\n\t\ttype: 'tabs',\n\t\tdefaultCollapsed: false,\n\t},\n};\n\nconst AddPaymentMethod: React.FunctionComponent<IAddPaymentMethodProps> = ({\n\treturnUrl,\n\tsetSystemMessage,\n\tproxyRoutePrefix,\n\tonBillingProfileCreated,\n\tlog,\n\tonCancelEditingBillingProfile,\n\tclientSecret,\n\tcountryCode,\n\tdoPaypalRedirect,\n\tonPaymentMethodFormLoaded,\n}) => {\n\tconst stripe = useStripe();\n\tconst elements = useElements();\n\tconst strings = useLocalization();\n\tconst [addressElement, setAddressElement] = useState<StripeAddressElement | null>(null);\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [isAddressComplete, setIsAddressComplete] = useState(false);\n\tconst [isElementsComplete, setIsElementsComplete] = useState(false);\n\n\tconst { mutate: createBillingProfile } = useMutation<any, IBillingProfileDto, string>(\n\t\tasync (setupIntentId: string) => await OrdersClient.createStripeBillingProfile(setupIntentId, proxyRoutePrefix),\n\t\t{\n\t\t\tonMutate: () => setIsLoading(true),\n\t\t\tonSuccess: createdProfileResponse => {\n\t\t\t\t// This will unmount the component so we don't need to set isLoading to false\n\t\t\t\tonBillingProfileCreated?.(createdProfileResponse);\n\t\t\t},\n\t\t\tonError: () => {\n\t\t\t\tshowFailedToCreateBillingProfile();\n\t\t\t\tsetIsLoading(false);\n\t\t\t},\n\t\t}\n\t);\n\n\tconst addressOptions: StripeAddressElementOptions = {\n\t\tmode: 'billing',\n\t\tdefaultValues: {\n\t\t\taddress: {\n\t\t\t\tline2: ' ',\n\t\t\t\tcountry: countryCode ?? 'US',\n\t\t\t\tstate: '---',\n\t\t\t},\n\t\t},\n\t\tfields: { phone: 'never' },\n\t\tdisplay: { name: 'full' },\n\t\tautocomplete: { mode: 'disabled' },\n\t};\n\n\tconst showFailedToCreateBillingProfile = useCallback(() => {\n\t\tsetSystemMessage({ status: 'error', message: strings.failedToCreateBillingProfile });\n\t}, [setSystemMessage, strings]);\n\n\tconst [selectedPaymentType, setSelectedPaymentType] = useState<string | undefined>(undefined);\n\n\tconst handleSubmit = useCallback(\n\t\tasync (event: React.FormEvent) => {\n\t\t\tevent.preventDefault();\n\n\t\t\tif (selectedPaymentType === 'external_paypal') {\n\t\t\t\tif (!doPaypalRedirect) {\n\t\t\t\t\tthrow new Error('doPaypalRedirect is required when PayPal is enabled.');\n\t\t\t\t}\n\n\t\t\t\tdoPaypalRedirect();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!stripe) {\n\t\t\t\tlog?.(LogLevel.Error, \"Stripe.js hasn't yet loaded.\");\n\t\t\t\tshowFailedToCreateBillingProfile();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!elements || elements === null) {\n\t\t\t\tlog?.(LogLevel.Error, \"Elements hasn't loaded, this shouldn't be possible.\");\n\t\t\t\tshowFailedToCreateBillingProfile();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clientSecret === null) {\n\t\t\t\tlog?.(LogLevel.Error, \"clientSecret hasn't loaded, this shouldn't be possible.\");\n\t\t\t\tshowFailedToCreateBillingProfile();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetIsLoading(true);\n\n\t\t\t// Trigger form validation and wallet collection\n\t\t\tconst { error: submitError } = await elements.submit();\n\t\t\tif (submitError) {\n\t\t\t\tsetIsLoading(false);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst confirmResponse = await stripe.confirmSetup({\n\t\t\t\telements,\n\t\t\t\tclientSecret: clientSecret ?? '', // clientSecret is validated above\n\t\t\t\tconfirmParams: {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\t\t\t\treturn_url: returnUrl,\n\t\t\t\t},\n\t\t\t\tredirect: 'if_required',\n\t\t\t});\n\n\t\t\tif (confirmResponse?.setupIntent?.status === 'succeeded' && confirmResponse.setupIntent.id) {\n\t\t\t\tcreateBillingProfile(confirmResponse.setupIntent.id);\n\t\t\t} else if (confirmResponse.error) {\n\t\t\t\tshowFailedToCreateBillingProfile();\n\t\t\t\tlog?.(\n\t\t\t\t\tLogLevel.Error,\n\t\t\t\t\t`${confirmResponse.error.message}: code ${confirmResponse.error.code}, type: ${confirmResponse.error.type}`\n\t\t\t\t);\n\t\t\t}\n\t\t\tsetIsLoading(false);\n\t\t},\n\t\t[\n\t\t\tcreateBillingProfile,\n\t\t\telements,\n\t\t\treturnUrl,\n\t\t\tstripe,\n\t\t\tlog,\n\t\t\tshowFailedToCreateBillingProfile,\n\t\t\tclientSecret,\n\t\t\tselectedPaymentType,\n\t\t\tdoPaypalRedirect,\n\t\t]\n\t);\n\n\tconst triggerElementsValidation = useCallback(() => {\n\t\tif (addressElement) {\n\t\t\taddressElement.getValue();\n\t\t}\n\t}, [addressElement]);\n\n\tconst handleAddressElementChange = (event: StripeAddressElementChangeEvent) => {\n\t\tsetIsAddressComplete(event.complete);\n\t\t//Display invalid fields since Payment method is complete but address element is not and line1 has been set which has expanded the other fields\n\t\tif (isElementsComplete && !event.complete && event.value.address?.line1) {\n\t\t\ttriggerElementsValidation();\n\t\t}\n\t};\n\n\tconst handlePaymentElementChange = (event: StripePaymentElementChangeEvent) => {\n\t\tsetIsElementsComplete(event.complete);\n\t\tsetSelectedPaymentType(event.value.type);\n\t};\n\n\tuseEffect(() => {\n\t\tif (elements) {\n\t\t\tsetAddressElement(elements.getElement(AddressElement));\n\t\t}\n\t}, [elements]);\n\n\tuseEffect(() => {\n\t\t//The call to getValue will trigger field validations on the AddressElement and display invalid fields\n\t\tif (isElementsComplete && !isAddressComplete) {\n\t\t\ttriggerElementsValidation();\n\t\t}\n\t}, [isElementsComplete, isAddressComplete, triggerElementsValidation]);\n\n\tconst [isAddressElementLoaded, setIsAddressElementLoaded] = useState(false);\n\tconst [isPaymentElementLoaded, setIsPaymentElementLoaded] = useState(false);\n\n\tconst handleAddressElementLoaded = useCallback((element: any) => {\n\t\tsetIsAddressElementLoaded(true);\n\t\telement.focus();\n\t}, []);\n\n\tconst handlePaymentElementLoaded = useCallback(() => setIsPaymentElementLoaded(true), []);\n\n\tconst isPaymentMethodFormLoaded = isAddressElementLoaded && isPaymentElementLoaded;\n\n\tuseEffect(() => {\n\t\tif (isPaymentMethodFormLoaded) {\n\t\t\tonPaymentMethodFormLoaded?.();\n\t\t}\n\t}, [isPaymentMethodFormLoaded, onPaymentMethodFormLoaded]);\n\n\treturn (\n\t\t<>\n\t\t\t<Styled.StripeElementsItemContainer\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: selectedPaymentType === 'external_paypal' ? 'none' : 'block',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<AddressElement\n\t\t\t\t\tonReady={handleAddressElementLoaded}\n\t\t\t\t\toptions={addressOptions}\n\t\t\t\t\tonChange={handleAddressElementChange}\n\t\t\t\t/>\n\t\t\t</Styled.StripeElementsItemContainer>\n\t\t\t<Styled.StripeElementsItemContainer>\n\t\t\t\t<PaymentElement\n\t\t\t\t\tonReady={handlePaymentElementLoaded}\n\t\t\t\t\toptions={paymentElementOptions}\n\t\t\t\t\tonChange={handlePaymentElementChange}\n\t\t\t\t/>\n\n\t\t\t\t{isPaymentMethodFormLoaded && (\n\t\t\t\t\t<Styled.NewProfileButtons>\n\t\t\t\t\t\t{onCancelEditingBillingProfile && (\n\t\t\t\t\t\t\t<Styled.CancelButton onClick={onCancelEditingBillingProfile}>{strings.cancel}</Styled.CancelButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<ProgressIndicator className=\"h-12 w-12\" />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Styled.CreateButton\n\t\t\t\t\t\t\t\tonClick={handleSubmit}\n\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t!stripe ||\n\t\t\t\t\t\t\t\t\t!elements ||\n\t\t\t\t\t\t\t\t\t(!isAddressComplete && selectedPaymentType !== 'external_paypal') ||\n\t\t\t\t\t\t\t\t\t!isElementsComplete\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{selectedPaymentType === 'external_paypal' ? strings.continueToPayPal : strings.save}\n\t\t\t\t\t\t\t</Styled.CreateButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Styled.NewProfileButtons>\n\t\t\t\t)}\n\t\t\t</Styled.StripeElementsItemContainer>\n\t\t</>\n\t);\n};\n\nexport default AddPaymentMethodWrapper;\n","import React from 'react';\nimport ICountry from '../../../../address-form/typings/ICountry';\nimport IStateDto from '../../../../address-form/typings/IState';\nimport IAddressFormatItem from '../../../../address-form/typings/IAddressFormatItem';\nimport Locale from '../../../locales/Locale';\nimport { ISystemMessage } from '../../../typings/ISystemMessage';\nimport StripeEnvironmentKind from '../../../typings/StripeEnvironmentKind';\nimport LogLevel from '../../../typings/LogLevel';\nimport AddStripePaymentMethodPaymentMode from './payment-mode/add-payment-method';\nimport AddStripePaymentMethodSetupMode from './setup-mode/add-payment-method';\nimport { IBillingProfileDto } from '../../../clients/typings/orders';\n\ninterface IAddPaymentMethodProps {\n\tmode?: 'setup' | 'payment';\n\treturnUrl: string;\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tonBillingProfileCreated?: (createdBillingProfile: IBillingProfileDto) => void;\n\tonCancelEditingBillingProfile?: () => void;\n\tenvironment: StripeEnvironmentKind;\n\tproxyRoutePrefix?: string;\n\tlog?: (logLevel: LogLevel, message: string, details?: Record<string, any>) => void;\n\tlocale?: Locale;\n\tdarkMode?: boolean;\n\tcurrencyCode?: string;\n\tcountryCode?: string;\n\tonSubmitBeforeRedirect?: () => void;\n\tonPaymentModePaymentSuccess?: (orderId: string, cartToken: string) => void;\n\tamount?: number;\n\tcartToken?: string | null;\n\tdoPaypalRedirect?: () => void;\n\tonBillingAddressChange?: (profileId: string, onAmountChanged: (amount: number) => void) => Promise<void>;\n\taddressFormatItems: IAddressFormatItem[];\n\tcountries: ICountry[];\n\tstatesByCountryId: Record<string, IStateDto[]>;\n\thandleCountryChanged: (countryId: string) => void;\n\thasLoadedAddressInfo: boolean;\n\tisFirstTimeProfile?: boolean;\n}\n\nconst AddPaymentMethod = ({\n\tmode,\n\treturnUrl,\n\tsetSystemMessage,\n\tonCancelEditingBillingProfile,\n\tonBillingProfileCreated,\n\tenvironment,\n\tproxyRoutePrefix,\n\tlog,\n\tlocale,\n\tdarkMode,\n\tcurrencyCode,\n\tcountryCode,\n\tonSubmitBeforeRedirect,\n\tonPaymentModePaymentSuccess,\n\tamount,\n\tcartToken,\n\tdoPaypalRedirect,\n\tonBillingAddressChange,\n\taddressFormatItems,\n\tcountries,\n\tstatesByCountryId,\n\thandleCountryChanged,\n\thasLoadedAddressInfo,\n\tisFirstTimeProfile,\n}: IAddPaymentMethodProps) => {\n\treturn (\n\t\t<>\n\t\t\t{mode === 'payment' ? (\n\t\t\t\t<AddStripePaymentMethodPaymentMode\n\t\t\t\t\treturnUrl={returnUrl}\n\t\t\t\t\tsetSystemMessage={setSystemMessage}\n\t\t\t\t\tonCancelEditingBillingProfile={onCancelEditingBillingProfile}\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t\tproxyRoutePrefix={proxyRoutePrefix}\n\t\t\t\t\tlog={log}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t\tdarkMode={darkMode}\n\t\t\t\t\tcurrencyCode={currencyCode ?? 'USD'}\n\t\t\t\t\tcountryCode={countryCode ?? 'US'}\n\t\t\t\t\tonSubmitBeforeRedirect={onSubmitBeforeRedirect}\n\t\t\t\t\tonPaymentModePaymentSuccess={onPaymentModePaymentSuccess}\n\t\t\t\t\tamount={amount}\n\t\t\t\t\tcartToken={cartToken}\n\t\t\t\t\tdoPaypalRedirect={doPaypalRedirect}\n\t\t\t\t\tonBillingAddressChange={onBillingAddressChange}\n\t\t\t\t\taddressFormatItems={addressFormatItems}\n\t\t\t\t\tcountries={countries}\n\t\t\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\t\t\thandleCountryChanged={handleCountryChanged}\n\t\t\t\t\thasLoadedAddressInfo={hasLoadedAddressInfo}\n\t\t\t\t\tisFirstTimeProfile={isFirstTimeProfile}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<AddStripePaymentMethodSetupMode\n\t\t\t\t\treturnUrl={returnUrl}\n\t\t\t\t\tsetSystemMessage={setSystemMessage}\n\t\t\t\t\tonBillingProfileCreated={onBillingProfileCreated}\n\t\t\t\t\tonCancelEditingBillingProfile={onCancelEditingBillingProfile}\n\t\t\t\t\tenvironment={environment}\n\t\t\t\t\tproxyRoutePrefix={proxyRoutePrefix}\n\t\t\t\t\tlog={log}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t\tdarkMode={darkMode}\n\t\t\t\t\tcurrencyCode={currencyCode}\n\t\t\t\t\tcountryCode={countryCode}\n\t\t\t\t\tdoPaypalRedirect={doPaypalRedirect}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nexport default AddPaymentMethod;\n","import { Button, LoadingSpinner, Radio } from '@faithlife/styled-ui';\nimport React, { forwardRef, Fragment, useCallback, useEffect, useImperativeHandle, useState } from 'react';\nimport { useQuery, useQueryClient } from 'react-query';\nimport { useAddressFormData } from '../../../address-form';\nimport { LocationsClient } from '../../clients/locations-client';\nimport OrdersClient from '../../clients/orders-client';\nimport { IBillingProfilesDto } from '../../clients/typings/orders';\nimport IBillingProfileDto from '../../clients/typings/orders/IBillingProfileDto';\nimport IError from '../../clients/typings/orders/IError';\nimport { isErrors } from '../../clients/typings/orders/IErrors';\nimport IUsageInfoDto from '../../clients/typings/orders/UsageInfoDto';\nimport { useLocalization } from '../../Localization';\nimport BillingProfileMapper from '../../mappers/BillingProfileMapper';\nimport IBillingProfileInfo from '../../typings/IBillingProfileInfo';\nimport IEditBillingProfile from '../../typings/IEditBillingProfile';\nimport { ISystemMessage } from '../../typings/ISystemMessage';\nimport BillingProfile from './billing-profile';\nimport PayPalProfile from './paypal-profile';\nimport EditCreditCardForm from './edit-credit-card-form';\nimport * as Styled from './styled';\nimport LogLevel from '../../typings/LogLevel';\nimport ICreditCardOptionsDto from '../../clients/typings/orders/ICreditCardOptionsDto';\nimport Locale from '../../locales/Locale';\nimport { SupportedBillingProfileTypes as SupportedCreditCardBillingProfileTypes } from './billing-profile';\nimport { SupportedBillingProfileTypes as SupportedPayPalBillingProfileTypes } from './paypal-profile';\nimport { SupportedBillingProfileTypes as SupportedStripeBillingProfileTypes } from './stripe-profile';\nimport AddStripePaymentMethod from '../payment-methods/stripe/add-payment-method';\nimport StripeProfile from './stripe-profile';\n\ntype billingProfileChangeKind = 'selected' | 'deleted' | 'invalidated';\nconst unitedStatesCountryId = '840';\n\nconst SupportedBillingProfileTypes = [\n\t...SupportedCreditCardBillingProfileTypes,\n\t...SupportedPayPalBillingProfileTypes,\n\t...SupportedStripeBillingProfileTypes,\n];\n\ninterface IBillingProfilesProps {\n\t/** Called when the user clicks a different payment method radio button. */\n\tonSelectedBillingProfileChange: (\n\t\tbillingProfile: IBillingProfileInfo | undefined,\n\t\tbillingProfileChangeKind?: billingProfileChangeKind\n\t) => void;\n\tonUpdateBillingProfile: (billingProfile: IEditBillingProfile, updateCallback: Function) => void;\n\t/** Called in functions that have network calls that could fail. */\n\tactAndHandleException: (action: () => Promise<any>, actionDescription: string) => Promise<any>;\n\t/** Called when component needs to display a message to user after actions were taken. */\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tselectedProfileId?: string;\n\tallowAddressOnly: boolean;\n\thandleSelectedProfileInvalid?: () => void;\n\tpreselectDefaultBillingProfile: boolean;\n\tproxyRoutePrefix?: string;\n\tlocale: Locale;\n\tenvironment: 'production' | 'test';\n\tcontinueToPaypalSiteToAddProfile?: () => void;\n\tstripeReturnUrl?: string;\n\tstripeAmount?: number;\n\tstripeCurrencyCode?: string;\n\tstripeCountryCode?: string;\n\tstripeMode?: 'setup' | 'payment';\n\tstripeOnSubmitBeforeRedirect?: () => void;\n\tstripeOnPaymentModePaymentSuccess?: (orderId: string, cartToken: string) => void;\n\tcartToken?: string | null;\n\tshouldOnlyShowStripeProfiles?: boolean;\n\tshouldOnlyShowStripeAndCreditCardProfiles?: boolean;\n\tlog?: (logLevel: LogLevel, message: string, details?: Record<string, any>) => void;\n\tdarkMode?: boolean;\n\tonBillingAddressChange?: (profileId: string, onAmountChanged: (amount: number) => void) => Promise<void>;\n}\n\ninterface IBillingProfilesHandle {\n\trefreshBillingProfiles: () => Promise<void>;\n}\n\nconst BillingProfiles = forwardRef<IBillingProfilesHandle, IBillingProfilesProps>(function BillingProfiles(\n\t{\n\t\tonSelectedBillingProfileChange,\n\t\tonUpdateBillingProfile,\n\t\tactAndHandleException,\n\t\tsetSystemMessage,\n\t\tselectedProfileId,\n\t\tallowAddressOnly = false,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\thandleSelectedProfileInvalid: _handleSelectedProfileInvalid,\n\t\tpreselectDefaultBillingProfile = true,\n\t\tproxyRoutePrefix = '',\n\t\tlocale,\n\t\tenvironment,\n\t\tlog,\n\t\tcontinueToPaypalSiteToAddProfile,\n\t\tshouldOnlyShowStripeProfiles = false,\n\t\tshouldOnlyShowStripeAndCreditCardProfiles = false,\n\t\tstripeReturnUrl,\n\t\tdarkMode,\n\t\tstripeAmount,\n\t\tstripeCurrencyCode,\n\t\tstripeCountryCode,\n\t\tstripeMode,\n\t\tstripeOnSubmitBeforeRedirect,\n\t\tcartToken,\n\t\tstripeOnPaymentModePaymentSuccess,\n\t\tonBillingAddressChange,\n\t\t...props\n\t},\n\tref\n) {\n\tconst [billingProfiles, setBillingProfiles] = useState<IBillingProfileDto[]>([]);\n\tconst [usageInfo, setUsageInfo] = useState<IUsageInfoDto>();\n\tconst [billingProfileValidationErrors, setBillingProfileValidationErrors] = useState<IError[]>([]);\n\n\tconst [showAllPaymentMethods, setShowAllPaymentMethods] = useState<boolean>(false);\n\tconst [selectedBillingProfileId, setSelectedBillingProfileId] = useState<string | null>(selectedProfileId || null);\n\tuseEffect(() => {\n\t\tif (selectedProfileId !== undefined) {\n\t\t\tsetSelectedBillingProfileId(selectedProfileId);\n\t\t}\n\t}, [selectedProfileId]);\n\tconst [isAddingNewCreditCard, setIsAddingNewCreditCard] = useState(false);\n\tconst [hasLoadedInitialBillingProfiles, setHasLoadedInitialBillingProfiles] = useState<boolean>(false);\n\tuseEffect(() => {\n\t\tif (!selectedBillingProfileId && hasLoadedInitialBillingProfiles && billingProfiles.length === 0) {\n\t\t\tsetIsAddingNewCreditCard(true);\n\t\t}\n\t}, [selectedBillingProfileId, billingProfiles, hasLoadedInitialBillingProfiles]);\n\tconst [editingBillingProfileId, setEditingBillingProfileId] = useState<string | null>(null);\n\tconst [billingProfileChangeKind, setBillingProfileChangeKind] = useState<billingProfileChangeKind | undefined>(\n\t\tundefined\n\t);\n\n\tconst queryClient = useQueryClient();\n\n\tconst strings = useLocalization();\n\tconst { addressFormatItems, countries, handleCountryChanged, statesByCountryId, hasLoadedAddressInfo } =\n\t\tuseAddressFormData(\n\t\t\tLocationsClient.getCountries,\n\t\t\tLocationsClient.getStatesForCountry,\n\t\t\tLocationsClient.getAddressFormatForCountry,\n\t\t\tactAndHandleException,\n\t\t\tlocale,\n\t\t\tproxyRoutePrefix\n\t\t);\n\n\tconst { data: selectedBillingProfile, isLoading: loadingSelectedBillingProfile } =\n\t\tuseQuery<IBillingProfileDto | null>(\n\t\t\t['getBillingProfile', selectedBillingProfileId],\n\t\t\tasync () =>\n\t\t\t\tselectedBillingProfileId\n\t\t\t\t\t? await OrdersClient.getBillingProfile(selectedBillingProfileId, proxyRoutePrefix)\n\t\t\t\t\t: Promise.resolve(null),\n\t\t\t{\n\t\t\t\tstaleTime: 1000 * 60 * 5, // five minutes\n\t\t\t\tonError: error =>\n\t\t\t\t\tactAndHandleException(() => {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}, strings.fetchBillingProfiles),\n\t\t\t}\n\t\t);\n\n\tuseEffect(() => {\n\t\tif (!selectedBillingProfile && !loadingSelectedBillingProfile) {\n\t\t\tonSelectedBillingProfileChange(undefined);\n\t\t}\n\t}, [selectedBillingProfile, onSelectedBillingProfileChange, loadingSelectedBillingProfile]);\n\n\tuseEffect(() => {\n\t\tif (!selectedBillingProfile || loadingSelectedBillingProfile) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst country = countries && countries.find(c => c.countryId === selectedBillingProfile.countryId?.toString());\n\n\t\tonSelectedBillingProfileChange(\n\t\t\t{\n\t\t\t\tbillingProfileDto: selectedBillingProfile,\n\t\t\t\tcountryAlpha2: (country && country.alpha2) || 'US',\n\t\t\t},\n\t\t\tbillingProfileChangeKind\n\t\t);\n\t}, [\n\t\tbillingProfiles,\n\t\tselectedBillingProfile,\n\t\tbillingProfileChangeKind,\n\t\tcountries,\n\t\tonSelectedBillingProfileChange,\n\t\tloadingSelectedBillingProfile,\n\t]);\n\n\tconst { refetch: getBillingProfilesAsync } = useQuery<IBillingProfilesDto>(\n\t\t['getBillingProfiles', allowAddressOnly],\n\t\tasync () => {\n\t\t\tconst shouldIncludePayPal = !!continueToPaypalSiteToAddProfile;\n\t\t\tconst shouldIncludeStripe = true;\n\t\t\treturn await OrdersClient.getBillingProfiles(\n\t\t\t\tproxyRoutePrefix,\n\t\t\t\tshouldIncludePayPal,\n\t\t\t\tallowAddressOnly,\n\t\t\t\tshouldIncludeStripe\n\t\t\t);\n\t\t},\n\t\t{\n\t\t\tonSuccess: ({ billingProfiles, usageInfo }: IBillingProfilesDto) => {\n\t\t\t\tconst filteredBillingProfiles = billingProfiles.filter(bp =>\n\t\t\t\t\tSupportedBillingProfileTypes.includes(bp.type.toLowerCase())\n\t\t\t\t);\n\n\t\t\t\tif (!hasLoadedInitialBillingProfiles) {\n\t\t\t\t\tactAndHandleException(\n\t\t\t\t\t\tasync () => await loadInitialBillingProfiles(filteredBillingProfiles, usageInfo),\n\t\t\t\t\t\tstrings.fetchBillingProfiles\n\t\t\t\t\t);\n\n\t\t\t\t\tsetHasLoadedInitialBillingProfiles(true);\n\t\t\t\t} else {\n\t\t\t\t\tactAndHandleException(\n\t\t\t\t\t\tasync () => reloadBillingProfiles(filteredBillingProfiles, usageInfo),\n\t\t\t\t\t\tstrings.fetchBillingProfiles\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonError: error =>\n\t\t\t\tactAndHandleException(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t}, strings.fetchBillingProfiles),\n\t\t}\n\t);\n\n\tconst loadInitialBillingProfiles = useCallback(\n\t\tasync (billingProfiles: IBillingProfileDto[], usageInfo?: IUsageInfoDto) => {\n\t\t\tsetBillingProfiles(billingProfiles);\n\t\t\tsetUsageInfo(usageInfo);\n\t\t},\n\t\t[setBillingProfiles]\n\t);\n\n\tconst reloadBillingProfiles = useCallback(\n\t\tasync (freshProfiles: IBillingProfileDto[], usageInfo?: IUsageInfoDto) => {\n\t\t\tsetBillingProfiles(freshProfiles);\n\t\t\tsetUsageInfo(usageInfo);\n\t\t\tif (freshProfiles.length > 0) {\n\t\t\t\tconst defaultProfile = freshProfiles.filter(p => p.isDefault)[0];\n\t\t\t\tif (defaultProfile && !selectedBillingProfileId && preselectDefaultBillingProfile) {\n\t\t\t\t\tsetBillingProfileChangeKind(undefined);\n\t\t\t\t\tsetSelectedBillingProfileId(defaultProfile.profileId);\n\t\t\t\t\tsetShowAllPaymentMethods(freshProfiles.findIndex(p => p.profileId === defaultProfile.profileId) > 2);\n\t\t\t\t} else {\n\t\t\t\t\tsetShowAllPaymentMethods(freshProfiles.findIndex(p => p.profileId === selectedBillingProfileId) > 2);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[selectedBillingProfileId, setUsageInfo, preselectDefaultBillingProfile]\n\t);\n\n\tconst onSelectBillingProfile = useCallback(\n\t\t(billingProfile: IBillingProfileDto) => {\n\t\t\tsetIsAddingNewCreditCard(false);\n\t\t\tsetBillingProfileChangeKind('selected');\n\t\t\tsetSelectedBillingProfileId(billingProfile.profileId);\n\t\t\tonSelectedBillingProfileChange(\n\t\t\t\t{\n\t\t\t\t\tbillingProfileDto: billingProfile,\n\t\t\t\t\tcountryAlpha2:\n\t\t\t\t\t\t(countries && countries.find(c => c.countryId === billingProfile.countryId?.toString())?.alpha2) || 'US',\n\t\t\t\t},\n\t\t\t\t'selected'\n\t\t\t);\n\t\t},\n\t\t[onSelectedBillingProfileChange, countries]\n\t);\n\n\tconst resetEditingBillingProfile = useCallback(() => {\n\t\tsetIsAddingNewCreditCard(false);\n\t\tsetEditingBillingProfileId(null);\n\t\tsetBillingProfileChangeKind(undefined);\n\n\t\t// Reset the editor back to US defaults\n\t\thandleCountryChanged(unitedStatesCountryId);\n\t}, [handleCountryChanged, setIsAddingNewCreditCard, setEditingBillingProfileId]);\n\n\tconst updateBillingProfile = useCallback(\n\t\tasync (profileId: string, profile: IEditBillingProfile) => {\n\t\t\tconst updateProfile = async () => {\n\t\t\t\tconst response = await OrdersClient.updateOrdersBillingProfile(\n\t\t\t\t\tprofileId,\n\t\t\t\t\tBillingProfileMapper.mapForUpdating(profile),\n\t\t\t\t\tproxyRoutePrefix\n\t\t\t\t);\n\n\t\t\t\tif (isErrors(response)) {\n\t\t\t\t\tsetBillingProfileValidationErrors(response.errors.filter(e => e.property !== null));\n\n\t\t\t\t\tconst isConflict = response.errors.some(e => e.code === '409');\n\t\t\t\t\tconst hasGeneralErrors = response.errors.some(e => e.message !== null);\n\t\t\t\t\tif (isConflict || hasGeneralErrors) {\n\t\t\t\t\t\tsetSystemMessage({\n\t\t\t\t\t\t\tmessage: isConflict ? strings.conflict : strings.billingUpdateError,\n\t\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetEditingBillingProfileId(null);\n\t\t\t\tgetBillingProfilesAsync();\n\n\t\t\t\tqueryClient.invalidateQueries(['getBillingProfile', response.profileId]);\n\n\t\t\t\tif (onUpdateBillingProfile) {\n\t\t\t\t\tonUpdateBillingProfile(profile, () => setSelectedBillingProfileId(response.profileId));\n\t\t\t\t} else {\n\t\t\t\t\tsetSelectedBillingProfileId(response.profileId);\n\t\t\t\t}\n\t\t\t};\n\t\t\tawait actAndHandleException(updateProfile, strings.updateProfile);\n\t\t},\n\t\t[\n\t\t\tactAndHandleException,\n\t\t\tstrings,\n\t\t\tsetSystemMessage,\n\t\t\tonUpdateBillingProfile,\n\t\t\tproxyRoutePrefix,\n\t\t\tgetBillingProfilesAsync,\n\t\t\tqueryClient,\n\t\t]\n\t);\n\n\tconst onDeleteBillingProfile = useCallback(\n\t\tasync (billingProfileId: string): Promise<boolean> => {\n\t\t\tconst deleteProfile = async () => {\n\t\t\t\tconst response = await OrdersClient.deleteOrdersBillingProfile(billingProfileId, proxyRoutePrefix);\n\n\t\t\t\tconst isConflict = response && isErrors(response) && response.errors.some(e => e.code === '409');\n\n\t\t\t\tif (isConflict) {\n\t\t\t\t\tsetSystemMessage({\n\t\t\t\t\t\tmessage: strings.conflict,\n\t\t\t\t\t\tstatus: 'error',\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tsetIsAddingNewCreditCard(false);\n\t\t\t\tsetEditingBillingProfileId(null);\n\n\t\t\t\t// Reset the editor back to US defaults\n\t\t\t\thandleCountryChanged(unitedStatesCountryId);\n\t\t\t\tgetBillingProfilesAsync();\n\t\t\t\tif (billingProfileId === selectedBillingProfileId) {\n\t\t\t\t\tsetBillingProfileChangeKind(undefined);\n\t\t\t\t\tsetSelectedBillingProfileId(null);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t};\n\n\t\t\treturn (await actAndHandleException(deleteProfile, strings.deleteProfile)) || false;\n\t\t},\n\t\t[\n\t\t\tactAndHandleException,\n\t\t\tstrings.deleteProfile,\n\t\t\tstrings.conflict,\n\t\t\tselectedBillingProfileId,\n\t\t\thandleCountryChanged,\n\t\t\tsetSystemMessage,\n\t\t\tproxyRoutePrefix,\n\t\t\tgetBillingProfilesAsync,\n\t\t]\n\t);\n\n\tconst toggleEditBillingProfile = useCallback(\n\t\t(billingProfileId: string): void => {\n\t\t\tsetIsAddingNewCreditCard(false);\n\t\t\tsetEditingBillingProfileId(billingProfileId);\n\t\t},\n\t\t[setEditingBillingProfileId]\n\t);\n\n\tconst handleOnUpdateBillingProfile = useCallback(\n\t\t(billingProfile: IBillingProfileDto): void => {\n\t\t\tconst countryId = billingProfile.countryId === -1 ? unitedStatesCountryId : billingProfile.countryId.toString();\n\t\t\thandleCountryChanged(countryId);\n\t\t\ttoggleEditBillingProfile(billingProfile.profileId);\n\t\t},\n\t\t[handleCountryChanged, toggleEditBillingProfile]\n\t);\n\n\tconst onAddCreditCardClicked = useCallback(() => {\n\t\tsetEditingBillingProfileId(null);\n\t\tsetIsAddingNewCreditCard(true);\n\t\tsetBillingProfileChangeKind(undefined);\n\t\tsetSelectedBillingProfileId(null);\n\t}, []);\n\n\tconst displayProfiles = showAllPaymentMethods ? billingProfiles : billingProfiles.slice(0, 3);\n\n\tuseImperativeHandle(\n\t\tref,\n\t\t() => ({\n\t\t\tasync refreshBillingProfiles() {\n\t\t\t\tawait getBillingProfilesAsync();\n\t\t\t},\n\t\t}),\n\t\t[getBillingProfilesAsync]\n\t);\n\n\tconst buildEditCreditCardFormForUpdates = (\n\t\teditingBillingProfileId: string,\n\t\tcreditCardOptions?: ICreditCardOptionsDto\n\t) => (\n\t\t<EditCreditCardForm\n\t\t\tbillingProfile={BillingProfileMapper.mapForEditing(\n\t\t\t\tdisplayProfiles.find(p => p.profileId === editingBillingProfileId) as IBillingProfileDto\n\t\t\t)}\n\t\t\tonCommitBillingProfile={(profile, onBillingProfileCommittedCb) => {\n\t\t\t\tupdateBillingProfile(editingBillingProfileId, profile);\n\t\t\t\tresetEditingBillingProfile();\n\t\t\t\tonBillingProfileCommittedCb();\n\t\t\t\treturn Promise.resolve();\n\t\t\t}}\n\t\t\tonCancelEditingBillingProfile={resetEditingBillingProfile}\n\t\t\tserverValidationErrors={billingProfileValidationErrors}\n\t\t\tcountries={countries}\n\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\tonSelectedCountryChanged={handleCountryChanged}\n\t\t\tusageInfo={usageInfo}\n\t\t\taddressFormatItems={addressFormatItems}\n\t\t\tonDelete={onDeleteBillingProfile}\n\t\t\tlocale={locale}\n\t\t\thasLoadedAddressInfo={hasLoadedAddressInfo}\n\t\t\tcreditCardOptions={creditCardOptions}\n\t\t/>\n\t);\n\n\treturn (\n\t\t<Styled.BillingProfilesContainer>\n\t\t\t<Styled.BillingProfilesSection>\n\t\t\t\t<div className=\"border border-[#DBDBDB]\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"overflow-y-auto overflow-x-hidden max-w-[500px] mx-auto\"\n\t\t\t\t\t\tdata-testid=\"billing-profiles\"\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"flex items-center h-[45px] mx-5 text-[16px] leading-[1.25] tracking-[0.16px] text-primary-500 [&:not(:last-child)]:border-b [&:not(:last-child)]:border-[#EBEBEB]\">\n\t\t\t\t\t\t\t<Radio onClick={onAddCreditCardClicked} isChecked={isAddingNewCreditCard} type=\"button\">\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName=\"text-primary-500 text-[16px] font-semibold pl-1\"\n\t\t\t\t\t\t\t\t\tdata-testid=\"add-payment-method-button\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{strings.newPaymentMethod}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Radio>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{isAddingNewCreditCard &&\n\t\t\t\t\t\t\t(shouldOnlyShowStripeProfiles || shouldOnlyShowStripeAndCreditCardProfiles) &&\n\t\t\t\t\t\t\tstripeReturnUrl && (\n\t\t\t\t\t\t\t\t<div className=\"flex flex-col h-auto mx-5 my-2 text-[14px] leading-[1.25] tracking-[0.16px] text-primary-500 [&:not(:last-child)]:border-b [&:not(:last-child)]:border-[#EBEBEB]\">\n\t\t\t\t\t\t\t\t\t{(stripeMode === 'setup' || (stripeMode === 'payment' && stripeAmount && stripeCurrencyCode)) && (\n\t\t\t\t\t\t\t\t\t\t<AddStripePaymentMethod\n\t\t\t\t\t\t\t\t\t\t\tmode={stripeMode}\n\t\t\t\t\t\t\t\t\t\t\treturnUrl={stripeReturnUrl}\n\t\t\t\t\t\t\t\t\t\t\tonBillingProfileCreated={(createdProfile: IBillingProfileDto) => {\n\t\t\t\t\t\t\t\t\t\t\t\tgetBillingProfilesAsync();\n\t\t\t\t\t\t\t\t\t\t\t\tresetEditingBillingProfile();\n\t\t\t\t\t\t\t\t\t\t\t\tonSelectBillingProfile(createdProfile);\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tonCancelEditingBillingProfile={resetEditingBillingProfile}\n\t\t\t\t\t\t\t\t\t\t\tsetSystemMessage={setSystemMessage}\n\t\t\t\t\t\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\t\t\t\t\t\tproxyRoutePrefix={proxyRoutePrefix}\n\t\t\t\t\t\t\t\t\t\t\tlog={log}\n\t\t\t\t\t\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t\t\t\t\t\t\tdarkMode={darkMode}\n\t\t\t\t\t\t\t\t\t\t\tcartToken={cartToken}\n\t\t\t\t\t\t\t\t\t\t\tamount={stripeAmount}\n\t\t\t\t\t\t\t\t\t\t\tcurrencyCode={stripeCurrencyCode}\n\t\t\t\t\t\t\t\t\t\t\tcountryCode={stripeCountryCode}\n\t\t\t\t\t\t\t\t\t\t\tonSubmitBeforeRedirect={stripeOnSubmitBeforeRedirect}\n\t\t\t\t\t\t\t\t\t\t\tdoPaypalRedirect={continueToPaypalSiteToAddProfile}\n\t\t\t\t\t\t\t\t\t\t\tonPaymentModePaymentSuccess={stripeOnPaymentModePaymentSuccess}\n\t\t\t\t\t\t\t\t\t\t\tonBillingAddressChange={onBillingAddressChange}\n\t\t\t\t\t\t\t\t\t\t\taddressFormatItems={addressFormatItems}\n\t\t\t\t\t\t\t\t\t\t\tcountries={countries}\n\t\t\t\t\t\t\t\t\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\t\t\t\t\t\t\t\t\thandleCountryChanged={handleCountryChanged}\n\t\t\t\t\t\t\t\t\t\t\thasLoadedAddressInfo={hasLoadedAddressInfo}\n\t\t\t\t\t\t\t\t\t\t\tisFirstTimeProfile={billingProfiles.length === 0}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!hasLoadedInitialBillingProfiles ? (\n\t\t\t\t\t\t\t<Styled.LoadingSpinnerRow>\n\t\t\t\t\t\t\t\t<LoadingSpinner variant=\"small\" />\n\t\t\t\t\t\t\t</Styled.LoadingSpinnerRow>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{displayProfiles\n\t\t\t\t\t\t\t\t\t? displayProfiles.map((p, i) => (\n\t\t\t\t\t\t\t\t\t\t\t<Fragment key={p.profileId}>\n\t\t\t\t\t\t\t\t\t\t\t\t{p.type.toLowerCase() === 'paypal' && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<PayPalProfile\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbillingProfile={p}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonDelete={onDeleteBillingProfile}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisSelected={selectedBillingProfileId === p.profileId && !isAddingNewCreditCard}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelected={() => onSelectBillingProfile(p)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={i}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t\t\t\t\t{p.type.toLowerCase() === 'stripe' && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<StripeProfile\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbillingProfile={p}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisSelected={selectedBillingProfileId === p.profileId && !isAddingNewCreditCard}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelected={() => onSelectBillingProfile(p)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={i}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisEditing={editingBillingProfileId === p.profileId}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonUpdate={handleOnUpdateBillingProfile}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{editingBillingProfileId === p.profileId &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuildEditCreditCardFormForUpdates(editingBillingProfileId, {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisMakingDefaultEnabled: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisMovingSubscriptionsEnabled: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisMovingPrepubsAndBidsEnabled: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisMovingPaymentPlansEnabled: false,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t\t\t\t\t{p.type.toLowerCase() !== 'paypal' && p.type.toLocaleLowerCase() !== 'stripe' && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<BillingProfile\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbillingProfile={p}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonUpdate={handleOnUpdateBillingProfile}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisSelected={selectedBillingProfileId === p.profileId && !isAddingNewCreditCard}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonSelected={() => onSelectBillingProfile(p)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex={i}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisEditing={editingBillingProfileId === p.profileId}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{editingBillingProfileId === p.profileId &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbuildEditCreditCardFormForUpdates(editingBillingProfileId)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t\t\t\t\t))\n\t\t\t\t\t\t\t\t\t: null}\n\t\t\t\t\t\t\t\t{billingProfiles && billingProfiles.length > 3 && !showAllPaymentMethods && (\n\t\t\t\t\t\t\t\t\t<div className=\"flex items-center h-[45px] mx-5 text-[16px] leading-[1.25] tracking-[0.16px] text-primary-500 [&:not(:last-child)]:border-b [&:not(:last-child)]:border-[#EBEBEB]\">\n\t\t\t\t\t\t\t\t\t\t<Button variant=\"link\" width=\"100%\" onClick={() => setShowAllPaymentMethods(true)}>\n\t\t\t\t\t\t\t\t\t\t\t{strings.showAllPaymentMethods}\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</Styled.BillingProfilesSection>\n\t\t</Styled.BillingProfilesContainer>\n\t);\n});\n\nexport default BillingProfiles;\n","import PaymentMethods from './payment-methods';\n\nexport default PaymentMethods;\n","import { theme as styledUITheme } from '@faithlife/styled-ui';\nimport React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport { ReactQueryDevtools } from 'react-query/devtools';\nimport { ThemeProvider } from 'styled-components';\nimport defaultResources from '../../locales/en-US/resources.json';\nimport { LocalizationProvider } from '../../Localization';\nimport IBillingProfileInfo from '../../typings/IBillingProfileInfo';\nimport IEditBillingProfile from '../../typings/IEditBillingProfile';\nimport ILocalizedResources from '../../typings/ILocalizedResources';\nimport { ISystemMessage } from '../../typings/ISystemMessage';\nimport LogLevel from '../../typings/LogLevel';\nimport Locale from '../../locales/Locale';\nimport BillingProfiles from '../billing-profiles/billing-profiles';\n\ninterface IPaymentMethodsProps {\n\t/** Called when the user clicks a different payment method radio button. */\n\tonSelectedBillingProfileChange: (\n\t\tbillingProfile: IBillingProfileInfo | undefined,\n\t\tbillingProfileChangeKind: any\n\t) => void;\n\tonUpdateBillingProfile: (billingProfile: IEditBillingProfile, updateCallback: Function) => void;\n\t/** Called in functions that have network calls that could fail. */\n\tactAndHandleException: (action: () => Promise<any>, actionDescription: string) => Promise<any>;\n\t/** Called when component needs to display a message to user after actions were taken. */\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tselectedBillingProfileId?: string;\n\tlocalizedResources: ILocalizedResources;\n\thandleSelectedProfileInvalid?: () => void;\n\tpreselectDefaultBillingProfile: boolean;\n\ttheme?: any;\n\tproxyRoutePrefix?: string;\n\tlocale: Locale;\n\tenvironment: 'production' | 'test';\n\tqueryClient?: QueryClient;\n\tshouldOnlyShowStripeProfiles?: boolean;\n\tshouldOnlyShowStripeAndCreditCardProfiles?: boolean;\n\tstripeAmount?: number;\n\tstripeCurrencyCode?: string;\n\tstripeCountryCode?: string;\n\tstripeReturnUrl?: string;\n\tstripeMode?: 'setup' | 'payment';\n\tstripeOnSubmitBeforeRedirect?: () => void;\n\tstripeOnPaymentModePaymentSuccess?: (orderId: string, cartToken: string) => void;\n\tcartToken?: string | null;\n\tcontinueToPaypalSiteToAddProfile?: () => void;\n\tlog?: (logLevel: LogLevel, message: string, details?: Record<string, any>) => void;\n\tdarkMode?: boolean;\n\tonBillingAddressChange?: (profileId: string, onAmountChanged: (amount: number) => void) => Promise<void>;\n}\n\ninterface IPaymentMethodsHandle {\n\trefreshBillingProfiles: () => Promise<void>;\n}\n\nconst PaymentMethods = forwardRef<IPaymentMethodsHandle, IPaymentMethodsProps>(function PaymentMethods(\n\t{\n\t\tonSelectedBillingProfileChange,\n\t\tonUpdateBillingProfile,\n\t\tactAndHandleException,\n\t\tsetSystemMessage,\n\t\tselectedBillingProfileId,\n\t\tlocalizedResources,\n\t\thandleSelectedProfileInvalid,\n\t\tpreselectDefaultBillingProfile = true,\n\t\ttheme = {},\n\t\tproxyRoutePrefix = '',\n\t\tlocale,\n\t\tqueryClient,\n\t\tcontinueToPaypalSiteToAddProfile,\n\t\tshouldOnlyShowStripeProfiles = false,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\tshouldOnlyShowStripeAndCreditCardProfiles: _shouldOnlyShowStripeAndCreditCardProfiles = false,\n\t\tlog,\n\t\tdarkMode,\n\t\tstripeAmount,\n\t\tstripeCurrencyCode,\n\t\tstripeCountryCode,\n\t\tstripeReturnUrl,\n\t\tstripeMode = 'setup',\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\tstripeOnSubmitBeforeRedirect: _stripeOnSubmitBeforeRedirect,\n\t\tcartToken,\n\t\tstripeOnPaymentModePaymentSuccess,\n\t\tonBillingAddressChange,\n\t\t...props\n\t},\n\tref\n) {\n\tconst resources = { ...defaultResources, ...localizedResources };\n\tconst [queryClientState] = useState<QueryClient>(\n\t\tqueryClient ||\n\t\t\tnew QueryClient({\n\t\t\t\tdefaultOptions: {\n\t\t\t\t\tqueries: {\n\t\t\t\t\t\trefetchOnWindowFocus: false,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t);\n\n\tconst billingProfilesRef = useRef<IPaymentMethodsHandle>(null);\n\n\tuseImperativeHandle(\n\t\tref,\n\t\t() => ({\n\t\t\tasync refreshBillingProfiles() {\n\t\t\t\tawait billingProfilesRef.current?.refreshBillingProfiles();\n\t\t\t},\n\t\t}),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<LocalizationProvider localizedResources={resources}>\n\t\t\t<ThemeProvider theme={() => ({ ...styledUITheme, ...theme })}>\n\t\t\t\t<QueryClientProvider client={queryClientState}>\n\t\t\t\t\t<BillingProfiles\n\t\t\t\t\t\tsetSystemMessage={setSystemMessage}\n\t\t\t\t\t\tactAndHandleException={actAndHandleException}\n\t\t\t\t\t\tonSelectedBillingProfileChange={onSelectedBillingProfileChange}\n\t\t\t\t\t\tselectedProfileId={selectedBillingProfileId}\n\t\t\t\t\t\thandleSelectedProfileInvalid={handleSelectedProfileInvalid}\n\t\t\t\t\t\tallowAddressOnly={false}\n\t\t\t\t\t\tpreselectDefaultBillingProfile={preselectDefaultBillingProfile}\n\t\t\t\t\t\tproxyRoutePrefix={proxyRoutePrefix}\n\t\t\t\t\t\tonUpdateBillingProfile={onUpdateBillingProfile}\n\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t\tshouldOnlyShowStripeProfiles={shouldOnlyShowStripeProfiles}\n\t\t\t\t\t\tshouldOnlyShowStripeAndCreditCardProfiles={true}\n\t\t\t\t\t\tstripeAmount={stripeAmount}\n\t\t\t\t\t\tstripeCurrencyCode={stripeCurrencyCode}\n\t\t\t\t\t\tstripeCountryCode={stripeCountryCode}\n\t\t\t\t\t\tstripeReturnUrl={stripeReturnUrl}\n\t\t\t\t\t\tstripeMode={stripeMode}\n\t\t\t\t\t\tstripeOnPaymentModePaymentSuccess={stripeOnPaymentModePaymentSuccess}\n\t\t\t\t\t\tcartToken={cartToken}\n\t\t\t\t\t\tcontinueToPaypalSiteToAddProfile={continueToPaypalSiteToAddProfile}\n\t\t\t\t\t\tlog={log}\n\t\t\t\t\t\tdarkMode={darkMode}\n\t\t\t\t\t\tonBillingAddressChange={onBillingAddressChange}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t\tref={billingProfilesRef}\n\t\t\t\t\t/>\n\t\t\t\t\t<ReactQueryDevtools initialIsOpen={false} />\n\t\t\t\t</QueryClientProvider>\n\t\t\t</ThemeProvider>\n\t\t</LocalizationProvider>\n\t);\n});\n\nexport default PaymentMethods;\n","import React from 'react';\nimport { theme as styledUITheme } from '@faithlife/styled-ui';\nimport { QueryClient, QueryClientProvider } from 'react-query';\nimport { ThemeProvider } from 'styled-components';\nimport { useAddressFormData } from '../../../address-form';\nimport { ISystemMessage } from '../../typings/ISystemMessage';\nimport { IBillingProfileDto } from '../../clients/typings/orders';\nimport StripeEnvironmentKind from '../../typings/StripeEnvironmentKind';\nimport LogLevel from '../../typings/LogLevel';\nimport { LocalizationProvider } from '../../Localization';\nimport ILocalizedResources from '../../typings/ILocalizedResources';\nimport defaultResources from '../../locales/en-US/resources.json';\nimport Locale from '../../locales/Locale';\nimport AddStripePaymentMethod from '../payment-methods/stripe/add-payment-method';\nimport { LocationsClient } from '../../clients/locations-client';\n\ninterface IStripeEntryFormProps {\n\treturnUrl: string;\n\tsetSystemMessage: (systemMessage: ISystemMessage) => void;\n\tactAndHandleException: (action: () => Promise<any>, actionDescription: string) => Promise<any>;\n\tonBillingProfileCreated?: (createdBillingProfile: IBillingProfileDto) => void;\n\tonCancelEditingBillingProfile?: () => void;\n\tenvironment: StripeEnvironmentKind;\n\tproxyRoutePrefix?: string;\n\ttheme: any;\n\tlocalizedResources: ILocalizedResources;\n\tlog?: (logLevel: LogLevel, message: string, details?: Record<string, any>) => void;\n\tlocale: Locale;\n\tdarkMode?: boolean;\n\tmode?: 'setup' | 'payment';\n\tamount: number;\n\tcartToken?: string | null;\n\tcurrencyCode?: string;\n\tcountryCode?: string;\n\tonSubmitBeforeRedirect?: () => void;\n\tonPaymentModePaymentSuccess?: (orderId: string, cartToken: string) => void;\n\tdoPaypalRedirect?: () => void;\n\tonBillingAddressChange?: (profileId: string, onAmountChanged: (amount: number) => void) => Promise<void>;\n}\n\nconst StripeEntryForm: React.FunctionComponent<IStripeEntryFormProps> = ({\n\treturnUrl,\n\tsetSystemMessage,\n\tactAndHandleException,\n\tonBillingProfileCreated,\n\tonCancelEditingBillingProfile,\n\tenvironment,\n\tproxyRoutePrefix,\n\ttheme,\n\tlocalizedResources,\n\tlog,\n\tlocale,\n\tdarkMode,\n\tmode = 'setup',\n\tamount,\n\tcartToken,\n\tcurrencyCode,\n\tcountryCode,\n\tonSubmitBeforeRedirect,\n\tonPaymentModePaymentSuccess,\n\tdoPaypalRedirect,\n\tonBillingAddressChange,\n}) => {\n\tconst { addressFormatItems, countries, handleCountryChanged, statesByCountryId, hasLoadedAddressInfo } =\n\t\tuseAddressFormData(\n\t\t\tLocationsClient.getCountries,\n\t\t\tLocationsClient.getStatesForCountry,\n\t\t\tLocationsClient.getAddressFormatForCountry,\n\t\t\tactAndHandleException,\n\t\t\tlocale,\n\t\t\tproxyRoutePrefix,\n\t\t\tcountryCode\n\t\t);\n\n\tconst resources = { ...defaultResources, ...localizedResources };\n\tconst queryClient = new QueryClient({\n\t\tdefaultOptions: {\n\t\t\tqueries: {\n\t\t\t\trefetchOnWindowFocus: false,\n\t\t\t},\n\t\t},\n\t});\n\n\treturn (\n\t\t<LocalizationProvider localizedResources={resources}>\n\t\t\t<ThemeProvider theme={() => ({ ...styledUITheme, ...theme })}>\n\t\t\t\t<QueryClientProvider client={queryClient}>\n\t\t\t\t\t<AddStripePaymentMethod\n\t\t\t\t\t\tmode={mode}\n\t\t\t\t\t\treturnUrl={returnUrl}\n\t\t\t\t\t\tsetSystemMessage={setSystemMessage}\n\t\t\t\t\t\tonBillingProfileCreated={onBillingProfileCreated}\n\t\t\t\t\t\tonCancelEditingBillingProfile={onCancelEditingBillingProfile}\n\t\t\t\t\t\tenvironment={environment}\n\t\t\t\t\t\tproxyRoutePrefix={proxyRoutePrefix}\n\t\t\t\t\t\tlog={log}\n\t\t\t\t\t\tlocale={locale}\n\t\t\t\t\t\tdarkMode={darkMode}\n\t\t\t\t\t\tamount={amount}\n\t\t\t\t\t\tcartToken={cartToken}\n\t\t\t\t\t\tcurrencyCode={currencyCode}\n\t\t\t\t\t\tcountryCode={countryCode}\n\t\t\t\t\t\tonSubmitBeforeRedirect={onSubmitBeforeRedirect}\n\t\t\t\t\t\tonPaymentModePaymentSuccess={onPaymentModePaymentSuccess}\n\t\t\t\t\t\tdoPaypalRedirect={doPaypalRedirect}\n\t\t\t\t\t\tonBillingAddressChange={onBillingAddressChange}\n\t\t\t\t\t\taddressFormatItems={addressFormatItems}\n\t\t\t\t\t\tcountries={countries}\n\t\t\t\t\t\tstatesByCountryId={statesByCountryId}\n\t\t\t\t\t\thandleCountryChanged={handleCountryChanged}\n\t\t\t\t\t\thasLoadedAddressInfo={hasLoadedAddressInfo}\n\t\t\t\t\t/>\n\t\t\t\t</QueryClientProvider>\n\t\t\t</ThemeProvider>\n\t\t</LocalizationProvider>\n\t);\n};\n\nexport default StripeEntryForm;\n","import { Box, Heading, Text } from '@faithlife/styled-ui';\nimport styled from 'styled-components';\n\nexport const Root = styled(Box)`\n\ttext-align: center;\n`;\n\nexport const Header = styled(Heading).attrs({\n\tlevel: 28,\n})``;\n\nexport const Body = styled(Text).attrs({\n\ttextStyle: 'c.18',\n})``;\n\nexport const Footer = styled(Text).attrs({\n\ttextStyle: 'c.14',\n\tfontStyle: 'italic',\n})``;\n","import React from 'react';\nimport { useQuery } from 'react-query';\nimport ordersClient from '../../clients/orders-client';\nimport * as Styled from './styled';\nimport ILocalizedResources from '../../typings/ILocalizedResources';\n\ninterface IStripeCartStatusCheckerProps {\n\tcartToken: string;\n\tonPaymentSuccess: (orderId: string, cartToken: string) => void;\n\tlocalizedResources: ILocalizedResources;\n\tredirectStatus?: string;\n}\n\ninterface StatusMessage {\n\theader: string;\n\tbody: string;\n\tfooter: string;\n}\n\nconst StripeCartStatusChecker: React.FunctionComponent<IStripeCartStatusCheckerProps> = ({\n\tcartToken,\n\tlocalizedResources,\n\tonPaymentSuccess,\n\tredirectStatus,\n}) => {\n\tconst pendingMessage = {\n\t\theader: localizedResources.stripeCartStatusChecker.header,\n\t\tbody: localizedResources.stripeCartStatusChecker.body,\n\t\tfooter: localizedResources.stripeCartStatusChecker.footer,\n\t};\n\n\tconst errorMessage = {\n\t\theader: localizedResources.stripeCartStatusChecker.errorHeader,\n\t\tbody: localizedResources.stripeCartStatusChecker.errorBody,\n\t\tfooter: '',\n\t};\n\n\tconst paymentFailedMessage = {\n\t\theader: localizedResources.stripeCartStatusChecker.paymentFailedHeader,\n\t\tbody: localizedResources.stripeCartStatusChecker.paymentFailedBody,\n\t\tfooter: localizedResources.stripeCartStatusChecker.paymentFailedFooter,\n\t};\n\n\tconst failedPayment = redirectStatus === 'failed';\n\n\tconst [statusMessage, setStatusMessage] = React.useState<StatusMessage>(\n\t\tfailedPayment ? paymentFailedMessage : pendingMessage\n\t);\n\n\tif (!cartToken) {\n\t\tthrow new Error('Cart token is required.');\n\t}\n\n\tuseQuery(['getCartByToken', cartToken], async () => await ordersClient.getCartByTokenAsync(cartToken), {\n\t\tenabled: !!cartToken && !failedPayment,\n\t\tstaleTime: 2000,\n\t\tretry: false,\n\t\trefetchInterval: 5000,\n\t\tonSuccess: data => {\n\t\t\tif (data.orderId && cartToken) {\n\t\t\t\tonPaymentSuccess(data.orderId, cartToken);\n\t\t\t} else {\n\t\t\t\tsetStatusMessage(pendingMessage);\n\t\t\t}\n\t\t},\n\t\tonError: () => {\n\t\t\tsetStatusMessage(errorMessage);\n\t\t},\n\t});\n\n\treturn (\n\t\t<Styled.Root>\n\t\t\t<Styled.Header>{statusMessage.header}</Styled.Header>\n\t\t\t<Styled.Body>{statusMessage.body}</Styled.Body>\n\t\t\t<br />\n\t\t\t<Styled.Footer>{statusMessage.footer}</Styled.Footer>\n\t\t</Styled.Root>\n\t);\n};\n\nexport default StripeCartStatusChecker;\n","import { useCallback, useEffect, useState } from 'react';\nimport { PaymentMethodEvent, paymentMethodEventHandler } from '../payment-method-event-handler';\nimport ILocalizedResources from '../../../../typings/ILocalizedResources';\n\ninterface IPaymentFormClientProps {\n\tselectedBillingProfileId?: string;\n\tamount: number;\n\tonPaymentProcessing: () => void;\n\tonPaymentProcessed: () => void;\n\tonPaymentCanceled: () => void;\n\tlocalizedResources: ILocalizedResources;\n}\n\nconst usePaymentFormClientHandler = ({\n\tselectedBillingProfileId,\n\tamount,\n\tonPaymentProcessing,\n\tonPaymentProcessed,\n\tonPaymentCanceled,\n\tlocalizedResources,\n}: IPaymentFormClientProps) => {\n\tconst [isBillingAddressComplete, setIsBillingAddressComplete] = useState(false);\n\tconst [isPaymentMethodComplete, setIsPaymentMethodComplete] = useState(false);\n\tconst [selectedPaymentMethod, setSelectedPaymentMethod] = useState<string | undefined>(undefined);\n\tconst [billingAddressProfileId, setBillingAddressProfileId] = useState<string | undefined>(undefined);\n\tconst [isProcessingPayment, setIsProcessingPayment] = useState(false);\n\tconst [isOpen, setIsOpen] = useState(false);\n\n\tconst onSubmitPayment = useCallback(() => {\n\t\tpaymentMethodEventHandler.emit(PaymentMethodEvent.PaymentSubmit);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst unsubscribe = paymentMethodEventHandler.subscribe(\n\t\t\t({ type, billingAddressProfileId, selectedPaymentMethod }) => {\n\t\t\t\tif (type === PaymentMethodEvent.BillingAddressComplete) {\n\t\t\t\t\tsetIsBillingAddressComplete(true);\n\t\t\t\t} else if (type === PaymentMethodEvent.BillingAddressRequired) {\n\t\t\t\t\tsetIsBillingAddressComplete(false);\n\t\t\t\t} else if (type === PaymentMethodEvent.BillingAddressProfileUpdated) {\n\t\t\t\t\tsetBillingAddressProfileId(billingAddressProfileId);\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentMethodComplete) {\n\t\t\t\t\tsetIsPaymentMethodComplete(true);\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentMethodRequired) {\n\t\t\t\t\tsetIsPaymentMethodComplete(false);\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentMethodChange) {\n\t\t\t\t\tsetSelectedPaymentMethod(selectedPaymentMethod);\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentProcessing) {\n\t\t\t\t\tsetIsProcessingPayment(true);\n\t\t\t\t\tonPaymentProcessing();\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentProcessed) {\n\t\t\t\t\tsetIsProcessingPayment(false);\n\t\t\t\t\tonPaymentProcessed();\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentFormOpened) {\n\t\t\t\t\tsetIsOpen(true);\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentFormClosed) {\n\t\t\t\t\tsetIsProcessingPayment(false);\n\t\t\t\t\tsetIsPaymentMethodComplete(false);\n\t\t\t\t\tsetIsBillingAddressComplete(false);\n\t\t\t\t\tsetIsOpen(false);\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentCanceled) {\n\t\t\t\t\tsetIsProcessingPayment(false);\n\t\t\t\t\tonPaymentCanceled();\n\t\t\t\t} else if (type === PaymentMethodEvent.PaymentSubmit) {\n\t\t\t\t\tsetIsProcessingPayment(true);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribe();\n\t\t};\n\t}, [onPaymentProcessing, onPaymentProcessed, onPaymentCanceled, selectedBillingProfileId]);\n\n\treturn {\n\t\tisOpen,\n\t\tisSubmitPaymentEnabled: isBillingAddressComplete && isPaymentMethodComplete && !isProcessingPayment,\n\t\tisProcessingPayment,\n\t\tsubmitPaymentDisabledReason: !isBillingAddressComplete\n\t\t\t? localizedResources.enterBillingAddressBeforePayment\n\t\t\t: !isPaymentMethodComplete\n\t\t\t\t? localizedResources.enterPaymentMethodBeforePlacingOrder\n\t\t\t\t: undefined,\n\t\tisPaymentBillingProfileRequired: amount > 0 && billingAddressProfileId === selectedBillingProfileId,\n\t\tselectedPaymentMethod,\n\t\tonSubmitPayment,\n\t};\n};\n\nexport default usePaymentFormClientHandler;\n","import BillingSummary from './components/billing-summary';\nimport ShippingAddressForm from './components/shipping-address-form';\nimport PaymentMethods from './components/payment-methods';\nimport StripeEntryForm from './components/stripe-entry-form';\nimport StripeCartStatusChecker from './components/stripe-cart-status-checker';\nimport LogLevel from './typings/LogLevel';\nimport StripeLocalesByLocale from './components/stripe-locales-by-locale';\nimport { paymentMethodEventHandler } from './components/payment-methods/stripe/payment-method-event-handler';\nimport usePaymentFormClientHandler from './components/payment-methods/stripe/payment-mode/use-payment-form-client-handler';\n\nexport {\n\tBillingSummary,\n\tShippingAddressForm,\n\tStripeEntryForm,\n\tStripeCartStatusChecker,\n\tLogLevel,\n\tStripeLocalesByLocale,\n\tpaymentMethodEventHandler,\n\tusePaymentFormClientHandler,\n};\nexport default PaymentMethods;\n"],"names":["_GetTypedLocalization","GetTypedLocalization","LocalizationProvider","useLocalization","Localize","Text","_g","_extends","Object","assign","bind","n","e","arguments","length","t","r","hasOwnProperty","call","apply","amex","props","react","createElement","xmlns","viewBox","fill","fillRule","width","height","x","y","stroke","rx","d","discover_g","discover_extends","discover","_defs","mastercard_g","mastercard_extends","mastercard","xmlnsXlink","id","transform","xlinkHref","mask","visa_g","visa_extends","visa","trash_defs","_use","trash_extends","trash","paypal_g","paypal_extends","paypal","_style","jcb_g","jcb_extends","jcb","xmlSpace","type","strokeWidth","gradientTransform","y2","x2","y1","x1","gradientUnits","style","stopColor","offset","_rect","_path","_path2","_path3","_path4","unionpay_extends","unionpay","preserveAspectRatio","discover_partner_path","discover_partner_extends","discover_partner","stripe_generic_path","stripe_generic_extends","stripe_generic","diners_club_g","diners_club_extends","diners_club","cx","cy","trash_disabled_defs","trash_disabled_use","trash_disabled_extends","trash_disabled","info_icon_g","info_icon_extends","Label","styled","label","withConfig","displayName","componentId","_ref","theme","colors","gray54","LabelText","p","InfoRow","div","BillingProfilesContainer","Box","borderColor","BillingProfilesSection","CancelButton","Button","attrs","variant","size","CardLogoContainer","CardNumber","Checkbox","UnstyledCheckbox","_ref2","space","CreateButton","CreditCardRow","_ref3","_ref4","foregroundPrimary","LoadingSpinnerRow","Delete","_ref5","isDeleting","DeleteButton","DeleteButtonContainer","Dots","EditButton","EditCreditCardFormSection","_ref6","gray4","_ref7","_ref8","EditText","ExpirationContainer","ExpiredCardWarning","_ref9","red4","_ref0","fontWeights","semibold","Name","_ref1","NewProfileButtons","PayPalDelete","marginBottom","RadioLabel","_ref10","_ref11","_ref12","_ref13","SecurityCodeContainer","Title","_ref14","_ref15","gray52","_ref16","thickness3","_ref17","_ref18","InfoSvgContainer","InfoSvg","ToolTipContentContainer","ToolTipContentTopParagraph","Row","SupportedBillingProfileTypes","map","s","toLowerCase","cardToSVG","React","Mastercard","className","Visa","Amex","Discover","JCB","UnionPay","discoverpartner","DiscoverPartner","dinersclub","DinersClub","billing_profile","billingProfile","onUpdate","isSelected","onSelected","index","isEditing","now","Date","strings","isExpired","cardInfo","expirationYear","getFullYear","expirationMonth","getMonth","isHalfProfile","includes","Styled","Radio","onClick","isChecked","disabled","creditCardProvider","creditCardNumber","expired","invalid","edit","CardInfoContainer","CardNumberContainer","Expiration","billing_summary","PayPal","nameOnCard","expires","toString","slice","components_billing_summary","localizedResources","resources","_objectSpread","defaultResources","queryClient","QueryClient","defaultOptions","queries","refetchOnWindowFocus","ThemeProvider","styledUITheme","QueryClientProvider","client","BillingSummary","AddressFieldKind","typings_AddressFieldKind","sharedInputStyles","css","input","background","foreground","border","placeholderForeground","shadowFocused","getSharedInvalidInputStyles","isValid","red2","red3","Cleave","CleaveUnstyled","backgroundReadOnly","$isValid","Input","UnstyledInput","AddressRow","AddressFormContainer","shade70","CenteredContent","span","localesByName","deDE","enUS","useLocale","locale","keys","CountryInput","_objectDestructuringEmpty","components","autoComplete","StateInput","toCamelCase","source","charAt","filterOptionByFullName","createFilter","matchFrom","filterOptionByAbbreviation","stringify","option","_option$data$abbrevia","data","abbreviation","filterOption","address_form","initialAddressInfo","addressInfo","countries","statesByCountryId","onSelectedCountryChanged","updateAddressInfo","addressFormatItems","_ref3$defaultCountryO","defaultCountryOption","value","errorByFieldName","_ref3$locale","_ref3$isReadOnly","isReadOnly","hasLoadedAddressInfo","_useState","useState","_useState2","_slicedToArray","isCountryMenuOpen","setIsCountryMenuOpen","_useState3","_useState4","isStateMenuOpen","setIsStateMenuOpen","_useState5","_useState6","shouldCloseStateSelect","setShouldCloseStateSelect","initialCountryOption","countryId","country","name","find","_useState7","_useState8","stateOption","setStateOption","_useState9","_useState0","countryOption","setCountryOption","useEffect","mapStateToOption","useCallback","state","stateId","initialStateOption","prototype","stateDto","useStateSelector","stateAddressFormat","item","kind","State","Suburb","postalCodeAddressFormat","PostalCode","cityAddressFormat","City","countryOptions","useMemo","c","sort","a","b","localeCompare","countriesByName","reduce","prev","cur","stateOptions","optionByState","acc","isValidField","fieldName","selectStyles","useSelectStyles","useTheme","isDisabled","control","base","backgroundColor","concat","gray34","opacity","boxShadow","outline","dropdownIndicator","paddingLeft","paddingRight","singleValue","color","hasLoadedStatesForCountry","some","target","selectedOption","suburb","toLocaleLowerCase","Select","placeholder","onChange","action","onInputChange","options","defaultValue","styles","streetAddress","addressLine1","maxLength","addressLine2","addressLine3","isOptional","city","menuIsOpen","onMenuOpen","onMenuClose","onBlur","setTimeout","_document","document","activeElement","HTMLElement","blur","onFocus","placeholders","postalCode","LoadingSpinner","useAddressFormData","getCountries","getStatesForCountry","getAddressFormatForCountry","actAndHandleException","proxyRoutePrefix","undefined","initialCountryId","setCountryId","setStatesByCountryId","_useQuery","useQuery","async","staleTime","Infinity","onError","error","fetchCountries","_useQuery$data","hasLoadedCountries","isFetched","hasLoadedStates","onSuccess","failedToFetchStates","_useQuery3","isNaN","Number","failedToFetchAddressFormat","_useQuery3$data","hasLoadedAddressFormat","handleCountryChanged","fetchJson","url","_ref$credentials","credentials","_ref$method","method","_ref$body","body","_ref$query","query","_ref$headers","headers","queryString","filter","key","encodeURIComponent","join","separator","response","fetch","Accept","ok","errorJson","json","_","Error","status","locations_AddressFieldKind","AddressFormatMapper","mapAddressFormatItems","formatItems","this","mapAddressFormatItem","mapAddressFieldKind","format","values","LocationsClient","states","orderedAddressFormatItems","nameof","cardNumberPrefixByType","diners","instapayment","mir","uatp","unionPay","formatMaskedCardNumber","maskedCardNumber","provider","lowercaseProvider","CreditCardDetector","cardNumberPrefix","blocks","firstSegment","repeat","middleSegments","block","push","lastSegment","enspace","areExpirationDatesValid","currentMonth","currentYear","parseInt","normalizeExpiration","expiration","normalizedExpiration","replace","_normalizedExpiration","split","_normalizedExpiration2","exampleDate","isExpirationValid","_normalizedExpiration3","_normalizedExpiration4","editPropertyByOrdersProperty","mapOrdersPropertyToEditProperty","code","message","property","editShippingProfileKindsByFormatItemKinds","Address1","Address2","Address3","potentialCardNumberPattern","isNullOrWhitespace","trim","missingValue","badValue","ShippingAddressContainer","isLoading","alignItems","overflowY","padding","Form","ButtonContainer","NextButton","ShippingAddressForm","setSystemMessage","stripeBillingProfile","shippingProfile","onCancelClicked","onCommitClicked","_ref$proxyRoutePrefix","useBilling","setUseBilling","clientValidationErrors","setClientValidationErrors","isProcessing","setIsProcessing","initialShippingProfile","organization","address1","address2","address3","uncommittedShippingProfile","setUncommittedShippingProfile","isMounted","useRef","current","_useAddressFormData","updateShippingProfile","event","prevState","handleCommitClicked","errors","validateShippingProfile","_statesByCountryId","validateSimpleMissingShippingAddressValues","profile","properties","formatItem","shippingProfileProperty","shippingProfilePropertyValue","match","_countries$find","shippingAddress","countryAlpha2","alpha2","handleUseBillingChange","_billingProfile$cardI","_billingProfile$cardI2","display","title","sameAsBilling","SharedStyled","AddressForm","cancel","save","create","shipping_address_form","_ref$theme","ErrorMapper","mapErrors","mapError","errorCode","isErrorsDto","OrdersClient","getBillingProfiles","shouldIncludePayPal","shouldIncludeAdyenAddressOnly","shouldIncludeStripe","fields","getBillingProfile","createOrdersBillingProfile","createBillingProfileDto","JSON","createStripeBillingProfile","setupIntentId","updateOrdersBillingProfile","billingProfileId","billingProfileChangeSet","deleteOrdersBillingProfile","updateCart","cartToken","cartChangeSet","prepareCartForStripeRedirect","paymentIntentId","amount","statusText","processCart","processCartDto","getCartByTokenAsync","isErrors","BillingProfileMapper","mapForCreatingInOrdersApi","_profile$profile$card","makeDefault","useOnPendingPrepubs","useOnPendingPreorders","useOnActiveSubscriptions","useOnOutstandingPaymentPlans","useOnActiveBids","mapForEditing","_profile$cardInfo","_profile$cardInfo2","_profile$cardInfo3","_profile$usageInfo","_profile$usageInfo2","_profile$usageInfo3","_profile$usageInfo4","padStart","profileId","cardNumber","securityCode","usageInfo","pendingPreorderCount","pendingPrepubCount","activeSubscriptionCount","outstandingPaymentPlansCount","activeBidCount","isDefault","mapForUpdating","sanitizedExpiration","address4","substr","paypal_profile","onDelete","setIsDeleting","trashDisabled","deleteBillingProfile","Tooltip","placement","content","associatedUsage","icon","TrashDisabled","Trash","edit_credit_card_info","uncommittedBillingProfile","isEditingExistingProfile","saveForLater","handleSaveForLaterChange","updateBillingProfile","isCardExpired","setIsCardExpired","updateExpirationDate","exampleExpiration","normalizedEvent","getUncommittedBillingProfileBoolOrDefault","propertyName","getUncommittedCardInfoValueOrDefault","showMakeDefault","isMakingDefaultEnabled","showMoveSubscriptions","isMovingSubscriptionsEnabled","showMovePreordersAndBids","isMovingPrepubsAndBidsEnabled","showMovePaymentPlans","isMovingPaymentPlansEnabled","updateFieldToDefault","makeCurrentProfileDefault","pattern","creditCard","creditCardStrictMode","autoFocus","expirationDateError","date","datePattern","delimiter","numericOnly","rememberThisCard","makeDefaultInfoFuturePurchases","CommandSentence","template","makeDefaultInfoExistingPlans","Field","makeDefaultInfoWillNotChange","toggleOnClick","modifiers","moveSubscriptions","movePaymentPlans","movePreorders","billingAddress","edit_credit_card_form","_billingProfile$usage","_billingProfile$usage2","_billingProfile$usage3","_billingProfile$usage4","onCommitBillingProfile","onCancelEditingBillingProfile","serverValidationErrors","_ref$saveForLater","createButtonText","_ref$usageInfo","_ref$creditCardOption","creditCardOptions","setUncommittedBillingProfile","setTrashDisabled","showErrorModal","setShowErrorModal","_useState1","_useState10","handleModalClose","isValidCreditCardField","validateBillingProfile","countrySpecificFields","validateSimpleMissingValues","i","addressFieldKind","mapAddressFieldKindToProfileProperty","EditCreditCardInfo","delete","Modal","isOpen","onClose","Header","beforeRemoving","Content","moveSubscriptionsToAlternate","movePaymentPlansToAlternate","movePreordersToAlternate","moveCommunityPricingBidsToAlternate","Footer","FooterButtons","cancelButton","text","stripe_profile","cardType","StripeGeneric","PayFacClient","createStripeSetupIntent","createStripePaymentModeCustomerSession","createStripePaymentIntent","currencyCode","returnUrl","confirmationToken","updateStripePaymentIntent","LogLevel","typings_LogLevel","stripe_locales_by_locale","freeze","LoadingSpinnerOverlay","loadingSpinner","outerColor","AddPaymentMethodContainer","BillingAddressSummary","BillingAddressForm","isHidden","BillingAddressFormControls","EnterAddressFirstMessageContainer","red1","EnterAddressFirstMessage","ErrorCircleIcon","ErrorCircle","BillingAddressNameRow","StripeElementsItemContainer","getLocationItemsFromCodes","countryCode","stateAbbr","_statesByCountryId$co2","toUpperCase","mapToStripeBillingAddress","_billingProfile$nameO","_billingProfile$addre","_billingProfile$addre2","_billingProfile$city","_billingProfile$posta","_getLocationItemsForS","getLocationItemsForStripe","_state$abbreviation$t","_getLocationItemsFrom","getLocationItemsFromIds","_statesByCountryId$co","address","line1","line2","postal_code","BillingAddressMode","mapToAddressElementOptions","defaultCountryCode","mode","defaultValues","phone","autocomplete","stripeAddressFormatItems","stripeAddressFormatItemMappings","_state","_suburb","FormattedBillingAddress","field","billing_address","billingAddressProfile","onCountryCodeChange","onSubmitBillingAddress","onEditBillingAddress","isCancelPaymentAllowed","onCancelPayment","onCancelEditingBillingAddress","isFirstTimeProfile","isFormReady","setIsFormReady","Check","setMode","setIsValid","setBillingAddress","billingAddressFormVersion","setBillingAddressFormVersion","elements","useElements","handleAddressElementChange","_event$value","complete","handleEditAddress","Edit","handleSubmitAddress","_elements$getElement","billingAddressEvent","getElement","getValue","billingAddressValue","View","handleCancelEditingBillingAddress","version","validationTimeoutId","_elements$getElement2","clearTimeout","enhancedBillingAddress","isNewBillingAddress","AddressElement","onReady","continue","enterBillingAddressBeforePayment","getPaymentElementOptions","layout","defaultCollapsed","radios","spacedAccordionItems","payment_methods","selectedPaymentMethod","isProcessingPayment","onPaymentMethodChange","onSubmitPayment","isPaymentSubmitEnabled","setIsPaymentSubmitEnabled","handlePaymentElementChange","isSubmitButtonDisabled","PaymentElement","continueToPayPal","proceed","placeOrder","minorUnitDecimalsByCurrencyCode","USD","convertToMinorUnits","minorUnitDecimals","multiplier","Math","pow","round","PaymentMethodEvent","paymentMethodEventHandler","constructor","_defineProperty","emit","typeOrPayload","payload","listeners","forEach","listener","subscribe","l","AddPaymentMethod","log","initialCountryCode","initialAmount","onSubmitBeforeRedirect","doPaypalRedirect","onPaymentModePaymentSuccess","onBillingAddressChange","setAmount","arePaymentMethodsVisible","setArePaymentMethodsVisible","handleError","setSelectedPaymentMethod","handleCountryCodeChange","handleBillingAddressProfileSaved","billingUpdateError","_useBillingAddressPro","useBillingAddressProfileHandler","onBillingAddressProfileSaved","onSaveBillingAddressProfileError","setBillingAddressProfile","createBillingAddressProfile","mapToCreateOrdersBillingProfileDto","_billingAddress$addre","_billingAddress$addre2","_state$stateId","_getLocationItemsFrom2","isAdyenProfile","updateBillingAddressProfile","mapToOrdersBillingProfileChangeSetDto","_billingAddress$addre3","_billingAddress$addre4","_state$stateId2","_getLocationItemsFrom3","loadBillingAddressProfile","_response$billingProf","_response$billingProf2","shouldIncludePaypal","billingProfiles","saveBillingAddressProfile","failedToProcessBillingAddress","_usePaymentMethodsFor","billingAddressProfileId","stripe","useStripe","setIsProcessingPayment","shouldPollCart","setShouldPollCart","handleSubmitPayment","failedToProcessPayment","PaymentProcessing","submitError","submit","Info","PaymentProcessed","_confirmationToken$pa","_await$stripe$createC","createConfirmationToken","params","return_url","billingDetails","payment_method_preview","billing_details","stateAbbrev","countryAbbrev","stripePaymentModeContext","every","orderDto","pendingActionDto","orderTxnId","stripePendingAction","isNextActionRedirect","_await$stripe$handleN","handleNextAction","clientSecret","nextActionError","paymentIntent","markCartAsActive","paymentIntentStatus","requiresPendingCartProcessing","handleCancelPayment","PaymentCanceled","enabled","retry","refetchInterval","orderId","handlePaymentMethodChange","isComplete","PaymentMethodComplete","PaymentMethodRequired","unsubscribe","PaymentSubmit","BillingAddressComplete","BillingAddressRequired","BillingAddressProfileUpdated","PaymentMethodChange","PaymentFormOpened","PaymentFormClosed","usePaymentMethodsFormEvents","preventDefault","paymentMethod","handleEditBillingAddress","handleSubmitBillingAddress","onSaveBillingAddressComplete","fetchInitialBillingAddressProfile","BillingAddress","PaymentMethods","add_payment_method","_props$currencyCode","stripePublishableKey","environment","stripePromise","loadStripe","StripeLocalesByLocale","customerSessionClientSecret","setCustomerSessionClientSecret","paymentMethodConfigurationId","setPaymentMethodConfigurationId","_useMutation","useMutation","createCustomerSession","mutate","isCreateCustomerSessionLoading","elementsOptions","externalPaymentMethodTypes","currency","captureMethod","appearance","darkMode","paymentMethodConfiguration","ProgressIndicator","Elements","paymentElementOptions","onBillingProfileCreated","onPaymentMethodFormLoaded","addressElement","setAddressElement","setIsLoading","isAddressComplete","setIsAddressComplete","isElementsComplete","setIsElementsComplete","createBillingProfile","onMutate","createdProfileResponse","showFailedToCreateBillingProfile","addressOptions","failedToCreateBillingProfile","_useState11","_useState12","selectedPaymentType","setSelectedPaymentType","handleSubmit","_confirmResponse$setu","confirmResponse","confirmSetup","confirmParams","redirect","setupIntent","triggerElementsValidation","_useState13","_useState14","isAddressElementLoaded","setIsAddressElementLoaded","_useState15","_useState16","isPaymentElementLoaded","setIsPaymentElementLoaded","handleAddressElementLoaded","element","focus","handlePaymentElementLoaded","isPaymentMethodFormLoaded","_event$value$address","setup_mode_add_payment_method","setClientSecret","createSetupIntent","isCreateSetupIntentLoading","handlePaymentMethodFormLoaded","stripe_add_payment_method","AddStripePaymentMethodPaymentMode","AddStripePaymentMethodSetupMode","unitedStatesCountryId","SupportedCreditCardBillingProfileTypes","SupportedPayPalBillingProfileTypes","SupportedStripeBillingProfileTypes","billing_profiles","forwardRef","ref","onSelectedBillingProfileChange","onUpdateBillingProfile","selectedProfileId","_ref$allowAddressOnly","allowAddressOnly","_ref$preselectDefault","handleSelectedProfileInvalid","preselectDefaultBillingProfile","continueToPaypalSiteToAddProfile","_ref$shouldOnlyShowSt","shouldOnlyShowStripeProfiles","_ref$shouldOnlyShowSt2","shouldOnlyShowStripeAndCreditCardProfiles","stripeReturnUrl","stripeAmount","stripeCurrencyCode","stripeCountryCode","stripeMode","stripeOnSubmitBeforeRedirect","stripeOnPaymentModePaymentSuccess","_objectWithoutProperties","_excluded","setBillingProfiles","setUsageInfo","billingProfileValidationErrors","setBillingProfileValidationErrors","showAllPaymentMethods","setShowAllPaymentMethods","selectedBillingProfileId","setSelectedBillingProfileId","isAddingNewCreditCard","setIsAddingNewCreditCard","hasLoadedInitialBillingProfiles","setHasLoadedInitialBillingProfiles","editingBillingProfileId","setEditingBillingProfileId","billingProfileChangeKind","setBillingProfileChangeKind","useQueryClient","Promise","resolve","fetchBillingProfiles","selectedBillingProfile","loadingSelectedBillingProfile","_selectedBillingProfi","billingProfileDto","_useQuery2","filteredBillingProfiles","bp","reloadBillingProfiles","loadInitialBillingProfiles","getBillingProfilesAsync","refetch","freshProfiles","defaultProfile","findIndex","onSelectBillingProfile","_billingProfile$count","resetEditingBillingProfile","isConflict","hasGeneralErrors","conflict","invalidateQueries","updateProfile","onDeleteBillingProfile","deleteProfile","toggleEditBillingProfile","handleOnUpdateBillingProfile","onAddCreditCardClicked","displayProfiles","useImperativeHandle","refreshBillingProfiles","buildEditCreditCardFormForUpdates","EditCreditCardForm","onBillingProfileCommittedCb","newPaymentMethod","AddStripePaymentMethod","createdProfile","Fragment","PayPalProfile","StripeProfile","BillingProfile","components_payment_methods","_ref$stripeMode","queryClientState","billingProfilesRef","_billingProfilesRef$c","BillingProfiles","ReactQueryDevtools","initialIsOpen","stripe_entry_form","_ref$mode","Root","Heading","level","Body","textStyle","fontStyle","stripe_cart_status_checker","onPaymentSuccess","redirectStatus","pendingMessage","header","stripeCartStatusChecker","footer","errorMessage","errorHeader","errorBody","paymentFailedMessage","paymentFailedHeader","paymentFailedBody","paymentFailedFooter","failedPayment","_React$useState","_React$useState2","statusMessage","setStatusMessage","ordersClient","use_payment_form_client_handler","onPaymentProcessing","onPaymentProcessed","onPaymentCanceled","isBillingAddressComplete","setIsBillingAddressComplete","isPaymentMethodComplete","setIsPaymentMethodComplete","setBillingAddressProfileId","setIsOpen","isSubmitPaymentEnabled","submitPaymentDisabledReason","enterPaymentMethodBeforePlacingOrder","isPaymentBillingProfileRequired","packages_payment_methods"],"sourceRoot":""}