@funnelfox/billing 0.8.0-ffb-805.56 → 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-805.56';
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,11 +1489,13 @@ class APIClient {
1450
1489
  if (params.countryCode !== undefined) {
1451
1490
  payload.country_code = params.countryCode;
1452
1491
  }
1453
- if (params.displayCurrency) {
1454
- payload.display_currency_code = params.displayCurrency;
1492
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1493
+ if (displayCurrency) {
1494
+ payload.display_currency_code = displayCurrency;
1455
1495
  }
1456
- if (params.displayCountry) {
1457
- payload.display_country_code = params.displayCountry;
1496
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1497
+ if (displayCountry) {
1498
+ payload.display_country_code = displayCountry;
1458
1499
  }
1459
1500
  return (await this.request(API_ENDPOINTS.CREATE_CLIENT_SESSION, {
1460
1501
  method: 'POST',
@@ -1468,11 +1509,13 @@ class APIClient {
1468
1509
  pp_ident: params.priceId,
1469
1510
  client_metadata: params.clientMetadata || {},
1470
1511
  };
1471
- if (params.displayCurrency) {
1472
- payload.display_currency_code = params.displayCurrency;
1512
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1513
+ if (displayCurrency) {
1514
+ payload.display_currency_code = displayCurrency;
1473
1515
  }
1474
- if (params.displayCountry) {
1475
- payload.display_country_code = params.displayCountry;
1516
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1517
+ if (displayCountry) {
1518
+ payload.display_country_code = displayCountry;
1476
1519
  }
1477
1520
  return await this.request(API_ENDPOINTS.UPDATE_CLIENT_SESSION, {
1478
1521
  method: 'POST',
@@ -1679,6 +1722,7 @@ class SessionService {
1679
1722
  p.externalId,
1680
1723
  p.email,
1681
1724
  p.integration,
1725
+ p.sessionScope ?? '',
1682
1726
  ].join('|');
1683
1727
  }
1684
1728
  makeClient(orgId, baseUrl) {
@@ -1726,6 +1770,19 @@ class SessionService {
1726
1770
  }
1727
1771
  var sessionService = new SessionService();
1728
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
+
1729
1786
  var loaderHtml = "<div class=\"ff-sdk-loader-container\">\n <div class=\"ff-sdk-loader\"></div>\n</div>\n";
1730
1787
 
1731
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 }";
@@ -2286,9 +2343,17 @@ class CheckoutInstance extends EventEmitter {
2286
2343
  this.checkoutConfig.onTaxError?.(err);
2287
2344
  }
2288
2345
  };
2346
+ this.canRecalcTax = () => !!this.orderId && !!this.getSelectedCountryCode();
2289
2347
  this.scheduleTaxRecalc = () => {
2290
2348
  if (this.taxRecalcDebounce) {
2291
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;
2292
2357
  }
2293
2358
  this.checkoutConfig.onTaxPending?.();
2294
2359
  this.emit(EVENTS.TAX_PENDING);
@@ -2464,8 +2529,8 @@ class CheckoutInstance extends EventEmitter {
2464
2529
  this.hideInitializingLoader();
2465
2530
  }
2466
2531
  }
2467
- async createSession() {
2468
- const response = await sessionService.createSession({
2532
+ sessionParams() {
2533
+ return {
2469
2534
  orgId: this.orgId,
2470
2535
  baseUrl: this.baseUrl,
2471
2536
  priceId: this.checkoutConfig.priceId,
@@ -2476,8 +2541,12 @@ class CheckoutInstance extends EventEmitter {
2476
2541
  countryCode: this.checkoutConfig.customer.countryCode,
2477
2542
  displayCurrency: this.checkoutConfig.displayCurrency,
2478
2543
  displayCountry: this.checkoutConfig.displayCountry,
2544
+ sessionScope: this.checkoutConfig.sessionScope,
2479
2545
  integration: 'primer',
2480
- });
2546
+ };
2547
+ }
2548
+ async createSession() {
2549
+ const response = await sessionService.createSession(this.sessionParams());
2481
2550
  const sessionResponse = response;
2482
2551
  if (response.data?.stripe_public_key && !sessionResponse.radarSessionId) {
2483
2552
  const stripePublicKey = response.data.stripe_public_key;
@@ -2757,7 +2826,10 @@ class CheckoutInstance extends EventEmitter {
2757
2826
  },
2758
2827
  };
2759
2828
  }
2760
- 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) {
2761
2833
  this._ensureNotDestroyed();
2762
2834
  requireString(newPriceId, 'priceId');
2763
2835
  if (this.state === 'processing') {
@@ -2766,16 +2838,20 @@ class CheckoutInstance extends EventEmitter {
2766
2838
  try {
2767
2839
  this.onLoaderChangeWithRace(true);
2768
2840
  this._setState('updating');
2769
- sessionService.clearCache();
2841
+ sessionService.invalidate(this.sessionParams());
2842
+ const displayCurrency = displayLocale?.displayCurrency ?? this.checkoutConfig.displayCurrency;
2843
+ const displayCountry = displayLocale?.displayCountry ?? this.checkoutConfig.displayCountry;
2770
2844
  await this.apiClient.updateClientSession({
2771
2845
  orderId: this.orderId,
2772
2846
  clientToken: this.clientToken,
2773
2847
  priceId: newPriceId,
2774
2848
  clientMetadata,
2775
- displayCurrency: this.checkoutConfig.displayCurrency,
2776
- displayCountry: this.checkoutConfig.displayCountry,
2849
+ displayCurrency,
2850
+ displayCountry,
2777
2851
  });
2778
2852
  this.checkoutConfig.priceId = newPriceId;
2853
+ this.checkoutConfig.displayCurrency = displayCurrency;
2854
+ this.checkoutConfig.displayCountry = displayCountry;
2779
2855
  await this.primerWrapper.refreshClientSession();
2780
2856
  this.onLoaderChangeWithRace(false);
2781
2857
  this._setState('ready');
@@ -2804,7 +2880,7 @@ class CheckoutInstance extends EventEmitter {
2804
2880
  return;
2805
2881
  try {
2806
2882
  this.stopUnhandledTelemetry();
2807
- sessionService.clearCache();
2883
+ sessionService.invalidate(this.sessionParams());
2808
2884
  await this.primerWrapper.destroy();
2809
2885
  this._setState('destroyed');
2810
2886
  this.orderId = null;
@@ -2988,6 +3064,7 @@ class CheckoutInstance extends EventEmitter {
2988
3064
  await methodInterface.destroy();
2989
3065
  await this.destroy();
2990
3066
  },
3067
+ updatePrice: (newPriceId, clientMetadata, displayLocale) => this.updatePrice(newPriceId, clientMetadata, displayLocale),
2991
3068
  };
2992
3069
  }
2993
3070
  startUnhandledTelemetry(paymentMethod) {
@@ -3442,8 +3519,9 @@ function buildOneClickRequest(options) {
3442
3519
  if (options.citCardNetworks !== undefined) {
3443
3520
  payload.cit_card_networks = options.citCardNetworks;
3444
3521
  }
3445
- if (options.displayCurrency) {
3446
- payload.display_currency_code = options.displayCurrency;
3522
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
3523
+ if (displayCurrency) {
3524
+ payload.display_currency_code = displayCurrency;
3447
3525
  }
3448
3526
  return payload;
3449
3527
  }
@@ -3902,6 +3980,7 @@ async function initMethod(method, element, options) {
3902
3980
  clientMetadata: options.meta,
3903
3981
  displayCurrency: options.displayCurrency,
3904
3982
  displayCountry: options.displayCountry,
3983
+ sessionScope: options.sessionScope,
3905
3984
  card: options.card,
3906
3985
  style: options.style,
3907
3986
  applePay: {
@@ -4131,12 +4210,17 @@ function parseWalletSession(data) {
4131
4210
  expiresAt,
4132
4211
  };
4133
4212
  }
4213
+ function displayCurrencyField(options) {
4214
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
4215
+ return displayCurrency ? { display_currency_code: displayCurrency } : {};
4216
+ }
4134
4217
  /** `null` = the customer's saved method is not a Primer wallet. */
4135
4218
  async function prepareSession(apiClient, options) {
4136
4219
  const response = await apiClient.oneClickWalletSession({
4137
4220
  pp_ident: options.priceId,
4138
4221
  external_id: options.externalId,
4139
4222
  client_metadata: options.clientMetadata || {},
4223
+ ...displayCurrencyField(options),
4140
4224
  }, SESSION_REQUEST_TIMEOUT_MS);
4141
4225
  if (response?.status !== 'success' || !response.data) {
4142
4226
  throw new APIError('one_click_wallet_session failed', null, { response });
@@ -4519,10 +4603,8 @@ class WalletUpsell {
4519
4603
  {}),
4520
4604
  payment_method_token: paymentMethodToken,
4521
4605
  session_id: session.sessionId,
4606
+ ...displayCurrencyField(this.options),
4522
4607
  };
4523
- if (this.options.displayCurrency) {
4524
- payload.display_currency_code = this.options.displayCurrency;
4525
- }
4526
4608
  const idempotencyKey = createIdempotencyKey();
4527
4609
  if (idempotencyKey) {
4528
4610
  payload.idempotency_key = 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) {