@funnelfox/billing 0.8.0-ffb-837.55 → 0.8.0-main.60

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.
@@ -125,6 +125,7 @@
125
125
  this.response = options.response || null;
126
126
  this.declineCode = options.declineCode || null;
127
127
  this.declineCodeSource = options.declineCodeSource || null;
128
+ this.retryAfterMs = options.retryAfterMs ?? null;
128
129
  }
129
130
  }
130
131
  class PrimerError extends FunnefoxSDKError {
@@ -364,6 +365,9 @@
364
365
  return {
365
366
  ...resolveTaxAmount(source),
366
367
  ...resolveTaxBreakdown(source.tax_breakdown),
368
+ ...(source.update_total_in_funnel != null
369
+ ? { updateTotalInFunnel: source.update_total_in_funnel }
370
+ : {}),
367
371
  };
368
372
  }
369
373
  function resolveTaxBreakdown(breakdown) {
@@ -450,7 +454,7 @@
450
454
  function sleep(ms) {
451
455
  return new Promise(resolve => setTimeout(resolve, ms));
452
456
  }
453
- async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
457
+ async function retry(fn, maxAttempts = 3, baseDelay = 1000, delayFor) {
454
458
  let lastError;
455
459
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
456
460
  try {
@@ -460,7 +464,7 @@
460
464
  lastError = error;
461
465
  if (attempt === maxAttempts)
462
466
  throw lastError;
463
- const delay = baseDelay * Math.pow(2, attempt - 1);
467
+ const delay = delayFor?.(error) ?? baseDelay * Math.pow(2, attempt - 1);
464
468
  await sleep(delay);
465
469
  }
466
470
  }
@@ -565,7 +569,7 @@
565
569
  /**
566
570
  * @fileoverview Constants for Funnefox SDK
567
571
  */
568
- const SDK_VERSION = '0.8.0-ffb-837.55';
572
+ const SDK_VERSION = '0.8.0-main.60';
569
573
  const DEFAULTS = {
570
574
  BASE_URL: 'https://billing.funnelfox.com',
571
575
  REGION: 'default',
@@ -573,6 +577,7 @@
573
577
  REQUEST_TIMEOUT: 30000,
574
578
  RETRY_ATTEMPTS: 3,
575
579
  RETRY_BASE_DELAY: 1000,
580
+ MAX_RETRY_AFTER: 10000,
576
581
  };
577
582
  const CHECKOUT_STATES = {
578
583
  INITIALIZING: 'initializing',
@@ -1348,9 +1353,42 @@
1348
1353
  return failure;
1349
1354
  }
1350
1355
 
1356
+ const CURRENCY_CODE = /^[A-Za-z]{3}$/;
1357
+ const COUNTRY_CODE = /^[A-Za-z]{2}$/;
1358
+ // Billing checks the code length before trimming it, so " EUR" or "EURO" fails the whole session
1359
+ // with a 422. An unknown currency is never an error there: left out, the price point's own one is
1360
+ // charged. A malformed code is dropped here for the same outcome instead of a checkout that never opens.
1361
+ function normalizeCode(value, pattern, option) {
1362
+ if (value === undefined || value === null || value === '') {
1363
+ return undefined;
1364
+ }
1365
+ const code = typeof value === 'string' ? value.trim() : '';
1366
+ if (!pattern.test(code)) {
1367
+ console.warn(`[funnelfox-billing] ${option} "${String(value)}" is not a valid code, so it is not sent`);
1368
+ return undefined;
1369
+ }
1370
+ return code.toUpperCase();
1371
+ }
1372
+ function normalizeDisplayCurrency(value) {
1373
+ return normalizeCode(value, CURRENCY_CODE, 'displayCurrency');
1374
+ }
1375
+ function normalizeDisplayCountry(value) {
1376
+ return normalizeCode(value, COUNTRY_CODE, 'displayCountry');
1377
+ }
1378
+
1351
1379
  /**
1352
1380
  * @fileoverview API client for Funnefox backend integration
1353
1381
  */
1382
+ function parseRetryAfter(response) {
1383
+ const seconds = Number(response.headers?.get('Retry-After'));
1384
+ if (response.status !== 429 || !Number.isFinite(seconds) || seconds <= 0) {
1385
+ return null;
1386
+ }
1387
+ return Math.min(seconds * 1000, DEFAULTS.MAX_RETRY_AFTER);
1388
+ }
1389
+ function retryAfterMs(error) {
1390
+ return error instanceof APIError ? error.retryAfterMs : null;
1391
+ }
1354
1392
  class APIClient {
1355
1393
  constructor(config) {
1356
1394
  this.baseUrl = config.baseUrl.replace(/\/$/, '');
@@ -1372,7 +1410,7 @@
1372
1410
  try {
1373
1411
  return await retry(async () => {
1374
1412
  return await withTimeout(this._makeRequest(url, requestOptions), this.timeout, 'Request timed out');
1375
- }, this.retryAttempts);
1413
+ }, this.retryAttempts, DEFAULTS.RETRY_BASE_DELAY, retryAfterMs);
1376
1414
  }
1377
1415
  catch (error) {
1378
1416
  if (error instanceof Error && error.name === 'APIError') {
@@ -1440,6 +1478,7 @@
1440
1478
  const message = d.error?.[0]?.msg || 'Failed to create payment';
1441
1479
  throw new APIError(message, response.status, {
1442
1480
  response: data,
1481
+ retryAfterMs: parseRetryAfter(response),
1443
1482
  });
1444
1483
  }
1445
1484
  return data;
@@ -1456,6 +1495,14 @@
1456
1495
  if (params.countryCode !== undefined) {
1457
1496
  payload.country_code = params.countryCode;
1458
1497
  }
1498
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1499
+ if (displayCurrency) {
1500
+ payload.display_currency_code = displayCurrency;
1501
+ }
1502
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1503
+ if (displayCountry) {
1504
+ payload.display_country_code = displayCountry;
1505
+ }
1459
1506
  return (await this.request(API_ENDPOINTS.CREATE_CLIENT_SESSION, {
1460
1507
  method: 'POST',
1461
1508
  body: JSON.stringify(payload),
@@ -1468,6 +1515,14 @@
1468
1515
  pp_ident: params.priceId,
1469
1516
  client_metadata: params.clientMetadata || {},
1470
1517
  };
1518
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1519
+ if (displayCurrency) {
1520
+ payload.display_currency_code = displayCurrency;
1521
+ }
1522
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1523
+ if (displayCountry) {
1524
+ payload.display_country_code = displayCountry;
1525
+ }
1471
1526
  return await this.request(API_ENDPOINTS.UPDATE_CLIENT_SESSION, {
1472
1527
  method: 'POST',
1473
1528
  body: JSON.stringify(payload),
@@ -1667,10 +1722,13 @@
1667
1722
  p.baseUrl || DEFAULTS.BASE_URL,
1668
1723
  p.region || DEFAULTS.REGION,
1669
1724
  p.countryCode ?? '',
1725
+ p.displayCurrency ?? '',
1726
+ p.displayCountry ?? '',
1670
1727
  p.priceId,
1671
1728
  p.externalId,
1672
1729
  p.email,
1673
1730
  p.integration,
1731
+ p.sessionScope ?? '',
1674
1732
  ].join('|');
1675
1733
  }
1676
1734
  makeClient(orgId, baseUrl) {
@@ -1694,6 +1752,8 @@
1694
1752
  region: p.region || DEFAULTS.REGION,
1695
1753
  clientMetadata: p.clientMetadata,
1696
1754
  countryCode: p.countryCode,
1755
+ displayCurrency: p.displayCurrency,
1756
+ displayCountry: p.displayCountry,
1697
1757
  integration: p.integration,
1698
1758
  });
1699
1759
  this.cache.set(key, req);
@@ -1716,6 +1776,19 @@
1716
1776
  }
1717
1777
  var sessionService = new SessionService();
1718
1778
 
1779
+ const tails = new Map();
1780
+ function enqueueForOrder(key, task) {
1781
+ const run = (tails.get(key) ?? Promise.resolve()).then(task);
1782
+ const tail = run.then(() => undefined, () => undefined);
1783
+ tails.set(key, tail);
1784
+ void tail.then(() => {
1785
+ if (tails.get(key) === tail) {
1786
+ tails.delete(key);
1787
+ }
1788
+ });
1789
+ return run;
1790
+ }
1791
+
1719
1792
  var loaderHtml = "<div class=\"ff-sdk-loader-container\">\n <div class=\"ff-sdk-loader\"></div>\n</div>\n";
1720
1793
 
1721
1794
  if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent=".ff-sdk-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.ff-sdk-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 }";
@@ -2276,9 +2349,17 @@
2276
2349
  this.checkoutConfig.onTaxError?.(err);
2277
2350
  }
2278
2351
  };
