@funnelfox/billing 0.6.7 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -426,7 +426,7 @@
426
426
  /**
427
427
  * @fileoverview Constants for Funnefox SDK
428
428
  */
429
- const SDK_VERSION = '0.6.7';
429
+ const SDK_VERSION = '0.7.0';
430
430
  const DEFAULTS = {
431
431
  BASE_URL: 'https://billing.funnelfox.com',
432
432
  REGION: 'default',
@@ -677,6 +677,8 @@
677
677
  onMethodRenderError: options.onMethodRenderError,
678
678
  onMethodRender: options.onMethodRender,
679
679
  onCardInputValueChange: options.onCardInputValueChange,
680
+ isCardholderNameRequired: options.isCardholderNameRequired,
681
+ isPostalCodeRequired: options.isPostalCodeRequired,
680
682
  });
681
683
  this.paymentMethodsInterfaces.push(cardInterface);
682
684
  return cardInterface;
@@ -695,7 +697,7 @@
695
697
  throw new PrimerError('Failed to initialize Primer checkout', error);
696
698
  }
697
699
  }
698
- async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onCardInputValueChange, onMethodRenderError, onMethodRender, }) {
700
+ async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onCardInputValueChange, isCardholderNameRequired, isPostalCodeRequired, onMethodRenderError, onMethodRender, }) {
699
701
  try {
700
702
  if (!this.currentHeadless) {
701
703
  throw new PrimerError('Headless checkout not found');
@@ -711,8 +713,10 @@
711
713
  if (!pmManager)
712
714
  return false;
713
715
  const { valid, validationErrors } = await pmManager.validate();
714
- const cardHolderError = validationErrors.find(v => v.name === 'cardholderName');
715
- dispatchError('cardholderName', cardHolderError?.message || null);
716
+ const cardHolderError = isCardholderNameRequired?.()
717
+ ? validationErrors.find(v => v.name === 'cardholderName')?.message
718
+ : null;
719
+ dispatchError('cardholderName', cardHolderError);
716
720
  let emailError = null;
717
721
  if (hasEmail) {
718
722
  const emailAddress = elements.emailAddress?.value?.trim();
@@ -721,11 +725,19 @@
721
725
  : null;
722
726
  dispatchError('emailAddress', emailError);
723
727
  }
724
- return valid && !emailError;
728
+ const postalCodeError = getPostalCodeError();
729
+ dispatchError('postalCode', postalCodeError);
730
+ return valid && !emailError && !cardHolderError && !postalCodeError;
725
731
  };
726
732
  const dispatchError = (inputName, error) => {
727
733
  onInputChange(inputName, error);
728
734
  };
735
+ const getPostalCodeError = () => {
736
+ const postalCode = elements.postalCode?.value?.trim();
737
+ return isPostalCodeRequired?.() && !postalCode
738
+ ? 'Please enter a postal code'
739
+ : null;
740
+ };
729
741
  const onHostedInputChange = (name) => (event) => {
730
742
  const input = event;
731
743
  if (input.submitted) {
@@ -748,7 +760,22 @@
748
760
  };
749
761
  elements.emailAddress.addEventListener('input', emailAddressOnChange);
750
762
  }
763
+ const countrySelectorOnChange = (e) => {
764
+ const countryCode = e.target.value.trim();
765
+ onCardInputValueChange?.('countryCode', countryCode);
766
+ if (!isPostalCodeRequired?.()) {
767
+ dispatchError('postalCode', null);
768
+ }
769
+ };
770
+ const postalCodeOnChange = (e) => {
771
+ const postalCode = e.target.value.trim();
772
+ onCardInputValueChange?.('postalCode', postalCode);
773
+ dispatchError('postalCode', getPostalCodeError());
774
+ };
751
775
  elements.cardholderName?.addEventListener('input', cardHolderOnChange);
776
+ elements.emailAddress?.addEventListener('input', emailAddressOnChange);
777
+ elements.countrySelector?.addEventListener('change', countrySelectorOnChange);
778
+ elements.postalCode?.addEventListener('input', postalCodeOnChange);
752
779
  cardNumberInput.addEventListener('change', onHostedInputChange('cardNumber'));
753
780
  expiryInput.addEventListener('change', onHostedInputChange('expiryDate'));
754
781
  cvvInput.addEventListener('change', onHostedInputChange('cvv'));
@@ -791,6 +818,8 @@
791
818
  pmManager.removeHostedInputs();
792
819
  elements.cardholderName?.removeEventListener('input', cardHolderOnChange);
793
820
  elements.emailAddress?.removeEventListener('input', emailAddressOnChange);
821
+ elements.countrySelector?.removeEventListener('change', countrySelectorOnChange);
822
+ elements.postalCode?.removeEventListener('input', postalCodeOnChange);
794
823
  elements.button?.removeEventListener('click', onSubmitHandler);
795
824
  };
796
825
  this.destroyCallbacks.push(onDestroy);
@@ -809,6 +838,12 @@
809
838
  if (elements.emailAddress) {
810
839
  elements.emailAddress.disabled = disabled;
811
840
  }
841
+ if (elements.countrySelector) {
842
+ elements.countrySelector.disabled = disabled;
843
+ }
844
+ if (elements.postalCode) {
845
+ elements.postalCode.disabled = disabled;
846
+ }
812
847
  },
