stripe-pwa-elements 4.0.0 → 4.0.2

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.
Files changed (108) hide show
  1. package/dist/cjs/factory-tenFFIul.js +1200 -0
  2. package/dist/cjs/{factory-da3xAKkz.js → i18n-FhEOc8vz.js} +6 -1131
  3. package/dist/cjs/ion-icon_2.cjs.entry.js +723 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/stripe-address-element.cjs.entry.js +12 -4
  6. package/dist/cjs/stripe-card-element-modal.cjs.entry.js +3 -2
  7. package/dist/cjs/{stripe-card-element_2.cjs.entry.js → stripe-card-element.cjs.entry.js} +15 -82
  8. package/dist/cjs/stripe-currency-selector.cjs.entry.js +11 -3
  9. package/dist/cjs/stripe-elements.cjs.js +1 -1
  10. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +31 -5
  11. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +11 -3
  12. package/dist/cjs/stripe-payment-element.cjs.entry.js +106 -161
  13. package/dist/cjs/stripe-payment-element.helpers-DukP33RI.js +122 -0
  14. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +23 -16
  15. package/dist/cjs/stripe-payment-sheet.cjs.entry.js +506 -0
  16. package/dist/collection/collection-manifest.json +3 -2
  17. package/dist/collection/components/stripe-address-element/stripe-address-element.js +7 -0
  18. package/dist/collection/components/stripe-card-element/stripe-card-element.js +10 -2
  19. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
  20. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +7 -0
  21. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +25 -0
  22. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +7 -0
  23. package/dist/collection/components/stripe-modal/stripe-modal.css +23 -1
  24. package/dist/collection/components/stripe-modal/stripe-modal.js +147 -6
  25. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +94 -37
  26. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +17 -10
  27. package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +179 -0
  28. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
  29. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +90 -0
  30. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +544 -0
  31. package/dist/collection/services/express-checkout-element-manager.js +36 -2
  32. package/dist/collection/services/stripe-service.js +37 -5
  33. package/dist/collection/utils/focus.js +76 -0
  34. package/dist/collection/utils/i18n.js +6 -0
  35. package/dist/components/factory.js +1 -1
  36. package/dist/components/i18n.js +1 -0
  37. package/dist/components/stripe-address-element.js +1 -1
  38. package/dist/components/stripe-card-element-modal.js +1 -1
  39. package/dist/components/stripe-card-element2.js +1 -1
  40. package/dist/components/stripe-currency-selector.js +1 -1
  41. package/dist/components/stripe-express-checkout-element.js +1 -1
  42. package/dist/components/stripe-link-authentication-element.js +1 -1
  43. package/dist/components/stripe-modal2.js +1 -1
  44. package/dist/components/stripe-payment-element.helpers.js +1 -0
  45. package/dist/components/stripe-payment-element.js +1 -1
  46. package/dist/components/stripe-payment-request-button2.js +1 -1
  47. package/dist/components/stripe-payment-sheet.d.ts +11 -0
  48. package/dist/components/stripe-payment-sheet.js +1 -0
  49. package/dist/esm/factory-Cd6OGTWN.js +1198 -0
  50. package/dist/esm/{factory-DeqoYLf_.js → i18n-B6JoQetF.js} +7 -1131
  51. package/dist/esm/ion-icon_2.entry.js +720 -0
  52. package/dist/esm/loader.js +1 -1
  53. package/dist/esm/stripe-address-element.entry.js +9 -1
  54. package/dist/esm/stripe-card-element-modal.entry.js +3 -2
  55. package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +13 -79
  56. package/dist/esm/stripe-currency-selector.entry.js +9 -1
  57. package/dist/esm/stripe-elements.js +1 -1
  58. package/dist/esm/stripe-express-checkout-element.entry.js +27 -1
  59. package/dist/esm/stripe-link-authentication-element.entry.js +9 -1
  60. package/dist/esm/stripe-payment-element.entry.js +98 -153
  61. package/dist/esm/stripe-payment-element.helpers-CipV87b8.js +117 -0
  62. package/dist/esm/stripe-payment-request-button.entry.js +18 -11
  63. package/dist/esm/stripe-payment-sheet.entry.js +504 -0
  64. package/dist/stripe-elements/{p-38e7b187.entry.js → p-4891edf0.entry.js} +1 -1
  65. package/dist/stripe-elements/p-5338bc5e.entry.js +1 -0
  66. package/dist/stripe-elements/p-6a9c8b7a.entry.js +1 -0
  67. package/dist/stripe-elements/p-7fe4a287.entry.js +1 -0
  68. package/dist/stripe-elements/p-915b86ed.entry.js +1 -0
  69. package/dist/stripe-elements/p-B6JoQetF.js +1 -0
  70. package/dist/stripe-elements/p-C7MQk9FK.js +1 -0
  71. package/dist/stripe-elements/p-DFAhQS0n.js +1 -0
  72. package/dist/stripe-elements/p-b06a254f.entry.js +1 -0
  73. package/dist/stripe-elements/p-b91c4fa7.entry.js +1 -0
  74. package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
  75. package/dist/stripe-elements/p-e7372ca7.entry.js +1 -0
  76. package/dist/stripe-elements/p-f892e375.entry.js +1 -0
  77. package/dist/stripe-elements/stripe-elements.esm.js +1 -1
  78. package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
  79. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +8 -1
  80. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
  81. package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
  82. package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +11 -0
  83. package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
  84. package/dist/types/components/stripe-modal/stripe-modal.d.ts +44 -0
  85. package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +18 -0
  86. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +7 -2
  87. package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +104 -0
  88. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +112 -0
  89. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +95 -0
  90. package/dist/types/components.d.ts +169 -10
  91. package/dist/types/index.d.ts +2 -0
  92. package/dist/types/services/interfaces.d.ts +2 -0
  93. package/dist/types/services/stripe-service.d.ts +12 -3
  94. package/dist/types/utils/focus.d.ts +15 -0
  95. package/package.json +5 -3
  96. package/readme.md +46 -10
  97. package/dist/cjs/ion-icon.cjs.entry.js +0 -431
  98. package/dist/components/utils.js +0 -1
  99. package/dist/esm/ion-icon.entry.js +0 -429
  100. package/dist/stripe-elements/p--sA2m1ad.js +0 -1
  101. package/dist/stripe-elements/p-44495284.entry.js +0 -1
  102. package/dist/stripe-elements/p-4ba675fa.entry.js +0 -1
  103. package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
  104. package/dist/stripe-elements/p-c24ae181.entry.js +0 -1
  105. package/dist/stripe-elements/p-d9e86451.entry.js +0 -1
  106. package/dist/stripe-elements/p-f09c86a0.entry.js +0 -1
  107. package/dist/stripe-elements/p-f64f394d.entry.js +0 -1
  108. package/dist/stripe-elements/p-f6d2425e.entry.js +0 -1