2352
+ this.canRecalcTax = () => !!this.orderId && !!this.getSelectedCountryCode();
2279
2353
  this.scheduleTaxRecalc = () => {
2280
2354
  if (this.taxRecalcDebounce) {
2281
2355
  clearTimeout(this.taxRecalcDebounce);
2356
+ this.taxRecalcDebounce = undefined;
2357
+ if (!this.canRecalcTax() && this.lastTaxInfo) {
2358
+ this.emitTaxInfo(this.lastTaxInfo);
2359
+ }
2360
+ }
2361
+ if (!this.canRecalcTax()) {
2362
+ return;
2282
2363
  }
2283
2364
  this.checkoutConfig.onTaxPending?.();
2284
2365
  this.emit(EVENTS.TAX_PENDING);
@@ -2454,8 +2535,8 @@
2454
2535
  this.hideInitializingLoader();
2455
2536
  }
2456
2537
  }
2457
- async createSession() {
2458
- const response = await sessionService.createSession({
2538
+ sessionParams() {
2539
+ return {
2459
2540
  orgId: this.orgId,
2460
2541
  baseUrl: this.baseUrl,
2461
2542
  priceId: this.checkoutConfig.priceId,
@@ -2464,8 +2545,14 @@
2464
2545
  region: this.region,
2465
2546
  clientMetadata: this.checkoutConfig.clientMetadata,
2466
2547
  countryCode: this.checkoutConfig.customer.countryCode,
2548
+ displayCurrency: this.checkoutConfig.displayCurrency,
2549
+ displayCountry: this.checkoutConfig.displayCountry,
2550
+ sessionScope: this.checkoutConfig.sessionScope,
2467
2551
  integration: 'primer',
2468
- });
2552
+ };
2553
+ }
2554
+ async createSession() {
2555
+ const response = await sessionService.createSession(this.sessionParams());
2469
2556
  const sessionResponse = response;
2470
2557
  if (response.data?.stripe_public_key && !sessionResponse.radarSessionId) {
2471
2558
  const stripePublicKey = response.data.stripe_public_key;
@@ -2745,7 +2832,10 @@
2745
2832
  },
2746
2833
  };
2747
2834
  }