813
848
  submit: () => onSubmitHandler(),
814
849
  destroy: () => {
@@ -831,7 +866,7 @@
831
866
  }, method);
832
867
  }
833
868
  async renderCheckout(clientToken, checkoutOptions, checkoutRenderOptions) {
834
- const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, onCardInputValueChange, } = checkoutRenderOptions;
869
+ const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, onCardInputValueChange, isCardholderNameRequired, isPostalCodeRequired, } = checkoutRenderOptions;
835
870
  await this.initializeHeadlessCheckout(clientToken, checkoutOptions);
836
871
  onMethodsAvailable?.(this.availableMethods);
837
872
  await Promise.all(this.availableMethods.map(method => {
@@ -844,6 +879,8 @@
844
879
  onMethodRender,
845
880
  onMethodRenderError,
846
881
  onCardInputValueChange,
882
+ isCardholderNameRequired,
883
+ isPostalCodeRequired,
847
884
  });
848
885
  }
849
886
  else {
@@ -1058,6 +1095,12 @@
1058
1095
  if (params.email !== undefined) {
1059
1096
  payload.email_address = params.email;
1060
1097
  }
1098
+ if (params.countryCode !== undefined) {
1099
+ payload.country_code = params.countryCode;
1100
+ }
1101
+ if (params.postalCode !== undefined) {
1102
+ payload.postal_code = params.postalCode;
1103
+ }
1061
1104
  return (await this.request(API_ENDPOINTS.CREATE_PAYMENT, {
1062
1105
  method: 'POST',
1063
1106
  body: JSON.stringify(payload),
@@ -1370,6 +1413,7 @@
1370
1413
  super();
1371
1414
  this.counter = 0;
1372
1415
  this.radarSessionId = null;
1416
+ this.cardSessionFieldConfig = {};
1373
1417
  this.handleInputChange = (inputName, error) => {
1374
1418
  this.emit(EVENTS.INPUT_ERROR, { name: inputName, error });
1375
1419
  };
@@ -1387,6 +1431,17 @@
1387
1431
  this.handleCardInputValueChange = (inputName, value) => {
1388
1432
  if (inputName === 'emailAddress') {
1389
1433
  this.cardEmailAddress = value?.trim() || undefined;
1434
+ return;
1435
+ }
1436
+ if (inputName === 'countryCode') {
1437
+ this.cardCountryCode = this.normalizeCountryCode(value);
1438
+ if (!this.isPostalCodeVisible()) {
1439
+ this.cardPostalCode = undefined;
1440
+ }
1441
+ return;
1442
+ }
1443
+ if (inputName === 'postalCode') {
1444
+ this.cardPostalCode = value?.trim() || undefined;
1390
1445
  }
1391
1446
  };
1392
1447
  this.handleMethodRender = (method) => {
@@ -1412,6 +1467,8 @@
1412
1467
  orderId: this.orderId,
1413
1468
  paymentMethodToken: paymentMethodTokenData.token,
1414
1469
  email: this.getPaymentEmailAddress(),
1470
+ countryCode: this.getPaymentCountryCode(),
1471
+ postalCode: this.getPaymentPostalCode(),
1415
1472
  clientMetadata: {
1416
1473
  radarSessionId,
1417
1474
  },
@@ -1484,6 +1541,8 @@
1484
1541
  this.primerWrapper = new PrimerWrapper();
1485
1542
  this.isDestroyed = false;
1486
1543
  this.cardEmailAddress = this.checkoutConfig.customer.email;
1544
+ this.shouldApplySessionCardholderNameConfig =
1545
+ this.checkoutConfig.card?.cardholderName?.required === undefined;
1487
1546
  this._setupCallbackBridges();
1488
1547
  }
1489
1548
  _setupCallbackBridges() {
@@ -1523,7 +1582,7 @@
1523
1582
  this.hideInitializingLoader();
1524
1583
  }
1525
1584
  }
1526
- async createSession(method) {
1585
+ async createSession() {
1527
1586
  this.apiClient = new APIClient({
1528
1587
  baseUrl: this.baseUrl || DEFAULTS.BASE_URL,
1529
1588
  orgId: this.orgId,
@@ -1538,14 +1597,11 @@
1538
1597
  clientMetadata: this.checkoutConfig.clientMetadata,
1539
1598
  countryCode: this.checkoutConfig.customer.countryCode,
1540
1599
  };
1541
- this.sessionMethod = method;
1542
1600
  const cacheKey = [
1543
- //this.id,
1544
1601
  this.orgId,
1545
1602
  this.checkoutConfig.priceId,
1546
1603
  this.checkoutConfig.customer.externalId,
1547
1604
  this.checkoutConfig.customer.email,
1548
- //method || 'default',
1549
1605
  ].join('-');
1550
1606
  let sessionResponse;
1551
1607
  // Return cached response if payload hasn't changed
@@ -1579,7 +1635,9 @@
1579
1635
  this.clientToken = sessionData.clientToken;
1580
1636
  }
1581
1637
  applySessionCardFieldConfig(response) {
1582
- const cardConfig = this.checkoutConfig.card || {};
1638
+ const cardConfig = {
1639
+ ...(this.checkoutConfig.card || {}),
1640
+ };
1583
1641
  if (cardConfig.emailAddress?.visible === undefined &&
1584
1642
  response.data?.show_email_field !== undefined) {
1585
1643
  cardConfig.emailAddress = {
@@ -1587,19 +1645,41 @@
1587
1645
  visible: response.data.show_email_field,
1588
1646
  };
1589
1647
  }
1590
- if (cardConfig.cardholderName?.required === undefined &&
1648
+ if (this.shouldApplySessionCardholderNameConfig &&
1591
1649
  response.data?.show_cardholder_name_field !== undefined) {
1592
1650
  cardConfig.cardholderName = {
1593
1651
  ...cardConfig.cardholderName,
1594
1652
  required: response.data.show_cardholder_name_field,
1595
1653
  };
1596
1654
  }
1655
+ const countryFieldOverrides = this.normalizeCountryFieldOverrides(response.data?.country_field_overrides);
1656
+ const detectedCountryCode = this.normalizeCountryCode(response.data?.detected_country_code) ||
1657
+ this.cardCountryCode;
1658
+ this.cardSessionFieldConfig = {
1659
+ ...this.cardSessionFieldConfig,
1660
+ showCountrySelector: response.data?.show_country_selector_field ??
1661
+ this.cardSessionFieldConfig.showCountrySelector,
1662
+ showPostalCode: response.data?.show_postal_code_field ??
1663
+ this.cardSessionFieldConfig.showPostalCode,
1664
+ detectedCountryCode: detectedCountryCode || this.cardSessionFieldConfig.detectedCountryCode,
1665
+ validCountries: response.data?.valid_countries ||
1666
+ this.cardSessionFieldConfig.validCountries,
1667
+ countryFieldOverrides: countryFieldOverrides ||
1668
+ this.cardSessionFieldConfig.countryFieldOverrides,
1669
+ };
1597
1670
  if (Object.keys(cardConfig).length > 0) {
1598
1671
  this.checkoutConfig.card = cardConfig;
1599
1672
  }
1673
+ this.cardCountryCode =
1674
+ this.cardSessionFieldConfig.detectedCountryCode || this.cardCountryCode;
1675
+ if (!this.isPostalCodeVisible()) {
1676
+ this.cardPostalCode = undefined;
1677
+ }
1600
1678
  }
1601
1679
  getPrimerCardConfig() {
1602
- const cardConfig = { ...(this.checkoutConfig.card || {}) };
1680
+ const cardConfig = {
1681
+ ...(this.checkoutConfig.card || {}),
1682
+ };
1603
1683
  delete cardConfig.emailAddress;
1604
1684
  return Object.keys(cardConfig).length
1605
1685
  ? cardConfig
@@ -1709,6 +1789,8 @@
1709
1789
  onSubmit: this.handleSubmit,
1710
1790
  onInputChange: this.handleInputChange,
1711
1791
  onCardInputValueChange: this.handleCardInputValueChange,
1792
+ isCardholderNameRequired: () => this.isCardholderNameRequired(),
1793
+ isPostalCodeRequired: () => this.isPostalCodeVisible(),
1712
1794
  onMethodRender: this.handleMethodRender,
1713
1795
  onMethodsAvailable: this.handleMethodsAvailable,
1714
1796
  onMethodRenderError: this.handleMethodRenderError,
@@ -1867,12 +1949,58 @@
1867
1949
  isProcessing() {
1868
1950
  return ['processing', 'action_required'].includes(this.state);
1869
1951
  }
1952
+ normalizeCountryCode(countryCode) {
1953
+ const normalized = countryCode?.trim().toUpperCase();
1954
+ return normalized || undefined;
1955
+ }
1956
+ normalizeCountryFieldOverrides(overrides) {
1957
+ if (!overrides) {
1958
+ return undefined;
1959
+ }
1960
+ return Object.entries(overrides).reduce((result, [countryCode, override]) => {
1961
+ const normalizedCountryCode = this.normalizeCountryCode(countryCode);
1962
+ if (normalizedCountryCode && override) {
1963
+ result[normalizedCountryCode] = override;
1964
+ }
1965
+ return result;
1966
+ }, {});
1967
+ }
1968
+ getSelectedCountryCode() {
1969
+ return (this.normalizeCountryCode(this.cardCountryCode) ||
1970
+ this.normalizeCountryCode(this.cardSessionFieldConfig.detectedCountryCode));
1971
+ }
1972
+ getCountryFieldOverride(countryCode = this.getSelectedCountryCode()) {
1973
+ if (!countryCode) {
1974
+ return undefined;
1975
+ }
1976
+ return this.cardSessionFieldConfig.countryFieldOverrides?.[countryCode];
1977
+ }
1978
+ isCardholderNameRequired() {
1979
+ return !!this.checkoutConfig.card?.cardholderName?.required;
1980
+ }
1981
+ isPostalCodeVisible(countryCode = this.getSelectedCountryCode()) {
1982
+ const defaultValue = !!this.cardSessionFieldConfig.showPostalCode;
1983
+ const overrideValue = this.getCountryFieldOverride(countryCode)?.show_postal_code;
1984
+ if (overrideValue === null || overrideValue === undefined) {
1985
+ return defaultValue;
1986
+ }
1987
+ return overrideValue;
1988
+ }
1989
+ getPaymentCountryCode() {
1990
+ return this.getSelectedCountryCode();
1991
+ }
1992
+ getPaymentPostalCode() {
1993
+ if (!this.isPostalCodeVisible()) {
1994
+ return undefined;
1995
+ }
1996
+ return this.cardPostalCode?.trim() || undefined;
1997
+ }
1870
1998
  // Creates containers to render hosted inputs with labels and error messages,
1871
1999
  // a card holder input with label and error, and a submit button.
1872
2000
  async getDefaultSkinCheckoutOptions() {
1873
2001
  const skinFactory = (await Promise.resolve().then(function () { return index; }))
1874
2002
  .default;
1875
- const skin = await skinFactory(this.checkoutConfig);
2003
+ const skin = await skinFactory(this.checkoutConfig, this.cardSessionFieldConfig);
1876
2004
  this.on(EVENTS.INPUT_ERROR, skin.onInputError);
1877
2005
  this.on(EVENTS.STATUS_CHANGE, skin.onStatusChange);
1878
2006
  this.on(EVENTS.ERROR, (error) => skin.onError(error));
@@ -1888,7 +2016,7 @@
1888
2016
  }
1889
2017
  async getCardDefaultSkinCheckoutOptions(node) {
1890
2018
  const CardSkin = (await Promise.resolve().then(function () { return index$1; })).default;
1891
- const skin = new CardSkin(node, this.checkoutConfig);
2019
+ const skin = new CardSkin(node, this.checkoutConfig, this.cardSessionFieldConfig);
1892
2020
  skin.init();
1893
2021
  this.on(EVENTS.INPUT_ERROR, skin.onInputError);
1894
2022
  this.on(EVENTS.METHOD_RENDER, skin.onMethodRender);
@@ -1905,7 +2033,7 @@
1905
2033
  async initMethod(method, element, callbacks) {
1906
2034
  this._ensureNotDestroyed();
1907
2035
  if (!this.isReady()) {
1908
- await this.createSession(method);
2036
+ await this.createSession();
1909
2037
  }
1910
2038
  if (callbacks.onRenderSuccess) {
1911
2039
  this.on(EVENTS.METHOD_RENDER, callbacks.onRenderSuccess);
@@ -1949,6 +2077,8 @@
1949
2077
  onSubmit: this.handleSubmit,
1950
2078
  onInputChange: this.handleInputChange,
1951
2079
  onCardInputValueChange: this.handleCardInputValueChange,
2080
+ isCardholderNameRequired: () => this.isCardholderNameRequired(),
2081
+ isPostalCodeRequired: () => this.isPostalCodeVisible(),
1952
2082
  onMethodRender: this.handleMethodRender,
1953
2083
  onMethodRenderError: this.handleMethodRenderError,
1954
2084
  };
@@ -2196,12 +2326,12 @@
2196
2326
 
2197
2327
  if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="/* Main container */\n.ff-skin-default {\n display: flex;\n flex-direction: column;\n text-align: left;\n gap: 8px;\n width: 100%;\n max-width: 400px;\n margin: 0 auto;\n color: #000000;\n}\n\n/* Payment method cards */\n.ff-payment-method-card {\n display: none;\n border: 1px solid #e0e0e0;\n border-radius: 8px;\n background-color: #ffffff;\n padding: 20px;\n transition: border-color 0.2s ease;\n height: auto;\n box-shadow: 0px 0px 10px 0px #eee;\n}\n\n.ff-payment-method-card.visible {\n display: block;\n}\n\n.payment-errors-container {\n background-color: #d1000033;\n color: #d10000;\n font-size: 14px;\n padding: 16px 12px;\n border-radius: 8px;\n}\n.payment-errors-container:empty {\n display: none;\n}\n\n/* Label wrapper */\n.ff-payment-method-label {\n display: flex;\n align-items: flex-start;\n gap: 16px;\n cursor: pointer;\n width: 100%;\n}\n\n.ff-google-pay-header {\n align-items: center;\n}\n\n/* Custom radio button styling */\n.ff-payment-method-radio {\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n width: 24px;\n height: 24px;\n min-width: 24px;\n min-height: 24px;\n border: 1px solid #9e9e9e;\n border-radius: 50%;\n background-color: #ffffff;\n cursor: pointer;\n position: relative;\n margin: 0;\n flex-shrink: 0;\n transition: border-color 0.2s ease;\n}\n\n.ff-card-form-submit-button {\n display: block;\n cursor: pointer;\n width: 100%;\n padding: 16px 0;\n border-radius: 16px;\n background-color: #000000;\n color: #ffffff;\n border: none;\n font-size: 16px;\n margin: 12px 0 16px;\n}\n\n.ff-payment-method-radio:checked {\n border-color: #e32f41;\n background-color: #ffffff;\n}\n\n.ff-payment-method-radio:checked::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background-color: #e32f41;\n}\n\n/* Payment method content */\n.ff-payment-method-content {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 16px;\n max-height: 0;\n height: 0;\n overflow: hidden;\n opacity: 0;\n transition:\n opacity 0.3s ease,\n margin-top 0.3s ease;\n margin-top: 0;\n}\n\n.ff-payment-method-card.expanded .ff-payment-method-content {\n max-height: 2000px;\n height: auto;\n opacity: 1;\n margin-top: 16px;\n}\n.ff-payment-method-card.expanded .ff-payment-method-label {\n margin-bottom: 16px;\n}\n\n/* Payment method header */\n.ff-payment-method-header {\n display: flex;\n align-items: center;\n}\n\n/* Google Pay Logo */\n.ff-google-pay-logo {\n display: flex;\n align-items: center;\n gap: 4px;\n font-weight: 500;\n font-size: 18px;\n}\n.ff-google-pay-logo img {\n height: 38px;\n}\n\n/* Payment features list */\n.ff-payment-features {\n list-style: none;\n padding: 0;\n margin: 0;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.ff-payment-feature {\n display: flex;\n align-items: baseline;\n text-align: left;\n gap: 8px;\n}\n\n.ff-checkmark-icon {\n width: 20px;\n height: 20px;\n min-width: 20px;\n color: #e32f41;\n flex-shrink: 0;\n margin-top: 2px;\n}\n\n.ff-payment-feature span {\n color: #333333;\n font-size: 14px;\n line-height: 1.5;\n}\n\n/* Google Pay button container */\n.ff-google-pay-button-container {\n display: flex;\n justify-content: center;\n}\n\n/* Security message */\n.ff-security-message {\n text-align: center;\n color: #999999;\n font-size: 14px;\n padding: 0;\n margin: 0\n}\n\n/* Card logos container */\n.ff-card-logos {\n display: flex;\n align-items: center;\n gap: 12px;\n flex-wrap: wrap;\n}\n\n/* Card form container */\n.ff-card-form-container {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.loader-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgba(255, 255, 255);\n z-index: 2;\n}\n\n.payment-button-loader {\n position: relative;\n height: 50px;\n}\n\n.loader {\n width: 24px;\n height: 24px;\n border: 4px solid #e32f41;\n border-top: 4px solid transparent;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/* Responsive adjustments */\n@media (max-width: 768px) {\n .ff-payment-method-card {\n padding: 16px;\n }\n\n .ff-payment-method-label {\n gap: 12px;\n }\n\n .ff-card-logos {\n gap: 8px;\n }\n}\n\n.ff-payment-container {\n position: relative;\n}\n\n.success {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 16px;\n}\n";
2198
2328
 
2199
- var template = "<div>\n <label class=\"ff-card-form-label\" for=\"cardNumberInput\">Card number</label>\n <div id=\"cardNumberInput\"></div>\n <div class=\"errorContainer\"></div>\n</div>\n<div class=\"card-form-row\">\n <div>\n <label class=\"ff-card-form-label\" for=\"expiryInput\">Expiration date</label>\n <div id=\"expiryInput\"></div>\n <div class=\"errorContainer\"></div>\n </div>\n <div>\n <label class=\"ff-card-form-label\" for=\"cvvInput\">Security code</label>\n <div id=\"cvvInput\">\n <svg width=\"200\" height=\"200\" viewBox=\"0 0 200 200\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"200\" fill=\"transparent\"/>\n <g clip-path=\"url(#clip0_0_1)\">\n <path d=\"M157.555 23C168.279 23.0002 177 31.7394 177 42.4854V80.5889C171.946 72.0151 164.749 64.8558 156.146 59.8457H166.394V42.4854C166.393 37.6004 162.43 33.6291 157.555 33.6289H27.4453C22.5704 33.6291 18.6066 37.6004 18.6064 42.4854V59.8457H97.8535C88.9153 65.0512 81.4954 72.5771 76.4189 81.5986H18.6064V127.515C18.6066 132.4 22.5704 136.371 27.4453 136.371H75.3281C77.2742 140.177 79.6285 143.739 82.333 147H27.4453C16.7215 147 8.00019 138.261 8 127.515V42.4854C8.0002 31.7394 16.7215 23.0002 27.4453 23H157.555Z\" fill=\"#93939A\"/>\n <mask id=\"path-2-outside-1_0_1\" maskUnits=\"userSpaceOnUse\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\" fill=\"black\">\n <rect fill=\"white\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\"/>\n </mask>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" fill=\"#93939A\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" stroke=\"transparent\" stroke-width=\"20\" mask=\"url(#path-2-outside-1_0_1)\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_0_1\">\n <rect width=\"200\" height=\"200\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n <div class=\"errorContainer\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"emailAddressInput\">Email</label>\n <input class=\"ff-card-form-text-input\" id=\"emailAddressInput\" placeholder=\"Email\" type=\"email\">\n <div class=\"errorContainer\"></div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"cardHolderInput\">Card holder</label>\n <input class=\"ff-card-form-text-input\" id=\"cardHolderInput\" placeholder=\"Card holder\">\n <div class=\"errorContainer\"></div>\n</div>\n";
2329
+ var template = "<div>\n <label class=\"ff-card-form-label\" for=\"cardNumberInput\">Card number</label>\n <div id=\"cardNumberInput\"></div>\n <div class=\"errorContainer\"></div>\n</div>\n<div class=\"card-form-row\">\n <div>\n <label class=\"ff-card-form-label\" for=\"expiryInput\">Expiration date</label>\n <div id=\"expiryInput\"></div>\n <div class=\"errorContainer\"></div>\n </div>\n <div>\n <label class=\"ff-card-form-label\" for=\"cvvInput\">Security code</label>\n <div id=\"cvvInput\">\n <svg width=\"200\" height=\"200\" viewBox=\"0 0 200 200\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"200\" fill=\"transparent\"/>\n <g clip-path=\"url(#clip0_0_1)\">\n <path d=\"M157.555 23C168.279 23.0002 177 31.7394 177 42.4854V80.5889C171.946 72.0151 164.749 64.8558 156.146 59.8457H166.394V42.4854C166.393 37.6004 162.43 33.6291 157.555 33.6289H27.4453C22.5704 33.6291 18.6066 37.6004 18.6064 42.4854V59.8457H97.8535C88.9153 65.0512 81.4954 72.5771 76.4189 81.5986H18.6064V127.515C18.6066 132.4 22.5704 136.371 27.4453 136.371H75.3281C77.2742 140.177 79.6285 143.739 82.333 147H27.4453C16.7215 147 8.00019 138.261 8 127.515V42.4854C8.0002 31.7394 16.7215 23.0002 27.4453 23H157.555Z\" fill=\"#93939A\"/>\n <mask id=\"path-2-outside-1_0_1\" maskUnits=\"userSpaceOnUse\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\" fill=\"black\">\n <rect fill=\"white\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\"/>\n </mask>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" fill=\"#93939A\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" stroke=\"transparent\" stroke-width=\"20\" mask=\"url(#path-2-outside-1_0_1)\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_0_1\">\n <rect width=\"200\" height=\"200\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n <div class=\"errorContainer\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"cardHolderInput\">Cardholder name</label>\n <input class=\"ff-card-form-text-input\" id=\"cardHolderInput\" type=\"text\" pattern=\"[A-Za-z\\s]+\" placeholder=\"Full name on card\">\n <div class=\"errorContainer\"></div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"emailAddressInput\">Email</label>\n <input class=\"ff-card-form-text-input\" id=\"emailAddressInput\" placeholder=\"Email\" type=\"email\">\n <div class=\"errorContainer\"></div>\n</div>\n<div id=\"countrySelectorField\">\n <label class=\"ff-card-form-label\" for=\"countrySelectorInput\">Country</label>\n <div class=\"ff-select-wrap\">\n <select class=\"ff-card-form-text-input ff-card-form-select\" id=\"countrySelectorInput\"></select>\n <div class=\"ff-select-arrow\" aria-hidden=\"true\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"postalCodeInput\">Zip code</label>\n <input class=\"ff-card-form-text-input\" id=\"postalCodeInput\" placeholder=\"12345\">\n <div class=\"errorContainer\"></div>\n</div>\n";
2200
2330
 
2201
- if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n \n .errorContainer:not(:empty) {\n color: #d10000;\n font-size: 16px;\n line-height: 1;\n margin: 0 0 10px;\n }\n\n #cvvInput {\n position: relative;\n }\n \n #cvvInput > svg {\n z-index: 1;\n position: absolute;\n top: 5px;\n right: 5px;\n width: 26px;\n height: 26px;\n }";
2331
+ if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #d10000;\n font-size: 16px;\n line-height: 1;\n margin: 0 0 10px;\n }\n\n #cvvInput {\n position: relative;\n }\n \n #cvvInput > svg {\n z-index: 1;\n position: absolute;\n top: 5px;\n right: 5px;\n width: 26px;\n height: 26px;\n }";
2202
2332
 
2203
2333
  class CardSkin {
2204
- constructor(containerEl, checkoutConfig) {
2334
+ constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {
2205
2335
  this.onInputError = (event) => {
2206
2336
  const { name, error } = event;
2207
2337
  const cardInputElements = this.getCardInputElements();
@@ -2211,15 +2341,20 @@
2211
2341
  cvv: cardInputElements.cvv.parentElement,
2212
2342
  cardholderName: cardInputElements.cardholderName?.parentElement,
2213
2343
  emailAddress: cardInputElements.emailAddress?.parentElement,
2344
+ postalCode: cardInputElements.postalCode?.parentElement,
2214
2345
  };
2215
2346
  const errorContainer = elementsMap[name]?.querySelector('.errorContainer');
2216
2347
  if (errorContainer) {
2217
2348
  errorContainer.textContent = error || '';
2218
2349
  }
2219
- if (name === 'cardholderName' || name === 'emailAddress') {
2350
+ if (name === 'cardholderName' ||
2351
+ name === 'emailAddress' ||
2352
+ name === 'postalCode') {
2220
2353
  const field = name === 'cardholderName'
2221
2354
  ? cardInputElements.cardholderName
2222
- : cardInputElements.emailAddress;
2355
+ : name === 'emailAddress'
2356
+ ? cardInputElements.emailAddress
2357
+ : cardInputElements.postalCode;
2223
2358
  if (error) {
2224
2359
  field?.classList?.add('error');
2225
2360
  }
@@ -2241,21 +2376,92 @@
2241
2376
  }
2242
2377
  this.containerEl = containerEl;
2243
2378
  this.checkoutConfig = checkoutConfig;
2379
+ this.cardSessionFieldConfig = cardSessionFieldConfig;
2244
2380
  this.containerEl.style.display = 'none';
2245
2381
  }
2382
+ normalizeCountryCode(countryCode) {
2383
+ const normalized = countryCode?.trim().toUpperCase();
2384
+ return normalized || undefined;
2385
+ }
2386
+ getSelectedCountryCode() {
2387
+ const selector = this.containerEl.querySelector('#countrySelectorInput');
2388
+ return (this.normalizeCountryCode(selector?.value) ||
2389
+ this.normalizeCountryCode(this.cardSessionFieldConfig?.detectedCountryCode));
2390
+ }
2391
+ getCountryFieldOverride(countryCode = this.getSelectedCountryCode()) {
2392
+ if (!countryCode) {
2393
+ return undefined;
2394
+ }
2395
+ return this.cardSessionFieldConfig?.countryFieldOverrides?.[countryCode];
2396
+ }
2397
+ isCountrySelectorVisible() {
2398
+ return !!this.cardSessionFieldConfig?.showCountrySelector;
2399
+ }
2400
+ isCardholderNameVisible() {
2401
+ return !!this.checkoutConfig.card?.cardholderName?.required;
2402
+ }
2403
+ isPostalCodeVisible(countryCode = this.getSelectedCountryCode()) {
2404
+ const defaultVisible = !!this.cardSessionFieldConfig?.showPostalCode;
2405
+ const overrideValue = this.getCountryFieldOverride(countryCode)?.show_postal_code;
2406
+ if (overrideValue === null || overrideValue === undefined) {
2407
+ return defaultVisible;
2408
+ }
2409
+ return overrideValue;
2410
+ }
2411
+ setFieldVisibility(inputId, isVisible) {
2412
+ const field = this.containerEl.querySelector(`#${inputId}`);
2413
+ if (field?.parentElement) {
2414
+ field.parentElement.style.display = isVisible ? '' : 'none';
2415
+ }
2416
+ }
2417
+ setContainerVisibility(containerId, isVisible) {
2418
+ const container = this.containerEl.querySelector(`#${containerId}`);
2419
+ if (container) {
2420
+ container.style.display = isVisible ? '' : 'none';
2421
+ }
2422
+ }
2423
+ populateCountrySelector(selectEl) {
2424
+ const validCountries = this.cardSessionFieldConfig?.validCountries || [];
2425
+ const selectedCountryCode = this.getSelectedCountryCode();
2426
+ selectEl.innerHTML = '';
2427
+ selectEl.disabled = false;
2428
+ if (!validCountries.length) {
2429
+ const fallbackOption = document.createElement('option');
2430
+ fallbackOption.value = selectedCountryCode || '';
2431
+ fallbackOption.textContent = selectedCountryCode
2432
+ ? `Detected country: ${selectedCountryCode}`
2433
+ : 'Country unavailable';
2434
+ selectEl.appendChild(fallbackOption);
2435
+ selectEl.disabled = true;
2436
+ return;
2437
+ }
2438
+ const placeholderOption = document.createElement('option');
2439
+ placeholderOption.value = '';
2440
+ placeholderOption.textContent = 'Select country';
2441
+ selectEl.appendChild(placeholderOption);
2442
+ validCountries.forEach(country => {
2443
+ const option = document.createElement('option');
2444
+ option.value = country.code;
2445
+ option.textContent = country.name;
2446
+ selectEl.appendChild(option);
2447
+ });
2448
+ if (selectedCountryCode) {
2449
+ selectEl.value = selectedCountryCode;
2450
+ }
2451
+ }
2452
+ updateDynamicFieldVisibility(countryCode = this.getSelectedCountryCode()) {
2453
+ this.setFieldVisibility('cardHolderInput', this.isCardholderNameVisible());
2454
+ this.setFieldVisibility('postalCodeInput', this.isPostalCodeVisible(countryCode));
2455
+ const postalCodeInput = this.containerEl.querySelector('#postalCodeInput');
2456
+ if (!this.isPostalCodeVisible(countryCode) && postalCodeInput) {
2457
+ postalCodeInput.value = '';
2458
+ }
2459
+ }
2246
2460
  wireCardInputs() {
2247
2461
  const cardNumber = this.containerEl.querySelector('#cardNumberInput');
2248
2462
  const expiryDate = this.containerEl.querySelector('#expiryInput');
2249
2463
  const cvv = this.containerEl.querySelector('#cvvInput');
2250
- const hasCardholderInput = !!this.checkoutConfig?.card?.cardholderName?.required;
2251
- let cardholderName = undefined;
2252
- if (hasCardholderInput) {
2253
- cardholderName =
2254
- this.containerEl.querySelector('#cardHolderInput');
2255
- }
2256
- else {
2257
- this.containerEl.querySelector('#cardHolderInput').parentElement.style.display = 'none';
2258
- }
2464
+ const cardholderName = this.containerEl.querySelector('#cardHolderInput');
2259
2465
  const hasEmailInput = !!this.checkoutConfig?.card?.emailAddress?.visible;
2260
2466
  let emailAddress = undefined;
2261
2467
  if (hasEmailInput) {
@@ -2268,11 +2474,23 @@
2268
2474
  else {
2269
2475
  this.containerEl.querySelector('#emailAddressInput').parentElement.style.display = 'none';
2270
2476
  }
2477
+ const countrySelector = this.containerEl.querySelector('#countrySelectorInput');
2478
+ const postalCode = this.containerEl.querySelector('#postalCodeInput');
2479
+ if (countrySelector) {
2480
+ this.populateCountrySelector(countrySelector);
2481
+ countrySelector.addEventListener('change', () => {
2482
+ this.updateDynamicFieldVisibility(this.normalizeCountryCode(countrySelector.value));
2483
+ });
2484
+ }
2485
+ this.setContainerVisibility('countrySelectorField', this.isCountrySelectorVisible());
2486
+ this.updateDynamicFieldVisibility();
2271
2487
  if (!cardNumber ||
2272
2488
  !expiryDate ||
2273
2489
  !cvv ||
2274
- (hasCardholderInput && !cardholderName) ||
2275
- (hasEmailInput && !emailAddress)) {
2490
+ !cardholderName ||
2491
+ (hasEmailInput && !emailAddress) ||
2492
+ !countrySelector ||
2493
+ !postalCode) {
2276
2494
  throw new Error('One or more card input elements are missing in the default skin');
2277
2495
  }
2278
2496
  this.cardInputElements = {
@@ -2281,6 +2499,8 @@
2281
2499
  cvv,
2282
2500
  cardholderName,
2283
2501
  emailAddress,
2502
+ countrySelector,
2503
+ postalCode,
2284
2504
  };
2285
2505
  }
2286
2506
  async init() {
@@ -2296,11 +2516,6 @@
2296
2516
  getCheckoutOptions() {
2297
2517
  return {
2298
2518
  cardElements: this.getCardInputElements(),
2299
- card: {
2300
- cardholderName: {
2301
- required: !!this.checkoutConfig?.card?.cardholderName?.required,
2302
- },
2303
- },
2304
2519
  };
2305
2520
  }
2306
2521
  }
@@ -2317,7 +2532,7 @@
2317
2532
  [exports.PaymentMethod.APPLE_PAY]: applePayTemplate,
2318
2533
  };
2319
2534
  class DefaultSkin {
2320
- constructor(checkoutConfig) {
2535
+ constructor(checkoutConfig, cardSessionFieldConfig) {
2321
2536
  this.onLoaderChange = (isLoading) => {
2322
2537
  document
2323
2538
  .querySelectorAll(`${this.containerSelector} .loader-container`)
@@ -2406,6 +2621,7 @@
2406
2621
  }
2407
2622
  this.containerEl = containerEl;
2408
2623
  this.checkoutConfig = checkoutConfig;
2624
+ this.cardSessionFieldConfig = cardSessionFieldConfig;
2409
2625
  }
2410
2626
  initAccordion() {
2411
2627
  const paymentMethodCards = this.containerEl.querySelectorAll('.ff-payment-method-card');
@@ -2454,7 +2670,7 @@
2454
2670
  this.paymentMethodOrder.forEach(paymentMethod => {
2455
2671
  paymentMethodContainers.insertAdjacentHTML('beforeend', paymentMethodTemplates[paymentMethod]);
2456
2672
  });
2457
- this.cardInstance = new CardSkin(document.querySelector('#cardForm'), this.checkoutConfig);
2673
+ this.cardInstance = new CardSkin(document.querySelector('#cardForm'), this.checkoutConfig, this.cardSessionFieldConfig);
2458
2674
  this.cardInstance.init();
2459
2675
  this.wireCardInputs();
2460
2676
  }
@@ -2485,8 +2701,8 @@
2485
2701
  };
2486
2702
  }
2487
2703
  }
2488
- const createDefaultSkin = async (checkoutConfig) => {
2489
- const skin = new DefaultSkin(checkoutConfig);
2704
+ const createDefaultSkin = async (checkoutConfig, cardSessionFieldConfig) => {
2705
+ const skin = new DefaultSkin(checkoutConfig, cardSessionFieldConfig);
2490
2706
  await skin['init']();
2491
2707
  return skin;
2492
2708
  };