stripe-pwa-elements 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -3
- package/dist/cjs/error-FFC4kSs5.js +0 -3
- package/dist/cjs/{factory-Hsw0e7-d.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 +135 -73
- 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.css +2 -2
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +16 -12
- 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.css +36 -2
- package/dist/collection/components/stripe-modal/stripe-modal.js +34 -7
- 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 +5 -0
- 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 -88
- 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-Li_TGt9P.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 +135 -73
- 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-modal/stripe-modal.d.ts +6 -0
- 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/dist/types/utils/test-setup.d.ts +1 -0
- 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-Hsw0e7-d.js.map +0 -1
- package/dist/cjs/index-Ba1pBePA.js.map +0 -1
- package/dist/cjs/index-C1haN5iF.js +0 -1907
- package/dist/cjs/index-C1haN5iF.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/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-Li_TGt9P.js.map +0 -1
- package/dist/esm/index-BHDCxQOb.js.map +0 -1
- package/dist/esm/index-Dkis4t79.js +0 -1895
- package/dist/esm/index-Dkis4t79.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-01d63033.entry.js +0 -2
- package/dist/stripe-elements/p-01d63033.entry.js.map +0 -1
- package/dist/stripe-elements/p-1b8f9c7f.entry.js +0 -2
- package/dist/stripe-elements/p-1b8f9c7f.entry.js.map +0 -1
- package/dist/stripe-elements/p-37008853.entry.js +0 -2
- package/dist/stripe-elements/p-37008853.entry.js.map +0 -1
- package/dist/stripe-elements/p-5d152193.entry.js +0 -2
- package/dist/stripe-elements/p-5d152193.entry.js.map +0 -1
- package/dist/stripe-elements/p-623f13e6.entry.js +0 -2
- package/dist/stripe-elements/p-623f13e6.entry.js.map +0 -1
- package/dist/stripe-elements/p-809c9f2f.entry.js +0 -2
- package/dist/stripe-elements/p-809c9f2f.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-DQuL1Twl.js.map +0 -1
- package/dist/stripe-elements/p-Dkis4t79.js +0 -3
- package/dist/stripe-elements/p-Dkis4t79.js.map +0 -1
- package/dist/stripe-elements/p-WnA32N4v.js +0 -2
- package/dist/stripe-elements/p-WnA32N4v.js.map +0 -1
- package/dist/stripe-elements/p-XRfh5Wrs.js.map +0 -1
- package/dist/stripe-elements/p-ba41e196.entry.js +0 -2
- package/dist/stripe-elements/p-ba41e196.entry.js.map +0 -1
- package/dist/stripe-elements/p-bb1bc49a.entry.js +0 -2
- package/dist/stripe-elements/p-bb1bc49a.entry.js.map +0 -1
- package/dist/stripe-elements/p-f21ea941.entry.js +0 -2
- package/dist/stripe-elements/p-f21ea941.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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
4
|
-
var index = require('./index-
|
|
3
|
+
var index$1 = require('./index-Dkb0SxZc.js');
|
|
4
|
+
var index = require('./index-CYbA1N_k.js');
|
|
5
5
|
|
|
6
|
-
const stripePaymentRequestButtonCss =
|
|
6
|
+
const stripePaymentRequestButtonCss = () => `:host{display:block}`;
|
|
7
7
|
|
|
8
8
|
const StripePaymentRequestButton = class {
|
|
9
9
|
/**
|
|
@@ -60,7 +60,7 @@ const StripePaymentRequestButton = class {
|
|
|
60
60
|
}
|
|
61
61
|
constructor(hostRef) {
|
|
62
62
|
index$1.registerInstance(this, hostRef);
|
|
63
|
-
this.stripeLoaded = index$1.createEvent(this, "stripeLoaded");
|
|
63
|
+
this.stripeLoaded = index$1.createEvent(this, "stripeLoaded", 7);
|
|
64
64
|
this.loadStripeStatus = '';
|
|
65
65
|
/**
|
|
66
66
|
* Overwrite the application name that registered
|
|
@@ -76,6 +76,12 @@ const StripePaymentRequestButton = class {
|
|
|
76
76
|
this.loadStripeStatus = 'failure';
|
|
77
77
|
}
|
|
78
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
|
+
}
|
|
79
85
|
/**
|
|
80
86
|
* @param option
|
|
81
87
|
* @private
|
|
@@ -181,11 +187,10 @@ const StripePaymentRequestButton = class {
|
|
|
181
187
|
this.stripe = undefined;
|
|
182
188
|
}
|
|
183
189
|
render() {
|
|
184
|
-
return (index$1.h(index$1.Host, { key: '
|
|
190
|
+
return (index$1.h(index$1.Host, { key: '6340656e6d6f7ac25db9c42e8cd82be9e342640d' }, index$1.h("div", { key: '2c83b290ee0fc7663b15d6e5ee7a76380f54875b', id: "payment-request" }, index$1.h("div", { key: 'bff7ac4d9f5cba737fa7addbc594c275164ff04a', id: "payment-request-button" })), index$1.h("slot", { key: 'de55b77ffa140ba83a6de8592f95bc75f4ffabf5' })));
|
|
185
191
|
}
|
|
186
192
|
get el() { return index$1.getElement(this); }
|
|
187
193
|
};
|
|
188
|
-
StripePaymentRequestButton.style = stripePaymentRequestButtonCss;
|
|
194
|
+
StripePaymentRequestButton.style = stripePaymentRequestButtonCss();
|
|
189
195
|
|
|
190
196
|
exports.stripe_payment_request_button = StripePaymentRequestButton;
|
|
191
|
-
//# sourceMappingURL=stripe-payment-request-button.entry.cjs.js.map
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
"components/stripe-modal/stripe-modal.js",
|
|
11
11
|
"components/stripe-payment-request-button/stripe-payment-request-button.js"
|
|
12
12
|
],
|
|
13
|
+
"mixins": [],
|
|
13
14
|
"compiler": {
|
|
14
15
|
"name": "@stencil/core",
|
|
15
|
-
"version": "4.
|
|
16
|
-
"typescriptVersion": "5.
|
|
16
|
+
"version": "4.43.5",
|
|
17
|
+
"typescriptVersion": "5.8.3"
|
|
17
18
|
},
|
|
18
19
|
"collections": [
|
|
19
20
|
{
|
|
@@ -98,22 +98,23 @@ export class StripeAddressElement {
|
|
|
98
98
|
*/
|
|
99
99
|
async getValue() {
|
|
100
100
|
const addressElement = this.addressElementManager.getElement();
|
|
101
|
-
if (
|
|
101
|
+
if (addressElement == null) {
|
|
102
102
|
throw new Error('Address element not initialized');
|
|
103
103
|
}
|
|
104
|
-
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
-
*
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
options.stripeAccount = this.stripeAccount;
|
|
102
|
+
if (publishableKey == null || publishableKey === '') {
|
|
103
|
+
return;
|
|
102
104
|
}
|
|
103
|
-
this.initStripe(publishableKey,
|
|
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 (
|
|
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 (
|
|
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
|
-
|
|
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.
|
|
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
|
|
170
|
-
|
|
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 (
|
|
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 (
|
|
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 ||
|
|
316
|
+
if (!showPaymentRequestButton || paymentRequestOption == null) {
|
|
332
317
|
return null;
|
|
333
318
|
}
|
|
334
|
-
if (
|
|
319
|
+
if (document == null) {
|
|
335
320
|
return null;
|
|
336
321
|
}
|
|
337
322
|
const targetElement = this.el.querySelector('#stripe-payment-request-button');
|
|
338
|
-
if (
|
|
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
|
|
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 (
|
|
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
|
|
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
|