stripe-pwa-elements 3.1.0 → 4.0.0

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 (235) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -3
  2. package/dist/cjs/error-FFC4kSs5.js +0 -3
  3. package/dist/cjs/{factory-Hsw0e7-d.js → factory-da3xAKkz.js} +194 -73
  4. package/dist/cjs/{index-Ba1pBePA.js → index-CYbA1N_k.js} +24 -6
  5. package/dist/cjs/index-Dkb0SxZc.js +4694 -0
  6. package/dist/cjs/index.cjs.js +0 -1
  7. package/dist/cjs/ion-icon.cjs.entry.js +22 -13
  8. package/dist/cjs/loader.cjs.js +2 -3
  9. package/dist/cjs/stripe-address-element.cjs.entry.js +34 -26
  10. package/dist/cjs/stripe-card-element-modal.cjs.entry.js +6 -7
  11. package/dist/cjs/stripe-card-element_2.cjs.entry.js +135 -73
  12. package/dist/cjs/stripe-currency-selector.cjs.entry.js +13 -10
  13. package/dist/cjs/stripe-elements.cjs.js +31 -5
  14. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +25 -22
  15. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +13 -10
  16. package/dist/cjs/stripe-payment-element.cjs.entry.js +190 -131
  17. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +12 -7
  18. package/dist/collection/collection-manifest.json +3 -2
  19. package/dist/collection/components/stripe-address-element/stripe-address-element.js +29 -21
  20. package/dist/collection/components/stripe-card-element/stripe-card-element.helpers.js +57 -0
  21. package/dist/collection/components/stripe-card-element/stripe-card-element.js +55 -68
  22. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.css +2 -2
  23. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +16 -12
  24. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +10 -6
  25. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +28 -20
  26. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +12 -7
  27. package/dist/collection/components/stripe-modal/stripe-modal.css +36 -2
  28. package/dist/collection/components/stripe-modal/stripe-modal.js +34 -7
  29. package/dist/collection/components/stripe-payment-element/stripe-payment-element.helpers.js +114 -0
  30. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +69 -126
  31. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +34 -12
  32. package/dist/collection/index.js +0 -1
  33. package/dist/collection/interfaces.js +0 -1
  34. package/dist/collection/services/address-element-manager.js +3 -4
  35. package/dist/collection/services/card-element-manager.js +3 -4
  36. package/dist/collection/services/currency-selector-element-manager.js +3 -4
  37. package/dist/collection/services/express-checkout-element-manager.js +9 -10
  38. package/dist/collection/services/factory.js +0 -1
  39. package/dist/collection/services/interfaces.js +0 -1
  40. package/dist/collection/services/link-authentication-element-manager.js +3 -4
  41. package/dist/collection/services/payment-element-manager.js +4 -5
  42. package/dist/collection/services/stripe-service.js +5 -6
  43. package/dist/collection/utils/element-finder.js +2 -3
  44. package/dist/collection/utils/error.js +0 -1
  45. package/dist/collection/utils/i18n.js +0 -1
  46. package/dist/collection/utils/platform.js +0 -1
  47. package/dist/collection/utils/test-setup.js +5 -0
  48. package/dist/collection/utils/utils.js +2 -3
  49. package/dist/components/error.js +1 -16
  50. package/dist/components/factory.js +1 -3736
  51. package/dist/components/icon.js +1 -459
  52. package/dist/components/index.d.ts +2 -0
  53. package/dist/components/index.js +1 -4
  54. package/dist/components/index2.js +1 -192
  55. package/dist/components/ion-icon.js +1 -9
  56. package/dist/components/stripe-address-element.js +1 -327
  57. package/dist/components/stripe-card-element-modal.js +1 -174
  58. package/dist/components/stripe-card-element.js +1 -9
  59. package/dist/components/stripe-card-element2.js +1 -440
  60. package/dist/components/stripe-currency-selector.js +1 -218
  61. package/dist/components/stripe-express-checkout-element.js +1 -332
  62. package/dist/components/stripe-link-authentication-element.js +1 -256
  63. package/dist/components/stripe-modal.js +1 -9
  64. package/dist/components/stripe-modal2.js +1 -88
  65. package/dist/components/stripe-payment-element.js +1 -510
  66. package/dist/components/stripe-payment-request-button.js +1 -9
  67. package/dist/components/stripe-payment-request-button2.js +1 -224
  68. package/dist/components/utils.js +1 -89
  69. package/dist/esm/app-globals-DQuL1Twl.js +0 -3
  70. package/dist/esm/error-XRfh5Wrs.js +0 -3
  71. package/dist/esm/{factory-Li_TGt9P.js → factory-DeqoYLf_.js} +194 -73
  72. package/dist/esm/index-C6bbmyga.js +4677 -0
  73. package/dist/esm/{index-BHDCxQOb.js → index-CBXaOfXU.js} +24 -6
  74. package/dist/esm/index.js +0 -1
  75. package/dist/esm/ion-icon.entry.js +22 -13
  76. package/dist/esm/loader.js +3 -4
  77. package/dist/esm/stripe-address-element.entry.js +34 -26
  78. package/dist/esm/stripe-card-element-modal.entry.js +6 -7
  79. package/dist/esm/stripe-card-element_2.entry.js +135 -73
  80. package/dist/esm/stripe-currency-selector.entry.js +13 -10
  81. package/dist/esm/stripe-elements.js +32 -6
  82. package/dist/esm/stripe-express-checkout-element.entry.js +25 -22
  83. package/dist/esm/stripe-link-authentication-element.entry.js +13 -10
  84. package/dist/esm/stripe-payment-element.entry.js +190 -131
  85. package/dist/esm/stripe-payment-request-button.entry.js +12 -7
  86. package/dist/stripe-elements/index.esm.js +0 -2
  87. package/dist/stripe-elements/p--sA2m1ad.js +1 -0
  88. package/dist/stripe-elements/p-38e7b187.entry.js +1 -0
  89. package/dist/stripe-elements/p-44495284.entry.js +1 -0
  90. package/dist/stripe-elements/p-4ba675fa.entry.js +1 -0
  91. package/dist/stripe-elements/p-5cf62945.entry.js +1 -0
  92. package/dist/stripe-elements/p-C6bbmyga.js +2 -0
  93. package/dist/stripe-elements/p-CBXaOfXU.js +1 -0
  94. package/dist/stripe-elements/p-DQuL1Twl.js +1 -2
  95. package/dist/stripe-elements/p-XRfh5Wrs.js +1 -2
  96. package/dist/stripe-elements/p-c24ae181.entry.js +1 -0
  97. package/dist/stripe-elements/p-d9e86451.entry.js +1 -0
  98. package/dist/stripe-elements/p-f09c86a0.entry.js +1 -0
  99. package/dist/stripe-elements/p-f64f394d.entry.js +1 -0
  100. package/dist/stripe-elements/p-f6d2425e.entry.js +1 -0
  101. package/dist/stripe-elements/stripe-elements.esm.js +1 -2
  102. package/dist/stripe-elements/svg/.gitignore +4 -0
  103. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +5 -1
  104. package/dist/types/components/stripe-card-element/stripe-card-element.helpers.d.ts +29 -0
  105. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +4 -4
  106. package/dist/types/components/stripe-modal/stripe-modal.d.ts +6 -0
  107. package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +2 -2
  108. package/dist/types/components/stripe-payment-element/stripe-payment-element.helpers.d.ts +54 -0
  109. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +8 -0
  110. package/dist/types/components.d.ts +139 -29
  111. package/dist/types/index.d.ts +1 -0
  112. package/dist/types/services/interfaces.d.ts +3 -3
  113. package/dist/types/services/stripe-service.d.ts +2 -2
  114. package/dist/types/stencil-public-runtime.d.ts +110 -5
  115. package/dist/types/utils/test-setup.d.ts +1 -0
  116. package/package.json +50 -30
  117. package/readme.md +386 -133
  118. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  119. package/dist/cjs/error-FFC4kSs5.js.map +0 -1
  120. package/dist/cjs/factory-Hsw0e7-d.js.map +0 -1
  121. package/dist/cjs/index-Ba1pBePA.js.map +0 -1
  122. package/dist/cjs/index-C1haN5iF.js +0 -1907
  123. package/dist/cjs/index-C1haN5iF.js.map +0 -1
  124. package/dist/cjs/index.cjs.js.map +0 -1
  125. package/dist/cjs/ion-icon.entry.cjs.js.map +0 -1
  126. package/dist/cjs/loader.cjs.js.map +0 -1
  127. package/dist/cjs/stripe-address-element.entry.cjs.js.map +0 -1
  128. package/dist/cjs/stripe-card-element-modal.entry.cjs.js.map +0 -1
  129. package/dist/cjs/stripe-card-element.stripe-modal.entry.cjs.js.map +0 -1
  130. package/dist/cjs/stripe-currency-selector.entry.cjs.js.map +0 -1
  131. package/dist/cjs/stripe-elements.cjs.js.map +0 -1
  132. package/dist/cjs/stripe-express-checkout-element.entry.cjs.js.map +0 -1
  133. package/dist/cjs/stripe-link-authentication-element.entry.cjs.js.map +0 -1
  134. package/dist/cjs/stripe-payment-element.entry.cjs.js.map +0 -1
  135. package/dist/cjs/stripe-payment-request-button.entry.cjs.js.map +0 -1
  136. package/dist/collection/components/stripe-address-element/stripe-address-element.js.map +0 -1
  137. package/dist/collection/components/stripe-card-element/stripe-card-element.js.map +0 -1
  138. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js.map +0 -1
  139. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js.map +0 -1
  140. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js.map +0 -1
  141. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js.map +0 -1
  142. package/dist/collection/components/stripe-modal/stripe-modal.js.map +0 -1
  143. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js.map +0 -1
  144. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js.map +0 -1
  145. package/dist/collection/index.js.map +0 -1
  146. package/dist/collection/interfaces.js.map +0 -1
  147. package/dist/collection/services/address-element-manager.js.map +0 -1
  148. package/dist/collection/services/card-element-manager.js.map +0 -1
  149. package/dist/collection/services/currency-selector-element-manager.js.map +0 -1
  150. package/dist/collection/services/express-checkout-element-manager.js.map +0 -1
  151. package/dist/collection/services/factory.js.map +0 -1
  152. package/dist/collection/services/interfaces.js.map +0 -1
  153. package/dist/collection/services/link-authentication-element-manager.js.map +0 -1
  154. package/dist/collection/services/payment-element-manager.js.map +0 -1
  155. package/dist/collection/services/stripe-service.js.map +0 -1
  156. package/dist/collection/utils/element-finder.js.map +0 -1
  157. package/dist/collection/utils/error.js.map +0 -1
  158. package/dist/collection/utils/i18n.js.map +0 -1
  159. package/dist/collection/utils/platform.js.map +0 -1
  160. package/dist/collection/utils/utils.js.map +0 -1
  161. package/dist/components/error.js.map +0 -1
  162. package/dist/components/factory.js.map +0 -1
  163. package/dist/components/icon.js.map +0 -1
  164. package/dist/components/index.js.map +0 -1
  165. package/dist/components/index2.js.map +0 -1
  166. package/dist/components/ion-icon.js.map +0 -1
  167. package/dist/components/stripe-address-element.js.map +0 -1
  168. package/dist/components/stripe-card-element-modal.js.map +0 -1
  169. package/dist/components/stripe-card-element.js.map +0 -1
  170. package/dist/components/stripe-card-element2.js.map +0 -1
  171. package/dist/components/stripe-currency-selector.js.map +0 -1
  172. package/dist/components/stripe-express-checkout-element.js.map +0 -1
  173. package/dist/components/stripe-link-authentication-element.js.map +0 -1
  174. package/dist/components/stripe-modal.js.map +0 -1
  175. package/dist/components/stripe-modal2.js.map +0 -1
  176. package/dist/components/stripe-payment-element.js.map +0 -1
  177. package/dist/components/stripe-payment-request-button.js.map +0 -1
  178. package/dist/components/stripe-payment-request-button2.js.map +0 -1
  179. package/dist/components/utils.js.map +0 -1
  180. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  181. package/dist/esm/error-XRfh5Wrs.js.map +0 -1
  182. package/dist/esm/factory-Li_TGt9P.js.map +0 -1
  183. package/dist/esm/index-BHDCxQOb.js.map +0 -1
  184. package/dist/esm/index-Dkis4t79.js +0 -1895
  185. package/dist/esm/index-Dkis4t79.js.map +0 -1
  186. package/dist/esm/index.js.map +0 -1
  187. package/dist/esm/ion-icon.entry.js.map +0 -1
  188. package/dist/esm/loader.js.map +0 -1
  189. package/dist/esm/stripe-address-element.entry.js.map +0 -1
  190. package/dist/esm/stripe-card-element-modal.entry.js.map +0 -1
  191. package/dist/esm/stripe-card-element.stripe-modal.entry.js.map +0 -1
  192. package/dist/esm/stripe-currency-selector.entry.js.map +0 -1
  193. package/dist/esm/stripe-elements.js.map +0 -1
  194. package/dist/esm/stripe-express-checkout-element.entry.js.map +0 -1
  195. package/dist/esm/stripe-link-authentication-element.entry.js.map +0 -1
  196. package/dist/esm/stripe-payment-element.entry.js.map +0 -1
  197. package/dist/esm/stripe-payment-request-button.entry.js.map +0 -1
  198. package/dist/stripe-elements/index.esm.js.map +0 -1
  199. package/dist/stripe-elements/ion-icon.entry.esm.js.map +0 -1
  200. package/dist/stripe-elements/loader.esm.js.map +0 -1
  201. package/dist/stripe-elements/p-01d63033.entry.js +0 -2
  202. package/dist/stripe-elements/p-01d63033.entry.js.map +0 -1
  203. package/dist/stripe-elements/p-1b8f9c7f.entry.js +0 -2
  204. package/dist/stripe-elements/p-1b8f9c7f.entry.js.map +0 -1
  205. package/dist/stripe-elements/p-37008853.entry.js +0 -2
  206. package/dist/stripe-elements/p-37008853.entry.js.map +0 -1
  207. package/dist/stripe-elements/p-5d152193.entry.js +0 -2
  208. package/dist/stripe-elements/p-5d152193.entry.js.map +0 -1
  209. package/dist/stripe-elements/p-623f13e6.entry.js +0 -2
  210. package/dist/stripe-elements/p-623f13e6.entry.js.map +0 -1
  211. package/dist/stripe-elements/p-809c9f2f.entry.js +0 -2
  212. package/dist/stripe-elements/p-809c9f2f.entry.js.map +0 -1
  213. package/dist/stripe-elements/p-BHDCxQOb.js +0 -2
  214. package/dist/stripe-elements/p-BHDCxQOb.js.map +0 -1
  215. package/dist/stripe-elements/p-DQuL1Twl.js.map +0 -1
  216. package/dist/stripe-elements/p-Dkis4t79.js +0 -3
  217. package/dist/stripe-elements/p-Dkis4t79.js.map +0 -1
  218. package/dist/stripe-elements/p-WnA32N4v.js +0 -2
  219. package/dist/stripe-elements/p-WnA32N4v.js.map +0 -1
  220. package/dist/stripe-elements/p-XRfh5Wrs.js.map +0 -1
  221. package/dist/stripe-elements/p-ba41e196.entry.js +0 -2
  222. package/dist/stripe-elements/p-ba41e196.entry.js.map +0 -1
  223. package/dist/stripe-elements/p-bb1bc49a.entry.js +0 -2
  224. package/dist/stripe-elements/p-bb1bc49a.entry.js.map +0 -1
  225. package/dist/stripe-elements/p-f21ea941.entry.js +0 -2
  226. package/dist/stripe-elements/p-f21ea941.entry.js.map +0 -1
  227. package/dist/stripe-elements/stripe-address-element.entry.esm.js.map +0 -1
  228. package/dist/stripe-elements/stripe-card-element-modal.entry.esm.js.map +0 -1
  229. package/dist/stripe-elements/stripe-card-element.stripe-modal.entry.esm.js.map +0 -1
  230. package/dist/stripe-elements/stripe-currency-selector.entry.esm.js.map +0 -1
  231. package/dist/stripe-elements/stripe-elements.esm.js.map +0 -1
  232. package/dist/stripe-elements/stripe-express-checkout-element.entry.esm.js.map +0 -1
  233. package/dist/stripe-elements/stripe-link-authentication-element.entry.esm.js.map +0 -1
  234. package/dist/stripe-elements/stripe-payment-element.entry.esm.js.map +0 -1
  235. package/dist/stripe-elements/stripe-payment-request-button.entry.esm.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-Dkis4t79.js';
