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