@funnelfox/billing 0.6.5-beta.3 → 0.6.6

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.
@@ -422,7 +422,7 @@ exports.PaymentMethod = void 0;
422
422
  /**
423
423
  * @fileoverview Constants for Funnefox SDK
424
424
  */
425
- const SDK_VERSION = '0.6.5-beta.3';
425
+ const SDK_VERSION = '0.6.6';
426
426
  const DEFAULTS = {
427
427
  BASE_URL: 'https://billing.funnelfox.com',
428
428
  REGION: 'default',
@@ -673,8 +673,6 @@ class PrimerWrapper {
673
673
  onMethodRenderError: options.onMethodRenderError,
674
674
  onMethodRender: options.onMethodRender,
675
675
  onCardInputValueChange: options.onCardInputValueChange,
676
- isCardholderNameRequired: options.isCardholderNameRequired,
677
- isPostalCodeRequired: options.isPostalCodeRequired,
678
676
  });
679
677
  this.paymentMethodsInterfaces.push(cardInterface);
680
678
  return cardInterface;
@@ -693,7 +691,7 @@ class PrimerWrapper {
693
691
  throw new PrimerError('Failed to initialize Primer checkout', error);
694
692
  }
695
693
  }
696
- async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onCardInputValueChange, isCardholderNameRequired, isPostalCodeRequired, onMethodRenderError, onMethodRender, }) {
694
+ async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onCardInputValueChange, onMethodRenderError, onMethodRender, }) {
697
695
  try {
698
696
  if (!this.currentHeadless) {
699
697
  throw new PrimerError('Headless checkout not found');
@@ -708,21 +706,14 @@ class PrimerWrapper {
708
706
  if (!pmManager)
709
707
  return false;
710
708
  const { valid, validationErrors } = await pmManager.validate();
711
- const cardHolderError = isCardholderNameRequired?.()
712
- ? validationErrors.find(v => v.name === 'cardholderName')?.message
713
- : null;
714
- dispatchError('cardholderName', cardHolderError);
709
+ const cardHolderError = validationErrors.find(v => v.name === 'cardholderName');
710
+ dispatchError('cardholderName', cardHolderError?.message || null);
715
711
  const emailAddress = elements.emailAddress?.value?.trim();
716
712
  const emailError = emailAddress && !isValidEmail(emailAddress)
717
713
  ? 'Please enter a valid email address'
718
714
  : null;
719
715
  dispatchError('emailAddress', emailError);
720
- const postalCode = elements.postalCode?.value?.trim();
721
- const postalCodeError = isPostalCodeRequired?.() && !postalCode
722
- ? 'Please enter a postal code'
723
- : null;
724
- dispatchError('postalCode', postalCodeError);
725
- return valid && !emailError && !cardHolderError && !postalCodeError;
716
+ return valid && !emailError;
726
717
  };
727
718
  const dispatchError = (inputName, error) => {
728
719
  onInputChange(inputName, error);
@@ -745,24 +736,18 @@ class PrimerWrapper {
745
736
  ? 'Please enter a valid email address'
746
737
  : null);
747
738
  };
748
- const countrySelectorOnChange = (e) => {
749
- const countryCode = e.target.value.trim();
750
- onCardInputValueChange?.('countryCode', countryCode);
751
- };
752
- const postalCodeOnChange = (e) => {
753
- const postalCode = e.target.value.trim();
754
- onCardInputValueChange?.('postalCode', postalCode);
755
- dispatchError('postalCode', null);
756
- };
757
739
  elements.cardholderName?.addEventListener('input', cardHolderOnChange);
758
740
  elements.emailAddress?.addEventListener('input', emailAddressOnChange);
759
- elements.countrySelector?.addEventListener('change', countrySelectorOnChange);
760
- elements.postalCode?.addEventListener('input', postalCodeOnChange);
761
741
  cardNumberInput.addEventListener('change', onHostedInputChange('cardNumber'));
762
742
  expiryInput.addEventListener('change', onHostedInputChange('expiryDate'));
763
743
  cvvInput.addEventListener('change', onHostedInputChange('cvv'));
764
744
  const onSubmitHandler = async () => {
765
- if (!(await validateForm())) {
745
+ const isEmailValid = isValidEmail(elements.emailAddress?.value?.trim() || '');
746
+ const isFormValid = await validateForm();
747
+ if (!isEmailValid) {
748
+ dispatchError('emailAddress', 'Please enter a valid email address');
749
+ }
750
+ if (!isFormValid || !isEmailValid) {
766
751
  return;
767
752
  }
768
753
  try {
@@ -799,8 +784,6 @@ class PrimerWrapper {
799
784
  pmManager.removeHostedInputs();
800
785
  elements.cardholderName?.removeEventListener('input', cardHolderOnChange);
801
786
  elements.emailAddress?.removeEventListener('input', emailAddressOnChange);
802
- elements.countrySelector?.removeEventListener('change', countrySelectorOnChange);
803
- elements.postalCode?.removeEventListener('input', postalCodeOnChange);
804
787
  elements.button?.removeEventListener('click', onSubmitHandler);
805
788
  };
806
789
  this.destroyCallbacks.push(onDestroy);
@@ -819,12 +802,6 @@ class PrimerWrapper {
819
802
  if (elements.emailAddress) {
820
803
  elements.emailAddress.disabled = disabled;
821
804
  }
822
- if (elements.countrySelector) {
823
- elements.countrySelector.disabled = disabled;
824
- }
825
- if (elements.postalCode) {
826
- elements.postalCode.disabled = disabled;
827
- }
828
805
  },
829
806
  submit: () => onSubmitHandler(),
830
807
  destroy: () => {
@@ -847,7 +824,7 @@ class PrimerWrapper {
847
824
  });
848
825
  }
849
826
  async renderCheckout(clientToken, checkoutOptions, checkoutRenderOptions) {
850
- const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, onCardInputValueChange, isCardholderNameRequired, isPostalCodeRequired, } = checkoutRenderOptions;
827
+ const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, onCardInputValueChange, } = checkoutRenderOptions;
851
828
  await this.initializeHeadlessCheckout(clientToken, checkoutOptions);
852
829
  onMethodsAvailable?.(this.availableMethods);
853
830
  await Promise.all(this.availableMethods.map(method => {
@@ -860,8 +837,6 @@ class PrimerWrapper {
860
837
  onMethodRender,
861
838
  onMethodRenderError,
862
839
  onCardInputValueChange,
863
- isCardholderNameRequired,
864
- isPostalCodeRequired,
865
840
  });
866
841
  }
867
842
  else {
@@ -1076,12 +1051,6 @@ class APIClient {
1076
1051
  if (params.email !== undefined) {
1077
1052
  payload.email_address = params.email;
1078
1053
  }
1079
- if (params.countryCode !== undefined) {
1080
- payload.country_code = params.countryCode;
1081
- }
1082
- if (params.postalCode !== undefined) {
1083
- payload.postal_code = params.postalCode;
1084
- }
1085
1054
  return (await this.request(API_ENDPOINTS.CREATE_PAYMENT, {
1086
1055
  method: 'POST',
1087
1056
  body: JSON.stringify(payload),
@@ -1394,24 +1363,23 @@ class CheckoutInstance extends EventEmitter {
1394
1363
  super();
1395
1364
  this.counter = 0;
1396
1365
  this.radarSessionId = null;
1397
- this.cardSessionFieldConfig = {};
1398
1366
  this.handleInputChange = (inputName, error) => {
1399
1367
  this.emit(EVENTS.INPUT_ERROR, { name: inputName, error });
1400
1368
  };
1369
+ this.getPaymentEmailAddress = () => {
1370
+ const email = this.cardEmailAddress?.trim() || this.checkoutConfig.customer.email;
1371
+ if (!email || !isValidEmail(email)) {
1372
+ return undefined;
1373
+ }
1374
+ const template = this.checkoutConfig.card?.emailAddress?.template;
1375
+ if (template?.includes('{{email}}')) {
1376
+ return template.replace(/\{\{email\}\}/g, email);
1377
+ }
1378
+ return email;
1379
+ };
1401
1380
  this.handleCardInputValueChange = (inputName, value) => {
1402
1381
  if (inputName === 'emailAddress') {
1403
1382
  this.cardEmailAddress = value?.trim() || undefined;
1404
- return;
1405
- }
1406
- if (inputName === 'countryCode') {
1407
- this.cardCountryCode = this.normalizeCountryCode(value);
1408
- if (!this.isPostalCodeVisible()) {
1409
- this.cardPostalCode = undefined;
1410
- }
1411
- return;
1412
- }
1413
- if (inputName === 'postalCode') {
1414
- this.cardPostalCode = value?.trim() || undefined;
1415
1383
  }
1416
1384
  };
1417
1385
  this.handleMethodRender = (method) => {
@@ -1437,8 +1405,6 @@ class CheckoutInstance extends EventEmitter {
1437
1405
  orderId: this.orderId,
1438
1406
  paymentMethodToken: paymentMethodTokenData.token,
1439
1407
  email: this.getPaymentEmailAddress(),
1440
- countryCode: this.getPaymentCountryCode(),
1441
- postalCode: this.getPaymentPostalCode(),
1442
1408
  clientMetadata: {
1443
1409
  radarSessionId,
1444
1410
  },
@@ -1511,8 +1477,6 @@ class CheckoutInstance extends EventEmitter {
1511
1477
  this.primerWrapper = new PrimerWrapper();
1512
1478
  this.isDestroyed = false;
1513
1479
  this.cardEmailAddress = this.checkoutConfig.customer.email;
1514
- this.shouldApplySessionCardholderNameConfig =
1515
- this.checkoutConfig.card?.cardholderName?.required === undefined;
1516
1480
  this._setupCallbackBridges();
1517
1481
  }
1518
1482
  _setupCallbackBridges() {
@@ -1605,9 +1569,7 @@ class CheckoutInstance extends EventEmitter {
1605
1569
  this.clientToken = sessionData.clientToken;
1606
1570
  }
1607
1571
  applySessionCardFieldConfig(response) {
1608
- const cardConfig = {
1609
- ...(this.checkoutConfig.card || {}),
1610
- };
1572
+ const cardConfig = this.checkoutConfig.card || {};
1611
1573
  if (cardConfig.emailAddress?.visible === undefined &&
1612
1574
  response.data?.show_email_field !== undefined) {
1613
1575
  cardConfig.emailAddress = {
@@ -1615,57 +1577,24 @@ class CheckoutInstance extends EventEmitter {
1615
1577
  visible: response.data.show_email_field,
1616
1578
  };
1617
1579
  }
1618
- if (this.shouldApplySessionCardholderNameConfig &&
1580
+ if (cardConfig.cardholderName?.required === undefined &&
1619
1581
  response.data?.show_cardholder_name_field !== undefined) {
1620
1582
  cardConfig.cardholderName = {
1621
1583
  ...cardConfig.cardholderName,
1622
1584
  required: response.data.show_cardholder_name_field,
1623
1585
  };
1624
1586
  }
1625
- const countryFieldOverrides = this.normalizeCountryFieldOverrides(response.data?.country_field_overrides);
1626
- const detectedCountryCode = this.normalizeCountryCode(response.data?.detected_country_code) ||
1627
- this.cardCountryCode;
1628
- this.cardSessionFieldConfig = {
1629
- ...this.cardSessionFieldConfig,
1630
- showCountrySelector: response.data?.show_country_selector_field ??
1631
- this.cardSessionFieldConfig.showCountrySelector,
1632
- showPostalCode: response.data?.show_postal_code_field ??
1633
- this.cardSessionFieldConfig.showPostalCode,
1634
- detectedCountryCode: detectedCountryCode || this.cardSessionFieldConfig.detectedCountryCode,
1635
- validCountries: response.data?.valid_countries ||
1636
- this.cardSessionFieldConfig.validCountries,
1637
- countryFieldOverrides: countryFieldOverrides ||
1638
- this.cardSessionFieldConfig.countryFieldOverrides,
1639
- };
1640
1587
  if (Object.keys(cardConfig).length > 0) {
1641
1588
  this.checkoutConfig.card = cardConfig;
1642
1589
  }
1643
- this.cardCountryCode =
1644
- this.cardSessionFieldConfig.detectedCountryCode || this.cardCountryCode;
1645
- if (!this.isPostalCodeVisible()) {
1646
- this.cardPostalCode = undefined;
1647
- }
1648
1590
  }
1649
1591
  getPrimerCardConfig() {
1650
- const cardConfig = {
1651
- ...(this.checkoutConfig.card || {}),
1652
- };
1592
+ const cardConfig = { ...(this.checkoutConfig.card || {}) };
1653
1593
  delete cardConfig.emailAddress;
1654
1594
  return Object.keys(cardConfig).length
1655
1595
  ? cardConfig
1656
1596
  : undefined;
1657
1597
  }
1658
- getPaymentEmailAddress() {
1659
- const email = this.cardEmailAddress?.trim() || this.checkoutConfig.customer.email;
1660
- if (!email || !isValidEmail(email)) {
1661
- return undefined;
1662
- }
1663
- const template = this.checkoutConfig.card?.emailAddress?.template;
1664
- if (template?.includes('{{email}}')) {
1665
- return template.replace(/\{\{email\}\}/g, email);
1666
- }
1667
- return email;
1668
- }
1669
1598
  mergeApplePayCollectingEmailOptions(checkoutOptions) {
1670
1599
  if (!this.isCollectingApplePayEmail) {
1671
1600
  return checkoutOptions;
@@ -1770,8 +1699,6 @@ class CheckoutInstance extends EventEmitter {
1770
1699
  onSubmit: this.handleSubmit,
1771
1700
  onInputChange: this.handleInputChange,
1772
1701
  onCardInputValueChange: this.handleCardInputValueChange,
1773
- isCardholderNameRequired: () => this.isCardholderNameRequired(),
1774
- isPostalCodeRequired: () => this.isPostalCodeVisible(),
1775
1702
  onMethodRender: this.handleMethodRender,
1776
1703
  onMethodsAvailable: this.handleMethodsAvailable,
1777
1704
  onMethodRenderError: this.handleMethodRenderError,
@@ -1930,58 +1857,12 @@ class CheckoutInstance extends EventEmitter {
1930
1857
  isProcessing() {
1931
1858
  return ['processing', 'action_required'].includes(this.state);
1932
1859
  }
1933
- normalizeCountryCode(countryCode) {
1934
- const normalized = countryCode?.trim().toUpperCase();
1935
- return normalized || undefined;
1936
- }
1937
- normalizeCountryFieldOverrides(overrides) {
1938
- if (!overrides) {
1939
- return undefined;
1940
- }
1941
- return Object.entries(overrides).reduce((result, [countryCode, override]) => {
1942
- const normalizedCountryCode = this.normalizeCountryCode(countryCode);
1943
- if (normalizedCountryCode && override) {
1944
- result[normalizedCountryCode] = override;
1945
- }
1946
- return result;
1947
- }, {});
1948
- }
1949
- getSelectedCountryCode() {
1950
- return (this.normalizeCountryCode(this.cardCountryCode) ||
1951
- this.normalizeCountryCode(this.cardSessionFieldConfig.detectedCountryCode));
1952
- }
1953
- getCountryFieldOverride(countryCode = this.getSelectedCountryCode()) {
1954
- if (!countryCode) {
1955
- return undefined;
1956
- }
1957
- return this.cardSessionFieldConfig.countryFieldOverrides?.[countryCode];
1958
- }
1959
- isCardholderNameRequired() {
1960
- return !!this.checkoutConfig.card?.cardholderName?.required;
1961
- }
1962
- isPostalCodeVisible(countryCode = this.getSelectedCountryCode()) {
1963
- const defaultValue = !!this.cardSessionFieldConfig.showPostalCode;
1964
- const overrideValue = this.getCountryFieldOverride(countryCode)?.show_postal_code;
1965
- if (overrideValue === null || overrideValue === undefined) {
1966
- return defaultValue;
1967
- }
1968
- return overrideValue;
1969
- }
1970
- getPaymentCountryCode() {
1971
- return this.getSelectedCountryCode();
1972
- }
1973
- getPaymentPostalCode() {
1974
- if (!this.isPostalCodeVisible()) {
1975
- return undefined;
1976
- }
1977
- return this.cardPostalCode?.trim() || undefined;
1978
- }
1979
1860
  // Creates containers to render hosted inputs with labels and error messages,
1980
1861
  // a card holder input with label and error, and a submit button.
1981
1862
  async getDefaultSkinCheckoutOptions() {
1982
1863
  const skinFactory = (await Promise.resolve().then(function () { return require('./chunk-index.cjs2.js'); }))
1983
1864
  .default;
1984
- const skin = await skinFactory(this.checkoutConfig, this.cardSessionFieldConfig);
1865
+ const skin = await skinFactory(this.checkoutConfig);
1985
1866
  this.on(EVENTS.INPUT_ERROR, skin.onInputError);
1986
1867
  this.on(EVENTS.STATUS_CHANGE, skin.onStatusChange);
1987
1868
  this.on(EVENTS.ERROR, (error) => skin.onError(error));
@@ -1997,7 +1878,7 @@ class CheckoutInstance extends EventEmitter {
1997
1878
  }
1998
1879
  async getCardDefaultSkinCheckoutOptions(node) {
1999
1880
  const CardSkin = (await Promise.resolve().then(function () { return require('./chunk-index.cjs3.js'); })).default;
2000
- const skin = new CardSkin(node, this.checkoutConfig, this.cardSessionFieldConfig);
1881
+ const skin = new CardSkin(node, this.checkoutConfig);
2001
1882
  skin.init();
2002
1883
  this.on(EVENTS.INPUT_ERROR, skin.onInputError);
2003
1884
  this.on(EVENTS.METHOD_RENDER, skin.onMethodRender);
@@ -2058,8 +1939,6 @@ class CheckoutInstance extends EventEmitter {
2058
1939
  onSubmit: this.handleSubmit,
2059
1940
  onInputChange: this.handleInputChange,
2060
1941
  onCardInputValueChange: this.handleCardInputValueChange,
2061
- isCardholderNameRequired: () => this.isCardholderNameRequired(),
2062
- isPostalCodeRequired: () => this.isPostalCodeVisible(),
2063
1942
  onMethodRender: this.handleMethodRender,
2064
1943
  onMethodRenderError: this.handleMethodRenderError,
2065
1944
  };
@@ -29,7 +29,7 @@ const paymentMethodTemplates = {
29
29
  [index.PaymentMethod.APPLE_PAY]: applePayTemplate,
30
30
  };
31
31
  class DefaultSkin {
32
- constructor(checkoutConfig, cardSessionFieldConfig) {
32
+ constructor(checkoutConfig) {
33
33
  this.onLoaderChange = (isLoading) => {
34
34
  document
35
35
  .querySelectorAll(`${this.containerSelector} .loader-container`)
@@ -118,7 +118,6 @@ class DefaultSkin {
118
118
  }
119
119
  this.containerEl = containerEl;
120
120
  this.checkoutConfig = checkoutConfig;
121
- this.cardSessionFieldConfig = cardSessionFieldConfig;
122
121
  }
123
122
  initAccordion() {
124
123
  const paymentMethodCards = this.containerEl.querySelectorAll('.ff-payment-method-card');
@@ -167,7 +166,7 @@ class DefaultSkin {
167
166
  this.paymentMethodOrder.forEach(paymentMethod => {
168
167
  paymentMethodContainers.insertAdjacentHTML('beforeend', paymentMethodTemplates[paymentMethod]);
169
168
  });
170
- this.cardInstance = new index$1.default(document.querySelector('#cardForm'), this.checkoutConfig, this.cardSessionFieldConfig);
169
+ this.cardInstance = new index$1.default(document.querySelector('#cardForm'), this.checkoutConfig);
171
170
  this.cardInstance.init();
172
171
  this.wireCardInputs();
173
172
  }
@@ -198,8 +197,8 @@ class DefaultSkin {
198
197
  };
199
198
  }
200
199
  }
201
- const createDefaultSkin = async (checkoutConfig, cardSessionFieldConfig) => {
202
- const skin = new DefaultSkin(checkoutConfig, cardSessionFieldConfig);
200
+ const createDefaultSkin = async (checkoutConfig) => {
201
+ const skin = new DefaultSkin(checkoutConfig);
203
202
  await skin['init']();
204
203
  return skin;
205
204
  };
@@ -7,12 +7,12 @@
7
7
  */
8
8
  'use strict';
9
9
 
10
- 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>\n";
10
+ 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";
11
11
 
12
- 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 }";
12
+ 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 }";
13
13
 
14
14
  class CardSkin {
15
- constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {
15
+ constructor(containerEl, checkoutConfig) {
16
16
  this.onInputError = (event) => {
17
17
  const { name, error } = event;
18
18
  const cardInputElements = this.getCardInputElements();
@@ -22,20 +22,15 @@ class CardSkin {
22
22
  cvv: cardInputElements.cvv.parentElement,
23
23
  cardholderName: cardInputElements.cardholderName?.parentElement,
24
24
  emailAddress: cardInputElements.emailAddress?.parentElement,
25
- postalCode: cardInputElements.postalCode?.parentElement,
26
25
  };
27
26
  const errorContainer = elementsMap[name]?.querySelector('.errorContainer');
28
27
  if (errorContainer) {
29
28
  errorContainer.textContent = error || '';
30
29
  }
31
- if (name === 'cardholderName' ||
32
- name === 'emailAddress' ||
33
- name === 'postalCode') {
30
+ if (name === 'cardholderName' || name === 'emailAddress') {
34
31
  const field = name === 'cardholderName'
35
32
  ? cardInputElements.cardholderName
36
- : name === 'emailAddress'
37
- ? cardInputElements.emailAddress
38
- : cardInputElements.postalCode;
33
+ : cardInputElements.emailAddress;
39
34
  if (error) {
40
35
  field?.classList?.add('error');
41
36
  }
@@ -57,92 +52,21 @@ class CardSkin {
57
52
  }
58
53
  this.containerEl = containerEl;
59
54
  this.checkoutConfig = checkoutConfig;
60
- this.cardSessionFieldConfig = cardSessionFieldConfig;
61
55
  this.containerEl.style.display = 'none';
62
56
  }
63
- normalizeCountryCode(countryCode) {
64
- const normalized = countryCode?.trim().toUpperCase();
65
- return normalized || undefined;
66
- }
67
- getSelectedCountryCode() {
68
- const selector = this.containerEl.querySelector('#countrySelectorInput');
69
- return (this.normalizeCountryCode(selector?.value) ||
70
- this.normalizeCountryCode(this.cardSessionFieldConfig?.detectedCountryCode));
71
- }
72
- getCountryFieldOverride(countryCode = this.getSelectedCountryCode()) {
73
- if (!countryCode) {
74
- return undefined;
75
- }
76
- return this.cardSessionFieldConfig?.countryFieldOverrides?.[countryCode];
77
- }
78
- isCountrySelectorVisible() {
79
- return !!this.cardSessionFieldConfig?.showCountrySelector;
80
- }
81
- isCardholderNameVisible() {
82
- return !!this.checkoutConfig.card?.cardholderName?.required;
83
- }
84
- isPostalCodeVisible(countryCode = this.getSelectedCountryCode()) {
85
- const defaultVisible = !!this.cardSessionFieldConfig?.showPostalCode;
86
- const overrideValue = this.getCountryFieldOverride(countryCode)?.show_postal_code;
87
- if (overrideValue === null || overrideValue === undefined) {
88
- return defaultVisible;
89
- }
90
- return overrideValue;
91
- }
92
- setFieldVisibility(inputId, isVisible) {
93
- const field = this.containerEl.querySelector(`#${inputId}`);
94
- if (field?.parentElement) {
95
- field.parentElement.style.display = isVisible ? '' : 'none';
96
- }
97
- }
98
- setContainerVisibility(containerId, isVisible) {
99
- const container = this.containerEl.querySelector(`#${containerId}`);
100
- if (container) {
101
- container.style.display = isVisible ? '' : 'none';
102
- }
103
- }
104
- populateCountrySelector(selectEl) {
105
- const validCountries = this.cardSessionFieldConfig?.validCountries || [];
106
- const selectedCountryCode = this.getSelectedCountryCode();
107
- selectEl.innerHTML = '';
108
- selectEl.disabled = false;
109
- if (!validCountries.length) {
110
- const fallbackOption = document.createElement('option');
111
- fallbackOption.value = selectedCountryCode || '';
112
- fallbackOption.textContent = selectedCountryCode
113
- ? `Detected country: ${selectedCountryCode}`
114
- : 'Country unavailable';
115
- selectEl.appendChild(fallbackOption);
116
- selectEl.disabled = true;
117
- return;
118
- }
119
- const placeholderOption = document.createElement('option');
120
- placeholderOption.value = '';
121
- placeholderOption.textContent = 'Select country';
122
- selectEl.appendChild(placeholderOption);
123
- validCountries.forEach(country => {
124
- const option = document.createElement('option');
125
- option.value = country.code;
126
- option.textContent = country.name;
127
- selectEl.appendChild(option);
128
- });
129
- if (selectedCountryCode) {
130
- selectEl.value = selectedCountryCode;
131
- }
132
- }
133
- updateDynamicFieldVisibility(countryCode = this.getSelectedCountryCode()) {
134
- this.setFieldVisibility('cardHolderInput', this.isCardholderNameVisible());
135
- this.setFieldVisibility('postalCodeInput', this.isPostalCodeVisible(countryCode));
136
- const postalCodeInput = this.containerEl.querySelector('#postalCodeInput');
137
- if (!this.isPostalCodeVisible(countryCode) && postalCodeInput) {
138
- postalCodeInput.value = '';
139
- }
140
- }
141
57
  wireCardInputs() {
142
58
  const cardNumber = this.containerEl.querySelector('#cardNumberInput');
143
59
  const expiryDate = this.containerEl.querySelector('#expiryInput');
144
60
  const cvv = this.containerEl.querySelector('#cvvInput');
145
- const cardholderName = this.containerEl.querySelector('#cardHolderInput');
61
+ const hasCardholderInput = !!this.checkoutConfig?.card?.cardholderName?.required;
62
+ let cardholderName = undefined;
63
+ if (hasCardholderInput) {
64
+ cardholderName =
65
+ this.containerEl.querySelector('#cardHolderInput');
66
+ }
67
+ else {
68
+ this.containerEl.querySelector('#cardHolderInput').parentElement.style.display = 'none';
69
+ }
146
70
  const hasEmailInput = !!this.checkoutConfig?.card?.emailAddress?.visible;
147
71
  let emailAddress = undefined;
148
72
  if (hasEmailInput) {
@@ -155,23 +79,11 @@ class CardSkin {
155
79
  else {
156
80
  this.containerEl.querySelector('#emailAddressInput').parentElement.style.display = 'none';
157
81
  }
158
- const countrySelector = this.containerEl.querySelector('#countrySelectorInput');
159
- const postalCode = this.containerEl.querySelector('#postalCodeInput');
160
- if (countrySelector) {
161
- this.populateCountrySelector(countrySelector);
162
- countrySelector.addEventListener('change', () => {
163
- this.updateDynamicFieldVisibility(this.normalizeCountryCode(countrySelector.value));
164
- });
165
- }
166
- this.setContainerVisibility('countrySelectorField', this.isCountrySelectorVisible());
167
- this.updateDynamicFieldVisibility();
168
82
  if (!cardNumber ||
169
83
  !expiryDate ||
170
84
  !cvv ||
171
- !cardholderName ||
172
- (hasEmailInput && !emailAddress) ||
173
- !countrySelector ||
174
- !postalCode) {
85
+ (hasCardholderInput && !cardholderName) ||
86
+ (hasEmailInput && !emailAddress)) {
175
87
  throw new Error('One or more card input elements are missing in the default skin');
176
88
  }
177
89
  this.cardInputElements = {
@@ -180,8 +92,6 @@ class CardSkin {
180
92
  cvv,
181
93
  cardholderName,
182
94
  emailAddress,
183
- countrySelector,
184
- postalCode,
185
95
  };
186
96
  }
187
97
  async init() {
@@ -197,6 +107,11 @@ class CardSkin {
197
107
  getCheckoutOptions() {
198
108
  return {
199
109
  cardElements: this.getCardInputElements(),
110
+ card: {
111
+ cardholderName: {
112
+ required: !!this.checkoutConfig?.card?.cardholderName?.required,
113
+ },
114
+ },
200
115
  };
201
116
  }
202
117
  }