stripe-pwa-elements 3.2.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 (237) 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-CbbbSvkg.js → factory-Cd2VI_N2.js} +216 -77
  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 +41 -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 +129 -72
  12. package/dist/cjs/stripe-currency-selector.cjs.entry.js +20 -10
  13. package/dist/cjs/stripe-elements.cjs.js +31 -5
  14. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +32 -22
  15. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +20 -10
  16. package/dist/cjs/stripe-payment-element.cjs.entry.js +283 -167
  17. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +30 -18
  18. package/dist/collection/collection-manifest.json +6 -5
  19. package/dist/collection/components/stripe-address-element/stripe-address-element.js +36 -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 +62 -68
  22. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +15 -11
  23. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +17 -6
  24. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +35 -20
  25. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +19 -7
  26. package/dist/collection/components/stripe-modal/stripe-modal.js +18 -7
  27. package/dist/collection/components/stripe-payment-element/stripe-payment-element.helpers.js +114 -0
  28. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +162 -162
  29. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +48 -19
  30. package/dist/collection/index.js +0 -1
  31. package/dist/collection/interfaces.js +0 -1
  32. package/dist/collection/services/address-element-manager.js +3 -4
  33. package/dist/collection/services/card-element-manager.js +3 -4
  34. package/dist/collection/services/currency-selector-element-manager.js +3 -4
  35. package/dist/collection/services/express-checkout-element-manager.js +9 -10
  36. package/dist/collection/services/factory.js +0 -1
  37. package/dist/collection/services/interfaces.js +0 -1
  38. package/dist/collection/services/link-authentication-element-manager.js +3 -4
  39. package/dist/collection/services/payment-element-manager.js +4 -5
  40. package/dist/collection/services/stripe-service.js +27 -10
  41. package/dist/collection/utils/element-finder.js +2 -3
  42. package/dist/collection/utils/error.js +0 -1
  43. package/dist/collection/utils/i18n.js +0 -1
  44. package/dist/collection/utils/platform.js +0 -1
  45. package/dist/collection/utils/test-setup.js +0 -1
  46. package/dist/collection/utils/utils.js +2 -3
  47. package/dist/components/error.js +1 -16
  48. package/dist/components/factory.js +1 -3736
  49. package/dist/components/icon.js +1 -459
  50. package/dist/components/index.d.ts +2 -0
  51. package/dist/components/index.js +1 -4
  52. package/dist/components/index2.js +1 -192
  53. package/dist/components/ion-icon.js +1 -9
  54. package/dist/components/stripe-address-element.js +1 -327
  55. package/dist/components/stripe-card-element-modal.js +1 -174
  56. package/dist/components/stripe-card-element.js +1 -9
  57. package/dist/components/stripe-card-element2.js +1 -440
  58. package/dist/components/stripe-currency-selector.js +1 -218
  59. package/dist/components/stripe-express-checkout-element.js +1 -332
  60. package/dist/components/stripe-link-authentication-element.js +1 -256
  61. package/dist/components/stripe-modal.js +1 -9
  62. package/dist/components/stripe-modal2.js +1 -112
  63. package/dist/components/stripe-payment-element.js +1 -510
  64. package/dist/components/stripe-payment-request-button.js +1 -9
  65. package/dist/components/stripe-payment-request-button2.js +1 -224
  66. package/dist/components/utils.js +1 -89
  67. package/dist/esm/app-globals-DQuL1Twl.js +0 -3
  68. package/dist/esm/error-XRfh5Wrs.js +0 -3
  69. package/dist/esm/{factory-Drde6-y7.js → factory-VTa1Gc94.js} +216 -77
  70. package/dist/esm/index-C6bbmyga.js +4677 -0
  71. package/dist/esm/{index-BHDCxQOb.js → index-CBXaOfXU.js} +24 -6
  72. package/dist/esm/index.js +0 -1
  73. package/dist/esm/ion-icon.entry.js +22 -13
  74. package/dist/esm/loader.js +3 -4
  75. package/dist/esm/stripe-address-element.entry.js +41 -26
  76. package/dist/esm/stripe-card-element-modal.entry.js +6 -7
  77. package/dist/esm/stripe-card-element_2.entry.js +129 -72
  78. package/dist/esm/stripe-currency-selector.entry.js +20 -10
  79. package/dist/esm/stripe-elements.js +32 -6
  80. package/dist/esm/stripe-express-checkout-element.entry.js +32 -22
  81. package/dist/esm/stripe-link-authentication-element.entry.js +20 -10
  82. package/dist/esm/stripe-payment-element.entry.js +283 -167
  83. package/dist/esm/stripe-payment-request-button.entry.js +27 -15
  84. package/dist/stripe-elements/index.esm.js +0 -2
  85. package/dist/stripe-elements/p-1bd46766.entry.js +1 -0
  86. package/dist/stripe-elements/p-1c6e0a45.entry.js +1 -0
  87. package/dist/stripe-elements/p-3f42ca0c.entry.js +1 -0
  88. package/dist/stripe-elements/p-5cf62945.entry.js +1 -0
  89. package/dist/stripe-elements/p-74de1556.entry.js +1 -0
  90. package/dist/stripe-elements/p-76e57d78.entry.js +1 -0
  91. package/dist/stripe-elements/p-840d499f.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-CrjrbGJ3.js +1 -0
  95. package/dist/stripe-elements/p-DQuL1Twl.js +1 -2
  96. package/dist/stripe-elements/p-XRfh5Wrs.js +1 -2
  97. package/dist/stripe-elements/p-ae0c336e.entry.js +1 -0
  98. package/dist/stripe-elements/p-cfd8e081.entry.js +1 -0
  99. package/dist/stripe-elements/stripe-elements.esm.js +1 -2
  100. package/dist/stripe-elements/svg/.gitignore +4 -0
  101. package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
  102. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +11 -1
  103. package/dist/types/components/stripe-card-element/stripe-card-element.helpers.d.ts +29 -0
  104. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +4 -4
  105. package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
  106. package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +6 -0
  107. package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
  108. package/dist/types/components/stripe-modal/stripe-modal.d.ts +1 -0
  109. package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +20 -2
  110. package/dist/types/components/stripe-payment-element/stripe-payment-element.helpers.d.ts +54 -0
  111. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +14 -1
  112. package/dist/types/components.d.ts +139 -29
  113. package/dist/types/index.d.ts +1 -0
  114. package/dist/types/services/interfaces.d.ts +4 -3
  115. package/dist/types/services/stripe-service.d.ts +8 -4
  116. package/dist/types/stencil-public-runtime.d.ts +110 -5
  117. package/package.json +50 -30
  118. package/readme.md +386 -133
  119. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  120. package/dist/cjs/error-FFC4kSs5.js.map +0 -1
  121. package/dist/cjs/factory-CbbbSvkg.js.map +0 -1
  122. package/dist/cjs/index-BXVW_rzh.js +0 -1932
  123. package/dist/cjs/index-BXVW_rzh.js.map +0 -1
  124. package/dist/cjs/index-Ba1pBePA.js.map +0 -1
  125. package/dist/cjs/index.cjs.js.map +0 -1
  126. package/dist/cjs/ion-icon.entry.cjs.js.map +0 -1
  127. package/dist/cjs/loader.cjs.js.map +0 -1
  128. package/dist/cjs/stripe-address-element.entry.cjs.js.map +0 -1
  129. package/dist/cjs/stripe-card-element-modal.entry.cjs.js.map +0 -1
  130. package/dist/cjs/stripe-card-element.stripe-modal.entry.cjs.js.map +0 -1
  131. package/dist/cjs/stripe-currency-selector.entry.cjs.js.map +0 -1
  132. package/dist/cjs/stripe-elements.cjs.js.map +0 -1
  133. package/dist/cjs/stripe-express-checkout-element.entry.cjs.js.map +0 -1
  134. package/dist/cjs/stripe-link-authentication-element.entry.cjs.js.map +0 -1
  135. package/dist/cjs/stripe-payment-element.entry.cjs.js.map +0 -1
  136. package/dist/cjs/stripe-payment-request-button.entry.cjs.js.map +0 -1
  137. package/dist/collection/components/stripe-address-element/stripe-address-element.js.map +0 -1
  138. package/dist/collection/components/stripe-card-element/stripe-card-element.js.map +0 -1
  139. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js.map +0 -1
  140. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js.map +0 -1
  141. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js.map +0 -1
  142. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js.map +0 -1
  143. package/dist/collection/components/stripe-modal/stripe-modal.js.map +0 -1
  144. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js.map +0 -1
  145. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js.map +0 -1
  146. package/dist/collection/index.js.map +0 -1
  147. package/dist/collection/interfaces.js.map +0 -1
  148. package/dist/collection/services/address-element-manager.js.map +0 -1
  149. package/dist/collection/services/card-element-manager.js.map +0 -1
  150. package/dist/collection/services/currency-selector-element-manager.js.map +0 -1
  151. package/dist/collection/services/express-checkout-element-manager.js.map +0 -1
  152. package/dist/collection/services/factory.js.map +0 -1
  153. package/dist/collection/services/interfaces.js.map +0 -1
  154. package/dist/collection/services/link-authentication-element-manager.js.map +0 -1
  155. package/dist/collection/services/payment-element-manager.js.map +0 -1
  156. package/dist/collection/services/stripe-service.js.map +0 -1
  157. package/dist/collection/utils/element-finder.js.map +0 -1
  158. package/dist/collection/utils/error.js.map +0 -1
  159. package/dist/collection/utils/i18n.js.map +0 -1
  160. package/dist/collection/utils/platform.js.map +0 -1
  161. package/dist/collection/utils/test-setup.js.map +0 -1
  162. package/dist/collection/utils/utils.js.map +0 -1
  163. package/dist/components/error.js.map +0 -1
  164. package/dist/components/factory.js.map +0 -1
  165. package/dist/components/icon.js.map +0 -1
  166. package/dist/components/index.js.map +0 -1
  167. package/dist/components/index2.js.map +0 -1
  168. package/dist/components/ion-icon.js.map +0 -1
  169. package/dist/components/stripe-address-element.js.map +0 -1
  170. package/dist/components/stripe-card-element-modal.js.map +0 -1
  171. package/dist/components/stripe-card-element.js.map +0 -1
  172. package/dist/components/stripe-card-element2.js.map +0 -1
  173. package/dist/components/stripe-currency-selector.js.map +0 -1
  174. package/dist/components/stripe-express-checkout-element.js.map +0 -1
  175. package/dist/components/stripe-link-authentication-element.js.map +0 -1
  176. package/dist/components/stripe-modal.js.map +0 -1
  177. package/dist/components/stripe-modal2.js.map +0 -1
  178. package/dist/components/stripe-payment-element.js.map +0 -1
  179. package/dist/components/stripe-payment-request-button.js.map +0 -1
  180. package/dist/components/stripe-payment-request-button2.js.map +0 -1
  181. package/dist/components/utils.js.map +0 -1
  182. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  183. package/dist/esm/error-XRfh5Wrs.js.map +0 -1
  184. package/dist/esm/factory-Drde6-y7.js.map +0 -1
  185. package/dist/esm/index-BHDCxQOb.js.map +0 -1
  186. package/dist/esm/index-DJwTOfxZ.js +0 -1920
  187. package/dist/esm/index-DJwTOfxZ.js.map +0 -1
  188. package/dist/esm/index.js.map +0 -1
  189. package/dist/esm/ion-icon.entry.js.map +0 -1
  190. package/dist/esm/loader.js.map +0 -1
  191. package/dist/esm/stripe-address-element.entry.js.map +0 -1
  192. package/dist/esm/stripe-card-element-modal.entry.js.map +0 -1
  193. package/dist/esm/stripe-card-element.stripe-modal.entry.js.map +0 -1
  194. package/dist/esm/stripe-currency-selector.entry.js.map +0 -1
  195. package/dist/esm/stripe-elements.js.map +0 -1
  196. package/dist/esm/stripe-express-checkout-element.entry.js.map +0 -1
  197. package/dist/esm/stripe-link-authentication-element.entry.js.map +0 -1
  198. package/dist/esm/stripe-payment-element.entry.js.map +0 -1
  199. package/dist/esm/stripe-payment-request-button.entry.js.map +0 -1
  200. package/dist/stripe-elements/index.esm.js.map +0 -1
  201. package/dist/stripe-elements/ion-icon.entry.esm.js.map +0 -1
  202. package/dist/stripe-elements/loader.esm.js.map +0 -1
  203. package/dist/stripe-elements/p-02f6e421.entry.js +0 -2
  204. package/dist/stripe-elements/p-02f6e421.entry.js.map +0 -1
  205. package/dist/stripe-elements/p-19888fa6.entry.js +0 -2
  206. package/dist/stripe-elements/p-19888fa6.entry.js.map +0 -1
  207. package/dist/stripe-elements/p-4d505729.entry.js +0 -2
  208. package/dist/stripe-elements/p-4d505729.entry.js.map +0 -1
  209. package/dist/stripe-elements/p-7e7ad92a.entry.js +0 -2
  210. package/dist/stripe-elements/p-7e7ad92a.entry.js.map +0 -1
  211. package/dist/stripe-elements/p-8bb4212c.entry.js +0 -2
  212. package/dist/stripe-elements/p-8bb4212c.entry.js.map +0 -1
  213. package/dist/stripe-elements/p-9aee2b6b.entry.js +0 -2
  214. package/dist/stripe-elements/p-9aee2b6b.entry.js.map +0 -1
  215. package/dist/stripe-elements/p-BHDCxQOb.js +0 -2
  216. package/dist/stripe-elements/p-BHDCxQOb.js.map +0 -1
  217. package/dist/stripe-elements/p-DI2vmGaI.js +0 -2
  218. package/dist/stripe-elements/p-DI2vmGaI.js.map +0 -1
  219. package/dist/stripe-elements/p-DJwTOfxZ.js +0 -3
  220. package/dist/stripe-elements/p-DJwTOfxZ.js.map +0 -1
  221. package/dist/stripe-elements/p-DQuL1Twl.js.map +0 -1
  222. package/dist/stripe-elements/p-XRfh5Wrs.js.map +0 -1
  223. package/dist/stripe-elements/p-ba251393.entry.js +0 -2
  224. package/dist/stripe-elements/p-ba251393.entry.js.map +0 -1
  225. package/dist/stripe-elements/p-c649edfc.entry.js +0 -2
  226. package/dist/stripe-elements/p-c649edfc.entry.js.map +0 -1
  227. package/dist/stripe-elements/p-e8bb43ae.entry.js +0 -2
  228. package/dist/stripe-elements/p-e8bb43ae.entry.js.map +0 -1
  229. package/dist/stripe-elements/stripe-address-element.entry.esm.js.map +0 -1
  230. package/dist/stripe-elements/stripe-card-element-modal.entry.esm.js.map +0 -1
  231. package/dist/stripe-elements/stripe-card-element.stripe-modal.entry.esm.js.map +0 -1
  232. package/dist/stripe-elements/stripe-currency-selector.entry.esm.js.map +0 -1
  233. package/dist/stripe-elements/stripe-elements.esm.js.map +0 -1
  234. package/dist/stripe-elements/stripe-express-checkout-element.entry.esm.js.map +0 -1
  235. package/dist/stripe-elements/stripe-link-authentication-element.entry.esm.js.map +0 -1
  236. package/dist/stripe-elements/stripe-payment-element.entry.esm.js.map +0 -1
  237. package/dist/stripe-elements/stripe-payment-request-button.entry.esm.js.map +0 -1
