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