@funnelfox/billing 0.8.0-ffb-550.37 → 0.8.0-ffb-631.40

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
@@ -421,6 +421,8 @@ try {
421
421
  console.log('Error Code:', error.errorCode); // e.g., 'double_purchase'
422
422
  console.log('Error Type:', error.errorType); // e.g., 'api_exception'
423
423
  console.log('Request ID:', error.requestId); // For support
424
+ console.log('Decline Code:', error.declineCode); // e.g., 'INSUFFICIENT_FUNDS', set on failed payments
425
+ console.log('Decline Source:', error.declineCodeSource); // 'primer' | 'stripe' | 'adyen', when the provider reports one
424
426
  console.log('Message:', error.message);
425
427
  } else if (error instanceof PrimerError) {
426
428
  // Primer SDK error
@@ -634,6 +636,8 @@ const paymentMethod = await Billing.initMethod(
634
636
  },
635
637
  onPaymentFail: error => {
636
638
  console.error('Payment failed:', error.message);
639
+ console.log('Decline code:', error.declineCode); // e.g., 'INSUFFICIENT_FUNDS', when the provider reports one
640
+ console.log('Decline source:', error.declineCodeSource); // 'primer' | 'stripe' | 'adyen'
637
641
  },
638
642
  onPaymentCancel: () => {
639
643
  console.log('Payment was cancelled');
@@ -119,6 +119,8 @@ class APIError extends FunnefoxSDKError {
119
119
  this.errorType = options.errorType || null;
120
120
  this.requestId = options.requestId || null;
121
121
  this.response = options.response || null;
122
+ this.declineCode = options.declineCode || null;
123
+ this.declineCodeSource = options.declineCodeSource || null;
122
124
  }
123
125
  }
124
126
  class PrimerError extends FunnefoxSDKError {
@@ -323,13 +325,64 @@ async function loadPrimerSDK(version) {
323
325
  /**
324
326
  * @fileoverview Helper utilities for Funnefox SDK
325
327
  */
326
- // Primer reports an error on every keystroke and even for fields the buyer has not reached yet
327
- // (an empty CVV is "required" while the card number is still being typed), so the error is shown
328
- // only once the buyer has typed into the field and left it, or has tried to submit.
329
- function shouldShowHostedInputError(input) {
330
- return input.submitted || (input.touched && input.dirty);
328
+ // Mirrors Stripe Elements: a card number that can never become valid is reported while the buyer
329
+ // types, an incomplete value only after they leave the field, and an empty one only after a submit
330
+ // attempt. Primer reports every error on every keystroke, even for fields the buyer has not reached
331
+ // yet, and its expiry codes cannot tell a typo from a half-typed date ("1" is already
332
+ // expiryYearInvalid, "01/2" is cardExpired), so expiry errors wait for the buyer to leave the field.
333
+ const HOSTED_INPUT_ERRORS_SHOWN_WHILE_TYPING = new Set(['cardInvalid']);
334
+ const HOSTED_INPUT_ERRORS_FOR_EMPTY_FIELD = new Set([
335
+ 'cardRequired',
336
+ 'expiryRequired',
337
+ 'cvvRequired',
338
+ ]);
339
+ function getVisibleHostedInputError(input) {
340
+ if (!input.error) {
341
+ return null;
342
+ }
343
+ if (input.errorCode &&
344
+ HOSTED_INPUT_ERRORS_SHOWN_WHILE_TYPING.has(input.errorCode)) {
345
+ return input.error;
346
+ }
347
+ if (input.active) {
348
+ return null;
349
+ }
350
+ if (input.submitted) {
351
+ return input.error;
352
+ }
353
+ if (input.errorCode &&
354
+ HOSTED_INPUT_ERRORS_FOR_EMPTY_FIELD.has(input.errorCode)) {
355
+ return null;
356
+ }
357
+ return input.touched ? input.error : null;
331
358
  }
332
359
  function resolveTaxDisplay(source) {
360
+ return {
361
+ ...resolveTaxAmount(source),
362
+ ...resolveTaxBreakdown(source.tax_breakdown),
363
+ };
364
+ }
365
+ function resolveTaxBreakdown(breakdown) {
366
+ if (!Array.isArray(breakdown)) {
367
+ return {};
368
+ }
369
+ const taxBreakdown = breakdown.map(entry => ({
370
+ amount: entry.amount,
371
+ percentage: entry.percentage,
372
+ inclusive: entry.inclusive,
373
+ taxType: entry.tax_type,
374
+ country: entry.country,
375
+ subdivision: entry.subdivision,
376
+ taxabilityReason: entry.taxability_reason,
377
+ }));
378
+ const percentages = taxBreakdown.map(entry => Number(entry.percentage));
379
+ if (!percentages.length || !percentages.every(Number.isFinite)) {
380
+ return { taxBreakdown };
381
+ }
382
+ const taxRate = Number(percentages.reduce((sum, percentage) => sum + percentage, 0).toFixed(6));
383
+ return { taxBreakdown, taxRate };
384
+ }
385
+ function resolveTaxAmount(source) {
333
386
  const taxBehavior = source.tax_behavior ??
334
387
  ((source.tax_amount ?? 0) > 0 ? 'exclusive' : undefined);
335
388
  if (taxBehavior === 'inclusive') {
@@ -508,7 +561,7 @@ exports.PaymentMethod = void 0;
508
561
  /**
509
562
  * @fileoverview Constants for Funnefox SDK
510
563
  */
511
- const SDK_VERSION = '0.8.0-ffb-550.37';
564
+ const SDK_VERSION = '0.8.0-ffb-631.40';
512
565
  const DEFAULTS = {
513
566
  BASE_URL: 'https://billing.funnelfox.com',
514
567
  REGION: 'default',
@@ -601,6 +654,7 @@ const DEFAULT_PAYMENT_METHOD_ORDER = [
601
654
  const DEFAULT_BUTTONS_OPTIONS = {
602
655
  [exports.PaymentMethod.APPLE_PAY]: {
603
656
  buttonStyle: 'black',
657
+ buttonType: 'continue',
604
658
  },
605
659
  [exports.PaymentMethod.PAYPAL]: {
606
660
  buttonColor: 'gold',
@@ -645,6 +699,117 @@ function requireString(value, fieldName) {
645
699
  return true;
646
700
  }
647
701
 
702
+ /**
703
+ * @fileoverview Support for Apple's official <apple-pay-button> custom element.
704
+ *
705
+ * Primer's checkout-web v2 renders the Apple Pay button through the CSS
706
+ * approach (-webkit-appearance: -apple-pay-button), and WebKit only accepts
707
+ * the 7 legacy values for -apple-pay-button-type. Newer types such as
708
+ * 'continue' are silently dropped and fall back to 'plain' (verified in
709
+ * Safari 26 on macOS and iOS, see PRD-1426).
710
+ *
711
+ * Apple's official custom element supports the full set of button types, so
712
+ * for "native-only" types we overlay it on top of the (visually hidden)
713
+ * Primer button and forward clicks, keeping Primer's payment flow untouched.
714
+ */
715
+ const APPLE_PAY_SDK_URL = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
716
+ /** How long to wait for the <apple-pay-button> element definition before
717
+ * giving up and falling back to Primer's own button. */
718
+ const ELEMENT_DEFINITION_TIMEOUT_MS = 4000;
719
+ /**
720
+ * Button types WebKit can render through Primer's CSS approach.
721
+ * Everything outside this list requires the native <apple-pay-button> element.
722
+ */
723
+ const CSS_RENDERABLE_APPLE_PAY_TYPES = [
724
+ 'plain',
725
+ 'buy',
726
+ 'set-up',
727
+ 'donate',
728
+ 'check-out',
729
+ 'book',
730
+ 'subscribe',
731
+ ];
732
+ /**
733
+ * Returns true when the requested Apple Pay buttonType can only be rendered
734
+ * with Apple's native <apple-pay-button> element.
735
+ */
736
+ function isNativeOnlyApplePayButtonType(type) {
737
+ return !!type && !CSS_RENDERABLE_APPLE_PAY_TYPES.includes(type);
738
+ }
739
+ /**
740
+ * Loads Apple's apple-pay-sdk.js (defines the <apple-pay-button> custom
741
+ * element). Resolves to true when the element is available.
742
+ */
743
+ async function loadApplePayButtonElement() {
744
+ if (typeof window === 'undefined' || !window.customElements) {
745
+ return false;
746
+ }
747
+ if (window.customElements.get('apple-pay-button')) {
748
+ return true;
749
+ }
750
+ try {
751
+ await loadScript$1({
752
+ src: APPLE_PAY_SDK_URL,
753
+ crossOrigin: 'anonymous',
754
+ appendTo: 'head',
755
+ });
756
+ // Never hang on a script that loaded but did not define the element;
757
+ // fall back to Primer's own button instead.
758
+ const defined = window.customElements
759
+ .whenDefined('apple-pay-button')
760
+ .then(() => true);
761
+ const timeout = new Promise(resolve => {
762
+ setTimeout(() => resolve(false), ELEMENT_DEFINITION_TIMEOUT_MS);
763
+ });
764
+ return await Promise.race([defined, timeout]);
765
+ }
766
+ catch {
767
+ return false;
768
+ }
769
+ }
770
+ /**
771
+ * Renders Apple's native <apple-pay-button> stretched over `wrapper` and
772
+ * forwards clicks to the Primer-rendered <button> inside it. The synchronous
773
+ * forwarded click preserves the user activation required by ApplePaySession.
774
+ *
775
+ * Returns the overlay element, or null when the Apple Pay SDK could not be
776
+ * loaded (callers should keep Primer's own button visible as a fallback).
777
+ */
778
+ async function overlayNativeApplePayButton(wrapper, options) {
779
+ const available = await loadApplePayButtonElement();
780
+ if (!available) {
781
+ return null;
782
+ }
783
+ // The overlay is only safe when Primer's own clickable button is present;
784
+ // otherwise there is nothing to forward the click to.
785
+ if (!wrapper.querySelector('button')) {
786
+ return null;
787
+ }
788
+ const native = document.createElement('apple-pay-button');
789
+ native.setAttribute('type', options.buttonType);
790
+ native.setAttribute('buttonstyle', options.buttonStyle || 'black');
791
+ native.setAttribute('locale', (typeof navigator !== 'undefined' && navigator.language) || 'en-US');
792
+ native.style.cssText = [
793
+ 'position:absolute',
794
+ 'inset:0',
795
+ 'width:100%',
796
+ 'height:100%',
797
+ '--apple-pay-button-width:100%',
798
+ '--apple-pay-button-height:100%',
799
+ '--apple-pay-button-border-radius:28px',
800
+ 'display:block',
801
+ 'cursor:pointer',
802
+ 'z-index:1',
803
+ ].join(';');
804
+ wrapper.style.position = 'relative';
805
+ native.addEventListener('click', () => {
806
+ const primerButton = wrapper.querySelector('button');
807
+ primerButton?.click();
808
+ });
809
+ wrapper.appendChild(native);
810
+ return native;
811
+ }
812
+
648
813
  /**
649
814
  * @fileoverview Primer SDK integration wrapper
650
815
  */
@@ -683,6 +848,7 @@ class PrimerWrapper {
683
848
  }
684
849
  async createHeadlessCheckout(clientToken, options, method) {
685
850
  await this.ensurePrimerLoaded();
851
+ this.applePayOptions = options.applePay;
686
852
  this.currentHeadless = PrimerWrapper.headlessManager.getOrCreate(clientToken, options, method);
687
853
  return this.currentHeadless;
688
854
  }
@@ -729,16 +895,56 @@ class PrimerWrapper {
729
895
  }
730
896
  htmlNode.appendChild(wrapper);
731
897
  /* end hack */
898
+ /* PRD-1426: WebKit cannot render newer Apple Pay button types (e.g.
899
+ * 'continue') through the CSS approach Primer v2 uses. For those types
900
+ * we overlay Apple's official <apple-pay-button> element on top of the
901
+ * visually hidden Primer button and forward clicks, keeping Primer's
902
+ * payment flow untouched. The Primer button is hidden BEFORE it renders
903
+ * to avoid a flash of the plain button; if the Apple SDK fails to load,
904
+ * the rule is removed and Primer's own button stays visible (graceful
905
+ * fallback to 'plain'). */
906
+ const applePayConfig = this.applePayOptions;
907
+ const nativeButtonType = allowedPaymentMethod === exports.PaymentMethod.APPLE_PAY &&
908
+ applePayConfig?.buttonType &&
909
+ isNativeOnlyApplePayButtonType(applePayConfig.buttonType)
910
+ ? applePayConfig.buttonType
911
+ : null;
912
+ let hideRuleIndex = null;
913
+ if (nativeButtonType && sheet) {
914
+ hideRuleIndex = sheet.insertRule(`
915
+ .${wrapper.className} > button {
916
+ opacity: 0 !important;
917
+ }
918
+ `);
919
+ }
732
920
  button = pmManager.createButton();
733
921
  await button.render(wrapper, {});
734
- this.destroyCallbacks.push(() => button.clean());
922
+ let nativeOverlay = null;
923
+ if (nativeButtonType) {
924
+ nativeOverlay = await overlayNativeApplePayButton(wrapper, {
925
+ buttonType: nativeButtonType,
926
+ buttonStyle: applePayConfig?.buttonStyle,
927
+ });
928
+ if (!nativeOverlay && sheet && hideRuleIndex !== null) {
929
+ sheet.deleteRule(hideRuleIndex);
930
+ }
931
+ }
932
+ this.destroyCallbacks.push(() => {
933
+ nativeOverlay?.remove();
934
+ button.clean();
935
+ });
735
936
  onMethodRender(allowedPaymentMethod);
736
937
  return {
737
938
  setDisabled: (disabled) => {
738
939
  button.setDisabled(disabled);
940
+ if (nativeOverlay) {
941
+ nativeOverlay.style.pointerEvents = disabled ? 'none' : '';
942
+ nativeOverlay.style.opacity = disabled ? '0.5' : '';
943
+ }
739
944
  },
740
945
  destroy: () => {
741
946
  styleEl.remove();
947
+ nativeOverlay?.remove();
742
948
  button.clean();
743
949
  },
744
950
  };
@@ -823,11 +1029,22 @@ class PrimerWrapper {
823
1029
  ? 'Please enter a postal code'
824
1030
  : null;
825
1031
  };
1032
+ const focusedHostedInputs = new Set();
826
1033
  const onHostedInputChange = (name) => (event) => {
827
1034
  const input = event;
828
- if (shouldShowHostedInputError(input)) {
829
- dispatchError(name, input.error);
1035
+ const justFocused = input.active && !focusedHostedInputs.has(name);
1036
+ if (input.active) {
1037
+ focusedHostedInputs.add(name);
1038
+ }
1039
+ else {
1040
+ focusedHostedInputs.delete(name);
1041
+ }
1042
+ // Primer sends a change on focus before any keystroke; like Stripe, the error the buyer
1043
+ // came back to fix stays visible until they start typing.
1044
+ if (justFocused) {
1045
+ return;
830
1046
  }
1047
+ dispatchError(name, getVisibleHostedInputError(input));
831
1048
  };
832
1049
  const cardHolderOnChange = async (e) => {
833
1050
  pmManager.setCardholderName(e.target.value);
@@ -1085,6 +1302,37 @@ class PrimerWrapper {
1085
1302
  }
1086
1303
  PrimerWrapper.headlessManager = new HeadlessManager();
1087
1304
 
1305
+ /**
1306
+ * @fileoverview Normalization of payment failure errors
1307
+ */
1308
+ const STRIPE_CARD_ERROR = 'card_error';
1309
+ function declineCodeFromStripeError(error) {
1310
+ const { type, code } = error;
1311
+ if (type !== STRIPE_CARD_ERROR || typeof code !== 'string' || !code) {
1312
+ return null;
1313
+ }
1314
+ return code.toUpperCase();
1315
+ }
1316
+ function toPaymentFailure(error) {
1317
+ const failure = new Error(error?.message || 'Payment processing failed');
1318
+ if (error instanceof APIError) {
1319
+ if (error.declineCode) {
1320
+ failure.declineCode = error.declineCode;
1321
+ }
1322
+ if (error.declineCodeSource) {
1323
+ failure.declineCodeSource = error.declineCodeSource;
1324
+ }
1325
+ }
1326
+ else if (error instanceof Error) {
1327
+ const declineCode = declineCodeFromStripeError(error);
1328
+ if (declineCode) {
1329
+ failure.declineCode = declineCode;
1330
+ failure.declineCodeSource = 'stripe';
1331
+ }
1332
+ }
1333
+ return failure;
1334
+ }
1335
+
1088
1336
  /**
1089
1337
  * @fileoverview API client for Funnefox backend integration
1090
1338
  */
@@ -1282,7 +1530,11 @@ class APIClient {
1282
1530
  status: 'succeeded',
1283
1531
  };
1284
1532
  case 'failed':
1285
- throw new APIError(data.failed_message_for_user || 'Payment failed', null, { response });
1533
+ throw new APIError(data.failed_message_for_user || 'Payment failed', null, {
1534
+ response,
1535
+ declineCode: data.decline_code,
1536
+ declineCodeSource: data.decline_code_source,
1537
+ });
1286
1538
  case 'cancelled':
1287
1539
  throw new APIError('Payment was cancelled by user', null, {
1288
1540
  response,
@@ -1833,6 +2085,9 @@ class CheckoutInstance extends EventEmitter {
1833
2085
  this.counter = 0;
1834
2086
  this.cachedSessionResponse = null;
1835
2087
  this.taxRecalcSeq = 0;
2088
+ // WebKit allows one ApplePaySession per page: a second tap while the sheet is
2089
+ // still opening throws InvalidAccessError, but Primer asks to start first.
2090
+ this.isApplePaySheetOpen = false;
1836
2091
  this.cardSessionFieldConfig = {};
1837
2092
  this.isTelemetryEnabled = false;
1838
2093
  this.telemetryCleanup = null;
@@ -1995,10 +2250,11 @@ class CheckoutInstance extends EventEmitter {
1995
2250
  }
1996
2251
  catch (error) {
1997
2252
  this._setState('error');
1998
- this.emit(EVENTS.PURCHASE_FAILURE, new Error(error.message || 'Payment processing failed'));
1999
- primerHandler.handleFailure(error.message || 'Payment processing failed');
2253
+ this.emit(EVENTS.PURCHASE_FAILURE, toPaymentFailure(error));
2254
+ primerHandler.handleFailure(error?.message || 'Payment processing failed');
2000
2255
  }
2001
2256
  finally {
2257
+ this.isApplePaySheetOpen = false;
2002
2258
  this.onLoaderChangeWithRace(false);
2003
2259
  this._setState('ready');
2004
2260
  }
@@ -2020,10 +2276,11 @@ class CheckoutInstance extends EventEmitter {
2020
2276
  }
2021
2277
  catch (error) {
2022
2278
  this._setState('error');
2023
- this.emit(EVENTS.PURCHASE_FAILURE, new Error(error.message || 'Payment processing failed'));
2024
- primerHandler.handleFailure(error.message || 'Payment processing failed');
2279
+ this.emit(EVENTS.PURCHASE_FAILURE, toPaymentFailure(error));
2280
+ primerHandler.handleFailure(error?.message || 'Payment processing failed');
2025
2281
  }
2026
2282
  finally {
2283
+ this.isApplePaySheetOpen = false;
2027
2284
  this.emit(EVENTS.PURCHASE_COMPLETED);
2028
2285
  this.onLoaderChangeWithRace(false);
2029
2286
  this._setState('ready');
@@ -2348,10 +2605,11 @@ class CheckoutInstance extends EventEmitter {
2348
2605
  ...checkoutConfig,
2349
2606
  ...options,
2350
2607
  card: merge(this.getPrimerCardConfig() || {}, options.card || {}),
2351
- applePay: merge(this.checkoutConfig.applePay || {}, options.applePay || {}),
2608
+ applePay: merge(DEFAULT_BUTTONS_OPTIONS[exports.PaymentMethod.APPLE_PAY], options.applePay || {}, this.checkoutConfig.applePay || {}),
2352
2609
  onTokenizeSuccess: this.handleTokenizeSuccess,
2353
2610
  onResumeSuccess: this.handleResumeSuccess,
2354
2611
  onResumeError: error => {
2612
+ this.isApplePaySheetOpen = false;
2355
2613
  if (error.stack?.includes('PROCESSOR_3DS') &&
2356
2614
  error.code === 'RESUME_ERROR' &&
2357
2615
  error.message?.includes('fetch resume key')) {
@@ -2361,15 +2619,23 @@ class CheckoutInstance extends EventEmitter {
2361
2619
  this.emit(EVENTS.PURCHASE_FAILURE, error);
2362
2620
  },
2363
2621
  onCheckoutFail: error => {
2622
+ this.isApplePaySheetOpen = false;
2364
2623
  this.emit(EVENTS.PURCHASE_FAILURE, error);
2365
2624
  },
2366
2625
  onTokenizeError: error => {
2626
+ this.isApplePaySheetOpen = false;
2367
2627
  this.emit(EVENTS.PURCHASE_FAILURE, error);
2368
2628
  },
2369
2629
  onTokenizeStart: () => {
2370
2630
  wasPaymentProcessedStarted = true;
2371
2631
  },
2372
2632
  onTokenizeShouldStart: data => {
2633
+ if (data.paymentMethodType === exports.PaymentMethod.APPLE_PAY) {
2634
+ if (this.isApplePaySheetOpen) {
2635
+ return false;
2636
+ }
2637
+ this.isApplePaySheetOpen = true;
2638
+ }
2373
2639
  this.activePaymentMethodType = data.paymentMethodType;
2374
2640
  this.emit(EVENTS.ERROR, undefined);
2375
2641
  this.emit(EVENTS.START_PURCHASE, data.paymentMethodType);
@@ -2381,6 +2647,7 @@ class CheckoutInstance extends EventEmitter {
2381
2647
  this.emit(EVENTS.ERROR, undefined);
2382
2648
  break;
2383
2649
  case 'PAYMENT_METHOD_UNSELECTED':
2650
+ this.isApplePaySheetOpen = false;
2384
2651
  if (!wasPaymentProcessedStarted) {
2385
2652
  this.emit(EVENTS.PURCHASE_CANCELLED);
2386
2653
  }
@@ -2975,3 +3242,4 @@ exports.createClientSession = createClientSession;
2975
3242
  exports.getAvailablePaymentMethods = getAvailablePaymentMethods;
2976
3243
  exports.loadStripe = loadStripe;
2977
3244
  exports.resolveTaxDisplay = resolveTaxDisplay;
3245
+ exports.toPaymentFailure = toPaymentFailure;
@@ -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 }\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: #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) {