stripe-pwa-elements 4.0.0 → 4.0.2
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/factory-tenFFIul.js +1200 -0
- package/dist/cjs/{factory-da3xAKkz.js → i18n-FhEOc8vz.js} +6 -1131
- package/dist/cjs/ion-icon_2.cjs.entry.js +723 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stripe-address-element.cjs.entry.js +12 -4
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +3 -2
- package/dist/cjs/{stripe-card-element_2.cjs.entry.js → stripe-card-element.cjs.entry.js} +15 -82
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +11 -3
- package/dist/cjs/stripe-elements.cjs.js +1 -1
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +31 -5
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +11 -3
- package/dist/cjs/stripe-payment-element.cjs.entry.js +106 -161
- package/dist/cjs/stripe-payment-element.helpers-DukP33RI.js +122 -0
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +23 -16
- package/dist/cjs/stripe-payment-sheet.cjs.entry.js +506 -0
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +7 -0
- package/dist/collection/components/stripe-card-element/stripe-card-element.js +10 -2
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +7 -0
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +25 -0
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +7 -0
- package/dist/collection/components/stripe-modal/stripe-modal.css +23 -1
- package/dist/collection/components/stripe-modal/stripe-modal.js +147 -6
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +94 -37
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +17 -10
- package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +179 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +90 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +544 -0
- package/dist/collection/services/express-checkout-element-manager.js +36 -2
- package/dist/collection/services/stripe-service.js +37 -5
- package/dist/collection/utils/focus.js +76 -0
- package/dist/collection/utils/i18n.js +6 -0
- package/dist/components/factory.js +1 -1
- package/dist/components/i18n.js +1 -0
- package/dist/components/stripe-address-element.js +1 -1
- package/dist/components/stripe-card-element-modal.js +1 -1
- package/dist/components/stripe-card-element2.js +1 -1
- package/dist/components/stripe-currency-selector.js +1 -1
- package/dist/components/stripe-express-checkout-element.js +1 -1
- package/dist/components/stripe-link-authentication-element.js +1 -1
- package/dist/components/stripe-modal2.js +1 -1
- package/dist/components/stripe-payment-element.helpers.js +1 -0
- package/dist/components/stripe-payment-element.js +1 -1
- package/dist/components/stripe-payment-request-button2.js +1 -1
- package/dist/components/stripe-payment-sheet.d.ts +11 -0
- package/dist/components/stripe-payment-sheet.js +1 -0
- package/dist/esm/factory-Cd6OGTWN.js +1198 -0
- package/dist/esm/{factory-DeqoYLf_.js → i18n-B6JoQetF.js} +7 -1131
- package/dist/esm/ion-icon_2.entry.js +720 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stripe-address-element.entry.js +9 -1
- package/dist/esm/stripe-card-element-modal.entry.js +3 -2
- package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +13 -79
- package/dist/esm/stripe-currency-selector.entry.js +9 -1
- package/dist/esm/stripe-elements.js +1 -1
- package/dist/esm/stripe-express-checkout-element.entry.js +27 -1
- package/dist/esm/stripe-link-authentication-element.entry.js +9 -1
- package/dist/esm/stripe-payment-element.entry.js +98 -153
- package/dist/esm/stripe-payment-element.helpers-CipV87b8.js +117 -0
- package/dist/esm/stripe-payment-request-button.entry.js +18 -11
- package/dist/esm/stripe-payment-sheet.entry.js +504 -0
- package/dist/stripe-elements/{p-38e7b187.entry.js → p-4891edf0.entry.js} +1 -1
- package/dist/stripe-elements/p-5338bc5e.entry.js +1 -0
- package/dist/stripe-elements/p-6a9c8b7a.entry.js +1 -0
- package/dist/stripe-elements/p-7fe4a287.entry.js +1 -0
- package/dist/stripe-elements/p-915b86ed.entry.js +1 -0
- package/dist/stripe-elements/p-B6JoQetF.js +1 -0
- package/dist/stripe-elements/p-C7MQk9FK.js +1 -0
- package/dist/stripe-elements/p-DFAhQS0n.js +1 -0
- package/dist/stripe-elements/p-b06a254f.entry.js +1 -0
- package/dist/stripe-elements/p-b91c4fa7.entry.js +1 -0
- package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
- package/dist/stripe-elements/p-e7372ca7.entry.js +1 -0
- package/dist/stripe-elements/p-f892e375.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -1
- package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +8 -1
- package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
- package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
- package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +11 -0
- package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
- package/dist/types/components/stripe-modal/stripe-modal.d.ts +44 -0
- package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +18 -0
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +7 -2
- package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +104 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +112 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +95 -0
- package/dist/types/components.d.ts +169 -10
- package/dist/types/index.d.ts +2 -0
- package/dist/types/services/interfaces.d.ts +2 -0
- package/dist/types/services/stripe-service.d.ts +12 -3
- package/dist/types/utils/focus.d.ts +15 -0
- package/package.json +5 -3
- package/readme.md +46 -10
- package/dist/cjs/ion-icon.cjs.entry.js +0 -431
- package/dist/components/utils.js +0 -1
- package/dist/esm/ion-icon.entry.js +0 -429
- package/dist/stripe-elements/p--sA2m1ad.js +0 -1
- package/dist/stripe-elements/p-44495284.entry.js +0 -1
- package/dist/stripe-elements/p-4ba675fa.entry.js +0 -1
- package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
- package/dist/stripe-elements/p-c24ae181.entry.js +0 -1
- package/dist/stripe-elements/p-d9e86451.entry.js +0 -1
- package/dist/stripe-elements/p-f09c86a0.entry.js +0 -1
- package/dist/stripe-elements/p-f64f394d.entry.js +0 -1
- package/dist/stripe-elements/p-f6d2425e.entry.js +0 -1
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { r as registerInstance, a as createEvent, h, d as Host, g as getElement } from './index-C6bbmyga.js';
|
|
2
|
+
import { c as checkPlatform, i as i18n } from './i18n-B6JoQetF.js';
|
|
3
|
+
import { s as serviceFactory } from './factory-Cd6OGTWN.js';
|
|
4
|
+
import { c as confirmPaymentOrSetup } from './stripe-payment-element.helpers-CipV87b8.js';
|
|
5
|
+
import './index-CBXaOfXU.js';
|
|
6
|
+
import './error-XRfh5Wrs.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* State machine behind `<stripe-payment-sheet>`.
|
|
10
|
+
*
|
|
11
|
+
* Pure functions only: the component feeds events in and performs the returned effects
|
|
12
|
+
* (loading Stripe.js, showing the modal, confirming, emitting events, resolving `present()`).
|
|
13
|
+
* The same rules are model-checked in Quint; see the exhaustive test next to this file.
|
|
14
|
+
*/
|
|
15
|
+
const initialSheetState = {
|
|
16
|
+
phase: 'idle',
|
|
17
|
+
generation: 0,
|
|
18
|
+
pendingPresent: false,
|
|
19
|
+
openRequested: false,
|
|
20
|
+
};
|
|
21
|
+
const CLIENT_SECRET_PATTERNS = [
|
|
22
|
+
[/^pi_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/, 'payment'],
|
|
23
|
+
[/^seti_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/, 'setup'],
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* Tell whether a client secret belongs to a PaymentIntent or a SetupIntent from its prefix.
|
|
27
|
+
* @param clientSecret - The `client_secret` of a PaymentIntent (`pi_..._secret_...`) or SetupIntent (`seti_..._secret_...`)
|
|
28
|
+
* @returns The intent kind, or undefined when the format is not recognized
|
|
29
|
+
*/
|
|
30
|
+
const intentKindFromClientSecret = (clientSecret) => {
|
|
31
|
+
const match = CLIENT_SECRET_PATTERNS.find(([pattern]) => pattern.test(clientSecret));
|
|
32
|
+
return match === null || match === void 0 ? void 0 : match[1];
|
|
33
|
+
};
|
|
34
|
+
const unchanged = (state) => ({ state, effects: [] });
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the pending `present()` promise, if any.
|
|
37
|
+
*/
|
|
38
|
+
const resolvePending = (state, result) => {
|
|
39
|
+
if (!state.pendingPresent) {
|
|
40
|
+
return unchanged(state);
|
|
41
|
+
}
|
|
42
|
+
return { state: Object.assign(Object.assign({}, state), { pendingPresent: false }), effects: [{ type: 'resolvePresent', result }] };
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Close the sheet as canceled: hide it, emit the event and resolve `present()`.
|
|
46
|
+
*/
|
|
47
|
+
const cancel = (state) => {
|
|
48
|
+
const resolved = resolvePending(Object.assign(Object.assign({}, state), { openRequested: false }), 'paymentSheetCanceled');
|
|
49
|
+
const visible = state.phase === 'presented' || state.phase === 'confirming';
|
|
50
|
+
return {
|
|
51
|
+
state: resolved.state,
|
|
52
|
+
effects: [...(visible ? [{ type: 'hide' }] : []), { type: 'emit', event: 'paymentSheetCanceled' }, ...resolved.effects],
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const changeSecret = (state, clientSecret) => {
|
|
56
|
+
if (clientSecret === '') {
|
|
57
|
+
return unchanged(state);
|
|
58
|
+
}
|
|
59
|
+
// Never drop the result of a running confirmation; apply the new secret once it finishes
|
|
60
|
+
if (state.phase === 'confirming') {
|
|
61
|
+
return unchanged(Object.assign(Object.assign({}, state), { deferredClientSecret: clientSecret }));
|
|
62
|
+
}
|
|
63
|
+
const canceled = state.phase === 'presented' ? cancel(state) : unchanged(state);
|
|
64
|
+
const generation = state.generation + 1;
|
|
65
|
+
const intentKind = intentKindFromClientSecret(clientSecret);
|
|
66
|
+
if (intentKind == null) {
|
|
67
|
+
const resolved = resolvePending(Object.assign(Object.assign({}, canceled.state), { phase: 'loadFailed', generation, intentKind: undefined, openRequested: false }), 'paymentSheetFailed');
|
|
68
|
+
return {
|
|
69
|
+
state: resolved.state,
|
|
70
|
+
effects: [...canceled.effects, { type: 'emit', event: 'paymentSheetFailedToLoad' }, ...resolved.effects],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
state: Object.assign(Object.assign({}, canceled.state), { phase: 'loading', generation, intentKind }),
|
|
75
|
+
effects: [...canceled.effects, { type: 'load', generation, clientSecret, intentKind }],
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Apply a secret that arrived while confirming.
|
|
80
|
+
*/
|
|
81
|
+
const applyDeferredSecret = (result) => {
|
|
82
|
+
const { deferredClientSecret } = result.state;
|
|
83
|
+
if (deferredClientSecret == null) {
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
const next = changeSecret(Object.assign(Object.assign({}, result.state), { deferredClientSecret: undefined }), deferredClientSecret);
|
|
87
|
+
return { state: next.state, effects: [...result.effects, ...next.effects] };
|
|
88
|
+
};
|
|
89
|
+
const isCurrentConfirmation = (state, generation) => state.phase === 'confirming' && state.generation === generation;
|
|
90
|
+
/**
|
|
91
|
+
* Compute the next state and the effects to perform for an event.
|
|
92
|
+
* @param state - Current state
|
|
93
|
+
* @param event - Event to handle
|
|
94
|
+
*/
|
|
95
|
+
const transition = (state, event) => {
|
|
96
|
+
switch (event.type) {
|
|
97
|
+
case 'secretChanged':
|
|
98
|
+
return changeSecret(state, event.clientSecret);
|
|
99
|
+
case 'loadSucceeded': {
|
|
100
|
+
if (event.generation !== state.generation || state.phase !== 'loading') {
|
|
101
|
+
return unchanged(state);
|
|
102
|
+
}
|
|
103
|
+
const open = state.openRequested;
|
|
104
|
+
return {
|
|
105
|
+
state: Object.assign(Object.assign({}, state), { phase: open ? 'presented' : 'ready', openRequested: false }),
|
|
106
|
+
effects: [{ type: 'emit', event: 'paymentSheetLoaded' }, ...(open ? [{ type: 'show' }] : [])],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
case 'loadFailed': {
|
|
110
|
+
if (event.generation !== state.generation || state.phase !== 'loading') {
|
|
111
|
+
return unchanged(state);
|
|
112
|
+
}
|
|
113
|
+
const resolved = resolvePending(Object.assign(Object.assign({}, state), { phase: 'loadFailed', openRequested: false }), 'paymentSheetFailed');
|
|
114
|
+
return { state: resolved.state, effects: [{ type: 'emit', event: 'paymentSheetFailedToLoad' }, ...resolved.effects] };
|
|
115
|
+
}
|
|
116
|
+
case 'presentRequested':
|
|
117
|
+
if (state.pendingPresent) {
|
|
118
|
+
return unchanged(state);
|
|
119
|
+
}
|
|
120
|
+
switch (state.phase) {
|
|
121
|
+
case 'ready':
|
|
122
|
+
return { state: Object.assign(Object.assign({}, state), { phase: 'presented', pendingPresent: true }), effects: [{ type: 'show' }] };
|
|
123
|
+
case 'idle':
|
|
124
|
+
case 'loading':
|
|
125
|
+
return unchanged(Object.assign(Object.assign({}, state), { pendingPresent: true, openRequested: true }));
|
|
126
|
+
case 'presented':
|
|
127
|
+
case 'confirming':
|
|
128
|
+
// Already shown through the `open` attribute: wait for its result
|
|
129
|
+
return unchanged(Object.assign(Object.assign({}, state), { pendingPresent: true }));
|
|
130
|
+
default:
|
|
131
|
+
// loadFailed / completed / errored: nothing can be shown
|
|
132
|
+
return { state, effects: [{ type: 'resolvePresent', result: 'paymentSheetFailed' }] };
|
|
133
|
+
}
|
|
134
|
+
case 'openRequested':
|
|
135
|
+
if (state.phase === 'ready') {
|
|
136
|
+
return { state: Object.assign(Object.assign({}, state), { phase: 'presented' }), effects: [{ type: 'show' }] };
|
|
137
|
+
}
|
|
138
|
+
if (state.phase === 'idle' || state.phase === 'loading') {
|
|
139
|
+
return unchanged(Object.assign(Object.assign({}, state), { openRequested: true }));
|
|
140
|
+
}
|
|
141
|
+
return unchanged(state);
|
|
142
|
+
case 'closeRequested':
|
|
143
|
+
if (state.phase === 'presented') {
|
|
144
|
+
const canceled = cancel(state);
|
|
145
|
+
return { state: Object.assign(Object.assign({}, canceled.state), { phase: 'ready' }), effects: canceled.effects };
|
|
146
|
+
}
|
|
147
|
+
// Closing before the sheet was shown withdraws the request to open it
|
|
148
|
+
if ((state.phase === 'idle' || state.phase === 'loading') && state.openRequested) {
|
|
149
|
+
return cancel(state);
|
|
150
|
+
}
|
|
151
|
+
return unchanged(state);
|
|
152
|
+
case 'submitted':
|
|
153
|
+
if (state.phase !== 'presented' || state.intentKind == null) {
|
|
154
|
+
return unchanged(state);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
state: Object.assign(Object.assign({}, state), { phase: 'confirming' }),
|
|
158
|
+
effects: [{ type: 'confirm', generation: state.generation, intentKind: state.intentKind }],
|
|
159
|
+
};
|
|
160
|
+
case 'confirmSucceeded': {
|
|
161
|
+
if (!isCurrentConfirmation(state, event.generation)) {
|
|
162
|
+
return unchanged(state);
|
|
163
|
+
}
|
|
164
|
+
const resolved = resolvePending(Object.assign(Object.assign({}, state), { phase: 'completed' }), 'paymentSheetCompleted');
|
|
165
|
+
return applyDeferredSecret({
|
|
166
|
+
state: resolved.state,
|
|
167
|
+
effects: [{ type: 'hide' }, { type: 'emit', event: 'paymentSheetCompleted' }, ...resolved.effects],
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
case 'confirmDeclined':
|
|
171
|
+
if (!isCurrentConfirmation(state, event.generation)) {
|
|
172
|
+
return unchanged(state);
|
|
173
|
+
}
|
|
174
|
+
return applyDeferredSecret({ state: Object.assign(Object.assign({}, state), { phase: 'presented' }), effects: [{ type: 'showError', message: event.message }] });
|
|
175
|
+
case 'confirmFailed': {
|
|
176
|
+
if (!isCurrentConfirmation(state, event.generation)) {
|
|
177
|
+
return unchanged(state);
|
|
178
|
+
}
|
|
179
|
+
const resolved = resolvePending(Object.assign(Object.assign({}, state), { phase: 'errored' }), 'paymentSheetFailed');
|
|
180
|
+
return applyDeferredSecret({
|
|
181
|
+
state: resolved.state,
|
|
182
|
+
effects: [{ type: 'hide' }, { type: 'emit', event: 'paymentSheetFailed' }, ...resolved.effects],
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
189
|
+
var t = {};
|
|
190
|
+
for (var p in s)
|
|
191
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
192
|
+
t[p] = s[p];
|
|
193
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
194
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
195
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
196
|
+
t[p[i]] = s[p[i]];
|
|
197
|
+
}
|
|
198
|
+
return t;
|
|
199
|
+
};
|
|
200
|
+
const SUPPORTED_OPTION_KEYS = ['merchantDisplayName', 'paymentMethodLayout', 'defaultBillingDetails', 'returnURL', 'style'];
|
|
201
|
+
const LAYOUTS = {
|
|
202
|
+
horizontal: 'tabs',
|
|
203
|
+
vertical: 'accordion',
|
|
204
|
+
automatic: 'auto',
|
|
205
|
+
};
|
|
206
|
+
const THEMES = {
|
|
207
|
+
alwaysLight: 'stripe',
|
|
208
|
+
alwaysDark: 'night',
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Drop keys whose value is undefined.
|
|
212
|
+
*/
|
|
213
|
+
const compact = (value) => Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined));
|
|
214
|
+
/**
|
|
215
|
+
* Build the Payment Element options from the payment sheet options.
|
|
216
|
+
* @param options - Payment sheet options
|
|
217
|
+
*/
|
|
218
|
+
const toPaymentElementOptions = (options) => {
|
|
219
|
+
if (options == null) {
|
|
220
|
+
return {};
|
|
221
|
+
}
|
|
222
|
+
const { merchantDisplayName, paymentMethodLayout, defaultBillingDetails } = options;
|
|
223
|
+
const elementOptions = {};
|
|
224
|
+
if (merchantDisplayName != null) {
|
|
225
|
+
elementOptions.business = { name: merchantDisplayName };
|
|
226
|
+
}
|
|
227
|
+
if (paymentMethodLayout != null) {
|
|
228
|
+
elementOptions.layout = LAYOUTS[paymentMethodLayout];
|
|
229
|
+
}
|
|
230
|
+
if (defaultBillingDetails != null) {
|
|
231
|
+
const { address } = defaultBillingDetails, contact = __rest(defaultBillingDetails, ["address"]);
|
|
232
|
+
const billingDetails = compact(contact);
|
|
233
|
+
if (address != null) {
|
|
234
|
+
const { postalCode } = address, rest = __rest(address, ["postalCode"]);
|
|
235
|
+
billingDetails.address = compact(Object.assign(Object.assign({}, rest), { postal_code: postalCode }));
|
|
236
|
+
}
|
|
237
|
+
elementOptions.defaultValues = { billingDetails };
|
|
238
|
+
}
|
|
239
|
+
return elementOptions;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Build the Elements appearance from the payment sheet style.
|
|
243
|
+
* @param style - `alwaysLight` or `alwaysDark`
|
|
244
|
+
*/
|
|
245
|
+
const toAppearance = (style) => {
|
|
246
|
+
if (style == null) {
|
|
247
|
+
return undefined;
|
|
248
|
+
}
|
|
249
|
+
return { theme: THEMES[style] };
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* List the given options that have no effect on the web (yet), sorted by name.
|
|
253
|
+
* @param options - Payment sheet options
|
|
254
|
+
*/
|
|
255
|
+
const unsupportedOptionKeys = (options) => {
|
|
256
|
+
if (options == null) {
|
|
257
|
+
return [];
|
|
258
|
+
}
|
|
259
|
+
return Object.entries(options)
|
|
260
|
+
.filter(([key, value]) => value !== undefined && !SUPPORTED_OPTION_KEYS.includes(key))
|
|
261
|
+
.map(([key]) => key)
|
|
262
|
+
.sort();
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Stripe error types after which the customer can fix the input or simply try again.
|
|
266
|
+
* Types are listed at https://docs.stripe.com/api/errors and in `StripeErrorType` of @stripe/stripe-js.
|
|
267
|
+
*/
|
|
268
|
+
const RECOVERABLE_ERROR_TYPES = ['card_error', 'validation_error', 'api_connection_error', 'rate_limit_error', 'api_error'];
|
|
269
|
+
/**
|
|
270
|
+
* Tell whether a confirmation error lets the customer try again in the open sheet.
|
|
271
|
+
* Other errors (for example `invalid_request_error` for an intent that already succeeded) end the sheet with `paymentSheetFailed`.
|
|
272
|
+
* @param error - Error thrown while confirming
|
|
273
|
+
*/
|
|
274
|
+
const isRecoverableConfirmError = (error) => {
|
|
275
|
+
const type = error === null || error === void 0 ? void 0 : error.type;
|
|
276
|
+
return typeof type === 'string' && RECOVERABLE_ERROR_TYPES.includes(type);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const stripePaymentSheetCss = () => `: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{display:contents}.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 .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .payment-info{margin-top:8px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap .stripe-submit{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)}`;
|
|
280
|
+
|
|
281
|
+
const StripePaymentSheet = class {
|
|
282
|
+
/**
|
|
283
|
+
* Show the sheet and wait for its result.
|
|
284
|
+
* Calling it again while a result is pending returns the same promise.
|
|
285
|
+
* @returns `{ paymentResult }`, where `paymentResult` is `paymentSheetCompleted`, `paymentSheetCanceled` or `paymentSheetFailed`
|
|
286
|
+
* @example
|
|
287
|
+
* ```
|
|
288
|
+
* const sheet = document.querySelector('stripe-payment-sheet');
|
|
289
|
+
* const { paymentResult } = await sheet.present();
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
async present() {
|
|
293
|
+
if (this.presentPromise == null) {
|
|
294
|
+
this.presentPromise = new Promise(resolve => {
|
|
295
|
+
this.resolvePresent = resolve;
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const promise = this.presentPromise;
|
|
299
|
+
this.dispatch({ type: 'presentRequested' });
|
|
300
|
+
return promise;
|
|
301
|
+
}
|
|
302
|
+
handleSecretChange() {
|
|
303
|
+
this.startLoading();
|
|
304
|
+
}
|
|
305
|
+
handleOpenChange(open) {
|
|
306
|
+
this.dispatch({ type: open ? 'openRequested' : 'closeRequested' });
|
|
307
|
+
}
|
|
308
|
+
constructor(hostRef) {
|
|
309
|
+
registerInstance(this, hostRef);
|
|
310
|
+
this.paymentSheetLoaded = createEvent(this, "paymentSheetLoaded", 7);
|
|
311
|
+
this.paymentSheetFailedToLoad = createEvent(this, "paymentSheetFailedToLoad", 7);
|
|
312
|
+
this.paymentSheetCompleted = createEvent(this, "paymentSheetCompleted", 7);
|
|
313
|
+
this.paymentSheetCanceled = createEvent(this, "paymentSheetCanceled", 7);
|
|
314
|
+
this.paymentSheetFailed = createEvent(this, "paymentSheetFailed", 7);
|
|
315
|
+
this.warnedUnsupportedOptions = false;
|
|
316
|
+
/**
|
|
317
|
+
* Whether the sheet is shown. Setting it to false closes the sheet as canceled.
|
|
318
|
+
*/
|
|
319
|
+
this.open = false;
|
|
320
|
+
/**
|
|
321
|
+
* Sheet title. Translated automatically by this library.
|
|
322
|
+
*/
|
|
323
|
+
this.sheetTitle = 'Add your payment information';
|
|
324
|
+
/**
|
|
325
|
+
* Submit button label. Translated automatically by this library.
|
|
326
|
+
*/
|
|
327
|
+
this.buttonLabel = 'Pay';
|
|
328
|
+
/**
|
|
329
|
+
* Application name registered to Stripe.js, for wrapper libraries such as `@capacitor-community/stripe`.
|
|
330
|
+
*/
|
|
331
|
+
this.applicationName = 'stripe-pwa-elements';
|
|
332
|
+
this.sheet = initialSheetState;
|
|
333
|
+
this.visible = false;
|
|
334
|
+
this.errorMessage = '';
|
|
335
|
+
this.handleSubmit = (e) => {
|
|
336
|
+
e.preventDefault();
|
|
337
|
+
this.errorMessage = '';
|
|
338
|
+
this.dispatch({ type: 'submitted' });
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* The modal closes itself on a backdrop or close button click. Keep it open when the sheet refuses to close (while confirming).
|
|
342
|
+
*/
|
|
343
|
+
this.handleModalClose = () => {
|
|
344
|
+
var _a;
|
|
345
|
+
this.dispatch({ type: 'closeRequested' });
|
|
346
|
+
if (this.visible) {
|
|
347
|
+
(_a = this.el.querySelector('stripe-modal')) === null || _a === void 0 ? void 0 : _a.openModal();
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
this.stripeService = serviceFactory.createStripeService();
|
|
351
|
+
this.paymentElementManager = serviceFactory.createPaymentElementManager(this.stripeService);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Props are not yet populated inside the constructor with the custom-elements build,
|
|
355
|
+
* so loading starts here.
|
|
356
|
+
*/
|
|
357
|
+
componentWillLoad() {
|
|
358
|
+
if (this.open) {
|
|
359
|
+
this.dispatch({ type: 'openRequested' });
|
|
360
|
+
}
|
|
361
|
+
this.startLoading();
|
|
362
|
+
}
|
|
363
|
+
componentDidLoad() {
|
|
364
|
+
this.el.classList.add(checkPlatform());
|
|
365
|
+
}
|
|
366
|
+
disconnectedCallback() {
|
|
367
|
+
this.paymentElementManager.unmount();
|
|
368
|
+
}
|
|
369
|
+
startLoading() {
|
|
370
|
+
if (this.publishableKey == null || this.publishableKey === '' || this.intentClientSecret == null) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
this.dispatch({ type: 'secretChanged', clientSecret: this.intentClientSecret });
|
|
374
|
+
}
|
|
375
|
+
dispatch(event) {
|
|
376
|
+
const { state, effects } = transition(this.sheet, event);
|
|
377
|
+
this.sheet = state;
|
|
378
|
+
effects.forEach(effect => this.perform(effect));
|
|
379
|
+
}
|
|
380
|
+
perform(effect) {
|
|
381
|
+
var _a;
|
|
382
|
+
switch (effect.type) {
|
|
383
|
+
case 'load':
|
|
384
|
+
this.load(effect.generation, effect.clientSecret);
|
|
385
|
+
break;
|
|
386
|
+
case 'show':
|
|
387
|
+
this.visible = true;
|
|
388
|
+
this.open = true;
|
|
389
|
+
break;
|
|
390
|
+
case 'hide':
|
|
391
|
+
this.visible = false;
|
|
392
|
+
this.open = false;
|
|
393
|
+
break;
|
|
394
|
+
case 'confirm':
|
|
395
|
+
this.confirm(effect.generation, effect.intentKind);
|
|
396
|
+
break;
|
|
397
|
+
case 'showError':
|
|
398
|
+
this.errorMessage = effect.message;
|
|
399
|
+
break;
|
|
400
|
+
case 'emit':
|
|
401
|
+
this.emit(effect.event);
|
|
402
|
+
break;
|
|
403
|
+
case 'resolvePresent':
|
|
404
|
+
(_a = this.resolvePresent) === null || _a === void 0 ? void 0 : _a.call(this, { paymentResult: effect.result });
|
|
405
|
+
this.presentPromise = undefined;
|
|
406
|
+
this.resolvePresent = undefined;
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async load(generation, clientSecret) {
|
|
411
|
+
var _a;
|
|
412
|
+
this.warnUnsupportedOptions();
|
|
413
|
+
try {
|
|
414
|
+
await this.stripeService.initialize(this.publishableKey, {
|
|
415
|
+
stripeAccount: this.stripeAccount,
|
|
416
|
+
applicationName: this.applicationName,
|
|
417
|
+
clientSecret,
|
|
418
|
+
});
|
|
419
|
+
if (generation !== this.sheet.generation) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (this.stripeService.state.loadStripeStatus !== 'success') {
|
|
423
|
+
throw new Error('Failed to load Stripe.js');
|
|
424
|
+
}
|
|
425
|
+
const appearance = toAppearance((_a = this.options) === null || _a === void 0 ? void 0 : _a.style);
|
|
426
|
+
if (appearance != null) {
|
|
427
|
+
await this.stripeService.getElements().update({ appearance });
|
|
428
|
+
}
|
|
429
|
+
await this.paymentElementManager.initialize(this.el, toPaymentElementOptions(this.options));
|
|
430
|
+
this.dispatch({ type: 'loadSucceeded', generation });
|
|
431
|
+
}
|
|
432
|
+
catch (e) {
|
|
433
|
+
this.lastError = e;
|
|
434
|
+
this.dispatch({ type: 'loadFailed', generation });
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
async confirm(generation, intentKind) {
|
|
438
|
+
var _a, _b, _c;
|
|
439
|
+
try {
|
|
440
|
+
const returnUrl = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.returnURL) !== null && _b !== void 0 ? _b : window.location.href;
|
|
441
|
+
this.lastResult = await confirmPaymentOrSetup(this.stripeService.getStripe(), this.stripeService.getElements(), intentKind, returnUrl);
|
|
442
|
+
this.dispatch({ type: 'confirmSucceeded', generation });
|
|
443
|
+
}
|
|
444
|
+
catch (e) {
|
|
445
|
+
const message = (_c = e.message) !== null && _c !== void 0 ? _c : String(e);
|
|
446
|
+
if (isRecoverableConfirmError(e)) {
|
|
447
|
+
this.dispatch({ type: 'confirmDeclined', generation, message });
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
this.lastError = e;
|
|
451
|
+
this.dispatch({ type: 'confirmFailed', generation, message });
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
emit(event) {
|
|
455
|
+
switch (event) {
|
|
456
|
+
case 'paymentSheetLoaded':
|
|
457
|
+
this.paymentSheetLoaded.emit({ stripe: this.stripeService.getStripe() });
|
|
458
|
+
break;
|
|
459
|
+
case 'paymentSheetFailedToLoad':
|
|
460
|
+
this.paymentSheetFailedToLoad.emit(this.lastError);
|
|
461
|
+
break;
|
|
462
|
+
case 'paymentSheetCompleted':
|
|
463
|
+
this.paymentSheetCompleted.emit(this.lastResult);
|
|
464
|
+
break;
|
|
465
|
+
case 'paymentSheetCanceled':
|
|
466
|
+
this.paymentSheetCanceled.emit();
|
|
467
|
+
break;
|
|
468
|
+
case 'paymentSheetFailed':
|
|
469
|
+
this.paymentSheetFailed.emit(this.lastError);
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
warnUnsupportedOptions() {
|
|
474
|
+
const keys = unsupportedOptionKeys(this.options);
|
|
475
|
+
if (this.warnedUnsupportedOptions || keys.length === 0) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
this.warnedUnsupportedOptions = true;
|
|
479
|
+
console.warn(`<stripe-payment-sheet>: these options have no effect on the web yet: ${keys.join(', ')}`);
|
|
480
|
+
}
|
|
481
|
+
render() {
|
|
482
|
+
const { phase } = this.sheet;
|
|
483
|
+
const confirming = phase === 'confirming';
|
|
484
|
+
return (h(Host, { key: 'ecb6de4b0674af9f5ecf86acce93e092c3bee881' }, h("stripe-modal", { key: '137473608d8cc3c0833c34529f1dafb9fc0cba34', open: this.visible, showCloseButton: !confirming, onClose: this.handleModalClose }, h("div", { key: '0da153ef48ddc5464f050ea1921a69f975a7d8e1', class: "stripe-payment-sheet-wrap" }, h("form", { key: '6f6653aee9d0ad54c8bf935ace2f6d4fdc648e1f', id: "stripe-payment-sheet", onSubmit: this.handleSubmit }, h("div", { key: '85d3e28a20679051decdb02d590c2144e652f0bd', class: "stripe-heading" }, i18n.t(this.sheetTitle)), h("div", { key: 'f6b8d90a3731732c0b36af0512a5ace87a12f98d', class: "payment-info visible" }, h("div", { key: '813a1ad3a0db2efa650aceff828412999f34ff2b', id: "payment-element" })), h("div", { key: '63bd6a8c20dd7b8b92aa2171553c13570ab17808', class: "stripe-element-errors", role: "alert" }, this.errorMessage), h("div", { key: 'f70e9b353ae9eecd1300bbbd40ebb731ef44c344', class: "stripe-submit" }, h("button", { key: '6f32a7b94132091348680476b0e7292072800dbf', type: "submit", disabled: phase !== 'presented' }, confirming ? i18n.t('Loading') : i18n.t(this.buttonLabel))))))));
|
|
485
|
+
}
|
|
486
|
+
get el() { return getElement(this); }
|
|
487
|
+
static get watchers() { return {
|
|
488
|
+
"publishableKey": [{
|
|
489
|
+
"handleSecretChange": 0
|
|
490
|
+
}],
|
|
491
|
+
"intentClientSecret": [{
|
|
492
|
+
"handleSecretChange": 0
|
|
493
|
+
}],
|
|
494
|
+
"stripeAccount": [{
|
|
495
|
+
"handleSecretChange": 0
|
|
496
|
+
}],
|
|
497
|
+
"open": [{
|
|
498
|
+
"handleOpenChange": 0
|
|
499
|
+
}]
|
|
500
|
+
}; }
|
|
501
|
+
};
|
|
502
|
+
StripePaymentSheet.style = stripePaymentSheetCss();
|
|
503
|
+
|
|
504
|
+
export { StripePaymentSheet as stripe_payment_sheet };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,a as e,h as s,g as i}from"./p-C6bbmyga.js";const r=class{constructor(s){t(this,s),this.closed=e(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(((t,e)=>{this.el.querySelector("stripe-card-element").addEventListener("formSubmit",(async e=>{t(e)})),this.el.addEventListener("closed",(()=>e()))}))}async updateProgress(t){return this.el.querySelector("stripe-card-element").updateProgress(t)}async destroy(){this.el.querySelector("stripe-card-element").remove(),this.el.remove()}async setPaymentRequestButton(t){const e=this.el.getElementsByTagName("stripe-card-element");if(e.length<1)return;const s=e[0];s&&(s.setAttribute("show-payment-request-button","true"),this.applicationName&&s.setAttribute("application-name",this.applicationName),s.setPaymentRequestOption(t))}render(){return s("stripe-modal",{key:"
|
|
1
|
+
import{r as t,a as e,h as s,g as i}from"./p-C6bbmyga.js";const r=class{constructor(s){t(this,s),this.closed=e(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(((t,e)=>{this.el.querySelector("stripe-card-element").addEventListener("formSubmit",(async e=>{t(e)})),this.el.addEventListener("closed",(()=>e()))}))}async updateProgress(t){return this.el.querySelector("stripe-card-element").updateProgress(t)}async destroy(){this.el.querySelector("stripe-card-element").remove(),this.el.remove()}async setPaymentRequestButton(t){const e=this.el.getElementsByTagName("stripe-card-element");if(e.length<1)return;const s=e[0];s&&(s.setAttribute("show-payment-request-button","true"),this.applicationName&&s.setAttribute("application-name",this.applicationName),s.setPaymentRequestOption(t))}render(){return s("stripe-modal",{key:"4904f57b562da9ce4fc348fb376f931cac707540",open:this.open,showCloseButton:this.showCloseButton},s("stripe-card-element",{key:"8707fa6e32ca82b700f53fc2a257b8af1cc7b45c",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 i(this)}};r.style="stripe-card-element-modal{display:block}";export{r as stripe_card_element_modal}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,a as i,h as e,g as n}from"./p-C6bbmyga.js";import{c as s,i as a}from"./p-B6JoQetF.js";import{s as r}from"./p-C7MQk9FK.js";import"./p-CBXaOfXU.js";const o=class{updatePublishableKey(t){const i={};this.stripeAccount&&(i.stripeAccount=this.stripeAccount),this.initStripe(t,Object.keys(i).length?i:void 0)}updateStripeAccountId(t){const i=this.stripeService.state.publishableKey||this.publishableKey;i&&this.initStripe(i,{stripeAccount:t})}async initStripe(t,i){if(await this.stripeService.initialize(t,{stripeAccount:null==i?void 0:i.stripeAccount,applicationName:this.applicationName}),"success"===this.stripeService.state.loadStripeStatus)await this.initElement(),this.stripeLoadedEventHandler();else{const t=this.stripeService.onChange("loadStripeStatus",(async i=>{"success"===i&&(await this.initElement(),this.stripeLoadedEventHandler(),t())}))}}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.linkAuthenticationElementManager.setError(t),this}async getEmail(){return this.linkAuthenticationElementManager.getState().email}stripeLoadedEventHandler(){const t=this.stripeService.getStripe();if(!t)return void console.error("Stripe instance is not available");const i={stripe:t};this.stripeDidLoaded&&this.stripeDidLoaded(i),this.stripeLoaded.emit(i)}linkAuthenticationChangeEventHandler(t){const i=this.linkAuthenticationElementManager.getElement(),e=this.stripeService.getStripe();if(!i||!e)return void console.error("Link Authentication Element not initialized");const n={stripe:e,linkAuthenticationElement:i,email:t};this.handleChange&&this.handleChange(n),this.linkAuthenticationChange.emit(n)}componentWillRender(){this.stripeService.state.publishableKey&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}))}constructor(e){t(this,e),this.stripeLoaded=i(this,"stripeLoaded",7),this.linkAuthenticationChange=i(this,"linkAuthenticationChange",7),this.applicationName="stripe-pwa-elements",this.progress="",this.stripeService=r.createStripeService(),this.linkAuthenticationElementManager=r.createLinkAuthenticationElementManager(this.stripeService)}componentWillLoad(){this.publishableKey&&this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount})}async initElement(){const t={};this.defaultEmail&&(t.defaultValues={email:this.defaultEmail}),await this.linkAuthenticationElementManager.initialize(this.el,Object.keys(t).length?t:void 0),this.linkAuthenticationElementManager.onChange("email",(t=>{this.linkAuthenticationChangeEventHandler(t)}))}componentDidLoad(){const t=s();t&&this.el.classList.add(t)}disconnectedCallback(){this.linkAuthenticationElementManager.unmount()}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:i}=this.linkAuthenticationElementManager.getState();return"failure"===t?e("p",null,a.t("Failed to load Stripe")):e("div",{class:"stripe-link-authentication-wrap"},e("div",{class:"stripe-link-authentication-container"},e("div",{id:"link-authentication-element"}),e("div",{id:"link-authentication-errors",class:"stripe-element-errors"},i)))}get el(){return n(this)}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}}};o.style=':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-link-authentication-wrap{box-sizing:border-box}.stripe-link-authentication-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-link-authentication-wrap button{cursor:pointer}.stripe-link-authentication-wrap{display:block;width:100%;background:#fff;padding:16px}.stripe-link-authentication-wrap .stripe-link-authentication-container #link-authentication-element .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-link-authentication-wrap .stripe-link-authentication-container #link-authentication-element .StripeElement>.__PrivateStripeElement{width:100%}.stripe-link-authentication-wrap .stripe-link-authentication-container .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}';export{o as stripe_link_authentication_element}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,a as e,h as s,g as i}from"./p-C6bbmyga.js";import{c as r,i as o}from"./p-B6JoQetF.js";import{s as n}from"./p-C7MQk9FK.js";import{S as a}from"./p-XRfh5Wrs.js";import"./p-CBXaOfXU.js";const c=class{updatePublishableKey(t){const e={};e.stripeAccount=this.stripeService.state.stripeAccount;const s=Object.values(e).filter(Boolean).length>0;this.initStripe(t,s?e:void 0)}updateStripeAccountId(t){this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:t})}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.expressCheckoutManager.setError(t),this}async initStripe(t,e){if(await this.stripeService.initialize(t,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName,clientSecret:this.clientSecret,elementsOptions:this.buildElementsOptions()}),"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())}))}}buildElementsOptions(){if(null!=this.currency&&""!==this.currency){if("setup"===this.intentType)return{mode:"setup",currency:this.currency};if(void 0!==this.amount)return{mode:"payment",amount:this.amount,currency:this.currency}}}async updateElementOptions(t){return this.expressCheckoutManager.update(t),this}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async defaultConfirmResultHandler(t){this.defaultConfirmResult.emit(t)}constructor(s){t(this,s),this.stripeLoaded=e(this,"stripeLoaded",7),this.confirm=e(this,"confirm",7),this.expressCheckoutClick=e(this,"expressCheckoutClick",7),this.cancel=e(this,"cancel",7),this.defaultConfirmResult=e(this,"defaultConfirmResult",7),this.intentType="payment",this.applicationName="stripe-pwa-elements",this.shouldUseDefaultConfirmAction=!0,this.progress="",this.stripeService=n.createStripeService(),this.expressCheckoutManager=n.createExpressCheckoutElementManager(this.stripeService)}componentWillLoad(){null!=this.publishableKey&&""!==this.publishableKey&&this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount})}componentWillUpdate(){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}))}async defaultConfirmAction(t){try{this.progress="loading";const e=this.stripeService.getStripe(),{intentType:s,clientSecret:i}=this;if(null==e)throw new Error("Stripe not initialized");if(null==i||""===i)throw new Error("Client secret is required");const r=await(()=>"payment"===s?e.confirmPayment({elements:this.stripeService.getElements(),clientSecret:i,confirmParams:{return_url:`${window.location.origin}${window.location.pathname}`},redirect:"if_required"}):e.confirmSetup({elements:this.stripeService.getElements(),clientSecret:i,confirmParams:{return_url:`${window.location.origin}${window.location.pathname}`},redirect:"if_required"}))();if(null!=r.error)throw new a(r.error);t.complete("success"),this.progress="success",this.defaultConfirmResultHandler(r)}catch(e){console.error(e),t.complete("fail"),this.expressCheckoutManager.setError(e.message),this.progress="failure",this.defaultConfirmResultHandler(e)}}async initElement(){const t={mode:"payment"===this.intentType?"payment":"setup"};if(void 0!==this.amount&&(t.amount=this.amount),null!=this.currency&&""!==this.currency&&(t.currency=this.currency),null!=this.buttonHeight&&""!==this.buttonHeight)if("string"==typeof this.buttonHeight){const e=parseInt(this.buttonHeight.replace("px",""),10);isNaN(e)||(t.buttonHeight=e)}else t.buttonHeight=this.buttonHeight;await this.expressCheckoutManager.initialize(this.el,t,{onConfirm:async t=>{this.confirm.emit(t),this.shouldUseDefaultConfirmAction&&null!=this.clientSecret&&""!==this.clientSecret&&await this.defaultConfirmAction(t)},onClick:t=>{this.expressCheckoutClick.emit(t)},onCancel:()=>{this.cancel.emit(),this.progress=""}})}componentDidLoad(){this.el.classList.add(r())}disconnectedCallback(){this.expressCheckoutManager.unmount()}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:e,isReady:i}=this.expressCheckoutManager.getState();return"failure"===t?s("p",null,o.t("Failed to load Stripe")):"loading"===t?s("p",null,o.t("Loading")):s("div",{class:"stripe-express-checkout-wrap"},s("div",{id:"express-checkout-element"}),e&&s("div",{id:"express-checkout-errors",class:"stripe-element-errors"},e),!i&&"success"===t&&s("div",{class:"stripe-express-checkout-loading"},o.t("Loading")))}get el(){return i(this)}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}}};c.style=":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-express-checkout-wrap{width:100%;max-width:500px;margin:0 auto;padding:1rem 0}.stripe-express-checkout-wrap #express-checkout-element{margin-bottom:1rem}.stripe-express-checkout-wrap .stripe-element-errors{color:var(--stripe-error-color, #fa755a);font-size:14px;margin-top:0.5rem;padding:0.5rem;background-color:var(--stripe-error-bg, #fff5f5);border:1px solid var(--stripe-error-border, #fdd);border-radius:6px}.stripe-express-checkout-wrap .stripe-express-checkout-loading{text-align:center;padding:1rem;color:var(--stripe-loading-color, #6772e5);font-size:14px}";export{c as stripe_express_checkout_element}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,a as s,h as e,g as r}from"./p-C6bbmyga.js";import{c as i,i as o}from"./p-B6JoQetF.js";import{s as c}from"./p-C7MQk9FK.js";import"./p-CBXaOfXU.js";const n=class{updatePublishableKey(t){this.initStripe(t,{stripeAccount:this.stripeAccount})}updateStripeAccountId(t){const s=this.stripeService.state.publishableKey||this.publishableKey;s&&this.initStripe(s,{stripeAccount:t})}async initStripe(t,s){if(await this.stripeService.initialize(t,{stripeAccount:null==s?void 0:s.stripeAccount,applicationName:this.applicationName}),"success"===this.stripeService.state.loadStripeStatus)await this.initElement(),this.stripeLoadedEventHandler();else{const t=this.stripeService.onChange("loadStripeStatus",(async s=>{"success"===s&&(await this.initElement(),this.stripeLoadedEventHandler(),t())}))}}async setErrorMessage(t){return this.currencySelectorElementManager.setError(t),this}async getSelectedCurrency(){return this.currencySelectorElementManager.getState().selectedCurrency}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async currencyChangeEventHandler(t){const s={currency:t};this.currencyChange.emit(s),this.handleCurrencyChange&&await this.handleCurrencyChange(s)}componentWillRender(){this.stripeService.state.publishableKey&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}))}constructor(e){t(this,e),this.stripeLoaded=s(this,"stripeLoaded",7),this.currencyChange=s(this,"currencyChange",7),this.applicationName="stripe-pwa-elements",this.stripeService=c.createStripeService(),this.currencySelectorElementManager=c.createCurrencySelectorElementManager(this.stripeService)}componentWillLoad(){this.publishableKey&&this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount})}async initElement(){const t={};this.clientSecret&&(t.clientSecret=this.clientSecret),(await this.currencySelectorElementManager.initialize(this.el,t)).on("change",(t=>{var s;(null===(s=null==t?void 0:t.value)||void 0===s?void 0:s.currency)&&this.currencyChangeEventHandler(t.value.currency)}))}componentDidLoad(){const t=i();t&&this.el.classList.add(t)}disconnectedCallback(){this.currencySelectorElementManager.unmount()}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:s}=this.currencySelectorElementManager.getState();return"failure"===t?e("p",null,o.t("Failed to load Stripe")):e("div",{class:"stripe-currency-selector-wrap"},e("div",{id:"currency-selector"}),s?e("div",{id:"currency-selector-errors",class:"stripe-element-errors"},s):null)}get el(){return r(this)}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}}};n.style=':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}:host{box-sizing:border-box}:host *: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}:host button{cursor:pointer}:host{display:block;width:100%}.stripe-currency-selector-wrap{width:100%;padding:0;margin:0}.stripe-currency-selector-wrap #currency-selector{width:100%;min-height:40px}.stripe-currency-selector-wrap #currency-selector-errors{margin-top:8px}';export{n as stripe_currency_selector}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as o,r as t,f as i,h as e,d as n,g as s,a as r}from"./p-C6bbmyga.js";import{c as a,i as l}from"./p-B6JoQetF.js";let c;const d=(o,t,i,e,n)=>(i="ios"===(i&&b(i))?"ios":"md",e&&"ios"===i?o=b(e):n&&"md"===i?o=b(n):(o||!t||f(t)||(o=t),u(o)&&(o=b(o))),u(o)&&""!==o.trim()?""!==o.replace(/[a-z]|-|\d/gi,"")?null:o:null),h=o=>u(o)&&(o=o.trim(),f(o))?o:null,f=o=>o.length>0&&/(\/|\.)/.test(o),u=o=>"string"==typeof o,b=o=>o.toLowerCase(),m=o=>{if(1===o.nodeType){if("script"===o.nodeName.toLowerCase())return!1;for(let t=0;t<o.attributes.length;t++){const i=o.attributes[t].name;if(u(i)&&0===i.toLowerCase().indexOf("on"))return!1}for(let t=0;t<o.childNodes.length;t++)if(!m(o.childNodes[t]))return!1}return!0},p=new Map,y=new Map;let v;function g(o){return p.set(o,""),""}const x=class{constructor(o){t(this,o),this.iconName=null,this.inheritedAttributes={},this.didLoadIcon=!1,this.isVisible=!1,this.mode=w(),this.lazy=!1,this.sanitize=!0}componentWillLoad(){this.inheritedAttributes=((o,t=[])=>{const i={};return t.forEach((t=>{o.hasAttribute(t)&&(null!==o.getAttribute(t)&&(i[t]=o.getAttribute(t)),o.removeAttribute(t))})),i})(this.el,["aria-label"])}connectedCallback(){this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=!0,this.loadIcon()}))}componentDidLoad(){this.didLoadIcon||this.loadIcon()}disconnectedCallback(){this.io&&(this.io.disconnect(),this.io=void 0)}waitUntilVisible(o,t,e){if(!Boolean(i.isBrowser&&this.lazy&&"undefined"!=typeof window&&window.IntersectionObserver))return e();const n=this.io=new window.IntersectionObserver((o=>{o[0].isIntersecting&&(n.disconnect(),this.io=void 0,e())}),{rootMargin:t});n.observe(o)}loadIcon(){if(i.isBrowser&&this.isVisible){const t=(t=>{let i=h(t.src);if(i)return i;if(i=d(t.name,t.icon,t.mode,t.ios,t.md),i)return((t,i)=>{const e=(()=>{if("undefined"==typeof window)return new Map;if(!c){const o=window;o.Ionicons=o.Ionicons||{},c=o.Ionicons.map=o.Ionicons.map||new Map}return c})().get(t);if(e)return e;try{return o(`svg/${t}.svg`)}catch(o){console.log("e",o),console.warn(`[Ionicons Warning]: Could not load icon with name "${t}". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`,i)}})(i,t);if(t.icon){if(i=h(t.icon),i)return i;if(i=h(t.icon[t.mode]),i)return i}return null})(this);t&&(p.has(t)?this.svgContent=p.get(t):((o,t)=>y.get(o)||("undefined"!=typeof fetch&&"undefined"!=typeof document?(o=>o.startsWith("data:image/svg+xml"))(o)&&(o=>-1!==o.indexOf(";utf8,"))(o)?Promise.resolve(function(o){v||(v=new DOMParser);const t=v.parseFromString(o,"text/html").querySelector("svg");if(t)return p.set(o,t.outerHTML),t.outerHTML;throw new Error(`Could not parse svg from ${o}`)}(o)):function(o,t){const i=fetch(o).then((i=>i.text().then((i=>{i&&!1!==t&&(i=(o=>{const t=document.createElement("div");t.innerHTML=o;for(let o=t.childNodes.length-1;o>=0;o--)"svg"!==t.childNodes[o].nodeName.toLowerCase()&&t.removeChild(t.childNodes[o]);const i=t.firstElementChild;if(i&&"svg"===i.nodeName.toLowerCase()){const o=i.getAttribute("class")||"";if(i.setAttribute("class",(o+" s-ion-icon").trim()),m(i))return t.innerHTML}return""})(i));const e=i||"";return p.set(o,e),e})).catch((()=>g(o))))).catch((()=>g(o)));return y.set(o,i),i}(o,t):Promise.resolve(g(o))))(t,this.sanitize).then((()=>this.svgContent=p.get(t))),this.didLoadIcon=!0)}this.iconName=d(this.name,this.icon,this.mode,this.ios,this.md)}render(){const{flipRtl:o,iconName:t,inheritedAttributes:s,el:r}=this,a=this.mode||"md",l=!!t&&(t.includes("arrow")||t.includes("chevron"))&&!1!==o,c=o||l;return e(n,Object.assign({key:"0578c899781ca145dd8205acd9670af39b57cf2e",role:"img",class:Object.assign(Object.assign({[a]:!0},k(this.color)),{[`icon-${this.size}`]:!!this.size,"flip-rtl":c,"icon-rtl":c&&(d=r,d&&""!==d.dir?"rtl"===d.dir.toLowerCase():"rtl"===(null===document||void 0===document?void 0:document.dir.toLowerCase()))})},s),e("div",i.isBrowser&&this.svgContent?{class:"icon-inner",innerHTML:this.svgContent}:{class:"icon-inner"}));var d}static get assetsDirs(){return["svg"]}get el(){return s(this)}static get watchers(){return{name:[{loadIcon:0}],src:[{loadIcon:0}],icon:[{loadIcon:0}],ios:[{loadIcon:0}],md:[{loadIcon:0}]}}},w=()=>i.isBrowser&&"undefined"!=typeof document&&document.documentElement.getAttribute("mode")||"md",k=o=>o?{"ion-color":!0,[`ion-color-${o}`]:!0}:null;x.style=":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}@supports (background: -webkit-named-image(i)){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}@supports not selector(:dir(rtl)) and selector(:host-context([dir='rtl'])){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}:host(.flip-rtl):host-context([dir='rtl']) .icon-inner{transform:scaleX(-1)}@supports selector(:dir(rtl)){:host(.flip-rtl:dir(rtl)) .icon-inner{transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{transform:scaleX(1)}}:host(.icon-small){font-size:1.125rem !important}:host(.icon-large){font-size:2rem !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";const C=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])","iframe","audio[controls]","video[controls]","summary",'[contenteditable]:not([contenteditable="false"])',"[tabindex]"].join(","),M=o=>{if(!o.matches(C))return!1;const t=o.getAttribute("tabindex");if(null!==t&&Number(t)<0)return!1;if(o.hasAttribute("hidden")||null!==o.closest("[inert]"))return!1;const{checkVisibility:i}=o;return!("function"==typeof i&&!i.call(o,{visibilityProperty:!0}))},F=o=>{const t=[],i=o=>{for(const e of(o=>{if(o instanceof Element&&"SLOT"===o.tagName){const t=o,i="function"==typeof t.assignedElements?t.assignedElements({flatten:!0}):[];return i.length>0?i:Array.from(t.children)}return o instanceof Element&&null!=o.shadowRoot?Array.from(o.shadowRoot.children):Array.from(o.children)})(o))M(e)&&t.push(e),i(e)};return i(o),t},I=(o=document)=>{var t,i;let e=null!==(t=o.activeElement)&&void 0!==t?t:null;for(;null!=(null===(i=null==e?void 0:e.shadowRoot)||void 0===i?void 0:i.activeElement);)e=e.shadowRoot.activeElement;return e},O=class{constructor(o){t(this,o),this.close=r(this,"close",7),this.showCloseButton=!0,this.open=!1,this.renderedOpen=!1,this.returnFocusElement=null,this.shouldFocusOnRender=!1,this.lastFocusedInside=null,this.handleKeyDown=o=>{this.open&&"Escape"===o.key&&(o.isComposing||229===o.keyCode||o.defaultPrevented||(o.preventDefault(),o.stopPropagation(),this.closeModal()))},this.handleFocusIn=o=>{var t,i;const e=null!==(i=null===(t=o.composedPath)||void 0===t?void 0:t.call(o)[0])&&void 0!==i?i:o.target;void 0===(null==e?void 0:e.classList)||e.classList.contains("focus-guard")||(this.lastFocusedInside=e)},this.handleStartGuardFocus=o=>{this.cameFromFocusableInside(o)?this.focusLastElement():this.focusFirstElement()},this.handleEndGuardFocus=o=>{this.isInsideModal(this.getFocusOrigin(o))?this.focusFirstElement():this.focusLastElement()}}onOpenChange(o){o?(this.rememberFocus(),this.openModalAnimation()):(this.renderedOpen=!1,this.shouldFocusOnRender=!1,this.lastFocusedInside=null,this.close.emit(),this.restoreFocus())}async toggleModal(){this.open?await this.closeModal():await this.openModal()}async openModal(){this.open=!0}async closeModal(){this.open=!1}componentDidLoad(){const o=a();o&&this.el.classList.add(o),this.open&&(this.rememberFocus(),this.openModalAnimation())}componentDidRender(){this.shouldFocusOnRender&&this.renderedOpen&&(this.shouldFocusOnRender=!1,this.focusFirstElement())}rememberFocus(){var o;if("undefined"==typeof document)return;const t=I(document);null===t||t===document.body||this.el.contains(t)||!0===(null===(o=this.el.shadowRoot)||void 0===o?void 0:o.contains(t))||(this.returnFocusElement=t)}restoreFocus(){const o=this.returnFocusElement;this.returnFocusElement=null,null!=o&&o.isConnected&&"function"==typeof o.focus&&o.focus()}getTabbableElements(){return void 0===this.dialogElement?[]:F(this.dialogElement).filter((o=>!o.classList.contains("focus-guard")))}isInsideModal(o){var t;return null!==o&&(this.el.contains(o)||!0===(null===(t=this.dialogElement)||void 0===t?void 0:t.contains(o)))}getFocusOrigin(o){var t;return null!==(t=o.relatedTarget)&&void 0!==t?t:this.lastFocusedInside}cameFromFocusableInside(o){const t=this.getFocusOrigin(o);return t!==this.dialogElement&&this.isInsideModal(t)}focusContentAfterLoading(){var o;if(!this.open||void 0===this.contentElement)return;const t=I(document);(null===t||t===document.body||t===this.dialogElement||t===this.closeButtonElement)&&(null===(o=F(this.contentElement)[0])||void 0===o||o.focus())}focusFirstElement(){var o;const[t]=this.getTabbableElements();null===(o=null!=t?t:this.dialogElement)||void 0===o||o.focus()}focusLastElement(){var o,t;const i=this.getTabbableElements();null===(t=null!==(o=i[i.length-1])&&void 0!==o?o:this.dialogElement)||void 0===t||t.focus()}openModalAnimation(){if(this.shouldFocusOnRender=!0,!this.el.shadowRoot)return void(this.renderedOpen=!0);const o=this.el.shadowRoot.querySelector(".modal-child");o.classList.add("loading"),o.style.willChange="transform",o.addEventListener("transitionend",(()=>{o.style.willChange="auto",o.classList.remove("loading"),this.focusContentAfterLoading()}),{once:!0}),requestAnimationFrame((()=>{this.renderedOpen=this.open}))}render(){const{renderedOpen:o,showCloseButton:t}=this,i=o?0:-1;return e(n,{key:"684539aa83388bec518e73bbd8aa19e73cfde07d",role:o?"dialog":void 0,"aria-modal":o?"true":void 0,onKeyDown:this.handleKeyDown,onFocusin:this.handleFocusIn},e("div",{key:"db6f1088c1ef7e35aefba06faaf3e9c2dcaa3419",class:"modal-row"+(o?" open":""),onClick:()=>this.closeModal()},e("div",{key:"89c783c793261566b77ba962da730a973e8cbd8d",class:"modal-child",tabindex:"-1",ref:o=>this.dialogElement=o,onClick:o=>o.stopPropagation()},e("div",{key:"0e329b32c25509134f5a25adb266b03dd0bd71d8",class:"focus-guard",tabindex:i,onFocus:this.handleStartGuardFocus}),t?e("div",{class:"modal-close-button-wrap"},e("button",{type:"button",class:"modal-close-button","aria-label":l.t("Close"),ref:o=>this.closeButtonElement=o,onClick:()=>this.closeModal()},e("ion-icon",{name:"close",size:"large","aria-hidden":"true"}))):null,e("div",{key:"f2b5dcbc72ba3178dd920ceecd4fd339f69598d7",class:"modal-loading"},e("svg",{key:"1f7afb6cc48be8fc84f9b69678f2c8ca1e2b145e",version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2400 2400"},e("g",{key:"ed40edfeabe02bf198b194eb04777e1f4a6b203e","stroke-width":"200","stroke-linecap":"round",stroke:"currentColor",fill:"none",id:"spinner"},e("line",{key:"03c9170ee9e566227fddcc9037a92c48ed954b89",x1:"1200",y1:"600",x2:"1200",y2:"100"}),e("line",{key:"302aec0abf20ee8afe66245ecbc9d5e2adbade82",opacity:"0.5",x1:"1200",y1:"2300",x2:"1200",y2:"1800"}),e("line",{key:"d3bea8de4d689a5c5c423a72dd23a0fbc64c29dd",opacity:"0.917",x1:"900",y1:"680.4",x2:"650",y2:"247.4"}),e("line",{key:"543e33091e87bf85c3a0e4d4881babdffbe4b825",opacity:"0.417",x1:"1750",y1:"2152.6",x2:"1500",y2:"1719.6"}),e("line",{key:"5c2e0a3722955a8ee17b57f3061097f18681ba7e",opacity:"0.833",x1:"680.4",y1:"900",x2:"247.4",y2:"650"}),e("line",{key:"1100d48a500bfca6075243cf69be9e6f575bdae6",opacity:"0.333",x1:"2152.6",y1:"1750",x2:"1719.6",y2:"1500"}),e("line",{key:"6c3f7c309a5ed15c6ffce11925efe09dbc8e6f3b",opacity:"0.75",x1:"600",y1:"1200",x2:"100",y2:"1200"}),e("line",{key:"7708c31b141f3a151e8dc78c89b20442f34ce1e2",opacity:"0.25",x1:"2300",y1:"1200",x2:"1800",y2:"1200"}),e("line",{key:"d419fc4006e8063f9bbc35b4cb2a9a88010c623a",opacity:"0.667",x1:"680.4",y1:"1500",x2:"247.4",y2:"1750"}),e("line",{key:"78ccaf11a6e7c3183d210b787ce9374bd7c4aff4",opacity:"0.167",x1:"2152.6",y1:"650",x2:"1719.6",y2:"900"}),e("line",{key:"acb1444de9fcd9aa1a3182d759d3b8aeb0906284",opacity:"0.583",x1:"900",y1:"1719.6",x2:"650",y2:"2152.6"}),e("line",{key:"6adef9d6a54f302c8da7c84cae32851723ce25cc",opacity:"0.083",x1:"1750",y1:"247.4",x2:"1500",y2:"680.4"}),e("animateTransform",{key:"7acf982514091f6c3ec9bd4ddfc660f3286ddd4e",attributeName:"transform",attributeType:"XML",type:"rotate",keyTimes:"0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667",values:"0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199",dur:"0.83333s",begin:"0s",repeatCount:"indefinite",calcMode:"discrete"})))),e("div",{key:"120bebc59c0fc013cb2bfbaf8957ad3731e1ddf4",class:"modal-content",ref:o=>this.contentElement=o},e("slot",{key:"0f371823f8fddd61e2b0ce24a59477103d979875"})),e("div",{key:"fa8436f70871d59055dab2cf0fcfe5d4577328c1",class:"focus-guard",tabindex:i,onFocus:this.handleEndGuardFocus}))))}get el(){return s(this)}static get watchers(){return{open:[{onOpenChange:0}]}}};O.style=':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}:host{box-sizing:border-box}:host *: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}:host button{cursor:pointer}:host{display:block}.modal-row{opacity:0;pointer-events:none;will-change:transform;visibility:hidden}.modal-row.open{opacity:1;pointer-events:auto;visibility:visible;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:1ch;background:rgba(0, 0, 0, 0.3)}.modal-row .modal-child{transform:translateY(100%);transition:transform 420ms ease;position:relative}.modal-row .modal-child .modal-loading{display:none;position:absolute;top:160px;left:50%;transform:translateX(-50%);width:24px;height:24px}.modal-row .modal-child.loading .modal-loading{display:flex;justify-content:center;align-items:center}.modal-row .modal-child.loading .modal-loading svg{width:24px;height:24px}.modal-row .modal-child.loading .modal-content{visibility:hidden}.modal-row.open .modal-child{transform:translateY(0%)}.modal-child{padding:16px 8px 24px;background-color:#fff;width:100%}.modal-close-button-wrap{padding-left:8px}.modal-close-button-wrap .modal-close-button{display:block;width:32px;cursor:pointer;border-radius:4px}.modal-close-button-wrap .modal-close-button:focus-visible{outline:2px solid var(--color-label, #000);outline-offset:2px}.modal-close-button-wrap .modal-close-button ion-icon{width:32px;display:block;fill:var(--color-label)}.modal-child:focus{outline:none}.focus-guard{position:absolute;width:1px;height:1px;overflow:hidden}';export{x as ion_icon,O as stripe_modal}
|