@@ -1,510 +1 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { c as checkPlatform } from './utils.js';
3
- import { s as serviceFactory, i as i18n } from './factory.js';
4
- import { S as StripeAPIError } from './error.js';
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)}";
7
-
8
- const StripePaymentElement$1 = /*@__PURE__*/ proxyCustomElement(class StripePaymentElement extends HTMLElement {
9
- /**
10
- * Get Stripe.js, and initialize elements
11
- * @param publishableKey
12
- * @param options
13
- * @example
14
- * ```
15
- * const stripeElement = document.createElement('stripe-payment-element');
16
- * customElements
17
- * .whenDefined('stripe-payment-element')
18
- * .then(() => {
19
- * stripeElement.initStripe('pk_test_XXXXXXXXX')
20
- * })
21
- * ```
22
- */
23
- async initStripe(publishableKey, options) {
24
- await this.stripeService.initialize(publishableKey, {
25
- stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
26
- applicationName: this.applicationName,
27
- });
28
- // If already successfully loaded, initialize elements immediately
29
- if (this.stripeService.state.loadStripeStatus === 'success') {
30
- await this.initElement();
31
- this.stripeLoadedEventHandler();
32
- }
33
- else {
34
- // Otherwise, wait for successful load
35
- const unsubscribe = this.stripeService.onChange('loadStripeStatus', async (newState) => {
36
- if (newState !== 'success') {
37
- return;
38
- }
39
- await this.initElement();
40
- this.stripeLoadedEventHandler();
41
- unsubscribe(); // Clean up listener after first success
42
- });
43
- }
44
- }
45
- /**
46
- * Get Stripe.js and initialize with Checkout Session mode
47
- * Use this method when you have a Checkout Session client secret instead of Payment/Setup Intent
48
- * @param publishableKey - Your Stripe publishable API key
49
- * @param checkoutSessionClientSecret - The client secret from Checkout Session
50
- * @param options - Optional configuration
51
- * @example
52
- * ```
53
- * const stripeElement = document.createElement('stripe-payment-element');
54
- * customElements
55
- * .whenDefined('stripe-payment-element')
56
- * .then(() => {
57
- * stripeElement.initStripeWithCheckoutSession(
58
- * 'pk_test_XXXXXXXXX',
59
- * 'cs_xxx_secret_xxx'
60
- * )
61
- * })
62
- * ```
63
- */
64
- async initStripeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, options) {
65
- await this.stripeService.initializeWithCheckoutSession(publishableKey, checkoutSessionClientSecret, {
66
- stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
67
- applicationName: this.applicationName,
68
- elementsOptions: options === null || options === void 0 ? void 0 : options.elementsOptions,
69
- });
70
- // If already successfully loaded, initialize elements immediately
71
- if (this.stripeService.state.loadStripeStatus === 'success') {
72
- await this.initElement();
73
- this.stripeLoadedEventHandler();
74
- }
75
- else {
76
- // Otherwise, wait for successful load
77
- const unsubscribe = this.stripeService.onChange('loadStripeStatus', async (newState) => {
78
- if (newState !== 'success') {
79
- return;
80
- }
81
- await this.initElement();
82
- this.stripeLoadedEventHandler();
83
- unsubscribe(); // Clean up listener after first success
84
- });
85
- }
86
- }
87
- /**
88
- * Update the form submit progress
89
- * @param progress
90
- * @returns
91
- * @example
92
- * ```
93
- * const stripeElement = document.createElement('stripe-payment-element');
94
- * customElements
95
- * .whenDefined('stripe-payment-element')
96
- * .then(() => {
97
- * stripeElement.updateProgress('success')
98
- * })
99
- * ```
100
- */
101
- async updateProgress(progress) {
102
- this.progress = progress;
103
- return this;
104
- }
105
- /**
106
- * Set error message
107
- * @param errorMessage string
108
- * @returns
109
- * @example
110
- * ```
111
- * const stripeElement = document.createElement('stripe-payment-element');
112
- * customElements
113
- * .whenDefined('stripe-payment-element')
114
- * .then(() => {
115
- * stripeElement.setErrorMessage('Payment failed')
116
- * })
117
- * ```
118
- */
119
- async setErrorMessage(errorMessage) {
120
- this.paymentElementManager.setError(errorMessage);
121
- return this;
122
- }
123
- updatePublishableKey(publishableKey) {
124
- const options = {};
125
- options.stripeAccount = this.stripeService.state.stripeAccount;
126
- const hasOptionValue = Object.values(options).filter(Boolean).length > 0;
127
- this.initStripe(publishableKey, hasOptionValue ? options : undefined);
128
- }
129
- updateStripeAccountId(stripeAccount) {
130
- this.initStripe(this.stripeService.state.publishableKey, {
131
- stripeAccount: stripeAccount,
132
- });
133
- }
134
- async updateIntentClientSecret() {
135
- // Re-initialize the payment element when client secret changes
136
- if (this.stripeService.state.loadStripeStatus === 'success') {
137
- await this.initElement();
138
- }
139
- }
140
- async updateCheckoutSessionClientSecret(newValue) {
141
- // Re-initialize with checkout session when client secret changes
142
- if (this.publishableKey && newValue) {
143
- await this.initStripeWithCheckoutSession(this.publishableKey, newValue, {
144
- stripeAccount: this.stripeAccount,
145
- });
146
- }
147
- }
148
- stripeLoadedEventHandler() {
149
- const event = {
150
- stripe: this.stripeService.getStripe(),
151
- };
152
- if (this.stripeDidLoaded) {
153
- this.stripeDidLoaded(event);
154
- }
155
- this.stripeLoaded.emit(event);
156
- }
157
- async formSubmitEventHandler() {
158
- const stripe = this.stripeService.getStripe();
159
- const isCheckoutSession = this.stripeService.state.isCheckoutSession;
160
- if (!stripe) {
161
- console.error('Stripe not properly initialized');
162
- return;
163
- }
164
- const eventData = {
165
- 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;
186
- }
187
- this.formSubmit.emit(eventData);
188
- }
189
- async defaultFormSubmitResultHandler(result) {
190
- this.defaultFormSubmitResult.emit(result);
191
- }
192
- async checkoutSessionConfirmResultHandler(result) {
193
- this.checkoutSessionConfirmResult.emit(result);
194
- }
195
- componentWillRender() {
196
- if (!this.stripeService.state.publishableKey) {
197
- return;
198
- }
199
- if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
200
- return;
201
- }
202
- this.initStripe(this.stripeService.state.publishableKey, {
203
- stripeAccount: this.stripeService.state.stripeAccount,
204
- });
205
- }
206
- /**
207
- * Default form submit action for Payment Intent / Setup Intent mode
208
- * Calls confirmPayment or confirmSetup based on intentType
209
- * If you don't want use it, please set `should-use-default-form-submit-action="false"`
210
- * @param event
211
- * @param param1
212
- */
213
- async defaultFormSubmitAction(event, { stripe, elements }) {
214
- event.preventDefault();
215
- try {
216
- const { intentType } = this;
217
- // Get current page URL for return_url
218
- 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
- }
240
- this.defaultFormSubmitResultHandler(result);
241
- }
242
- catch (e) {
243
- console.error(e);
244
- this.defaultFormSubmitResultHandler(e);
245
- throw e;
246
- }
247
- }
248
- /**
249
- * Checkout Session form submit action
250
- * Uses checkout.loadActions().confirm() to confirm the payment
251
- * @param event
252
- * @param checkout - The Stripe Checkout instance
253
- */
254
- async checkoutSessionFormSubmitAction(event, checkout) {
255
- var _a;
256
- event.preventDefault();
257
- 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
- // Get current page URL for return_url
271
- 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
- }
287
- this.checkoutSessionConfirmResultHandler(result);
288
- }
289
- catch (e) {
290
- console.error(e);
291
- this.checkoutSessionConfirmResultHandler(e instanceof Error ? e : new Error(String(e)));
292
- throw e;
293
- }
294
- }
295
- constructor(registerHost) {
296
- super();
297
- if (registerHost !== false) {
298
- this.__registerHost();
299
- }
300
- this.stripeLoaded = createEvent(this, "stripeLoaded", 7);
301
- this.formSubmit = createEvent(this, "formSubmit", 7);
302
- this.defaultFormSubmitResult = createEvent(this, "defaultFormSubmitResult", 7);
303
- this.checkoutSessionConfirmResult = createEvent(this, "checkoutSessionConfirmResult", 7);
304
- /**
305
- * Default submit handle type.
306
- * If you want to use `setupIntent`, should update this attribute.
307
- */
308
- this.intentType = 'payment';
309
- /**
310
- * Payment sheet title
311
- * By default we recommended to use these string
312
- * - 'Add your payment information' -> PaymentSheet / PaymentFlow(Android)
313
- * - 'Add a card' -> PaymentFlow(iOS)
314
- * These strings will translated automatically by this library.
315
- */
316
- this.sheetTitle = 'Add your payment information';
317
- /**
318
- * Submit button label
319
- * By default we recommended to use these string
320
- * - 'Pay' -> PaymentSheet
321
- * - 'Add' -> PaymentFlow(Android)
322
- * - 'Add card' -> PaymentFlow(iOS)
323
- * - 'Add a card' -> PaymentFlow(iOS)
324
- * These strings will translated automatically by this library.
325
- */
326
- this.buttonLabel = 'Pay';
327
- /**
328
- * The progress status of the checkout process
329
- */
330
- this.progress = '';
331
- /**
332
- * Overwrite the application name that registered
333
- * For wrapper library (like Capacitor)
334
- */
335
- this.applicationName = 'stripe-pwa-elements';
336
- /**
337
- * The component will provide a function to call the `stripe.confirmPayment` API.
338
- * If you want to customize the behavior, should set false.
339
- * And listen the 'formSubmit' event on the element
340
- */
341
- this.shouldUseDefaultFormSubmitAction = true;
342
- // Dependency Injection via factory
343
- this.stripeService = serviceFactory.createStripeService();
344
- this.paymentElementManager = serviceFactory.createPaymentElementManager(this.stripeService);
345
- if (this.publishableKey) {
346
- this.initStripe(this.publishableKey, {
347
- stripeAccount: this.stripeAccount,
348
- });
349
- }
350
- }
351
- /**
352
- * Initialize Component using Stripe Element
353
- */
354
- async initElement() {
355
- // Initialize payment element
356
- await this.paymentElementManager.initialize(this.el);
357
- // Add form submit listener scoped to this component instance
358
- const formElement = this.el.querySelector('#stripe-payment-element');
359
- if (!formElement) {
360
- console.error('Form element #stripe-payment-element not found');
361
- return;
362
- }
363
- // Remove existing listener if present to prevent duplicates
364
- if (this._submitHandler) {
365
- formElement.removeEventListener('submit', this._submitHandler);
366
- }
367
- // Create and store the submit handler
368
- this._submitHandler = async (e) => {
369
- const stripe = this.stripeService.getStripe();
370
- const isCheckoutSession = this.stripeService.state.isCheckoutSession;
371
- if (!stripe) {
372
- console.error('Stripe not properly initialized');
373
- return;
374
- }
375
- // Build submit event props based on mode
376
- const submitEventProps = {
377
- stripe,
378
- };
379
- if (isCheckoutSession) {
380
- // Checkout Session mode
381
- const checkout = this.stripeService.getCheckout();
382
- if (!checkout) {
383
- console.error('Checkout not properly initialized');
384
- return;
385
- }
386
- submitEventProps.checkout = checkout;
387
- submitEventProps.checkoutSessionClientSecret = this.checkoutSessionClientSecret;
388
- }
389
- else {
390
- // Payment Intent / Setup Intent mode
391
- const elements = this.stripeService.getElements();
392
- if (!elements) {
393
- console.error('Elements not properly initialized');
394
- return;
395
- }
396
- submitEventProps.elements = elements;
397
- submitEventProps.intentClientSecret = this.intentClientSecret;
398
- }
399
- this.progress = 'loading';
400
- try {
401
- if (this.handleSubmit) {
402
- await this.handleSubmit(e, submitEventProps);
403
- }
404
- else if (this.shouldUseDefaultFormSubmitAction === true) {
405
- if (isCheckoutSession && submitEventProps.checkout) {
406
- // Use Checkout Session confirmation
407
- await this.checkoutSessionFormSubmitAction(e, submitEventProps.checkout);
408
- }
409
- else if (this.intentClientSecret) {
410
- // Use Payment Intent / Setup Intent confirmation
411
- await this.defaultFormSubmitAction(e, submitEventProps);
412
- }
413
- else {
414
- e.preventDefault();
415
- }
416
- }
417
- else {
418
- e.preventDefault();
419
- }
420
- await this.formSubmitEventHandler();
421
- if (this.handleSubmit || this.shouldUseDefaultFormSubmitAction === true) {
422
- this.progress = 'success';
423
- }
424
- }
425
- catch (err) {
426
- const errorMessage = err instanceof Error ? err.message : String(err);
427
- this.paymentElementManager.setError(errorMessage);
428
- this.progress = 'failure';
429
- }
430
- };
431
- formElement.addEventListener('submit', this._submitHandler);
432
- }
433
- componentDidLoad() {
434
- this.el.classList.add(checkPlatform());
435
- }
436
- disconnectedCallback() {
437
- this.paymentElementManager.unmount();
438
- // Remove event listener to prevent memory leaks
439
- if (this._submitHandler) {
440
- const formElement = this.el.querySelector('#stripe-payment-element');
441
- if (formElement) {
442
- formElement.removeEventListener('submit', this._submitHandler);
443
- }
444
- }
445
- }
446
- render() {
447
- const { loadStripeStatus, isCheckoutSession } = this.stripeService.state;
448
- const { errorMessage } = this.paymentElementManager.getState();
449
- if (loadStripeStatus === 'failure') {
450
- return h("p", null, i18n.t('Failed to load Stripe'));
451
- }
452
- // Determine if button should be disabled
453
- // For Checkout Session mode: check if checkout is initialized (loadStripeStatus === 'success')
454
- // For Payment Intent mode: check if intentClientSecret is set
455
- const hasValidSecret = isCheckoutSession ? loadStripeStatus === 'success' : !!this.intentClientSecret;
456
- const disabled = this.progress === 'loading' || !hasValidSecret;
457
- 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))))));
458
- }
459
- get el() { return this; }
460
- static get watchers() { return {
461
- "publishableKey": ["updatePublishableKey"],
462
- "stripeAccount": ["updateStripeAccountId"],
463
- "intentClientSecret": ["updateIntentClientSecret"],
464
- "checkoutSessionClientSecret": ["updateCheckoutSessionClientSecret"]
465
- }; }
466
- static get style() { return stripePaymentElementCss; }
467
- }, [256, "stripe-payment-element", {
468
- "intentType": [1, "intent-type"],
469
- "sheetTitle": [1, "sheet-title"],
470
- "buttonLabel": [1, "button-label"],
471
- "publishableKey": [1, "publishable-key"],
472
- "stripeAccount": [1, "stripe-account"],
473
- "applicationName": [1, "application-name"],
474
- "intentClientSecret": [1, "intent-client-secret"],
475
- "checkoutSessionClientSecret": [1, "checkout-session-client-secret"],
476
- "shouldUseDefaultFormSubmitAction": [4, "should-use-default-form-submit-action"],
477
- "handleSubmit": [1040],
478
- "stripeDidLoaded": [1040],
479
- "progress": [32],
480
- "initStripe": [64],
481
- "initStripeWithCheckoutSession": [64],
482
- "updateProgress": [64],
483
- "setErrorMessage": [64]
484
- }, undefined, {
485
- "publishableKey": ["updatePublishableKey"],
486
- "stripeAccount": ["updateStripeAccountId"],
487
- "intentClientSecret": ["updateIntentClientSecret"],
488
- "checkoutSessionClientSecret": ["updateCheckoutSessionClientSecret"]
489
- }]);
490
- function defineCustomElement$1() {
491
- if (typeof customElements === "undefined") {
492
- return;
493
- }
494
- const components = ["stripe-payment-element"];
495
- components.forEach(tagName => { switch (tagName) {
496
- case "stripe-payment-element":
497
- if (!customElements.get(tagName)) {
498
- customElements.define(tagName, StripePaymentElement$1);
499
- }
500
- break;
501
- } });
502
- }
503
-
504
- const StripePaymentElement = StripePaymentElement$1;
505
- const defineCustomElement = defineCustomElement$1;
506
-
507
- export { StripePaymentElement, defineCustomElement };
508
- //# sourceMappingURL=stripe-payment-element.js.map
509
-
510
- //# sourceMappingURL=stripe-payment-element.js.map
1
+ import{transformTag as t,proxyCustomElement as e,HTMLElement as i,createEvent as s,h as n}from"@stencil/core/internal/client";import{c as r}from"./utils.js";import{s as o,i as a}from"./factory.js";import{S as c}from"./error.js";const l=t=>{const{stripe:e,isCheckoutSession:i,checkout:s,checkoutSessionClientSecret:n,elements:r,intentClientSecret:o}=t,a={stripe:e};return i?null==s?{error:"Checkout not properly initialized"}:(a.checkout=s,a.checkoutSessionClientSecret=n,{props:a}):null==r?{error:"Elements not properly initialized"}:(a.elements=r,a.intentClientSecret=o,{props:a})},h=e(class extends i{async initStripe(t,e){const i=++this.initGeneration;await this.stripeService.initialize(t,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName,clientSecret:this.intentClientSecret}),await this.mountWhenLoaded(i)}async initStripeWithCheckoutSession(t,e,i){const s=++this.initGeneration;await this.stripeService.initializeWithCheckoutSession(t,e,{stripeAccount:null==i?void 0:i.stripeAccount,applicationName:this.applicationName,elementsOptions:null==i?void 0:i.elementsOptions}),await this.mountWhenLoaded(s)}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.paymentElementManager.setError(t),this}updatePublishableKey(t){const e={};e.stripeAccount=this.stripeService.state.stripeAccount;const i=Object.values(e).filter((t=>null!=t&&""!==t)).length>0;this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(t,this.checkoutSessionClientSecret,{stripeAccount:e.stripeAccount}):this.initStripe(t,i?e:void 0)}updateStripeAccountId(t){this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:t}):this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:t})}async updateIntentClientSecret(){if(null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret)return;const{publishableKey:t,stripeAccount:e}=this.stripeService.state;null!=t&&""!==t&&await this.initStripe(t,{stripeAccount:e})}async updateCheckoutSessionClientSecret(t){null!=this.publishableKey&&""!==this.publishableKey&&null!=t&&""!==t&&await this.initStripeWithCheckoutSession(this.publishableKey,t,{stripeAccount:this.stripeAccount})}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=this.stripeService.getStripe(),e=!0===this.stripeService.state.isCheckoutSession;if(null==t)return void console.error("Stripe not properly initialized");const i=l({stripe:t,isCheckoutSession:e,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});"error"in i?console.error(i.error):this.formSubmit.emit(i.props)}async defaultFormSubmitResultHandler(t){this.defaultFormSubmitResult.emit(t)}async checkoutSessionConfirmResultHandler(t){this.checkoutSessionConfirmResult.emit(t)}componentWillRender(){const{publishableKey:t}=this.stripeService.state;null!=t&&""!==t&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}):this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeService.state.stripeAccount})))}async defaultFormSubmitAction(t,{stripe:e,elements:i}){t.preventDefault();try{const t=window.location.href,s=await(async(t,e,i,s)=>{const n=await("payment"===i?t.confirmPayment({elements:e,confirmParams:{return_url:s},redirect:"if_required"}):t.confirmSetup({elements:e,confirmParams:{return_url:s},redirect:"if_required"}));if(n.error)throw new c(n.error);return n})(e,i,this.intentType,t);this.defaultFormSubmitResultHandler(s)}catch(t){throw console.error(t),this.defaultFormSubmitResultHandler(t),t}}async checkoutSessionFormSubmitAction(t,e){t.preventDefault();try{const t=window.location.href,i=await(async(t,e)=>{var i;const s=await t.loadActions();if("error"===s.type)throw new c({type:"api_error",code:s.error.code||"checkout_session_error",message:s.error.message});const{actions:n}=s,r=await n.confirm({returnUrl:e,redirect:"if_required"});if("error"===r.type){const t={type:"card_error",code:r.error.code||"payment_failed",message:r.error.message,decline_code:"paymentFailed"===r.error.code?null===(i=r.error.paymentFailed)||void 0===i?void 0:i.declineCode:void 0};throw new c(t)}return r})(e,t);this.checkoutSessionConfirmResultHandler(i)}catch(t){throw console.error(t),this.checkoutSessionConfirmResultHandler(t instanceof Error?t:Error(t+"")),t}}constructor(t){super(),!1!==t&&this.__registerHost(),this.stripeLoaded=s(this,"stripeLoaded",7),this.formSubmit=s(this,"formSubmit",7),this.defaultFormSubmitResult=s(this,"defaultFormSubmitResult",7),this.checkoutSessionConfirmResult=s(this,"checkoutSessionConfirmResult",7),this.initGeneration=0,this.intentType="payment",this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.progress="",this.applicationName="stripe-pwa-elements",this.shouldUseDefaultFormSubmitAction=!0,this.stripeService=o.createStripeService(),this.paymentElementManager=o.createPaymentElementManager(this.stripeService)}componentWillLoad(){this.startStripe()}async mountWhenLoaded(t){if(t!==this.initGeneration)return;if("success"===this.stripeService.state.loadStripeStatus){if(await this.initElement(),t!==this.initGeneration)return;return void this.stripeLoadedEventHandler()}const e=this.stripeService.onChange("loadStripeStatus",(async i=>{t===this.initGeneration?"success"===i&&(await this.initElement(),t===this.initGeneration?(this.stripeLoadedEventHandler(),e()):e()):e()}))}hasCheckoutSessionClientSecret(){return null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret}startStripe(){null!=this.publishableKey&&""!==this.publishableKey&&(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount}):this.initStripeWithCheckoutSession(this.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeAccount}))}async initElement(){await this.paymentElementManager.initialize(this.el);const t=this.el.querySelector("#stripe-payment-element");null!=t?(null!=this._submitHandler&&t.removeEventListener("submit",this._submitHandler),this._submitHandler=async t=>{const e=this.stripeService.getStripe(),i=!0===this.stripeService.state.isCheckoutSession;if(null==e)return void console.error("Stripe not properly initialized");const s=l({stripe:e,isCheckoutSession:i,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});if("error"in s)return void console.error(s.error);const n=s.props;this.progress="loading";try{null!=this.handleSubmit?await this.handleSubmit(t,n):!0===this.shouldUseDefaultFormSubmitAction?i&&null!=n.checkout?await this.checkoutSessionFormSubmitAction(t,n.checkout):null!=this.intentClientSecret&&""!==this.intentClientSecret?await this.defaultFormSubmitAction(t,n):t.preventDefault():t.preventDefault(),await this.formSubmitEventHandler(),null==this.handleSubmit&&!0!==this.shouldUseDefaultFormSubmitAction||(this.progress="success")}catch(t){this.paymentElementManager.setError(t instanceof Error?t.message:t+""),this.progress="failure"}},t.addEventListener("submit",this._submitHandler)):console.error("Form element #stripe-payment-element not found")}componentDidLoad(){this.el.classList.add(r())}disconnectedCallback(){if(this.paymentElementManager.unmount(),null!=this._submitHandler){const t=this.el.querySelector("#stripe-payment-element");null!=t&&t.removeEventListener("submit",this._submitHandler)}}render(){const{loadStripeStatus:t,isCheckoutSession:e}=this.stripeService.state,{errorMessage:i}=this.paymentElementManager.getState();if("failure"===t)return n("p",null,a.t("Failed to load Stripe"));const s=(t=>{const{progress:e,isCheckoutSession:i,loadStripeStatus:s,intentClientSecret:n}=t;return"loading"===e||!(i?"success"===s:null!=n&&""!==n)})({progress:this.progress,isCheckoutSession:!0===e,loadStripeStatus:t,intentClientSecret:this.intentClientSecret});return n("div",{class:"stripe-payment-sheet-wrap"},n("form",{id:"stripe-payment-element"},n("div",{class:"stripe-heading"},a.t(this.sheetTitle)),n("div",null,n("div",{class:"stripe-section-title"},a.t("Payment information"))),n("div",{class:"payment-info visible"},n("div",{id:"payment-element"})),n("div",{id:"payment-errors",class:"stripe-element-errors"},i),n("div",{style:{marginTop:"32px"}},n("button",{type:"submit",disabled:s},a.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return this}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}}static get style(){return':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)}'}},[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]},void 0,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}]);function p(){"undefined"!=typeof customElements&&["stripe-payment-element"].forEach((e=>{"stripe-payment-element"===e&&(customElements.get(t(e))||customElements.define(t(e),h))}))}p();const u=h,d=p;export{u as StripePaymentElement,d as defineCustomElement}
@@ -1,9 +1 @@
1
- import { S as StripePaymentRequestButton$1, d as defineCustomElement$1 } from './stripe-payment-request-button2.js';
2
-
3
- const StripePaymentRequestButton = StripePaymentRequestButton$1;
4
- const defineCustomElement = defineCustomElement$1;
5
-
6
- export { StripePaymentRequestButton, defineCustomElement };
7
- //# sourceMappingURL=stripe-payment-request-button.js.map
8
-
9
- //# sourceMappingURL=stripe-payment-request-button.js.map
1
+ import{S as t,d as s}from"./stripe-payment-request-button2.js";const e=t,o=s;export{e as StripePaymentRequestButton,o as defineCustomElement}