@@ -1,8 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Dkb0SxZc.js');
4
- var index$1 = require('./index-CYbA1N_k.js');
5
-
6
3
  const getPlatforms = (win) => setupPlatforms(win);
7
4
  const setupPlatforms = (win = window) => {
8
5
  if (typeof win === 'undefined') {
@@ -2792,6 +2789,11 @@ instance.use(Browser).init({
2792
2789
  'CVC': 'セキュリティコード(CVC)',
2793
2790
  'Country or region': '地域',
2794
2791
  'Postal Code': '郵便番号',
2792
+ 'Close': '閉じる',
2793
+ 'Loading': '読み込み中',
2794
+ 'Payment information': '支払情報',
2795
+ 'Billing address': '請求先住所',
2796
+ 'Save': '保存',
2795
2797
  },
2796
2798
  },
2797
2799
  'pt-BR': {
@@ -2808,1139 +2810,12 @@ instance.use(Browser).init({
2808
2810
  'CVC': 'Número de Segurança(CVC)',
2809
2811
  'Country or region': 'País ou região',
2810
2812
  'Postal Code': 'Cep',
2813
+ 'Close': 'Fechar',
2811
2814
  },
2812
2815
  },
2813
2816
  },
2814
2817
  });
2815
2818
  const i18n = instance;
2816
2819
 
