@funnelfox/billing 0.6.4-beta.0 → 0.6.4-beta.2
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/README.md +14 -4
- package/dist/chunk-index.cjs.js +164 -163
- package/dist/chunk-index.cjs3.js +24 -6
- package/dist/chunk-index.es.js +164 -163
- package/dist/chunk-index.es3.js +24 -6
- package/dist/funnelfox-billing.js +188 -169
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +2 -2
- package/src/types.d.ts +30 -11
|
@@ -154,64 +154,46 @@
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
|
-
* @fileoverview
|
|
157
|
+
* @fileoverview Dynamic loader for Primer SDK
|
|
158
|
+
* Loads Primer script and CSS from CDN independently of bundler
|
|
158
159
|
*/
|
|
160
|
+
const PRIMER_CDN_BASE = 'https://sdk.primer.io/web';
|
|
161
|
+
const DEFAULT_VERSION = '2.57.3';
|
|
162
|
+
// Integrity hashes for specific versions (for SRI security)
|
|
163
|
+
const INTEGRITY_HASHES = {
|
|
164
|
+
'2.57.3': {
|
|
165
|
+
js: 'sha384-xq2SWkYvTlKOMpuXQUXq1QI3eZN7JiqQ3Sc72U9wY1IE30MW3HkwQWg/1n6BTMz4',
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
let loadingPromise = null;
|
|
169
|
+
let isLoaded = false;
|
|
159
170
|
/**
|
|
160
|
-
*
|
|
161
|
-
* Checks if script already exists before loading to prevent duplicates.
|
|
162
|
-
*
|
|
163
|
-
* @param options - Script configuration options
|
|
164
|
-
* @returns Promise that resolves when script is loaded or rejects on error
|
|
171
|
+
* Injects a script tag into the document head
|
|
165
172
|
*/
|
|
166
|
-
function
|
|
167
|
-
const { id, src, async = true, type = 'text/javascript', attributes = {}, integrity, crossOrigin, appendTo = 'body', } = options;
|
|
173
|
+
function injectScript$1(src, integrity) {
|
|
168
174
|
return new Promise((resolve, reject) => {
|
|
169
|
-
// Check if script already exists
|
|
170
|
-
|
|
171
|
-
if (id) {
|
|
172
|
-
existingScript = document.getElementById(id);
|
|
173
|
-
}
|
|
174
|
-
if (!existingScript) {
|
|
175
|
-
existingScript = document.querySelector(`script[src="${src}"]`);
|
|
176
|
-
}
|
|
175
|
+
// Check if script already exists
|
|
176
|
+
const existingScript = document.querySelector(`script[src="${src}"]`);
|
|
177
177
|
if (existingScript) {
|
|
178
178
|
resolve(existingScript);
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
const script = document.createElement('script');
|
|
182
|
-
if (id) {
|
|
183
|
-
script.id = id;
|
|
184
|
-
}
|
|
185
|
-
script.type = type;
|
|
186
182
|
script.src = src;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
183
|
+
script.async = true;
|
|
184
|
+
script.crossOrigin = 'anonymous';
|
|
190
185
|
if (integrity) {
|
|
191
186
|
script.integrity = integrity;
|
|
192
187
|
}
|
|
193
|
-
if (crossOrigin) {
|
|
194
|
-
script.crossOrigin = crossOrigin;
|
|
195
|
-
}
|
|
196
|
-
// Set additional attributes
|
|
197
|
-
Object.entries(attributes).forEach(([key, value]) => {
|
|
198
|
-
script.setAttribute(key, value);
|
|
199
|
-
});
|
|
200
188
|
script.onload = () => resolve(script);
|
|
201
|
-
script.onerror = () => reject(new Error(`Failed to load script
|
|
202
|
-
|
|
203
|
-
target.appendChild(script);
|
|
189
|
+
script.onerror = () => reject(new Error(`Failed to load Primer SDK script from ${src}`));
|
|
190
|
+
document.head.appendChild(script);
|
|
204
191
|
});
|
|
205
192
|
}
|
|
206
193
|
/**
|
|
207
|
-
*
|
|
208
|
-
* Checks if stylesheet already exists before loading to prevent duplicates.
|
|
209
|
-
*
|
|
210
|
-
* @param options - Stylesheet configuration options
|
|
211
|
-
* @returns Promise that resolves when stylesheet is loaded or rejects on error
|
|
194
|
+
* Injects a CSS link tag into the document head
|
|
212
195
|
*/
|
|
213
|
-
function
|
|
214
|
-
const { href, integrity, crossOrigin } = options;
|
|
196
|
+
function injectCSS(href, integrity) {
|
|
215
197
|
return new Promise((resolve, reject) => {
|
|
216
198
|
// Check if stylesheet already exists
|
|
217
199
|
const existingLink = document.querySelector(`link[href="${href}"]`);
|
|
@@ -222,32 +204,15 @@
|
|
|
222
204
|
const link = document.createElement('link');
|
|
223
205
|
link.rel = 'stylesheet';
|
|
224
206
|
link.href = href;
|
|
207
|
+
link.crossOrigin = 'anonymous';
|
|
225
208
|
if (integrity) {
|
|
226
209
|
link.integrity = integrity;
|
|
227
210
|
}
|
|
228
|
-
if (crossOrigin) {
|
|
229
|
-
link.crossOrigin = crossOrigin;
|
|
230
|
-
}
|
|
231
211
|
link.onload = () => resolve(link);
|
|
232
|
-
link.onerror = () => reject(new Error(`Failed to load
|
|
212
|
+
link.onerror = () => reject(new Error(`Failed to load Primer SDK CSS from ${href}`));
|
|
233
213
|
document.head.appendChild(link);
|
|
234
214
|
});
|
|
235
215
|
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* @fileoverview Dynamic loader for Primer SDK
|
|
239
|
-
* Loads Primer script and CSS from CDN independently of bundler
|
|
240
|
-
*/
|
|
241
|
-
const PRIMER_CDN_BASE = 'https://sdk.primer.io/web';
|
|
242
|
-
const DEFAULT_VERSION = '2.57.3';
|
|
243
|
-
// Integrity hashes for specific versions (for SRI security)
|
|
244
|
-
const INTEGRITY_HASHES = {
|
|
245
|
-
'2.57.3': {
|
|
246
|
-
js: 'sha384-xq2SWkYvTlKOMpuXQUXq1QI3eZN7JiqQ3Sc72U9wY1IE30MW3HkwQWg/1n6BTMz4',
|
|
247
|
-
},
|
|
248
|
-
};
|
|
249
|
-
let loadingPromise = null;
|
|
250
|
-
let isLoaded = false;
|
|
251
216
|
/**
|
|
252
217
|
* Waits for window.Primer to be available
|
|
253
218
|
*/
|
|
@@ -299,17 +264,8 @@
|
|
|
299
264
|
try {
|
|
300
265
|
// Load CSS and JS in parallel
|
|
301
266
|
await Promise.all([
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
integrity: hashes?.css,
|
|
305
|
-
crossOrigin: 'anonymous',
|
|
306
|
-
}),
|
|
307
|
-
loadScript$1({
|
|
308
|
-
src: jsUrl,
|
|
309
|
-
integrity: hashes?.js,
|
|
310
|
-
crossOrigin: 'anonymous',
|
|
311
|
-
appendTo: 'head',
|
|
312
|
-
}),
|
|
267
|
+
injectCSS(cssUrl, hashes?.css),
|
|
268
|
+
injectScript$1(jsUrl, hashes?.js),
|
|
313
269
|
]);
|
|
314
270
|
// Wait for Primer to be available on window
|
|
315
271
|
await waitForPrimer();
|
|
@@ -352,28 +308,6 @@
|
|
|
352
308
|
const random = Math.random().toString(36).substr(2, 5);
|
|
353
309
|
return `${prefix}${timestamp}_${random}`;
|
|
354
310
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Generates a UUID v4 compliant string (RFC 4122).
|
|
357
|
-
* Meets Airwallex requirements:
|
|
358
|
-
* - Maximum 128 characters (UUID is 36 chars)
|
|
359
|
-
* - Only contains: a-z, A-Z, 0-9, underscore, hyphen
|
|
360
|
-
* - No prefix + timestamp pattern
|
|
361
|
-
* - Not a short series of numbers
|
|
362
|
-
*
|
|
363
|
-
* @returns UUID v4 string (e.g., "a3bb189e-8bf9-3888-9912-ace4e6543002")
|
|
364
|
-
*/
|
|
365
|
-
function generateUUID() {
|
|
366
|
-
// Use crypto.randomUUID if available (modern browsers)
|
|
367
|
-
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
368
|
-
return crypto.randomUUID();
|
|
369
|
-
}
|
|
370
|
-
// Fallback: manual UUID v4 generation
|
|
371
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
372
|
-
const r = (Math.random() * 16) | 0;
|
|
373
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
374
|
-
return v.toString(16);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
311
|
function sleep(ms) {
|
|
378
312
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
379
313
|
}
|
|
@@ -492,7 +426,7 @@
|
|
|
492
426
|
/**
|
|
493
427
|
* @fileoverview Constants for Funnefox SDK
|
|
494
428
|
*/
|
|
495
|
-
const SDK_VERSION = '0.6.4-beta.
|
|
429
|
+
const SDK_VERSION = '0.6.4-beta.2';
|
|
496
430
|
const DEFAULTS = {
|
|
497
431
|
BASE_URL: 'https://billing.funnelfox.com',
|
|
498
432
|
REGION: 'default',
|
|
@@ -606,6 +540,26 @@
|
|
|
606
540
|
},
|
|
607
541
|
};
|
|
608
542
|
|
|
543
|
+
/**
|
|
544
|
+
* @fileoverview Input validation utilities for Funnefox SDK
|
|
545
|
+
*/
|
|
546
|
+
function isValidEmail(email) {
|
|
547
|
+
if (typeof email !== 'string')
|
|
548
|
+
return false;
|
|
549
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
550
|
+
return emailRegex.test(email);
|
|
551
|
+
}
|
|
552
|
+
function sanitizeString(input) {
|
|
553
|
+
return input?.trim() || '';
|
|
554
|
+
}
|
|
555
|
+
function requireString(value, fieldName) {
|
|
556
|
+
const sanitized = sanitizeString(value);
|
|
557
|
+
if (sanitized.length === 0) {
|
|
558
|
+
throw new ValidationError(fieldName, 'must be a non-empty string', value);
|
|
559
|
+
}
|
|
560
|
+
return true;
|
|
561
|
+
}
|
|
562
|
+
|
|
609
563
|
/**
|
|
610
564
|
* @fileoverview Primer SDK integration wrapper
|
|
611
565
|
*/
|
|
@@ -722,6 +676,7 @@
|
|
|
722
676
|
onInputChange: options.onInputChange,
|
|
723
677
|
onMethodRenderError: options.onMethodRenderError,
|
|
724
678
|
onMethodRender: options.onMethodRender,
|
|
679
|
+
onCardInputValueChange: options.onCardInputValueChange,
|
|
725
680
|
});
|
|
726
681
|
this.paymentMethodsInterfaces.push(cardInterface);
|
|
727
682
|
return cardInterface;
|
|
@@ -740,7 +695,7 @@
|
|
|
740
695
|
throw new PrimerError('Failed to initialize Primer checkout', error);
|
|
741
696
|
}
|
|
742
697
|
}
|
|
743
|
-
async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onMethodRenderError, onMethodRender, }) {
|
|
698
|
+
async renderCardCheckoutWithElements(elements, { onSubmit, onInputChange, onCardInputValueChange, onMethodRenderError, onMethodRender, }) {
|
|
744
699
|
try {
|
|
745
700
|
if (!this.currentHeadless) {
|
|
746
701
|
throw new PrimerError('Headless checkout not found');
|
|
@@ -757,7 +712,12 @@
|
|
|
757
712
|
const { valid, validationErrors } = await pmManager.validate();
|
|
758
713
|
const cardHolderError = validationErrors.find(v => v.name === 'cardholderName');
|
|
759
714
|
dispatchError('cardholderName', cardHolderError?.message || null);
|
|
760
|
-
|
|
715
|
+
const emailAddress = elements.emailAddress?.value?.trim();
|
|
716
|
+
const emailError = emailAddress && !isValidEmail(emailAddress)
|
|
717
|
+
? 'Please enter a valid email address'
|
|
718
|
+
: null;
|
|
719
|
+
dispatchError('emailAddress', emailError);
|
|
720
|
+
return valid && !emailError;
|
|
761
721
|
};
|
|
762
722
|
const dispatchError = (inputName, error) => {
|
|
763
723
|
onInputChange(inputName, error);
|
|
@@ -772,7 +732,16 @@
|
|
|
772
732
|
pmManager.setCardholderName(e.target.value);
|
|
773
733
|
dispatchError('cardholderName', null);
|
|
774
734
|
};
|
|
735
|
+
const emailAddressOnChange = (e) => {
|
|
736
|
+
const value = e.target.value;
|
|
737
|
+
const email = value.trim();
|
|
738
|
+
onCardInputValueChange?.('emailAddress', email);
|
|
739
|
+
dispatchError('emailAddress', email && !isValidEmail(email)
|
|
740
|
+
? 'Please enter a valid email address'
|
|
741
|
+
: null);
|
|
742
|
+
};
|
|
775
743
|
elements.cardholderName?.addEventListener('input', cardHolderOnChange);
|
|
744
|
+
elements.emailAddress?.addEventListener('input', emailAddressOnChange);
|
|
776
745
|
cardNumberInput.addEventListener('change', onHostedInputChange('cardNumber'));
|
|
777
746
|
expiryInput.addEventListener('change', onHostedInputChange('expiryDate'));
|
|
778
747
|
cvvInput.addEventListener('change', onHostedInputChange('cvv'));
|
|
@@ -812,7 +781,8 @@
|
|
|
812
781
|
]);
|
|
813
782
|
const onDestroy = () => {
|
|
814
783
|
pmManager.removeHostedInputs();
|
|
815
|
-
elements.cardholderName?.removeEventListener('
|
|
784
|
+
elements.cardholderName?.removeEventListener('input', cardHolderOnChange);
|
|
785
|
+
elements.emailAddress?.removeEventListener('input', emailAddressOnChange);
|
|
816
786
|
elements.button?.removeEventListener('click', onSubmitHandler);
|
|
817
787
|
};
|
|
818
788
|
this.destroyCallbacks.push(onDestroy);
|
|
@@ -828,6 +798,9 @@
|
|
|
828
798
|
if (elements.cardholderName) {
|
|
829
799
|
elements.cardholderName.disabled = disabled;
|
|
830
800
|
}
|
|
801
|
+
if (elements.emailAddress) {
|
|
802
|
+
elements.emailAddress.disabled = disabled;
|
|
803
|
+
}
|
|
831
804
|
},
|
|
832
805
|
submit: () => onSubmitHandler(),
|
|
833
806
|
destroy: () => {
|
|
@@ -850,7 +823,7 @@
|
|
|
850
823
|
});
|
|
851
824
|
}
|
|
852
825
|
async renderCheckout(clientToken, checkoutOptions, checkoutRenderOptions) {
|
|
853
|
-
const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, } = checkoutRenderOptions;
|
|
826
|
+
const { cardElements, paymentButtonElements, container, onSubmit, onInputChange, onMethodRender, onMethodRenderError, onMethodsAvailable, onCardInputValueChange, } = checkoutRenderOptions;
|
|
854
827
|
await this.initializeHeadlessCheckout(clientToken, checkoutOptions);
|
|
855
828
|
onMethodsAvailable?.(this.availableMethods);
|
|
856
829
|
await Promise.all(this.availableMethods.map(method => {
|
|
@@ -862,6 +835,7 @@
|
|
|
862
835
|
onInputChange,
|
|
863
836
|
onMethodRender,
|
|
864
837
|
onMethodRenderError,
|
|
838
|
+
onCardInputValueChange,
|
|
865
839
|
});
|
|
866
840
|
}
|
|
867
841
|
else {
|
|
@@ -978,20 +952,6 @@
|
|
|
978
952
|
}
|
|
979
953
|
PrimerWrapper.headlessManager = new HeadlessManager();
|
|
980
954
|
|
|
981
|
-
/**
|
|
982
|
-
* @fileoverview Input validation utilities for Funnefox SDK
|
|
983
|
-
*/
|
|
984
|
-
function sanitizeString(input) {
|
|
985
|
-
return input?.trim() || '';
|
|
986
|
-
}
|
|
987
|
-
function requireString(value, fieldName) {
|
|
988
|
-
const sanitized = sanitizeString(value);
|
|
989
|
-
if (sanitized.length === 0) {
|
|
990
|
-
throw new ValidationError(fieldName, 'must be a non-empty string', value);
|
|
991
|
-
}
|
|
992
|
-
return true;
|
|
993
|
-
}
|
|
994
|
-
|
|
995
955
|
/**
|
|
996
956
|
* @fileoverview API client for Funnefox backend integration
|
|
997
957
|
*/
|
|
@@ -1087,6 +1047,9 @@
|
|
|
1087
1047
|
payment_method_token: params.paymentMethodToken,
|
|
1088
1048
|
client_metadata: params.clientMetadata || {},
|
|
1089
1049
|
};
|
|
1050
|
+
if (params.email !== undefined) {
|
|
1051
|
+
payload.email_address = params.email;
|
|
1052
|
+
}
|
|
1090
1053
|
return (await this.request(API_ENDPOINTS.CREATE_PAYMENT, {
|
|
1091
1054
|
method: 'POST',
|
|
1092
1055
|
body: JSON.stringify(payload),
|
|
@@ -1391,34 +1354,6 @@
|
|
|
1391
1354
|
}
|
|
1392
1355
|
};
|
|
1393
1356
|
|
|
1394
|
-
/**
|
|
1395
|
-
* @fileoverview Airwallex device fingerprinting script loader
|
|
1396
|
-
*/
|
|
1397
|
-
/**
|
|
1398
|
-
* Loads Airwallex device fingerprinting script for fraud prevention.
|
|
1399
|
-
* The script collects browser, screen, device, and interaction data.
|
|
1400
|
-
*
|
|
1401
|
-
* @param sessionId - Unique order session ID (UUID v4 format, max 128 chars)
|
|
1402
|
-
* @param isDemoMode - If true, uses demo environment URL for testing
|
|
1403
|
-
* @returns Promise that resolves when script is loaded
|
|
1404
|
-
*
|
|
1405
|
-
* @see https://www.airwallex.com/docs/payments/online-payments/native-api/device-fingerprinting
|
|
1406
|
-
*/
|
|
1407
|
-
async function loadAirwallexDeviceFingerprint(sessionId, isDemoMode = false) {
|
|
1408
|
-
const scriptId = 'airwallex-fraud-api';
|
|
1409
|
-
const src = isDemoMode
|
|
1410
|
-
? 'https://static-demo.airwallex.com/webapp/fraud/device-fingerprint/index.js'
|
|
1411
|
-
: 'https://static.airwallex.com/webapp/fraud/device-fingerprint/index.js';
|
|
1412
|
-
await loadScript$1({
|
|
1413
|
-
id: scriptId,
|
|
1414
|
-
src,
|
|
1415
|
-
async: true,
|
|
1416
|
-
attributes: {
|
|
1417
|
-
'data-order-session-id': sessionId,
|
|
1418
|
-
},
|
|
1419
|
-
});
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
1357
|
/**
|
|
1423
1358
|
* @fileoverview Checkout instance manager for Funnefox SDK
|
|
1424
1359
|
*/
|
|
@@ -1427,10 +1362,14 @@
|
|
|
1427
1362
|
super();
|
|
1428
1363
|
this.counter = 0;
|
|
1429
1364
|
this.radarSessionId = null;
|
|
1430
|
-
this.airwallexDeviceId = null;
|
|
1431
1365
|
this.handleInputChange = (inputName, error) => {
|
|
1432
1366
|
this.emit(EVENTS.INPUT_ERROR, { name: inputName, error });
|
|
1433
1367
|
};
|
|
1368
|
+
this.handleCardInputValueChange = (inputName, value) => {
|
|
1369
|
+
if (inputName === 'emailAddress') {
|
|
1370
|
+
this.cardEmailAddress = value?.trim() || undefined;
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1434
1373
|
this.handleMethodRender = (method) => {
|
|
1435
1374
|
this.emit(EVENTS.METHOD_RENDER, method);
|
|
1436
1375
|
};
|
|
@@ -1449,16 +1388,13 @@
|
|
|
1449
1388
|
try {
|
|
1450
1389
|
this.onLoaderChangeWithRace(true);
|
|
1451
1390
|
this._setState('processing');
|
|
1452
|
-
const
|
|
1453
|
-
this.radarSessionId,
|
|
1454
|
-
this.airwallexDeviceId,
|
|
1455
|
-
]);
|
|
1391
|
+
const radarSessionId = await this.radarSessionId;
|
|
1456
1392
|
const paymentResponse = await this.apiClient.createPayment({
|
|
1457
1393
|
orderId: this.orderId,
|
|
1458
1394
|
paymentMethodToken: paymentMethodTokenData.token,
|
|
1395
|
+
email: this.getPaymentEmailAddress(),
|
|
1459
1396
|
clientMetadata: {
|
|
1460
1397
|
radarSessionId,
|
|
1461
|
-
airwallexDeviceId,
|
|
1462
1398
|
},
|
|
1463
1399
|
});
|
|
1464
1400
|
const result = this.apiClient.processPaymentResponse(paymentResponse);
|
|
@@ -1528,6 +1464,7 @@
|
|
|
1528
1464
|
this.clientToken = null;
|
|
1529
1465
|
this.primerWrapper = new PrimerWrapper();
|
|
1530
1466
|
this.isDestroyed = false;
|
|
1467
|
+
this.cardEmailAddress = this.checkoutConfig.customer.email;
|
|
1531
1468
|
this._setupCallbackBridges();
|
|
1532
1469
|
}
|
|
1533
1470
|
_setupCallbackBridges() {
|
|
@@ -1606,18 +1543,9 @@
|
|
|
1606
1543
|
.catch(() => '');
|
|
1607
1544
|
});
|
|
1608
1545
|
}
|
|
1609
|
-
// Initialize Airwallex device fingerprinting if enabled by backend
|
|
1610
|
-
if (response.data?.airwallex_risk_enabled) {
|
|
1611
|
-
const deviceId = generateUUID();
|
|
1612
|
-
this.airwallexDeviceId = loadAirwallexDeviceFingerprint(deviceId, true)
|
|
1613
|
-
.then(() => deviceId)
|
|
1614
|
-
.catch(() => {
|
|
1615
|
-
// Silently fail - return deviceId anyway
|
|
1616
|
-
return deviceId;
|
|
1617
|
-
});
|
|
1618
|
-
}
|
|
1619
1546
|
this.isCollectingApplePayEmail =
|
|
1620
1547
|
!!response.data?.collect_apple_pay_email;
|
|
1548
|
+
this.applySessionCardFieldConfig(response);
|
|
1621
1549
|
return response;
|
|
1622
1550
|
});
|
|
1623
1551
|
// Cache the successful response
|
|
@@ -1628,11 +1556,81 @@
|
|
|
1628
1556
|
this.orderId = sessionData.orderId;
|
|
1629
1557
|
this.clientToken = sessionData.clientToken;
|
|
1630
1558
|
}
|
|
1559
|
+
applySessionCardFieldConfig(response) {
|
|
1560
|
+
const cardConfig = this.checkoutConfig.card || {};
|
|
1561
|
+
if (cardConfig.emailAddress?.visible === undefined &&
|
|
1562
|
+
response.data?.show_email_field !== undefined) {
|
|
1563
|
+
cardConfig.emailAddress = {
|
|
1564
|
+
...cardConfig.emailAddress,
|
|
1565
|
+
visible: response.data.show_email_field,
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
if (cardConfig.cardholderName?.required === undefined &&
|
|
1569
|
+
response.data?.show_cardholder_name_field !== undefined) {
|
|
1570
|
+
cardConfig.cardholderName = {
|
|
1571
|
+
...cardConfig.cardholderName,
|
|
1572
|
+
required: response.data.show_cardholder_name_field,
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
if (Object.keys(cardConfig).length > 0) {
|
|
1576
|
+
this.checkoutConfig.card = cardConfig;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
getPrimerCardConfig() {
|
|
1580
|
+
const cardConfig = { ...(this.checkoutConfig.card || {}) };
|
|
1581
|
+
delete cardConfig.emailAddress;
|
|
1582
|
+
return Object.keys(cardConfig).length
|
|
1583
|
+
? cardConfig
|
|
1584
|
+
: undefined;
|
|
1585
|
+
}
|
|
1586
|
+
getPaymentEmailAddress() {
|
|
1587
|
+
const email = this.cardEmailAddress?.trim() || this.checkoutConfig.customer.email;
|
|
1588
|
+
if (!email || !isValidEmail(email)) {
|
|
1589
|
+
return undefined;
|
|
1590
|
+
}
|
|
1591
|
+
const template = this.checkoutConfig.card?.emailAddress?.template;
|
|
1592
|
+
if (template?.includes('{{email}}')) {
|
|
1593
|
+
return template.replace(/\{\{email\}\}/g, email);
|
|
1594
|
+
}
|
|
1595
|
+
return email;
|
|
1596
|
+
}
|
|
1597
|
+
mergeApplePayCollectingEmailOptions(checkoutOptions) {
|
|
1598
|
+
if (!this.isCollectingApplePayEmail) {
|
|
1599
|
+
return checkoutOptions;
|
|
1600
|
+
}
|
|
1601
|
+
const billingFields = Array.from(new Set([
|
|
1602
|
+
...(checkoutOptions.applePay?.billingOptions
|
|
1603
|
+
?.requiredBillingContactFields || []),
|
|
1604
|
+
...(APPLE_PAY_COLLECTING_EMAIL_OPTIONS.billingOptions
|
|
1605
|
+
?.requiredBillingContactFields || []),
|
|
1606
|
+
]));
|
|
1607
|
+
const shippingFields = Array.from(new Set([
|
|
1608
|
+
...(checkoutOptions.applePay?.shippingOptions
|
|
1609
|
+
?.requiredShippingContactFields || []),
|
|
1610
|
+
...(APPLE_PAY_COLLECTING_EMAIL_OPTIONS.shippingOptions
|
|
1611
|
+
?.requiredShippingContactFields || []),
|
|
1612
|
+
]));
|
|
1613
|
+
return merge(checkoutOptions, {
|
|
1614
|
+
applePay: {
|
|
1615
|
+
billingOptions: {
|
|
1616
|
+
requiredBillingContactFields: billingFields,
|
|
1617
|
+
},
|
|
1618
|
+
shippingOptions: {
|
|
1619
|
+
requiredShippingContactFields: shippingFields,
|
|
1620
|
+
},
|
|
1621
|
+
},
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1631
1624
|
convertCardSelectorsToElements(selectors, container) {
|
|
1632
1625
|
const cardNumber = container.querySelector(selectors.cardNumber);
|
|
1633
1626
|
const expiryDate = container.querySelector(selectors.expiryDate);
|
|
1634
1627
|
const cvv = container.querySelector(selectors.cvv);
|
|
1635
|
-
const cardholderName =
|
|
1628
|
+
const cardholderName = selectors.cardholderName
|
|
1629
|
+
? container.querySelector(selectors.cardholderName)
|
|
1630
|
+
: undefined;
|
|
1631
|
+
const emailAddress = selectors.emailAddress
|
|
1632
|
+
? container.querySelector(selectors.emailAddress)
|
|
1633
|
+
: undefined;
|
|
1636
1634
|
const button = container.querySelector(selectors.button);
|
|
1637
1635
|
if (!cardNumber || !expiryDate || !cvv || !button) {
|
|
1638
1636
|
throw new CheckoutError('Required card input elements not found in container');
|
|
@@ -1642,6 +1640,7 @@
|
|
|
1642
1640
|
expiryDate,
|
|
1643
1641
|
cvv,
|
|
1644
1642
|
cardholderName,
|
|
1643
|
+
emailAddress,
|
|
1645
1644
|
button,
|
|
1646
1645
|
};
|
|
1647
1646
|
}
|
|
@@ -1691,15 +1690,14 @@
|
|
|
1691
1690
|
paymentButtonElements = this.convertPaymentButtonSelectorsToElements(this.checkoutConfig.paymentButtonSelectors);
|
|
1692
1691
|
checkoutOptions = this.getCheckoutOptions({});
|
|
1693
1692
|
}
|
|
1694
|
-
checkoutOptions =
|
|
1695
|
-
? { applePay: APPLE_PAY_COLLECTING_EMAIL_OPTIONS }
|
|
1696
|
-
: {});
|
|
1693
|
+
checkoutOptions = this.mergeApplePayCollectingEmailOptions(checkoutOptions);
|
|
1697
1694
|
await this.primerWrapper.renderCheckout(this.clientToken, checkoutOptions, {
|
|
1698
1695
|
container: containerElement,
|
|
1699
1696
|
cardElements,
|
|
1700
1697
|
paymentButtonElements,
|
|
1701
1698
|
onSubmit: this.handleSubmit,
|
|
1702
1699
|
onInputChange: this.handleInputChange,
|
|
1700
|
+
onCardInputValueChange: this.handleCardInputValueChange,
|
|
1703
1701
|
onMethodRender: this.handleMethodRender,
|
|
1704
1702
|
onMethodsAvailable: this.handleMethodsAvailable,
|
|
1705
1703
|
onMethodRenderError: this.handleMethodRenderError,
|
|
@@ -1735,9 +1733,13 @@
|
|
|
1735
1733
|
}
|
|
1736
1734
|
getCheckoutOptions(options) {
|
|
1737
1735
|
let wasPaymentProcessedStarted = false;
|
|
1736
|
+
const checkoutConfig = { ...this.checkoutConfig };
|
|
1737
|
+
delete checkoutConfig.card;
|
|
1738
1738
|
return {
|
|
1739
|
-
...
|
|
1739
|
+
...checkoutConfig,
|
|
1740
1740
|
...options,
|
|
1741
|
+
card: merge(this.getPrimerCardConfig() || {}, options.card || {}),
|
|
1742
|
+
applePay: merge(this.checkoutConfig.applePay || {}, options.applePay || {}),
|
|
1741
1743
|
onTokenizeSuccess: this.handleTokenizeSuccess,
|
|
1742
1744
|
onResumeSuccess: this.handleResumeSuccess,
|
|
1743
1745
|
onResumeError: error => {
|
|
@@ -1921,9 +1923,7 @@
|
|
|
1921
1923
|
if (callbacks.onMethodsAvailable) {
|
|
1922
1924
|
this.on(EVENTS.METHODS_AVAILABLE, callbacks.onMethodsAvailable);
|
|
1923
1925
|
}
|
|
1924
|
-
let checkoutOptions = this.
|
|
1925
|
-
? { applePay: APPLE_PAY_COLLECTING_EMAIL_OPTIONS }
|
|
1926
|
-
: {});
|
|
1926
|
+
let checkoutOptions = this.mergeApplePayCollectingEmailOptions(this.getCheckoutOptions({}));
|
|
1927
1927
|
let methodOptions = {
|
|
1928
1928
|
onMethodRender: this.handleMethodRender,
|
|
1929
1929
|
onMethodRenderError: this.handleMethodRenderError,
|
|
@@ -1937,6 +1937,7 @@
|
|
|
1937
1937
|
cardElements: cardDefaultOptions.cardElements,
|
|
1938
1938
|
onSubmit: this.handleSubmit,
|
|
1939
1939
|
onInputChange: this.handleInputChange,
|
|
1940
|
+
onCardInputValueChange: this.handleCardInputValueChange,
|
|
1940
1941
|
onMethodRender: this.handleMethodRender,
|
|
1941
1942
|
onMethodRenderError: this.handleMethodRenderError,
|
|
1942
1943
|
};
|
|
@@ -2184,9 +2185,9 @@
|
|
|
2184
2185
|
|
|
2185
2186
|
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";
|
|
2186
2187
|
|
|
2187
|
-
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\">Card holder</label>\n <input class=\"ff-card-form-cardholder-input\" id=\"cardHolderInput\" placeholder=\"Card holder\">\n <div class=\"errorContainer\"></div>\n</div>\n";
|
|
2188
|
+
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";
|
|
2188
2189
|
|
|
2189
|
-
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-
|
|
2190
|
+
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 }";
|
|
2190
2191
|
|
|
2191
2192
|
class CardSkin {
|
|
2192
2193
|
constructor(containerEl, checkoutConfig) {
|
|
@@ -2198,17 +2199,21 @@
|
|
|
2198
2199
|
expiryDate: cardInputElements.expiryDate.parentElement,
|
|
2199
2200
|
cvv: cardInputElements.cvv.parentElement,
|
|
2200
2201
|
cardholderName: cardInputElements.cardholderName?.parentElement,
|
|
2202
|
+
emailAddress: cardInputElements.emailAddress?.parentElement,
|
|
2201
2203
|
};
|
|
2202
2204
|
const errorContainer = elementsMap[name]?.querySelector('.errorContainer');
|
|
2203
2205
|
if (errorContainer) {
|
|
2204
2206
|
errorContainer.textContent = error || '';
|
|
2205
2207
|
}
|
|
2206
|
-
if (name === 'cardholderName') {
|
|
2208
|
+
if (name === 'cardholderName' || name === 'emailAddress') {
|
|
2209
|
+
const field = name === 'cardholderName'
|
|
2210
|
+
? cardInputElements.cardholderName
|
|
2211
|
+
: cardInputElements.emailAddress;
|
|
2207
2212
|
if (error) {
|
|
2208
|
-
|
|
2213
|
+
field?.classList?.add('error');
|
|
2209
2214
|
}
|
|
2210
2215
|
else {
|
|
2211
|
-
|
|
2216
|
+
field?.classList?.remove('error');
|
|
2212
2217
|
}
|
|
2213
2218
|
}
|
|
2214
2219
|
};
|
|
@@ -2240,10 +2245,23 @@
|
|
|
2240
2245
|
else {
|
|
2241
2246
|
this.containerEl.querySelector('#cardHolderInput').parentElement.style.display = 'none';
|
|
2242
2247
|
}
|
|
2248
|
+
const hasEmailInput = !!this.checkoutConfig?.card?.emailAddress?.visible;
|
|
2249
|
+
let emailAddress = undefined;
|
|
2250
|
+
if (hasEmailInput) {
|
|
2251
|
+
emailAddress =
|
|
2252
|
+
this.containerEl.querySelector('#emailAddressInput');
|
|
2253
|
+
if (emailAddress) {
|
|
2254
|
+
emailAddress.value = this.checkoutConfig.customer.email || '';
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
else {
|
|
2258
|
+
this.containerEl.querySelector('#emailAddressInput').parentElement.style.display = 'none';
|
|
2259
|
+
}
|
|
2243
2260
|
if (!cardNumber ||
|
|
2244
2261
|
!expiryDate ||
|
|
2245
2262
|
!cvv ||
|
|
2246
|
-
(hasCardholderInput && !cardholderName)
|
|
2263
|
+
(hasCardholderInput && !cardholderName) ||
|
|
2264
|
+
(hasEmailInput && !emailAddress)) {
|
|
2247
2265
|
throw new Error('One or more card input elements are missing in the default skin');
|
|
2248
2266
|
}
|
|
2249
2267
|
this.cardInputElements = {
|
|
@@ -2251,6 +2269,7 @@
|
|
|
2251
2269
|
expiryDate,
|
|
2252
2270
|
cvv,
|
|
2253
2271
|
cardholderName,
|
|
2272
|
+
emailAddress,
|
|
2254
2273
|
};
|
|
2255
2274
|
}
|
|
2256
2275
|
async init() {
|