2
- import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-Li_TGt9P.js';
1
+ import { r as registerInstance, a as createEvent, h, g as getElement } from './index-C6bbmyga.js';
2
+ import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-DeqoYLf_.js';
3
3
  import { S as StripeAPIError } from './error-XRfh5Wrs.js';
4
- import './index-BHDCxQOb.js';
4
+ import './index-CBXaOfXU.js';
5
5
 
6
- const stripeExpressCheckoutElementCss = ":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-express-checkout-wrap{width:100%;max-width:500px;margin:0 auto;padding:1rem 0}.stripe-express-checkout-wrap #express-checkout-element{margin-bottom:1rem}.stripe-express-checkout-wrap .stripe-element-errors{color:var(--stripe-error-color, #fa755a);font-size:14px;margin-top:0.5rem;padding:0.5rem;background-color:var(--stripe-error-bg, #fff5f5);border:1px solid var(--stripe-error-border, #fdd);border-radius:6px}.stripe-express-checkout-wrap .stripe-express-checkout-loading{text-align:center;padding:1rem;color:var(--stripe-loading-color, #6772e5);font-size:14px}";
6
+ const stripeExpressCheckoutElementCss = () => `: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-express-checkout-wrap{width:100%;max-width:500px;margin:0 auto;padding:1rem 0}.stripe-express-checkout-wrap #express-checkout-element{margin-bottom:1rem}.stripe-express-checkout-wrap .stripe-element-errors{color:var(--stripe-error-color, #fa755a);font-size:14px;margin-top:0.5rem;padding:0.5rem;background-color:var(--stripe-error-bg, #fff5f5);border:1px solid var(--stripe-error-border, #fdd);border-radius:6px}.stripe-express-checkout-wrap .stripe-express-checkout-loading{text-align:center;padding:1rem;color:var(--stripe-loading-color, #6772e5);font-size:14px}`;
7
7
 
8
8
  const StripeExpressCheckoutElement = class {
9
9
  updatePublishableKey(publishableKey) {
@@ -111,7 +111,7 @@ const StripeExpressCheckoutElement = class {
111
111
  const event = {
112
112
  stripe: this.stripeService.getStripe(),
113
113
  };
114
- if (this.stripeDidLoaded) {
114
+ if (this.stripeDidLoaded != null) {
115
115
  this.stripeDidLoaded(event);
116
116
  }
117
117
  this.stripeLoaded.emit(event);
@@ -121,11 +121,11 @@ const StripeExpressCheckoutElement = class {
121
121
  }
122
122
  constructor(hostRef) {
123
123
  registerInstance(this, hostRef);
124
- this.stripeLoaded = createEvent(this, "stripeLoaded");
125
- this.confirm = createEvent(this, "confirm");
126
- this.expressCheckoutClick = createEvent(this, "expressCheckoutClick");
127
- this.cancel = createEvent(this, "cancel");
128
- this.defaultConfirmResult = createEvent(this, "defaultConfirmResult");
124
+ this.stripeLoaded = createEvent(this, "stripeLoaded", 7);
125
+ this.confirm = createEvent(this, "confirm", 7);
126
+ this.expressCheckoutClick = createEvent(this, "expressCheckoutClick", 7);
127
+ this.cancel = createEvent(this, "cancel", 7);
128
+ this.defaultConfirmResult = createEvent(this, "defaultConfirmResult", 7);
129
129
  /**
130
130
  * Default submit handle type.
131
131
  * If you want to use `setupIntent`, should update this attribute.
@@ -149,14 +149,14 @@ const StripeExpressCheckoutElement = class {
149
149
  // Dependency Injection via factory
150
150
  this.stripeService = serviceFactory.createStripeService();
151
151
  this.expressCheckoutManager = serviceFactory.createExpressCheckoutElementManager(this.stripeService);
152
- if (this.publishableKey) {
152
+ if (this.publishableKey != null && this.publishableKey !== '') {
153
153
  this.initStripe(this.publishableKey, {
154
154
  stripeAccount: this.stripeAccount,
155
155
  });
156
156
  }
157
157
  }
158
158
  componentWillUpdate() {
159
- if (!this.stripeService.state.publishableKey) {
159
+ if (this.stripeService.state.publishableKey == null || this.stripeService.state.publishableKey === '') {
160
160
  return;
161
161
  }
162
162
  if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
@@ -176,10 +176,10 @@ const StripeExpressCheckoutElement = class {
176
176
  this.progress = 'loading';
177
177
  const stripe = this.stripeService.getStripe();
178
178
  const { intentType, clientSecret } = this;
179
- if (!stripe) {
179
+ if (stripe == null) {
180
180
  throw new Error('Stripe not initialized');
181
181
  }
182
- if (!clientSecret) {
182
+ if (clientSecret == null || clientSecret === '') {
183
183
  throw new Error('Client secret is required');
184
184
  }
185
185
  const result = await (() => {
@@ -202,7 +202,7 @@ const StripeExpressCheckoutElement = class {
202
202
  redirect: 'if_required',
203
203
  });
204
204
  })();
205
- if (result.error) {
205
+ if (result.error != null) {
206
206
  throw new StripeAPIError(result.error);
207
207
  }
208
208
  // Complete the payment in the Express Checkout Element
@@ -231,10 +231,10 @@ const StripeExpressCheckoutElement = class {
231
231
  if (this.amount !== undefined) {
232
232
  elementOptions.amount = this.amount;
233
233
  }
234
- if (this.currency) {
234
+ if (this.currency != null && this.currency !== '') {
235
235
  elementOptions.currency = this.currency;
236
236
  }
237
- if (this.buttonHeight) {
237
+ if (this.buttonHeight != null && this.buttonHeight !== '') {
238
238
  // Convert string like "48px" to number for Stripe API
239
239
  if (typeof this.buttonHeight === 'string') {
240
240
  const height = parseInt(this.buttonHeight.replace('px', ''), 10);
@@ -250,7 +250,7 @@ const StripeExpressCheckoutElement = class {
250
250
  await this.expressCheckoutManager.initialize(this.el, elementOptions, {
251
251
  onConfirm: async (event) => {
252
252
  this.confirm.emit(event);
253
- if (this.shouldUseDefaultConfirmAction && this.clientSecret) {
253
+ if (this.shouldUseDefaultConfirmAction && this.clientSecret != null && this.clientSecret !== '') {
254
254
  await this.defaultConfirmAction(event);
255
255
  }
256
256
  },
@@ -282,11 +282,14 @@ const StripeExpressCheckoutElement = class {
282
282
  }
283
283
  get el() { return getElement(this); }
284
284
  static get watchers() { return {
285
- "publishableKey": ["updatePublishableKey"],
286
- "stripeAccount": ["updateStripeAccountId"]
285
+ "publishableKey": [{
286
+ "updatePublishableKey": 0
287
+ }],
288
+ "stripeAccount": [{
289
+ "updateStripeAccountId": 0
290
+ }]
287
291
  }; }
288
292
  };
289
- StripeExpressCheckoutElement.style = stripeExpressCheckoutElementCss;
293
+ StripeExpressCheckoutElement.style = stripeExpressCheckoutElementCss();
290
294
 
291
295
  export { StripeExpressCheckoutElement as stripe_express_checkout_element };
292
- //# sourceMappingURL=stripe-express-checkout-element.entry.js.map
@@ -1,8 +1,8 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-Dkis4t79.js';
2
- import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-Li_TGt9P.js';
3
- import './index-BHDCxQOb.js';
1
+ import { r as registerInstance, a as createEvent, h, g as getElement } from './index-C6bbmyga.js';
2
+ import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-DeqoYLf_.js';
3
+ import './index-CBXaOfXU.js';
4
4
 
5
- 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)}";
5
+ 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)}`;
6
6
 
7
7
  const StripeLinkAuthenticationElement = class {
8
8
  updatePublishableKey(publishableKey) {
@@ -154,8 +154,8 @@ const StripeLinkAuthenticationElement = class {
154
154
  }
155
155
  constructor(hostRef) {
156
156
  registerInstance(this, hostRef);
157
- this.stripeLoaded = createEvent(this, "stripeLoaded");
158
- this.linkAuthenticationChange = createEvent(this, "linkAuthenticationChange");
157
+ this.stripeLoaded = createEvent(this, "stripeLoaded", 7);
158
+ this.linkAuthenticationChange = createEvent(this, "linkAuthenticationChange", 7);
159
159
  /**
160
160
  * Overwrite the application name that registered
161
161
  * For wrapper library (like Capacitor)
@@ -210,11 +210,14 @@ const StripeLinkAuthenticationElement = class {
210
210
  }
211
211
  get el() { return getElement(this); }
212
212
  static get watchers() { return {
213
- "publishableKey": ["updatePublishableKey"],
214
- "stripeAccount": ["updateStripeAccountId"]
213
+ "publishableKey": [{
214
+ "updatePublishableKey": 0
215
+ }],
216
+ "stripeAccount": [{
217
+ "updateStripeAccountId": 0
218
+ }]
215
219
  }; }
216
220
  };
217
- StripeLinkAuthenticationElement.style = stripeLinkAuthenticationElementCss;
221
+ StripeLinkAuthenticationElement.style = stripeLinkAuthenticationElementCss();
218
222
 
219
223
  export { StripeLinkAuthenticationElement as stripe_link_authentication_element };
220
- //# sourceMappingURL=stripe-link-authentication-element.entry.js.map
@@ -1,9 +1,123 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-Dkis4t79.js';
2
- import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-Li_TGt9P.js';
1
+ import { r as registerInstance, a as createEvent, h, g as getElement } from './index-C6bbmyga.js';
2
+ import { s as serviceFactory, c as checkPlatform, i as i18n } from './factory-DeqoYLf_.js';
3
3
  import { S as StripeAPIError } from './error-XRfh5Wrs.js';
4
- import './index-BHDCxQOb.js';
4
+ import './index-CBXaOfXU.js';
5
5
 
6
- const stripePaymentElementCss = ":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 .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.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{margin-top:8px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.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)}";
6
+ /**
7
+ * Determine whether the submit button should be disabled.
8
+ * For Checkout Session mode: the checkout is ready once Stripe finished loading.
9
+ * For Payment Intent / Setup Intent mode: an intent client secret must be present.
10
+ * @param params progress / loading state and the current mode information
11
+ * @returns true when the submit button should be disabled
12
+ */
13
+ const isSubmitButtonDisabled = (params) => {
14
+ const { progress, isCheckoutSession, loadStripeStatus, intentClientSecret } = params;
15
+ const hasValidSecret = isCheckoutSession ? loadStripeStatus === 'success' : intentClientSecret != null && intentClientSecret !== '';
16
+ return progress === 'loading' || !hasValidSecret;
17
+ };
18
+ /**
19
+ * Run the default Stripe confirmation flow for Payment Intent / Setup Intent mode.
20
+ * Calls `confirmPayment` or `confirmSetup` depending on the intent type.
21
+ * @param stripe the loaded Stripe.js instance
22
+ * @param elements the Stripe Elements instance bound to the payment element
23
+ * @param intentType the configured intent type
24
+ * @param returnUrl the URL Stripe should redirect back to when required
25
+ * @returns the confirmation result
26
+ * @throws StripeAPIError when Stripe returns an error
27
+ */
28
+ const confirmPaymentOrSetup = async (stripe, elements, intentType, returnUrl) => {
29
+ const result = await (() => {
30
+ if (intentType === 'payment') {
31
+ return stripe.confirmPayment({
32
+ elements,
33
+ confirmParams: {
34
+ return_url: returnUrl,
35
+ },
36
+ redirect: 'if_required',
37
+ });
38
+ }
39
+ return stripe.confirmSetup({
40
+ elements,
41
+ confirmParams: {
42
+ return_url: returnUrl,
43
+ },
44
+ redirect: 'if_required',
45
+ });
46
+ })();
47
+ if (result.error) {
48
+ throw new StripeAPIError(result.error);
49
+ }
50
+ return result;
51
+ };
52
+ /**
53
+ * Confirm a Checkout Session payment using the checkout actions.
54
+ * @param checkout the Stripe Checkout instance
55
+ * @param returnUrl the URL Stripe should redirect back to when required
56
+ * @returns the confirmation result
57
+ * @throws StripeAPIError when loading actions or confirming fails
58
+ */
59
+ const confirmCheckoutSession = async (checkout, returnUrl) => {
60
+ var _a;
61
+ // Load actions from the checkout session
62
+ const loadActionsResult = await checkout.loadActions();
63
+ if (loadActionsResult.type === 'error') {
64
+ // Create a StripeError-compatible object from the Checkout Session error
65
+ const stripeError = {
66
+ type: 'api_error',
67
+ code: loadActionsResult.error.code || 'checkout_session_error',
68
+ message: loadActionsResult.error.message,
69
+ };
70
+ throw new StripeAPIError(stripeError);
71
+ }
72
+ const { actions } = loadActionsResult;
73
+ // Confirm the payment using checkout session actions
74
+ const result = await actions.confirm({
75
+ returnUrl,
76
+ redirect: 'if_required',
77
+ });
78
+ if (result.type === 'error') {
79
+ // Create a StripeError-compatible object from the confirm error
80
+ const stripeError = {
81
+ type: 'card_error',
82
+ code: result.error.code || 'payment_failed',
83
+ message: result.error.message,
84
+ decline_code: result.error.code === 'paymentFailed' ? (_a = result.error.paymentFailed) === null || _a === void 0 ? void 0 : _a.declineCode : undefined,
85
+ };
86
+ throw new StripeAPIError(stripeError);
87
+ }
88
+ return result;
89
+ };
90
+ /**
91
+ * Resolve the mode-specific properties for a submit event.
92
+ * Picks the Checkout or Elements payload depending on the active mode and
93
+ * reports a descriptive error string when the required instance is missing.
94
+ * @param params the resolved Stripe instances and client secrets for the current mode
95
+ * @returns the submit event props, or an error message when an instance is missing
96
+ */
97
+ const buildSubmitEventProps = (params) => {
98
+ const { stripe, isCheckoutSession, checkout, checkoutSessionClientSecret, elements, intentClientSecret } = params;
99
+ const props = {
100
+ stripe,
101
+ };
102
+ if (isCheckoutSession) {
103
+ // Checkout Session mode
104
+ if (checkout == null) {
105
+ return { error: 'Checkout not properly initialized' };
106
+ }
107
+ props.checkout = checkout;
108
+ props.checkoutSessionClientSecret = checkoutSessionClientSecret;
109
+ return { props };
110
+ }
111
+ // Payment Intent / Setup Intent mode
112
+ if (elements == null) {
113
+ return { error: 'Elements not properly initialized' };
114
+ }
115
+ props.elements = elements;
116
+ props.intentClientSecret = intentClientSecret;
117
+ return { props };
118
+ };
119
+
120
+ const stripePaymentElementCss = () => `: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 .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.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{margin-top:8px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.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)}`;
7
121
 
8
122
  const StripePaymentElement = class {
9
123
  /**
@@ -123,7 +237,7 @@ const StripePaymentElement = class {
123
237
  updatePublishableKey(publishableKey) {
124
238
  const options = {};
125
239
  options.stripeAccount = this.stripeService.state.stripeAccount;
126
- const hasOptionValue = Object.values(options).filter(Boolean).length > 0;
240
+ const hasOptionValue = Object.values(options).filter(value => value != null && value !== '').length > 0;
127
241
  this.initStripe(publishableKey, hasOptionValue ? options : undefined);
128
242
  }
129
243
  updateStripeAccountId(stripeAccount) {
@@ -139,7 +253,7 @@ const StripePaymentElement = class {
139
253
  }
140
254
  async updateCheckoutSessionClientSecret(newValue) {
141
255
  // Re-initialize with checkout session when client secret changes
142
- if (this.publishableKey && newValue) {
256
+ if (this.publishableKey != null && this.publishableKey !== '' && newValue != null && newValue !== '') {
143
257
  await this.initStripeWithCheckoutSession(this.publishableKey, newValue, {
144
258
  stripeAccount: this.stripeAccount,
145
259
  });
@@ -149,42 +263,31 @@ const StripePaymentElement = class {
149
263
  const event = {
150
264
  stripe: this.stripeService.getStripe(),
151
265
  };
152
- if (this.stripeDidLoaded) {
266
+ if (this.stripeDidLoaded != null) {
153
267
  this.stripeDidLoaded(event);
154
268
  }
155
269
  this.stripeLoaded.emit(event);
156
270
  }
157
271
  async formSubmitEventHandler() {
158
272
  const stripe = this.stripeService.getStripe();
159
- const isCheckoutSession = this.stripeService.state.isCheckoutSession;
160
- if (!stripe) {
273
+ const isCheckoutSession = this.stripeService.state.isCheckoutSession === true;
274
+ if (stripe == null) {
161
275
  console.error('Stripe not properly initialized');
162
276
  return;
163
277
  }
164
- const eventData = {
278
+ const result = buildSubmitEventProps({
165
279
  stripe,
166
- };
167
- if (isCheckoutSession) {
168
- // Checkout Session mode
169
- const checkout = this.stripeService.getCheckout();
170
- if (!checkout) {
171
- console.error('Checkout not properly initialized');
172
- return;
173
- }
174
- eventData.checkout = checkout;
175
- eventData.checkoutSessionClientSecret = this.checkoutSessionClientSecret;
176
- }
177
- else {
178
- // Payment Intent / Setup Intent mode
179
- const elements = this.stripeService.getElements();
180
- if (!elements) {
181
- console.error('Elements not properly initialized');
182
- return;
183
- }
184
- eventData.elements = elements;
185
- eventData.intentClientSecret = this.intentClientSecret;
280
+ isCheckoutSession,
281
+ checkout: this.stripeService.getCheckout(),
282
+ checkoutSessionClientSecret: this.checkoutSessionClientSecret,
283
+ elements: this.stripeService.getElements(),
284
+ intentClientSecret: this.intentClientSecret,
285
+ });
286
+ if ('error' in result) {
287
+ console.error(result.error);
288
+ return;
186
289
  }
187
- this.formSubmit.emit(eventData);
290
+ this.formSubmit.emit(result.props);
188
291
  }
189
292
  async defaultFormSubmitResultHandler(result) {
190
293
  this.defaultFormSubmitResult.emit(result);
@@ -193,7 +296,8 @@ const StripePaymentElement = class {
193
296
  this.checkoutSessionConfirmResult.emit(result);
194
297
  }
195
298
  componentWillRender() {
196
- if (!this.stripeService.state.publishableKey) {
299
+ const { publishableKey } = this.stripeService.state;
300
+ if (publishableKey == null || publishableKey === '') {
197
301
  return;
198
302
  }
199
303
  if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
@@ -213,30 +317,9 @@ const StripePaymentElement = class {
213
317
  async defaultFormSubmitAction(event, { stripe, elements }) {
214
318
  event.preventDefault();
215
319
  try {
216
- const { intentType } = this;
217
320
  // Get current page URL for return_url
218
321
  const returnUrl = window.location.href;
219
- const result = await (() => {
220
- if (intentType === 'payment') {
221
- return stripe.confirmPayment({
222
- elements,
223
- confirmParams: {
224
- return_url: returnUrl,
225
- },
226
- redirect: 'if_required',
227
- });
228
- }
229
- return stripe.confirmSetup({
230
- elements,
231
- confirmParams: {
232
- return_url: returnUrl,
233
- },
234
- redirect: 'if_required',
235
- });
236
- })();
237
- if (result.error) {
238
- throw new StripeAPIError(result.error);
239
- }
322
+ const result = await confirmPaymentOrSetup(stripe, elements, this.intentType, returnUrl);
240
323
  this.defaultFormSubmitResultHandler(result);
241
324
  }
242
325
  catch (e) {
@@ -252,38 +335,11 @@ const StripePaymentElement = class {
252
335
  * @param checkout - The Stripe Checkout instance
253
336
  */
254
337
  async checkoutSessionFormSubmitAction(event, checkout) {
255
- var _a;
256
338
  event.preventDefault();
257
339
  try {
258
- // Load actions from the checkout session
259
- const loadActionsResult = await checkout.loadActions();
260
- if (loadActionsResult.type === 'error') {
261
- // Create a StripeError-compatible object from the Checkout Session error
262
- const stripeError = {
263
- type: 'api_error',
264
- code: loadActionsResult.error.code || 'checkout_session_error',
265
- message: loadActionsResult.error.message,
266
- };
267
- throw new StripeAPIError(stripeError);
268
- }
269
- const { actions } = loadActionsResult;
270
340
  // Get current page URL for return_url
271
341
  const returnUrl = window.location.href;
272
- // Confirm the payment using checkout session actions
273
- const result = await actions.confirm({
274
- returnUrl,
275
- redirect: 'if_required',
276
- });
277
- if (result.type === 'error') {
278
- // Create a StripeError-compatible object from the confirm error
279
- const stripeError = {
280
- type: 'card_error',
281
- code: result.error.code || 'payment_failed',
282
- message: result.error.message,
283
- decline_code: result.error.code === 'paymentFailed' ? (_a = result.error.paymentFailed) === null || _a === void 0 ? void 0 : _a.declineCode : undefined,
284
- };
285
- throw new StripeAPIError(stripeError);
286
- }
342
+ const result = await confirmCheckoutSession(checkout, returnUrl);
287
343
  this.checkoutSessionConfirmResultHandler(result);
288
344
  }
289
345
  catch (e) {
@@ -294,10 +350,10 @@ const StripePaymentElement = class {
294
350
  }
295
351
  constructor(hostRef) {
296
352
  registerInstance(this, hostRef);
297
- this.stripeLoaded = createEvent(this, "stripeLoaded");
298
- this.formSubmit = createEvent(this, "formSubmit");
299
- this.defaultFormSubmitResult = createEvent(this, "defaultFormSubmitResult");
300
- this.checkoutSessionConfirmResult = createEvent(this, "checkoutSessionConfirmResult");
353
+ this.stripeLoaded = createEvent(this, "stripeLoaded", 7);
354
+ this.formSubmit = createEvent(this, "formSubmit", 7);
355
+ this.defaultFormSubmitResult = createEvent(this, "defaultFormSubmitResult", 7);
356
+ this.checkoutSessionConfirmResult = createEvent(this, "checkoutSessionConfirmResult", 7);
301
357
  /**
302
358
  * Default submit handle type.
303
359
  * If you want to use `setupIntent`, should update this attribute.
@@ -339,7 +395,7 @@ const StripePaymentElement = class {
339
395
  // Dependency Injection via factory
340
396
  this.stripeService = serviceFactory.createStripeService();
341
397
  this.paymentElementManager = serviceFactory.createPaymentElementManager(this.stripeService);
342
- if (this.publishableKey) {
398
+ if (this.publishableKey != null && this.publishableKey !== '') {
343
399
  this.initStripe(this.publishableKey, {
344
400
  stripeAccount: this.stripeAccount,
345
401
  });
@@ -353,57 +409,47 @@ const StripePaymentElement = class {
353
409
  await this.paymentElementManager.initialize(this.el);
354
410
  // Add form submit listener scoped to this component instance
355
411
  const formElement = this.el.querySelector('#stripe-payment-element');
356
- if (!formElement) {
412
+ if (formElement == null) {
357
413
  console.error('Form element #stripe-payment-element not found');
358
414
  return;
359
415
  }
360
416
  // Remove existing listener if present to prevent duplicates
361
- if (this._submitHandler) {
417
+ if (this._submitHandler != null) {
362
418
  formElement.removeEventListener('submit', this._submitHandler);
363
419
  }
364
420
  // Create and store the submit handler
365
421
  this._submitHandler = async (e) => {
366
422
  const stripe = this.stripeService.getStripe();
367
- const isCheckoutSession = this.stripeService.state.isCheckoutSession;
368
- if (!stripe) {
423
+ const isCheckoutSession = this.stripeService.state.isCheckoutSession === true;
424
+ if (stripe == null) {
369
425
  console.error('Stripe not properly initialized');
370
426
  return;
371
427
  }
372
- // Build submit event props based on mode
373
- const submitEventProps = {
428
+ // Build submit event props based on mode (shared with formSubmitEventHandler)
429
+ const result = buildSubmitEventProps({
374
430
  stripe,
375
- };
376
- if (isCheckoutSession) {
377
- // Checkout Session mode
378
- const checkout = this.stripeService.getCheckout();
379
- if (!checkout) {
380
- console.error('Checkout not properly initialized');
381
- return;
382
- }
383
- submitEventProps.checkout = checkout;
384
- submitEventProps.checkoutSessionClientSecret = this.checkoutSessionClientSecret;
385
- }
386
- else {
387
- // Payment Intent / Setup Intent mode
388
- const elements = this.stripeService.getElements();
389
- if (!elements) {
390
- console.error('Elements not properly initialized');
391
- return;
392
- }
393
- submitEventProps.elements = elements;
394
- submitEventProps.intentClientSecret = this.intentClientSecret;
431
+ isCheckoutSession,
432
+ checkout: this.stripeService.getCheckout(),
433
+ checkoutSessionClientSecret: this.checkoutSessionClientSecret,
434
+ elements: this.stripeService.getElements(),
435
+ intentClientSecret: this.intentClientSecret,
436
+ });
437
+ if ('error' in result) {
438
+ console.error(result.error);
439
+ return;
395
440
  }
441
+ const submitEventProps = result.props;
396
442
  this.progress = 'loading';
397
443
  try {
398
- if (this.handleSubmit) {
444
+ if (this.handleSubmit != null) {
399
445
  await this.handleSubmit(e, submitEventProps);
400
446
  }
401
447
  else if (this.shouldUseDefaultFormSubmitAction === true) {
402
- if (isCheckoutSession && submitEventProps.checkout) {
448
+ if (isCheckoutSession && submitEventProps.checkout != null) {
403
449
  // Use Checkout Session confirmation
404
450
  await this.checkoutSessionFormSubmitAction(e, submitEventProps.checkout);
405
451
  }
406
- else if (this.intentClientSecret) {
452
+ else if (this.intentClientSecret != null && this.intentClientSecret !== '') {
407
453
  // Use Payment Intent / Setup Intent confirmation
408
454
  await this.defaultFormSubmitAction(e, submitEventProps);
409
455
  }
@@ -415,7 +461,7 @@ const StripePaymentElement = class {
415
461
  e.preventDefault();
416
462
  }
417
463
  await this.formSubmitEventHandler();
418
- if (this.handleSubmit || this.shouldUseDefaultFormSubmitAction === true) {
464
+ if (this.handleSubmit != null || this.shouldUseDefaultFormSubmitAction === true) {
419
465
  this.progress = 'success';
420
466
  }
421
467
  }
@@ -433,9 +479,9 @@ const StripePaymentElement = class {
433
479
  disconnectedCallback() {
434
480
  this.paymentElementManager.unmount();
435
481
  // Remove event listener to prevent memory leaks
436
- if (this._submitHandler) {
482
+ if (this._submitHandler != null) {
437
483
  const formElement = this.el.querySelector('#stripe-payment-element');
438
- if (formElement) {
484
+ if (formElement != null) {
439
485
  formElement.removeEventListener('submit', this._submitHandler);
440
486
  }
441
487
  }
@@ -446,22 +492,35 @@ const StripePaymentElement = class {
446
492
  if (loadStripeStatus === 'failure') {
447
493
  return h("p", null, i18n.t('Failed to load Stripe'));
448
494
  }
449
- // Determine if button should be disabled
450
- // For Checkout Session mode: check if checkout is initialized (loadStripeStatus === 'success')
451
- // For Payment Intent mode: check if intentClientSecret is set
452
- const hasValidSecret = isCheckoutSession ? loadStripeStatus === 'success' : !!this.intentClientSecret;
453
- const disabled = this.progress === 'loading' || !hasValidSecret;
454
- return (h("div", { class: "stripe-payment-sheet-wrap" }, h("form", { id: "stripe-payment-element" }, h("div", { class: "stripe-heading" }, i18n.t(this.sheetTitle)), h("div", null, h("div", { class: "stripe-section-title" }, i18n.t('Payment information'))), h("div", { class: "payment-info visible" }, h("div", { id: "payment-element" })), h("div", { id: "payment-errors", class: "stripe-element-errors" }, errorMessage), h("div", { style: { marginTop: '32px' } }, h("button", { type: "submit", disabled: disabled }, this.progress === 'loading' ? i18n.t('Loading') : i18n.t(this.buttonLabel))))));
495
+ // Determine if button should be disabled (see isSubmitButtonDisabled helper for mode-specific rules)
496
+ const disabled = isSubmitButtonDisabled({
497
+ progress: this.progress,
498
+ isCheckoutSession: isCheckoutSession === true,
499
+ loadStripeStatus,
500
+ intentClientSecret: this.intentClientSecret,
501
+ });
502
+ return (
503
+ // NOTE: `stripe-payment-sheet-wrap` is a legacy CSS class kept for backward compatibility.
504
+ // It is a leftover from a former component name but is part of the public DOM contract,
505
+ // so external stylesheets may target it. Keep it in the rendered output and the .scss.
506
+ h("div", { class: "stripe-payment-sheet-wrap" }, h("form", { id: "stripe-payment-element" }, h("div", { class: "stripe-heading" }, i18n.t(this.sheetTitle)), h("div", null, h("div", { class: "stripe-section-title" }, i18n.t('Payment information'))), h("div", { class: "payment-info visible" }, h("div", { id: "payment-element" })), h("div", { id: "payment-errors", class: "stripe-element-errors" }, errorMessage), h("div", { style: { marginTop: '32px' } }, h("button", { type: "submit", disabled: disabled }, this.progress === 'loading' ? i18n.t('Loading') : i18n.t(this.buttonLabel))))));
455
507
  }
456
508
  get el() { return getElement(this); }
457
509
  static get watchers() { return {
458
- "publishableKey": ["updatePublishableKey"],
459
- "stripeAccount": ["updateStripeAccountId"],
460
- "intentClientSecret": ["updateIntentClientSecret"],
461
- "checkoutSessionClientSecret": ["updateCheckoutSessionClientSecret"]
510
+ "publishableKey": [{
511
+ "updatePublishableKey": 0
512
+ }],
513
+ "stripeAccount": [{
514
+ "updateStripeAccountId": 0
515
+ }],
516
+ "intentClientSecret": [{
517
+ "updateIntentClientSecret": 0
518
+ }],
519
+ "checkoutSessionClientSecret": [{
520
+ "updateCheckoutSessionClientSecret": 0
521
+ }]
462
522
  }; }
463
523
  };
464
- StripePaymentElement.style = stripePaymentElementCss;
524
+ StripePaymentElement.style = stripePaymentElementCss();
465
525
 
466
526
  export { StripePaymentElement as stripe_payment_element };
467
- //# sourceMappingURL=stripe-payment-element.entry.js.map