stripe-pwa-elements 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/cjs/{factory-da3xAKkz.js → factory-Cd2VI_N2.js} +22 -4
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/stripe-address-element.cjs.entry.js +8 -1
  4. package/dist/cjs/stripe-card-element-modal.cjs.entry.js +1 -1
  5. package/dist/cjs/stripe-card-element_2.cjs.entry.js +24 -6
  6. package/dist/cjs/stripe-currency-selector.cjs.entry.js +8 -1
  7. package/dist/cjs/stripe-elements.cjs.js +1 -1
  8. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +8 -1
  9. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +8 -1
  10. package/dist/cjs/stripe-payment-element.cjs.entry.js +95 -38
  11. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +22 -15
  12. package/dist/collection/collection-manifest.json +3 -3
  13. package/dist/collection/components/stripe-address-element/stripe-address-element.js +7 -0
  14. package/dist/collection/components/stripe-card-element/stripe-card-element.js +7 -0
  15. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +1 -1
  16. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +7 -0
  17. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +7 -0
  18. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +7 -0
  19. package/dist/collection/components/stripe-modal/stripe-modal.js +18 -6
  20. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +94 -37
  21. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +15 -8
  22. package/dist/collection/services/stripe-service.js +22 -4
  23. package/dist/components/factory.js +1 -1
  24. package/dist/components/stripe-address-element.js +1 -1
  25. package/dist/components/stripe-card-element-modal.js +1 -1
  26. package/dist/components/stripe-card-element2.js +1 -1
  27. package/dist/components/stripe-currency-selector.js +1 -1
  28. package/dist/components/stripe-express-checkout-element.js +1 -1
  29. package/dist/components/stripe-link-authentication-element.js +1 -1
  30. package/dist/components/stripe-modal2.js +1 -1
  31. package/dist/components/stripe-payment-element.js +1 -1
  32. package/dist/components/stripe-payment-request-button2.js +1 -1
  33. package/dist/esm/{factory-DeqoYLf_.js → factory-VTa1Gc94.js} +22 -4
  34. package/dist/esm/loader.js +1 -1
  35. package/dist/esm/stripe-address-element.entry.js +8 -1
  36. package/dist/esm/stripe-card-element-modal.entry.js +1 -1
  37. package/dist/esm/stripe-card-element_2.entry.js +24 -6
  38. package/dist/esm/stripe-currency-selector.entry.js +8 -1
  39. package/dist/esm/stripe-elements.js +1 -1
  40. package/dist/esm/stripe-express-checkout-element.entry.js +8 -1
  41. package/dist/esm/stripe-link-authentication-element.entry.js +8 -1
  42. package/dist/esm/stripe-payment-element.entry.js +95 -38
  43. package/dist/esm/stripe-payment-request-button.entry.js +17 -10
  44. package/dist/stripe-elements/p-1bd46766.entry.js +1 -0
  45. package/dist/stripe-elements/p-1c6e0a45.entry.js +1 -0
  46. package/dist/stripe-elements/p-3f42ca0c.entry.js +1 -0
  47. package/dist/stripe-elements/p-74de1556.entry.js +1 -0
  48. package/dist/stripe-elements/p-76e57d78.entry.js +1 -0
  49. package/dist/stripe-elements/p-840d499f.entry.js +1 -0
  50. package/dist/stripe-elements/{p--sA2m1ad.js → p-CrjrbGJ3.js} +1 -1
  51. package/dist/stripe-elements/{p-38e7b187.entry.js → p-ae0c336e.entry.js} +1 -1
  52. package/dist/stripe-elements/p-cfd8e081.entry.js +1 -0
  53. package/dist/stripe-elements/stripe-elements.esm.js +1 -1
  54. package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
  55. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +6 -0
  56. package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
  57. package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +6 -0
  58. package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
  59. package/dist/types/components/stripe-modal/stripe-modal.d.ts +1 -0
  60. package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +18 -0
  61. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +6 -1
  62. package/dist/types/services/interfaces.d.ts +1 -0
  63. package/dist/types/services/stripe-service.d.ts +6 -2
  64. package/package.json +1 -1
  65. package/readme.md +4 -4
  66. package/dist/stripe-elements/p-44495284.entry.js +0 -1
  67. package/dist/stripe-elements/p-4ba675fa.entry.js +0 -1
  68. package/dist/stripe-elements/p-c24ae181.entry.js +0 -1
  69. package/dist/stripe-elements/p-d9e86451.entry.js +0 -1
  70. package/dist/stripe-elements/p-f09c86a0.entry.js +0 -1
  71. package/dist/stripe-elements/p-f64f394d.entry.js +0 -1
  72. package/dist/stripe-elements/p-f6d2425e.entry.js +0 -1
@@ -3101,6 +3101,8 @@ class StripeServiceClass {
3101
3101
  applicationName: 'stripe-pwa-elements',
3102
3102
  isCheckoutSession: false,
3103
3103
  });
