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 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const IonIcon = Icon;
|
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
|
5
|
-
|
|
6
|
-
export { IonIcon, defineCustomElement };
|
|
7
|
-
//# sourceMappingURL=ion-icon.js.map
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=ion-icon.js.map
|
|
1
|
+
import{I as o,d as s}from"./icon.js";const r=o,t=s;export{r as IonIcon,t as defineCustomElement}
|
|
@@ -1,327 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { c as checkPlatform } from './utils.js';
|
|
3
|
-
import { s as serviceFactory, i as i18n } from './factory.js';
|
|
4
|
-
|
|
5
|
-
const stripeAddressElementCss = ":root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:\"Roboto\", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap #address-element{margin-top:16px}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info.address{margin-bottom:16px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap .submit-button-wrapper{margin-top:32px}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}";
|
|
6
|
-
|
|
7
|
-
const StripeAddressElement$1 = /*@__PURE__*/ proxyCustomElement(class StripeAddressElement extends HTMLElement {
|
|
8
|
-
/**
|
|
9
|
-
* Get Stripe.js, and initialize elements
|
|
10
|
-
* @param publishableKey
|
|
11
|
-
* @param options
|
|
12
|
-
* @example
|
|
13
|
-
* ```
|
|
14
|
-
* const stripeElement = document.createElement('stripe-address-element');
|
|
15
|
-
* customElements
|
|
16
|
-
* .whenDefined('stripe-address-element')
|
|
17
|
-
* .then(() => {
|
|
18
|
-
* stripeElement.initStripe('pk_test_XXXXXXXXX')
|
|
19
|
-
* })
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
async initStripe(publishableKey, options) {
|
|
23
|
-
await this.stripeService.initialize(publishableKey, {
|
|
24
|
-
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
25
|
-
applicationName: this.applicationName,
|
|
26
|
-
});
|
|
27
|
-
// If already successfully loaded, initialize elements immediately
|
|
28
|
-
if (this.stripeService.state.loadStripeStatus === 'success') {
|
|
29
|
-
await this.initElement();
|
|
30
|
-
this.stripeLoadedEventHandler();
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// Otherwise, wait for successful load
|
|
34
|
-
const unsubscribe = this.stripeService.onChange('loadStripeStatus', async (newState) => {
|
|
35
|
-
if (newState !== 'success') {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
await this.initElement();
|
|
39
|
-
this.stripeLoadedEventHandler();
|
|
40
|
-
unsubscribe(); // Clean up listener after first success
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Update the form submit progress
|
|
46
|
-
* @param progress
|
|
47
|
-
* @returns
|
|
48
|
-
* @example
|
|
49
|
-
* ```
|
|
50
|
-
* const stripeElement = document.createElement('stripe-address-element');
|
|
51
|
-
* customElements
|
|
52
|
-
* .whenDefined('stripe-address-element')
|
|
53
|
-
* .then(() => {
|
|
54
|
-
* stripeElement.addEventListener('formSubmit', async props => {
|
|
55
|
-
* const { detail: { address } } = props;
|
|
56
|
-
* console.log('Address:', address);
|
|
57
|
-
* stripeElement.updateProgress('success')
|
|
58
|
-
* });
|
|
59
|
-
* })
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
async updateProgress(progress) {
|
|
63
|
-
this.progress = progress;
|
|
64
|
-
return this;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Set error message
|
|
68
|
-
* @param errorMessage string
|
|
69
|
-
* @returns
|
|
70
|
-
* @example
|
|
71
|
-
* ```
|
|
72
|
-
* const stripeElement = document.createElement('stripe-address-element');
|
|
73
|
-
* customElements
|
|
74
|
-
* .whenDefined('stripe-address-element')
|
|
75
|
-
* .then(() => {
|
|
76
|
-
* stripeElement.addEventListener('formSubmit', async props => {
|
|
77
|
-
* try {
|
|
78
|
-
* throw new Error('debug')
|
|
79
|
-
* } catch (e) {
|
|
80
|
-
* stripeElement.setErrorMessage(`Error: ${e.message}`)
|
|
81
|
-
* stripeElement.updateProgress('failure')
|
|
82
|
-
* }
|
|
83
|
-
* });
|
|
84
|
-
* })
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
async setErrorMessage(errorMessage) {
|
|
88
|
-
this.addressElementManager.setError(errorMessage);
|
|
89
|
-
return this;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Get the current address value
|
|
93
|
-
* @returns Promise resolving to the address value
|
|
94
|
-
* @example
|
|
95
|
-
* ```
|
|
96
|
-
* const stripeElement = document.querySelector('stripe-address-element');
|
|
97
|
-
* const addressValue = await stripeElement.getValue();
|
|
98
|
-
* console.log('Address:', addressValue);
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
async getValue() {
|
|
102
|
-
const addressElement = this.addressElementManager.getElement();
|
|
103
|
-
if (!addressElement) {
|
|
104
|
-
throw new Error('Address element not initialized');
|
|
105
|
-
}
|
|
106
|
-
const result = await addressElement.getValue();
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
updatePublishableKey(publishableKey) {
|
|
110
|
-
const options = {};
|
|
111
|
-
if (this.stripeAccount) {
|
|
112
|
-
options.stripeAccount = this.stripeAccount;
|
|
113
|
-
}
|
|
114
|
-
this.initStripe(publishableKey, Object.keys(options).length ? options : undefined);
|
|
115
|
-
}
|
|
116
|
-
updateStripeAccountId(stripeAccount) {
|
|
117
|
-
const publishableKey = this.stripeService.state.publishableKey || this.publishableKey;
|
|
118
|
-
if (!publishableKey) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
this.initStripe(publishableKey, {
|
|
122
|
-
stripeAccount,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
stripeLoadedEventHandler() {
|
|
126
|
-
const event = {
|
|
127
|
-
stripe: this.stripeService.getStripe(),
|
|
128
|
-
};
|
|
129
|
-
if (this.stripeDidLoaded) {
|
|
130
|
-
this.stripeDidLoaded(event);
|
|
131
|
-
}
|
|
132
|
-
this.stripeLoaded.emit(event);
|
|
133
|
-
}
|
|
134
|
-
async formSubmitEventHandler() {
|
|
135
|
-
const addressValue = await this.getValue();
|
|
136
|
-
this.formSubmit.emit({
|
|
137
|
-
address: addressValue,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
componentWillRender() {
|
|
141
|
-
if (!this.stripeService.state.publishableKey) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (['success', 'loading'].includes(this.stripeService.state.loadStripeStatus)) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
this.initStripe(this.stripeService.state.publishableKey, {
|
|
148
|
-
stripeAccount: this.stripeService.state.stripeAccount,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
constructor(registerHost) {
|
|
152
|
-
super();
|
|
153
|
-
if (registerHost !== false) {
|
|
154
|
-
this.__registerHost();
|
|
155
|
-
}
|
|
156
|
-
this.stripeLoaded = createEvent(this, "stripeLoaded", 7);
|
|
157
|
-
this.formSubmit = createEvent(this, "formSubmit", 7);
|
|
158
|
-
/**
|
|
159
|
-
* Address mode: 'shipping' or 'billing'
|
|
160
|
-
* @default 'billing'
|
|
161
|
-
*/
|
|
162
|
-
this.mode = 'billing';
|
|
163
|
-
/**
|
|
164
|
-
* Form title
|
|
165
|
-
* By default we recommended to use these string
|
|
166
|
-
* - 'Shipping address' for shipping mode
|
|
167
|
-
* - 'Billing address' for billing mode
|
|
168
|
-
* These strings will translated automatically by this library.
|
|
169
|
-
*/
|
|
170
|
-
this.sheetTitle = 'Billing address';
|
|
171
|
-
/**
|
|
172
|
-
* Submit button label
|
|
173
|
-
* By default we recommended to use these string
|
|
174
|
-
* - 'Save' or 'Continue'
|
|
175
|
-
* These strings will translated automatically by this library.
|
|
176
|
-
*/
|
|
177
|
-
this.buttonLabel = 'Save';
|
|
178
|
-
/**
|
|
179
|
-
* The progress status of the submission process
|
|
180
|
-
*/
|
|
181
|
-
this.progress = '';
|
|
182
|
-
/**
|
|
183
|
-
* Overwrite the application name that registered
|
|
184
|
-
* For wrapper library (like Capacitor)
|
|
185
|
-
*/
|
|
186
|
-
this.applicationName = 'stripe-pwa-elements';
|
|
187
|
-
/**
|
|
188
|
-
* Show the form label
|
|
189
|
-
*/
|
|
190
|
-
this.showLabel = false;
|
|
191
|
-
// Dependency Injection via factory
|
|
192
|
-
this.stripeService = serviceFactory.createStripeService();
|
|
193
|
-
this.addressElementManager = serviceFactory.createAddressElementManager(this.stripeService);
|
|
194
|
-
if (this.publishableKey) {
|
|
195
|
-
this.initStripe(this.publishableKey, {
|
|
196
|
-
stripeAccount: this.stripeAccount,
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Initialize Component using Stripe Address Element
|
|
202
|
-
*/
|
|
203
|
-
async initElement() {
|
|
204
|
-
// Prepare address element options
|
|
205
|
-
const addressOptions = {
|
|
206
|
-
mode: this.mode,
|
|
207
|
-
};
|
|
208
|
-
if (this.defaultCountry) {
|
|
209
|
-
addressOptions.defaultValues = {
|
|
210
|
-
address: {
|
|
211
|
-
country: this.defaultCountry,
|
|
212
|
-
},
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
if (this.allowedCountries && this.allowedCountries.length > 0) {
|
|
216
|
-
addressOptions.allowedCountries = this.allowedCountries;
|
|
217
|
-
}
|
|
218
|
-
// Initialize address element
|
|
219
|
-
await this.addressElementManager.initialize(this.el, addressOptions);
|
|
220
|
-
// Add form submit listener scoped to this component instance
|
|
221
|
-
const formElement = this.el.querySelector('#stripe-address-element-form');
|
|
222
|
-
if (!formElement) {
|
|
223
|
-
console.error('Form element #stripe-address-element-form not found');
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
// Remove previous listener if it exists to prevent duplicate submissions
|
|
227
|
-
if (this.formSubmitListener) {
|
|
228
|
-
formElement.removeEventListener('submit', this.formSubmitListener);
|
|
229
|
-
}
|
|
230
|
-
// Create and store the listener
|
|
231
|
-
this.formSubmitListener = async (e) => {
|
|
232
|
-
e.preventDefault();
|
|
233
|
-
const addressElement = this.addressElementManager.getElement();
|
|
234
|
-
if (!addressElement) {
|
|
235
|
-
console.error('Address element not initialized');
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
this.progress = 'loading';
|
|
239
|
-
try {
|
|
240
|
-
const addressValue = await this.getValue();
|
|
241
|
-
if (this.handleSubmit) {
|
|
242
|
-
await this.handleSubmit(e, { address: addressValue });
|
|
243
|
-
}
|
|
244
|
-
await this.formSubmitEventHandler();
|
|
245
|
-
if (this.handleSubmit) {
|
|
246
|
-
this.progress = 'success';
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
250
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
251
|
-
this.addressElementManager.setError(errorMessage);
|
|
252
|
-
this.progress = 'failure';
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
formElement.addEventListener('submit', this.formSubmitListener);
|
|
256
|
-
}
|
|
257
|
-
componentDidLoad() {
|
|
258
|
-
this.el.classList.add(checkPlatform());
|
|
259
|
-
}
|
|
260
|
-
disconnectedCallback() {
|
|
261
|
-
// Remove form submit listener
|
|
262
|
-
if (this.formSubmitListener) {
|
|
263
|
-
const formElement = this.el.querySelector('#stripe-address-element-form');
|
|
264
|
-
if (formElement) {
|
|
265
|
-
formElement.removeEventListener('submit', this.formSubmitListener);
|
|
266
|
-
}
|
|
267
|
-
this.formSubmitListener = undefined;
|
|
268
|
-
}
|
|
269
|
-
this.addressElementManager.unmount();
|
|
270
|
-
}
|
|
271
|
-
render() {
|
|
272
|
-
const { loadStripeStatus } = this.stripeService.state;
|
|
273
|
-
const { errorMessage } = this.addressElementManager.getState();
|
|
274
|
-
if (loadStripeStatus === 'failure') {
|
|
275
|
-
return h("p", null, i18n.t('Failed to load Stripe'));
|
|
276
|
-
}
|
|
277
|
-
const disabled = this.progress === 'loading';
|
|
278
|
-
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))))));
|
|
279
|
-
}
|
|
280
|
-
get el() { return this; }
|
|
281
|
-
static get watchers() { return {
|
|
282
|
-
"publishableKey": ["updatePublishableKey"],
|
|
283
|
-
"stripeAccount": ["updateStripeAccountId"]
|
|
284
|
-
}; }
|
|
285
|
-
static get style() { return stripeAddressElementCss; }
|
|
286
|
-
}, [256, "stripe-address-element", {
|
|
287
|
-
"mode": [1],
|
|
288
|
-
"sheetTitle": [1, "sheet-title"],
|
|
289
|
-
"buttonLabel": [1, "button-label"],
|
|
290
|
-
"publishableKey": [1, "publishable-key"],
|
|
291
|
-
"stripeAccount": [1, "stripe-account"],
|
|
292
|
-
"applicationName": [1, "application-name"],
|
|
293
|
-
"showLabel": [4, "show-label"],
|
|
294
|
-
"defaultCountry": [1, "default-country"],
|
|
295
|
-
"allowedCountries": [16],
|
|
296
|
-
"handleSubmit": [1040],
|
|
297
|
-
"stripeDidLoaded": [1040],
|
|
298
|
-
"progress": [32],
|
|
299
|
-
"initStripe": [64],
|
|
300
|
-
"updateProgress": [64],
|
|
301
|
-
"setErrorMessage": [64],
|
|
302
|
-
"getValue": [64]
|
|
303
|
-
}, undefined, {
|
|
304
|
-
"publishableKey": ["updatePublishableKey"],
|
|
305
|
-
"stripeAccount": ["updateStripeAccountId"]
|
|
306
|
-
}]);
|
|
307
|
-
function defineCustomElement$1() {
|
|
308
|
-
if (typeof customElements === "undefined") {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
const components = ["stripe-address-element"];
|
|
312
|
-
components.forEach(tagName => { switch (tagName) {
|
|
313
|
-
case "stripe-address-element":
|
|
314
|
-
if (!customElements.get(tagName)) {
|
|
315
|
-
customElements.define(tagName, StripeAddressElement$1);
|
|
316
|
-
}
|
|
317
|
-
break;
|
|
318
|
-
} });
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const StripeAddressElement = StripeAddressElement$1;
|
|
322
|
-
const defineCustomElement = defineCustomElement$1;
|
|
323
|
-
|
|
324
|
-
export { StripeAddressElement, defineCustomElement };
|
|
325
|
-
//# sourceMappingURL=stripe-address-element.js.map
|
|
326
|
-
|
|
327
|
-
//# sourceMappingURL=stripe-address-element.js.map
|
|
1
|
+
import{transformTag as t,proxyCustomElement as e,HTMLElement as s,createEvent as i,h as r}from"@stencil/core/internal/client";import{c as o}from"./utils.js";import{s as a,i as n}from"./factory.js";const l=e(class extends s{async initStripe(t,e){if(await this.stripeService.initialize(t,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName}),"success"===this.stripeService.state.loadStripeStatus)await this.initElement(),this.stripeLoadedEventHandler();else{const t=this.stripeService.onChange("loadStripeStatus",(async e=>{"success"===e&&(await this.initElement(),this.stripeLoadedEventHandler(),t())}))}}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.addressElementManager.setError(t),this}async getValue(){const t=this.addressElementManager.getElement();if(null==t)throw Error("Address element not initialized");return await t.getValue({format:"localized"})}updatePublishableKey(t){const e={};null!=this.stripeAccount&&""!==this.stripeAccount&&(e.stripeAccount=this.stripeAccount),this.initStripe(t,Object.keys(e).length>0?e:void 0)}updateStripeAccountId(t){const e=this.stripeService.state.publishableKey||this.publishableKey;null!=e&&""!==e&&this.initStripe(e,{stripeAccount:t})}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=await this.getValue();this.formSubmit.emit({address:t})}componentWillRender(){null!=this.stripeService.state.publishableKey&&""!==this.stripeService.state.publishableKey&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}))}constructor(t){super(),!1!==t&&this.__registerHost(),this.stripeLoaded=i(this,"stripeLoaded",7),this.formSubmit=i(this,"formSubmit",7),this.mode="billing",this.sheetTitle="Billing address",this.buttonLabel="Save",this.progress="",this.applicationName="stripe-pwa-elements",this.showLabel=!1,this.stripeService=a.createStripeService(),this.addressElementManager=a.createAddressElementManager(this.stripeService),null!=this.publishableKey&&""!==this.publishableKey&&this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount})}async initElement(){const t={mode:this.mode};null!=this.defaultCountry&&""!==this.defaultCountry&&(t.defaultValues={address:{country:this.defaultCountry}}),this.allowedCountries&&this.allowedCountries.length>0&&(t.allowedCountries=this.allowedCountries),await this.addressElementManager.initialize(this.el,t);const e=this.el.querySelector("#stripe-address-element-form");null!=e?(null!=this.formSubmitListener&&e.removeEventListener("submit",this.formSubmitListener),this.formSubmitListener=async t=>{if(t.preventDefault(),null!=this.addressElementManager.getElement()){this.progress="loading";try{const e=await this.getValue();null!=this.handleSubmit&&await this.handleSubmit(t,{address:e}),await this.formSubmitEventHandler(),null!=this.handleSubmit&&(this.progress="success")}catch(t){this.addressElementManager.setError(t instanceof Error?t.message:t+""),this.progress="failure"}}else console.error("Address element not initialized")},e.addEventListener("submit",this.formSubmitListener)):console.error("Form element #stripe-address-element-form not found")}componentDidLoad(){this.el.classList.add(o())}disconnectedCallback(){if(null!=this.formSubmitListener){const t=this.el.querySelector("#stripe-address-element-form");null!=t&&t.removeEventListener("submit",this.formSubmitListener),this.formSubmitListener=void 0}this.addressElementManager.unmount()}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:e}=this.addressElementManager.getState();if("failure"===t)return r("p",null,n.t("Failed to load Stripe"));const s="loading"===this.progress;return r("div",{class:"stripe-payment-sheet-wrap"},r("form",{id:"stripe-address-element-form"},r("div",{class:"stripe-heading"},n.t(this.sheetTitle)),r("div",{class:"payment-info address visible"},r("div",{id:"address-element"})),r("div",{id:"address-errors",class:"stripe-element-errors"},e),r("div",{class:"submit-button-wrapper"},r("button",{type:"submit",disabled:s},n.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return this}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}}static get style(){return':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap #address-element{margin-top:16px}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info.address{margin-bottom:16px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap .submit-button-wrapper{margin-top:32px}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}'}},[0,"stripe-address-element",{mode:[1],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],defaultCountry:[1,"default-country"],allowedCountries:[16],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],updateProgress:[64],setErrorMessage:[64],getValue:[64]},void 0,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]);function p(){"undefined"!=typeof customElements&&["stripe-address-element"].forEach((e=>{"stripe-address-element"===e&&(customElements.get(t(e))||customElements.define(t(e),l))}))}p();const d=l,h=p;export{d as StripeAddressElement,h as defineCustomElement}
|
|
@@ -1,174 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { d as defineCustomElement$5 } from './icon.js';
|
|
3
|
-
import { d as defineCustomElement$4 } from './stripe-card-element2.js';
|
|
4
|
-
import { d as defineCustomElement$3 } from './stripe-modal2.js';
|
|
5
|
-
import { d as defineCustomElement$2 } from './stripe-payment-request-button2.js';
|
|
6
|
-
|
|
7
|
-
const stripeCardElementModalCss = ":host{display:block}";
|
|
8
|
-
|
|
9
|
-
const StripeCardElementModal$1 = /*@__PURE__*/ proxyCustomElement(class StripeCardElementModal extends HTMLElement {
|
|
10
|
-
constructor(registerHost) {
|
|
11
|
-
super();
|
|
12
|
-
if (registerHost !== false) {
|
|
13
|
-
this.__registerHost();
|
|
14
|
-
}
|
|
15
|
-
this.closed = createEvent(this, "closed", 7);
|
|
16
|
-
/**
|
|
17
|
-
* Show the form label
|
|
18
|
-
*/
|
|
19
|
-
this.showLabel = false;
|
|
20
|
-
/**
|
|
21
|
-
* The component will provide a function to call the `stripe.confirmCardPayment`API.
|
|
22
|
-
* If you want to customize the behavior, should set false.
|
|
23
|
-
* And listen the 'formSubmit' event on the element
|
|
24
|
-
*/
|
|
25
|
-
this.shouldUseDefaultFormSubmitAction = true;
|
|
26
|
-
/**
|
|
27
|
-
* Default submit handle type.
|
|
28
|
-
* If you want to use `setupIntent`, should update this attribute.
|
|
29
|
-
* @example
|
|
30
|
-
* ```
|
|
31
|
-
* <stripe-card-element intent-type="setup" />
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
this.intentType = 'payment';
|
|
35
|
-
/**
|
|
36
|
-
* If true, the modal display close button
|
|
37
|
-
*/
|
|
38
|
-
this.showCloseButton = true;
|
|
39
|
-
/**
|
|
40
|
-
* If true, show zip code field
|
|
41
|
-
*/
|
|
42
|
-
this.zip = true;
|
|
43
|
-
/**
|
|
44
|
-
* Modal state.
|
|
45
|
-
* If true, the modal will open
|
|
46
|
-
*/
|
|
47
|
-
this.open = false;
|
|
48
|
-
}
|
|
49
|
-
componentDidLoad() {
|
|
50
|
-
const modal = this.el.querySelector('stripe-modal');
|
|
51
|
-
modal.addEventListener('close', () => {
|
|
52
|
-
this.closed.emit();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get the inner component
|
|
57
|
-
*/
|
|
58
|
-
async getStripeCardElementElement() {
|
|
59
|
-
return this.el.querySelector('stripe-card-element');
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* open modal
|
|
63
|
-
*/
|
|
64
|
-
async present() {
|
|
65
|
-
this.open = true;
|
|
66
|
-
return new Promise((resolve, reject) => {
|
|
67
|
-
const cardElement = this.el.querySelector('stripe-card-element');
|
|
68
|
-
cardElement.addEventListener('formSubmit', async (props) => {
|
|
69
|
-
resolve(props);
|
|
70
|
-
});
|
|
71
|
-
this.el.addEventListener('closed', () => reject());
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Update Stripe client loading process
|
|
76
|
-
*/
|
|
77
|
-
async updateProgress(progress) {
|
|
78
|
-
const cardElement = this.el.querySelector('stripe-card-element');
|
|
79
|
-
return cardElement.updateProgress(progress);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Remove the modal
|
|
83
|
-
*/
|
|
84
|
-
async destroy() {
|
|
85
|
-
const cardElement = this.el.querySelector('stripe-card-element');
|
|
86
|
-
cardElement.remove();
|
|
87
|
-
this.el.remove();
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* Add payment request button
|
|
92
|
-
*/
|
|
93
|
-
async setPaymentRequestButton(options) {
|
|
94
|
-
const elements = this.el.getElementsByTagName('stripe-card-element');
|
|
95
|
-
if (elements.length < 1) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const cardElement = elements[0];
|
|
99
|
-
if (!cardElement) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
cardElement.setAttribute('show-payment-request-button', 'true');
|
|
103
|
-
if (this.applicationName) {
|
|
104
|
-
cardElement.setAttribute('application-name', this.applicationName);
|
|
105
|
-
}
|
|
106
|
-
cardElement.setPaymentRequestOption(options);
|
|
107
|
-
}
|
|
108
|
-
render() {
|
|
109
|
-
return (h("stripe-modal", { key: '2cc1cef56eac36fbc6cc9b8f7aeb21cb0927f59a', open: this.open, showCloseButton: this.showCloseButton }, h("stripe-card-element", { key: 'c55d1d5d04c522cec081f04e653692d85c46eea6', showLabel: this.showLabel, publishableKey: this.publishableKey, intentClientSecret: this.intentClientSecret, shouldUseDefaultFormSubmitAction: this.shouldUseDefaultFormSubmitAction, handleSubmit: this.handleSubmit, stripeDidLoaded: this.stripeDidLoaded, intentType: this.intentType, zip: this.zip, buttonLabel: this.buttonLabel, sheetTitle: this.sheetTitle, applicationName: this.applicationName })));
|
|
110
|
-
}
|
|
111
|
-
get el() { return this; }
|
|
112
|
-
static get style() { return stripeCardElementModalCss; }
|
|
113
|
-
}, [256, "stripe-card-element-modal", {
|
|
114
|
-
"publishableKey": [1, "publishable-key"],
|
|
115
|
-
"stripeAccount": [1, "stripe-account"],
|
|
116
|
-
"applicationName": [1, "application-name"],
|
|
117
|
-
"showLabel": [4, "show-label"],
|
|
118
|
-
"sheetTitle": [1, "sheet-title"],
|
|
119
|
-
"buttonLabel": [1, "button-label"],
|
|
120
|
-
"intentClientSecret": [1, "intent-client-secret"],
|
|
121
|
-
"shouldUseDefaultFormSubmitAction": [4, "should-use-default-form-submit-action"],
|
|
122
|
-
"intentType": [1, "intent-type"],
|
|
123
|
-
"handleSubmit": [1040],
|
|
124
|
-
"stripeDidLoaded": [1040],
|
|
125
|
-
"showCloseButton": [4, "show-close-button"],
|
|
126
|
-
"zip": [4],
|
|
127
|
-
"open": [4],
|
|
128
|
-
"getStripeCardElementElement": [64],
|
|
129
|
-
"present": [64],
|
|
130
|
-
"updateProgress": [64],
|
|
131
|
-
"destroy": [64],
|
|
132
|
-
"setPaymentRequestButton": [64]
|
|
133
|
-
}]);
|
|
134
|
-
function defineCustomElement$1() {
|
|
135
|
-
if (typeof customElements === "undefined") {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const components = ["stripe-card-element-modal", "ion-icon", "stripe-card-element", "stripe-modal", "stripe-payment-request-button"];
|
|
139
|
-
components.forEach(tagName => { switch (tagName) {
|
|
140
|
-
case "stripe-card-element-modal":
|
|
141
|
-
if (!customElements.get(tagName)) {
|
|
142
|
-
customElements.define(tagName, StripeCardElementModal$1);
|
|
143
|
-
}
|
|
144
|
-
break;
|
|
145
|
-
case "ion-icon":
|
|
146
|
-
if (!customElements.get(tagName)) {
|
|
147
|
-
defineCustomElement$5();
|
|
148
|
-
}
|
|
149
|
-
break;
|
|
150
|
-
case "stripe-card-element":
|
|
151
|
-
if (!customElements.get(tagName)) {
|
|
152
|
-
defineCustomElement$4();
|
|
153
|
-
}
|
|
154
|
-
break;
|
|
155
|
-
case "stripe-modal":
|
|
156
|
-
if (!customElements.get(tagName)) {
|
|
157
|
-
defineCustomElement$3();
|
|
158
|
-
}
|
|
159
|
-
break;
|
|
160
|
-
case "stripe-payment-request-button":
|
|
161
|
-
if (!customElements.get(tagName)) {
|
|
162
|
-
defineCustomElement$2();
|
|
163
|
-
}
|
|
164
|
-
break;
|
|
165
|
-
} });
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const StripeCardElementModal = StripeCardElementModal$1;
|
|
169
|
-
const defineCustomElement = defineCustomElement$1;
|
|
170
|
-
|
|
171
|
-
export { StripeCardElementModal, defineCustomElement };
|
|
172
|
-
//# sourceMappingURL=stripe-card-element-modal.js.map
|
|
173
|
-
|
|
174
|
-
//# sourceMappingURL=stripe-card-element-modal.js.map
|
|
1
|
+
import{transformTag as e,proxyCustomElement as t,HTMLElement as s,createEvent as i,h as n}from"@stencil/core/internal/client";import{d as r}from"./icon.js";import{d as o}from"./stripe-card-element2.js";import{d as a}from"./stripe-modal2.js";import{d as l}from"./stripe-payment-request-button2.js";const m=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.closed=i(this,"closed",7),this.showLabel=!1,this.shouldUseDefaultFormSubmitAction=!0,this.intentType="payment",this.showCloseButton=!0,this.zip=!0,this.open=!1}componentDidLoad(){this.el.querySelector("stripe-modal").addEventListener("close",(()=>{this.closed.emit()}))}async getStripeCardElementElement(){return this.el.querySelector("stripe-card-element")}async present(){return this.open=!0,new Promise(((e,t)=>{this.el.querySelector("stripe-card-element").addEventListener("formSubmit",(async t=>{e(t)})),this.el.addEventListener("closed",(()=>t()))}))}async updateProgress(e){return this.el.querySelector("stripe-card-element").updateProgress(e)}async destroy(){this.el.querySelector("stripe-card-element").remove(),this.el.remove()}async setPaymentRequestButton(e){const t=this.el.getElementsByTagName("stripe-card-element");if(t.length<1)return;const s=t[0];s&&(s.setAttribute("show-payment-request-button","true"),this.applicationName&&s.setAttribute("application-name",this.applicationName),s.setPaymentRequestOption(e))}render(){return n("stripe-modal",{key:"236b4910e4f2ff792def134e7726623f2a09475e",open:this.open,showCloseButton:this.showCloseButton},n("stripe-card-element",{key:"5748af4f6df67571289236435c7481d6f445fce8",showLabel:this.showLabel,publishableKey:this.publishableKey,intentClientSecret:this.intentClientSecret,shouldUseDefaultFormSubmitAction:this.shouldUseDefaultFormSubmitAction,handleSubmit:this.handleSubmit,stripeDidLoaded:this.stripeDidLoaded,intentType:this.intentType,zip:this.zip,buttonLabel:this.buttonLabel,sheetTitle:this.sheetTitle,applicationName:this.applicationName}))}get el(){return this}static get style(){return"stripe-card-element-modal{display:block}"}},[0,"stripe-card-element-modal",{publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],intentClientSecret:[1,"intent-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],intentType:[1,"intent-type"],handleSubmit:[1040],stripeDidLoaded:[1040],showCloseButton:[4,"show-close-button"],zip:[4],open:[4],getStripeCardElementElement:[64],present:[64],updateProgress:[64],destroy:[64],setPaymentRequestButton:[64]}]);function c(){"undefined"!=typeof customElements&&["stripe-card-element-modal","ion-icon","stripe-card-element","stripe-modal","stripe-payment-request-button"].forEach((t=>{switch(t){case"stripe-card-element-modal":customElements.get(e(t))||customElements.define(e(t),m);break;case"ion-icon":customElements.get(e(t))||r();break;case"stripe-card-element":customElements.get(e(t))||o();break;case"stripe-modal":customElements.get(e(t))||a();break;case"stripe-payment-request-button":customElements.get(e(t))||l()}}))}c();const p=m,u=c;export{p as StripeCardElementModal,u as defineCustomElement}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const StripeCardElement = StripeCardElement$1;
|
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
|
5
|
-
|
|
6
|
-
export { StripeCardElement, defineCustomElement };
|
|
7
|
-
//# sourceMappingURL=stripe-card-element.js.map
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=stripe-card-element.js.map
|
|
1
|
+
import{S as e,d as r}from"./stripe-card-element2.js";const s=e,t=r;export{s as StripeCardElement,t as defineCustomElement}
|