stripe-pwa-elements 3.2.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 (232) 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-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 +106 -67
  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.js +15 -11
  23. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +10 -6
  24. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +28 -20
  25. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +12 -7
  26. package/dist/collection/components/stripe-modal/stripe-modal.js +0 -1
  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 +69 -126
  29. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +34 -12
  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 +5 -6
  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-DeqoYLf_.js} +194 -73
  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 +34 -26
  76. package/dist/esm/stripe-card-element-modal.entry.js +6 -7
  77. package/dist/esm/stripe-card-element_2.entry.js +106 -67
  78. package/dist/esm/stripe-currency-selector.entry.js +13 -10
  79. package/dist/esm/stripe-elements.js +32 -6
  80. package/dist/esm/stripe-express-checkout-element.entry.js +25 -22
  81. package/dist/esm/stripe-link-authentication-element.entry.js +13 -10
  82. package/dist/esm/stripe-payment-element.entry.js +190 -131
  83. package/dist/esm/stripe-payment-request-button.entry.js +12 -7
  84. package/dist/stripe-elements/index.esm.js +0 -2
  85. package/dist/stripe-elements/p--sA2m1ad.js +1 -0
  86. package/dist/stripe-elements/p-38e7b187.entry.js +1 -0
  87. package/dist/stripe-elements/p-44495284.entry.js +1 -0
  88. package/dist/stripe-elements/p-4ba675fa.entry.js +1 -0
  89. package/dist/stripe-elements/p-5cf62945.entry.js +1 -0
  90. package/dist/stripe-elements/p-C6bbmyga.js +2 -0
  91. package/dist/stripe-elements/p-CBXaOfXU.js +1 -0
  92. package/dist/stripe-elements/p-DQuL1Twl.js +1 -2
  93. package/dist/stripe-elements/p-XRfh5Wrs.js +1 -2
  94. package/dist/stripe-elements/p-c24ae181.entry.js +1 -0
  95. package/dist/stripe-elements/p-d9e86451.entry.js +1 -0
  96. package/dist/stripe-elements/p-f09c86a0.entry.js +1 -0
  97. package/dist/stripe-elements/p-f64f394d.entry.js +1 -0
  98. package/dist/stripe-elements/p-f6d2425e.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-card-element/stripe-card-element.d.ts +5 -1
  102. package/dist/types/components/stripe-card-element/stripe-card-element.helpers.d.ts +29 -0
  103. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +4 -4
  104. package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +2 -2
  105. package/dist/types/components/stripe-payment-element/stripe-payment-element.helpers.d.ts +54 -0
  106. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +8 -0
  107. package/dist/types/components.d.ts +139 -29
  108. package/dist/types/index.d.ts +1 -0
  109. package/dist/types/services/interfaces.d.ts +3 -3
  110. package/dist/types/services/stripe-service.d.ts +2 -2
  111. package/dist/types/stencil-public-runtime.d.ts +110 -5
  112. package/package.json +50 -30
  113. package/readme.md +386 -133
  114. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
  115. package/dist/cjs/error-FFC4kSs5.js.map +0 -1
  116. package/dist/cjs/factory-CbbbSvkg.js.map +0 -1
  117. package/dist/cjs/index-BXVW_rzh.js +0 -1932
  118. package/dist/cjs/index-BXVW_rzh.js.map +0 -1
  119. package/dist/cjs/index-Ba1pBePA.js.map +0 -1
  120. package/dist/cjs/index.cjs.js.map +0 -1
  121. package/dist/cjs/ion-icon.entry.cjs.js.map +0 -1
  122. package/dist/cjs/loader.cjs.js.map +0 -1
  123. package/dist/cjs/stripe-address-element.entry.cjs.js.map +0 -1
  124. package/dist/cjs/stripe-card-element-modal.entry.cjs.js.map +0 -1
  125. package/dist/cjs/stripe-card-element.stripe-modal.entry.cjs.js.map +0 -1
  126. package/dist/cjs/stripe-currency-selector.entry.cjs.js.map +0 -1
  127. package/dist/cjs/stripe-elements.cjs.js.map +0 -1
  128. package/dist/cjs/stripe-express-checkout-element.entry.cjs.js.map +0 -1
  129. package/dist/cjs/stripe-link-authentication-element.entry.cjs.js.map +0 -1
  130. package/dist/cjs/stripe-payment-element.entry.cjs.js.map +0 -1
  131. package/dist/cjs/stripe-payment-request-button.entry.cjs.js.map +0 -1
  132. package/dist/collection/components/stripe-address-element/stripe-address-element.js.map +0 -1
  133. package/dist/collection/components/stripe-card-element/stripe-card-element.js.map +0 -1
  134. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js.map +0 -1
  135. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js.map +0 -1
  136. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js.map +0 -1
  137. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js.map +0 -1
  138. package/dist/collection/components/stripe-modal/stripe-modal.js.map +0 -1
  139. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js.map +0 -1
  140. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js.map +0 -1
  141. package/dist/collection/index.js.map +0 -1
  142. package/dist/collection/interfaces.js.map +0 -1
  143. package/dist/collection/services/address-element-manager.js.map +0 -1
  144. package/dist/collection/services/card-element-manager.js.map +0 -1
  145. package/dist/collection/services/currency-selector-element-manager.js.map +0 -1
  146. package/dist/collection/services/express-checkout-element-manager.js.map +0 -1
  147. package/dist/collection/services/factory.js.map +0 -1
  148. package/dist/collection/services/interfaces.js.map +0 -1
  149. package/dist/collection/services/link-authentication-element-manager.js.map +0 -1
  150. package/dist/collection/services/payment-element-manager.js.map +0 -1
  151. package/dist/collection/services/stripe-service.js.map +0 -1
  152. package/dist/collection/utils/element-finder.js.map +0 -1
  153. package/dist/collection/utils/error.js.map +0 -1
  154. package/dist/collection/utils/i18n.js.map +0 -1
  155. package/dist/collection/utils/platform.js.map +0 -1
  156. package/dist/collection/utils/test-setup.js.map +0 -1
  157. package/dist/collection/utils/utils.js.map +0 -1
  158. package/dist/components/error.js.map +0 -1
  159. package/dist/components/factory.js.map +0 -1
  160. package/dist/components/icon.js.map +0 -1
  161. package/dist/components/index.js.map +0 -1
  162. package/dist/components/index2.js.map +0 -1
  163. package/dist/components/ion-icon.js.map +0 -1
  164. package/dist/components/stripe-address-element.js.map +0 -1
  165. package/dist/components/stripe-card-element-modal.js.map +0 -1
  166. package/dist/components/stripe-card-element.js.map +0 -1
  167. package/dist/components/stripe-card-element2.js.map +0 -1
  168. package/dist/components/stripe-currency-selector.js.map +0 -1
  169. package/dist/components/stripe-express-checkout-element.js.map +0 -1
  170. package/dist/components/stripe-link-authentication-element.js.map +0 -1
  171. package/dist/components/stripe-modal.js.map +0 -1
  172. package/dist/components/stripe-modal2.js.map +0 -1
  173. package/dist/components/stripe-payment-element.js.map +0 -1
  174. package/dist/components/stripe-payment-request-button.js.map +0 -1
  175. package/dist/components/stripe-payment-request-button2.js.map +0 -1
  176. package/dist/components/utils.js.map +0 -1
  177. package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
  178. package/dist/esm/error-XRfh5Wrs.js.map +0 -1
  179. package/dist/esm/factory-Drde6-y7.js.map +0 -1
  180. package/dist/esm/index-BHDCxQOb.js.map +0 -1
  181. package/dist/esm/index-DJwTOfxZ.js +0 -1920
  182. package/dist/esm/index-DJwTOfxZ.js.map +0 -1
  183. package/dist/esm/index.js.map +0 -1
  184. package/dist/esm/ion-icon.entry.js.map +0 -1
  185. package/dist/esm/loader.js.map +0 -1
  186. package/dist/esm/stripe-address-element.entry.js.map +0 -1
  187. package/dist/esm/stripe-card-element-modal.entry.js.map +0 -1
  188. package/dist/esm/stripe-card-element.stripe-modal.entry.js.map +0 -1
  189. package/dist/esm/stripe-currency-selector.entry.js.map +0 -1
  190. package/dist/esm/stripe-elements.js.map +0 -1
  191. package/dist/esm/stripe-express-checkout-element.entry.js.map +0 -1
  192. package/dist/esm/stripe-link-authentication-element.entry.js.map +0 -1
  193. package/dist/esm/stripe-payment-element.entry.js.map +0 -1
  194. package/dist/esm/stripe-payment-request-button.entry.js.map +0 -1
  195. package/dist/stripe-elements/index.esm.js.map +0 -1
  196. package/dist/stripe-elements/ion-icon.entry.esm.js.map +0 -1
  197. package/dist/stripe-elements/loader.esm.js.map +0 -1
  198. package/dist/stripe-elements/p-02f6e421.entry.js +0 -2
  199. package/dist/stripe-elements/p-02f6e421.entry.js.map +0 -1
  200. package/dist/stripe-elements/p-19888fa6.entry.js +0 -2
  201. package/dist/stripe-elements/p-19888fa6.entry.js.map +0 -1
  202. package/dist/stripe-elements/p-4d505729.entry.js +0 -2
  203. package/dist/stripe-elements/p-4d505729.entry.js.map +0 -1
  204. package/dist/stripe-elements/p-7e7ad92a.entry.js +0 -2
  205. package/dist/stripe-elements/p-7e7ad92a.entry.js.map +0 -1
  206. package/dist/stripe-elements/p-8bb4212c.entry.js +0 -2
  207. package/dist/stripe-elements/p-8bb4212c.entry.js.map +0 -1
  208. package/dist/stripe-elements/p-9aee2b6b.entry.js +0 -2
  209. package/dist/stripe-elements/p-9aee2b6b.entry.js.map +0 -1
  210. package/dist/stripe-elements/p-BHDCxQOb.js +0 -2
  211. package/dist/stripe-elements/p-BHDCxQOb.js.map +0 -1
  212. package/dist/stripe-elements/p-DI2vmGaI.js +0 -2
  213. package/dist/stripe-elements/p-DI2vmGaI.js.map +0 -1
  214. package/dist/stripe-elements/p-DJwTOfxZ.js +0 -3
  215. package/dist/stripe-elements/p-DJwTOfxZ.js.map +0 -1
  216. package/dist/stripe-elements/p-DQuL1Twl.js.map +0 -1
  217. package/dist/stripe-elements/p-XRfh5Wrs.js.map +0 -1
  218. package/dist/stripe-elements/p-ba251393.entry.js +0 -2
  219. package/dist/stripe-elements/p-ba251393.entry.js.map +0 -1
  220. package/dist/stripe-elements/p-c649edfc.entry.js +0 -2
  221. package/dist/stripe-elements/p-c649edfc.entry.js.map +0 -1
  222. package/dist/stripe-elements/p-e8bb43ae.entry.js +0 -2
  223. package/dist/stripe-elements/p-e8bb43ae.entry.js.map +0 -1
  224. package/dist/stripe-elements/stripe-address-element.entry.esm.js.map +0 -1
  225. package/dist/stripe-elements/stripe-card-element-modal.entry.esm.js.map +0 -1
  226. package/dist/stripe-elements/stripe-card-element.stripe-modal.entry.esm.js.map +0 -1
  227. package/dist/stripe-elements/stripe-currency-selector.entry.esm.js.map +0 -1
  228. package/dist/stripe-elements/stripe-elements.esm.js.map +0 -1
  229. package/dist/stripe-elements/stripe-express-checkout-element.entry.esm.js.map +0 -1
  230. package/dist/stripe-elements/stripe-link-authentication-element.entry.esm.js.map +0 -1
  231. package/dist/stripe-elements/stripe-payment-element.entry.esm.js.map +0 -1
  232. package/dist/stripe-elements/stripe-payment-request-button.entry.esm.js.map +0 -1