3104
+ /** Incremented on every init so that a slower, older call cannot overwrite newer state */
3105
+ this.initGeneration = 0;
3104
3106
  this.changeListeners = new Map();
3105
3107
  }
3106
3108
  /**
@@ -3128,12 +3130,20 @@ class StripeServiceClass {
3128
3130
  /**
3129
3131
  * Initialize Stripe.js client with Payment Intent mode
3130
3132
  * @param publishableKey - Your Stripe publishable API key
3131
- * @param options - Optional configuration
3133
+ * @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
3132
3134
  */
3133
3135
  async initialize(publishableKey, options) {
3136
+ const generation = ++this.initGeneration;
3137
+ // Capture the previous config before overwriting it, so we can detect real changes
3138
+ const isUpToDate = this.store.state.stripe != null &&
3139
+ !this.store.state.isCheckoutSession &&
3140
+ this.store.state.publishableKey === publishableKey &&
3141
+ this.store.state.stripeAccount === (options === null || options === void 0 ? void 0 : options.stripeAccount) &&
3142
+ this.intentClientSecret === (options === null || options === void 0 ? void 0 : options.clientSecret);
3134
3143
  // Update configuration
3135
3144
  this.store.state.publishableKey = publishableKey;
3136
3145
  this.store.state.isCheckoutSession = false;
3146
+ this.intentClientSecret = options === null || options === void 0 ? void 0 : options.clientSecret;
3137
3147
  if ((options === null || options === void 0 ? void 0 : options.stripeAccount) != null && (options === null || options === void 0 ? void 0 : options.stripeAccount) !== '') {
3138
3148
  this.store.state.stripeAccount = options.stripeAccount;
3139
3149
  }
@@ -3141,7 +3151,7 @@ class StripeServiceClass {
3141
3151
  this.store.state.applicationName = options.applicationName;
3142
3152
  }
3143
3153
  // 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) {
3154
+ if (isUpToDate) {
3145
3155
  return;
3146
3156
  }
3147
3157
  this.store.state.loadStripeStatus = 'loading';
@@ -3149,12 +3159,16 @@ class StripeServiceClass {
3149
3159
  const stripe = await index$1.loadStripe(publishableKey, {
3150
3160
  stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
3151
3161
  });
3162
+ if (generation !== this.initGeneration) {
3163
+ return;
3164
+ }
3152
3165
  // Register app info
3153
3166
  stripe.registerAppInfo({
3154
3167
  name: this.store.state.applicationName,
3155
3168
  });
3156
3169
  this.store.state.stripe = stripe;
3157
- this.store.state.elements = stripe.elements();
3170
+ // Payment Element requires the client secret at Elements creation time
3171
+ this.store.state.elements = (options === null || options === void 0 ? void 0 : options.clientSecret) != null && options.clientSecret !== '' ? stripe.elements({ clientSecret: options.clientSecret }) : stripe.elements();
3158
3172
  this.store.state.checkout = undefined;
3159
3173
  this.store.state.loadStripeStatus = 'success';
3160
3174
  }
@@ -3167,9 +3181,10 @@ class StripeServiceClass {
3167
3181
  * Initialize Stripe.js client with Checkout Session mode
3168
3182
  * @param publishableKey - Your Stripe publishable API key
3169
3183
  * @param checkoutSessionClientSecret - The client secret from Checkout Session
3170
- * @param options - Optional configuration
3184
+ * @param options - Optional configuration (`clientSecret` is the PaymentIntent / SetupIntent client secret)
3171
3185
  */
3172
3186
  async initializeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, options) {
3187
+ const generation = ++this.initGeneration;
3173
3188
  // Update configuration
3174
3189
  this.store.state.publishableKey = publishableKey;
3175
3190
  this.store.state.isCheckoutSession = true;
@@ -3184,6 +3199,9 @@ class StripeServiceClass {
3184
3199
  const stripe = await index$1.loadStripe(publishableKey, {
3185
3200
  stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
3186
3201
  });
3202
+ if (generation !== this.initGeneration) {
3203
+ return;
3204
+ }
3187
3205
  // Register app info
3188
3206
  stripe.registerAppInfo({
3189
3207
  name: this.store.state.applicationName,
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["stripe-card-element-modal.cjs",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element.cjs",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector.cjs",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element.cjs",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element.cjs",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element.cjs",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon.cjs",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button.cjs",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2.cjs",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[4],"renderedOpen":[32],"toggleModal":[64],"openModal":[64],"closeModal":[64]}]]]], options);
9
+ return index.bootstrapLazy([["stripe-card-element-modal.cjs",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element.cjs",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector.cjs",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element.cjs",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element.cjs",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element.cjs",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon.cjs",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button.cjs",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2.cjs",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[1028],"renderedOpen":[32],"toggleModal":[64],"openModal":[64],"closeModal":[64]},null,{"open":[{"onOpenChange":0}]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Dkb0SxZc.js');
4
- var factory = require('./factory-da3xAKkz.js');
4
+ var factory = require('./factory-Cd2VI_N2.js');
5
5
  require('./index-CYbA1N_k.js');
6
6
 
7
7
  const stripeAddressElementCss = () => `:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap #address-element{margin-top:16px}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info.address{margin-bottom:16px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap .submit-button-wrapper{margin-top:32px}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}`;
@@ -191,6 +191,13 @@ const StripeAddressElement = class {
191
191
  // Dependency Injection via factory
192
192
  this.stripeService = factory.serviceFactory.createStripeService();
193
193
  this.addressElementManager = factory.serviceFactory.createAddressElementManager(this.stripeService);
194
+ }
195
+ /**
196
+ * Props are not yet populated inside the constructor when the component is registered via
197
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
198
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
199
+ */
200
+ componentWillLoad() {
194
201
  if (this.publishableKey != null && this.publishableKey !== '') {
195
202
  this.initStripe(this.publishableKey, {
196
203
  stripeAccount: this.stripeAccount,
@@ -101,7 +101,7 @@ const StripeCardElementModal = class {
101
101
  cardElement.setPaymentRequestOption(options);
102
102
  }
103
103
  render() {
104
- return (index.h("stripe-modal", { key: '236b4910e4f2ff792def134e7726623f2a09475e', open: this.open, showCloseButton: this.showCloseButton }, index.h("stripe-card-element", { key: '5748af4f6df67571289236435c7481d6f445fce8', showLabel: this.showLabel, publishableKey: this.publishableKey, intentClientSecret: this.intentClientSecret, shouldUseDefaultFormSubmitAction: this.shouldUseDefaultFormSubmitAction, handleSubmit: this.handleSubmit, stripeDidLoaded: this.stripeDidLoaded, intentType: this.intentType, zip: this.zip, buttonLabel: this.buttonLabel, sheetTitle: this.sheetTitle, applicationName: this.applicationName })));
104
+ return (index.h("stripe-modal", { key: 'a0229c55472e3c6f417086fa08d79e1ec8a8c485', open: this.open, showCloseButton: this.showCloseButton }, index.h("stripe-card-element", { key: '799f08c781bad089cec8b1338e9a714d080abd51', showLabel: this.showLabel, publishableKey: this.publishableKey, intentClientSecret: this.intentClientSecret, shouldUseDefaultFormSubmitAction: this.shouldUseDefaultFormSubmitAction, handleSubmit: this.handleSubmit, stripeDidLoaded: this.stripeDidLoaded, intentType: this.intentType, zip: this.zip, buttonLabel: this.buttonLabel, sheetTitle: this.sheetTitle, applicationName: this.applicationName })));
105
105
  }
106
106
  get el() { return index.getElement(this); }
107
107
  };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Dkb0SxZc.js');
4
- var factory = require('./factory-da3xAKkz.js');
4
+ var factory = require('./factory-Cd2VI_N2.js');
5
5
  var error = require('./error-FFC4kSs5.js');
6
6
  require('./index-CYbA1N_k.js');
7
7
 
@@ -301,6 +301,13 @@ const StripeCardElement = class {
301
301
  // Dependency Injection via factory
302
302
  this.stripeService = factory.serviceFactory.createStripeService();
303
303
  this.cardElementManager = factory.serviceFactory.createCardElementManager(this.stripeService);
304
+ }
305
+ /**
306
+ * Props are not yet populated inside the constructor when the component is registered via
307
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
308
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
309
+ */
310
+ componentWillLoad() {
304
311
  if (this.publishableKey != null && this.publishableKey !== '') {
305
312
  this.initStripe(this.publishableKey, buildInitStripeOptionsFromAccount(this.stripeAccount));
306
313
  }
@@ -451,6 +458,15 @@ const StripeModal = class {
451
458
  */
452
459
  this.renderedOpen = false;
453
460
  }
461
+ onOpenChange(open) {
462
+ if (open) {
463
+ this.openModalAnimation();
464
+ }
465
+ else {
466
+ this.renderedOpen = false;
467
+ this.close.emit();
468
+ }
469
+ }
454
470
  /**
455
471
  * Toggle modal state
456
472
  */
@@ -462,15 +478,12 @@ const StripeModal = class {
462
478
  */
463
479
  async openModal() {
464
480
  this.open = true;
465
- this.openModalAnimation();
466
481
  }
467
482
  /**
468
483
  * Close the modal
469
484
  */
470
485
  async closeModal() {
471
486
  this.open = false;
472
- this.renderedOpen = false;
473
- this.close.emit();
474
487
  }
475
488
  componentDidLoad() {
476
489
  const platformName = factory.checkPlatform();
@@ -494,14 +507,19 @@ const StripeModal = class {
494
507
  modalChild.classList.remove('loading');
495
508
  }, { once: true });
496
509
  requestAnimationFrame(() => {
497
- this.renderedOpen = true;
510
+ this.renderedOpen = this.open;
498
511
  });
499
512
  }
500
513
  render() {
501
514
  const { renderedOpen, showCloseButton } = this;
502
- return (index.h(index.Host, { key: 'dee14229db3c17744ae5013e5f9aab813a77880b' }, index.h("div", { key: 'c82f4f18286a3d341932bacf09973da80ee2acdd', class: `modal-row${renderedOpen ? ' open' : ''}`, onClick: () => this.closeModal() }, index.h("div", { key: '20b5dc2db1509486e74ff2f6049f5c27de4d4793', class: "modal-child", onClick: e => e.stopPropagation() }, showCloseButton ? (index.h("div", { class: "modal-close-button-wrap" }, index.h("ion-icon", { name: "close", size: "large", class: "modal-close-button", onClick: () => this.closeModal() }))) : null, index.h("div", { key: '863c6285045ad9dcbfeb286ee8ffa8aa1581f90e', class: "modal-loading" }, index.h("svg", { key: 'ba5d9e80236600f4b64a7fa735d49241eb1c3f29', version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2400 2400" }, index.h("g", { key: '290f7a2e79dc54f36603fa4a6b7d3922e4d1f432', "stroke-width": "200", "stroke-linecap": "round", stroke: "currentColor", fill: "none", id: "spinner" }, index.h("line", { key: '92cafdfad5a2631046bdd5f1fb6431b623808961', x1: "1200", y1: "600", x2: "1200", y2: "100" }), index.h("line", { key: '8b6e7260dcc41f969c7bac0fec073928e8e146a7', opacity: "0.5", x1: "1200", y1: "2300", x2: "1200", y2: "1800" }), index.h("line", { key: 'a5eb02131aa60cd6126a2be5f874e8f3bf3b6d5f', opacity: "0.917", x1: "900", y1: "680.4", x2: "650", y2: "247.4" }), index.h("line", { key: '1052903918a67fc53c0df06af43ad564fc9180f7', opacity: "0.417", x1: "1750", y1: "2152.6", x2: "1500", y2: "1719.6" }), index.h("line", { key: 'ac37ac0104a2738375b8f71481b826ae63730dce', opacity: "0.833", x1: "680.4", y1: "900", x2: "247.4", y2: "650" }), index.h("line", { key: '0623f6448f636a6f5f65cb68387ab81381a56acf', opacity: "0.333", x1: "2152.6", y1: "1750", x2: "1719.6", y2: "1500" }), index.h("line", { key: 'f3dbc37979ad51676728ac79eccab6d7be4d9192', opacity: "0.75", x1: "600", y1: "1200", x2: "100", y2: "1200" }), index.h("line", { key: 'c5d92ff42dbe24d6c2136b24cdf2d57835f11b76', opacity: "0.25", x1: "2300", y1: "1200", x2: "1800", y2: "1200" }), index.h("line", { key: '3339f4fefcc7222050da34aa7b8b60c9ac511aea', opacity: "0.667", x1: "680.4", y1: "1500", x2: "247.4", y2: "1750" }), index.h("line", { key: '7ddc8d68d7f7deb0fe377b508180bc0b1123bf7f', opacity: "0.167", x1: "2152.6", y1: "650", x2: "1719.6", y2: "900" }), index.h("line", { key: '8825e19d81b7ade6d1ee327ac7b8bc24607a7c47', opacity: "0.583", x1: "900", y1: "1719.6", x2: "650", y2: "2152.6" }), index.h("line", { key: '9562d8c1dcc59a4884cff618edc35e951b19794c', opacity: "0.083", x1: "1750", y1: "247.4", x2: "1500", y2: "680.4" }), index.h("animateTransform", { key: '648f2a04edef2c2908782aa2296e4dba2b27d7b1', attributeName: "transform", attributeType: "XML", type: "rotate", keyTimes: "0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667", values: "0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199", dur: "0.83333s", begin: "0s", repeatCount: "indefinite", calcMode: "discrete" })))), index.h("div", { key: 'a86fb232eb5df0737c870e0e788c0c1e230b434e', class: "modal-content" }, index.h("slot", { key: 'b5ee41fc9dd113c3e2716f01350641fc2adebd7b' }))))));
515
+ return (index.h(index.Host, { key: '38fb86acf7cf5887a426c67b1a1271f7fae7048c' }, index.h("div", { key: 'f751d92c327ee2e564edfcd4d18f4dca43c20c37', class: `modal-row${renderedOpen ? ' open' : ''}`, onClick: () => this.closeModal() }, index.h("div", { key: '11519ccd44a5069df3247c530a2c1e114eab7aef', class: "modal-child", onClick: e => e.stopPropagation() }, showCloseButton ? (index.h("div", { class: "modal-close-button-wrap" }, index.h("ion-icon", { name: "close", size: "large", class: "modal-close-button", onClick: () => this.closeModal() }))) : null, index.h("div", { key: 'a41f7f263b488b5bbc2a999cbabf6b9e407bca85', class: "modal-loading" }, index.h("svg", { key: '0b3b25cb2812bc4d837fb4b7e6af4a5f42f0247e', version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2400 2400" }, index.h("g", { key: '10a9f9ec59699e6d2988b9c65cd02da1754fd760', "stroke-width": "200", "stroke-linecap": "round", stroke: "currentColor", fill: "none", id: "spinner" }, index.h("line", { key: 'ed271fa584b930ceed5397c271b31e0d48c72f72', x1: "1200", y1: "600", x2: "1200", y2: "100" }), index.h("line", { key: '3cf855a84f3ab58b914b7aeb784fbc5b95d8ae94', opacity: "0.5", x1: "1200", y1: "2300", x2: "1200", y2: "1800" }), index.h("line", { key: '2cce4b62a276399235509e94f47a63acf9c69a0f', opacity: "0.917", x1: "900", y1: "680.4", x2: "650", y2: "247.4" }), index.h("line", { key: '64c175ef068591417b043f7630a44d34eae7cb59', opacity: "0.417", x1: "1750", y1: "2152.6", x2: "1500", y2: "1719.6" }), index.h("line", { key: '0856a654e3aa756dfb1e9fc316b8b379fa9d5a4e', opacity: "0.833", x1: "680.4", y1: "900", x2: "247.4", y2: "650" }), index.h("line", { key: 'c60f1f8495df9b8cdcc8941255d08c01a0e1c02f', opacity: "0.333", x1: "2152.6", y1: "1750", x2: "1719.6", y2: "1500" }), index.h("line", { key: '204bc2a7765e43b86f91c3fb9b1e72a3a39bb323', opacity: "0.75", x1: "600", y1: "1200", x2: "100", y2: "1200" }), index.h("line", { key: '7584b272f9efd7f746c1bcc5c8a5576098b02381', opacity: "0.25", x1: "2300", y1: "1200", x2: "1800", y2: "1200" }), index.h("line", { key: '7a053e9eb5f0da3fbf6fb7c9680bf73073bb126d', opacity: "0.667", x1: "680.4", y1: "1500", x2: "247.4", y2: "1750" }), index.h("line", { key: 'f8b817095143d739589e45c99b03c7afbdfc8293', opacity: "0.167", x1: "2152.6", y1: "650", x2: "1719.6", y2: "900" }), index.h("line", { key: 'aae0e36dbdfff44196f9758c8a5ed2337139ebe0', opacity: "0.583", x1: "900", y1: "1719.6", x2: "650", y2: "2152.6" }), index.h("line", { key: '3a257b30cb289f29ba386ccca7519bcdc22c3786', opacity: "0.083", x1: "1750", y1: "247.4", x2: "1500", y2: "680.4" }), index.h("animateTransform", { key: 'c6b8e73025589403dd3d08f84b02eb824763d056', attributeName: "transform", attributeType: "XML", type: "rotate", keyTimes: "0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667", values: "0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199", dur: "0.83333s", begin: "0s", repeatCount: "indefinite", calcMode: "discrete" })))), index.h("div", { key: 'da5ef8031e5b826d854a065d8172389cdd84fbf0', class: "modal-content" }, index.h("slot", { key: 'fbe97a3a4d5489de5ae6f49342c58d537b317842' }))))));
503
516
  }
504
517
  get el() { return index.getElement(this); }
518
+ static get watchers() { return {
519
+ "open": [{
520
+ "onOpenChange": 0
521
+ }]
522
+ }; }
505
523
  };
506
524
  StripeModal.style = stripeModalCss();
507
525
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Dkb0SxZc.js');
4
- var factory = require('./factory-da3xAKkz.js');
4
+ var factory = require('./factory-Cd2VI_N2.js');
5
5
  require('./index-CYbA1N_k.js');
6
6
 
7
7
  const stripeCurrencySelectorCss = () => `:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}:host{box-sizing:border-box}:host *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}:host button{cursor:pointer}:host{display:block;width:100%}.stripe-currency-selector-wrap{width:100%;padding:0;margin:0}.stripe-currency-selector-wrap #currency-selector{width:100%;min-height:40px}.stripe-currency-selector-wrap #currency-selector-errors{margin-top:8px}`;
@@ -129,6 +129,13 @@ const StripeCurrencySelector = class {
129
129
  // Dependency Injection via factory
130
130
  this.stripeService = factory.serviceFactory.createStripeService();
131
131
  this.currencySelectorElementManager = factory.serviceFactory.createCurrencySelectorElementManager(this.stripeService);
132
+ }
133
+ /**
134
+ * Props are not yet populated inside the constructor when the component is registered via
135
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
136
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
137
+ */
138
+ componentWillLoad() {
132
139
  if (this.publishableKey) {
133
140
  this.initStripe(this.publishableKey, {
134
141
  stripeAccount: this.stripeAccount,
@@ -46,7 +46,7 @@ var patchCloneNodeFix = (HTMLElementPrototype) => {
46
46
 
47
47
  patchBrowser().then(async (options) => {
48
48
  await appGlobals.globalScripts();
49
- return index.bootstrapLazy([["stripe-card-element-modal.cjs",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element.cjs",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector.cjs",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element.cjs",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element.cjs",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element.cjs",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon.cjs",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button.cjs",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2.cjs",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[4],"renderedOpen":[32],"toggleModal":[64],"openModal":[64],"closeModal":[64]}]]]], options);
49
+ return index.bootstrapLazy([["stripe-card-element-modal.cjs",[[0,"stripe-card-element-modal",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4],"getStripeCardElementElement":[64],"present":[64],"updateProgress":[64],"destroy":[64],"setPaymentRequestButton":[64]}]]],["stripe-address-element.cjs",[[0,"stripe-address-element",{"mode":[1],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"defaultCountry":[1,"default-country"],"allowedCountries":[16],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getValue":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-currency-selector.cjs",[[0,"stripe-currency-selector",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"handleCurrencyChange":[1040],"stripeDidLoaded":[1040],"initStripe":[64],"setErrorMessage":[64],"getSelectedCurrency":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-express-checkout-element.cjs",[[0,"stripe-express-checkout-element",{"intentType":[1,"intent-type"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"clientSecret":[1,"client-secret"],"amount":[2],"currency":[1],"buttonHeight":[1,"button-height"],"shouldUseDefaultConfirmAction":[4,"should-use-default-confirm-action"],"stripeDidLoaded":[1040],"progress":[32],"updateProgress":[64],"setErrorMessage":[64],"initStripe":[64],"updateElementOptions":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-link-authentication-element.cjs",[[0,"stripe-link-authentication-element",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"defaultEmail":[1,"default-email"],"handleChange":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"getEmail":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}]]],["stripe-payment-element.cjs",[[0,"stripe-payment-element",{"intentType":[1,"intent-type"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"intentClientSecret":[1,"intent-client-secret"],"checkoutSessionClientSecret":[1,"checkout-session-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"initStripe":[64],"initStripeWithCheckoutSession":[64],"updateProgress":[64],"setErrorMessage":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}],"intentClientSecret":[{"updateIntentClientSecret":0}],"checkoutSessionClientSecret":[{"updateCheckoutSessionClientSecret":0}]}]]],["ion-icon.cjs",[[1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32]},null,{"name":[{"loadIcon":0}],"src":[{"loadIcon":0}],"icon":[{"loadIcon":0}],"ios":[{"loadIcon":0}],"md":[{"loadIcon":0}]}]]],["stripe-payment-request-button.cjs",[[260,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32],"isAvailable":[64],"setPaymentMethodEventHandler":[64],"setPaymentRequestShippingOptionEventHandler":[64],"setPaymentRequestShippingAddressEventHandler":[64],"setPaymentRequestOption":[64],"initStripe":[64]}]]],["stripe-card-element_2.cjs",[[0,"stripe-card-element",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"progress":[32],"zipCode":[32],"paymentRequestOption":[32],"initStripe":[64],"updateProgress":[64],"setErrorMessage":[64],"setPaymentRequestOption":[64]},null,{"publishableKey":[{"updatePublishableKey":0}],"stripeAccount":[{"updateStripeAccountId":0}]}],[257,"stripe-modal",{"showCloseButton":[4,"show-close-button"],"open":[1028],"renderedOpen":[32],"toggleModal":[64],"openModal":[64],"closeModal":[64]},null,{"open":[{"onOpenChange":0}]}]]]], options);
50
50
  });
51
51
 
52
52
  exports.setNonce = index.setNonce;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Dkb0SxZc.js');
4
- var factory = require('./factory-da3xAKkz.js');
4
+ var factory = require('./factory-Cd2VI_N2.js');
5
5
  var error = require('./error-FFC4kSs5.js');
6
6
  require('./index-CYbA1N_k.js');
7
7
 
@@ -151,6 +151,13 @@ const StripeExpressCheckoutElement = class {
151
151
  // Dependency Injection via factory
152
152
  this.stripeService = factory.serviceFactory.createStripeService();
153
153
  this.expressCheckoutManager = factory.serviceFactory.createExpressCheckoutElementManager(this.stripeService);
154
+ }
155
+ /**
156
+ * Props are not yet populated inside the constructor when the component is registered via
157
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
158
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
159
+ */
160
+ componentWillLoad() {
154
161
  if (this.publishableKey != null && this.publishableKey !== '') {
155
162
  this.initStripe(this.publishableKey, {
156
163
  stripeAccount: this.stripeAccount,
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Dkb0SxZc.js');
4
- var factory = require('./factory-da3xAKkz.js');
4
+ var factory = require('./factory-Cd2VI_N2.js');
5
5
  require('./index-CYbA1N_k.js');
6
6
 
7
7
  const stripeLinkAuthenticationElementCss = () => `:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-link-authentication-wrap{box-sizing:border-box}.stripe-link-authentication-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-link-authentication-wrap button{cursor:pointer}.stripe-link-authentication-wrap{display:block;width:100%;background:#fff;padding:16px}.stripe-link-authentication-wrap .stripe-link-authentication-container #link-authentication-element .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-link-authentication-wrap .stripe-link-authentication-container #link-authentication-element .StripeElement>.__PrivateStripeElement{width:100%}.stripe-link-authentication-wrap .stripe-link-authentication-container .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}`;
@@ -170,6 +170,13 @@ const StripeLinkAuthenticationElement = class {
170
170
  // Dependency Injection via factory
171
171
  this.stripeService = factory.serviceFactory.createStripeService();
172
172
  this.linkAuthenticationElementManager = factory.serviceFactory.createLinkAuthenticationElementManager(this.stripeService);
173
+ }
174
+ /**
175
+ * Props are not yet populated inside the constructor when the component is registered via
176
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
177
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
178
+ */
179
+ componentWillLoad() {
173
180
  if (this.publishableKey) {
174
181
  this.initStripe(this.publishableKey, {
175
182
  stripeAccount: this.stripeAccount,
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-Dkb0SxZc.js');
4
- var factory = require('./factory-da3xAKkz.js');
4
+ var factory = require('./factory-Cd2VI_N2.js');
5
5
  var error = require('./error-FFC4kSs5.js');
6
6
  require('./index-CYbA1N_k.js');
7
7
 
@@ -137,26 +137,14 @@ const StripePaymentElement = class {
137
137
  * ```
138
138
  */
139
139
  async initStripe(publishableKey, options) {
140
+ const generation = ++this.initGeneration;
140
141
  await this.stripeService.initialize(publishableKey, {
141
142
  stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
142
143
  applicationName: this.applicationName,
144
+ // Payment Element needs the client secret when the Elements group is created
145
+ clientSecret: this.intentClientSecret,
143
146
  });
144
- // If already successfully loaded, initialize elements immediately
145
- if (this.stripeService.state.loadStripeStatus === 'success') {
146
- await this.initElement();
147
- this.stripeLoadedEventHandler();
148
- }
149
- else {
150
- // Otherwise, wait for successful load
151
- const unsubscribe = this.stripeService.onChange('loadStripeStatus', async (newState) => {
152
- if (newState !== 'success') {
153
- return;
154
- }
155
- await this.initElement();
156
- this.stripeLoadedEventHandler();
157
- unsubscribe(); // Clean up listener after first success
158
- });
159
- }
147
+ await this.mountWhenLoaded(generation);
160
148
  }
161
149
  /**
162
150
  * Get Stripe.js and initialize with Checkout Session mode
@@ -178,27 +166,13 @@ const StripePaymentElement = class {
178
166
  * ```
179
167
  */
180
168
  async initStripeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, options) {
169
+ const generation = ++this.initGeneration;
181
170
  await this.stripeService.initializeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, {
182
171
  stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
183
172
  applicationName: this.applicationName,
184
173
  elementsOptions: options === null || options === void 0 ? void 0 : options.elementsOptions,
185
174
  });
186
- // If already successfully loaded, initialize elements immediately
187
- if (this.stripeService.state.loadStripeStatus === 'success') {
188
- await this.initElement();
189
- this.stripeLoadedEventHandler();
190
- }
191
- else {
192
- // Otherwise, wait for successful load
193
- const unsubscribe = this.stripeService.onChange('loadStripeStatus', async (newState) => {
194
- if (newState !== 'success') {
195
- return;
196
- }
197
- await this.initElement();
198
- this.stripeLoadedEventHandler();
199
- unsubscribe(); // Clean up listener after first success
200
- });
201
- }
175
+ await this.mountWhenLoaded(generation);
202
176
  }
203
177
  /**
204
178
  * Update the form submit progress
@@ -240,18 +214,32 @@ const StripePaymentElement = class {
240
214
  const options = {};
241
215
  options.stripeAccount = this.stripeService.state.stripeAccount;
242
216
  const hasOptionValue = Object.values(options).filter(value => value != null && value !== '').length > 0;
217
+ if (this.hasCheckoutSessionClientSecret()) {
218
+ this.initStripeWithCheckoutSession(publishableKey, this.checkoutSessionClientSecret, { stripeAccount: options.stripeAccount });
219
+ return;
220
+ }
243
221
  this.initStripe(publishableKey, hasOptionValue ? options : undefined);
244
222
  }
245
223
  updateStripeAccountId(stripeAccount) {
224
+ if (this.hasCheckoutSessionClientSecret()) {
225
+ this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey, this.checkoutSessionClientSecret, { stripeAccount });
226
+ return;
227
+ }
246
228
  this.initStripe(this.stripeService.state.publishableKey, {
247
229
  stripeAccount: stripeAccount,
248
230
  });
249
231
  }
250
232
  async updateIntentClientSecret() {
251
- // Re-initialize the payment element when client secret changes
252
- if (this.stripeService.state.loadStripeStatus === 'success') {
253
- await this.initElement();
233
+ // Checkout Session mode takes precedence (same rule as startStripe); an intent secret must not switch the mode
234
+ if (this.checkoutSessionClientSecret != null && this.checkoutSessionClientSecret !== '') {
235
+ return;
254
236
  }
237
+ // The Elements group is bound to its client secret, so it has to be recreated when the secret changes
238
+ const { publishableKey, stripeAccount } = this.stripeService.state;
239
+ if (publishableKey == null || publishableKey === '') {
240
+ return;
241
+ }
242
+ await this.initStripe(publishableKey, { stripeAccount });
255
243
  }
256
244
  async updateCheckoutSessionClientSecret(newValue) {
257
245
  // Re-initialize with checkout session when client secret changes
@@ -305,6 +293,13 @@ const StripePaymentElement = class {
305
293
  if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
306
294
  return;
307
295
  }
296
+ // Retry in the same mode as the initial start
297
+ if (this.checkoutSessionClientSecret != null && this.checkoutSessionClientSecret !== '') {
298
+ this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey, this.checkoutSessionClientSecret, {
299
+ stripeAccount: this.stripeService.state.stripeAccount,
300
+ });
301
+ return;
302
+ }
308
303
  this.initStripe(this.stripeService.state.publishableKey, {
309
304
  stripeAccount: this.stripeService.state.stripeAccount,
310
305
  });
@@ -356,6 +351,8 @@ const StripePaymentElement = class {
356
351
  this.formSubmit = index.createEvent(this, "formSubmit", 7);
357
352
  this.defaultFormSubmitResult = index.createEvent(this, "defaultFormSubmitResult", 7);
358
353
  this.checkoutSessionConfirmResult = index.createEvent(this, "checkoutSessionConfirmResult", 7);
354
+ // Incremented on every initStripe call so that a superseded call stops after its awaits
355
+ this.initGeneration = 0;
359
356
  /**
360
357
  * Default submit handle type.
361
358
  * If you want to use `setupIntent`, should update this attribute.
@@ -397,11 +394,71 @@ const StripePaymentElement = class {
397
394
  // Dependency Injection via factory
398
395
  this.stripeService = factory.serviceFactory.createStripeService();
399
396
  this.paymentElementManager = factory.serviceFactory.createPaymentElementManager(this.stripeService);
400
- if (this.publishableKey != null && this.publishableKey !== '') {
401
- this.initStripe(this.publishableKey, {
397
+ }
398
+ /**
399
+ * Props are not yet populated inside the constructor when the component is registered via
400
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
401
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
402
+ */
403
+ componentWillLoad() {
404
+ this.startStripe();
405
+ }
406
+ /**
407
+ * Mount the element once Stripe.js has loaded, unless a newer init call (of either mode) has superseded this one.
408
+ * @param generation - The value of `initGeneration` taken when the init call started
409
+ */
410
+ async mountWhenLoaded(generation) {
411
+ // A newer init call supersedes this one
412
+ if (generation !== this.initGeneration) {
413
+ return;
414
+ }
415
+ // If already successfully loaded, initialize elements immediately
416
+ if (this.stripeService.state.loadStripeStatus === 'success') {
417
+ await this.initElement();
418
+ if (generation !== this.initGeneration) {
419
+ return;
420
+ }
421
+ this.stripeLoadedEventHandler();
422
+ return;
423
+ }
424
+ // Otherwise, wait for successful load
425
+ const unsubscribe = this.stripeService.onChange('loadStripeStatus', async (newState) => {
426
+ if (generation !== this.initGeneration) {
427
+ unsubscribe();
428
+ return;
429
+ }
430
+ if (newState !== 'success') {
431
+ return;
432
+ }
433
+ await this.initElement();
434
+ if (generation !== this.initGeneration) {
435
+ unsubscribe();
436
+ return;
437
+ }
438
+ this.stripeLoadedEventHandler();
439
+ unsubscribe(); // Clean up listener after first success
440
+ });
441
+ }
442
+ hasCheckoutSessionClientSecret() {
443
+ return this.checkoutSessionClientSecret != null && this.checkoutSessionClientSecret !== '';
444
+ }
445
+ /**
446
+ * Start Stripe.js in the mode that matches the given props.
447
+ * Checkout Session mode when `checkoutSessionClientSecret` is set, PaymentIntent / SetupIntent mode otherwise.
448
+ */
449
+ startStripe() {
450
+ if (this.publishableKey == null || this.publishableKey === '') {
451
+ return;
452
+ }
453
+ if (this.checkoutSessionClientSecret != null && this.checkoutSessionClientSecret !== '') {
454
+ this.initStripeWithCheckoutSession(this.publishableKey, this.checkoutSessionClientSecret, {
402
455
  stripeAccount: this.stripeAccount,
403
456
  });
457
+ return;
404
458
  }
459
+ this.initStripe(this.publishableKey, {
460
+ stripeAccount: this.stripeAccount,
461
+ });
405
462
  }
406
463
  /**
407
464
  * Initialize Component using Stripe Element