@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.
package/README.md CHANGED
@@ -140,7 +140,7 @@ const checkout = await createCheckout({
140
140
  - `customer.externalId` (string, required) - Your user identifier
141
141
  - `customer.email` (string, optional) - Customer email
142
142
  - `customer.countryCode` (string, optional) - ISO country code
143
- - `options.displayCurrency` (string, optional) - ISO 4217 currency the page showed the price in (from Billing's `price_points/resolve`). Billing charges it when the price point offers it, otherwise the price point's own currency. Also accepted by `initMethod`, `createClientSession`, the Stripe forms, and (currency only) `silentPurchase` and `mountWalletUpsell`.
143
+ - `options.displayCurrency` (string, optional) - ISO 4217 currency the page showed the price in (from Billing's `price_points/resolve`). Billing charges it when the price point offers it, otherwise the price point's own currency. Also accepted by `initMethod`, `createClientSession`, the Stripe forms, and (currency only) `silentPurchase` and `mountWalletUpsell`, which sends it with both the wallet session and the charge.
144
144
  - `options.displayCountry` (string, optional) - ISO 3166-1 alpha-2 country the page resolved that currency for.
145
145
  - `options.container` (string, required) - CSS selector for checkout container
146
146
  - `options.card.emailAddress.visible` (boolean, optional) - Shows an email field in the card form. Disabled by default.
@@ -258,7 +258,7 @@ checkout.on('destroy', () => {
258
258
 
259
259
  #### Methods
260
260
 
261
- ##### `updatePrice(priceId)`
261
+ ##### `updatePrice(priceId, clientMetadata?, displayLocale?)`
262
262
 
263
263
  Updates the checkout to use a different price.
264
264
 
@@ -266,6 +266,16 @@ Updates the checkout to use a different price.
266
266
  await checkout.updatePrice('price_yearly');
267
267
  ```
268
268
 
269
+ When the page shows the new price in another currency than the checkout was opened with, pass it
270
+ as `displayLocale`, otherwise the checkout keeps charging the currency it was opened in:
271
+
272
+ ```javascript
273
+ await checkout.updatePrice('price_yearly', undefined, {
274
+ displayCurrency: 'EUR',
275
+ displayCountry: 'DE',
276
+ });
277
+ ```
278
+
269
279
  **Note:** Cannot update price while payment is processing.
270
280
 
271
281
  ##### `getStatus()`
@@ -729,6 +739,7 @@ const mount = await Billing.mountWalletUpsell(container, {
729
739
  orgId: 'your-org-id',
730
740
  priceId: 'upsell_price',
731
741
  externalId: 'user_456',
742
+ displayCurrency: 'EUR', // optional: the currency the upsell page showed
732
743
  clientMetadata: { ff_billing_reason: 'upsell' },
733
744
  style: {
734
745
  buttonType: 'plain',
@@ -121,6 +121,7 @@ class APIError extends FunnefoxSDKError {
121
121
  this.response = options.response || null;
122
122
  this.declineCode = options.declineCode || null;
123
123
  this.declineCodeSource = options.declineCodeSource || null;
124
+ this.retryAfterMs = options.retryAfterMs ?? null;
124
125
  }
125
126
  }
126
127
  class PrimerError extends FunnefoxSDKError {
@@ -360,6 +361,9 @@ function resolveTaxDisplay(source) {
360
361
  return {
361
362
  ...resolveTaxAmount(source),
362
363
  ...resolveTaxBreakdown(source.tax_breakdown),
364
+ ...(source.update_total_in_funnel != null
365
+ ? { updateTotalInFunnel: source.update_total_in_funnel }
366
+ : {}),
363
367
  };
364
368
  }
365
369
  function resolveTaxBreakdown(breakdown) {
@@ -446,7 +450,7 @@ function isBrowser() {
446
450
  function sleep(ms) {
447
451
  return new Promise(resolve => setTimeout(resolve, ms));
448
452
  }
449
- async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
453
+ async function retry(fn, maxAttempts = 3, baseDelay = 1000, delayFor) {
450
454
  let lastError;
451
455
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
452
456
  try {
@@ -456,7 +460,7 @@ async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
456
460
  lastError = error;
457
461
  if (attempt === maxAttempts)
458
462
  throw lastError;
459
- const delay = baseDelay * Math.pow(2, attempt - 1);
463
+ const delay = delayFor?.(error) ?? baseDelay * Math.pow(2, attempt - 1);
460
464
  await sleep(delay);
461
465
  }
462
466
  }
@@ -561,7 +565,7 @@ exports.PaymentMethod = void 0;
561
565
  /**
562
566
  * @fileoverview Constants for Funnefox SDK
563
567
  */
564
- const SDK_VERSION = '0.8.0-ffb-805.56';
568
+ const SDK_VERSION = '0.8.0-main.60';
565
569
  const DEFAULTS = {
566
570
  BASE_URL: 'https://billing.funnelfox.com',
567
571
  REGION: 'default',
@@ -569,6 +573,7 @@ const DEFAULTS = {
569
573
  REQUEST_TIMEOUT: 30000,
570
574
  RETRY_ATTEMPTS: 3,
571
575
  RETRY_BASE_DELAY: 1000,
576
+ MAX_RETRY_AFTER: 10000,
572
577
  };
573
578
  const CHECKOUT_STATES = {
574
579
  INITIALIZING: 'initializing',
@@ -1344,9 +1349,42 @@ function toPaymentFailure(error) {
1344
1349
  return failure;
1345
1350
  }
1346
1351
 
1352
+ const CURRENCY_CODE = /^[A-Za-z]{3}$/;
1353
+ const COUNTRY_CODE = /^[A-Za-z]{2}$/;
1354
+ // Billing checks the code length before trimming it, so " EUR" or "EURO" fails the whole session
1355
+ // with a 422. An unknown currency is never an error there: left out, the price point's own one is
1356
+ // charged. A malformed code is dropped here for the same outcome instead of a checkout that never opens.
1357
+ function normalizeCode(value, pattern, option) {
1358
+ if (value === undefined || value === null || value === '') {
1359
+ return undefined;
1360
+ }
1361
+ const code = typeof value === 'string' ? value.trim() : '';
1362
+ if (!pattern.test(code)) {
1363
+ console.warn(`[funnelfox-billing] ${option} "${String(value)}" is not a valid code, so it is not sent`);
1364
+ return undefined;
1365
+ }
1366
+ return code.toUpperCase();
1367
+ }
1368
+ function normalizeDisplayCurrency(value) {
1369
+ return normalizeCode(value, CURRENCY_CODE, 'displayCurrency');
1370
+ }
1371
+ function normalizeDisplayCountry(value) {
1372
+ return normalizeCode(value, COUNTRY_CODE, 'displayCountry');
1373
+ }
1374
+
1347
1375
  /**
1348
1376
  * @fileoverview API client for Funnefox backend integration
1349
1377
  */
1378
+ function parseRetryAfter(response) {
1379
+ const seconds = Number(response.headers?.get('Retry-After'));
1380
+ if (response.status !== 429 || !Number.isFinite(seconds) || seconds <= 0) {
1381
+ return null;
1382
+ }
1383
+ return Math.min(seconds * 1000, DEFAULTS.MAX_RETRY_AFTER);
1384
+ }
1385
+ function retryAfterMs(error) {
1386
+ return error instanceof APIError ? error.retryAfterMs : null;
1387
+ }
1350
1388
  class APIClient {
1351
1389
  constructor(config) {
1352
1390
  this.baseUrl = config.baseUrl.replace(/\/$/, '');
@@ -1368,7 +1406,7 @@ class APIClient {
1368
1406
  try {
1369
1407
  return await retry(async () => {
1370
1408
  return await withTimeout(this._makeRequest(url, requestOptions), this.timeout, 'Request timed out');
1371
- }, this.retryAttempts);
1409
+ }, this.retryAttempts, DEFAULTS.RETRY_BASE_DELAY, retryAfterMs);
1372
1410
  }
1373
1411
  catch (error) {
1374
1412
  if (error instanceof Error && error.name === 'APIError') {
@@ -1436,6 +1474,7 @@ class APIClient {
1436
1474
  const message = d.error?.[0]?.msg || 'Failed to create payment';
1437
1475
  throw new APIError(message, response.status, {
1438
1476
  response: data,
1477
+ retryAfterMs: parseRetryAfter(response),
1439
1478
  });
1440
1479
  }
1441
1480
  return data;
@@ -1452,11 +1491,13 @@ class APIClient {
1452
1491
  if (params.countryCode !== undefined) {
1453
1492
  payload.country_code = params.countryCode;
1454
1493
  }
1455
- if (params.displayCurrency) {
1456
- payload.display_currency_code = params.displayCurrency;
1494
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1495
+ if (displayCurrency) {
1496
+ payload.display_currency_code = displayCurrency;
1457
1497
  }
1458
- if (params.displayCountry) {
1459
- payload.display_country_code = params.displayCountry;
1498
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1499
+ if (displayCountry) {
1500
+ payload.display_country_code = displayCountry;
1460
1501
  }
1461
1502
  return (await this.request(API_ENDPOINTS.CREATE_CLIENT_SESSION, {
1462
1503
  method: 'POST',
@@ -1470,11 +1511,13 @@ class APIClient {
1470
1511
  pp_ident: params.priceId,
1471
1512
  client_metadata: params.clientMetadata || {},
1472
1513
  };
1473
- if (params.displayCurrency) {
1474
- payload.display_currency_code = params.displayCurrency;
1514
+ const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
1515
+ if (displayCurrency) {
1516
+ payload.display_currency_code = displayCurrency;
1475
1517
  }
1476
- if (params.displayCountry) {
1477
- payload.display_country_code = params.displayCountry;
1518
+ const displayCountry = normalizeDisplayCountry(params.displayCountry);
1519
+ if (displayCountry) {
1520
+ payload.display_country_code = displayCountry;
1478
1521
  }
1479
1522
  return await this.request(API_ENDPOINTS.UPDATE_CLIENT_SESSION, {
1480
1523
  method: 'POST',
@@ -1681,6 +1724,7 @@ class SessionService {
1681
1724
  p.externalId,
1682
1725
  p.email,
1683
1726
  p.integration,
1727
+ p.sessionScope ?? '',
1684
1728
  ].join('|');
1685
1729
  }
1686
1730
  makeClient(orgId, baseUrl) {
@@ -1728,6 +1772,19 @@ class SessionService {
1728
1772
  }
1729
1773
  var sessionService = new SessionService();
1730
1774
 
1775
+ const tails = new Map();
1776
+ function enqueueForOrder(key, task) {
1777
+ const run = (tails.get(key) ?? Promise.resolve()).then(task);
1778
+ const tail = run.then(() => undefined, () => undefined);
1779
+ tails.set(key, tail);
1780
+ void tail.then(() => {
1781
+ if (tails.get(key) === tail) {
1782
+ tails.delete(key);
1783
+ }
1784
+ });
1785
+ return run;
1786
+ }
1787
+
1731
1788
  var loaderHtml = "<div class=\"ff-sdk-loader-container\">\n <div class=\"ff-sdk-loader\"></div>\n</div>\n";
1732
1789
 
1733
1790
  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 }";
@@ -2288,9 +2345,17 @@ class CheckoutInstance extends EventEmitter {
2288
2345
  this.checkoutConfig.onTaxError?.(err);
2289
2346
  }
2290
2347
  };
2348
+ this.canRecalcTax = () => !!this.orderId && !!this.getSelectedCountryCode();
2291
2349
  this.scheduleTaxRecalc = () => {
2292
2350
  if (this.taxRecalcDebounce) {
2293
2351
  clearTimeout(this.taxRecalcDebounce);
2352
+ this.taxRecalcDebounce = undefined;
2353
+ if (!this.canRecalcTax() && this.lastTaxInfo) {
2354
+ this.emitTaxInfo(this.lastTaxInfo);
2355
+ }
2356
+ }
2357
+ if (!this.canRecalcTax()) {
2358
+ return;
2294
2359
  }
2295
2360
  this.checkoutConfig.onTaxPending?.();
2296
2361
  this.emit(EVENTS.TAX_PENDING);
@@ -2466,8 +2531,8 @@ class CheckoutInstance extends EventEmitter {
2466
2531
  this.hideInitializingLoader();
2467
2532
  }
2468
2533
  }
2469
- async createSession() {
2470
- const response = await sessionService.createSession({
2534
+ sessionParams() {
2535
+ return {
2471
2536
  orgId: this.orgId,
2472
2537
  baseUrl: this.baseUrl,
2473
2538
  priceId: this.checkoutConfig.priceId,
@@ -2478,8 +2543,12 @@ class CheckoutInstance extends EventEmitter {
2478
2543
  countryCode: this.checkoutConfig.customer.countryCode,
2479
2544
  displayCurrency: this.checkoutConfig.displayCurrency,
2480
2545
  displayCountry: this.checkoutConfig.displayCountry,
2546
+ sessionScope: this.checkoutConfig.sessionScope,
2481
2547
  integration: 'primer',
2482
- });
2548
+ };
2549
+ }
2550
+ async createSession() {
2551
+ const response = await sessionService.createSession(this.sessionParams());
2483
2552
  const sessionResponse = response;
2484
2553
  if (response.data?.stripe_public_key && !sessionResponse.radarSessionId) {
2485
2554
  const stripePublicKey = response.data.stripe_public_key;
@@ -2759,7 +2828,10 @@ class CheckoutInstance extends EventEmitter {
2759
2828
  },
2760
2829
  };
2761
2830
  }
2762
- async updatePrice(newPriceId, clientMetadata) {
2831
+ updatePrice(newPriceId, clientMetadata, displayLocale) {
2832
+ return enqueueForOrder(this.orderId ?? `checkout:${this.id}`, () => this.applyPrice(newPriceId, clientMetadata, displayLocale));
2833
+ }
2834
+ async applyPrice(newPriceId, clientMetadata, displayLocale) {
2763
2835
  this._ensureNotDestroyed();
2764
2836
  requireString(newPriceId, 'priceId');
2765
2837
  if (this.state === 'processing') {
@@ -2768,16 +2840,20 @@ class CheckoutInstance extends EventEmitter {
2768
2840
  try {
2769
2841
  this.onLoaderChangeWithRace(true);
2770
2842
  this._setState('updating');
2771
- sessionService.clearCache();
2843
+ sessionService.invalidate(this.sessionParams());
2844
+ const displayCurrency = displayLocale?.displayCurrency ?? this.checkoutConfig.displayCurrency;
2845
+ const displayCountry = displayLocale?.displayCountry ?? this.checkoutConfig.displayCountry;
2772
2846
  await this.apiClient.updateClientSession({
2773
2847
  orderId: this.orderId,
2774
2848
  clientToken: this.clientToken,
2775
2849
  priceId: newPriceId,
2776
2850
  clientMetadata,
2777
- displayCurrency: this.checkoutConfig.displayCurrency,
2778
- displayCountry: this.checkoutConfig.displayCountry,
2851
+ displayCurrency,
2852
+ displayCountry,
2779
2853
  });
2780
2854
  this.checkoutConfig.priceId = newPriceId;
2855
+ this.checkoutConfig.displayCurrency = displayCurrency;
2856
+ this.checkoutConfig.displayCountry = displayCountry;
2781
2857
  await this.primerWrapper.refreshClientSession();
2782
2858
  this.onLoaderChangeWithRace(false);
2783
2859
  this._setState('ready');
@@ -2806,7 +2882,7 @@ class CheckoutInstance extends EventEmitter {
2806
2882
  return;
2807
2883
  try {
2808
2884
  this.stopUnhandledTelemetry();
2809
- sessionService.clearCache();
2885
+ sessionService.invalidate(this.sessionParams());
2810
2886
  await this.primerWrapper.destroy();
2811
2887
  this._setState('destroyed');
2812
2888
  this.orderId = null;
@@ -2990,6 +3066,7 @@ class CheckoutInstance extends EventEmitter {
2990
3066
  await methodInterface.destroy();
2991
3067
  await this.destroy();
2992
3068
  },
3069
+ updatePrice: (newPriceId, clientMetadata, displayLocale) => this.updatePrice(newPriceId, clientMetadata, displayLocale),
2993
3070
  };
2994
3071
  }
2995
3072
  startUnhandledTelemetry(paymentMethod) {
@@ -3444,8 +3521,9 @@ function buildOneClickRequest(options) {
3444
3521
  if (options.citCardNetworks !== undefined) {
3445
3522
  payload.cit_card_networks = options.citCardNetworks;
3446
3523
  }
3447
- if (options.displayCurrency) {
3448
- payload.display_currency_code = options.displayCurrency;
3524
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
3525
+ if (displayCurrency) {
3526
+ payload.display_currency_code = displayCurrency;
3449
3527
  }
3450
3528
  return payload;
3451
3529
  }
@@ -3904,6 +3982,7 @@ async function initMethod(method, element, options) {
3904
3982
  clientMetadata: options.meta,
3905
3983
  displayCurrency: options.displayCurrency,
3906
3984
  displayCountry: options.displayCountry,
3985
+ sessionScope: options.sessionScope,
3907
3986
  card: options.card,
3908
3987
  style: options.style,
3909
3988
  applePay: {
@@ -4133,12 +4212,17 @@ function parseWalletSession(data) {
4133
4212
  expiresAt,
4134
4213
  };
4135
4214
  }
4215
+ function displayCurrencyField(options) {
4216
+ const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
4217
+ return displayCurrency ? { display_currency_code: displayCurrency } : {};
4218
+ }
4136
4219
  /** `null` = the customer's saved method is not a Primer wallet. */
4137
4220
  async function prepareSession(apiClient, options) {
4138
4221
  const response = await apiClient.oneClickWalletSession({
4139
4222
  pp_ident: options.priceId,
4140
4223
  external_id: options.externalId,
4141
4224
  client_metadata: options.clientMetadata || {},
4225
+ ...displayCurrencyField(options),
4142
4226
  }, SESSION_REQUEST_TIMEOUT_MS);
4143
4227
  if (response?.status !== 'success' || !response.data) {
4144
4228
  throw new APIError('one_click_wallet_session failed', null, { response });
@@ -4521,10 +4605,8 @@ class WalletUpsell {
4521
4605
  {}),
4522
4606
  payment_method_token: paymentMethodToken,
4523
4607
  session_id: session.sessionId,
4608
+ ...displayCurrencyField(this.options),
4524
4609
  };
4525
- if (this.options.displayCurrency) {
4526
- payload.display_currency_code = this.options.displayCurrency;
4527
- }
4528
4610
  const idempotencyKey = createIdempotencyKey();
4529
4611
  if (idempotencyKey) {
4530
4612
  payload.idempotency_key = idempotencyKey;
@@ -9,7 +9,7 @@
9
9
 
10
10
  var template = "<div>\n <label class=\"ff-card-form-label\" for=\"cardNumberInput\">Card number</label>\n <div id=\"cardNumberInput\"></div>\n <div class=\"errorContainer\"></div>\n</div>\n<div class=\"card-form-row\">\n <div>\n <label class=\"ff-card-form-label\" for=\"expiryInput\">Expiration date</label>\n <div id=\"expiryInput\"></div>\n <div class=\"errorContainer\"></div>\n </div>\n <div>\n <label class=\"ff-card-form-label\" for=\"cvvInput\">Security code</label>\n <div id=\"cvvInput\">\n <svg width=\"200\" height=\"200\" viewBox=\"0 0 200 200\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"200\" fill=\"transparent\"/>\n <g clip-path=\"url(#clip0_0_1)\">\n <path d=\"M157.555 23C168.279 23.0002 177 31.7394 177 42.4854V80.5889C171.946 72.0151 164.749 64.8558 156.146 59.8457H166.394V42.4854C166.393 37.6004 162.43 33.6291 157.555 33.6289H27.4453C22.5704 33.6291 18.6066 37.6004 18.6064 42.4854V59.8457H97.8535C88.9153 65.0512 81.4954 72.5771 76.4189 81.5986H18.6064V127.515C18.6066 132.4 22.5704 136.371 27.4453 136.371H75.3281C77.2742 140.177 79.6285 143.739 82.333 147H27.4453C16.7215 147 8.00019 138.261 8 127.515V42.4854C8.0002 31.7394 16.7215 23.0002 27.4453 23H157.555Z\" fill=\"#93939A\"/>\n <mask id=\"path-2-outside-1_0_1\" maskUnits=\"userSpaceOnUse\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\" fill=\"black\">\n <rect fill=\"white\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\"/>\n </mask>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" fill=\"#93939A\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" stroke=\"transparent\" stroke-width=\"20\" mask=\"url(#path-2-outside-1_0_1)\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_0_1\">\n <rect width=\"200\" height=\"200\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n <div class=\"errorContainer\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"cardHolderInput\">Cardholder name</label>\n <input class=\"ff-card-form-text-input\" id=\"cardHolderInput\" type=\"text\" pattern=\"[A-Za-z\\s]+\" placeholder=\"Full name on card\">\n <div class=\"errorContainer\"></div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"emailAddressInput\">Email</label>\n <input class=\"ff-card-form-text-input\" id=\"emailAddressInput\" placeholder=\"Email\" type=\"email\">\n <div class=\"errorContainer\"></div>\n</div>\n<div id=\"countrySelectorField\">\n <label class=\"ff-card-form-label\" for=\"countrySelectorInput\">Country</label>\n <div class=\"ff-select-wrap\">\n <select class=\"ff-card-form-text-input ff-card-form-select\" id=\"countrySelectorInput\"></select>\n <div class=\"ff-select-arrow\" aria-hidden=\"true\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"postalCodeInput\">Zip code</label>\n <input class=\"ff-card-form-text-input\" id=\"postalCodeInput\" placeholder=\"12345\">\n <div class=\"errorContainer\"></div>\n</div>\n";
11
11
 
12
- if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: 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";
12
+ if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n grid-template-rows: repeat(3, auto);\n grid-auto-flow: column;\n column-gap: 10px;\n }\n\n /* Label, input and error of both columns share grid rows, so a label that wraps in one column\n moves both inputs down together, and an error under one input does not move the other. */\n .card-form-row > div {\n display: contents;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n /* 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";
13
13
 
14
14
  class CardSkin {
15
15
  constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {