@funnelfox/billing 0.9.0-ffb-467-adyen.25 → 0.9.1

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
@@ -800,6 +800,8 @@ if (wallet === 'APPLE_PAY') {
800
800
 
801
801
  **Returns:** `Promise<'APPLE_PAY' | 'GOOGLE_PAY' | null>`
802
802
 
803
+ Call `Billing.stripe.getAvailableWallet(...)` while rendering the page (it decides whether to show the wallet button anyway). Besides detecting availability it prewarms the payment sheet, so `purchaseWallet(...)` inside the click handler can open it immediately — Safari cancels Apple Pay sheets that open after long async work in the click handler. Pass the same `priceId`/`externalId`/`email`/`countryCode` to both calls: they share one checkout session, and mismatched params create a second session and skip the prewarmed sheet.
804
+
803
805
  ---
804
806
 
805
807
  ### `Billing.stripe.purchaseWallet(params)`
@@ -171,16 +171,7 @@ function loadScript$1(options) {
171
171
  existingScript = document.querySelector(`script[src="${src}"]`);
172
172
  }
173
173
  if (existingScript) {
174
- // A concurrent caller may have appended the tag but not yet finished loading it (e.g. the
175
- // card form and the wallet probe both request Adyen Web at once). Resolving now would let the
176
- // caller read the not-yet-defined global; wait for the in-flight load instead.
177
- if (existingScript.dataset.loaded === 'true') {
178
- resolve(existingScript);
179
- }
180
- else {
181
- existingScript.addEventListener('load', () => resolve(existingScript));
182
- existingScript.addEventListener('error', () => reject(new Error(`Failed to load script: ${src}`)));
183
- }
174
+ resolve(existingScript);
184
175
  return;
185
176
  }
186
177
  const script = document.createElement('script');
@@ -202,10 +193,7 @@ function loadScript$1(options) {
202
193
  Object.entries(attributes).forEach(([key, value]) => {
203
194
  script.setAttribute(key, value);
204
195
  });
205
- script.onload = () => {
206
- script.dataset.loaded = 'true';
207
- resolve(script);
208
- };
196
+ script.onload = () => resolve(script);
209
197
  script.onerror = () => reject(new Error(`Failed to load script: ${src}`));
210
198
  const target = appendTo === 'head' ? document.head : document.body;
211
199
  target.appendChild(script);
@@ -224,14 +212,7 @@ function loadStylesheet(options) {
224
212
  // Check if stylesheet already exists
225
213
  const existingLink = document.querySelector(`link[href="${href}"]`);
226
214
  if (existingLink) {
227
- // Wait for an in-flight load from a concurrent caller rather than resolving prematurely.
228
- if (existingLink.dataset.loaded === 'true') {
229
- resolve(existingLink);
230
- }
231
- else {
232
- existingLink.addEventListener('load', () => resolve(existingLink));
233
- existingLink.addEventListener('error', () => reject(new Error(`Failed to load stylesheet: ${href}`)));
234
- }
215
+ resolve(existingLink);
235
216
  return;
236
217
  }
237
218
  const link = document.createElement('link');
@@ -243,10 +224,7 @@ function loadStylesheet(options) {
243
224
  if (crossOrigin) {
244
225
  link.crossOrigin = crossOrigin;
245
226
  }
246
- link.onload = () => {
247
- link.dataset.loaded = 'true';
248
- resolve(link);
249
- };
227
+ link.onload = () => resolve(link);
250
228
  link.onerror = () => reject(new Error(`Failed to load stylesheet: ${href}`));
251
229
  document.head.appendChild(link);
252
230
  });
@@ -513,7 +491,7 @@ exports.PaymentMethod = void 0;
513
491
  /**
514
492
  * @fileoverview Constants for Funnefox SDK
515
493
  */
516
- const SDK_VERSION = '0.9.0-beta.1';
494
+ const SDK_VERSION = '0.9.1';
517
495
  const DEFAULTS = {
518
496
  BASE_URL: 'https://billing.funnelfox.com',
519
497
  REGION: 'default',
@@ -546,6 +524,8 @@ const EVENTS = {
546
524
  PURCHASE_COMPLETED: 'purchase-completed',
547
525
  PURCHASE_CANCELLED: 'purchase-cancelled',
548
526
  METHODS_AVAILABLE: 'methods-available',
527
+ TAX_CHANGE: 'tax-change',
528
+ TAX_PENDING: 'tax-pending',
549
529
  };
550
530
  const API_ENDPOINTS = {
551
531
  CREATE_CLIENT_SESSION: '/v1/checkout/create_client_session',
@@ -1219,6 +1199,15 @@ class APIClient {
1219
1199
  method: 'POST',
1220
1200
  body: JSON.stringify(payload),
1221
1201
  }));
1202
+ if (raw.status === 'error' || !raw.data) {
1203
+ const firstError = raw.error?.[0];
1204
+ throw new APIError(firstError?.msg || 'Tax recalculation failed', null, {
1205
+ errorCode: firstError?.code,
1206
+ errorType: firstError?.type,
1207
+ requestId: raw.req_id,
1208
+ response: raw,
1209
+ });
1210
+ }
1222
1211
  return raw.data;
1223
1212
  }
1224
1213
  async resumePayment(params) {
@@ -1316,7 +1305,16 @@ class SessionService {
1316
1305
  this.cache = new Map();
1317
1306
  }
1318
1307
  buildCacheKey(p) {
1319
- return [p.orgId, p.priceId, p.externalId, p.email, p.integration].join('-');
1308
+ return [
1309
+ p.orgId,
1310
+ p.baseUrl || DEFAULTS.BASE_URL,
1311
+ p.region || DEFAULTS.REGION,
1312
+ p.countryCode ?? '',
1313
+ p.priceId,
1314
+ p.externalId,
1315
+ p.email,
1316
+ p.integration,
1317
+ ].join('|');
1320
1318
  }
1321
1319
  makeClient(orgId, baseUrl) {
1322
1320
  return new APIClient({
@@ -1342,8 +1340,19 @@ class SessionService {
1342
1340
  integration: p.integration,
1343
1341
  });
1344
1342
  this.cache.set(key, req);
1343
+ const evict = () => {
1344
+ if (this.cache.get(key) === req)
1345
+ this.cache.delete(key);
1346
+ };
1347
+ req.then(resp => {
1348
+ if (!resp || resp.status === 'error' || !resp.data)
1349
+ evict();
1350
+ }, evict);
1345
1351
  return req;
1346
1352
  }
1353
+ invalidate(p) {
1354
+ this.cache.delete(this.buildCacheKey(p));
1355
+ }
1347
1356
  clearCache() {
1348
1357
  this.cache.clear();
1349
1358
  }
@@ -1806,6 +1815,7 @@ class CheckoutInstance extends EventEmitter {
1806
1815
  super();
1807
1816
  this.counter = 0;
1808
1817
  this.cachedSessionResponse = null;
1818
+ this.taxRecalcSeq = 0;
1809
1819
  this.cardSessionFieldConfig = {};
1810
1820
  this.isTelemetryEnabled = false;
1811
1821
  this.telemetryCleanup = null;
@@ -1849,16 +1859,27 @@ class CheckoutInstance extends EventEmitter {
1849
1859
  this.isTaxEnabled = () => this.cachedSessionResponse?.data?.tax_enabled ??
1850
1860
  this.checkoutConfig.enableTax ??
1851
1861
  false;
1852
- this.emitSessionTaxEstimate = () => {
1862
+ this.getSessionTaxInfo = () => {
1853
1863
  const data = this.cachedSessionResponse?.data;
1854
1864
  if (!data || data.amount_total == null) {
1855
- return;
1865
+ return undefined;
1856
1866
  }
1857
- this.checkoutConfig.onTaxChange?.({
1867
+ return {
1858
1868
  amountTotal: data.amount_total,
1859
1869
  taxAmount: data.tax_amount ?? 0,
1860
1870
  currency: data.currency ?? '',
1861
- });
1871
+ };
1872
+ };
1873
+ this.emitTaxInfo = (info) => {
1874
+ this.lastTaxInfo = info;
1875
+ this.checkoutConfig.onTaxChange?.(info);
1876
+ this.emit(EVENTS.TAX_CHANGE, info);
1877
+ };
1878
+ this.emitSessionTaxEstimate = () => {
1879
+ const info = this.getSessionTaxInfo();
1880
+ if (info) {
1881
+ this.emitTaxInfo(info);
1882
+ }
1862
1883
  };
1863
1884
  this.runTaxRecalc = async () => {
1864
1885
  const orderId = this.orderId;
@@ -1866,6 +1887,7 @@ class CheckoutInstance extends EventEmitter {
1866
1887
  if (!orderId || !countryCode) {
1867
1888
  return;
1868
1889
  }
1890
+ const seq = ++this.taxRecalcSeq;
1869
1891
  try {
1870
1892
  const tax = await this.apiClient.recalculateTax({
1871
1893
  orderId,
@@ -1873,15 +1895,24 @@ class CheckoutInstance extends EventEmitter {
1873
1895
  countryCode,
1874
1896
  postalCode: this.cardPostalCode,
1875
1897
  });
1876
- this.checkoutConfig.onTaxChange?.({
1898
+ if (seq !== this.taxRecalcSeq) {
1899
+ return;
1900
+ }
1901
+ this.emitTaxInfo({
1877
1902
  amountTotal: tax.amount_total,
1878
1903
  taxAmount: tax.tax_amount,
1879
1904
  currency: tax.currency,
1880
1905
  });
1881
1906
  }
1882
1907
  catch (err) {
1908
+ if (seq !== this.taxRecalcSeq) {
1909
+ return;
1910
+ }
1883
1911
  // Recalc failed for the new address; surface it instead of silently showing a stale total.
1884
1912
  console.warn('[funnelfox-billing] tax recalculation failed', err);
1913
+ if (this.lastTaxInfo) {
1914
+ this.emit(EVENTS.TAX_CHANGE, this.lastTaxInfo);
1915
+ }
1885
1916
  this.checkoutConfig.onTaxError?.(err);
1886
1917
  }
1887
1918
  };
@@ -1889,6 +1920,7 @@ class CheckoutInstance extends EventEmitter {
1889
1920
  if (this.taxRecalcDebounce) {
1890
1921
  clearTimeout(this.taxRecalcDebounce);
1891
1922
  }
1923
+ this.emit(EVENTS.TAX_PENDING);
1892
1924
  this.taxRecalcDebounce = setTimeout(this.runTaxRecalc, TAX_RECALC_DEBOUNCE_MS);
1893
1925
  };
1894
1926
  // Flush a pending recalc so a card charge reflects the final entered address (no estimate drift).
@@ -2072,7 +2104,7 @@ class CheckoutInstance extends EventEmitter {
2072
2104
  integration: 'primer',
2073
2105
  });
2074
2106
  const sessionResponse = response;
2075
- if (response.data?.stripe_public_key) {
2107
+ if (response.data?.stripe_public_key && !sessionResponse.radarSessionId) {
2076
2108
  const stripePublicKey = response.data.stripe_public_key;
2077
2109
  sessionResponse.radarSessionId = loadStripe(stripePublicKey)
2078
2110
  .then(stripe => stripe
@@ -2083,7 +2115,8 @@ class CheckoutInstance extends EventEmitter {
2083
2115
  : '')
2084
2116
  .catch(() => '');
2085
2117
  }
2086
- if (response.data?.airwallex_risk_enabled) {
2118
+ if (response.data?.airwallex_risk_enabled &&
2119
+ !sessionResponse.airwallexDeviceId) {
2087
2120
  const isLivemode = response.data?.is_livemode;
2088
2121
  const deviceId = generateUUID();
2089
2122
  sessionResponse.airwallexDeviceId = loadAirwallexDeviceFingerprint(deviceId, isLivemode)
@@ -2787,120 +2820,59 @@ async function getAvailablePaymentMethods(params) {
2787
2820
  }
2788
2821
  async function createStripeCardForm(element, params) {
2789
2822
  const config = resolveConfig(params, 'createStripeCardForm');
2823
+ const sessionParams = {
2824
+ orgId: config.orgId,
2825
+ baseUrl: config.baseUrl,
2826
+ region: config.region,
2827
+ priceId: params.priceId,
2828
+ externalId: params.externalId,
2829
+ email: params.email,
2830
+ clientMetadata: params.clientMetadata,
2831
+ countryCode: params.countryCode,
2832
+ integration: 'stripe',
2833
+ };
2790
2834
  const [session, { mountStripeCardForm }] = await Promise.all([
2791
- sessionService.createSession({
2792
- orgId: config.orgId,
2793
- baseUrl: config.baseUrl,
2794
- region: config.region,
2795
- priceId: params.priceId,
2796
- externalId: params.externalId,
2797
- email: params.email,
2798
- clientMetadata: params.clientMetadata,
2799
- countryCode: params.countryCode,
2800
- integration: 'stripe',
2801
- }),
2835
+ sessionService.createSession(sessionParams),
2802
2836
  Promise.resolve().then(function () { return require('./chunk-stripe-card-form.cjs.js'); }),
2803
2837
  ]);
2804
2838
  const apiClient = new APIClient({
2805
2839
  orgId: config.orgId,
2806
2840
  baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
2807
2841
  });
2808
- return mountStripeCardForm(element, session, { ...params, apiClient });
2809
- }
2810
- async function createAdyenCardForm(element, params) {
2811
- const config = resolveConfig(params, 'createAdyenCardForm');
2812
- const [session, { mountAdyenCardForm }] = await Promise.all([
2813
- sessionService.createSession({
2814
- orgId: config.orgId,
2815
- baseUrl: config.baseUrl,
2816
- region: config.region,
2817
- priceId: params.priceId,
2818
- externalId: params.externalId,
2819
- email: params.email,
2820
- clientMetadata: params.clientMetadata,
2821
- countryCode: params.countryCode,
2822
- integration: 'adyen',
2823
- }),
2824
- Promise.resolve().then(function () { return require('./chunk-adyen-card-form.cjs.js'); }),
2825
- ]);
2826
- const apiClient = new APIClient({
2827
- orgId: config.orgId,
2828
- baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
2842
+ apiClient.processSessionResponse(session);
2843
+ return mountStripeCardForm(element, session, {
2844
+ ...params,
2845
+ apiClient,
2846
+ invalidateSession: () => sessionService.invalidate(sessionParams),
2829
2847
  });
2830
- return mountAdyenCardForm(element, session, { ...params, apiClient });
2831
- }
2832
- async function purchaseAdyenWallet(params) {
2833
- const config = resolveConfig(params, 'purchaseAdyenWallet');
2834
- const [session, { purchaseWallet }] = await Promise.all([
2835
- sessionService.createSession({
2836
- orgId: config.orgId,
2837
- baseUrl: config.baseUrl,
2838
- region: config.region,
2839
- priceId: params.priceId,
2840
- externalId: params.externalId,
2841
- email: params.email,
2842
- clientMetadata: params.clientMetadata,
2843
- countryCode: params.countryCode,
2844
- integration: 'adyen',
2845
- }),
2846
- Promise.resolve().then(function () { return require('./chunk-adyen-wallet.cjs.js'); }),
2847
- ]);
2848
- const apiClient = new APIClient({
2849
- orgId: config.orgId,
2850
- baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
2851
- });
2852
- return purchaseWallet(session, { ...params, apiClient });
2853
- }
2854
- async function getAvailableAdyenWallet(params) {
2855
- const config = resolveConfig(params, 'getAvailableAdyenWallet');
2856
- const [session, { getAvailableWallet }] = await Promise.all([
2857
- sessionService.createSession({
2858
- orgId: config.orgId,
2859
- baseUrl: config.baseUrl,
2860
- region: config.region,
2861
- priceId: params.priceId,
2862
- externalId: params.externalId,
2863
- email: params.email,
2864
- clientMetadata: params.clientMetadata,
2865
- countryCode: params.countryCode,
2866
- integration: 'adyen',
2867
- }),
2868
- Promise.resolve().then(function () { return require('./chunk-adyen-wallet.cjs.js'); }),
2869
- ]);
2870
- const result = await getAvailableWallet(session);
2871
- if (result === 'APPLE_PAY')
2872
- return exports.PaymentMethod.APPLE_PAY;
2873
- if (result === 'GOOGLE_PAY')
2874
- return exports.PaymentMethod.GOOGLE_PAY;
2875
- return null;
2876
- }
2877
- async function getAvailableAdyenPaymentMethods(params) {
2878
- const wallet = await getAvailableAdyenWallet(params);
2879
- return wallet
2880
- ? [exports.PaymentMethod.PAYMENT_CARD, wallet]
2881
- : [exports.PaymentMethod.PAYMENT_CARD];
2882
2848
  }
2883
2849
  async function purchaseStripeWallet(params) {
2884
2850
  const config = resolveConfig(params, 'purchaseStripeWallet');
2851
+ const sessionParams = {
2852
+ orgId: config.orgId,
2853
+ baseUrl: config.baseUrl,
2854
+ region: config.region,
2855
+ priceId: params.priceId,
2856
+ externalId: params.externalId,
2857
+ email: params.email,
2858
+ clientMetadata: params.clientMetadata,
2859
+ countryCode: params.countryCode,
2860
+ integration: 'stripe',
2861
+ };
2885
2862
  const [session, { purchaseWallet }] = await Promise.all([
2886
- sessionService.createSession({
2887
- orgId: config.orgId,
2888
- baseUrl: config.baseUrl,
2889
- region: config.region,
2890
- priceId: params.priceId,
2891
- externalId: params.externalId,
2892
- email: params.email,
2893
- clientMetadata: params.clientMetadata,
2894
- countryCode: params.countryCode,
2895
- integration: 'stripe',
2896
- }),
2863
+ sessionService.createSession(sessionParams),
2897
2864
  Promise.resolve().then(function () { return require('./chunk-stripe-wallet.cjs.js'); }),
2898
2865
  ]);
2899
2866
  const apiClient = new APIClient({
2900
2867
  orgId: config.orgId,
2901
2868
  baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
2902
2869
  });
2903
- return purchaseWallet(session, { ...params, apiClient });
2870
+ apiClient.processSessionResponse(session);
2871
+ return purchaseWallet(session, {
2872
+ ...params,
2873
+ apiClient,
2874
+ invalidateSession: () => sessionService.invalidate(sessionParams),
2875
+ });
2904
2876
  }
2905
2877
  async function getAvailableStripeWallet(params) {
2906
2878
  const config = resolveConfig(params, 'getAvailableStripeWallet');
@@ -2918,6 +2890,11 @@ async function getAvailableStripeWallet(params) {
2918
2890
  }),
2919
2891
  Promise.resolve().then(function () { return require('./chunk-stripe-wallet.cjs.js'); }),
2920
2892
  ]);
2893
+ const apiClient = new APIClient({
2894
+ orgId: config.orgId,
2895
+ baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
2896
+ });
2897
+ apiClient.processSessionResponse(session);
2921
2898
  const result = await getAvailableWallet(session);
2922
2899
  if (result === 'APPLE_PAY')
2923
2900
  return exports.PaymentMethod.APPLE_PAY;
@@ -2948,16 +2925,11 @@ const Billing = {
2948
2925
  getAvailableWallet: getAvailableStripeWallet,
2949
2926
  getAvailablePaymentMethods: getAvailableStripePaymentMethods,
2950
2927
  },
2951
- adyen: {
2952
- createCardForm: createAdyenCardForm,
2953
- purchaseWallet: purchaseAdyenWallet,
2954
- getAvailableWallet: getAvailableAdyenWallet,
2955
- getAvailablePaymentMethods: getAvailableAdyenPaymentMethods,
2956
- },
2957
2928
  };
2958
2929
  if (typeof window !== 'undefined') {
2959
2930
  window.Billing = Billing;
2960
2931
  }
2932
+ console.debug('Billing SDK inited');
2961
2933
 
2962
2934
  exports.APIError = APIError;
2963
2935
  exports.Billing = Billing;
@@ -2977,6 +2949,4 @@ exports.configure = configure;
2977
2949
  exports.createCheckout = createCheckout;
2978
2950
  exports.createClientSession = createClientSession;
2979
2951
  exports.getAvailablePaymentMethods = getAvailablePaymentMethods;
2980
- exports.loadScript = loadScript$1;
2981
2952
  exports.loadStripe = loadStripe;
2982
- exports.loadStylesheet = loadStylesheet;
@@ -9,7 +9,7 @@
9
9
 
10
10
  var template = "<div>\n <label class=\"ff-card-form-label\" for=\"cardNumberInput\">Card number</label>\n <div id=\"cardNumberInput\"></div>\n <div class=\"errorContainer\"></div>\n</div>\n<div class=\"card-form-row\">\n <div>\n <label class=\"ff-card-form-label\" for=\"expiryInput\">Expiration date</label>\n <div id=\"expiryInput\"></div>\n <div class=\"errorContainer\"></div>\n </div>\n <div>\n <label class=\"ff-card-form-label\" for=\"cvvInput\">Security code</label>\n <div id=\"cvvInput\">\n <svg width=\"200\" height=\"200\" viewBox=\"0 0 200 200\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"200\" fill=\"transparent\"/>\n <g clip-path=\"url(#clip0_0_1)\">\n <path d=\"M157.555 23C168.279 23.0002 177 31.7394 177 42.4854V80.5889C171.946 72.0151 164.749 64.8558 156.146 59.8457H166.394V42.4854C166.393 37.6004 162.43 33.6291 157.555 33.6289H27.4453C22.5704 33.6291 18.6066 37.6004 18.6064 42.4854V59.8457H97.8535C88.9153 65.0512 81.4954 72.5771 76.4189 81.5986H18.6064V127.515C18.6066 132.4 22.5704 136.371 27.4453 136.371H75.3281C77.2742 140.177 79.6285 143.739 82.333 147H27.4453C16.7215 147 8.00019 138.261 8 127.515V42.4854C8.0002 31.7394 16.7215 23.0002 27.4453 23H157.555Z\" fill=\"#93939A\"/>\n <mask id=\"path-2-outside-1_0_1\" maskUnits=\"userSpaceOnUse\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\" fill=\"black\">\n <rect fill=\"white\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\"/>\n </mask>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" fill=\"#93939A\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" stroke=\"transparent\" stroke-width=\"20\" mask=\"url(#path-2-outside-1_0_1)\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_0_1\">\n <rect width=\"200\" height=\"200\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n <div class=\"errorContainer\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"cardHolderInput\">Cardholder name</label>\n <input class=\"ff-card-form-text-input\" id=\"cardHolderInput\" type=\"text\" pattern=\"[A-Za-z\\s]+\" placeholder=\"Full name on card\">\n <div class=\"errorContainer\"></div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"emailAddressInput\">Email</label>\n <input class=\"ff-card-form-text-input\" id=\"emailAddressInput\" placeholder=\"Email\" type=\"email\">\n <div class=\"errorContainer\"></div>\n</div>\n<div id=\"countrySelectorField\">\n <label class=\"ff-card-form-label\" for=\"countrySelectorInput\">Country</label>\n <div class=\"ff-select-wrap\">\n <select class=\"ff-card-form-text-input ff-card-form-select\" id=\"countrySelectorInput\"></select>\n <div class=\"ff-select-arrow\" aria-hidden=\"true\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"postalCodeInput\">Zip code</label>\n <input class=\"ff-card-form-text-input\" id=\"postalCodeInput\" placeholder=\"12345\">\n <div class=\"errorContainer\"></div>\n</div>\n";
11
11
 
12
- if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #d10000;\n font-size: 16px;\n line-height: 1;\n margin: 0 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 }";
12
+ if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #d10000;\n font-size: 16px;\n line-height: 1;\n margin: 0 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) {