2748
- async updatePrice(newPriceId, clientMetadata) {
2835
+ updatePrice(newPriceId, clientMetadata, displayLocale) {
2836
+ return enqueueForOrder(this.orderId ?? `checkout:${this.id}`, () => this.applyPrice(newPriceId, clientMetadata, displayLocale));
2837
+ }
2838
+ async applyPrice(newPriceId, clientMetadata, displayLocale) {
2749
2839
  this._ensureNotDestroyed();
2750
2840
  requireString(newPriceId, 'priceId');
2751
2841
  if (this.state === 'processing') {
@@ -2754,14 +2844,20 @@
2754
2844
  try {
2755
2845
  this.onLoaderChangeWithRace(true);
2756
2846
  this._setState('updating');
2757
- sessionService.clearCache();
2847
+ sessionService.invalidate(this.sessionParams());
2848
+ const displayCurrency = displayLocale?.displayCurrency ?? this.checkoutConfig.displayCurrency;
2849
+ const displayCountry = displayLocale?.displayCountry ?? this.checkoutConfig.displayCountry;
2758
2850
  await this.apiClient.updateClientSession({
2759
2851
  orderId: this.orderId,
2760
2852
  clientToken: this.clientToken,
2761
2853
  priceId: newPriceId,
2762
2854
  clientMetadata,
2855
+ displayCurrency,
2856
+ displayCountry,
2763
2857
  });
2764
2858
  this.checkoutConfig.priceId = newPriceId;
2859
+ this.checkoutConfig.displayCurrency = displayCurrency;
2860
+ this.checkoutConfig.displayCountry = displayCountry;
2765
2861
  await this.primerWrapper.refreshClientSession();
2766
2862
  this.onLoaderChangeWithRace(false);
2767
2863
  this._setState('ready');
@@ -2790,7 +2886,7 @@
2790
2886
  return;
2791
2887
  try {
2792
2888
  this.stopUnhandledTelemetry();
2793
- sessionService.clearCache();
2889
+ sessionService.invalidate(this.sessionParams());
2794
2890
  await this.primerWrapper.destroy();
2795
2891
  this._setState('destroyed');
2796
2892
  this.orderId = null;
@@ -2974,6 +3070,7 @@
2974
3070
  await methodInterface.destroy();
2975
3071
  await this.destroy();
2976
3072
  },
3073
+ updatePrice: (newPriceId, clientMetadata, displayLocale) => this.updatePrice(newPriceId, clientMetadata, displayLocale),
2977
3074
  };
2978
3075
  }
2979
3076
  startUnhandledTelemetry(paymentMethod) {
@@ -3393,7 +3490,7 @@
3393
3490
  }
3394
3491
  }
3395
3492
  async function createClientSession(params) {
3396
- const { priceId, externalId, email, clientMetadata, countryCode } = params;
3493
+ const { priceId, externalId, email, clientMetadata, countryCode, displayCurrency, displayCountry, } = params;
3397
3494
  const config = resolveConfig(params, 'createClientSession');
3398
3495
  const apiClient = new APIClient({
3399
3496
  baseUrl: config.baseUrl,
@@ -3408,6 +3505,8 @@
3408
3505
  region: config.region,
3409
3506
  clientMetadata,
3410
3507
  countryCode,
3508
+ displayCurrency,
3509
+ displayCountry,
3411
3510
  });
3412
3511
  return apiClient.processSessionResponse(sessionResponse);
3413
3512
  }
@@ -3426,6 +3525,10 @@
3426
3525
  if (options.citCardNetworks !== undefined) {
3427
3526
  payload.cit_card_networks = options.citCardNetworks;
3428
3527
  }
3528
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
3529
+ if (displayCurrency) {
3530
+ payload.display_currency_code = displayCurrency;
3531
+ }
3429
3532
  return payload;
3430
3533
  }
