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.
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -3
- package/dist/cjs/error-FFC4kSs5.js +0 -3
- package/dist/cjs/{factory-CbbbSvkg.js → factory-da3xAKkz.js} +194 -73
- package/dist/cjs/{index-Ba1pBePA.js → index-CYbA1N_k.js} +24 -6
- package/dist/cjs/index-Dkb0SxZc.js +4694 -0
- package/dist/cjs/index.cjs.js +0 -1
- package/dist/cjs/ion-icon.cjs.entry.js +22 -13
- package/dist/cjs/loader.cjs.js +2 -3
- package/dist/cjs/stripe-address-element.cjs.entry.js +34 -26
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +6 -7
- package/dist/cjs/stripe-card-element_2.cjs.entry.js +106 -67
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +13 -10
- package/dist/cjs/stripe-elements.cjs.js +31 -5
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +25 -22
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +13 -10
- package/dist/cjs/stripe-payment-element.cjs.entry.js +190 -131
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +12 -7
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +29 -21
- package/dist/collection/components/stripe-card-element/stripe-card-element.helpers.js +57 -0
- package/dist/collection/components/stripe-card-element/stripe-card-element.js +55 -68
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +15 -11
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +10 -6
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +28 -20
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +12 -7
- package/dist/collection/components/stripe-modal/stripe-modal.js +0 -1
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.helpers.js +114 -0
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +69 -126
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +34 -12
- package/dist/collection/index.js +0 -1
- package/dist/collection/interfaces.js +0 -1
- package/dist/collection/services/address-element-manager.js +3 -4
- package/dist/collection/services/card-element-manager.js +3 -4
- package/dist/collection/services/currency-selector-element-manager.js +3 -4
- package/dist/collection/services/express-checkout-element-manager.js +9 -10
- package/dist/collection/services/factory.js +0 -1
- package/dist/collection/services/interfaces.js +0 -1
- package/dist/collection/services/link-authentication-element-manager.js +3 -4
- package/dist/collection/services/payment-element-manager.js +4 -5
- package/dist/collection/services/stripe-service.js +5 -6
- package/dist/collection/utils/element-finder.js +2 -3
- package/dist/collection/utils/error.js +0 -1
- package/dist/collection/utils/i18n.js +0 -1
- package/dist/collection/utils/platform.js +0 -1
- package/dist/collection/utils/test-setup.js +0 -1
- package/dist/collection/utils/utils.js +2 -3
- package/dist/components/error.js +1 -16
- package/dist/components/factory.js +1 -3736
- package/dist/components/icon.js +1 -459
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -4
- package/dist/components/index2.js +1 -192
- package/dist/components/ion-icon.js +1 -9
- package/dist/components/stripe-address-element.js +1 -327
- package/dist/components/stripe-card-element-modal.js +1 -174
- package/dist/components/stripe-card-element.js +1 -9
- package/dist/components/stripe-card-element2.js +1 -440
- package/dist/components/stripe-currency-selector.js +1 -218
- package/dist/components/stripe-express-checkout-element.js +1 -332
- package/dist/components/stripe-link-authentication-element.js +1 -256
- package/dist/components/stripe-modal.js +1 -9
- package/dist/components/stripe-modal2.js +1 -112
- package/dist/components/stripe-payment-element.js +1 -510
- package/dist/components/stripe-payment-request-button.js +1 -9
- package/dist/components/stripe-payment-request-button2.js +1 -224
- package/dist/components/utils.js +1 -89
- package/dist/esm/app-globals-DQuL1Twl.js +0 -3
- package/dist/esm/error-XRfh5Wrs.js +0 -3
- package/dist/esm/{factory-Drde6-y7.js → factory-DeqoYLf_.js} +194 -73
- package/dist/esm/index-C6bbmyga.js +4677 -0
- package/dist/esm/{index-BHDCxQOb.js → index-CBXaOfXU.js} +24 -6
- package/dist/esm/index.js +0 -1
- package/dist/esm/ion-icon.entry.js +22 -13
- package/dist/esm/loader.js +3 -4
- package/dist/esm/stripe-address-element.entry.js +34 -26
- package/dist/esm/stripe-card-element-modal.entry.js +6 -7
- package/dist/esm/stripe-card-element_2.entry.js +106 -67
- package/dist/esm/stripe-currency-selector.entry.js +13 -10
- package/dist/esm/stripe-elements.js +32 -6
- package/dist/esm/stripe-express-checkout-element.entry.js +25 -22
- package/dist/esm/stripe-link-authentication-element.entry.js +13 -10
- package/dist/esm/stripe-payment-element.entry.js +190 -131
- package/dist/esm/stripe-payment-request-button.entry.js +12 -7
- package/dist/stripe-elements/index.esm.js +0 -2
- package/dist/stripe-elements/p--sA2m1ad.js +1 -0
- package/dist/stripe-elements/p-38e7b187.entry.js +1 -0
- package/dist/stripe-elements/p-44495284.entry.js +1 -0
- package/dist/stripe-elements/p-4ba675fa.entry.js +1 -0
- package/dist/stripe-elements/p-5cf62945.entry.js +1 -0
- package/dist/stripe-elements/p-C6bbmyga.js +2 -0
- package/dist/stripe-elements/p-CBXaOfXU.js +1 -0
- package/dist/stripe-elements/p-DQuL1Twl.js +1 -2
- package/dist/stripe-elements/p-XRfh5Wrs.js +1 -2
- package/dist/stripe-elements/p-c24ae181.entry.js +1 -0
- package/dist/stripe-elements/p-d9e86451.entry.js +1 -0
- package/dist/stripe-elements/p-f09c86a0.entry.js +1 -0
- package/dist/stripe-elements/p-f64f394d.entry.js +1 -0
- package/dist/stripe-elements/p-f6d2425e.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -2
- package/dist/stripe-elements/svg/.gitignore +4 -0
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +5 -1
- package/dist/types/components/stripe-card-element/stripe-card-element.helpers.d.ts +29 -0
- package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +4 -4
- package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +2 -2
- package/dist/types/components/stripe-payment-element/stripe-payment-element.helpers.d.ts +54 -0
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +8 -0
- package/dist/types/components.d.ts +139 -29
- package/dist/types/index.d.ts +1 -0
- package/dist/types/services/interfaces.d.ts +3 -3
- package/dist/types/services/stripe-service.d.ts +2 -2
- package/dist/types/stencil-public-runtime.d.ts +110 -5
- package/package.json +50 -30
- package/readme.md +386 -133
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +0 -1
- package/dist/cjs/error-FFC4kSs5.js.map +0 -1
- package/dist/cjs/factory-CbbbSvkg.js.map +0 -1
- package/dist/cjs/index-BXVW_rzh.js +0 -1932
- package/dist/cjs/index-BXVW_rzh.js.map +0 -1
- package/dist/cjs/index-Ba1pBePA.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/ion-icon.entry.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/stripe-address-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-card-element-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-card-element.stripe-modal.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-currency-selector.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-elements.cjs.js.map +0 -1
- package/dist/cjs/stripe-express-checkout-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-link-authentication-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-payment-element.entry.cjs.js.map +0 -1
- package/dist/cjs/stripe-payment-request-button.entry.cjs.js.map +0 -1
- package/dist/collection/components/stripe-address-element/stripe-address-element.js.map +0 -1
- package/dist/collection/components/stripe-card-element/stripe-card-element.js.map +0 -1
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js.map +0 -1
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js.map +0 -1
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js.map +0 -1
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js.map +0 -1
- package/dist/collection/components/stripe-modal/stripe-modal.js.map +0 -1
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js.map +0 -1
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/interfaces.js.map +0 -1
- package/dist/collection/services/address-element-manager.js.map +0 -1
- package/dist/collection/services/card-element-manager.js.map +0 -1
- package/dist/collection/services/currency-selector-element-manager.js.map +0 -1
- package/dist/collection/services/express-checkout-element-manager.js.map +0 -1
- package/dist/collection/services/factory.js.map +0 -1
- package/dist/collection/services/interfaces.js.map +0 -1
- package/dist/collection/services/link-authentication-element-manager.js.map +0 -1
- package/dist/collection/services/payment-element-manager.js.map +0 -1
- package/dist/collection/services/stripe-service.js.map +0 -1
- package/dist/collection/utils/element-finder.js.map +0 -1
- package/dist/collection/utils/error.js.map +0 -1
- package/dist/collection/utils/i18n.js.map +0 -1
- package/dist/collection/utils/platform.js.map +0 -1
- package/dist/collection/utils/test-setup.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/error.js.map +0 -1
- package/dist/components/factory.js.map +0 -1
- package/dist/components/icon.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/index2.js.map +0 -1
- package/dist/components/ion-icon.js.map +0 -1
- package/dist/components/stripe-address-element.js.map +0 -1
- package/dist/components/stripe-card-element-modal.js.map +0 -1
- package/dist/components/stripe-card-element.js.map +0 -1
- package/dist/components/stripe-card-element2.js.map +0 -1
- package/dist/components/stripe-currency-selector.js.map +0 -1
- package/dist/components/stripe-express-checkout-element.js.map +0 -1
- package/dist/components/stripe-link-authentication-element.js.map +0 -1
- package/dist/components/stripe-modal.js.map +0 -1
- package/dist/components/stripe-modal2.js.map +0 -1
- package/dist/components/stripe-payment-element.js.map +0 -1
- package/dist/components/stripe-payment-request-button.js.map +0 -1
- package/dist/components/stripe-payment-request-button2.js.map +0 -1
- package/dist/components/utils.js.map +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js.map +0 -1
- package/dist/esm/error-XRfh5Wrs.js.map +0 -1
- package/dist/esm/factory-Drde6-y7.js.map +0 -1
- package/dist/esm/index-BHDCxQOb.js.map +0 -1
- package/dist/esm/index-DJwTOfxZ.js +0 -1920
- package/dist/esm/index-DJwTOfxZ.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/ion-icon.entry.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/stripe-address-element.entry.js.map +0 -1
- package/dist/esm/stripe-card-element-modal.entry.js.map +0 -1
- package/dist/esm/stripe-card-element.stripe-modal.entry.js.map +0 -1
- package/dist/esm/stripe-currency-selector.entry.js.map +0 -1
- package/dist/esm/stripe-elements.js.map +0 -1
- package/dist/esm/stripe-express-checkout-element.entry.js.map +0 -1
- package/dist/esm/stripe-link-authentication-element.entry.js.map +0 -1
- package/dist/esm/stripe-payment-element.entry.js.map +0 -1
- package/dist/esm/stripe-payment-request-button.entry.js.map +0 -1
- package/dist/stripe-elements/index.esm.js.map +0 -1
- package/dist/stripe-elements/ion-icon.entry.esm.js.map +0 -1
- package/dist/stripe-elements/loader.esm.js.map +0 -1
- package/dist/stripe-elements/p-02f6e421.entry.js +0 -2
- package/dist/stripe-elements/p-02f6e421.entry.js.map +0 -1
- package/dist/stripe-elements/p-19888fa6.entry.js +0 -2
- package/dist/stripe-elements/p-19888fa6.entry.js.map +0 -1
- package/dist/stripe-elements/p-4d505729.entry.js +0 -2
- package/dist/stripe-elements/p-4d505729.entry.js.map +0 -1
- package/dist/stripe-elements/p-7e7ad92a.entry.js +0 -2
- package/dist/stripe-elements/p-7e7ad92a.entry.js.map +0 -1
- package/dist/stripe-elements/p-8bb4212c.entry.js +0 -2
- package/dist/stripe-elements/p-8bb4212c.entry.js.map +0 -1
- package/dist/stripe-elements/p-9aee2b6b.entry.js +0 -2
- package/dist/stripe-elements/p-9aee2b6b.entry.js.map +0 -1
- package/dist/stripe-elements/p-BHDCxQOb.js +0 -2
- package/dist/stripe-elements/p-BHDCxQOb.js.map +0 -1
- package/dist/stripe-elements/p-DI2vmGaI.js +0 -2
- package/dist/stripe-elements/p-DI2vmGaI.js.map +0 -1
- package/dist/stripe-elements/p-DJwTOfxZ.js +0 -3
- package/dist/stripe-elements/p-DJwTOfxZ.js.map +0 -1
- package/dist/stripe-elements/p-DQuL1Twl.js.map +0 -1
- package/dist/stripe-elements/p-XRfh5Wrs.js.map +0 -1
- package/dist/stripe-elements/p-ba251393.entry.js +0 -2
- package/dist/stripe-elements/p-ba251393.entry.js.map +0 -1
- package/dist/stripe-elements/p-c649edfc.entry.js +0 -2
- package/dist/stripe-elements/p-c649edfc.entry.js.map +0 -1
- package/dist/stripe-elements/p-e8bb43ae.entry.js +0 -2
- package/dist/stripe-elements/p-e8bb43ae.entry.js.map +0 -1
- package/dist/stripe-elements/stripe-address-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-card-element-modal.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-card-element.stripe-modal.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-currency-selector.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-elements.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-express-checkout-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-link-authentication-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-payment-element.entry.esm.js.map +0 -1
- package/dist/stripe-elements/stripe-payment-request-button.entry.esm.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { checkPlatform } from "../../utils/utils";
|
|
3
3
|
import { i18n } from "../../utils/i18n";
|
|
4
4
|
import { serviceFactory } from "../../services/factory";
|
|
5
|
-
import {
|
|
5
|
+
import { confirmCheckoutSession, confirmPaymentOrSetup, isSubmitButtonDisabled, buildSubmitEventProps } from "./stripe-payment-element.helpers";
|
|
6
6
|
export class StripePaymentElement {
|
|
7
7
|
/**
|
|
8
8
|
* Get Stripe.js, and initialize elements
|
|
@@ -121,7 +121,7 @@ export class StripePaymentElement {
|
|
|
121
121
|
updatePublishableKey(publishableKey) {
|
|
122
122
|
const options = {};
|
|
123
123
|
options.stripeAccount = this.stripeService.state.stripeAccount;
|
|
124
|
-
const hasOptionValue = Object.values(options).filter(
|
|
124
|
+
const hasOptionValue = Object.values(options).filter(value => value != null && value !== '').length > 0;
|
|
125
125
|
this.initStripe(publishableKey, hasOptionValue ? options : undefined);
|
|
126
126
|
}
|
|
127
127
|
updateStripeAccountId(stripeAccount) {
|
|
@@ -137,7 +137,7 @@ export class StripePaymentElement {
|
|
|
137
137
|
}
|
|
138
138
|
async updateCheckoutSessionClientSecret(newValue) {
|
|
139
139
|
// Re-initialize with checkout session when client secret changes
|
|
140
|
-
if (this.publishableKey && newValue) {
|
|
140
|
+
if (this.publishableKey != null && this.publishableKey !== '' && newValue != null && newValue !== '') {
|
|
141
141
|
await this.initStripeWithCheckoutSession(this.publishableKey, newValue, {
|
|
142
142
|
stripeAccount: this.stripeAccount,
|
|
143
143
|
});
|
|
@@ -147,42 +147,31 @@ export class StripePaymentElement {
|
|
|
147
147
|
const event = {
|
|
148
148
|
stripe: this.stripeService.getStripe(),
|
|
149
149
|
};
|
|
150
|
-
if (this.stripeDidLoaded) {
|
|
150
|
+
if (this.stripeDidLoaded != null) {
|
|
151
151
|
this.stripeDidLoaded(event);
|
|
152
152
|
}
|
|
153
153
|
this.stripeLoaded.emit(event);
|
|
154
154
|
}
|
|
155
155
|
async formSubmitEventHandler() {
|
|
156
156
|
const stripe = this.stripeService.getStripe();
|
|
157
|
-
const isCheckoutSession = this.stripeService.state.isCheckoutSession;
|
|
158
|
-
if (
|
|
157
|
+
const isCheckoutSession = this.stripeService.state.isCheckoutSession === true;
|
|
158
|
+
if (stripe == null) {
|
|
159
159
|
console.error('Stripe not properly initialized');
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const result = buildSubmitEventProps({
|
|
163
163
|
stripe,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
eventData.checkoutSessionClientSecret = this.checkoutSessionClientSecret;
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
// Payment Intent / Setup Intent mode
|
|
177
|
-
const elements = this.stripeService.getElements();
|
|
178
|
-
if (!elements) {
|
|
179
|
-
console.error('Elements not properly initialized');
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
eventData.elements = elements;
|
|
183
|
-
eventData.intentClientSecret = this.intentClientSecret;
|
|
164
|
+
isCheckoutSession,
|
|
165
|
+
checkout: this.stripeService.getCheckout(),
|
|
166
|
+
checkoutSessionClientSecret: this.checkoutSessionClientSecret,
|
|
167
|
+
elements: this.stripeService.getElements(),
|
|
168
|
+
intentClientSecret: this.intentClientSecret,
|
|
169
|
+
});
|
|
170
|
+
if ('error' in result) {
|
|
171
|
+
console.error(result.error);
|
|
172
|
+
return;
|
|
184
173
|
}
|
|
185
|
-
this.formSubmit.emit(
|
|
174
|
+
this.formSubmit.emit(result.props);
|
|
186
175
|
}
|
|
187
176
|
async defaultFormSubmitResultHandler(result) {
|
|
188
177
|
this.defaultFormSubmitResult.emit(result);
|
|
@@ -191,7 +180,8 @@ export class StripePaymentElement {
|
|
|
191
180
|
this.checkoutSessionConfirmResult.emit(result);
|
|
192
181
|
}
|
|
193
182
|
componentWillRender() {
|
|
194
|
-
|
|
183
|
+
const { publishableKey } = this.stripeService.state;
|
|
184
|
+
if (publishableKey == null || publishableKey === '') {
|
|
195
185
|
return;
|
|
196
186
|
}
|
|
197
187
|
if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
|
|
@@ -211,30 +201,9 @@ export class StripePaymentElement {
|
|
|
211
201
|
async defaultFormSubmitAction(event, { stripe, elements }) {
|
|
212
202
|
event.preventDefault();
|
|
213
203
|
try {
|
|
214
|
-
const { intentType } = this;
|
|
215
204
|
// Get current page URL for return_url
|
|
216
205
|
const returnUrl = window.location.href;
|
|
217
|
-
const result = await (
|
|
218
|
-
if (intentType === 'payment') {
|
|
219
|
-
return stripe.confirmPayment({
|
|
220
|
-
elements,
|
|
221
|
-
confirmParams: {
|
|
222
|
-
return_url: returnUrl,
|
|
223
|
-
},
|
|
224
|
-
redirect: 'if_required',
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
return stripe.confirmSetup({
|
|
228
|
-
elements,
|
|
229
|
-
confirmParams: {
|
|
230
|
-
return_url: returnUrl,
|
|
231
|
-
},
|
|
232
|
-
redirect: 'if_required',
|
|
233
|
-
});
|
|
234
|
-
})();
|
|
235
|
-
if (result.error) {
|
|
236
|
-
throw new StripeAPIError(result.error);
|
|
237
|
-
}
|
|
206
|
+
const result = await confirmPaymentOrSetup(stripe, elements, this.intentType, returnUrl);
|
|
238
207
|
this.defaultFormSubmitResultHandler(result);
|
|
239
208
|
}
|
|
240
209
|
catch (e) {
|
|
@@ -250,38 +219,11 @@ export class StripePaymentElement {
|
|
|
250
219
|
* @param checkout - The Stripe Checkout instance
|
|
251
220
|
*/
|
|
252
221
|
async checkoutSessionFormSubmitAction(event, checkout) {
|
|
253
|
-
var _a;
|
|
254
222
|
event.preventDefault();
|
|
255
223
|
try {
|
|
256
|
-
// Load actions from the checkout session
|
|
257
|
-
const loadActionsResult = await checkout.loadActions();
|
|
258
|
-
if (loadActionsResult.type === 'error') {
|
|
259
|
-
// Create a StripeError-compatible object from the Checkout Session error
|
|
260
|
-
const stripeError = {
|
|
261
|
-
type: 'api_error',
|
|
262
|
-
code: loadActionsResult.error.code || 'checkout_session_error',
|
|
263
|
-
message: loadActionsResult.error.message,
|
|
264
|
-
};
|
|
265
|
-
throw new StripeAPIError(stripeError);
|
|
266
|
-
}
|
|
267
|
-
const { actions } = loadActionsResult;
|
|
268
224
|
// Get current page URL for return_url
|
|
269
225
|
const returnUrl = window.location.href;
|
|
270
|
-
|
|
271
|
-
const result = await actions.confirm({
|
|
272
|
-
returnUrl,
|
|
273
|
-
redirect: 'if_required',
|
|
274
|
-
});
|
|
275
|
-
if (result.type === 'error') {
|
|
276
|
-
// Create a StripeError-compatible object from the confirm error
|
|
277
|
-
const stripeError = {
|
|
278
|
-
type: 'card_error',
|
|
279
|
-
code: result.error.code || 'payment_failed',
|
|
280
|
-
message: result.error.message,
|
|
281
|
-
decline_code: result.error.code === 'paymentFailed' ? (_a = result.error.paymentFailed) === null || _a === void 0 ? void 0 : _a.declineCode : undefined,
|
|
282
|
-
};
|
|
283
|
-
throw new StripeAPIError(stripeError);
|
|
284
|
-
}
|
|
226
|
+
const result = await confirmCheckoutSession(checkout, returnUrl);
|
|
285
227
|
this.checkoutSessionConfirmResultHandler(result);
|
|
286
228
|
}
|
|
287
229
|
catch (e) {
|
|
@@ -332,7 +274,7 @@ export class StripePaymentElement {
|
|
|
332
274
|
// Dependency Injection via factory
|
|
333
275
|
this.stripeService = serviceFactory.createStripeService();
|
|
334
276
|
this.paymentElementManager = serviceFactory.createPaymentElementManager(this.stripeService);
|
|
335
|
-
if (this.publishableKey) {
|
|
277
|
+
if (this.publishableKey != null && this.publishableKey !== '') {
|
|
336
278
|
this.initStripe(this.publishableKey, {
|
|
337
279
|
stripeAccount: this.stripeAccount,
|
|
338
280
|
});
|
|
@@ -346,57 +288,47 @@ export class StripePaymentElement {
|
|
|
346
288
|
await this.paymentElementManager.initialize(this.el);
|
|
347
289
|
// Add form submit listener scoped to this component instance
|
|
348
290
|
const formElement = this.el.querySelector('#stripe-payment-element');
|
|
349
|
-
if (
|
|
291
|
+
if (formElement == null) {
|
|
350
292
|
console.error('Form element #stripe-payment-element not found');
|
|
351
293
|
return;
|
|
352
294
|
}
|
|
353
295
|
// Remove existing listener if present to prevent duplicates
|
|
354
|
-
if (this._submitHandler) {
|
|
296
|
+
if (this._submitHandler != null) {
|
|
355
297
|
formElement.removeEventListener('submit', this._submitHandler);
|
|
356
298
|
}
|
|
357
299
|
// Create and store the submit handler
|
|
358
300
|
this._submitHandler = async (e) => {
|
|
359
301
|
const stripe = this.stripeService.getStripe();
|
|
360
|
-
const isCheckoutSession = this.stripeService.state.isCheckoutSession;
|
|
361
|
-
if (
|
|
302
|
+
const isCheckoutSession = this.stripeService.state.isCheckoutSession === true;
|
|
303
|
+
if (stripe == null) {
|
|
362
304
|
console.error('Stripe not properly initialized');
|
|
363
305
|
return;
|
|
364
306
|
}
|
|
365
|
-
// Build submit event props based on mode
|
|
366
|
-
const
|
|
307
|
+
// Build submit event props based on mode (shared with formSubmitEventHandler)
|
|
308
|
+
const result = buildSubmitEventProps({
|
|
367
309
|
stripe,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
submitEventProps.checkoutSessionClientSecret = this.checkoutSessionClientSecret;
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
// Payment Intent / Setup Intent mode
|
|
381
|
-
const elements = this.stripeService.getElements();
|
|
382
|
-
if (!elements) {
|
|
383
|
-
console.error('Elements not properly initialized');
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
submitEventProps.elements = elements;
|
|
387
|
-
submitEventProps.intentClientSecret = this.intentClientSecret;
|
|
310
|
+
isCheckoutSession,
|
|
311
|
+
checkout: this.stripeService.getCheckout(),
|
|
312
|
+
checkoutSessionClientSecret: this.checkoutSessionClientSecret,
|
|
313
|
+
elements: this.stripeService.getElements(),
|
|
314
|
+
intentClientSecret: this.intentClientSecret,
|
|
315
|
+
});
|
|
316
|
+
if ('error' in result) {
|
|
317
|
+
console.error(result.error);
|
|
318
|
+
return;
|
|
388
319
|
}
|
|
320
|
+
const submitEventProps = result.props;
|
|
389
321
|
this.progress = 'loading';
|
|
390
322
|
try {
|
|
391
|
-
if (this.handleSubmit) {
|
|
323
|
+
if (this.handleSubmit != null) {
|
|
392
324
|
await this.handleSubmit(e, submitEventProps);
|
|
393
325
|
}
|
|
394
326
|
else if (this.shouldUseDefaultFormSubmitAction === true) {
|
|
395
|
-
if (isCheckoutSession && submitEventProps.checkout) {
|
|
327
|
+
if (isCheckoutSession && submitEventProps.checkout != null) {
|
|
396
328
|
// Use Checkout Session confirmation
|
|
397
329
|
await this.checkoutSessionFormSubmitAction(e, submitEventProps.checkout);
|
|
398
330
|
}
|
|
399
|
-
else if (this.intentClientSecret) {
|
|
331
|
+
else if (this.intentClientSecret != null && this.intentClientSecret !== '') {
|
|
400
332
|
// Use Payment Intent / Setup Intent confirmation
|
|
401
333
|
await this.defaultFormSubmitAction(e, submitEventProps);
|
|
402
334
|
}
|
|
@@ -408,7 +340,7 @@ export class StripePaymentElement {
|
|
|
408
340
|
e.preventDefault();
|
|
409
341
|
}
|
|
410
342
|
await this.formSubmitEventHandler();
|
|
411
|
-
if (this.handleSubmit || this.shouldUseDefaultFormSubmitAction === true) {
|
|
343
|
+
if (this.handleSubmit != null || this.shouldUseDefaultFormSubmitAction === true) {
|
|
412
344
|
this.progress = 'success';
|
|
413
345
|
}
|
|
414
346
|
}
|
|
@@ -426,9 +358,9 @@ export class StripePaymentElement {
|
|
|
426
358
|
disconnectedCallback() {
|
|
427
359
|
this.paymentElementManager.unmount();
|
|
428
360
|
// Remove event listener to prevent memory leaks
|
|
429
|
-
if (this._submitHandler) {
|
|
361
|
+
if (this._submitHandler != null) {
|
|
430
362
|
const formElement = this.el.querySelector('#stripe-payment-element');
|
|
431
|
-
if (formElement) {
|
|
363
|
+
if (formElement != null) {
|
|
432
364
|
formElement.removeEventListener('submit', this._submitHandler);
|
|
433
365
|
}
|
|
434
366
|
}
|
|
@@ -439,12 +371,18 @@ export class StripePaymentElement {
|
|
|
439
371
|
if (loadStripeStatus === 'failure') {
|
|
440
372
|
return h("p", null, i18n.t('Failed to load Stripe'));
|
|
441
373
|
}
|
|
442
|
-
// Determine if button should be disabled
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
374
|
+
// Determine if button should be disabled (see isSubmitButtonDisabled helper for mode-specific rules)
|
|
375
|
+
const disabled = isSubmitButtonDisabled({
|
|
376
|
+
progress: this.progress,
|
|
377
|
+
isCheckoutSession: isCheckoutSession === true,
|
|
378
|
+
loadStripeStatus,
|
|
379
|
+
intentClientSecret: this.intentClientSecret,
|
|
380
|
+
});
|
|
381
|
+
return (
|
|
382
|
+
// NOTE: `stripe-payment-sheet-wrap` is a legacy CSS class kept for backward compatibility.
|
|
383
|
+
// It is a leftover from a former component name but is part of the public DOM contract,
|
|
384
|
+
// so external stylesheets may target it. Keep it in the rendered output and the .scss.
|
|
385
|
+
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))))));
|
|
448
386
|
}
|
|
449
387
|
static get is() { return "stripe-payment-element"; }
|
|
450
388
|
static get originalStyleUrls() {
|
|
@@ -469,7 +407,8 @@ export class StripePaymentElement {
|
|
|
469
407
|
"IntentType": {
|
|
470
408
|
"location": "import",
|
|
471
409
|
"path": "../../interfaces",
|
|
472
|
-
"id": "src/interfaces.ts::IntentType"
|
|
410
|
+
"id": "src/interfaces.ts::IntentType",
|
|
411
|
+
"referenceLocation": "IntentType"
|
|
473
412
|
}
|
|
474
413
|
}
|
|
475
414
|
},
|
|
@@ -686,7 +625,8 @@ export class StripePaymentElement {
|
|
|
686
625
|
"StripeDidLoadedHandler": {
|
|
687
626
|
"location": "import",
|
|
688
627
|
"path": "../../interfaces",
|
|
689
|
-
"id": "src/interfaces.ts::StripeDidLoadedHandler"
|
|
628
|
+
"id": "src/interfaces.ts::StripeDidLoadedHandler",
|
|
629
|
+
"referenceLocation": "StripeDidLoadedHandler"
|
|
690
630
|
}
|
|
691
631
|
}
|
|
692
632
|
},
|
|
@@ -727,7 +667,8 @@ export class StripePaymentElement {
|
|
|
727
667
|
"StripeLoadedEvent": {
|
|
728
668
|
"location": "import",
|
|
729
669
|
"path": "../../interfaces",
|
|
730
|
-
"id": "src/interfaces.ts::StripeLoadedEvent"
|
|
670
|
+
"id": "src/interfaces.ts::StripeLoadedEvent",
|
|
671
|
+
"referenceLocation": "StripeLoadedEvent"
|
|
731
672
|
}
|
|
732
673
|
}
|
|
733
674
|
}
|
|
@@ -746,7 +687,7 @@ export class StripePaymentElement {
|
|
|
746
687
|
},
|
|
747
688
|
"complexType": {
|
|
748
689
|
"original": "PaymentElementSubmitEvent",
|
|
749
|
-
"resolved": "{ stripe: Stripe; elements?: StripeElements; intentClientSecret?: string; checkout?:
|
|
690
|
+
"resolved": "{ stripe: Stripe; elements?: StripeElements; intentClientSecret?: string; checkout?: StripeCheckoutElementsSdk; checkoutSessionClientSecret?: string; }",
|
|
750
691
|
"references": {
|
|
751
692
|
"PaymentElementSubmitEvent": {
|
|
752
693
|
"location": "local",
|
|
@@ -775,7 +716,8 @@ export class StripePaymentElement {
|
|
|
775
716
|
"DefaultFormSubmitResult": {
|
|
776
717
|
"location": "import",
|
|
777
718
|
"path": "../../interfaces",
|
|
778
|
-
"id": "src/interfaces.ts::DefaultFormSubmitResult"
|
|
719
|
+
"id": "src/interfaces.ts::DefaultFormSubmitResult",
|
|
720
|
+
"referenceLocation": "DefaultFormSubmitResult"
|
|
779
721
|
}
|
|
780
722
|
}
|
|
781
723
|
}
|
|
@@ -827,7 +769,8 @@ export class StripePaymentElement {
|
|
|
827
769
|
"InitStripeOptions": {
|
|
828
770
|
"location": "import",
|
|
829
771
|
"path": "../../interfaces",
|
|
830
|
-
"id": "src/interfaces.ts::InitStripeOptions"
|
|
772
|
+
"id": "src/interfaces.ts::InitStripeOptions",
|
|
773
|
+
"referenceLocation": "InitStripeOptions"
|
|
831
774
|
}
|
|
832
775
|
},
|
|
833
776
|
"return": "Promise<void>"
|
|
@@ -908,7 +851,8 @@ export class StripePaymentElement {
|
|
|
908
851
|
"ProgressStatus": {
|
|
909
852
|
"location": "import",
|
|
910
853
|
"path": "../../interfaces",
|
|
911
|
-
"id": "src/interfaces.ts::ProgressStatus"
|
|
854
|
+
"id": "src/interfaces.ts::ProgressStatus",
|
|
855
|
+
"referenceLocation": "ProgressStatus"
|
|
912
856
|
}
|
|
913
857
|
},
|
|
914
858
|
"return": "Promise<this>"
|
|
@@ -976,4 +920,3 @@ export class StripePaymentElement {
|
|
|
976
920
|
}];
|
|
977
921
|
}
|
|
978
922
|
}
|
|
979
|
-
//# sourceMappingURL=stripe-payment-element.js.map
|
package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { loadStripe } from "@stripe/stripe-js";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated `stripe-payment-request-button` is deprecated and will be removed in a future release.
|
|
5
|
+
* `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
|
|
6
|
+
* Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
|
|
7
|
+
* and more via the modern Express Checkout Element API.
|
|
8
|
+
* Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/
|
|
9
|
+
*/
|
|
3
10
|
export class StripePaymentRequestButton {
|
|
4
11
|
/**
|
|
5
12
|
* Check isAvailable ApplePay or GooglePay.
|
|
@@ -69,6 +76,12 @@ export class StripePaymentRequestButton {
|
|
|
69
76
|
this.loadStripeStatus = 'failure';
|
|
70
77
|
}
|
|
71
78
|
}
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
console.warn('[stripe-pwa-elements] <stripe-payment-request-button> is deprecated. ' +
|
|
81
|
+
'stripe.paymentRequest() is being removed in Stripe.js 9.x (deprecated 2025-09-30 / removed 2026-03-25). ' +
|
|
82
|
+
'Please migrate to <stripe-express-checkout-element>, which supports Apple Pay, Google Pay, Link, PayPal, and more. ' +
|
|
83
|
+
'Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/');
|
|
84
|
+
}
|
|
72
85
|
/**
|
|
73
86
|
* @param option
|
|
74
87
|
* @private
|
|
@@ -174,7 +187,7 @@ export class StripePaymentRequestButton {
|
|
|
174
187
|
this.stripe = undefined;
|
|
175
188
|
}
|
|
176
189
|
render() {
|
|
177
|
-
return (h(Host, { key: '
|
|
190
|
+
return (h(Host, { key: '6340656e6d6f7ac25db9c42e8cd82be9e342640d' }, h("div", { key: '2c83b290ee0fc7663b15d6e5ee7a76380f54875b', id: "payment-request" }, h("div", { key: 'bff7ac4d9f5cba737fa7addbc594c275164ff04a', id: "payment-request-button" })), h("slot", { key: 'de55b77ffa140ba83a6de8592f95bc75f4ffabf5' })));
|
|
178
191
|
}
|
|
179
192
|
static get is() { return "stripe-payment-request-button"; }
|
|
180
193
|
static get originalStyleUrls() {
|
|
@@ -199,7 +212,8 @@ export class StripePaymentRequestButton {
|
|
|
199
212
|
"PaymentRequestPaymentMethodEventHandler": {
|
|
200
213
|
"location": "import",
|
|
201
214
|
"path": "../../interfaces",
|
|
202
|
-
"id": "src/interfaces.ts::PaymentRequestPaymentMethodEventHandler"
|
|
215
|
+
"id": "src/interfaces.ts::PaymentRequestPaymentMethodEventHandler",
|
|
216
|
+
"referenceLocation": "PaymentRequestPaymentMethodEventHandler"
|
|
203
217
|
}
|
|
204
218
|
}
|
|
205
219
|
},
|
|
@@ -225,7 +239,8 @@ export class StripePaymentRequestButton {
|
|
|
225
239
|
"PaymentRequestShippingOptionEventHandler": {
|
|
226
240
|
"location": "import",
|
|
227
241
|
"path": "../../interfaces",
|
|
228
|
-
"id": "src/interfaces.ts::PaymentRequestShippingOptionEventHandler"
|
|
242
|
+
"id": "src/interfaces.ts::PaymentRequestShippingOptionEventHandler",
|
|
243
|
+
"referenceLocation": "PaymentRequestShippingOptionEventHandler"
|
|
229
244
|
}
|
|
230
245
|
}
|
|
231
246
|
},
|
|
@@ -251,7 +266,8 @@ export class StripePaymentRequestButton {
|
|
|
251
266
|
"PaymentRequestShippingAddressEventHandler": {
|
|
252
267
|
"location": "import",
|
|
253
268
|
"path": "../../interfaces",
|
|
254
|
-
"id": "src/interfaces.ts::PaymentRequestShippingAddressEventHandler"
|
|
269
|
+
"id": "src/interfaces.ts::PaymentRequestShippingAddressEventHandler",
|
|
270
|
+
"referenceLocation": "PaymentRequestShippingAddressEventHandler"
|
|
255
271
|
}
|
|
256
272
|
}
|
|
257
273
|
},
|
|
@@ -338,7 +354,8 @@ export class StripePaymentRequestButton {
|
|
|
338
354
|
"StripeDidLoadedHandler": {
|
|
339
355
|
"location": "import",
|
|
340
356
|
"path": "../../interfaces",
|
|
341
|
-
"id": "src/interfaces.ts::StripeDidLoadedHandler"
|
|
357
|
+
"id": "src/interfaces.ts::StripeDidLoadedHandler",
|
|
358
|
+
"referenceLocation": "StripeDidLoadedHandler"
|
|
342
359
|
}
|
|
343
360
|
}
|
|
344
361
|
},
|
|
@@ -381,7 +398,8 @@ export class StripePaymentRequestButton {
|
|
|
381
398
|
"StripeLoadedEvent": {
|
|
382
399
|
"location": "import",
|
|
383
400
|
"path": "../../interfaces",
|
|
384
|
-
"id": "src/interfaces.ts::StripeLoadedEvent"
|
|
401
|
+
"id": "src/interfaces.ts::StripeLoadedEvent",
|
|
402
|
+
"referenceLocation": "StripeLoadedEvent"
|
|
385
403
|
}
|
|
386
404
|
}
|
|
387
405
|
}
|
|
@@ -405,7 +423,8 @@ export class StripePaymentRequestButton {
|
|
|
405
423
|
"PaymentRequestWallet": {
|
|
406
424
|
"location": "import",
|
|
407
425
|
"path": "@stripe/stripe-js",
|
|
408
|
-
"id": "node_modules::PaymentRequestWallet"
|
|
426
|
+
"id": "node_modules::PaymentRequestWallet",
|
|
427
|
+
"referenceLocation": "PaymentRequestWallet"
|
|
409
428
|
}
|
|
410
429
|
},
|
|
411
430
|
"return": "Promise<void>"
|
|
@@ -431,7 +450,8 @@ export class StripePaymentRequestButton {
|
|
|
431
450
|
"PaymentRequestPaymentMethodEventHandler": {
|
|
432
451
|
"location": "import",
|
|
433
452
|
"path": "../../interfaces",
|
|
434
|
-
"id": "src/interfaces.ts::PaymentRequestPaymentMethodEventHandler"
|
|
453
|
+
"id": "src/interfaces.ts::PaymentRequestPaymentMethodEventHandler",
|
|
454
|
+
"referenceLocation": "PaymentRequestPaymentMethodEventHandler"
|
|
435
455
|
}
|
|
436
456
|
},
|
|
437
457
|
"return": "Promise<void>"
|
|
@@ -457,7 +477,8 @@ export class StripePaymentRequestButton {
|
|
|
457
477
|
"PaymentRequestShippingOptionEventHandler": {
|
|
458
478
|
"location": "import",
|
|
459
479
|
"path": "../../interfaces",
|
|
460
|
-
"id": "src/interfaces.ts::PaymentRequestShippingOptionEventHandler"
|
|
480
|
+
"id": "src/interfaces.ts::PaymentRequestShippingOptionEventHandler",
|
|
481
|
+
"referenceLocation": "PaymentRequestShippingOptionEventHandler"
|
|
461
482
|
}
|
|
462
483
|
},
|
|
463
484
|
"return": "Promise<void>"
|
|
@@ -483,7 +504,8 @@ export class StripePaymentRequestButton {
|
|
|
483
504
|
"PaymentRequestShippingAddressEventHandler": {
|
|
484
505
|
"location": "import",
|
|
485
506
|
"path": "../../interfaces",
|
|
486
|
-
"id": "src/interfaces.ts::PaymentRequestShippingAddressEventHandler"
|
|
507
|
+
"id": "src/interfaces.ts::PaymentRequestShippingAddressEventHandler",
|
|
508
|
+
"referenceLocation": "PaymentRequestShippingAddressEventHandler"
|
|
487
509
|
}
|
|
488
510
|
},
|
|
489
511
|
"return": "Promise<void>"
|
|
@@ -509,7 +531,8 @@ export class StripePaymentRequestButton {
|
|
|
509
531
|
"PaymentRequestOptions": {
|
|
510
532
|
"location": "import",
|
|
511
533
|
"path": "@stripe/stripe-js",
|
|
512
|
-
"id": "node_modules::PaymentRequestOptions"
|
|
534
|
+
"id": "node_modules::PaymentRequestOptions",
|
|
535
|
+
"referenceLocation": "PaymentRequestOptions"
|
|
513
536
|
}
|
|
514
537
|
},
|
|
515
538
|
"return": "Promise<this>"
|
|
@@ -560,4 +583,3 @@ export class StripePaymentRequestButton {
|
|
|
560
583
|
}
|
|
561
584
|
static get elementRef() { return "el"; }
|
|
562
585
|
}
|
|
563
|
-
//# sourceMappingURL=stripe-payment-request-button.js.map
|
package/dist/collection/index.js
CHANGED
|
@@ -31,11 +31,11 @@ export class AddressElementManager {
|
|
|
31
31
|
*/
|
|
32
32
|
async initialize(containerElement, options) {
|
|
33
33
|
const elements = this.stripeService.getElements();
|
|
34
|
-
if (
|
|
34
|
+
if (elements == null) {
|
|
35
35
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
36
36
|
}
|
|
37
37
|
// Unmount if already initialized
|
|
38
|
-
if (this.addressElement) {
|
|
38
|
+
if (this.addressElement != null) {
|
|
39
39
|
this.unmount();
|
|
40
40
|
}
|
|
41
41
|
// Create and mount address element
|
|
@@ -73,11 +73,10 @@ export class AddressElementManager {
|
|
|
73
73
|
* Unmount address element
|
|
74
74
|
*/
|
|
75
75
|
unmount() {
|
|
76
|
-
if (
|
|
76
|
+
if (this.addressElement == null) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
this.addressElement.unmount();
|
|
80
80
|
this.addressElement = undefined;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
//# sourceMappingURL=address-element-manager.js.map
|
|
@@ -31,11 +31,11 @@ export class CardElementManager {
|
|
|
31
31
|
*/
|
|
32
32
|
async initialize(containerElement) {
|
|
33
33
|
const elements = this.stripeService.getElements();
|
|
34
|
-
if (
|
|
34
|
+
if (elements == null) {
|
|
35
35
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
36
36
|
}
|
|
37
37
|
// Unmount if already initialized
|
|
38
|
-
if (this.cardElements) {
|
|
38
|
+
if (this.cardElements != null) {
|
|
39
39
|
this.unmount();
|
|
40
40
|
}
|
|
41
41
|
// Create and mount card number element
|
|
@@ -86,7 +86,7 @@ export class CardElementManager {
|
|
|
86
86
|
*/
|
|
87
87
|
unmount() {
|
|
88
88
|
var _a, _b, _c;
|
|
89
|
-
if (
|
|
89
|
+
if (this.cardElements == null) {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
(_a = this.cardElements.cardNumber) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
@@ -114,4 +114,3 @@ export class CardElementManager {
|
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
//# sourceMappingURL=card-element-manager.js.map
|
|
@@ -32,11 +32,11 @@ export class CurrencySelectorElementManager {
|
|
|
32
32
|
*/
|
|
33
33
|
async initialize(containerElement, options) {
|
|
34
34
|
const elements = this.stripeService.getElements();
|
|
35
|
-
if (
|
|
35
|
+
if (elements == null) {
|
|
36
36
|
throw new Error('StripeService not initialized. Call StripeService.initialize() first.');
|
|
37
37
|
}
|
|
38
38
|
// Unmount if already initialized
|
|
39
|
-
if (this.currencySelectorElement) {
|
|
39
|
+
if (this.currencySelectorElement != null) {
|
|
40
40
|
this.unmount();
|
|
41
41
|
}
|
|
42
42
|
// Find mount point first to avoid element leak if findElement throws
|
|
@@ -82,11 +82,10 @@ export class CurrencySelectorElementManager {
|
|
|
82
82
|
* Unmount currency selector element
|
|
83
83
|
*/
|
|
84
84
|
unmount() {
|
|
85
|
-
if (
|
|
85
|
+
if (this.currencySelectorElement == null) {
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
this.currencySelectorElement.unmount();
|
|
89
89
|
this.currencySelectorElement = undefined;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
//# sourceMappingURL=currency-selector-element-manager.js.map
|