stripe-pwa-elements 4.0.1 → 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.
Files changed (100) hide show
  1. package/dist/cjs/factory-tenFFIul.js +1200 -0
  2. package/dist/cjs/{factory-Cd2VI_N2.js → i18n-FhEOc8vz.js} +6 -1149
  3. package/dist/cjs/ion-icon_2.cjs.entry.js +723 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/stripe-address-element.cjs.entry.js +5 -4
  6. package/dist/cjs/stripe-card-element-modal.cjs.entry.js +3 -2
  7. package/dist/cjs/{stripe-card-element_2.cjs.entry.js → stripe-card-element.cjs.entry.js} +8 -93
  8. package/dist/cjs/stripe-currency-selector.cjs.entry.js +4 -3
  9. package/dist/cjs/stripe-elements.cjs.js +1 -1
  10. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +24 -5
  11. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +4 -3
  12. package/dist/cjs/stripe-payment-element.cjs.entry.js +12 -124
  13. package/dist/cjs/stripe-payment-element.helpers-DukP33RI.js +122 -0
  14. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +2 -2
  15. package/dist/cjs/stripe-payment-sheet.cjs.entry.js +506 -0
  16. package/dist/collection/collection-manifest.json +2 -1
  17. package/dist/collection/components/stripe-card-element/stripe-card-element.js +3 -2
  18. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
  19. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +18 -0
  20. package/dist/collection/components/stripe-modal/stripe-modal.css +23 -1
  21. package/dist/collection/components/stripe-modal/stripe-modal.js +130 -1
  22. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +3 -3
  23. package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +179 -0
  24. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
  25. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +90 -0
  26. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +544 -0
  27. package/dist/collection/services/express-checkout-element-manager.js +36 -2
  28. package/dist/collection/services/stripe-service.js +20 -6
  29. package/dist/collection/utils/focus.js +76 -0
  30. package/dist/collection/utils/i18n.js +6 -0
  31. package/dist/components/factory.js +1 -1
  32. package/dist/components/i18n.js +1 -0
  33. package/dist/components/stripe-address-element.js +1 -1
  34. package/dist/components/stripe-card-element-modal.js +1 -1
  35. package/dist/components/stripe-card-element2.js +1 -1
  36. package/dist/components/stripe-currency-selector.js +1 -1
  37. package/dist/components/stripe-express-checkout-element.js +1 -1
  38. package/dist/components/stripe-link-authentication-element.js +1 -1
  39. package/dist/components/stripe-modal2.js +1 -1
  40. package/dist/components/stripe-payment-element.helpers.js +1 -0
  41. package/dist/components/stripe-payment-element.js +1 -1
  42. package/dist/components/stripe-payment-request-button2.js +1 -1
  43. package/dist/components/stripe-payment-sheet.d.ts +11 -0
  44. package/dist/components/stripe-payment-sheet.js +1 -0
  45. package/dist/esm/factory-Cd6OGTWN.js +1198 -0
  46. package/dist/esm/{factory-VTa1Gc94.js → i18n-B6JoQetF.js} +7 -1149
  47. package/dist/esm/ion-icon_2.entry.js +720 -0
  48. package/dist/esm/loader.js +1 -1
  49. package/dist/esm/stripe-address-element.entry.js +2 -1
  50. package/dist/esm/stripe-card-element-modal.entry.js +3 -2
  51. package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +6 -90
  52. package/dist/esm/stripe-currency-selector.entry.js +2 -1
  53. package/dist/esm/stripe-elements.js +1 -1
  54. package/dist/esm/stripe-express-checkout-element.entry.js +20 -1
  55. package/dist/esm/stripe-link-authentication-element.entry.js +2 -1
  56. package/dist/esm/stripe-payment-element.entry.js +4 -116
  57. package/dist/esm/stripe-payment-element.helpers-CipV87b8.js +117 -0
  58. package/dist/esm/stripe-payment-request-button.entry.js +2 -2
  59. package/dist/esm/stripe-payment-sheet.entry.js +504 -0
  60. package/dist/stripe-elements/{p-ae0c336e.entry.js → p-4891edf0.entry.js} +1 -1
  61. package/dist/stripe-elements/p-5338bc5e.entry.js +1 -0
  62. package/dist/stripe-elements/p-6a9c8b7a.entry.js +1 -0
  63. package/dist/stripe-elements/p-7fe4a287.entry.js +1 -0
  64. package/dist/stripe-elements/p-915b86ed.entry.js +1 -0
  65. package/dist/stripe-elements/p-B6JoQetF.js +1 -0
  66. package/dist/stripe-elements/p-C7MQk9FK.js +1 -0
  67. package/dist/stripe-elements/p-DFAhQS0n.js +1 -0
  68. package/dist/stripe-elements/p-b06a254f.entry.js +1 -0
  69. package/dist/stripe-elements/p-b91c4fa7.entry.js +1 -0
  70. package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
  71. package/dist/stripe-elements/p-e7372ca7.entry.js +1 -0
  72. package/dist/stripe-elements/p-f892e375.entry.js +1 -0
  73. package/dist/stripe-elements/stripe-elements.esm.js +1 -1
  74. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +2 -1
  75. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
  76. package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +5 -0
  77. package/dist/types/components/stripe-modal/stripe-modal.d.ts +43 -0
  78. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +1 -1
  79. package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +104 -0
  80. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +112 -0
  81. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +95 -0
  82. package/dist/types/components.d.ts +169 -10
  83. package/dist/types/index.d.ts +2 -0
  84. package/dist/types/services/interfaces.d.ts +1 -0
  85. package/dist/types/services/stripe-service.d.ts +7 -2
  86. package/dist/types/utils/focus.d.ts +15 -0
  87. package/package.json +5 -3
  88. package/readme.md +42 -6
  89. package/dist/cjs/ion-icon.cjs.entry.js +0 -431
  90. package/dist/components/utils.js +0 -1
  91. package/dist/esm/ion-icon.entry.js +0 -429
  92. package/dist/stripe-elements/p-1bd46766.entry.js +0 -1
  93. package/dist/stripe-elements/p-1c6e0a45.entry.js +0 -1
  94. package/dist/stripe-elements/p-3f42ca0c.entry.js +0 -1
  95. package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
  96. package/dist/stripe-elements/p-74de1556.entry.js +0 -1
  97. package/dist/stripe-elements/p-76e57d78.entry.js +0 -1
  98. package/dist/stripe-elements/p-840d499f.entry.js +0 -1
  99. package/dist/stripe-elements/p-CrjrbGJ3.js +0 -1
  100. package/dist/stripe-elements/p-cfd8e081.entry.js +0 -1