3431
3534
  function silentPurchase(options) {
@@ -3881,6 +3984,9 @@
3881
3984
  },
3882
3985
  container: '',
3883
3986
  clientMetadata: options.meta,
3987
+ displayCurrency: options.displayCurrency,
3988
+ displayCountry: options.displayCountry,
3989
+ sessionScope: options.sessionScope,
3884
3990
  card: options.card,
3885
3991
  style: options.style,
3886
3992
  applePay: {
@@ -3972,6 +4078,8 @@
3972
4078
  email: params.email,
3973
4079
  clientMetadata: params.clientMetadata,
3974
4080
  countryCode: params.countryCode,
4081
+ displayCurrency: params.displayCurrency,
4082
+ displayCountry: params.displayCountry,
3975
4083
  integration: 'stripe',
3976
4084
  };
3977
4085
  const [session, { mountStripeCardForm }] = await Promise.all([
@@ -4000,6 +4108,8 @@
4000
4108
  email: params.email,
4001
4109
  clientMetadata: params.clientMetadata,
4002
4110
  countryCode: params.countryCode,
4111
+ displayCurrency: params.displayCurrency,
4112
+ displayCountry: params.displayCountry,
4003
4113
  integration: 'stripe',
4004
4114
  };
4005
4115
  const [session, { purchaseWallet }] = await Promise.all([
@@ -4029,6 +4139,8 @@
4029
4139
  email: params.email,
4030
4140
  clientMetadata: params.clientMetadata,
4031
4141
  countryCode: params.countryCode,
4142
+ displayCurrency: params.displayCurrency,
4143
+ displayCountry: params.displayCountry,
4032
4144
  integration: 'stripe',
4033
4145
  }),
4034
4146
  Promise.resolve().then(function () { return stripeWallet; }),
@@ -4104,12 +4216,17 @@
4104
4216
  expiresAt,
4105
4217
  };
4106
4218
  }
4219
+ function displayCurrencyField(options) {
4220
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
4221
+ return displayCurrency ? { display_currency_code: displayCurrency } : {};
4222
+ }
4107
4223
  /** `null` = the customer's saved method is not a Primer wallet. */
4108
4224
  async function prepareSession(apiClient, options) {
4109
4225
  const response = await apiClient.oneClickWalletSession({
4110
4226
  pp_ident: options.priceId,
4111
4227
  external_id: options.externalId,
4112
4228
  client_metadata: options.clientMetadata || {},
4229
+ ...displayCurrencyField(options),
4113
4230
  }, SESSION_REQUEST_TIMEOUT_MS);
4114
4231
  if (response?.status !== 'success' || !response.data) {
4115
4232
  throw new APIError('one_click_wallet_session failed', null, { response });
@@ -4492,6 +4609,7 @@
4492
4609
  {}),
4493
4610
  payment_method_token: paymentMethodToken,
4494
4611
  session_id: session.sessionId,
4612
+ ...displayCurrencyField(this.options),
4495
4613
  };
4496
4614
  const idempotencyKey = createIdempotencyKey();
4497
4615
  if (idempotencyKey) {
@@ -4845,7 +4963,7 @@
4845
4963
 
4846
4964
  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";
4847
4965
 
4848
- 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";
4966
+ 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 /* iOS Safari paints select text system blue unless a color is set; match the label instead. */\n color: inherit;\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";
4849
4967
 
4850
4968
  class CardSkin {
4851
4969
  constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {