@funnelfox/billing 0.13.0 → 0.13.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/dist/chunk-index.cjs.js +209 -30
- package/dist/chunk-index.cjs3.js +1 -1
- package/dist/chunk-index.es.js +209 -30
- package/dist/chunk-index.es3.js +1 -1
- package/dist/funnelfox-billing.js +210 -31
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +2 -2
- package/src/types.d.ts +42 -16
|
@@ -565,7 +565,7 @@
|
|
|
565
565
|
/**
|
|
566
566
|
* @fileoverview Constants for Funnefox SDK
|
|
567
567
|
*/
|
|
568
|
-
const SDK_VERSION = '0.13.
|
|
568
|
+
const SDK_VERSION = '0.13.2';
|
|
569
569
|
const DEFAULTS = {
|
|
570
570
|
BASE_URL: 'https://billing.funnelfox.com',
|
|
571
571
|
REGION: 'default',
|
|
@@ -1381,11 +1381,13 @@
|
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
/**
|
|
1384
|
-
* Sends the request exactly once: no retry and no client timeout
|
|
1384
|
+
* Sends the request exactly once: no retry and, without `timeoutMs`, no client timeout
|
|
1385
|
+
* (FFB-704, decision 9).
|
|
1385
1386
|
* Same URL, headers and error classes as `request()`. Used only by `silentPurchase`'s
|
|
1386
|
-
* `handle3DS` mode for `one_click` and `resume_payment`, which must not be POSTed twice
|
|
1387
|
+
* `handle3DS` mode for `one_click` and `resume_payment`, which must not be POSTed twice;
|
|
1388
|
+
* `one_click` is re-sent by the caller only with the same idempotency key.
|
|
1387
1389
|
*/
|
|
1388
|
-
async requestOnce(endpoint, options = {}) {
|
|
1390
|
+
async requestOnce(endpoint, options = {}, timeoutMs) {
|
|
1389
1391
|
const url = `${this.baseUrl}/${this.orgId}${endpoint}`;
|
|
1390
1392
|
const requestOptions = {
|
|
1391
1393
|
method: 'GET',
|
|
@@ -1397,7 +1399,10 @@
|
|
|
1397
1399
|
...options,
|
|
1398
1400
|
};
|
|
1399
1401
|
try {
|
|
1400
|
-
|
|
1402
|
+
const request = this._makeRequest(url, requestOptions);
|
|
1403
|
+
return await (timeoutMs
|
|
1404
|
+
? withTimeout(request, timeoutMs, 'Request timed out')
|
|
1405
|
+
: request);
|
|
1401
1406
|
}
|
|
1402
1407
|
catch (error) {
|
|
1403
1408
|
if (error instanceof APIError) {
|
|
@@ -1603,11 +1608,11 @@
|
|
|
1603
1608
|
}));
|
|
1604
1609
|
}
|
|
1605
1610
|
/** `one_click`, POSTed exactly once (see `requestOnce`). */
|
|
1606
|
-
async oneClickOnce(payload) {
|
|
1611
|
+
async oneClickOnce(payload, timeoutMs) {
|
|
1607
1612
|
return (await this.requestOnce(API_ENDPOINTS.ONE_CLICK, {
|
|
1608
1613
|
method: 'POST',
|
|
1609
1614
|
body: JSON.stringify(payload),
|
|
1610
|
-
}));
|
|
1615
|
+
}, timeoutMs));
|
|
1611
1616
|
}
|
|
1612
1617
|
/** `resume_payment`, POSTed exactly once (see `requestOnce`). */
|
|
1613
1618
|
async resumePaymentOnce(params) {
|
|
@@ -2160,6 +2165,9 @@
|
|
|
2160
2165
|
this.counter = 0;
|
|
2161
2166
|
this.cachedSessionResponse = null;
|
|
2162
2167
|
this.taxRecalcSeq = 0;
|
|
2168
|
+
// WebKit allows one ApplePaySession per page: a second tap while the sheet is
|
|
2169
|
+
// still opening throws InvalidAccessError, but Primer asks to start first.
|
|
2170
|
+
this.isApplePaySheetOpen = false;
|
|
2163
2171
|
this.cardSessionFieldConfig = {};
|
|
2164
2172
|
this.isTelemetryEnabled = false;
|
|
2165
2173
|
this.telemetryCleanup = null;
|
|
@@ -2326,6 +2334,7 @@
|
|
|
2326
2334
|
primerHandler.handleFailure(error?.message || 'Payment processing failed');
|
|
2327
2335
|
}
|
|
2328
2336
|
finally {
|
|
2337
|
+
this.isApplePaySheetOpen = false;
|
|
2329
2338
|
this.onLoaderChangeWithRace(false);
|
|
2330
2339
|
this._setState('ready');
|
|
2331
2340
|
}
|
|
@@ -2351,6 +2360,7 @@
|
|
|
2351
2360
|
primerHandler.handleFailure(error?.message || 'Payment processing failed');
|
|
2352
2361
|
}
|
|
2353
2362
|
finally {
|
|
2363
|
+
this.isApplePaySheetOpen = false;
|
|
2354
2364
|
this.emit(EVENTS.PURCHASE_COMPLETED);
|
|
2355
2365
|
this.onLoaderChangeWithRace(false);
|
|
2356
2366
|
this._setState('ready');
|
|
@@ -2679,6 +2689,7 @@
|
|
|
2679
2689
|
onTokenizeSuccess: this.handleTokenizeSuccess,
|
|
2680
2690
|
onResumeSuccess: this.handleResumeSuccess,
|
|
2681
2691
|
onResumeError: error => {
|
|
2692
|
+
this.isApplePaySheetOpen = false;
|
|
2682
2693
|
if (error.stack?.includes('PROCESSOR_3DS') &&
|
|
2683
2694
|
error.code === 'RESUME_ERROR' &&
|
|
2684
2695
|
error.message?.includes('fetch resume key')) {
|
|
@@ -2688,15 +2699,23 @@
|
|
|
2688
2699
|
this.emit(EVENTS.PURCHASE_FAILURE, error);
|
|
2689
2700
|
},
|
|
2690
2701
|
onCheckoutFail: error => {
|
|
2702
|
+
this.isApplePaySheetOpen = false;
|
|
2691
2703
|
this.emit(EVENTS.PURCHASE_FAILURE, error);
|
|
2692
2704
|
},
|
|
2693
2705
|
onTokenizeError: error => {
|
|
2706
|
+
this.isApplePaySheetOpen = false;
|
|
2694
2707
|
this.emit(EVENTS.PURCHASE_FAILURE, error);
|
|
2695
2708
|
},
|
|
2696
2709
|
onTokenizeStart: () => {
|
|
2697
2710
|
wasPaymentProcessedStarted = true;
|
|
2698
2711
|
},
|
|
2699
2712
|
onTokenizeShouldStart: data => {
|
|
2713
|
+
if (data.paymentMethodType === exports.PaymentMethod.APPLE_PAY) {
|
|
2714
|
+
if (this.isApplePaySheetOpen) {
|
|
2715
|
+
return false;
|
|
2716
|
+
}
|
|
2717
|
+
this.isApplePaySheetOpen = true;
|
|
2718
|
+
}
|
|
2700
2719
|
this.activePaymentMethodType = data.paymentMethodType;
|
|
2701
2720
|
this.emit(EVENTS.ERROR, undefined);
|
|
2702
2721
|
this.emit(EVENTS.START_PURCHASE, data.paymentMethodType);
|
|
@@ -2708,6 +2727,7 @@
|
|
|
2708
2727
|
this.emit(EVENTS.ERROR, undefined);
|
|
2709
2728
|
break;
|
|
2710
2729
|
case 'PAYMENT_METHOD_UNSELECTED':
|
|
2730
|
+
this.isApplePaySheetOpen = false;
|
|
2711
2731
|
if (!wasPaymentProcessedStarted) {
|
|
2712
2732
|
this.emit(EVENTS.PURCHASE_CANCELLED);
|
|
2713
2733
|
}
|
|
@@ -2987,11 +3007,23 @@
|
|
|
2987
3007
|
* checkout, tokenize a vaulted instrument through the vault manager as a stand-in, and in
|
|
2988
3008
|
* `onTokenizeSuccess` continue with the one-click `action_required_token` instead. Primer then
|
|
2989
3009
|
* shows its 3DS overlay; `onResumeSuccess` yields the resume token for `resume_payment`.
|
|
3010
|
+
*
|
|
3011
|
+
* With processor 3DS (`PROCESSOR_3DS`) Primer frames the processor's hosted 3DS page and cannot
|
|
3012
|
+
* tell a frictionless check from a challenge, and nothing reaches the page from the cross-origin
|
|
3013
|
+
* frame (FFB-758 spike). A frictionless check finishes within ~5 s, so the overlay stays
|
|
3014
|
+
* invisible for `THREE_DS_OVERLAY_REVEAL_DELAY_MS` and only then counts as a shown challenge.
|
|
2990
3015
|
*/
|
|
2991
3016
|
/** Primer client-token intents that carry a 3DS step. */
|
|
2992
3017
|
const PRIMER_3DS_INTENTS = ['3DS_AUTHENTICATION', 'PROCESSOR_3DS'];
|
|
2993
3018
|
/** Default `threeDSTimeoutMs`. */
|
|
2994
3019
|
const DEFAULT_THREE_DS_TIMEOUT_MS = 600000;
|
|
3020
|
+
/**
|
|
3021
|
+
* How long Primer's 3DS overlay stays invisible. Frictionless checks on billing-dev took
|
|
3022
|
+
* 4.2-5.0 s from overlay to resume; a real challenge is shown this much later.
|
|
3023
|
+
*/
|
|
3024
|
+
const THREE_DS_OVERLAY_REVEAL_DELAY_MS = 6000;
|
|
3025
|
+
/** Primer's 3DS overlay (Primer Web SDK 2.57.3, verified in the FFB-758 spike). */
|
|
3026
|
+
const PRIMER_OVERLAY_SELECTOR = '#primer-overlay';
|
|
2995
3027
|
/** Close button of Primer's 3DS overlay (Primer Web SDK 2.57.3, verified in the spike). */
|
|
2996
3028
|
const PRIMER_OVERLAY_CLOSE_SELECTOR = '[data-testid="OverlayContent.closeButton"]';
|
|
2997
3029
|
/** Decodes the `intent` of a Primer client token (a JWT); `null` if it is not one. */
|
|
@@ -3035,6 +3067,26 @@
|
|
|
3035
3067
|
const button = document.querySelector(PRIMER_OVERLAY_CLOSE_SELECTOR);
|
|
3036
3068
|
button?.click();
|
|
3037
3069
|
}
|
|
3070
|
+
/** Hides Primer's overlay until the returned function is called. */
|
|
3071
|
+
function hidePrimerOverlay() {
|
|
3072
|
+
if (typeof document === 'undefined') {
|
|
3073
|
+
return () => { };
|
|
3074
|
+
}
|
|
3075
|
+
const style = document.createElement('style');
|
|
3076
|
+
style.textContent = `${PRIMER_OVERLAY_SELECTOR}{opacity:0!important;pointer-events:none!important}`;
|
|
3077
|
+
document.head.appendChild(style);
|
|
3078
|
+
return () => style.remove();
|
|
3079
|
+
}
|
|
3080
|
+
/**
|
|
3081
|
+
* A Primer update that renames the overlay would leave it visible during the hidden phase, while
|
|
3082
|
+
* `threeDSChallenged` stays false for a check that finishes in that time.
|
|
3083
|
+
*/
|
|
3084
|
+
function warnIfOverlayNotFound() {
|
|
3085
|
+
if (typeof document !== 'undefined' &&
|
|
3086
|
+
!document.querySelector(PRIMER_OVERLAY_SELECTOR)) {
|
|
3087
|
+
console.warn(`[FunnelfoxSDK] Primer 3DS overlay ${PRIMER_OVERLAY_SELECTOR} not found`);
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3038
3090
|
function toPrimerError(message, error) {
|
|
3039
3091
|
return error instanceof PrimerError ? error : new PrimerError(message, error);
|
|
3040
3092
|
}
|
|
@@ -3065,6 +3117,9 @@
|
|
|
3065
3117
|
return new Promise(resolve => {
|
|
3066
3118
|
let settled = false;
|
|
3067
3119
|
let tokenized = false;
|
|
3120
|
+
let revealed = false;
|
|
3121
|
+
let revealTimer = null;
|
|
3122
|
+
let showOverlay = () => { };
|
|
3068
3123
|
// True only while create_client_session is in flight.
|
|
3069
3124
|
let sessionInFlight = false;
|
|
3070
3125
|
let timer = null;
|
|
@@ -3078,12 +3133,17 @@
|
|
|
3078
3133
|
clearTimeout(timer);
|
|
3079
3134
|
timer = null;
|
|
3080
3135
|
}
|
|
3136
|
+
if (revealTimer) {
|
|
3137
|
+
clearTimeout(revealTimer);
|
|
3138
|
+
revealTimer = null;
|
|
3139
|
+
}
|
|
3140
|
+
showOverlay();
|
|
3081
3141
|
headless = null;
|
|
3082
3142
|
resolve(result);
|
|
3083
3143
|
};
|
|
3084
|
-
|
|
3144
|
+
const onTimeout = () => {
|
|
3085
3145
|
timer = null;
|
|
3086
|
-
if (
|
|
3146
|
+
if (revealed) {
|
|
3087
3147
|
// The challenge was shown and the customer did not finish it.
|
|
3088
3148
|
settle({ kind: 'abandoned' });
|
|
3089
3149
|
// Close Primer's overlay; the close error it raises is ignored (already settled).
|
|
@@ -3099,17 +3159,37 @@
|
|
|
3099
3159
|
});
|
|
3100
3160
|
return;
|
|
3101
3161
|
}
|
|
3162
|
+
if (tokenized) {
|
|
3163
|
+
// The overlay is about to be shown: the reveal restarts the timer.
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3102
3166
|
settle({
|
|
3103
3167
|
kind: 'error',
|
|
3104
3168
|
error: new PrimerError('Timed out before the 3DS challenge was shown (threeDSTimeoutMs)'),
|
|
3105
3169
|
});
|
|
3106
|
-
}
|
|
3170
|
+
};
|
|
3171
|
+
timer = setTimeout(onTimeout, timeoutMs);
|
|
3107
3172
|
const onTokenizeSuccess = (_data, handler) => {
|
|
3108
|
-
|
|
3173
|
+
// A repeated tokenization would start a second reveal timer, so the challenge
|
|
3174
|
+
// (and the caller's onThreeDSStart) would be reported twice: refuse it.
|
|
3175
|
+
if (settled || tokenized) {
|
|
3109
3176
|
callSafely(() => handler.handleFailure());
|
|
3110
3177
|
return;
|
|
3111
3178
|
}
|
|
3112
3179
|
tokenized = true;
|
|
3180
|
+
showOverlay = hidePrimerOverlay();
|
|
3181
|
+
revealTimer = setTimeout(() => {
|
|
3182
|
+
revealTimer = null;
|
|
3183
|
+
revealed = true;
|
|
3184
|
+
showOverlay();
|
|
3185
|
+
warnIfOverlayNotFound();
|
|
3186
|
+
callSafely(params.onChallengeShown);
|
|
3187
|
+
// The whole timeout belongs to the challenge the customer can see.
|
|
3188
|
+
if (timer) {
|
|
3189
|
+
clearTimeout(timer);
|
|
3190
|
+
}
|
|
3191
|
+
timer = setTimeout(onTimeout, timeoutMs);
|
|
3192
|
+
}, params.revealDelayMs);
|
|
3113
3193
|
// Ignore the stand-in vaulted token: run the one-click 3DS action instead.
|
|
3114
3194
|
handler.continueWithNewClientToken(actionToken);
|
|
3115
3195
|
};
|
|
@@ -3123,6 +3203,10 @@
|
|
|
3123
3203
|
clearTimeout(timer);
|
|
3124
3204
|
timer = null;
|
|
3125
3205
|
}
|
|
3206
|
+
if (revealTimer) {
|
|
3207
|
+
clearTimeout(revealTimer);
|
|
3208
|
+
revealTimer = null;
|
|
3209
|
+
}
|
|
3126
3210
|
let response;
|
|
3127
3211
|
try {
|
|
3128
3212
|
response = await apiClient.resumePaymentOnce({
|
|
@@ -3376,7 +3460,80 @@
|
|
|
3376
3460
|
}
|
|
3377
3461
|
const ONE_CLICK_IN_PROGRESS = 'one_click_in_progress';
|
|
3378
3462
|
const DOUBLE_PURCHASE = 'double_purchase';
|
|
3463
|
+
const IDEMPOTENCY_KEY_IN_PROGRESS = 'idempotency_key_in_progress';
|
|
3464
|
+
const ONE_CLICK_RETRY_DELAYS_MS = [1000, 2000, 4000];
|
|
3465
|
+
/** Longer than the backend's wait for the user's lock (~12.6 s). */
|
|
3466
|
+
const ONE_CLICK_TIMEOUT_MS = 25000;
|
|
3379
3467
|
const oneClickInFlight = new Set();
|
|
3468
|
+
/** A random UUID v4, or `null` when the browser has no crypto (then one_click is not retried). */
|
|
3469
|
+
function createIdempotencyKey() {
|
|
3470
|
+
const cryptoApi = typeof crypto === 'undefined' ? undefined : crypto;
|
|
3471
|
+
if (typeof cryptoApi?.randomUUID === 'function') {
|
|
3472
|
+
return cryptoApi.randomUUID();
|
|
3473
|
+
}
|
|
3474
|
+
if (typeof cryptoApi?.getRandomValues !== 'function') {
|
|
3475
|
+
return null;
|
|
3476
|
+
}
|
|
3477
|
+
const bytes = cryptoApi.getRandomValues(new Uint8Array(16));
|
|
3478
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
3479
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
3480
|
+
const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, '0'));
|
|
3481
|
+
return [
|
|
3482
|
+
hex.slice(0, 4).join(''),
|
|
3483
|
+
hex.slice(4, 6).join(''),
|
|
3484
|
+
hex.slice(6, 8).join(''),
|
|
3485
|
+
hex.slice(8, 10).join(''),
|
|
3486
|
+
hex.slice(10, 16).join(''),
|
|
3487
|
+
].join('-');
|
|
3488
|
+
}
|
|
3489
|
+
/**
|
|
3490
|
+
* Failures after which the backend may or may not have processed the request. Retrying them
|
|
3491
|
+
* with the same idempotency key is safe: the backend never charges a key twice (FFB-757).
|
|
3492
|
+
* A 2xx APIError means the body could not be parsed.
|
|
3493
|
+
*/
|
|
3494
|
+
function isRetryableOneClickError(error) {
|
|
3495
|
+
if (error instanceof NetworkError) {
|
|
3496
|
+
return true;
|
|
3497
|
+
}
|
|
3498
|
+
if (!(error instanceof APIError) || error.statusCode === null) {
|
|
3499
|
+
return false;
|
|
3500
|
+
}
|
|
3501
|
+
if (error.statusCode >= 500) {
|
|
3502
|
+
return true;
|
|
3503
|
+
}
|
|
3504
|
+
if (error.statusCode >= 200 && error.statusCode < 300) {
|
|
3505
|
+
return true;
|
|
3506
|
+
}
|
|
3507
|
+
return (error.statusCode === 400 && error.errorCode === IDEMPOTENCY_KEY_IN_PROGRESS);
|
|
3508
|
+
}
|
|
3509
|
+
function isEmptyResponse(response) {
|
|
3510
|
+
return !response || typeof response !== 'object' || !('status' in response);
|
|
3511
|
+
}
|
|
3512
|
+
/** `one_click`, retried with the same idempotency key; sent once when there is no key. */
|
|
3513
|
+
async function postOneClick(apiClient, payload) {
|
|
3514
|
+
if (!payload.idempotency_key) {
|
|
3515
|
+
return apiClient.oneClickOnce(payload);
|
|
3516
|
+
}
|
|
3517
|
+
for (const delay of ONE_CLICK_RETRY_DELAYS_MS) {
|
|
3518
|
+
try {
|
|
3519
|
+
const response = await apiClient.oneClickOnce(payload, ONE_CLICK_TIMEOUT_MS);
|
|
3520
|
+
if (!isEmptyResponse(response)) {
|
|
3521
|
+
return response;
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
catch (error) {
|
|
3525
|
+
if (!isRetryableOneClickError(error)) {
|
|
3526
|
+
throw error;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
await sleep(delay);
|
|
3530
|
+
}
|
|
3531
|
+
const response = await apiClient.oneClickOnce(payload, ONE_CLICK_TIMEOUT_MS);
|
|
3532
|
+
if (isEmptyResponse(response)) {
|
|
3533
|
+
throw new NetworkError('one_click returned an empty response');
|
|
3534
|
+
}
|
|
3535
|
+
return response;
|
|
3536
|
+
}
|
|
3380
3537
|
function declineFields(data) {
|
|
3381
3538
|
return {
|
|
3382
3539
|
failedMessageForUser: data.failed_message_for_user ?? null,
|
|
@@ -3465,7 +3622,7 @@
|
|
|
3465
3622
|
}
|
|
3466
3623
|
}
|
|
3467
3624
|
/** Maps a `resume_payment` response after a challenge (rows 5, 6, 6b, 6c, 7, 8). */
|
|
3468
|
-
function mapResumeResponse(response, orderId, threeDSAuthDeclineCodes = THREE_DS_AUTH_DECLINE_CODES) {
|
|
3625
|
+
function mapResumeResponse(response, orderId, threeDSChallenged, threeDSAuthDeclineCodes = THREE_DS_AUTH_DECLINE_CODES) {
|
|
3469
3626
|
const data = response?.data;
|
|
3470
3627
|
if (response?.status !== 'success' || !data) {
|
|
3471
3628
|
return {
|
|
@@ -3473,7 +3630,7 @@
|
|
|
3473
3630
|
result: {
|
|
3474
3631
|
outcome: 'error',
|
|
3475
3632
|
orderId,
|
|
3476
|
-
threeDSChallenged
|
|
3633
|
+
threeDSChallenged,
|
|
3477
3634
|
error: envelopeError(response, 'Resume payment failed'),
|
|
3478
3635
|
failedRequest: 'resume_payment',
|
|
3479
3636
|
},
|
|
@@ -3486,7 +3643,7 @@
|
|
|
3486
3643
|
result: {
|
|
3487
3644
|
outcome: 'error',
|
|
3488
3645
|
orderId,
|
|
3489
|
-
threeDSChallenged
|
|
3646
|
+
threeDSChallenged,
|
|
3490
3647
|
error: new FunnefoxSDKError('resume_payment returned another action token; chained 3DS is not supported', 'one_click_chained_action'),
|
|
3491
3648
|
},
|
|
3492
3649
|
};
|
|
@@ -3495,22 +3652,24 @@
|
|
|
3495
3652
|
case 'succeeded':
|
|
3496
3653
|
return {
|
|
3497
3654
|
threeDS: 'passed',
|
|
3498
|
-
result: { outcome: 'succeeded', orderId, threeDSChallenged
|
|
3655
|
+
result: { outcome: 'succeeded', orderId, threeDSChallenged },
|
|
3499
3656
|
};
|
|
3500
3657
|
case 'processing':
|
|
3501
3658
|
return {
|
|
3502
3659
|
threeDS: 'passed',
|
|
3503
|
-
result: { outcome: 'processing', orderId, threeDSChallenged
|
|
3660
|
+
result: { outcome: 'processing', orderId, threeDSChallenged },
|
|
3504
3661
|
};
|
|
3505
3662
|
case 'failed': {
|
|
3506
|
-
|
|
3507
|
-
|
|
3663
|
+
// Without a shown challenge the customer saw no 3DS step: a decline is a plain decline.
|
|
3664
|
+
const authFailed = threeDSChallenged &&
|
|
3665
|
+
(threeDSAuthDeclineCodes === null ||
|
|
3666
|
+
threeDSAuthDeclineCodes.includes(data.decline_code ?? ''));
|
|
3508
3667
|
return {
|
|
3509
3668
|
threeDS: authFailed ? 'failed' : 'passed',
|
|
3510
3669
|
result: {
|
|
3511
3670
|
outcome: authFailed ? '3ds_failed' : 'declined',
|
|
3512
3671
|
orderId,
|
|
3513
|
-
threeDSChallenged
|
|
3672
|
+
threeDSChallenged,
|
|
3514
3673
|
...declineFields(data),
|
|
3515
3674
|
},
|
|
3516
3675
|
};
|
|
@@ -3521,7 +3680,7 @@
|
|
|
3521
3680
|
result: {
|
|
3522
3681
|
outcome: 'error',
|
|
3523
3682
|
orderId,
|
|
3524
|
-
threeDSChallenged
|
|
3683
|
+
threeDSChallenged,
|
|
3525
3684
|
error: new APIError(data.checkout_status === 'cancelled'
|
|
3526
3685
|
? 'Payment was cancelled'
|
|
3527
3686
|
: `Unhandled checkout status: ${data.checkout_status}`, null, { response }),
|
|
@@ -3529,30 +3688,30 @@
|
|
|
3529
3688
|
};
|
|
3530
3689
|
}
|
|
3531
3690
|
}
|
|
3532
|
-
function mapThreeDSRun(run, orderId) {
|
|
3691
|
+
function mapThreeDSRun(run, orderId, threeDSChallenged) {
|
|
3533
3692
|
switch (run.kind) {
|
|
3534
3693
|
case 'resumed':
|
|
3535
|
-
return mapResumeResponse(run.response, orderId);
|
|
3694
|
+
return mapResumeResponse(run.response, orderId, threeDSChallenged);
|
|
3536
3695
|
case 'failed':
|
|
3537
3696
|
return {
|
|
3538
3697
|
threeDS: 'failed',
|
|
3539
3698
|
result: {
|
|
3540
3699
|
outcome: '3ds_failed',
|
|
3541
3700
|
orderId,
|
|
3542
|
-
threeDSChallenged
|
|
3701
|
+
threeDSChallenged,
|
|
3543
3702
|
error: run.error,
|
|
3544
3703
|
},
|
|
3545
3704
|
};
|
|
3546
3705
|
case 'abandoned':
|
|
3547
3706
|
return {
|
|
3548
3707
|
threeDS: 'abandoned',
|
|
3549
|
-
result: { outcome: '3ds_abandoned', orderId, threeDSChallenged
|
|
3708
|
+
result: { outcome: '3ds_abandoned', orderId, threeDSChallenged },
|
|
3550
3709
|
};
|
|
3551
3710
|
default: {
|
|
3552
3711
|
const result = {
|
|
3553
3712
|
outcome: 'error',
|
|
3554
3713
|
orderId,
|
|
3555
|
-
threeDSChallenged
|
|
3714
|
+
threeDSChallenged,
|
|
3556
3715
|
error: run.error,
|
|
3557
3716
|
};
|
|
3558
3717
|
if (run.failedRequest) {
|
|
@@ -3615,9 +3774,14 @@
|
|
|
3615
3774
|
timeout: DEFAULTS.REQUEST_TIMEOUT,
|
|
3616
3775
|
retryAttempts: DEFAULTS.RETRY_ATTEMPTS,
|
|
3617
3776
|
});
|
|
3777
|
+
const payload = buildOneClickRequest(options);
|
|
3778
|
+
const idempotencyKey = createIdempotencyKey();
|
|
3779
|
+
if (idempotencyKey) {
|
|
3780
|
+
payload.idempotency_key = idempotencyKey;
|
|
3781
|
+
}
|
|
3618
3782
|
let response;
|
|
3619
3783
|
try {
|
|
3620
|
-
response = await apiClient
|
|
3784
|
+
response = await postOneClick(apiClient, payload);
|
|
3621
3785
|
}
|
|
3622
3786
|
catch (error) {
|
|
3623
3787
|
if (error instanceof APIError &&
|
|
@@ -3628,6 +3792,16 @@
|
|
|
3628
3792
|
threeDSChallenged: false,
|
|
3629
3793
|
};
|
|
3630
3794
|
}
|
|
3795
|
+
if (idempotencyKey && isRetryableOneClickError(error)) {
|
|
3796
|
+
// The charge may have gone through: the caller must not start a new payment.
|
|
3797
|
+
return {
|
|
3798
|
+
outcome: 'processing',
|
|
3799
|
+
orderId: null,
|
|
3800
|
+
threeDSChallenged: false,
|
|
3801
|
+
error: error,
|
|
3802
|
+
failedRequest: 'one_click',
|
|
3803
|
+
};
|
|
3804
|
+
}
|
|
3631
3805
|
return {
|
|
3632
3806
|
outcome: 'error',
|
|
3633
3807
|
orderId: null,
|
|
@@ -3641,15 +3815,15 @@
|
|
|
3641
3815
|
return step.result;
|
|
3642
3816
|
}
|
|
3643
3817
|
const { orderId, actionToken } = step;
|
|
3818
|
+
let challenged = false;
|
|
3644
3819
|
let ended = false;
|
|
3645
3820
|
const end = (result) => {
|
|
3646
|
-
if (ended) {
|
|
3821
|
+
if (!challenged || ended) {
|
|
3647
3822
|
return;
|
|
3648
3823
|
}
|
|
3649
3824
|
ended = true;
|
|
3650
3825
|
callHook('onThreeDSEnd', options.onThreeDSEnd, { result });
|
|
3651
3826
|
};
|
|
3652
|
-
callHook('onThreeDSStart', options.onThreeDSStart, { orderId });
|
|
3653
3827
|
try {
|
|
3654
3828
|
const run = await runOneClickThreeDS({
|
|
3655
3829
|
apiClient,
|
|
@@ -3659,8 +3833,13 @@
|
|
|
3659
3833
|
orderId,
|
|
3660
3834
|
actionToken,
|
|
3661
3835
|
timeoutMs: options.threeDSTimeoutMs ?? DEFAULT_THREE_DS_TIMEOUT_MS,
|
|
3836
|
+
revealDelayMs: THREE_DS_OVERLAY_REVEAL_DELAY_MS,
|
|
3837
|
+
onChallengeShown: () => {
|
|
3838
|
+
challenged = true;
|
|
3839
|
+
callHook('onThreeDSStart', options.onThreeDSStart, { orderId });
|
|
3840
|
+
},
|
|
3662
3841
|
});
|
|
3663
|
-
const mapped = mapThreeDSRun(run, orderId);
|
|
3842
|
+
const mapped = mapThreeDSRun(run, orderId, challenged);
|
|
3664
3843
|
end(mapped.threeDS);
|
|
3665
3844
|
return mapped.result;
|
|
3666
3845
|
}
|
|
@@ -3669,7 +3848,7 @@
|
|
|
3669
3848
|
return {
|
|
3670
3849
|
outcome: 'error',
|
|
3671
3850
|
orderId,
|
|
3672
|
-
threeDSChallenged:
|
|
3851
|
+
threeDSChallenged: challenged,
|
|
3673
3852
|
error: error instanceof Error
|
|
3674
3853
|
? error
|
|
3675
3854
|
: new FunnefoxSDKError('One-click 3DS step failed', undefined, error),
|
|
@@ -3896,7 +4075,7 @@
|
|
|
3896
4075
|
|
|
3897
4076
|
var template = "<div>\n <label class=\"ff-card-form-label\" for=\"cardNumberInput\">Card number</label>\n <div id=\"cardNumberInput\"></div>\n <div class=\"errorContainer\"></div>\n</div>\n<div class=\"card-form-row\">\n <div>\n <label class=\"ff-card-form-label\" for=\"expiryInput\">Expiration date</label>\n <div id=\"expiryInput\"></div>\n <div class=\"errorContainer\"></div>\n </div>\n <div>\n <label class=\"ff-card-form-label\" for=\"cvvInput\">Security code</label>\n <div id=\"cvvInput\">\n <svg width=\"200\" height=\"200\" viewBox=\"0 0 200 200\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"200\" fill=\"transparent\"/>\n <g clip-path=\"url(#clip0_0_1)\">\n <path d=\"M157.555 23C168.279 23.0002 177 31.7394 177 42.4854V80.5889C171.946 72.0151 164.749 64.8558 156.146 59.8457H166.394V42.4854C166.393 37.6004 162.43 33.6291 157.555 33.6289H27.4453C22.5704 33.6291 18.6066 37.6004 18.6064 42.4854V59.8457H97.8535C88.9153 65.0512 81.4954 72.5771 76.4189 81.5986H18.6064V127.515C18.6066 132.4 22.5704 136.371 27.4453 136.371H75.3281C77.2742 140.177 79.6285 143.739 82.333 147H27.4453C16.7215 147 8.00019 138.261 8 127.515V42.4854C8.0002 31.7394 16.7215 23.0002 27.4453 23H157.555Z\" fill=\"#93939A\"/>\n <mask id=\"path-2-outside-1_0_1\" maskUnits=\"userSpaceOnUse\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\" fill=\"black\">\n <rect fill=\"white\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\"/>\n </mask>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" fill=\"#93939A\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" stroke=\"transparent\" stroke-width=\"20\" mask=\"url(#path-2-outside-1_0_1)\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_0_1\">\n <rect width=\"200\" height=\"200\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n <div class=\"errorContainer\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"cardHolderInput\">Cardholder name</label>\n <input class=\"ff-card-form-text-input\" id=\"cardHolderInput\" type=\"text\" pattern=\"[A-Za-z\\s]+\" placeholder=\"Full name on card\">\n <div class=\"errorContainer\"></div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"emailAddressInput\">Email</label>\n <input class=\"ff-card-form-text-input\" id=\"emailAddressInput\" placeholder=\"Email\" type=\"email\">\n <div class=\"errorContainer\"></div>\n</div>\n<div id=\"countrySelectorField\">\n <label class=\"ff-card-form-label\" for=\"countrySelectorInput\">Country</label>\n <div class=\"ff-select-wrap\">\n <select class=\"ff-card-form-text-input ff-card-form-select\" id=\"countrySelectorInput\"></select>\n <div class=\"ff-select-arrow\" aria-hidden=\"true\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"postalCodeInput\">Zip code</label>\n <input class=\"ff-card-form-text-input\" id=\"postalCodeInput\" placeholder=\"12345\">\n <div class=\"errorContainer\"></div>\n</div>\n";
|
|
3898
4077
|
|
|
3899
|
-
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:
|
|
4078
|
+
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: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n grid-template-rows: repeat(3, auto);\n grid-auto-flow: column;\n column-gap: 10px;\n }\n\n /* Label, input and error of both columns share grid rows, so a label that wraps in one column\n moves both inputs down together, and an error under one input does not move the other. */\n .card-form-row > div {\n display: contents;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #df1b41;\n font-size: 15px;\n line-height: 1.15;\n margin: 4px 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 }\n";
|
|
3900
4079
|
|
|
3901
4080
|
class CardSkin {
|
|
3902
4081
|
constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {
|