2817
- const appendToMap = (map, propName, value) => {
2818
- let refs = map.get(propName);
2819
- if (!refs) {
2820
- refs = [];
2821
- map.set(propName, refs);
2822
- }
2823
- if (!refs.some((ref) => ref.deref() === value)) {
2824
- refs.push(new WeakRef(value));
2825
- }
2826
- };
2827
- const debounce = (fn, ms) => {
2828
- let timeoutId;
2829
- return (...args) => {
2830
- if (timeoutId) {
2831
- clearTimeout(timeoutId);
2832
- }
2833
- timeoutId = setTimeout(() => {
2834
- timeoutId = 0;
2835
- fn(...args);
2836
- }, ms);
2837
- };
2838
- };
2839
-
2840
- /**
2841
- * Check if a possible element isConnected.
2842
- * The property might not be there, so we check for it.
2843
- *
2844
- * We want it to return true if isConnected is not a property,
2845
- * otherwise we would remove these elements and would not update.
2846
- *
2847
- * Better leak in Edge than to be useless.
2848
- */
2849
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
2850
- const cleanupElements = debounce((map) => {
2851
- for (let key of map.keys()) {
2852
- const refs = map.get(key).filter((ref) => {
2853
- const elm = ref.deref();
2854
- return elm && isConnected(elm);
2855
- });
2856
- map.set(key, refs);
2857
- }
2858
- }, 2_000);
2859
- const core = index.StencilCore;
2860
- const forceUpdate = core.forceUpdate;
2861
- const getRenderingRef = core.getRenderingRef;
2862
- const stencilSubscription = () => {
2863
- if (typeof getRenderingRef !== 'function' || typeof forceUpdate !== 'function') {
2864
- // If we are not in a stencil project, we do nothing.
2865
- // This function is not really exported by @stencil/core.
2866
- return {};
2867
- }
2868
- const ensureForceUpdate = forceUpdate;
2869
- const ensureGetRenderingRef = getRenderingRef;
2870
- const elmsToUpdate = new Map();
2871
- return {
2872
- dispose: () => elmsToUpdate.clear(),
2873
- get: (propName) => {
2874
- const elm = ensureGetRenderingRef();
2875
- if (elm) {
2876
- appendToMap(elmsToUpdate, propName, elm);
2877
- }
2878
- },
2879
- set: (propName) => {
2880
- const refs = elmsToUpdate.get(propName);
2881
- if (refs) {
2882
- const nextRefs = refs.filter((ref) => {
2883
- const elm = ref.deref();
2884
- if (!elm)
2885
- return false;
2886
- return ensureForceUpdate(elm);
2887
- });
2888
- elmsToUpdate.set(propName, nextRefs);
2889
- }
2890
- cleanupElements(elmsToUpdate);
2891
- },
2892
- reset: () => {
2893
- elmsToUpdate.forEach((refs) => {
2894
- refs.forEach((ref) => {
2895
- const elm = ref.deref();
2896
- if (elm)
2897
- ensureForceUpdate(elm);
2898
- });
2899
- });
2900
- cleanupElements(elmsToUpdate);
2901
- },
2902
- };
2903
- };
2904
-
2905
- const unwrap = (val) => (typeof val === 'function' ? val() : val);
2906
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
2907
- const resolveDefaultState = () => (unwrap(defaultState) ?? {});
2908
- const initialState = resolveDefaultState();
2909
- let states = new Map(Object.entries(initialState));
2910
- const proxyAvailable = typeof Proxy !== 'undefined';
2911
- const plainState = proxyAvailable ? null : {};
2912
- const handlers = {
2913
- dispose: [],
2914
- get: [],
2915
- set: [],
2916
- reset: [],
2917
- };
2918
- // Track onChange listeners to enable removeListener functionality
2919
- const changeListeners = new Map();
2920
- const reset = () => {
2921
- // When resetting the state, the default state may be a function - unwrap it to invoke it.
2922
- // otherwise, the state won't be properly reset
2923
- states = new Map(Object.entries(resolveDefaultState()));
2924
- if (!proxyAvailable) {
2925
- syncPlainStateKeys();
2926
- }
2927
- handlers.reset.forEach((cb) => cb());
2928
- };
2929
- const dispose = () => {
2930
- // Call first dispose as resetting the state would
2931
- // cause less updates ;)
2932
- handlers.dispose.forEach((cb) => cb());
2933
- reset();
2934
- };
2935
- const get = (propName) => {
2936
- handlers.get.forEach((cb) => cb(propName));
2937
- return states.get(propName);
2938
- };
2939
- const set = (propName, value) => {
2940
- const oldValue = states.get(propName);
2941
- if (shouldUpdate(value, oldValue, propName)) {
2942
- states.set(propName, value);
2943
- if (!proxyAvailable) {
2944
- ensurePlainProperty(propName);
2945
- }
2946
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
2947
- }
2948
- };
2949
- const state = (proxyAvailable
2950
- ? new Proxy(initialState, {
2951
- get(_, propName) {
2952
- return get(propName);
2953
- },
2954
- ownKeys(_) {
2955
- return Array.from(states.keys());
2956
- },
2957
- getOwnPropertyDescriptor() {
2958
- return {
2959
- enumerable: true,
2960
- configurable: true,
2961
- };
2962
- },
2963
- has(_, propName) {
2964
- return states.has(propName);
2965
- },
2966
- set(_, propName, value) {
2967
- set(propName, value);
2968
- return true;
2969
- },
2970
- })
2971
- : (() => {
2972
- syncPlainStateKeys();
2973
- return plainState;
2974
- })());
2975
- const on = (eventName, callback) => {
2976
- handlers[eventName].push(callback);
2977
- return () => {
2978
- removeFromArray(handlers[eventName], callback);
2979
- };
2980
- };
2981
- const onChange = (propName, cb) => {
2982
- const setHandler = (key, newValue) => {
2983
- if (key === propName) {
2984
- cb(newValue);
2985
- }
2986
- };
2987
- const resetHandler = () => {
2988
- const snapshot = resolveDefaultState();
2989
- cb(snapshot[propName]);
2990
- };
2991
- // Register the handlers
2992
- const unSet = on('set', setHandler);
2993
- const unReset = on('reset', resetHandler);
2994
- // Track the relationship between the user callback and internal handlers
2995
- changeListeners.set(cb, { setHandler, resetHandler, propName });
2996
- return () => {
2997
- unSet();
2998
- unReset();
2999
- changeListeners.delete(cb);
3000
- };
3001
- };
3002
- const use = (...subscriptions) => {
3003
- const unsubs = subscriptions.reduce((unsubs, subscription) => {
3004
- if (subscription.set) {
3005
- unsubs.push(on('set', subscription.set));
3006
- }
3007
- if (subscription.get) {
3008
- unsubs.push(on('get', subscription.get));
3009
- }
3010
- if (subscription.reset) {
3011
- unsubs.push(on('reset', subscription.reset));
3012
- }
3013
- if (subscription.dispose) {
3014
- unsubs.push(on('dispose', subscription.dispose));
3015
- }
3016
- return unsubs;
3017
- }, []);
3018
- return () => unsubs.forEach((unsub) => unsub());
3019
- };
3020
- const forceUpdate = (key) => {
3021
- const oldValue = states.get(key);
3022
- handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
3023
- };
3024
- const removeListener = (propName, listener) => {
3025
- const listenerInfo = changeListeners.get(listener);
3026
- if (listenerInfo && listenerInfo.propName === propName) {
3027
- // Remove the specific handlers that were created for this listener
3028
- removeFromArray(handlers.set, listenerInfo.setHandler);
3029
- removeFromArray(handlers.reset, listenerInfo.resetHandler);
3030
- changeListeners.delete(listener);
3031
- }
3032
- };
3033
- function ensurePlainProperty(key) {
3034
- if (proxyAvailable || !plainState) {
3035
- return;
3036
- }
3037
- if (Object.prototype.hasOwnProperty.call(plainState, key)) {
3038
- return;
3039
- }
3040
- Object.defineProperty(plainState, key, {
3041
- configurable: true,
3042
- enumerable: true,
3043
- get() {
3044
- return get(key);
3045
- },
3046
- set(value) {
3047
- set(key, value);
3048
- },
3049
- });
3050
- }
3051
- function syncPlainStateKeys() {
3052
- if (proxyAvailable || !plainState) {
3053
- return;
3054
- }
3055
- const knownKeys = new Set(states.keys());
3056
- for (const key of Object.keys(plainState)) {
3057
- if (!knownKeys.has(key)) {
3058
- delete plainState[key];
3059
- }
3060
- }
3061
- for (const key of knownKeys) {
3062
- ensurePlainProperty(key);
3063
- }
3064
- }
3065
- return {
3066
- state,
3067
- get,
3068
- set,
3069
- on,
3070
- onChange,
3071
- use,
3072
- dispose,
3073
- reset,
3074
- forceUpdate,
3075
- removeListener,
3076
- };
3077
- };
3078
- const removeFromArray = (array, item) => {
3079
- const index = array.indexOf(item);
3080
- if (index >= 0) {
3081
- array[index] = array[array.length - 1];
3082
- array.length--;
3083
- }
3084
- };
3085
-
3086
- const createStore = (defaultState, shouldUpdate) => {
3087
- const map = createObservableMap(defaultState, shouldUpdate);
3088
- map.use(stencilSubscription());
3089
- return map;
3090
- };
3091
-
3092
- /**
3093
- * Core Stripe Service
3094
- * Manages Stripe.js initialization and Elements instance only
3095
- * Does NOT manage specific element types (Card, Payment, etc.)
3096
- */
3097
- class StripeServiceClass {
3098
- constructor() {
3099
- this.store = createStore({
3100
- loadStripeStatus: '',
3101
- applicationName: 'stripe-pwa-elements',
3102
- isCheckoutSession: false,
3103
- });
3104
- this.changeListeners = new Map();
3105
- }
3106
- /**
3107
- * Get the reactive state object
3108
- * Components can use this directly in render() for automatic reactivity
3109
- */
3110
- get state() {
3111
- return this.store.state;
3112
- }
3113
- /**
3114
- * Register a callback for when a specific state property changes
3115
- * @param key - The state property to watch
3116
- * @param callback - Function to call when the property changes
3117
- * @returns Unsubscribe function
3118
- */
3119
- onChange(key, callback) {
3120
- const dispose = this.store.onChange(key, callback);
3121
- // Track listeners for cleanup
3122
- if (!this.changeListeners.has(key)) {
3123
- this.changeListeners.set(key, []);
3124
- }
3125
- this.changeListeners.get(key).push(dispose);
3126
- return dispose;
3127
- }
3128
- /**
3129
- * Initialize Stripe.js client with Payment Intent mode
3130
- * @param publishableKey - Your Stripe publishable API key
3131
- * @param options - Optional configuration
3132
- */
3133
- async initialize(publishableKey, options) {
3134
- // Update configuration
3135
- this.store.state.publishableKey = publishableKey;
3136
- this.store.state.isCheckoutSession = false;
3137
- if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
3138
- this.store.state.stripeAccount = options.stripeAccount;
3139
- }
3140
- if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
3141
- this.store.state.applicationName = options.applicationName;
3142
- }
3143
- // If Stripe.js already loaded with same config, do nothing
3144
- if (this.store.state.stripe && this.store.state.publishableKey === publishableKey && this.store.state.stripeAccount === (options === null || options === void 0 ? void 0 : options.stripeAccount) && !this.store.state.isCheckoutSession) {
3145
- return;
3146
- }
3147
- this.store.state.loadStripeStatus = 'loading';
3148
- try {
3149
- const stripe = await index$1.loadStripe(publishableKey, {
3150
- stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
3151
- });
3152
- // Register app info
3153
- stripe.registerAppInfo({
3154
- name: this.store.state.applicationName,
3155
- });
3156
- this.store.state.stripe = stripe;
3157
- this.store.state.elements = stripe.elements();
3158
- this.store.state.checkout = undefined;
3159
- this.store.state.loadStripeStatus = 'success';
3160
- }
3161
- catch (e) {
3162
- console.error('Failed to load Stripe.js:', e);
3163
- this.store.state.loadStripeStatus = 'failure';
3164
- }
3165
- }
3166
- /**
3167
- * Initialize Stripe.js client with Checkout Session mode
3168
- * @param publishableKey - Your Stripe publishable API key
3169
- * @param checkoutSessionClientSecret - The client secret from Checkout Session
3170
- * @param options - Optional configuration
3171
- */
3172
- async initializeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, options) {
3173
- // Update configuration
3174
- this.store.state.publishableKey = publishableKey;
3175
- this.store.state.isCheckoutSession = true;
3176
- if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
3177
- this.store.state.stripeAccount = options.stripeAccount;
3178
- }
3179
- if ((options === null || options === void 0 ? void 0 : options.applicationName) != null && (options === null || options === void 0 ? void 0 : options.applicationName) !== '') {
3180
- this.store.state.applicationName = options.applicationName;
3181
- }
3182
- this.store.state.loadStripeStatus = 'loading';
3183
- try {
3184
- const stripe = await index$1.loadStripe(publishableKey, {
3185
- stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
3186
- });
3187
- // Register app info
3188
- stripe.registerAppInfo({
3189
- name: this.store.state.applicationName,
3190
- });
3191
- this.store.state.stripe = stripe;
3192
- // Initialize Checkout instance instead of Elements
3193
- const checkout = stripe.initCheckoutElementsSdk({
3194
- clientSecret: checkoutSessionClientSecret,
3195
- elementsOptions: options === null || options === void 0 ? void 0 : options.elementsOptions,
3196
- });
3197
- this.store.state.checkout = checkout;
3198
- this.store.state.elements = undefined;
3199
- this.store.state.loadStripeStatus = 'success';
3200
- }
3201
- catch (e) {
3202
- console.error('Failed to initialize Stripe Checkout:', e);
3203
- this.store.state.loadStripeStatus = 'failure';
3204
- }
3205
- }
3206
- /**
3207
- * Get the current Stripe instance
3208
- */
3209
- getStripe() {
3210
- return this.store.state.stripe;
3211
- }
3212
- /**
3213
- * Get the current Elements instance
3214
- */
3215
- getElements() {
3216
- return this.store.state.elements;
3217
- }
3218
- /**
3219
- * Get the current Checkout instance (for Checkout Session mode)
3220
- */
3221
- getCheckout() {
3222
- return this.store.state.checkout;
3223
- }
3224
- /**
3225
- * Reset the service to initial state
3226
- * Useful for testing and cleanup
3227
- */
3228
- reset() {
3229
- this.store.reset();
3230
- }
3231
- /**
3232
- * Dispose of all listeners and reset state
3233
- * Should be called in test cleanup
3234
- */
3235
- dispose() {
3236
- // Dispose all onChange listeners
3237
- this.changeListeners.forEach(listeners => {
3238
- listeners.forEach(dispose => dispose());
3239
- });
3240
- this.changeListeners.clear();
3241
- // Dispose the store
3242
- this.store.dispose();
3243
- }
3244
- }
3245
- /**
3246
- * Singleton instance of StripeService (for backward compatibility)
3247
- * New code should use ServiceFactory for better testability
3248
- *
3249
- * @deprecated Use ServiceFactory.createStripeService() for better DI support
3250
- */
3251
- new StripeServiceClass();
3252
-
3253
- /**
3254
- * Wait for an element to appear in the DOM
3255
- * @param containerElement - Parent element to search in
3256
- * @param selector - CSS selector
3257
- * @param timeout - Timeout in milliseconds (default: 5000ms)
3258
- * @returns Promise that resolves to the found element or rejects on timeout
3259
- */
3260
- function findElement(containerElement, selector, timeout = 5000) {
3261
- return new Promise((resolve, reject) => {
3262
- const elem = containerElement.querySelector(selector);
3263
- if (elem != null) {
3264
- return resolve(elem);
3265
- }
3266
- const timeoutId = setTimeout(() => {
3267
- observer.disconnect();
3268
- reject(new Error(`Element "${selector}" not found within ${timeout}ms`));
3269
- }, timeout);
3270
- const observer = new MutationObserver(() => {
3271
- const elem = containerElement.querySelector(selector);
3272
- if (elem != null) {
3273
- clearTimeout(timeoutId);
3274
- observer.disconnect();
3275
- resolve(elem);
3276
- }
3277
- });
3278
- observer.observe(containerElement, {
3279
- childList: true,
3280
- subtree: true,
3281
- });
3282
- });
3283
- }
3284
-
3285
- /**
3286
- * Card Element Manager
3287
- * Manages Stripe Card Elements (cardNumber, cardExpiry, cardCvc)
3288
- * with dependency injection of StripeService
3289
- */
3290
- class CardElementManager {
3291
- /**
3292
- * Constructor with dependency injection
3293
- * @param stripeService - Injected Stripe service instance
3294
- */
3295
- constructor(stripeService) {
3296
- this.stripeService = stripeService;
3297
- this.store = createStore({
3298
- errorMessage: '',
3299
- errorSource: undefined,
3300
- });
3301
- }
3302
- /**
3303
- * Get current card element state (reactive)
3304
- */
3305
- getState() {
3306
- return this.store.state;
3307
- }
3308
- /**
3309
- * Initialize and mount card elements to DOM
3310
- * @param containerElement - Parent element containing mount points
3311
- * @returns Promise resolving to card element instances
3312
- */
3313
- async initialize(containerElement) {
3314
- const elements = this.stripeService.getElements();
3315
- if (elements == null) {
3316
- throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
3317
- }
3318
- // Unmount if already initialized
3319
- if (this.cardElements != null) {
3320
- this.unmount();
3321
- }
3322
- // Create and mount card number element
3323
- const cardNumber = elements.create('cardNumber', {
3324
- placeholder: i18n.t('Card Number'),
3325
- });
3326
- const cardNumberElement = await findElement(containerElement, '#card-number');
3327
- cardNumber.mount(cardNumberElement);
3328
- cardNumber.on('change', this.handleCardError('cardNumber'));
3329
- // Create and mount card expiry element
3330
- const cardExpiry = elements.create('cardExpiry');
3331
- const cardExpiryElement = await findElement(containerElement, '#card-expiry');
3332
- cardExpiry.mount(cardExpiryElement);
3333
- cardExpiry.on('change', this.handleCardError('cardExpiry'));
3334
- // Create and mount card CVC element
3335
- const cardCVC = elements.create('cardCvc');
3336
- const cardCVCElement = await findElement(containerElement, '#card-cvc');
3337
- cardCVC.mount(cardCVCElement);
3338
- cardCVC.on('change', this.handleCardError('cardCvc'));
3339
- this.cardElements = {
3340
- cardNumber,
3341
- cardExpiry,
3342
- cardCVC,
3343
- };
3344
- return this.cardElements;
3345
- }
3346
- /**
3347
- * Get mounted card element instances
3348
- */
3349
- getElements() {
3350
- return this.cardElements;
3351
- }
3352
- /**
3353
- * Set error message (triggers reactivity)
3354
- */
3355
- setError(message) {
3356
- this.store.set('errorMessage', message);
3357
- }
3358
- /**
3359
- * Clear error message (triggers reactivity)
3360
- */
3361
- clearError() {
3362
- this.store.set('errorMessage', '');
3363
- this.store.set('errorSource', undefined);
3364
- }
3365
- /**
3366
- * Unmount all card elements
3367
- */
3368
- unmount() {
3369
- var _a, _b, _c;
3370
- if (this.cardElements == null) {
3371
- return;
3372
- }
3373
- (_a = this.cardElements.cardNumber) === null || _a === void 0 ? void 0 : _a.unmount();
3374
- (_b = this.cardElements.cardExpiry) === null || _b === void 0 ? void 0 : _b.unmount();
3375
- (_c = this.cardElements.cardCVC) === null || _c === void 0 ? void 0 : _c.unmount();
3376
- this.cardElements = undefined;
3377
- }
3378
- /**
3379
- * Handle card element errors
3380
- * Only clears error if it's from the same element type
3381
- * Uses store.set() to trigger reactivity
3382
- */
3383
- handleCardError(elementType) {
3384
- return ({ error }) => {
3385
- if (error) {
3386
- this.store.set('errorMessage', error.message);
3387
- this.store.set('errorSource', elementType);
3388
- return;
3389
- }
3390
- // Only clear error if it originated from the same element
3391
- if (this.store.state.errorSource === elementType) {
3392
- this.store.set('errorMessage', '');
3393
- this.store.set('errorSource', undefined);
3394
- }
3395
- };
3396
- }
3397
- }
3398
-
3399
- /**
3400
- * Payment Element Manager
3401
- * Manages Stripe Payment Element (unified payment form)
3402
- * with dependency injection of StripeService
3403
- * Supports both Payment Intent mode and Checkout Session mode
3404
- */
3405
- class PaymentElementManager {
3406
- /**
3407
- * Constructor with dependency injection
3408
- * @param stripeService - Injected Stripe service instance
3409
- */
3410
- constructor(stripeService) {
3411
- this.stripeService = stripeService;
3412
- this.store = createStore({
3413
- errorMessage: '',
3414
- });
3415
- }
3416
- /**
3417
- * Get current payment element state (reactive)
3418
- */
3419
- getState() {
3420
- return this.store.state;
3421
- }
3422
- /**
3423
- * Initialize and mount payment element to DOM
3424
- * Supports both Payment Intent mode and Checkout Session mode
3425
- * @param containerElement - Parent element containing mount point
3426
- * @param options - Optional payment element options
3427
- * @returns Promise resolving to payment element instance
3428
- */
3429
- async initialize(containerElement, options) {
3430
- const isCheckoutSession = this.stripeService.state.isCheckoutSession;
3431
- // Unmount if already initialized
3432
- if (this.paymentElement != null) {
3433
- this.unmount();
3434
- }
3435
- if (isCheckoutSession) {
3436
- // Checkout Session mode: use checkout.createPaymentElement()
3437
- const checkout = this.stripeService.getCheckout();
3438
- if (checkout == null) {
3439
- throw new Error('StripeService not initialized with Checkout Session. Call StripeService.initializeWithCheckoutSession() first.');
3440
- }
3441
- // Create payment element using Checkout instance
3442
- this.paymentElement = checkout.createPaymentElement(options);
3443
- }
3444
- else {
3445
- // Payment Intent mode: use elements.create('payment')
3446
- const elements = this.stripeService.getElements();
3447
- if (elements == null) {
3448
- throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
3449
- }
3450
- // Create payment element with options
3451
- const elementOptions = options || {};
3452
- // Create the payment element
3453
- this.paymentElement = elements.create('payment', elementOptions);
3454
- }
3455
- // Find mount point and mount
3456
- const paymentElementContainer = await findElement(containerElement, '#payment-element');
3457
- this.paymentElement.mount(paymentElementContainer);
3458
- // Note: Payment Element errors are handled during submission
3459
- // Use setError() method to manually set errors if needed
3460
- return this.paymentElement;
3461
- }
3462
- /**
3463
- * Get mounted payment element instance
3464
- */
3465
- getElement() {
3466
- return this.paymentElement;
3467
- }
3468
- /**
3469
- * Set error message (triggers reactivity)
3470
- */
3471
- setError(message) {
3472
- this.store.set('errorMessage', message);
3473
- }
3474
- /**
3475
- * Clear error message (triggers reactivity)
3476
- */
3477
- clearError() {
3478
- this.store.set('errorMessage', '');
3479
- }
3480
- /**
3481
- * Unmount payment element
3482
- */
3483
- unmount() {
3484
- if (this.paymentElement == null) {
3485
- return;
3486
- }
3487
- this.paymentElement.unmount();
3488
- this.paymentElement = undefined;
3489
- }
3490
- }
3491
-
3492
- /**
3493
- * Address Element Manager
3494
- * Manages Stripe Address Element
3495
- * with dependency injection of StripeService
3496
- */
3497
- class AddressElementManager {
3498
- /**
3499
- * Constructor with dependency injection
3500
- * @param stripeService - Injected Stripe service instance
3501
- */
3502
- constructor(stripeService) {
3503
- this.stripeService = stripeService;
3504
- this.store = createStore({
3505
- errorMessage: '',
3506
- isComplete: false,
3507
- });
3508
- }
3509
- /**
3510
- * Get current address element state (reactive)
3511
- */
3512
- getState() {
3513
- return this.store.state;
3514
- }
3515
- /**
3516
- * Initialize and mount address element to DOM
3517
- * @param containerElement - Parent element containing mount point
3518
- * @param options - Address element options
3519
- * @returns Promise resolving to address element instance
3520
- */
3521
- async initialize(containerElement, options) {
3522
- const elements = this.stripeService.getElements();
3523
- if (elements == null) {
3524
- throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
3525
- }
3526
- // Unmount if already initialized
3527
- if (this.addressElement != null) {
3528
- this.unmount();
3529
- }
3530
- // Create and mount address element
3531
- this.addressElement = elements.create('address', options || { mode: 'billing' });
3532
- const addressElementContainer = await findElement(containerElement, '#address-element');
3533
- this.addressElement.mount(addressElementContainer);
3534
- // Listen for changes
3535
- this.addressElement.on('change', event => {
3536
- // StripeAddressElementChangeEvent doesn't have an error property
3537
- // Errors are handled through the complete property and validation
3538
- this.store.set('errorMessage', '');
3539
- this.store.set('isComplete', event.complete);
3540
- });
3541
- return this.addressElement;
3542
- }
3543
- /**
3544
- * Get mounted address element instance
3545
- */
3546
- getElement() {
3547
- return this.addressElement;
3548
- }
3549
- /**
3550
- * Set error message (triggers reactivity)
3551
- */
3552
- setError(message) {
3553
- this.store.set('errorMessage', message);
3554
- }
3555
- /**
3556
- * Clear error message (triggers reactivity)
3557
- */
3558
- clearError() {
3559
- this.store.set('errorMessage', '');
3560
- }
3561
- /**
3562
- * Unmount address element
3563
- */
3564
- unmount() {
3565
- if (this.addressElement == null) {
3566
- return;
3567
- }
3568
- this.addressElement.unmount();
3569
- this.addressElement = undefined;
3570
- }
3571
- }
3572
-
3573
- /**
3574
- * Link Authentication Element Manager
3575
- * Manages Stripe Link Authentication Element for email collection and Link authentication
3576
- * with dependency injection of StripeService
3577
- */
3578
- class LinkAuthenticationElementManager {
3579
- /**
3580
- * Constructor with dependency injection
3581
- * @param stripeService - Injected Stripe service instance
3582
- */
3583
- constructor(stripeService) {
3584
- this.stripeService = stripeService;
3585
- this.store = createStore({
3586
- errorMessage: '',
3587
- email: undefined,
3588
- });
3589
- }
3590
- /**
3591
- * Get current link authentication element state (reactive)
3592
- */
3593
- getState() {
3594
- return this.store.state;
3595
- }
3596
- /**
3597
- * Register state change listener
3598
- * @param key - State property to watch
3599
- * @param callback - Callback function invoked when property changes
3600
- * @returns Unsubscribe function
3601
- */
3602
- onChange(key, callback) {
3603
- return this.store.onChange(key, callback);
3604
- }
3605
- /**
3606
- * Initialize and mount link authentication element to DOM
3607
- * @param containerElement - Parent element containing mount point
3608
- * @param options - Optional configuration for Link Authentication Element
3609
- * @returns Promise resolving to link authentication element instance
3610
- */
3611
- async initialize(containerElement, options) {
3612
- const elements = this.stripeService.getElements();
3613
- if (elements == null) {
3614
- throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
3615
- }
3616
- // Unmount if already initialized
3617
- if (this.linkAuthenticationElement != null) {
3618
- this.unmount();
3619
- }
3620
- // Create link authentication element
3621
- const linkAuthentication = elements.create('linkAuthentication', options);
3622
- const linkAuthenticationElementDiv = await findElement(containerElement, '#link-authentication-element');
3623
- linkAuthentication.mount(linkAuthenticationElementDiv);
3624
- // Listen for change events
3625
- linkAuthentication.on('change', event => {
3626
- var _a;
3627
- // Unconditionally set email from event.value.email
3628
- // This handles all cases: valid email, empty string, or undefined
3629
- this.store.set('email', (_a = event.value) === null || _a === void 0 ? void 0 : _a.email);
3630
- });
3631
- this.linkAuthenticationElement = linkAuthentication;
3632
- return this.linkAuthenticationElement;
3633
- }
3634
- /**
3635
- * Get mounted link authentication element instance
3636
- */
3637
- getElement() {
3638
- return this.linkAuthenticationElement;
3639
- }
3640
- /**
3641
- * Set error message (triggers reactivity)
3642
- */
3643
- setError(message) {
3644
- this.store.set('errorMessage', message);
3645
- }
3646
- /**
3647
- * Clear error message (triggers reactivity)
3648
- */
3649
- clearError() {
3650
- this.store.set('errorMessage', '');
3651
- }
3652
- /**
3653
- * Unmount link authentication element
3654
- */
3655
- unmount() {
3656
- if (this.linkAuthenticationElement == null) {
3657
- return;
3658
- }
3659
- this.linkAuthenticationElement.unmount();
3660
- this.linkAuthenticationElement = undefined;
3661
- }
3662
- }
3663
-
3664
- /**
3665
- * Currency Selector Element Manager
3666
- * Manages Stripe Currency Selector Element
3667
- * with dependency injection of StripeService
3668
- */
3669
- class CurrencySelectorElementManager {
3670
- /**
3671
- * Constructor with dependency injection
3672
- * @param stripeService - Injected Stripe service instance
3673
- */
3674
- constructor(stripeService) {
3675
- this.stripeService = stripeService;
3676
- this.store = createStore({
3677
- errorMessage: '',
3678
- selectedCurrency: undefined,
3679
- });
3680
- }
3681
- /**
3682
- * Get current currency selector element state (reactive)
3683
- */
3684
- getState() {
3685
- return this.store.state;
3686
- }
3687
- /**
3688
- * Initialize and mount currency selector element to DOM
3689
- * @param containerElement - Parent element containing mount point
3690
- * @param options - Currency selector element options
3691
- * @returns Promise resolving to currency selector element instance
3692
- * Note: StripeCurrencySelectorElementOptions is not yet exported in @stripe/stripe-js v8.6.0
3693
- */
3694
- async initialize(containerElement, options) {
3695
- const elements = this.stripeService.getElements();
3696
- if (elements == null) {
3697
- throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
3698
- }
3699
- // Unmount if already initialized
3700
- if (this.currencySelectorElement != null) {
3701
- this.unmount();
3702
- }
3703
- // Find mount point first to avoid element leak if findElement throws
3704
- const currencySelectorElementContainer = await findElement(containerElement, '#currency-selector');
3705
- // Create and mount currency selector element
3706
- // Note: 'currencySelector' type is not yet in @stripe/stripe-js v8.6.0 type definitions
3707
- // but is documented in Stripe's Currency Selector Element documentation
3708
- this.currencySelectorElement = elements.create('currencySelector', options || {});
3709
- this.currencySelectorElement.mount(currencySelectorElementContainer);
3710
- // Listen for changes
3711
- // Note: The 'change' event type is not yet in @stripe/stripe-js type definitions
3712
- // but is documented in Stripe's Currency Selector Element documentation
3713
- this.currencySelectorElement.on('change', (event) => {
3714
- var _a;
3715
- // Clear error on change
3716
- this.store.set('errorMessage', '');
3717
- // Update selected currency if available
3718
- if ((_a = event === null || event === void 0 ? void 0 : event.value) === null || _a === void 0 ? void 0 : _a.currency) {
3719
- this.store.set('selectedCurrency', event.value.currency);
3720
- }
3721
- });
3722
- return this.currencySelectorElement;
3723
- }
3724
- /**
3725
- * Get mounted currency selector element instance
3726
- */
3727
- getElement() {
3728
- return this.currencySelectorElement;
3729
- }
3730
- /**
3731
- * Set error message (triggers reactivity)
3732
- */
3733
- setError(message) {
3734
- this.store.set('errorMessage', message);
3735
- }
3736
- /**
3737
- * Clear error message (triggers reactivity)
3738
- */
3739
- clearError() {
3740
- this.store.set('errorMessage', '');
3741
- }
3742
- /**
3743
- * Unmount currency selector element
3744
- */
3745
- unmount() {
3746
- if (this.currencySelectorElement == null) {
3747
- return;
3748
- }
3749
- this.currencySelectorElement.unmount();
3750
- this.currencySelectorElement = undefined;
3751
- }
3752
- }
3753
-
3754
- /**
3755
- * Express Checkout Element Manager
3756
- * Manages Stripe Express Checkout Element
3757
- * with dependency injection of StripeService
3758
- */
3759
- class ExpressCheckoutElementManager {
3760
- /**
3761
- * Constructor with dependency injection
3762
- * @param stripeService - Injected Stripe service instance
3763
- */
3764
- constructor(stripeService) {
3765
- this.stripeService = stripeService;
3766
- this.store = createStore({
3767
- errorMessage: '',
3768
- isReady: false,
3769
- });
3770
- }
3771
- /**
3772
- * Get current express checkout element state (reactive)
3773
- */
3774
- getState() {
3775
- return this.store.state;
3776
- }
3777
- /**
3778
- * Initialize and mount express checkout element to DOM
3779
- * @param containerElement - Parent element containing mount point
3780
- * @param options - Express Checkout Element configuration options
3781
- * @param eventHandlers - Event handlers for element events
3782
- * @returns Promise resolving to express checkout element instance
3783
- */
3784
- async initialize(containerElement, options, eventHandlers) {
3785
- const elements = this.stripeService.getElements();
3786
- if (elements == null) {
3787
- throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
3788
- }
3789
- // Unmount if already initialized
3790
- if (this.expressCheckoutElement != null) {
3791
- this.unmount();
3792
- }
3793
- // Convert buttonHeight from string to number if present
3794
- const createOptions = Object.assign({}, options);
3795
- if (createOptions.buttonHeight && typeof createOptions.buttonHeight === 'string') {
3796
- const height = parseInt(createOptions.buttonHeight.replace('px', ''), 10);
3797
- if (!isNaN(height)) {
3798
- createOptions.buttonHeight = height;
3799
- }
3800
- }
3801
- // Create express checkout element
3802
- // Note: 'expressCheckout' is not yet in the official Stripe type definitions
3803
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3804
- const expressCheckout = elements.create('expressCheckout', createOptions);
3805
- // Find the mount point
3806
- const mountPoint = await findElement(containerElement, '#express-checkout-element');
3807
- // Set up event handlers before mounting
3808
- if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onConfirm) != null) {
3809
- expressCheckout.on('confirm', eventHandlers.onConfirm);
3810
- }
3811
- if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick) != null) {
3812
- expressCheckout.on('click', eventHandlers.onClick);
3813
- }
3814
- if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onCancel) != null) {
3815
- expressCheckout.on('cancel', eventHandlers.onCancel);
3816
- }
3817
- if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingAddressChange) != null) {
3818
- expressCheckout.on('shippingaddresschange', eventHandlers.onShippingAddressChange);
3819
- }
3820
- if ((eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onShippingRateChange) != null) {
3821
- expressCheckout.on('shippingratechange', eventHandlers.onShippingRateChange);
3822
- }
3823
- // Add ready event handler
3824
- expressCheckout.on('ready', () => {
3825
- this.store.set('isReady', true);
3826
- });
3827
- // Mount the element
3828
- expressCheckout.mount(mountPoint);
3829
- this.expressCheckoutElement = expressCheckout;
3830
- return this.expressCheckoutElement;
3831
- }
3832
- /**
3833
- * Get mounted express checkout element instance
3834
- */
3835
- getElement() {
3836
- return this.expressCheckoutElement;
3837
- }
3838
- /**
3839
- * Update element options dynamically
3840
- * @param options - Partial options to update
3841
- */
3842
- update(options) {
3843
- if (this.expressCheckoutElement == null) {
3844
- console.warn('Express Checkout Element not initialized. Cannot update options.');
3845
- return;
3846
- }
3847
- // Convert buttonHeight from string to number if present
3848
- const updateOptions = Object.assign({}, options);
3849
- if (updateOptions.buttonHeight && typeof updateOptions.buttonHeight === 'string') {
3850
- const height = parseInt(updateOptions.buttonHeight.replace('px', ''), 10);
3851
- if (!isNaN(height)) {
3852
- updateOptions.buttonHeight = height;
3853
- }
3854
- }
3855
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3856
- this.expressCheckoutElement.update(updateOptions);
3857
- }
3858
- /**
3859
- * Set error message (triggers reactivity)
3860
- */
3861
- setError(message) {
3862
- this.store.set('errorMessage', message);
3863
- }
3864
- /**
3865
- * Clear error message (triggers reactivity)
3866
- */
3867
- clearError() {
3868
- this.store.set('errorMessage', '');
3869
- }
3870
- /**
3871
- * Unmount express checkout element
3872
- */
3873
- unmount() {
3874
- if (this.expressCheckoutElement == null) {
3875
- return;
3876
- }
3877
- this.expressCheckoutElement.unmount();
3878
- this.expressCheckoutElement = undefined;
3879
- this.store.set('isReady', false);
3880
- }
3881
- }
3882
-
3883
- /**
3884
- * Service Factory
3885
- * Creates service instances with proper dependency injection
3886
- * Can be mocked in tests for better testability
3887
- */
3888
- class ServiceFactory {
3889
- /**
3890
- * Create a new StripeService instance
3891
- */
3892
- createStripeService() {
3893
- return new StripeServiceClass();
3894
- }
3895
- /**
3896
- * Create a new CardElementManager instance
3897
- * @param stripeService - Injected StripeService dependency
3898
- */
3899
- createCardElementManager(stripeService) {
3900
- return new CardElementManager(stripeService);
3901
- }
3902
- /**
3903
- * Create a new PaymentElementManager instance
3904
- * @param stripeService - Injected StripeService dependency
3905
- */
3906
- createPaymentElementManager(stripeService) {
3907
- return new PaymentElementManager(stripeService);
3908
- }
3909
- /**
3910
- * Create a new AddressElementManager instance
3911
- * @param stripeService - Injected StripeService dependency
3912
- */
3913
- createAddressElementManager(stripeService) {
3914
- return new AddressElementManager(stripeService);
3915
- }
3916
- /**
3917
- * Create a new LinkAuthenticationElementManager instance
3918
- * @param stripeService - Injected StripeService dependency
3919
- */
3920
- createLinkAuthenticationElementManager(stripeService) {
3921
- return new LinkAuthenticationElementManager(stripeService);
3922
- }
3923
- /**
3924
- * Create a new CurrencySelectorElementManager instance
3925
- * @param stripeService - Injected StripeService dependency
3926
- */
3927
- createCurrencySelectorElementManager(stripeService) {
3928
- return new CurrencySelectorElementManager(stripeService);
3929
- }
3930
- /**
3931
- * Create a new ExpressCheckoutElementManager instance
3932
- * @param stripeService - Injected StripeService dependency
3933
- */
3934
- createExpressCheckoutElementManager(stripeService) {
3935
- return new ExpressCheckoutElementManager(stripeService);
3936
- }
3937
- }
3938
- /**
3939
- * Default factory instance
3940
- * Can be replaced with a mock in tests
3941
- */
3942
- const serviceFactory = new ServiceFactory();
3943
-
3944
2820
  exports.checkPlatform = checkPlatform;
3945
2821
  exports.i18n = i18n;
3946
- exports.serviceFactory = serviceFactory;