@@ -1,429 +0,0 @@
1
- import { e as getAssetPath, r as registerInstance, f as Build, h, d as Host, g as getElement } from './index-C6bbmyga.js';
2
-
3
- let CACHED_MAP;
4
- const getIconMap = () => {
5
- if (typeof window === 'undefined') {
6
- return new Map();
7
- }
8
- else {
9
- if (!CACHED_MAP) {
10
- const win = window;
11
- win.Ionicons = win.Ionicons || {};
12
- CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
13
- }
14
- return CACHED_MAP;
15
- }
16
- };
17
- const getUrl = (i) => {
18
- let url = getSrc(i.src);
19
- if (url) {
20
- return url;
21
- }
22
- url = getName(i.name, i.icon, i.mode, i.ios, i.md);
23
- if (url) {
24
- return getNamedUrl(url, i);
25
- }
26
- if (i.icon) {
27
- url = getSrc(i.icon);
28
- if (url) {
29
- return url;
30
- }
31
- url = getSrc(i.icon[i.mode]);
32
- if (url) {
33
- return url;
34
- }
35
- }
36
- return null;
37
- };
38
- const getNamedUrl = (iconName, iconEl) => {
39
- const url = getIconMap().get(iconName);
40
- if (url) {
41
- return url;
42
- }
43
- try {
44
- return getAssetPath(`svg/${iconName}.svg`);
45
- }
46
- catch (e) {
47
- console.log('e', e);
48
- /**
49
- * In the custom elements build version of ionicons, referencing an icon
50
- * by name will throw an invalid URL error because the asset path is not defined.
51
- * This catches that error and logs something that is more developer-friendly.
52
- * We also include a reference to the ion-icon element so developers can
53
- * figure out which instance of ion-icon needs to be updated.
54
- */
55
- console.warn(`[Ionicons Warning]: Could not load icon with name "${iconName}". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`, iconEl);
56
- }
57
- };
58
- const getName = (iconName, icon, mode, ios, md) => {
59
- // default to "md" if somehow the mode wasn't set
60
- mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
61
- // if an icon was passed in using the ios or md attributes
62
- // set the iconName to whatever was passed in
63
- if (ios && mode === 'ios') {
64
- iconName = toLower(ios);
65
- }
66
- else if (md && mode === 'md') {
67
- iconName = toLower(md);
68
- }
69
- else {
70
- if (!iconName && icon && !isSrc(icon)) {
71
- iconName = icon;
72
- }
73
- if (isStr(iconName)) {
74
- iconName = toLower(iconName);
75
- }
76
- }
77
- if (!isStr(iconName) || iconName.trim() === '') {
78
- return null;
79
- }
80
- // only allow alpha characters and dash
81
- const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
82
- if (invalidChars !== '') {
83
- return null;
84
- }
85
- return iconName;
86
- };
87
- const getSrc = (src) => {
88
- if (isStr(src)) {
89
- src = src.trim();
90
- if (isSrc(src)) {
91
- return src;
92
- }
93
- }
94
- return null;
95
- };
96
- const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
97
- const isStr = (val) => typeof val === 'string';
98
- const toLower = (val) => val.toLowerCase();
99
- /**
100
- * Elements inside of web components sometimes need to inherit global attributes
101
- * set on the host. For example, the inner input in `ion-input` should inherit
102
- * the `title` attribute that developers set directly on `ion-input`. This
103
- * helper function should be called in componentWillLoad and assigned to a variable
104
- * that is later used in the render function.
105
- *
106
- * This does not need to be reactive as changing attributes on the host element
107
- * does not trigger a re-render.
108
- */
109
- const inheritAttributes = (el, attributes = []) => {
110
- const attributeObject = {};
111
- attributes.forEach((attr) => {
112
- if (el.hasAttribute(attr)) {
113
- const value = el.getAttribute(attr);
114
- if (value !== null) {
115
- attributeObject[attr] = el.getAttribute(attr);
116
- }
117
- el.removeAttribute(attr);
118
- }
119
- });
120
- return attributeObject;
121
- };
122
- /**
123
- * Returns `true` if the document or host element
124
- * has a `dir` set to `rtl`. The host value will always
125
- * take priority over the root document value.
126
- */
127
- const isRTL = (hostEl) => {
128
- if (hostEl) {
129
- if (hostEl.dir !== '') {
130
- return hostEl.dir.toLowerCase() === 'rtl';
131
- }
132
- }
133
- return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';
134
- };
135
-
136
- const validateContent = (svgContent) => {
137
- const div = document.createElement('div');
138
- div.innerHTML = svgContent;
139
- // setup this way to ensure it works on our buddy IE
140
- for (let i = div.childNodes.length - 1; i >= 0; i--) {
141
- if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
142
- div.removeChild(div.childNodes[i]);
143
- }
144
- }
145
- // must only have 1 root element
146
- const svgElm = div.firstElementChild;
147
- if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
148
- const svgClass = svgElm.getAttribute('class') || '';
149
- svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
150
- // root element must be an svg
151
- // lets double check we've got valid elements
152
- // do not allow scripts
153
- if (isValid(svgElm)) {
154
- return div.innerHTML;
155
- }
156
- }
157
- return '';
158
- };
159
- const isValid = (elm) => {
160
- if (elm.nodeType === 1) {
161
- if (elm.nodeName.toLowerCase() === 'script') {
162
- return false;
163
- }
164
- for (let i = 0; i < elm.attributes.length; i++) {
165
- const name = elm.attributes[i].name;
166
- if (isStr(name) && name.toLowerCase().indexOf('on') === 0) {
167
- return false;
168
- }
169
- }
170
- for (let i = 0; i < elm.childNodes.length; i++) {
171
- if (!isValid(elm.childNodes[i])) {
172
- return false;
173
- }
174
- }
175
- }
176
- return true;
177
- };
178
- const isSvgDataUrl = (url) => url.startsWith('data:image/svg+xml');
179
- const isEncodedDataUrl = (url) => url.indexOf(';utf8,') !== -1;
180
-
181
- const ioniconContent = new Map();
182
- const requests = new Map();
183
- let parser;
184
- /**
185
- * Safely fallback to an empty svg
186
- */
187
- function safeFallback(url) {
188
- const svg = '';
189
- ioniconContent.set(url, svg);
190
- return svg;
191
- }
192
- const getSvgContent = (url, sanitize) => {
193
- /**
194
- * See if we already have a request for this url
195
- */
196
- const req = requests.get(url);
197
- if (req) {
198
- return req;
199
- }
200
- if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {
201
- /**
202
- * If the url is a data url of an svg, then try to parse it
203
- * with the DOMParser. This works with content security policies enabled.
204
- */
205
- if (isSvgDataUrl(url) && isEncodedDataUrl(url)) {
206
- return Promise.resolve(getSvgByUrl(url));
207
- }
208
- return fetchSvg(url, sanitize);
209
- }
210
- return Promise.resolve(safeFallback(url));
211
- };
212
- function getSvgByUrl(url) {
213
- if (!parser) {
214
- /**
215
- * Create an instance of the DOM parser. This creates a single
216
- * parser instance for the entire app, which is more efficient.
217
- */
218
- parser = new DOMParser();
219
- }
220
- const doc = parser.parseFromString(url, 'text/html');
221
- const svg = doc.querySelector('svg');
222
- if (svg) {
223
- ioniconContent.set(url, svg.outerHTML);
224
- return svg.outerHTML;
225
- }
226
- throw new Error(`Could not parse svg from ${url}`);
227
- }
228
- function fetchSvg(url, sanitize) {
229
- /**
230
- * We don't already have a request
231
- */
232
- const req = fetch(url)
233
- .then((rsp) => {
234
- /**
235
- * When fetching from a file:// URL, some browsers return
236
- * a 0 status code even when the request succeeds so don't
237
- * rely on rsp.ok as the only signal of success.
238
- */
239
- return rsp
240
- .text()
241
- .then((svgContent) => {
242
- if (svgContent && sanitize !== false) {
243
- svgContent = validateContent(svgContent);
244
- }
245
- const svg = svgContent || '';
246
- ioniconContent.set(url, svg);
247
- return svg;
248
- })
249
- .catch(() => safeFallback(url));
250
- })
251
- .catch(() => safeFallback(url));
252
- /**
253
- * Cache for the same requests
254
- */
255
- requests.set(url, req);
256
- return req;
257
- }
258
-
259
- const iconCss = () => `: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)}`;
260
-
261
- const Icon = class {
262
- constructor(hostRef) {
263
- registerInstance(this, hostRef);
264
- this.iconName = null;
265
- this.inheritedAttributes = {};
266
- this.didLoadIcon = false;
267
- this.isVisible = false;
268
- /**
269
- * The mode determines which platform styles to use.
270
- */
271
- this.mode = getIonMode();
272
- /**
273
- * If enabled, ion-icon will be loaded lazily when it's visible in the viewport.
274
- * Default, `false`.
275
- */
276
- this.lazy = false;
277
- /**
278
- * When set to `false`, SVG content that is HTTP fetched will not be checked
279
- * if the response SVG content has any `<script>` elements, or any attributes
280
- * that start with `on`, such as `onclick`.
281
- * @default true
282
- */
283
- this.sanitize = true;
284
- }
285
- componentWillLoad() {
286
- this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
287
- }
288
- connectedCallback() {
289
- /**
290
- * purposely do not return the promise here because loading
291
- * the svg file should not hold up loading the app
292
- * only load the svg if it's visible
293
- */
294
- this.waitUntilVisible(this.el, '50px', () => {
295
- this.isVisible = true;
296
- this.loadIcon();
297
- });
298
- }
299
- /**
300
- * Loads the icon after the component has finished rendering.
301
- */
302
- componentDidLoad() {
303
- /**
304
- * Addresses an Angular issue where property values are assigned after the 'connectedCallback' but prior to the registration of watchers.
305
- * This enhancement ensures the loading of an icon when the component has finished rendering and the icon has yet to apply the SVG data.
306
- * This modification pertains to the usage of Angular's binding syntax:
307
- * `<ion-icon [name]="myIconName"></ion-icon>`
308
- */
309
- if (!this.didLoadIcon) {
310
- this.loadIcon();
311
- }
312
- }
313
- /**
314
- * Disconnect the IntersectionObserver.
315
- */
316
- disconnectedCallback() {
317
- if (this.io) {
318
- this.io.disconnect();
319
- this.io = undefined;
320
- }
321
- }
322
- /**
323
- * Wait until the icon is visible in the viewport.
324
- * @param el - The element to observe.
325
- * @param rootMargin - The root margin of the observer.
326
- * @param cb - The callback to call when the element is visible.
327
- */
328
- waitUntilVisible(el, rootMargin, cb) {
329
- /**
330
- * IntersectionObserver is a browser API that allows you to observe
331
- * the visibility of an element relative to a root element. It is
332
- * supported in all modern browsers, except IE and when server-side
333
- * rendering.
334
- */
335
- const hasIntersectionObserverSupport = Boolean(Build.isBrowser && this.lazy && typeof window !== 'undefined' && window.IntersectionObserver);
336
- /**
337
- * browser doesn't support IntersectionObserver
338
- * so just fallback to always show it
339
- */
340
- if (!hasIntersectionObserverSupport) {
341
- return cb();
342
- }
343
- const io = (this.io = new window.IntersectionObserver((data) => {
344
- if (data[0].isIntersecting) {
345
- io.disconnect();
346
- this.io = undefined;
347
- cb();
348
- }
349
- }, { rootMargin }));
350
- io.observe(el);
351
- }
352
- /**
353
- * Watch for changes to the icon name, src, icon, ios, or md properties.
354
- * When a change is detected, the icon will be loaded.
355
- */
356
- loadIcon() {
357
- if (Build.isBrowser && this.isVisible) {
358
- const url = getUrl(this);
359
- if (url) {
360
- if (ioniconContent.has(url)) {
361
- // sync if it's already loaded
362
- this.svgContent = ioniconContent.get(url);
363
- }
364
- else {
365
- // async if it hasn't been loaded
366
- getSvgContent(url, this.sanitize).then(() => (this.svgContent = ioniconContent.get(url)));
367
- }
368
- this.didLoadIcon = true;
369
- }
370
- }
371
- this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
372
- }
373
- render() {
374
- const { flipRtl, iconName, inheritedAttributes, el } = this;
375
- const mode = this.mode || 'md';
376
- /**
377
- * we have designated that arrows & chevrons should automatically flip (unless flip-rtl
378
- * is set to false) because "back" is left in ltr and right in rtl, and "forward" is the opposite
379
- */
380
- const shouldAutoFlip = iconName
381
- ? (iconName.includes('arrow') || iconName.includes('chevron')) && flipRtl !== false
382
- : false;
383
- /**
384
- * if shouldBeFlippable is true, the icon should change direction when `dir` changes
385
- */
386
- const shouldBeFlippable = flipRtl || shouldAutoFlip;
387
- return (h(Host, Object.assign({ key: '0578c899781ca145dd8205acd9670af39b57cf2e', role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': shouldBeFlippable, 'icon-rtl': shouldBeFlippable && isRTL(el) }) }, inheritedAttributes), Build.isBrowser && this.svgContent ? (h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (h("div", { class: "icon-inner" }))));
388
- }
389
- static get assetsDirs() { return ["svg"]; }
390
- get el() { return getElement(this); }
391
- static get watchers() { return {
392
- "name": [{
393
- "loadIcon": 0
394
- }],
395
- "src": [{
396
- "loadIcon": 0
397
- }],
398
- "icon": [{
399
- "loadIcon": 0
400
- }],
401
- "ios": [{
402
- "loadIcon": 0
403
- }],
404
- "md": [{
405
- "loadIcon": 0
406
- }]
407
- }; }
408
- };
409
- /**
410
- * Get the mode of the document.
411
- * @returns The mode of the document.
412
- */
413
- const getIonMode = () => (Build.isBrowser && typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
414
- /**
415
- * Create color classes for the icon.
416
- * @param color - The color of the icon.
417
- * @returns The color classes for the icon.
418
- */
419
- const createColorClasses = (color) => {
420
- return color
421
- ? {
422
- 'ion-color': true,
423
- [`ion-color-${color}`]: true,
424
- }
425
- : null;
426
- };
427
- Icon.style = iconCss();
428
-
429
- export { Icon as ion_icon };
@@ -1 +0,0 @@
1
- import{r as t,a as s,h as e,g as i}from"./p-C6bbmyga.js";import{s as r,c as o,i as n}from"./p-CrjrbGJ3.js";import{S as a}from"./p-XRfh5Wrs.js";import"./p-CBXaOfXU.js";const c=class{updatePublishableKey(t){const s={};s.stripeAccount=this.stripeService.state.stripeAccount;const e=Object.values(s).filter(Boolean).length>0;this.initStripe(t,e?s: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,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 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(e){t(this,e),this.stripeLoaded=s(this,"stripeLoaded",7),this.confirm=s(this,"confirm",7),this.expressCheckoutClick=s(this,"expressCheckoutClick",7),this.cancel=s(this,"cancel",7),this.defaultConfirmResult=s(this,"defaultConfirmResult",7),this.intentType="payment",this.applicationName="stripe-pwa-elements",this.shouldUseDefaultConfirmAction=!0,this.progress="",this.stripeService=r.createStripeService(),this.expressCheckoutManager=r.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 s=this.stripeService.getStripe(),{intentType:e,clientSecret:i}=this;if(null==s)throw new Error("Stripe not initialized");if(null==i||""===i)throw new Error("Client secret is required");const r=await(()=>"payment"===e?s.confirmPayment({elements:this.stripeService.getElements(),clientSecret:i,confirmParams:{return_url:`${window.location.origin}${window.location.pathname}`},redirect:"if_required"}):s.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(s){console.error(s),t.complete("fail"),this.expressCheckoutManager.setError(s.message),this.progress="failure",this.defaultConfirmResultHandler(s)}}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 s=parseInt(this.buttonHeight.replace("px",""),10);isNaN(s)||(t.buttonHeight=s)}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(o())}disconnectedCallback(){this.expressCheckoutManager.unmount()}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:s,isReady:i}=this.expressCheckoutManager.getState();return"failure"===t?e("p",null,n.t("Failed to load Stripe")):"loading"===t?e("p",null,n.t("Loading")):e("div",{class:"stripe-express-checkout-wrap"},e("div",{id:"express-checkout-element"}),s&&e("div",{id:"express-checkout-errors",class:"stripe-element-errors"},s),!i&&"success"===t&&e("div",{class:"stripe-express-checkout-loading"},n.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}
@@ -1 +0,0 @@
1
- import{r as t,a as e,h as i,g as s}from"./p-C6bbmyga.js";import{s as r,c as n,i as o}from"./p-CrjrbGJ3.js";import{S as a}from"./p-XRfh5Wrs.js";import"./p-CBXaOfXU.js";const c=t=>{const{stripe:e,isCheckoutSession:i,checkout:s,checkoutSessionClientSecret:r,elements:n,intentClientSecret:o}=t,a={stripe:e};return i?null==s?{error:"Checkout not properly initialized"}:(a.checkout=s,a.checkoutSessionClientSecret=r,{props:a}):null==n?{error:"Elements not properly initialized"}:(a.elements=n,a.intentClientSecret=o,{props:a})},l=class{async initStripe(t,e){const i=++this.initGeneration;await this.stripeService.initialize(t,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName,clientSecret:this.intentClientSecret}),await this.mountWhenLoaded(i)}async initStripeWithCheckoutSession(t,e,i){const s=++this.initGeneration;await this.stripeService.initializeWithCheckoutSession(t,e,{stripeAccount:null==i?void 0:i.stripeAccount,applicationName:this.applicationName,elementsOptions:null==i?void 0:i.elementsOptions}),await this.mountWhenLoaded(s)}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.paymentElementManager.setError(t),this}updatePublishableKey(t){const e={};e.stripeAccount=this.stripeService.state.stripeAccount;const i=Object.values(e).filter((t=>null!=t&&""!==t)).length>0;this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(t,this.checkoutSessionClientSecret,{stripeAccount:e.stripeAccount}):this.initStripe(t,i?e:void 0)}updateStripeAccountId(t){this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:t}):this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:t})}async updateIntentClientSecret(){if(null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret)return;const{publishableKey:t,stripeAccount:e}=this.stripeService.state;null!=t&&""!==t&&await this.initStripe(t,{stripeAccount:e})}async updateCheckoutSessionClientSecret(t){null!=this.publishableKey&&""!==this.publishableKey&&null!=t&&""!==t&&await this.initStripeWithCheckoutSession(this.publishableKey,t,{stripeAccount:this.stripeAccount})}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=this.stripeService.getStripe(),e=!0===this.stripeService.state.isCheckoutSession;if(null==t)return void console.error("Stripe not properly initialized");const i=c({stripe:t,isCheckoutSession:e,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});"error"in i?console.error(i.error):this.formSubmit.emit(i.props)}async defaultFormSubmitResultHandler(t){this.defaultFormSubmitResult.emit(t)}async checkoutSessionConfirmResultHandler(t){this.checkoutSessionConfirmResult.emit(t)}componentWillRender(){const{publishableKey:t}=this.stripeService.state;null!=t&&""!==t&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}):this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeService.state.stripeAccount})))}async defaultFormSubmitAction(t,{stripe:e,elements:i}){t.preventDefault();try{const t=window.location.href,s=await(async(t,e,i,s)=>{const r=await("payment"===i?t.confirmPayment({elements:e,confirmParams:{return_url:s},redirect:"if_required"}):t.confirmSetup({elements:e,confirmParams:{return_url:s},redirect:"if_required"}));if(r.error)throw new a(r.error);return r})(e,i,this.intentType,t);this.defaultFormSubmitResultHandler(s)}catch(t){throw console.error(t),this.defaultFormSubmitResultHandler(t),t}}async checkoutSessionFormSubmitAction(t,e){t.preventDefault();try{const t=window.location.href,i=await(async(t,e)=>{var i;const s=await t.loadActions();if("error"===s.type)throw new a({type:"api_error",code:s.error.code||"checkout_session_error",message:s.error.message});const{actions:r}=s,n=await r.confirm({returnUrl:e,redirect:"if_required"});if("error"===n.type){const t={type:"card_error",code:n.error.code||"payment_failed",message:n.error.message,decline_code:"paymentFailed"===n.error.code?null===(i=n.error.paymentFailed)||void 0===i?void 0:i.declineCode:void 0};throw new a(t)}return n})(e,t);this.checkoutSessionConfirmResultHandler(i)}catch(t){throw console.error(t),this.checkoutSessionConfirmResultHandler(t instanceof Error?t:new Error(String(t))),t}}constructor(i){t(this,i),this.stripeLoaded=e(this,"stripeLoaded",7),this.formSubmit=e(this,"formSubmit",7),this.defaultFormSubmitResult=e(this,"defaultFormSubmitResult",7),this.checkoutSessionConfirmResult=e(this,"checkoutSessionConfirmResult",7),this.initGeneration=0,this.intentType="payment",this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.progress="",this.applicationName="stripe-pwa-elements",this.shouldUseDefaultFormSubmitAction=!0,this.stripeService=r.createStripeService(),this.paymentElementManager=r.createPaymentElementManager(this.stripeService)}componentWillLoad(){this.startStripe()}async mountWhenLoaded(t){if(t!==this.initGeneration)return;if("success"===this.stripeService.state.loadStripeStatus){if(await this.initElement(),t!==this.initGeneration)return;return void this.stripeLoadedEventHandler()}const e=this.stripeService.onChange("loadStripeStatus",(async i=>{t===this.initGeneration?"success"===i&&(await this.initElement(),t===this.initGeneration?(this.stripeLoadedEventHandler(),e()):e()):e()}))}hasCheckoutSessionClientSecret(){return null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret}startStripe(){null!=this.publishableKey&&""!==this.publishableKey&&(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount}):this.initStripeWithCheckoutSession(this.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeAccount}))}async initElement(){await this.paymentElementManager.initialize(this.el);const t=this.el.querySelector("#stripe-payment-element");null!=t?(null!=this._submitHandler&&t.removeEventListener("submit",this._submitHandler),this._submitHandler=async t=>{const e=this.stripeService.getStripe(),i=!0===this.stripeService.state.isCheckoutSession;if(null==e)return void console.error("Stripe not properly initialized");const s=c({stripe:e,isCheckoutSession:i,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});if("error"in s)return void console.error(s.error);const r=s.props;this.progress="loading";try{null!=this.handleSubmit?await this.handleSubmit(t,r):!0===this.shouldUseDefaultFormSubmitAction?i&&null!=r.checkout?await this.checkoutSessionFormSubmitAction(t,r.checkout):null!=this.intentClientSecret&&""!==this.intentClientSecret?await this.defaultFormSubmitAction(t,r):t.preventDefault():t.preventDefault(),await this.formSubmitEventHandler(),null==this.handleSubmit&&!0!==this.shouldUseDefaultFormSubmitAction||(this.progress="success")}catch(t){const e=t instanceof Error?t.message:String(t);this.paymentElementManager.setError(e),this.progress="failure"}},t.addEventListener("submit",this._submitHandler)):console.error("Form element #stripe-payment-element not found")}componentDidLoad(){this.el.classList.add(n())}disconnectedCallback(){if(this.paymentElementManager.unmount(),null!=this._submitHandler){const t=this.el.querySelector("#stripe-payment-element");null!=t&&t.removeEventListener("submit",this._submitHandler)}}render(){const{loadStripeStatus:t,isCheckoutSession:e}=this.stripeService.state,{errorMessage:s}=this.paymentElementManager.getState();if("failure"===t)return i("p",null,o.t("Failed to load Stripe"));const r=(t=>{const{progress:e,isCheckoutSession:i,loadStripeStatus:s,intentClientSecret:r}=t;return"loading"===e||!(i?"success"===s:null!=r&&""!==r)})({progress:this.progress,isCheckoutSession:!0===e,loadStripeStatus:t,intentClientSecret:this.intentClientSecret});return i("div",{class:"stripe-payment-sheet-wrap"},i("form",{id:"stripe-payment-element"},i("div",{class:"stripe-heading"},o.t(this.sheetTitle)),i("div",null,i("div",{class:"stripe-section-title"},o.t("Payment information"))),i("div",{class:"payment-info visible"},i("div",{id:"payment-element"})),i("div",{id:"payment-errors",class:"stripe-element-errors"},s),i("div",{style:{marginTop:"32px"}},i("button",{type:"submit",disabled:r},o.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return s(this)}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}}};l.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-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 .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.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{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 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)}';export{l as stripe_payment_element}
@@ -1 +0,0 @@
1
- import{r as t,a as s,h as e,g as i}from"./p-C6bbmyga.js";import{s as r,c as o,i as a}from"./p-CrjrbGJ3.js";import"./p-CBXaOfXU.js";const n=class{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 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 new Error("Address element not initialized");return await t.getValue({format:"localized"})}updatePublishableKey(t){const s={};null!=this.stripeAccount&&""!==this.stripeAccount&&(s.stripeAccount=this.stripeAccount),this.initStripe(t,Object.keys(s).length>0?s:void 0)}updateStripeAccountId(t){const s=this.stripeService.state.publishableKey||this.publishableKey;null!=s&&""!==s&&this.initStripe(s,{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(e){t(this,e),this.stripeLoaded=s(this,"stripeLoaded",7),this.formSubmit=s(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=r.createStripeService(),this.addressElementManager=r.createAddressElementManager(this.stripeService)}componentWillLoad(){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 s=this.el.querySelector("#stripe-address-element-form");null!=s?(null!=this.formSubmitListener&&s.removeEventListener("submit",this.formSubmitListener),this.formSubmitListener=async t=>{if(t.preventDefault(),null!=this.addressElementManager.getElement()){this.progress="loading";try{const s=await this.getValue();null!=this.handleSubmit&&await this.handleSubmit(t,{address:s}),await this.formSubmitEventHandler(),null!=this.handleSubmit&&(this.progress="success")}catch(t){const s=t instanceof Error?t.message:String(t);this.addressElementManager.setError(s),this.progress="failure"}}else console.error("Address element not initialized")},s.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:s}=this.addressElementManager.getState();if("failure"===t)return e("p",null,a.t("Failed to load Stripe"));const i="loading"===this.progress;return e("div",{class:"stripe-payment-sheet-wrap"},e("form",{id:"stripe-address-element-form"},e("div",{class:"stripe-heading"},a.t(this.sheetTitle)),e("div",{class:"payment-info address visible"},e("div",{id:"address-element"})),e("div",{id:"address-errors",class:"stripe-element-errors"},s),e("div",{class:"submit-button-wrapper"},e("button",{type:"submit",disabled:i},a.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return i(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}.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)}';export{n as stripe_address_element}
@@ -1 +0,0 @@
1
- import{e as o,r as t,f as n,h as i,d as r,g as s}from"./p-C6bbmyga.js";let e;const c=(o,t,n,i,r)=>(n="ios"===(n&&h(n))?"ios":"md",i&&"ios"===n?o=h(i):r&&"md"===n?o=h(r):(o||!t||a(t)||(o=t),d(o)&&(o=h(o))),d(o)&&""!==o.trim()?""!==o.replace(/[a-z]|-|\d/gi,"")?null:o:null),l=o=>d(o)&&(o=o.trim(),a(o))?o:null,a=o=>o.length>0&&/(\/|\.)/.test(o),d=o=>"string"==typeof o,h=o=>o.toLowerCase(),f=o=>{if(1===o.nodeType){if("script"===o.nodeName.toLowerCase())return!1;for(let t=0;t<o.attributes.length;t++){const n=o.attributes[t].name;if(d(n)&&0===n.toLowerCase().indexOf("on"))return!1}for(let t=0;t<o.childNodes.length;t++)if(!f(o.childNodes[t]))return!1}return!0},u=new Map,m=new Map;let p;function g(o){return u.set(o,""),""}const w=class{constructor(o){t(this,o),this.iconName=null,this.inheritedAttributes={},this.didLoadIcon=!1,this.isVisible=!1,this.mode=v(),this.lazy=!1,this.sanitize=!0}componentWillLoad(){this.inheritedAttributes=((o,t=[])=>{const n={};return t.forEach((t=>{o.hasAttribute(t)&&(null!==o.getAttribute(t)&&(n[t]=o.getAttribute(t)),o.removeAttribute(t))})),n})(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,i){if(!Boolean(n.isBrowser&&this.lazy&&"undefined"!=typeof window&&window.IntersectionObserver))return i();const r=this.io=new window.IntersectionObserver((o=>{o[0].isIntersecting&&(r.disconnect(),this.io=void 0,i())}),{rootMargin:t});r.observe(o)}loadIcon(){if(n.isBrowser&&this.isVisible){const t=(t=>{let n=l(t.src);if(n)return n;if(n=c(t.name,t.icon,t.mode,t.ios,t.md),n)return((t,n)=>{const i=(()=>{if("undefined"==typeof window)return new Map;if(!e){const o=window;o.Ionicons=o.Ionicons||{},e=o.Ionicons.map=o.Ionicons.map||new Map}return e})().get(t);if(i)return i;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.`,n)}})(n,t);if(t.icon){if(n=l(t.icon),n)return n;if(n=l(t.icon[t.mode]),n)return n}return null})(this);t&&(u.has(t)?this.svgContent=u.get(t):((o,t)=>m.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){p||(p=new DOMParser);const t=p.parseFromString(o,"text/html").querySelector("svg");if(t)return u.set(o,t.outerHTML),t.outerHTML;throw new Error(`Could not parse svg from ${o}`)}(o)):function(o,t){const n=fetch(o).then((n=>n.text().then((n=>{n&&!1!==t&&(n=(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 n=t.firstElementChild;if(n&&"svg"===n.nodeName.toLowerCase()){const o=n.getAttribute("class")||"";if(n.setAttribute("class",(o+" s-ion-icon").trim()),f(n))return t.innerHTML}return""})(n));const i=n||"";return u.set(o,i),i})).catch((()=>g(o))))).catch((()=>g(o)));return m.set(o,n),n}(o,t):Promise.resolve(g(o))))(t,this.sanitize).then((()=>this.svgContent=u.get(t))),this.didLoadIcon=!0)}this.iconName=c(this.name,this.icon,this.mode,this.ios,this.md)}render(){const{flipRtl:o,iconName:t,inheritedAttributes:s,el:e}=this,c=this.mode||"md",l=!!t&&(t.includes("arrow")||t.includes("chevron"))&&!1!==o,a=o||l;return i(r,Object.assign({key:"0578c899781ca145dd8205acd9670af39b57cf2e",role:"img",class:Object.assign(Object.assign({[c]:!0},b(this.color)),{[`icon-${this.size}`]:!!this.size,"flip-rtl":a,"icon-rtl":a&&(d=e,d&&""!==d.dir?"rtl"===d.dir.toLowerCase():"rtl"===(null===document||void 0===document?void 0:document.dir.toLowerCase()))})},s),i("div",n.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}]}}},v=()=>n.isBrowser&&"undefined"!=typeof document&&document.documentElement.getAttribute("mode")||"md",b=o=>o?{"ion-color":!0,[`ion-color-${o}`]:!0}:null;w.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)}";export{w as ion_icon}
@@ -1 +0,0 @@
1
- import{r as t,a as e,h as i,g as o,d as s}from"./p-C6bbmyga.js";import{s as n,c as a,i as r}from"./p-CrjrbGJ3.js";import{S as l}from"./p-XRfh5Wrs.js";import"./p-CBXaOfXU.js";const d=t=>{if(null!=t&&""!==t)return{stripeAccount:t}},c=class{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.cardElementManager.setError(t),this}updatePublishableKey(t){null!=t&&""!==t&&this.initStripe(t,d(this.stripeAccount))}updateStripeAccountId(t){const e=this.stripeService.state.publishableKey||this.publishableKey;null!=e&&""!==e&&this.initStripe(e,{stripeAccount:t})}async setPaymentRequestOption(t){return this.paymentRequestOption=t,this.createPaymentRequestButton(),this}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=this.cardElementManager.getElements(),e=this.stripeService.getStripe();null!=t?this.formSubmit.emit({cardCVCElement:t.cardCVC,cardExpiryElement:t.cardExpiry,cardNumberElement:t.cardNumber,stripe:e}):console.error("Card elements not initialized")}async defaultFormSubmitResultHandler(t){this.defaultFormSubmitResult.emit(t)}componentWillRender(){const{publishableKey:t}=this.stripeService.state;null!=t&&""!==t&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||this.initStripe(t,d(this.stripeService.state.stripeAccount)))}async defaultFormSubmitAction(t,{stripe:e,cardNumberElement:i,intentClientSecret:o}){t.preventDefault();try{const t=await((t,e,i,o)=>"payment"===this.intentType?t.confirmCardPayment(i,{payment_method:{card:o}}):t.confirmCardSetup(i,{payment_method:{card:o}}))(e,0,o,i);if(null!=t.error)throw new l(t.error);this.defaultFormSubmitResultHandler(t)}catch(t){throw console.error(t),this.defaultFormSubmitResultHandler(t),t}}constructor(i){t(this,i),this.stripeLoaded=e(this,"stripeLoaded",7),this.formSubmit=e(this,"formSubmit",7),this.defaultFormSubmitResult=e(this,"defaultFormSubmitResult",7),this.paymentRequestButtonCreated=!1,this.intentType="payment",this.zip=!0,this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.progress="",this.zipCode="",this.applicationName="stripe-pwa-elements",this.showLabel=!1,this.shouldUseDefaultFormSubmitAction=!0,this.stripeService=n.createStripeService(),this.cardElementManager=n.createCardElementManager(this.stripeService)}componentWillLoad(){null!=this.publishableKey&&""!==this.publishableKey&&this.initStripe(this.publishableKey,d(this.stripeAccount))}async initElement(){await this.cardElementManager.initialize(this.el);const t=this.el.querySelector("#stripe-card-element");null!=t?t.addEventListener("submit",(async t=>{const e=this.cardElementManager.getElements(),i=this.stripeService.getStripe(),{intentClientSecret:o}=this;if(null==e||null==i)return void console.error("Stripe not properly initialized");const s={cardCVCElement:e.cardCVC,cardExpiryElement:e.cardExpiry,cardNumberElement:e.cardNumber,stripe:i,intentClientSecret:o,zipCode:this.zipCode};this.progress="loading";try{null!=this.handleSubmit?await this.handleSubmit(t,s):!0===this.shouldUseDefaultFormSubmitAction&&null!=o&&""!==o?await this.defaultFormSubmitAction(t,s):t.preventDefault(),await this.formSubmitEventHandler(),null==this.handleSubmit&&!0!==this.shouldUseDefaultFormSubmitAction||(this.progress="success")}catch(t){this.cardElementManager.setError(t.message),this.progress="failure"}})):console.error("Form element #stripe-card-element not found")}componentDidLoad(){this.el.classList.add(a())}componentDidRender(){this.showPaymentRequestButton&&this.paymentRequestOption&&!this.paymentRequestButtonCreated&&this.createPaymentRequestButton()}disconnectedCallback(){this.cardElementManager.unmount()}createPaymentRequestButton(){const{showPaymentRequestButton:t,paymentRequestOption:e}=this;if(this.paymentRequestButtonCreated)return null;if(!t||null==e)return null;if(null==document)return null;const i=this.el.querySelector("#stripe-payment-request-button");if(null==i)return console.error("Target element #stripe-payment-request-button not found"),null;if(null!=i.querySelector("stripe-payment-request-button"))return this.paymentRequestButtonCreated=!0,null;const o=document.createElement("stripe-payment-request-button");i.appendChild(o),customElements.whenDefined("stripe-payment-request-button").then((()=>(((t,e)=>{const{paymentRequestPaymentMethodHandler:i,paymentRequestShippingOptionChangeHandler:o,paymentRequestShippingAddressChangeHandler:s}=e;t.setPaymentRequestOption(e),null!=i&&t.setPaymentMethodEventHandler(i),null!=o&&t.setPaymentRequestShippingOptionEventHandler(o),null!=s&&t.setPaymentRequestShippingAddressEventHandler(s)})(o,e),o.initStripe(this.publishableKey)))),this.paymentRequestButtonCreated=!0}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:e}=this.cardElementManager.getState();if("failure"===t)return i("p",null,r.t("Failed to load Stripe"));const o="loading"===this.progress;return i("div",{class:"stripe-payment-sheet-wrap"},i("form",{id:"stripe-card-element"},i("div",{class:"stripe-heading"},r.t(this.sheetTitle)),i("div",{id:"stripe-payment-request-button"}),i("div",null,i("div",{class:"stripe-section-title"},r.t("Card information"))),i("div",{class:"payment-info card visible"},i("fieldset",{class:"stripe-input-box"},i("div",null,i("label",null,this.showLabel?i("lenged",null,r.t("Card Number")):null,i("div",{id:"card-number"}))),i("div",{class:"stripe-input-column",style:{display:"flex"}},i("label",{style:{width:"50%"}},this.showLabel?i("lenged",null,r.t("MM / YY")):null,i("div",{id:"card-expiry"})),i("label",{style:{width:"50%"}},this.showLabel?i("lenged",null,r.t("CVC")):null,i("div",{id:"card-cvc"}))))),i("div",{id:"card-errors",class:"stripe-element-errors"},e),this.zip?i("div",{style:{marginTop:"1.5rem"}},i("div",{class:"stripe-section-title"},r.t("Country or region"))):null,this.zip?i("div",{class:"payment-info card visible"},i("fieldset",{class:"stripe-input-box"},i("div",null,i("label",null,this.showLabel?i("lenged",null,r.t("Postal Code")):null,i("input",{id:"zip",name:"zip",type:"text",inputmode:"numeric",class:"StripeElement",style:{width:"100%"},placeholder:r.t("Postal Code"),value:this.zipCode,onInput:t=>{this.zipCode=t.target.value}}))))):null,i("div",{style:{marginTop:"32px"}},i("button",{type:"submit",disabled:o},r.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return o(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-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 .StripeElement{padding:8px 16px;min-height:64px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.stripe-payment-sheet-wrap .stripe-input-box{background-color:#fff;border-radius:6px;border:1px solid var(--color-input-border);overflow:hidden;filter:drop-shadow(0 0 2px var(--color-input-border-shadow))}.stripe-payment-sheet-wrap .stripe-input-box>*{border-bottom:1px solid var(--color-input-border)}.stripe-payment-sheet-wrap .stripe-input-box>*:last-child{border-bottom:none}.stripe-payment-sheet-wrap .stripe-input-column>*{border-right:1px solid var(--color-input-border)}.stripe-payment-sheet-wrap .stripe-input-column>*:last-child{border-right:none}.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 label{color:var(--color-label)}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.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)}';const p=class{constructor(i){t(this,i),this.close=e(this,"close",7),this.showCloseButton=!0,this.open=!1,this.renderedOpen=!1}onOpenChange(t){t?this.openModalAnimation():(this.renderedOpen=!1,this.close.emit())}async toggleModal(){this.open?await this.closeModal():await this.openModal()}async openModal(){this.open=!0}async closeModal(){this.open=!1}componentDidLoad(){const t=a();t&&this.el.classList.add(t),this.open&&this.openModalAnimation()}openModalAnimation(){if(!this.el.shadowRoot)return void(this.renderedOpen=!0);const t=this.el.shadowRoot.querySelector(".modal-child");t.classList.add("loading"),t.style.willChange="transform",t.addEventListener("transitionend",(()=>{t.style.willChange="auto",t.classList.remove("loading")}),{once:!0}),requestAnimationFrame((()=>{this.renderedOpen=this.open}))}render(){const{renderedOpen:t,showCloseButton:e}=this;return i(s,{key:"38fb86acf7cf5887a426c67b1a1271f7fae7048c"},i("div",{key:"f751d92c327ee2e564edfcd4d18f4dca43c20c37",class:"modal-row"+(t?" open":""),onClick:()=>this.closeModal()},i("div",{key:"11519ccd44a5069df3247c530a2c1e114eab7aef",class:"modal-child",onClick:t=>t.stopPropagation()},e?i("div",{class:"modal-close-button-wrap"},i("ion-icon",{name:"close",size:"large",class:"modal-close-button",onClick:()=>this.closeModal()})):null,i("div",{key:"a41f7f263b488b5bbc2a999cbabf6b9e407bca85",class:"modal-loading"},i("svg",{key:"0b3b25cb2812bc4d837fb4b7e6af4a5f42f0247e",version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 2400 2400"},i("g",{key:"10a9f9ec59699e6d2988b9c65cd02da1754fd760","stroke-width":"200","stroke-linecap":"round",stroke:"currentColor",fill:"none",id:"spinner"},i("line",{key:"ed271fa584b930ceed5397c271b31e0d48c72f72",x1:"1200",y1:"600",x2:"1200",y2:"100"}),i("line",{key:"3cf855a84f3ab58b914b7aeb784fbc5b95d8ae94",opacity:"0.5",x1:"1200",y1:"2300",x2:"1200",y2:"1800"}),i("line",{key:"2cce4b62a276399235509e94f47a63acf9c69a0f",opacity:"0.917",x1:"900",y1:"680.4",x2:"650",y2:"247.4"}),i("line",{key:"64c175ef068591417b043f7630a44d34eae7cb59",opacity:"0.417",x1:"1750",y1:"2152.6",x2:"1500",y2:"1719.6"}),i("line",{key:"0856a654e3aa756dfb1e9fc316b8b379fa9d5a4e",opacity:"0.833",x1:"680.4",y1:"900",x2:"247.4",y2:"650"}),i("line",{key:"c60f1f8495df9b8cdcc8941255d08c01a0e1c02f",opacity:"0.333",x1:"2152.6",y1:"1750",x2:"1719.6",y2:"1500"}),i("line",{key:"204bc2a7765e43b86f91c3fb9b1e72a3a39bb323",opacity:"0.75",x1:"600",y1:"1200",x2:"100",y2:"1200"}),i("line",{key:"7584b272f9efd7f746c1bcc5c8a5576098b02381",opacity:"0.25",x1:"2300",y1:"1200",x2:"1800",y2:"1200"}),i("line",{key:"7a053e9eb5f0da3fbf6fb7c9680bf73073bb126d",opacity:"0.667",x1:"680.4",y1:"1500",x2:"247.4",y2:"1750"}),i("line",{key:"f8b817095143d739589e45c99b03c7afbdfc8293",opacity:"0.167",x1:"2152.6",y1:"650",x2:"1719.6",y2:"900"}),i("line",{key:"aae0e36dbdfff44196f9758c8a5ed2337139ebe0",opacity:"0.583",x1:"900",y1:"1719.6",x2:"650",y2:"2152.6"}),i("line",{key:"3a257b30cb289f29ba386ccca7519bcdc22c3786",opacity:"0.083",x1:"1750",y1:"247.4",x2:"1500",y2:"680.4"}),i("animateTransform",{key:"c6b8e73025589403dd3d08f84b02eb824763d056",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"})))),i("div",{key:"da5ef8031e5b826d854a065d8172389cdd84fbf0",class:"modal-content"},i("slot",{key:"fbe97a3a4d5489de5ae6f49342c58d537b317842"})))))}get el(){return o(this)}static get watchers(){return{open:[{onOpenChange:0}]}}};p.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}.modal-row.open{opacity:1;pointer-events:auto;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{width:32px;display:block;fill:var(--color-label);cursor:pointer}';export{c as stripe_card_element,p as stripe_modal}
@@ -1 +0,0 @@
1
- import{r as t,a as e,h as s,d as i,g as a}from"./p-C6bbmyga.js";import{l as n}from"./p-CBXaOfXU.js";const o=class{constructor(s){t(this,s),this.stripeLoaded=e(this,"stripeLoaded",7),this.loadStripeStatus="",this.applicationName="stripe-pwa-elements"}async isAvailable(t){if(void 0===this.publishableKey)throw new Error("You should set publishableKey before calling this method.");const e=(await n(this.publishableKey,{stripeAccount:this.stripeAccount})).paymentRequest({country:"US",currency:"usd",total:{label:"Demo total",amount:1099},disableWallets:["applePay","googlePay","browserCard"].filter((e=>e!==t))}),s=await e.canMakePayment();if(!s||"applePay"===t&&!s[t]||"googlePay"===t&&!s[t])throw new Error(`This device cannot use ${t}.`)}async setPaymentMethodEventHandler(t){this.paymentMethodEventHandler=t}async setPaymentRequestShippingOptionEventHandler(t){this.shippingOptionEventHandler=t}async setPaymentRequestShippingAddressEventHandler(t){this.shippingAddressEventHandler=t}stripeLoadedEventHandler(){const t={stripe:this.stripe};this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}componentWillLoad(){void 0!==this.publishableKey&&void 0!==this.paymentRequestOption?this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount}):this.loadStripeStatus="failure"}connectedCallback(){console.warn("[stripe-pwa-elements] <stripe-payment-request-button> is deprecated. stripe.paymentRequest() is being removed in Stripe.js 9.x (deprecated 2025-09-30 / removed 2026-03-25). Please migrate to <stripe-express-checkout-element>, which supports Apple Pay, Google Pay, Link, PayPal, and more. Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/")}async setPaymentRequestOption(t){return this.paymentRequestOption=t,this}async initStripe(t,e){this.loadStripeStatus="loading",n(t,{stripeAccount:null==e?void 0:e.stripeAccount}).then((t=>{this.loadStripeStatus="success",t.registerAppInfo({name:this.applicationName}),this.stripe=t})).catch((t=>{console.log(t),this.loadStripeStatus="failure"})).then((()=>{if(this.stripe)return this.initElement(0==!(null==e?void 0:e.showButton))})).then((()=>{this.stripe&&this.stripeLoadedEventHandler()}))}async initElement(t=!0){const e=this.stripe.paymentRequest(this.paymentRequestOption);if(!await e.canMakePayment())throw new Error("Payment Request is not supported.");if(this.paymentMethodEventHandler&&e.on("paymentmethod",(t=>{this.paymentMethodEventHandler(t,this.stripe)})),this.shippingOptionEventHandler&&e.on("shippingoptionchange",(t=>{this.shippingOptionEventHandler(t,this.stripe)})),this.shippingAddressEventHandler&&e.on("shippingaddresschange",(t=>{this.shippingAddressEventHandler(t,this.stripe)})),t){this.paymentRequestElement&&this.paymentRequestElement.unmount();const t=this.stripe.elements().create("paymentRequestButton",{paymentRequest:e});this.paymentRequestElement=t;const s=this.el.querySelector("#payment-request-button");t.mount(s),this.el.querySelector("#payment-request").classList.add("visible")}else e.show()}disconnectedCallback(){this.paymentRequestElement&&(this.paymentRequestElement.unmount(),this.paymentRequestElement=void 0),this.stripe=void 0}render(){return s(i,{key:"dd3ae348f9e9c798acdeca095ad9c157afd4734f"},s("div",{key:"f2e13b6980318ede1812d4f54223b7aeb9cfc51b",id:"payment-request"},s("div",{key:"ff6c1218924044d1ffc11354909f25c1745ef254",id:"payment-request-button"})),s("slot",{key:"ec2131a0503baa15cdcf3571040e9ce6040da708"}))}get el(){return a(this)}};o.style=":host{display:block}";export{o as stripe_payment_request_button}
@@ -1 +0,0 @@
1
- import{r as t,a as s,h as e,g as r}from"./p-C6bbmyga.js";import{s as i,c as o,i as c}from"./p-CrjrbGJ3.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=i.createStripeService(),this.currencySelectorElementManager=i.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=o();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,c.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}