@funnelfox/billing 0.6.5-beta.3 → 0.6.5
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.
- package/dist/chunk-index.cjs.js +17 -138
- package/dist/chunk-index.cjs2.js +4 -5
- package/dist/chunk-index.cjs3.js +21 -106
- package/dist/chunk-index.es.js +17 -138
- package/dist/chunk-index.es2.js +4 -5
- package/dist/chunk-index.es3.js +21 -106
- package/dist/funnelfox-billing.js +42 -249
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +2 -2
- package/src/types.d.ts +2 -26
|
@@ -426,7 +426,7 @@
|
|
|
426
426
|
/**
|
|
427
427
|
* @fileoverview Constants for Funnefox SDK
|
|
428
428
|
*/
|
|
429
|
-
const SDK_VERSION = '0.6.5
|
|
429
|
+
const SDK_VERSION = '0.6.5';
|
|
430
430
|
const DEFAULTS = {
|
|
431
431
|
BASE_URL: 'https://billing.funnelfox.com',
|
|
432
432
|
REGION: 'default',
|
|
@@ -677,8 +677,6 @@
|
|
|
677
677
|
onMethodRenderError: options.onMethodRenderError,
|
|
678
678
|
onMethodRender: options.onMethodRender,
|
|
679
679
|
onCardInputValueChange: options.onCardInputValueChange,
|
|
680
|
-
isCardholderNameRequired: options.isCardholderNameRequired,
|
|
681
|
-
isPostalCodeRequired: options.isPostalCodeRequired,
|
|
682
680
|
});
|
|
683
681
|
this.paymentMethodsInterfaces.push(cardInterface);
|
|
684
682
|
return cardInterface;
|
|
@@ -697,7 +695,7 @@
|
|
|
697
695
|
throw new PrimerError('Failed to initialize Primer checkout', error);
|
|
698
696
|
}
|
|
699
697
|
}
|
|
700
|
-
async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onCardInputValueChange,
|
|
698
|
+
async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onCardInputValueChange, onMethodRenderError, onMethodRender, }) {
|
|
701
699
|
try {
|
|
702
700
|
if (!this.currentHeadless) {
|
|
703
701
|
throw new PrimerError('Headless checkout not found');
|
|
@@ -712,21 +710,14 @@
|
|
|
712
710
|
if (!pmManager)
|
|
713
711
|
return false;
|
|
714
712
|
const { valid, validationErrors } = await pmManager.validate();
|
|
715
|
-
const cardHolderError =
|
|
716
|
-
|
|
717
|
-
: null;
|
|
718
|
-
dispatchError('cardholderName', cardHolderError);
|
|
713
|
+
const cardHolderError = validationErrors.find(v => v.name === 'cardholderName');
|
|
714
|
+
dispatchError('cardholderName', cardHolderError?.message || null);
|
|
719
715
|
const emailAddress = elements.emailAddress?.value?.trim();
|
|
720
716
|
const emailError = emailAddress && !isValidEmail(emailAddress)
|
|
721
717
|
? 'Please enter a valid email address'
|
|
722
718
|
: null;
|
|
723
719
|
dispatchError('emailAddress', emailError);
|
|
724
|
-
|
|
725
|
-
const postalCodeError = isPostalCodeRequired?.() && !postalCode
|
|
726
|
-
? 'Please enter a postal code'
|
|
727
|
-
: null;
|
|
728
|
-
dispatchError('postalCode', postalCodeError);
|
|
729
|
-
return valid && !emailError && !cardHolderError && !postalCodeError;
|
|
720
|
+
return valid && !emailError;
|
|
730
721
|
};
|
|
731
722
|
const dispatchError = (inputName, error) => {
|
|
732
723
|
onInputChange(inputName, error);
|
|
@@ -749,24 +740,18 @@
|
|
|
749
740
|
? 'Please enter a valid email address'
|
|
750
741
|
: null);
|
|
751
742
|
};
|
|
752
|
-
const countrySelectorOnChange = (e) => {
|
|
753
|
-
const countryCode = e.target.value.trim();
|
|
754
|
-
onCardInputValueChange?.('countryCode', countryCode);
|
|
755
|
-
};
|
|
756
|
-
const postalCodeOnChange = (e) => {
|
|
757
|
-
const postalCode = e.target.value.trim();
|
|
758
|
-
onCardInputValueChange?.('postalCode', postalCode);
|
|
759
|
-
dispatchError('postalCode', null);
|
|
760
|
-
};
|
|
761
743
|
elements.cardholderName?.addEventListener('input', cardHolderOnChange);
|
|
762
744
|
elements.emailAddress?.addEventListener('input', emailAddressOnChange);
|
|
763
|
-
elements.countrySelector?.addEventListener('change', countrySelectorOnChange);
|
|
764
|
-
elements.postalCode?.addEventListener('input', postalCodeOnChange);
|
|
765
745
|
cardNumberInput.addEventListener('change', onHostedInputChange('cardNumber'));
|
|
766
746
|
expiryInput.addEventListener('change', onHostedInputChange('expiryDate'));
|
|
767
747
|
cvvInput.addEventListener('change', onHostedInputChange('cvv'));
|
|
768
748
|
const onSubmitHandler = async () => {
|
|
769
|
-
|
|
749
|
+
const isEmailValid = isValidEmail(elements.emailAddress?.value?.trim() || '');
|
|
750
|
+
const isFormValid = await validateForm();
|
|
751
|
+
if (!isEmailValid) {
|
|
752
|
+
dispatchError('emailAddress', 'Please enter a valid email address');
|
|
753
|
+
}
|
|
754
|
+
if (!isFormValid || !isEmailValid) {
|
|
770
755
|
return;
|
|
771
756
|
}
|
|
772
757
|
try {
|
|
@@ -803,8 +788,6 @@
|
|
|
803
788
|
pmManager.removeHostedInputs();
|
|
804
789
|
elements.cardholderName?.removeEventListener('input', cardHolderOnChange);
|
|
805
790
|
elements.emailAddress?.removeEventListener('input', emailAddressOnChange);
|
|
806
|
-
elements.countrySelector?.removeEventListener('change', countrySelectorOnChange);
|
|
807
|
-
elements.postalCode?.removeEventListener('input', postalCodeOnChange);
|
|
808
791
|
elements.button?.removeEventListener('click', onSubmitHandler);
|
|
809
792
|
};
|
|
810
793
|
this.destroyCallbacks.push(onDestroy);
|
|
@@ -823,12 +806,6 @@
|
|
|
823
806
|
if (elements.emailAddress) {
|
|
824
807
|
elements.emailAddress.disabled = disabled;
|
|
825
808
|
}
|
|
826
|
-
if (elements.countrySelector) {
|
|
827
|
-
elements.countrySelector.disabled = disabled;
|
|
828
|
-
}
|
|
829
|
-
if (elements.postalCode) {
|
|
830
|
-
elements.postalCode.disabled = disabled;
|
|
831
|
-
}
|
|
832
809
|
},
|
|
833
810
|
submit: () => onSubmitHandler(),
|
|
834
811
|
destroy: () => {
|
|
@@ -851,7 +828,7 @@
|
|
|
851
828
|
});
|
|
852
829
|
}
|
|
853
830
|
async renderCheckout(clientToken, checkoutOptions, checkoutRenderOptions) {
|
|
854
|
-
const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, onCardInputValueChange,
|
|
831
|
+
const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, onCardInputValueChange, } = checkoutRenderOptions;
|
|
855
832
|
await this.initializeHeadlessCheckout(clientToken, checkoutOptions);
|
|
856
833
|
onMethodsAvailable?.(this.availableMethods);
|
|
857
834
|
await Promise.all(this.availableMethods.map(method => {
|
|
@@ -864,8 +841,6 @@
|
|
|
864
841
|
onMethodRender,
|
|
865
842
|
onMethodRenderError,
|
|
866
843
|
onCardInputValueChange,
|
|
867
|
-
isCardholderNameRequired,
|
|
868
|
-
isPostalCodeRequired,
|
|
869
844
|
});
|
|
870
845
|
}
|
|
871
846
|
else {
|
|
@@ -1080,12 +1055,6 @@
|
|
|
1080
1055
|
if (params.email !== undefined) {
|
|
1081
1056
|
payload.email_address = params.email;
|
|
1082
1057
|
}
|
|
1083
|
-
if (params.countryCode !== undefined) {
|
|
1084
|
-
payload.country_code = params.countryCode;
|
|
1085
|
-
}
|
|
1086
|
-
if (params.postalCode !== undefined) {
|
|
1087
|
-
payload.postal_code = params.postalCode;
|
|
1088
|
-
}
|
|
1089
1058
|
return (await this.request(API_ENDPOINTS.CREATE_PAYMENT, {
|
|
1090
1059
|
method: 'POST',
|
|
1091
1060
|
body: JSON.stringify(payload),
|
|
@@ -1398,24 +1367,12 @@
|
|
|
1398
1367
|
super();
|
|
1399
1368
|
this.counter = 0;
|
|
1400
1369
|
this.radarSessionId = null;
|
|
1401
|
-
this.cardSessionFieldConfig = {};
|
|
1402
1370
|
this.handleInputChange = (inputName, error) => {
|
|
1403
1371
|
this.emit(EVENTS.INPUT_ERROR, { name: inputName, error });
|
|
1404
1372
|
};
|
|
1405
1373
|
this.handleCardInputValueChange = (inputName, value) => {
|
|
1406
1374
|
if (inputName === 'emailAddress') {
|
|
1407
1375
|
this.cardEmailAddress = value?.trim() || undefined;
|
|
1408
|
-
return;
|
|
1409
|
-
}
|
|
1410
|
-
if (inputName === 'countryCode') {
|
|
1411
|
-
this.cardCountryCode = this.normalizeCountryCode(value);
|
|
1412
|
-
if (!this.isPostalCodeVisible()) {
|
|
1413
|
-
this.cardPostalCode = undefined;
|
|
1414
|
-
}
|
|
1415
|
-
return;
|
|
1416
|
-
}
|
|
1417
|
-
if (inputName === 'postalCode') {
|
|
1418
|
-
this.cardPostalCode = value?.trim() || undefined;
|
|
1419
1376
|
}
|
|
1420
1377
|
};
|
|
1421
1378
|
this.handleMethodRender = (method) => {
|
|
@@ -1441,8 +1398,6 @@
|
|
|
1441
1398
|
orderId: this.orderId,
|
|
1442
1399
|
paymentMethodToken: paymentMethodTokenData.token,
|
|
1443
1400
|
email: this.getPaymentEmailAddress(),
|
|
1444
|
-
countryCode: this.getPaymentCountryCode(),
|
|
1445
|
-
postalCode: this.getPaymentPostalCode(),
|
|
1446
1401
|
clientMetadata: {
|
|
1447
1402
|
radarSessionId,
|
|
1448
1403
|
},
|
|
@@ -1515,8 +1470,6 @@
|
|
|
1515
1470
|
this.primerWrapper = new PrimerWrapper();
|
|
1516
1471
|
this.isDestroyed = false;
|
|
1517
1472
|
this.cardEmailAddress = this.checkoutConfig.customer.email;
|
|
1518
|
-
this.shouldApplySessionCardholderNameConfig =
|
|
1519
|
-
this.checkoutConfig.card?.cardholderName?.required === undefined;
|
|
1520
1473
|
this._setupCallbackBridges();
|
|
1521
1474
|
}
|
|
1522
1475
|
_setupCallbackBridges() {
|
|
@@ -1609,9 +1562,7 @@
|
|
|
1609
1562
|
this.clientToken = sessionData.clientToken;
|
|
1610
1563
|
}
|
|
1611
1564
|
applySessionCardFieldConfig(response) {
|
|
1612
|
-
const cardConfig = {
|
|
1613
|
-
...(this.checkoutConfig.card || {}),
|
|
1614
|
-
};
|
|
1565
|
+
const cardConfig = this.checkoutConfig.card || {};
|
|
1615
1566
|
if (cardConfig.emailAddress?.visible === undefined &&
|
|
1616
1567
|
response.data?.show_email_field !== undefined) {
|
|
1617
1568
|
cardConfig.emailAddress = {
|
|
@@ -1619,41 +1570,19 @@
|
|
|
1619
1570
|
visible: response.data.show_email_field,
|
|
1620
1571
|
};
|
|
1621
1572
|
}
|
|
1622
|
-
if (
|
|
1573
|
+
if (cardConfig.cardholderName?.required === undefined &&
|
|
1623
1574
|
response.data?.show_cardholder_name_field !== undefined) {
|
|
1624
1575
|
cardConfig.cardholderName = {
|
|
1625
1576
|
...cardConfig.cardholderName,
|
|
1626
1577
|
required: response.data.show_cardholder_name_field,
|
|
1627
1578
|
};
|
|
1628
1579
|
}
|
|
1629
|
-
const countryFieldOverrides = this.normalizeCountryFieldOverrides(response.data?.country_field_overrides);
|
|
1630
|
-
const detectedCountryCode = this.normalizeCountryCode(response.data?.detected_country_code) ||
|
|
1631
|
-
this.cardCountryCode;
|
|
1632
|
-
this.cardSessionFieldConfig = {
|
|
1633
|
-
...this.cardSessionFieldConfig,
|
|
1634
|
-
showCountrySelector: response.data?.show_country_selector_field ??
|
|
1635
|
-
this.cardSessionFieldConfig.showCountrySelector,
|
|
1636
|
-
showPostalCode: response.data?.show_postal_code_field ??
|
|
1637
|
-
this.cardSessionFieldConfig.showPostalCode,
|
|
1638
|
-
detectedCountryCode: detectedCountryCode || this.cardSessionFieldConfig.detectedCountryCode,
|
|
1639
|
-
validCountries: response.data?.valid_countries ||
|
|
1640
|
-
this.cardSessionFieldConfig.validCountries,
|
|
1641
|
-
countryFieldOverrides: countryFieldOverrides ||
|
|
1642
|
-
this.cardSessionFieldConfig.countryFieldOverrides,
|
|
1643
|
-
};
|
|
1644
1580
|
if (Object.keys(cardConfig).length > 0) {
|
|
1645
1581
|
this.checkoutConfig.card = cardConfig;
|
|
1646
1582
|
}
|
|
1647
|
-
this.cardCountryCode =
|
|
1648
|
-
this.cardSessionFieldConfig.detectedCountryCode || this.cardCountryCode;
|
|
1649
|
-
if (!this.isPostalCodeVisible()) {
|
|
1650
|
-
this.cardPostalCode = undefined;
|
|
1651
|
-
}
|
|
1652
1583
|
}
|
|
1653
1584
|
getPrimerCardConfig() {
|
|
1654
|
-
const cardConfig = {
|
|
1655
|
-
...(this.checkoutConfig.card || {}),
|
|
1656
|
-
};
|
|
1585
|
+
const cardConfig = { ...(this.checkoutConfig.card || {}) };
|
|
1657
1586
|
delete cardConfig.emailAddress;
|
|
1658
1587
|
return Object.keys(cardConfig).length
|
|
1659
1588
|
? cardConfig
|
|
@@ -1774,8 +1703,6 @@
|
|
|
1774
1703
|
onSubmit: this.handleSubmit,
|
|
1775
1704
|
onInputChange: this.handleInputChange,
|
|
1776
1705
|
onCardInputValueChange: this.handleCardInputValueChange,
|
|
1777
|
-
isCardholderNameRequired: () => this.isCardholderNameRequired(),
|
|
1778
|
-
isPostalCodeRequired: () => this.isPostalCodeVisible(),
|
|
1779
1706
|
onMethodRender: this.handleMethodRender,
|
|
1780
1707
|
onMethodsAvailable: this.handleMethodsAvailable,
|
|
1781
1708
|
onMethodRenderError: this.handleMethodRenderError,
|
|
@@ -1934,58 +1861,12 @@
|
|
|
1934
1861
|
isProcessing() {
|
|
1935
1862
|
return ['processing', 'action_required'].includes(this.state);
|
|
1936
1863
|
}
|
|
1937
|
-
normalizeCountryCode(countryCode) {
|
|
1938
|
-
const normalized = countryCode?.trim().toUpperCase();
|
|
1939
|
-
return normalized || undefined;
|
|
1940
|
-
}
|
|
1941
|
-
normalizeCountryFieldOverrides(overrides) {
|
|
1942
|
-
if (!overrides) {
|
|
1943
|
-
return undefined;
|
|
1944
|
-
}
|
|
1945
|
-
return Object.entries(overrides).reduce((result, [countryCode, override]) => {
|
|
1946
|
-
const normalizedCountryCode = this.normalizeCountryCode(countryCode);
|
|
1947
|
-
if (normalizedCountryCode && override) {
|
|
1948
|
-
result[normalizedCountryCode] = override;
|
|
1949
|
-
}
|
|
1950
|
-
return result;
|
|
1951
|
-
}, {});
|
|
1952
|
-
}
|
|
1953
|
-
getSelectedCountryCode() {
|
|
1954
|
-
return (this.normalizeCountryCode(this.cardCountryCode) ||
|
|
1955
|
-
this.normalizeCountryCode(this.cardSessionFieldConfig.detectedCountryCode));
|
|
1956
|
-
}
|
|
1957
|
-
getCountryFieldOverride(countryCode = this.getSelectedCountryCode()) {
|
|
1958
|
-
if (!countryCode) {
|
|
1959
|
-
return undefined;
|
|
1960
|
-
}
|
|
1961
|
-
return this.cardSessionFieldConfig.countryFieldOverrides?.[countryCode];
|
|
1962
|
-
}
|
|
1963
|
-
isCardholderNameRequired() {
|
|
1964
|
-
return !!this.checkoutConfig.card?.cardholderName?.required;
|
|
1965
|
-
}
|
|
1966
|
-
isPostalCodeVisible(countryCode = this.getSelectedCountryCode()) {
|
|
1967
|
-
const defaultValue = !!this.cardSessionFieldConfig.showPostalCode;
|
|
1968
|
-
const overrideValue = this.getCountryFieldOverride(countryCode)?.show_postal_code;
|
|
1969
|
-
if (overrideValue === null || overrideValue === undefined) {
|
|
1970
|
-
return defaultValue;
|
|
1971
|
-
}
|
|
1972
|
-
return overrideValue;
|
|
1973
|
-
}
|
|
1974
|
-
getPaymentCountryCode() {
|
|
1975
|
-
return this.getSelectedCountryCode();
|
|
1976
|
-
}
|
|
1977
|
-
getPaymentPostalCode() {
|
|
1978
|
-
if (!this.isPostalCodeVisible()) {
|
|
1979
|
-
return undefined;
|
|
1980
|
-
}
|
|
1981
|
-
return this.cardPostalCode?.trim() || undefined;
|
|
1982
|
-
}
|
|
1983
1864
|
// Creates containers to render hosted inputs with labels and error messages,
|
|
1984
1865
|
// a card holder input with label and error, and a submit button.
|
|
1985
1866
|
async getDefaultSkinCheckoutOptions() {
|
|
1986
1867
|
const skinFactory = (await Promise.resolve().then(function () { return index; }))
|
|
1987
1868
|
.default;
|
|
1988
|
-
const skin = await skinFactory(this.checkoutConfig
|
|
1869
|
+
const skin = await skinFactory(this.checkoutConfig);
|
|
1989
1870
|
this.on(EVENTS.INPUT_ERROR, skin.onInputError);
|
|
1990
1871
|
this.on(EVENTS.STATUS_CHANGE, skin.onStatusChange);
|
|
1991
1872
|
this.on(EVENTS.ERROR, (error) => skin.onError(error));
|
|
@@ -2001,7 +1882,7 @@
|
|
|
2001
1882
|
}
|
|
2002
1883
|
async getCardDefaultSkinCheckoutOptions(node) {
|
|
2003
1884
|
const CardSkin = (await Promise.resolve().then(function () { return index$1; })).default;
|
|
2004
|
-
const skin = new CardSkin(node, this.checkoutConfig
|
|
1885
|
+
const skin = new CardSkin(node, this.checkoutConfig);
|
|
2005
1886
|
skin.init();
|
|
2006
1887
|
this.on(EVENTS.INPUT_ERROR, skin.onInputError);
|
|
2007
1888
|
this.on(EVENTS.METHOD_RENDER, skin.onMethodRender);
|
|
@@ -2062,8 +1943,6 @@
|
|
|
2062
1943
|
onSubmit: this.handleSubmit,
|
|
2063
1944
|
onInputChange: this.handleInputChange,
|
|
2064
1945
|
onCardInputValueChange: this.handleCardInputValueChange,
|
|
2065
|
-
isCardholderNameRequired: () => this.isCardholderNameRequired(),
|
|
2066
|
-
isPostalCodeRequired: () => this.isPostalCodeVisible(),
|
|
2067
1946
|
onMethodRender: this.handleMethodRender,
|
|
2068
1947
|
onMethodRenderError: this.handleMethodRenderError,
|
|
2069
1948
|
};
|
|
@@ -2311,12 +2190,12 @@
|
|
|
2311
2190
|
|
|
2312
2191
|
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";
|
|
2313
2192
|
|
|
2314
|
-
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";
|
|
2193
|
+
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";
|
|
2315
2194
|
|
|
2316
|
-
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
|
|
2195
|
+
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 }";
|
|
2317
2196
|
|
|
2318
2197
|
class CardSkin {
|
|
2319
|
-
constructor(containerEl, checkoutConfig
|
|
2198
|
+
constructor(containerEl, checkoutConfig) {
|
|
2320
2199
|
this.onInputError = (event) => {
|
|
2321
2200
|
const { name, error } = event;
|
|
2322
2201
|
const cardInputElements = this.getCardInputElements();
|
|
@@ -2326,20 +2205,15 @@
|
|
|
2326
2205
|
cvv: cardInputElements.cvv.parentElement,
|
|
2327
2206
|
cardholderName: cardInputElements.cardholderName?.parentElement,
|
|
2328
2207
|
emailAddress: cardInputElements.emailAddress?.parentElement,
|
|
2329
|
-
postalCode: cardInputElements.postalCode?.parentElement,
|
|
2330
2208
|
};
|
|
2331
2209
|
const errorContainer = elementsMap[name]?.querySelector('.errorContainer');
|
|
2332
2210
|
if (errorContainer) {
|
|
2333
2211
|
errorContainer.textContent = error || '';
|
|
2334
2212
|
}
|
|
2335
|
-
if (name === 'cardholderName' ||
|
|
2336
|
-
name === 'emailAddress' ||
|
|
2337
|
-
name === 'postalCode') {
|
|
2213
|
+
if (name === 'cardholderName' || name === 'emailAddress') {
|
|
2338
2214
|
const field = name === 'cardholderName'
|
|
2339
2215
|
? cardInputElements.cardholderName
|
|
2340
|
-
:
|
|
2341
|
-
? cardInputElements.emailAddress
|
|
2342
|
-
: cardInputElements.postalCode;
|
|
2216
|
+
: cardInputElements.emailAddress;
|
|
2343
2217
|
if (error) {
|
|
2344
2218
|
field?.classList?.add('error');
|
|
2345
2219
|
}
|
|
@@ -2361,92 +2235,21 @@
|
|
|
2361
2235
|
}
|
|
2362
2236
|
this.containerEl = containerEl;
|
|
2363
2237
|
this.checkoutConfig = checkoutConfig;
|
|
2364
|
-
this.cardSessionFieldConfig = cardSessionFieldConfig;
|
|
2365
2238
|
this.containerEl.style.display = 'none';
|
|
2366
2239
|
}
|
|
2367
|
-
normalizeCountryCode(countryCode) {
|
|
2368
|
-
const normalized = countryCode?.trim().toUpperCase();
|
|
2369
|
-
return normalized || undefined;
|
|
2370
|
-
}
|
|
2371
|
-
getSelectedCountryCode() {
|
|
2372
|
-
const selector = this.containerEl.querySelector('#countrySelectorInput');
|
|
2373
|
-
return (this.normalizeCountryCode(selector?.value) ||
|
|
2374
|
-
this.normalizeCountryCode(this.cardSessionFieldConfig?.detectedCountryCode));
|
|
2375
|
-
}
|
|
2376
|
-
getCountryFieldOverride(countryCode = this.getSelectedCountryCode()) {
|
|
2377
|
-
if (!countryCode) {
|
|
2378
|
-
return undefined;
|
|
2379
|
-
}
|
|
2380
|
-
return this.cardSessionFieldConfig?.countryFieldOverrides?.[countryCode];
|
|
2381
|
-
}
|
|
2382
|
-
isCountrySelectorVisible() {
|
|
2383
|
-
return !!this.cardSessionFieldConfig?.showCountrySelector;
|
|
2384
|
-
}
|
|
2385
|
-
isCardholderNameVisible() {
|
|
2386
|
-
return !!this.checkoutConfig.card?.cardholderName?.required;
|
|
2387
|
-
}
|
|
2388
|
-
isPostalCodeVisible(countryCode = this.getSelectedCountryCode()) {
|
|
2389
|
-
const defaultVisible = !!this.cardSessionFieldConfig?.showPostalCode;
|
|
2390
|
-
const overrideValue = this.getCountryFieldOverride(countryCode)?.show_postal_code;
|
|
2391
|
-
if (overrideValue === null || overrideValue === undefined) {
|
|
2392
|
-
return defaultVisible;
|
|
2393
|
-
}
|
|
2394
|
-
return overrideValue;
|
|
2395
|
-
}
|
|
2396
|
-
setFieldVisibility(inputId, isVisible) {
|
|
2397
|
-
const field = this.containerEl.querySelector(`#${inputId}`);
|
|
2398
|
-
if (field?.parentElement) {
|
|
2399
|
-
field.parentElement.style.display = isVisible ? '' : 'none';
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
setContainerVisibility(containerId, isVisible) {
|
|
2403
|
-
const container = this.containerEl.querySelector(`#${containerId}`);
|
|
2404
|
-
if (container) {
|
|
2405
|
-
container.style.display = isVisible ? '' : 'none';
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
populateCountrySelector(selectEl) {
|
|
2409
|
-
const validCountries = this.cardSessionFieldConfig?.validCountries || [];
|
|
2410
|
-
const selectedCountryCode = this.getSelectedCountryCode();
|
|
2411
|
-
selectEl.innerHTML = '';
|
|
2412
|
-
selectEl.disabled = false;
|
|
2413
|
-
if (!validCountries.length) {
|
|
2414
|
-
const fallbackOption = document.createElement('option');
|
|
2415
|
-
fallbackOption.value = selectedCountryCode || '';
|
|
2416
|
-
fallbackOption.textContent = selectedCountryCode
|
|
2417
|
-
? `Detected country: ${selectedCountryCode}`
|
|
2418
|
-
: 'Country unavailable';
|
|
2419
|
-
selectEl.appendChild(fallbackOption);
|
|
2420
|
-
selectEl.disabled = true;
|
|
2421
|
-
return;
|
|
2422
|
-
}
|
|
2423
|
-
const placeholderOption = document.createElement('option');
|
|
2424
|
-
placeholderOption.value = '';
|
|
2425
|
-
placeholderOption.textContent = 'Select country';
|
|
2426
|
-
selectEl.appendChild(placeholderOption);
|
|
2427
|
-
validCountries.forEach(country => {
|
|
2428
|
-
const option = document.createElement('option');
|
|
2429
|
-
option.value = country.code;
|
|
2430
|
-
option.textContent = country.name;
|
|
2431
|
-
selectEl.appendChild(option);
|
|
2432
|
-
});
|
|
2433
|
-
if (selectedCountryCode) {
|
|
2434
|
-
selectEl.value = selectedCountryCode;
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
updateDynamicFieldVisibility(countryCode = this.getSelectedCountryCode()) {
|
|
2438
|
-
this.setFieldVisibility('cardHolderInput', this.isCardholderNameVisible());
|
|
2439
|
-
this.setFieldVisibility('postalCodeInput', this.isPostalCodeVisible(countryCode));
|
|
2440
|
-
const postalCodeInput = this.containerEl.querySelector('#postalCodeInput');
|
|
2441
|
-
if (!this.isPostalCodeVisible(countryCode) && postalCodeInput) {
|
|
2442
|
-
postalCodeInput.value = '';
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
2240
|
wireCardInputs() {
|
|
2446
2241
|
const cardNumber = this.containerEl.querySelector('#cardNumberInput');
|
|
2447
2242
|
const expiryDate = this.containerEl.querySelector('#expiryInput');
|
|
2448
2243
|
const cvv = this.containerEl.querySelector('#cvvInput');
|
|
2449
|
-
const
|
|
2244
|
+
const hasCardholderInput = !!this.checkoutConfig?.card?.cardholderName?.required;
|
|
2245
|
+
let cardholderName = undefined;
|
|
2246
|
+
if (hasCardholderInput) {
|
|
2247
|
+
cardholderName =
|
|
2248
|
+
this.containerEl.querySelector('#cardHolderInput');
|
|
2249
|
+
}
|
|
2250
|
+
else {
|
|
2251
|
+
this.containerEl.querySelector('#cardHolderInput').parentElement.style.display = 'none';
|
|
2252
|
+
}
|
|
2450
2253
|
const hasEmailInput = !!this.checkoutConfig?.card?.emailAddress?.visible;
|
|
2451
2254
|
let emailAddress = undefined;
|
|
2452
2255
|
if (hasEmailInput) {
|
|
@@ -2459,23 +2262,11 @@
|
|
|
2459
2262
|
else {
|
|
2460
2263
|
this.containerEl.querySelector('#emailAddressInput').parentElement.style.display = 'none';
|
|
2461
2264
|
}
|
|
2462
|
-
const countrySelector = this.containerEl.querySelector('#countrySelectorInput');
|
|
2463
|
-
const postalCode = this.containerEl.querySelector('#postalCodeInput');
|
|
2464
|
-
if (countrySelector) {
|
|
2465
|
-
this.populateCountrySelector(countrySelector);
|
|
2466
|
-
countrySelector.addEventListener('change', () => {
|
|
2467
|
-
this.updateDynamicFieldVisibility(this.normalizeCountryCode(countrySelector.value));
|
|
2468
|
-
});
|
|
2469
|
-
}
|
|
2470
|
-
this.setContainerVisibility('countrySelectorField', this.isCountrySelectorVisible());
|
|
2471
|
-
this.updateDynamicFieldVisibility();
|
|
2472
2265
|
if (!cardNumber ||
|
|
2473
2266
|
!expiryDate ||
|
|
2474
2267
|
!cvv ||
|
|
2475
|
-
!cardholderName ||
|
|
2476
|
-
(hasEmailInput && !emailAddress)
|
|
2477
|
-
!countrySelector ||
|
|
2478
|
-
!postalCode) {
|
|
2268
|
+
(hasCardholderInput && !cardholderName) ||
|
|
2269
|
+
(hasEmailInput && !emailAddress)) {
|
|
2479
2270
|
throw new Error('One or more card input elements are missing in the default skin');
|
|
2480
2271
|
}
|
|
2481
2272
|
this.cardInputElements = {
|
|
@@ -2484,8 +2275,6 @@
|
|
|
2484
2275
|
cvv,
|
|
2485
2276
|
cardholderName,
|
|
2486
2277
|
emailAddress,
|
|
2487
|
-
countrySelector,
|
|
2488
|
-
postalCode,
|
|
2489
2278
|
};
|
|
2490
2279
|
}
|
|
2491
2280
|
async init() {
|
|
@@ -2501,6 +2290,11 @@
|
|
|
2501
2290
|
getCheckoutOptions() {
|
|
2502
2291
|
return {
|
|
2503
2292
|
cardElements: this.getCardInputElements(),
|
|
2293
|
+
card: {
|
|
2294
|
+
cardholderName: {
|
|
2295
|
+
required: !!this.checkoutConfig?.card?.cardholderName?.required,
|
|
2296
|
+
},
|
|
2297
|
+
},
|
|
2504
2298
|
};
|
|
2505
2299
|
}
|
|
2506
2300
|
}
|
|
@@ -2517,7 +2311,7 @@
|
|
|
2517
2311
|
[exports.PaymentMethod.APPLE_PAY]: applePayTemplate,
|
|
2518
2312
|
};
|
|
2519
2313
|
class DefaultSkin {
|
|
2520
|
-
constructor(checkoutConfig
|
|
2314
|
+
constructor(checkoutConfig) {
|
|
2521
2315
|
this.onLoaderChange = (isLoading) => {
|
|
2522
2316
|
document
|
|
2523
2317
|
.querySelectorAll(`${this.containerSelector} .loader-container`)
|
|
@@ -2606,7 +2400,6 @@
|
|
|
2606
2400
|
}
|
|
2607
2401
|
this.containerEl = containerEl;
|
|
2608
2402
|
this.checkoutConfig = checkoutConfig;
|
|
2609
|
-
this.cardSessionFieldConfig = cardSessionFieldConfig;
|
|
2610
2403
|
}
|
|
2611
2404
|
initAccordion() {
|
|
2612
2405
|
const paymentMethodCards = this.containerEl.querySelectorAll('.ff-payment-method-card');
|
|
@@ -2655,7 +2448,7 @@
|
|
|
2655
2448
|
this.paymentMethodOrder.forEach(paymentMethod => {
|
|
2656
2449
|
paymentMethodContainers.insertAdjacentHTML('beforeend', paymentMethodTemplates[paymentMethod]);
|
|
2657
2450
|
});
|
|
2658
|
-
this.cardInstance = new CardSkin(document.querySelector('#cardForm'), this.checkoutConfig
|
|
2451
|
+
this.cardInstance = new CardSkin(document.querySelector('#cardForm'), this.checkoutConfig);
|
|
2659
2452
|
this.cardInstance.init();
|
|
2660
2453
|
this.wireCardInputs();
|
|
2661
2454
|
}
|
|
@@ -2686,8 +2479,8 @@
|
|
|
2686
2479
|
};
|
|
2687
2480
|
}
|
|
2688
2481
|
}
|
|
2689
|
-
const createDefaultSkin = async (checkoutConfig
|
|
2690
|
-
const skin = new DefaultSkin(checkoutConfig
|
|
2482
|
+
const createDefaultSkin = async (checkoutConfig) => {
|
|
2483
|
+
const skin = new DefaultSkin(checkoutConfig);
|
|
2691
2484
|
await skin['init']();
|
|
2692
2485
|
return skin;
|
|
2693
2486
|
};
|