@@ -98,22 +98,23 @@ export class StripeAddressElement {
98
98
  */
99
99
  async getValue() {
100
100
  const addressElement = this.addressElementManager.getElement();
101
- if (!addressElement) {
101
+ if (addressElement == null) {
102
102
  throw new Error('Address element not initialized');
103
103
  }
104
- const result = await addressElement.getValue();
104
+ // Dahlia defaults to Latin; preserve the component's browser-localized values.
105
+ const result = await addressElement.getValue({ format: 'localized' });
105
106
  return result;
106
107
  }
107
108
  updatePublishableKey(publishableKey) {
108
109
  const options = {};
109
- if (this.stripeAccount) {
110
+ if (this.stripeAccount != null && this.stripeAccount !== '') {
110
111
  options.stripeAccount = this.stripeAccount;
111
112
  }
112
- this.initStripe(publishableKey, Object.keys(options).length ? options : undefined);
113
+ this.initStripe(publishableKey, Object.keys(options).length > 0 ? options : undefined);
113
114
  }
114
115
  updateStripeAccountId(stripeAccount) {
115
116
  const publishableKey = this.stripeService.state.publishableKey || this.publishableKey;
116
- if (!publishableKey) {
117
+ if (publishableKey == null || publishableKey === '') {
117
118
  return;
118
119
  }
119
120
  this.initStripe(publishableKey, {
@@ -124,7 +125,7 @@ export class StripeAddressElement {
124
125
  const event = {
125
126
  stripe: this.stripeService.getStripe(),
126
127
  };
127
- if (this.stripeDidLoaded) {
128
+ if (this.stripeDidLoaded != null) {
128
129
  this.stripeDidLoaded(event);
129
130
  }
130
131
  this.stripeLoaded.emit(event);
@@ -136,7 +137,7 @@ export class StripeAddressElement {
136
137
  });
137
138
  }
138
139
  componentWillRender() {
139
- if (!this.stripeService.state.publishableKey) {
140
+ if (this.stripeService.state.publishableKey == null || this.stripeService.state.publishableKey === '') {
140
141
  return;
141
142
  }
142
143
  if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
@@ -183,7 +184,7 @@ export class StripeAddressElement {
183
184
  // Dependency Injection via factory
184
185
  this.stripeService = serviceFactory.createStripeService();
185
186
  this.addressElementManager = serviceFactory.createAddressElementManager(this.stripeService);
186
- if (this.publishableKey) {
187
+ if (this.publishableKey != null && this.publishableKey !== '') {
187
188
  this.initStripe(this.publishableKey, {
188
189
  stripeAccount: this.stripeAccount,
189
190
  });
@@ -197,7 +198,7 @@ export class StripeAddressElement {
197
198
  const addressOptions = {
198
199
  mode: this.mode,
199
200
  };
200
- if (this.defaultCountry) {
201
+ if (this.defaultCountry != null && this.defaultCountry !== '') {
201
202
  addressOptions.defaultValues = {
202
203
  address: {
203
204
  country: this.defaultCountry,
@@ -211,30 +212,30 @@ export class StripeAddressElement {
211
212
  await this.addressElementManager.initialize(this.el, addressOptions);
212
213
  // Add form submit listener scoped to this component instance
213
214
  const formElement = this.el.querySelector('#stripe-address-element-form');
214
- if (!formElement) {
215
+ if (formElement == null) {
215
216
  console.error('Form element #stripe-address-element-form not found');
216
217
  return;
217
218
  }
218
219
  // Remove previous listener if it exists to prevent duplicate submissions
219
- if (this.formSubmitListener) {
220
+ if (this.formSubmitListener != null) {
220
221
  formElement.removeEventListener('submit', this.formSubmitListener);
221
222
  }
222
223
  // Create and store the listener
223
224
  this.formSubmitListener = async (e) => {
224
225
  e.preventDefault();
225
226
  const addressElement = this.addressElementManager.getElement();
226
- if (!addressElement) {
227
+ if (addressElement == null) {
227
228
  console.error('Address element not initialized');
228
229
  return;
229
230
  }
230
231
  this.progress = 'loading';
231
232
  try {
232
233
  const addressValue = await this.getValue();
233
- if (this.handleSubmit) {
234
+ if (this.handleSubmit != null) {
234
235
  await this.handleSubmit(e, { address: addressValue });
235
236
  }
236
237
  await this.formSubmitEventHandler();
237
- if (this.handleSubmit) {
238
+ if (this.handleSubmit != null) {
238
239
  this.progress = 'success';
239
240
  }
240
241
  }
@@ -251,9 +252,9 @@ export class StripeAddressElement {
251
252
  }
252
253
  disconnectedCallback() {
253
254
  // Remove form submit listener
254
- if (this.formSubmitListener) {
255
+ if (this.formSubmitListener != null) {
255
256
  const formElement = this.el.querySelector('#stripe-address-element-form');
256
- if (formElement) {
257
+ if (formElement != null) {
257
258
  formElement.removeEventListener('submit', this.formSubmitListener);
258
259
  }
259
260
  this.formSubmitListener = undefined;
@@ -267,6 +268,10 @@ export class StripeAddressElement {
267
268
  return h("p", null, i18n.t('Failed to load Stripe'));
268
269
  }
269
270
  const disabled = this.progress === 'loading';
271
+ // NOTE: `stripe-payment-sheet-wrap` below is a legacy CSS class kept for backward
272
+ // compatibility (leftover from a former component name). It is part of the public
273
+ // DOM contract — consumers may target it in their own stylesheets — so it must
274
+ // remain in the rendered output. Do not remove it.
270
275
  return (h("div", { class: "stripe-payment-sheet-wrap" }, h("form", { id: "stripe-address-element-form" }, h("div", { class: "stripe-heading" }, i18n.t(this.sheetTitle)), h("div", { class: "payment-info address visible" }, h("div", { id: "address-element" })), h("div", { id: "address-errors", class: "stripe-element-errors" }, errorMessage), h("div", { class: "submit-button-wrapper" }, h("button", { type: "submit", disabled: disabled }, this.progress === 'loading' ? i18n.t('Loading') : i18n.t(this.buttonLabel))))));
271
276
  }
272
277
  static get is() { return "stripe-address-element"; }
@@ -495,7 +500,8 @@ export class StripeAddressElement {
495
500
  "StripeDidLoadedHandler": {
496
501
  "location": "import",
497
502
  "path": "../../interfaces",
498
- "id": "src/interfaces.ts::StripeDidLoadedHandler"
503
+ "id": "src/interfaces.ts::StripeDidLoadedHandler",
504
+ "referenceLocation": "StripeDidLoadedHandler"
499
505
  }
500
506
  }
501
507
  },
@@ -536,7 +542,8 @@ export class StripeAddressElement {
536
542
  "StripeLoadedEvent": {
537
543
  "location": "import",
538
544
  "path": "../../interfaces",
539
- "id": "src/interfaces.ts::StripeLoadedEvent"
545
+ "id": "src/interfaces.ts::StripeLoadedEvent",
546
+ "referenceLocation": "StripeLoadedEvent"
540
547
  }
541
548
  }
542
549
  }
@@ -588,7 +595,8 @@ export class StripeAddressElement {
588
595
  "InitStripeOptions": {
589
596
  "location": "import",
590
597
  "path": "../../interfaces",
591
- "id": "src/interfaces.ts::InitStripeOptions"
598
+ "id": "src/interfaces.ts::InitStripeOptions",
599
+ "referenceLocation": "InitStripeOptions"
592
600
  }
593
601
  },
594
602
  "return": "Promise<void>"
@@ -623,7 +631,8 @@ export class StripeAddressElement {
623
631
  "ProgressStatus": {
624
632
  "location": "import",
625
633
  "path": "../../interfaces",
626
- "id": "src/interfaces.ts::ProgressStatus"
634
+ "id": "src/interfaces.ts::ProgressStatus",
635
+ "referenceLocation": "ProgressStatus"
627
636
  }
628
637
  },
629
638
  "return": "Promise<this>"
@@ -708,4 +717,3 @@ export class StripeAddressElement {
708
717
  }];
709
718
  }
710
719
  }
711
- //# sourceMappingURL=stripe-address-element.js.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Build the `InitStripeOptions` object from an optional connected-account id.
3
+ * Returns `undefined` when no account is provided, mirroring the behavior
4
+ * expected by `initStripe` (so the second argument can be omitted entirely).
5
+ * @param stripeAccount Optional connected-account id
6
+ * @returns InitStripeOptions when an account id exists, otherwise undefined
7
+ */
8
+ export const buildInitStripeOptionsFromAccount = (stripeAccount) => {
9
+ if (stripeAccount != null && stripeAccount !== '') {
10
+ return { stripeAccount };
11
+ }
12
+ return undefined;
13
+ };
14
+ /**
15
+ * Confirm a Stripe card intent, dispatching to `confirmCardPayment` or
16
+ * `confirmCardSetup` based on the configured intent type.
17
+ * @param stripe The loaded Stripe.js instance
18
+ * @param intentType Whether this is a payment or setup intent
19
+ * @param intentClientSecret The client secret of the intent to confirm
20
+ * @param cardNumberElement The Stripe card number element to confirm with
21
+ * @returns The PaymentIntent or SetupIntent confirmation result
22
+ */
23
+ export const confirmCardIntent = (stripe, intentType, intentClientSecret, cardNumberElement) => {
24
+ if (intentType === 'payment') {
25
+ return stripe.confirmCardPayment(intentClientSecret, {
26
+ payment_method: {
27
+ card: cardNumberElement,
28
+ },
29
+ });
30
+ }
31
+ return stripe.confirmCardSetup(intentClientSecret, {
32
+ payment_method: {
33
+ card: cardNumberElement,
34
+ },
35
+ });
36
+ };
37
+ /**
38
+ * Wire up the optional payment-request handlers onto a freshly created
39
+ * `<stripe-payment-request-button>` element. Only handlers that are provided
40
+ * on the option object are attached, preserving the original behavior.
41
+ * @param element The payment-request-button custom element instance
42
+ * @param option The payment request button option (handlers + config)
43
+ * @returns void
44
+ */
45
+ export const attachPaymentRequestHandlers = (element, option) => {
46
+ const { paymentRequestPaymentMethodHandler, paymentRequestShippingOptionChangeHandler, paymentRequestShippingAddressChangeHandler } = option;
47
+ element.setPaymentRequestOption(option);
48
+ if (paymentRequestPaymentMethodHandler != null) {
49
+ element.setPaymentMethodEventHandler(paymentRequestPaymentMethodHandler);
50
+ }
51
+ if (paymentRequestShippingOptionChangeHandler != null) {
52
+ element.setPaymentRequestShippingOptionEventHandler(paymentRequestShippingOptionChangeHandler);
53
+ }
54
+ if (paymentRequestShippingAddressChangeHandler != null) {
55
+ element.setPaymentRequestShippingAddressEventHandler(paymentRequestShippingAddressChangeHandler);
56
+ }
57
+ };
@@ -3,6 +3,7 @@ import { checkPlatform } from "../../utils/utils";
3
3
  import { i18n } from "../../utils/i18n";
4
4
  import { serviceFactory } from "../../services/factory";
5
5
  import { StripeAPIError } from "../../utils/error";
6
+ import { buildInitStripeOptionsFromAccount, confirmCardIntent, attachPaymentRequestHandlers } from "./stripe-card-element.helpers";
6
7
  export class StripeCardElement {
7
8
  /**
8
9
  * Get Stripe.js, and initialize elements
@@ -14,7 +15,7 @@ export class StripeCardElement {
14
15
  * customElements
15
16
  * .whenDefined('stripe-card-element')
16
17
  * .then(() => {
17
- * tripeElement.initStripe('pk_test_XXXXXXXXX')
18
+ * stripeElement.initStripe('pk_test_XXXXXXXXX')
18
19
  * })
19
20
  * ```
20
21
  */
@@ -64,6 +65,7 @@ export class StripeCardElement {
64
65
  * stripeElement.updateProgress('success')
65
66
  * });
66
67
  * })
68
+ * ```
67
69
  */
68
70
  async updateProgress(progress) {
69
71
  this.progress = progress;
@@ -90,21 +92,21 @@ export class StripeCardElement {
90
92
  * }
91
93
  * });
92
94
  * })
95
+ * ```
93
96
  */
94
97
  async setErrorMessage(errorMessage) {
95
98
  this.cardElementManager.setError(errorMessage);
96
99
  return this;
97
100
  }
98
101
  updatePublishableKey(publishableKey) {
99
- const options = {};
100
- if (this.stripeAccount) {
101
- options.stripeAccount = this.stripeAccount;
102
+ if (publishableKey == null || publishableKey === '') {
103
+ return;
102
104
  }
103
- this.initStripe(publishableKey, Object.keys(options).length ? options : undefined);
105
+ this.initStripe(publishableKey, buildInitStripeOptionsFromAccount(this.stripeAccount));
104
106
  }
105
107
  updateStripeAccountId(stripeAccount) {
106
108
  const publishableKey = this.stripeService.state.publishableKey || this.publishableKey;
107
- if (!publishableKey) {
109
+ if (publishableKey == null || publishableKey === '') {
108
110
  return;
109
111
  }
110
112
  this.initStripe(publishableKey, {
@@ -124,7 +126,7 @@ export class StripeCardElement {
124
126
  const event = {
125
127
  stripe: this.stripeService.getStripe(),
126
128
  };
127
- if (this.stripeDidLoaded) {
129
+ if (this.stripeDidLoaded != null) {
128
130
  this.stripeDidLoaded(event);
129
131
  }
130
132
  this.stripeLoaded.emit(event);
@@ -132,7 +134,7 @@ export class StripeCardElement {
132
134
  async formSubmitEventHandler() {
133
135
  const cardElements = this.cardElementManager.getElements();
134
136
  const stripe = this.stripeService.getStripe();
135
- if (!cardElements) {
137
+ if (cardElements == null) {
136
138
  console.error('Card elements not initialized');
137
139
  return;
138
140
  }
@@ -147,15 +149,14 @@ export class StripeCardElement {
147
149
  this.defaultFormSubmitResult.emit(result);
148
150
  }
149
151
  componentWillRender() {
150
- if (!this.stripeService.state.publishableKey) {
152
+ const { publishableKey } = this.stripeService.state;
153
+ if (publishableKey == null || publishableKey === '') {
151
154
  return;
152
155
  }
153
156
  if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
154
157
  return;
155
158
  }
156
- this.initStripe(this.stripeService.state.publishableKey, {
157
- stripeAccount: this.stripeService.state.stripeAccount,
158
- });
159
+ this.initStripe(publishableKey, buildInitStripeOptionsFromAccount(this.stripeService.state.stripeAccount));
159
160
  }
160
161
  /**
161
162
  * Default form submit action (just call a confirmCardPayment).
@@ -166,22 +167,8 @@ export class StripeCardElement {
166
167
  async defaultFormSubmitAction(event, { stripe, cardNumberElement, intentClientSecret }) {
167
168
  event.preventDefault();
168
169
  try {
169
- const { intentType } = this;
170
- const result = await (() => {
171
- if (intentType === 'payment') {
172
- return stripe.confirmCardPayment(intentClientSecret, {
173
- payment_method: {
174
- card: cardNumberElement,
175
- },
176
- });
177
- }
178
- return stripe.confirmCardSetup(intentClientSecret, {
179
- payment_method: {
180
- card: cardNumberElement,
181
- },
182
- });
183
- })();
184
- if (result.error) {
170
+ const result = await confirmCardIntent(stripe, this.intentType, intentClientSecret, cardNumberElement);
171
+ if (result.error != null) {
185
172
  throw new StripeAPIError(result.error);
186
173
  }
187
174
  this.defaultFormSubmitResultHandler(result);
@@ -249,10 +236,8 @@ export class StripeCardElement {
249
236
  // Dependency Injection via factory
250
237
  this.stripeService = serviceFactory.createStripeService();
251
238
  this.cardElementManager = serviceFactory.createCardElementManager(this.stripeService);
252
- if (this.publishableKey) {
253
- this.initStripe(this.publishableKey, {
254
- stripeAccount: this.stripeAccount,
255
- });
239
+ if (this.publishableKey != null && this.publishableKey !== '') {
240
+ this.initStripe(this.publishableKey, buildInitStripeOptionsFromAccount(this.stripeAccount));
256
241
  }
257
242
  }
258
243
  /**
@@ -263,7 +248,7 @@ export class StripeCardElement {
263
248
  await this.cardElementManager.initialize(this.el);
264
249
  // Add form submit listener scoped to this component instance
265
250
  const formElement = this.el.querySelector('#stripe-card-element');
266
- if (!formElement) {
251
+ if (formElement == null) {
267
252
  console.error('Form element #stripe-card-element not found');
268
253
  return;
269
254
  }
@@ -271,7 +256,7 @@ export class StripeCardElement {
271
256
  const cardElements = this.cardElementManager.getElements();
272
257
  const stripe = this.stripeService.getStripe();
273
258
  const { intentClientSecret } = this;
274
- if (!cardElements || !stripe) {
259
+ if (cardElements == null || stripe == null) {
275
260
  console.error('Stripe not properly initialized');
276
261
  return;
277
262
  }
@@ -285,17 +270,17 @@ export class StripeCardElement {
285
270
  };
286
271
  this.progress = 'loading';
287
272
  try {
288
- if (this.handleSubmit) {
273
+ if (this.handleSubmit != null) {
289
274
  await this.handleSubmit(e, submitEventProps);
290
275
  }
291
- else if (this.shouldUseDefaultFormSubmitAction === true && intentClientSecret) {
276
+ else if (this.shouldUseDefaultFormSubmitAction === true && intentClientSecret != null && intentClientSecret !== '') {
292
277
  await this.defaultFormSubmitAction(e, submitEventProps);
293
278
  }
294
279
  else {
295
280
  e.preventDefault();
296
281
  }
297
282
  await this.formSubmitEventHandler();
298
- if (this.handleSubmit || this.shouldUseDefaultFormSubmitAction === true) {
283
+ if (this.handleSubmit != null || this.shouldUseDefaultFormSubmitAction === true) {
299
284
  this.progress = 'success';
300
285
  }
301
286
  }
@@ -328,36 +313,26 @@ export class StripeCardElement {
328
313
  if (this.paymentRequestButtonCreated) {
329
314
  return null;
330
315
  }
331
- if (!showPaymentRequestButton || !paymentRequestOption) {
316
+ if (!showPaymentRequestButton || paymentRequestOption == null) {
332
317
  return null;
333
318
  }
334
- if (!document) {
319
+ if (document == null) {
335
320
  return null;
336
321
  }
337
322
  const targetElement = this.el.querySelector('#stripe-payment-request-button');
338
- if (!targetElement) {
323
+ if (targetElement == null) {
339
324
  console.error('Target element #stripe-payment-request-button not found');
340
325
  return null;
341
326
  }
342
327
  // Check if button already exists in DOM to prevent duplicates
343
- if (targetElement.querySelector('stripe-payment-request-button')) {
328
+ if (targetElement.querySelector('stripe-payment-request-button') != null) {
344
329
  this.paymentRequestButtonCreated = true;
345
330
  return null;
346
331
  }
347
332
  const stripePaymentRequestElement = document.createElement('stripe-payment-request-button');
348
333
  targetElement.appendChild(stripePaymentRequestElement);
349
- const { paymentRequestPaymentMethodHandler, paymentRequestShippingOptionChangeHandler, paymentRequestShippingAddressChangeHandler } = paymentRequestOption;
350
334
  customElements.whenDefined('stripe-payment-request-button').then(() => {
351
- stripePaymentRequestElement.setPaymentRequestOption(paymentRequestOption);
352
- if (paymentRequestPaymentMethodHandler) {
353
- stripePaymentRequestElement.setPaymentMethodEventHandler(paymentRequestPaymentMethodHandler);
354
- }
355
- if (paymentRequestShippingOptionChangeHandler) {
356
- stripePaymentRequestElement.setPaymentRequestShippingOptionEventHandler(paymentRequestShippingOptionChangeHandler);
357
- }
358
- if (paymentRequestShippingAddressChangeHandler) {
359
- stripePaymentRequestElement.setPaymentRequestShippingAddressEventHandler(paymentRequestShippingAddressChangeHandler);
360
- }
335
+ attachPaymentRequestHandlers(stripePaymentRequestElement, paymentRequestOption);
361
336
  return stripePaymentRequestElement.initStripe(this.publishableKey);
362
337
  });
363
338
  // Mark as created
@@ -370,7 +345,11 @@ export class StripeCardElement {
370
345
  return h("p", null, i18n.t('Failed to load Stripe'));
371
346
  }
372
347
  const disabled = this.progress === 'loading';
373
- return (h("div", { class: "stripe-payment-sheet-wrap" }, h("form", { id: "stripe-card-element" }, h("div", { class: "stripe-heading" }, i18n.t(this.sheetTitle)), h("div", { id: "stripe-payment-request-button" }), h("div", null, h("div", { class: "stripe-section-title" }, i18n.t('Card information'))), h("div", { class: "payment-info card visible" }, h("fieldset", { class: "stripe-input-box" }, h("div", null, h("label", null, this.showLabel ? h("lenged", null, i18n.t('Card Number')) : null, h("div", { id: "card-number" }))), h("div", { class: "stripe-input-column", style: { display: 'flex' } }, h("label", { style: { width: '50%' } }, this.showLabel ? h("lenged", null, i18n.t('MM / YY')) : null, h("div", { id: "card-expiry" })), h("label", { style: { width: '50%' } }, this.showLabel ? h("lenged", null, i18n.t('CVC')) : null, h("div", { id: "card-cvc" }))))), h("div", { id: "card-errors", class: "stripe-element-errors" }, errorMessage), this.zip ? (h("div", { style: { marginTop: '1.5rem' } }, h("div", { class: "stripe-section-title" }, i18n.t('Country or region')))) : null, this.zip ? (h("div", { class: "payment-info card visible" }, h("fieldset", { class: "stripe-input-box" }, h("div", null, h("label", null, this.showLabel ? h("lenged", null, i18n.t('Postal Code')) : null, h("input", { id: "zip", name: "zip", type: "text", inputmode: "numeric", class: "StripeElement", style: { width: '100%' }, placeholder: i18n.t('Postal Code'), value: this.zipCode, onInput: e => {
348
+ return (
349
+ // NOTE: `stripe-payment-sheet-wrap` is a legacy class name (leftover from a former
350
+ // component name). External consumers may target it in their own CSS, so it is a
351
+ // public DOM contract that MUST be kept for backward compatibility. Do not remove it.
352
+ h("div", { class: "stripe-payment-sheet-wrap" }, h("form", { id: "stripe-card-element" }, h("div", { class: "stripe-heading" }, i18n.t(this.sheetTitle)), h("div", { id: "stripe-payment-request-button" }), h("div", null, h("div", { class: "stripe-section-title" }, i18n.t('Card information'))), h("div", { class: "payment-info card visible" }, h("fieldset", { class: "stripe-input-box" }, h("div", null, h("label", null, this.showLabel ? h("lenged", null, i18n.t('Card Number')) : null, h("div", { id: "card-number" }))), h("div", { class: "stripe-input-column", style: { display: 'flex' } }, h("label", { style: { width: '50%' } }, this.showLabel ? h("lenged", null, i18n.t('MM / YY')) : null, h("div", { id: "card-expiry" })), h("label", { style: { width: '50%' } }, this.showLabel ? h("lenged", null, i18n.t('CVC')) : null, h("div", { id: "card-cvc" }))))), h("div", { id: "card-errors", class: "stripe-element-errors" }, errorMessage), this.zip ? (h("div", { style: { marginTop: '1.5rem' } }, h("div", { class: "stripe-section-title" }, i18n.t('Country or region')))) : null, this.zip ? (h("div", { class: "payment-info card visible" }, h("fieldset", { class: "stripe-input-box" }, h("div", null, h("label", null, this.showLabel ? h("lenged", null, i18n.t('Postal Code')) : null, h("input", { id: "zip", name: "zip", type: "text", inputmode: "numeric", class: "StripeElement", style: { width: '100%' }, placeholder: i18n.t('Postal Code'), value: this.zipCode, onInput: e => {
374
353
  this.zipCode = e.target.value;
375
354
  } })))))) : null, h("div", { style: { marginTop: '32px' } }, h("button", { type: "submit", disabled: disabled }, this.progress === 'loading' ? i18n.t('Loading') : i18n.t(this.buttonLabel))))));
376
355
  }
@@ -397,7 +376,8 @@ export class StripeCardElement {
397
376
  "IntentType": {
398
377
  "location": "import",
399
378
  "path": "../../interfaces",
400
- "id": "src/interfaces.ts::IntentType"
379
+ "id": "src/interfaces.ts::IntentType",
380
+ "referenceLocation": "IntentType"
401
381
  }
402
382
  }
403
383
  },
@@ -628,7 +608,8 @@ export class StripeCardElement {
628
608
  "FormSubmitHandler": {
629
609
  "location": "import",
630
610
  "path": "../../interfaces",
631
- "id": "src/interfaces.ts::FormSubmitHandler"
611
+ "id": "src/interfaces.ts::FormSubmitHandler",
612
+ "referenceLocation": "FormSubmitHandler"
632
613
  }
633
614
  }
634
615
  },
@@ -651,7 +632,8 @@ export class StripeCardElement {
651
632
  "StripeDidLoadedHandler": {
652
633
  "location": "import",
653
634
  "path": "../../interfaces",
654
- "id": "src/interfaces.ts::StripeDidLoadedHandler"
635
+ "id": "src/interfaces.ts::StripeDidLoadedHandler",
636
+ "referenceLocation": "StripeDidLoadedHandler"
655
637
  }
656
638
  }
657
639
  },
@@ -694,7 +676,8 @@ export class StripeCardElement {
694
676
  "StripeLoadedEvent": {
695
677
  "location": "import",
696
678
  "path": "../../interfaces",
697
- "id": "src/interfaces.ts::StripeLoadedEvent"
679
+ "id": "src/interfaces.ts::StripeLoadedEvent",
680
+ "referenceLocation": "StripeLoadedEvent"
698
681
  }
699
682
  }
700
683
  }
@@ -707,7 +690,7 @@ export class StripeCardElement {
707
690
  "docs": {
708
691
  "tags": [{
709
692
  "name": "example",
710
- "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n stripeElement\n .addEventListener('formSubmit', async props => {\n const {\n detail: { stripe, cardNumber, event },\n } = props;\n const result = await stripe.createPaymentMethod({\n type: 'card',\n card: cardNumber,\n });\n console.log(result);\n })\n })"
693
+ "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n stripeElement\n .addEventListener('formSubmit', async props => {\n const {\n detail: { stripe, cardNumber, event },\n } = props;\n const result = await stripe.createPaymentMethod({\n type: 'card',\n card: cardNumber,\n });\n console.log(result);\n })\n })\n```"
711
694
  }],
712
695
  "text": "Form submit event"
713
696
  },
@@ -718,7 +701,8 @@ export class StripeCardElement {
718
701
  "FormSubmitEvent": {
719
702
  "location": "import",
720
703
  "path": "../../interfaces",
721
- "id": "src/interfaces.ts::FormSubmitEvent"
704
+ "id": "src/interfaces.ts::FormSubmitEvent",
705
+ "referenceLocation": "FormSubmitEvent"
722
706
  }
723
707
  }
724
708
  }
@@ -731,7 +715,7 @@ export class StripeCardElement {
731
715
  "docs": {
732
716
  "tags": [{
733
717
  "name": "example",
734
- "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n stripeElement.addEventListener('defaultFormSubmitResult', async ({detail}) => {\n if (detail instanceof Error) {\n console.error(detail)\n } else {\n console.log(detail)\n }\n })\n })"
718
+ "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n stripeElement.addEventListener('defaultFormSubmitResult', async ({detail}) => {\n if (detail instanceof Error) {\n console.error(detail)\n } else {\n console.log(detail)\n }\n })\n })\n```"
735
719
  }],
736
720
  "text": "Recieve the result of defaultFormSubmit event"
737
721
  },
@@ -742,7 +726,8 @@ export class StripeCardElement {
742
726
  "DefaultFormSubmitResult": {
743
727
  "location": "import",
744
728
  "path": "../../interfaces",
745
- "id": "src/interfaces.ts::DefaultFormSubmitResult"
729
+ "id": "src/interfaces.ts::DefaultFormSubmitResult",
730
+ "referenceLocation": "DefaultFormSubmitResult"
746
731
  }
747
732
  }
748
733
  }
@@ -770,7 +755,8 @@ export class StripeCardElement {
770
755
  "InitStripeOptions": {
771
756
  "location": "import",
772
757
  "path": "../../interfaces",
773
- "id": "src/interfaces.ts::InitStripeOptions"
758
+ "id": "src/interfaces.ts::InitStripeOptions",
759
+ "referenceLocation": "InitStripeOptions"
774
760
  }
775
761
  },
776
762
  "return": "Promise<void>"
@@ -785,7 +771,7 @@ export class StripeCardElement {
785
771
  "text": "options"
786
772
  }, {
787
773
  "name": "example",
788
- "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n tripeElement.initStripe('pk_test_XXXXXXXXX')\n })\n```"
774
+ "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n stripeElement.initStripe('pk_test_XXXXXXXXX')\n })\n```"
789
775
  }]
790
776
  }
791
777
  },
@@ -805,7 +791,8 @@ export class StripeCardElement {
805
791
  "ProgressStatus": {
806
792
  "location": "import",
807
793
  "path": "../../interfaces",
808
- "id": "src/interfaces.ts::ProgressStatus"
794
+ "id": "src/interfaces.ts::ProgressStatus",
795
+ "referenceLocation": "ProgressStatus"
809
796
  }
810
797
  },
811
798
  "return": "Promise<this>"
@@ -820,7 +807,7 @@ export class StripeCardElement {
820
807
  "text": undefined
821
808
  }, {
822
809
  "name": "example",
823
- "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event.\n stripeElement.setAttribute('should-use-default-form-submit-action', false)\n stripeElement.addEventListener('formSubmit', async props => {\n const {\n detail: { stripe, cardNumber, event },\n } = props;\n const result = await stripe.createPaymentMethod({\n type: 'card',\n card: cardNumber,\n });\n console.log(result);\n stripeElement.updateProgress('success')\n });\n})"
810
+ "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event.\n stripeElement.setAttribute('should-use-default-form-submit-action', false)\n stripeElement.addEventListener('formSubmit', async props => {\n const {\n detail: { stripe, cardNumber, event },\n } = props;\n const result = await stripe.createPaymentMethod({\n type: 'card',\n card: cardNumber,\n });\n console.log(result);\n stripeElement.updateProgress('success')\n });\n})\n```"
824
811
  }]
825
812
  }
826
813
  },
@@ -850,7 +837,7 @@ export class StripeCardElement {
850
837
  "text": undefined
851
838
  }, {
852
839
  "name": "example",
853
- "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event.\n stripeElement.setAttribute('should-use-default-form-submit-action', false)\n stripeElement.addEventListener('formSubmit', async props => {\n try {\n throw new Error('debug')\n } catch (e) {\n stripeElement.setErrorMessage(`Error: ${e.message}`)\n stripeElement.updateProgress('failure')\n }\n });\n})"
840
+ "text": "```\nconst stripeElement = document.createElement('stripe-card-element');\ncustomElements\n .whenDefined('stripe-card-element')\n .then(() => {\n // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event.\n stripeElement.setAttribute('should-use-default-form-submit-action', false)\n stripeElement.addEventListener('formSubmit', async props => {\n try {\n throw new Error('debug')\n } catch (e) {\n stripeElement.setErrorMessage(`Error: ${e.message}`)\n stripeElement.updateProgress('failure')\n }\n });\n})\n```"
854
841
  }]
855
842
  }
856
843
  },
@@ -870,7 +857,8 @@ export class StripeCardElement {
870
857
  "PaymentRequestButtonOption": {
871
858
  "location": "import",
872
859
  "path": "../../interfaces",
873
- "id": "src/interfaces.ts::PaymentRequestButtonOption"
860
+ "id": "src/interfaces.ts::PaymentRequestButtonOption",
861
+ "referenceLocation": "PaymentRequestButtonOption"
874
862
  }
875
863
  },
876
864
  "return": "Promise<this>"
@@ -899,4 +887,3 @@ export class StripeCardElement {
899
887
  }];
900
888
  }
901
889
  }
902
- //# sourceMappingURL=stripe-card-element.js.map