@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.
@@ -119,6 +119,7 @@ class APIError extends FunnefoxSDKError {
119
119
  this.response = options.response || null;
120
120
  this.declineCode = options.declineCode || null;
121
121
  this.declineCodeSource = options.declineCodeSource || null;
122
+ this.retryAfterMs = options.retryAfterMs ?? null;
122
123
  }
123
124
  }
124
125
  class PrimerError extends FunnefoxSDKError {
@@ -358,6 +359,9 @@ function resolveTaxDisplay(source) {
358
359
  return {
359
360
  ...resolveTaxAmount(source),
360
361
  ...resolveTaxBreakdown(source.tax_breakdown),
362
+ ...(source.update_total_in_funnel != null
363
+ ? { updateTotalInFunnel: source.update_total_in_funnel }
364
+ : {}),
361
365
  };
362
366
  }
363
367
  function resolveTaxBreakdown(breakdown) {
@@ -444,7 +448,7 @@ function isBrowser() {
444
448
  function sleep(ms) {
445
449
  return new Promise(resolve => setTimeout(resolve, ms));
446
450
  }
447
- async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
451
+ async function retry(fn, maxAttempts = 3, baseDelay = 1000, delayFor) {
448
452
  let lastError;
449
453
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
450
454
  try {
@@ -454,7 +458,7 @@ async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
454
458
  lastError = error;
455
459
  if (attempt === maxAttempts)
456
460
  throw lastError;
457
- const delay = baseDelay * Math.pow(2, attempt - 1);
461
+ const delay = delayFor?.(error) ?? baseDelay * Math.pow(2, attempt - 1);
458
462
  await sleep(delay);
459
463
  }
460
464
  }
@@ -559,7 +563,7 @@ var PaymentMethod;
559
563
  /**
560
564
  * @fileoverview Constants for Funnefox SDK
561
565
  */
562
- const SDK_VERSION = '0.8.0-ffb-837.55';
566
+ const SDK_VERSION = '0.8.0-main.60';
563
567
  const DEFAULTS = {
564
568
  BASE_URL: 'https://billing.funnelfox.com',
565
569
  REGION: 'default',
@@ -567,6 +571,7 @@ const DEFAULTS = {
567
571
  REQUEST_TIMEOUT: 30000,
568
572
  RETRY_ATTEMPTS: 3,
569
573
  RETRY_BASE_DELAY: 1000,
574
+ MAX_RETRY_AFTER: 10000,
570
575
  };
571
576
  const CHECKOUT_STATES = {
572
577
  INITIALIZING: 'initializing',
@@ -1342,9 +1347,42 @@ function toPaymentFailure(error) {
1342
1347
  return failure;
1343
1348
  }
1344
1349
 
1350
+ const CURRENCY_CODE = /^[A-Za-z]{3}$/;
1351
+ const COUNTRY_CODE = /^[A-Za-z]{2}$/;
1352
+ // Billing checks the code length before trimming it, so " EUR" or "EURO" fails the whole session
1353
+ // with a 422. An unknown currency is never an error there: left out, the price point's own one is
1354
+ // charged. A malformed code is dropped here for the same outcome instead of a checkout that never opens.
1355
+ function normalizeCode(value, pattern, option) {
1356
+ if (value === undefined || value === null || value === '') {
1357
+ return undefined;
1358
+ }
1359
+ const code = typeof value === 'string' ? value.trim() : '';
1360
+ if (!pattern.test(code)) {
1361
+ console.warn(`[funnelfox-billing] ${option} "${String(value)}" is not a valid code, so it is not sent`);
1362
+ return undefined;
1363
+ }
1364
+ return code.toUpperCase();
1365
+ }
1366
+ function normalizeDisplayCurrency(value) {
1367
+ return normalizeCode(value, CURRENCY_CODE, 'displayCurrency');
1368
+ }
1369
+ function normalizeDisplayCountry(value) {
1370
+ return normalizeCode(value, COUNTRY_CODE, 'displayCountry');
1371
+ }
1372
+
1345
1373
  /**
1346
1374
  * @fileoverview API client for Funnefox backend integration
1347
1375
  */
1376
+ function parseRetryAfter(response) {
1377
+ const seconds = Number(response.headers?.get('Retry-After'));
1378
+ if (response.status !== 429 || !Number.isFinite(seconds) || seconds <= 0) {
1379
+ return null;
1380
+ }
1381
+ return Math.min(seconds * 1000, DEFAULTS.MAX_RETRY_AFTER);
1382
+ }
1383
+ function retryAfterMs(error) {
1384
+ return error instanceof APIError ? error.retryAfterMs : null;
1385
+ }
1348
1386
  class APIClient {
1349
1387
  constructor(config) {
1350
1388
  this.baseUrl = config.baseUrl.replace(/\/$/, '');
@@ -1366,7 +1404,7 @@ class APIClient {
1366
1404
  try {
1367
1405
  return await retry(async () => {
1368
1406
  return await withTimeout(this._makeRequest(url, requestOptions), this.timeout, 'Request timed out');
1369
- }, this.retryAttempts);
1407
+ }, this.retryAttempts, DEFAULTS.RETRY_BASE_DELAY, retryAfterMs);
1370
1408
  }
1371
1409
  catch (error) {
1372
1410
  if (error instanceof Error && error.name === 'APIError') {
@@ -1434,6 +1472,7 @@ class APIClient {
1434
1472
  const message = d.error?.[0]?.msg || 'Failed to create payment';
1435
1473
  throw new APIError(message, response.status, {
1436
1474
  response: data,
1475
+ retryAfterMs: parseRetryAfter(response),
1437
1476
  });
1438
1477
  }
1439
1478
  return data;
@@ -1450,6 +1489,14 @@ class APIClient {
1450
1489
  if (params.countryCode !== undefined) {
1451
1490
  payload.country_code = params.countryCode;
1452
1491
  }
1492
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1493
+ if (displayCurrency) {
1494
+ payload.display_currency_code = displayCurrency;
1495
+ }
1496
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1497
+ if (displayCountry) {
1498
+ payload.display_country_code = displayCountry;
1499
+ }
1453
1500
  return (await this.request(API_ENDPOINTS.CREATE_CLIENT_SESSION, {
1454
1501
  method: 'POST',
1455
1502
  body: JSON.stringify(payload),
@@ -1462,6 +1509,14 @@ class APIClient {
1462
1509
  pp_ident: params.priceId,
1463
1510
  client_metadata: params.clientMetadata || {},
1464
1511
  };
1512
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1513
+ if (displayCurrency) {
1514
+ payload.display_currency_code = displayCurrency;
1515
+ }
1516
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1517
+ if (displayCountry) {
1518
+ payload.display_country_code = displayCountry;
1519
+ }
1465
1520
  return await this.request(API_ENDPOINTS.UPDATE_CLIENT_SESSION, {
1466
1521
  method: 'POST',
1467
1522
  body: JSON.stringify(payload),
@@ -1661,10 +1716,13 @@ class SessionService {
1661
1716
  p.baseUrl || DEFAULTS.BASE_URL,
1662
1717
  p.region || DEFAULTS.REGION,
1663
1718
  p.countryCode ?? '',
1719
+ p.displayCurrency ?? '',
1720
+ p.displayCountry ?? '',
1664
1721
  p.priceId,
1665
1722
  p.externalId,
1666
1723
  p.email,
1667
1724
  p.integration,
1725
+ p.sessionScope ?? '',
1668
1726
  ].join('|');
1669
1727
  }
1670
1728
  makeClient(orgId, baseUrl) {
@@ -1688,6 +1746,8 @@ class SessionService {
1688
1746
  region: p.region || DEFAULTS.REGION,
1689
1747
  clientMetadata: p.clientMetadata,
1690
1748
  countryCode: p.countryCode,
1749
+ displayCurrency: p.displayCurrency,
1750
+ displayCountry: p.displayCountry,
1691
1751
  integration: p.integration,
1692
1752
  });
1693
1753
  this.cache.set(key, req);
@@ -1710,6 +1770,19 @@ class SessionService {
1710
1770
  }
1711
1771
  var sessionService = new SessionService();
1712
1772
 
1773
+ const tails = new Map();
1774
+ function enqueueForOrder(key, task) {
1775
+ const run = (tails.get(key) ?? Promise.resolve()).then(task);
1776
+ const tail = run.then(() => undefined, () => undefined);
1777
+ tails.set(key, tail);
1778
+ void tail.then(() => {
1779
+ if (tails.get(key) === tail) {
1780
+ tails.delete(key);
1781
+ }
1782
+ });
1783
+ return run;
1784
+ }
1785
+
1713
1786
  var loaderHtml = "<div class=\"ff-sdk-loader-container\">\n <div class=\"ff-sdk-loader\"></div>\n</div>\n";
1714
1787
 
1715
1788
  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 }";
@@ -2270,9 +2343,17 @@ class CheckoutInstance extends EventEmitter {
2270
2343
  this.checkoutConfig.onTaxError?.(err);
2271
2344
  }
2272
2345
  };
2346
+ this.canRecalcTax = () => !!this.orderId && !!this.getSelectedCountryCode();
2273
2347
  this.scheduleTaxRecalc = () => {
2274
2348
  if (this.taxRecalcDebounce) {
2275
2349
  clearTimeout(this.taxRecalcDebounce);
2350
+ this.taxRecalcDebounce = undefined;
2351
+ if (!this.canRecalcTax() && this.lastTaxInfo) {
2352
+ this.emitTaxInfo(this.lastTaxInfo);
2353
+ }
2354
+ }
2355
+ if (!this.canRecalcTax()) {
2356
+ return;
2276
2357
  }
2277
2358
  this.checkoutConfig.onTaxPending?.();
2278
2359
  this.emit(EVENTS.TAX_PENDING);
@@ -2448,8 +2529,8 @@ class CheckoutInstance extends EventEmitter {
2448
2529
  this.hideInitializingLoader();
2449
2530
  }
2450
2531
  }
2451
- async createSession() {
2452
- const response = await sessionService.createSession({
2532
+ sessionParams() {
2533
+ return {
2453
2534
  orgId: this.orgId,
2454
2535
  baseUrl: this.baseUrl,
2455
2536
  priceId: this.checkoutConfig.priceId,
@@ -2458,8 +2539,14 @@ class CheckoutInstance extends EventEmitter {
2458
2539
  region: this.region,
2459
2540
  clientMetadata: this.checkoutConfig.clientMetadata,
2460
2541
  countryCode: this.checkoutConfig.customer.countryCode,
2542
+ displayCurrency: this.checkoutConfig.displayCurrency,
2543
+ displayCountry: this.checkoutConfig.displayCountry,
2544
+ sessionScope: this.checkoutConfig.sessionScope,
2461
2545
  integration: 'primer',
2462
- });
2546
+ };
2547
+ }
2548
+ async createSession() {
2549
+ const response = await sessionService.createSession(this.sessionParams());
2463
2550
  const sessionResponse = response;
2464
2551
  if (response.data?.stripe_public_key && !sessionResponse.radarSessionId) {
2465
2552
  const stripePublicKey = response.data.stripe_public_key;
@@ -2739,7 +2826,10 @@ class CheckoutInstance extends EventEmitter {
2739
2826
  },
2740
2827
  };
2741
2828
  }
2742
- async updatePrice(newPriceId, clientMetadata) {
2829
+ updatePrice(newPriceId, clientMetadata, displayLocale) {
2830
+ return enqueueForOrder(this.orderId ?? `checkout:${this.id}`, () => this.applyPrice(newPriceId, clientMetadata, displayLocale));
2831
+ }
2832
+ async applyPrice(newPriceId, clientMetadata, displayLocale) {
2743
2833
  this._ensureNotDestroyed();
2744
2834
  requireString(newPriceId, 'priceId');
2745
2835
  if (this.state === 'processing') {
@@ -2748,14 +2838,20 @@ class CheckoutInstance extends EventEmitter {
2748
2838
  try {
2749
2839
  this.onLoaderChangeWithRace(true);
2750
2840
  this._setState('updating');
2751
- sessionService.clearCache();
2841
+ sessionService.invalidate(this.sessionParams());
2842
+ const displayCurrency = displayLocale?.displayCurrency ?? this.checkoutConfig.displayCurrency;
2843
+ const displayCountry = displayLocale?.displayCountry ?? this.checkoutConfig.displayCountry;
2752
2844
  await this.apiClient.updateClientSession({
2753
2845
  orderId: this.orderId,
2754
2846
  clientToken: this.clientToken,
2755
2847
  priceId: newPriceId,
2756
2848
  clientMetadata,
2849
+ displayCurrency,
2850
+ displayCountry,
2757
2851
  });
2758
2852
  this.checkoutConfig.priceId = newPriceId;
2853
+ this.checkoutConfig.displayCurrency = displayCurrency;
2854
+ this.checkoutConfig.displayCountry = displayCountry;
2759
2855
  await this.primerWrapper.refreshClientSession();
2760
2856
  this.onLoaderChangeWithRace(false);
2761
2857
  this._setState('ready');
@@ -2784,7 +2880,7 @@ class CheckoutInstance extends EventEmitter {
2784
2880
  return;
2785
2881
  try {
2786
2882
  this.stopUnhandledTelemetry();
2787
- sessionService.clearCache();
2883
+ sessionService.invalidate(this.sessionParams());
2788
2884
  await this.primerWrapper.destroy();
2789
2885
  this._setState('destroyed');
2790
2886
  this.orderId = null;
@@ -2968,6 +3064,7 @@ class CheckoutInstance extends EventEmitter {
2968
3064
  await methodInterface.destroy();
2969
3065
  await this.destroy();
2970
3066
  },
3067
+ updatePrice: (newPriceId, clientMetadata, displayLocale) => this.updatePrice(newPriceId, clientMetadata, displayLocale),
2971
3068
  };
2972
3069
  }
2973
3070
  startUnhandledTelemetry(paymentMethod) {
@@ -3387,7 +3484,7 @@ async function createCheckout(options) {
3387
3484
  }
3388
3485
  }
3389
3486
  async function createClientSession(params) {
3390
- const { priceId, externalId, email, clientMetadata, countryCode } = params;
3487
+ const { priceId, externalId, email, clientMetadata, countryCode, displayCurrency, displayCountry, } = params;
3391
3488
  const config = resolveConfig(params, 'createClientSession');
3392
3489
  const apiClient = new APIClient({
3393
3490
  baseUrl: config.baseUrl,
@@ -3402,6 +3499,8 @@ async function createClientSession(params) {
3402
3499
  region: config.region,
3403
3500
  clientMetadata,
3404
3501
  countryCode,
3502
+ displayCurrency,
3503
+ displayCountry,
3405
3504
  });
3406
3505
  return apiClient.processSessionResponse(sessionResponse);
3407
3506
  }
@@ -3420,6 +3519,10 @@ function buildOneClickRequest(options) {
3420
3519
  if (options.citCardNetworks !== undefined) {
3421
3520
  payload.cit_card_networks = options.citCardNetworks;
3422
3521
  }
3522
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
3523
+ if (displayCurrency) {
3524
+ payload.display_currency_code = displayCurrency;
3525
+ }
3423
3526
  return payload;
3424
3527
  }
3425
3528
  function silentPurchase(options) {
@@ -3875,6 +3978,9 @@ async function initMethod(method, element, options) {
3875
3978
  },
3876
3979
  container: '',
3877
3980
  clientMetadata: options.meta,
3981
+ displayCurrency: options.displayCurrency,
3982
+ displayCountry: options.displayCountry,
3983
+ sessionScope: options.sessionScope,
3878
3984
  card: options.card,
3879
3985
  style: options.style,
3880
3986
  applePay: {
@@ -3966,6 +4072,8 @@ async function createStripeCardForm(element, params) {
3966
4072
  email: params.email,
3967
4073
  clientMetadata: params.clientMetadata,
3968
4074
  countryCode: params.countryCode,
4075
+ displayCurrency: params.displayCurrency,
4076
+ displayCountry: params.displayCountry,
3969
4077
  integration: 'stripe',
3970
4078
  };
3971
4079
  const [session, { mountStripeCardForm }] = await Promise.all([
@@ -3994,6 +4102,8 @@ async function purchaseStripeWallet(params) {
3994
4102
  email: params.email,
3995
4103
  clientMetadata: params.clientMetadata,
3996
4104
  countryCode: params.countryCode,
4105
+ displayCurrency: params.displayCurrency,
4106
+ displayCountry: params.displayCountry,
3997
4107
  integration: 'stripe',
3998
4108
  };
3999
4109
  const [session, { purchaseWallet }] = await Promise.all([
@@ -4023,6 +4133,8 @@ async function getAvailableStripeWallet(params) {
4023
4133
  email: params.email,
4024
4134
  clientMetadata: params.clientMetadata,
4025
4135
  countryCode: params.countryCode,
4136
+ displayCurrency: params.displayCurrency,
4137
+ displayCountry: params.displayCountry,
4026
4138
  integration: 'stripe',
4027
4139
  }),
4028
4140
  import('./chunk-stripe-wallet.es.js'),
@@ -4098,12 +4210,17 @@ function parseWalletSession(data) {
4098
4210
  expiresAt,
4099
4211
  };
4100
4212
  }
4213
+ function displayCurrencyField(options) {
4214
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
4215
+ return displayCurrency ? { display_currency_code: displayCurrency } : {};
4216
+ }
4101
4217
  /** `null` = the customer's saved method is not a Primer wallet. */
4102
4218
  async function prepareSession(apiClient, options) {
4103
4219
  const response = await apiClient.oneClickWalletSession({
4104
4220
  pp_ident: options.priceId,
4105
4221
  external_id: options.externalId,
4106
4222
  client_metadata: options.clientMetadata || {},
4223
+ ...displayCurrencyField(options),
4107
4224
  }, SESSION_REQUEST_TIMEOUT_MS);
4108
4225
  if (response?.status !== 'success' || !response.data) {
4109
4226
  throw new APIError('one_click_wallet_session failed', null, { response });
@@ -4486,6 +4603,7 @@ class WalletUpsell {
4486
4603
  {}),
4487
4604
  payment_method_token: paymentMethodToken,
4488
4605
  session_id: session.sessionId,
4606
+ ...displayCurrencyField(this.options),
4489
4607
  };
4490
4608
  const idempotencyKey = createIdempotencyKey();
4491
4609
  if (idempotencyKey) {
@@ -7,7 +7,7 @@
7
7
  */
8
8
  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";
9
9
 
10
- 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";
10
+ 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";
11
11
 
12
12
  class CardSkin {
13
13
  constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {