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
@@ -6,7 +6,8 @@ export class StripeCardElementModal {
6
6
  */
7
7
  this.showLabel = false;
8
8
  /**
9
- * The component will provide a function to call the `stripe.confirmCardPayment`API.
9
+ * The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`,
10
+ * `stripe.confirmCardSetup` when it is `'setup'`.
10
11
  * If you want to customize the behavior, should set false.
11
12
  * And listen the 'formSubmit' event on the element
12
13
  */
@@ -94,7 +95,7 @@ export class StripeCardElementModal {
94
95
  cardElement.setPaymentRequestOption(options);
95
96
  }
96
97
  render() {
97
- return (h("stripe-modal", { key: 'a0229c55472e3c6f417086fa08d79e1ec8a8c485', open: this.open, showCloseButton: this.showCloseButton }, h("stripe-card-element", { key: '799f08c781bad089cec8b1338e9a714d080abd51', 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 })));
98
+ return (h("stripe-modal", { key: '4904f57b562da9ce4fc348fb376f931cac707540', open: this.open, showCloseButton: this.showCloseButton }, h("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 })));
98
99
  }
99
100
  static get is() { return "stripe-card-element-modal"; }
100
101
  static get originalStyleUrls() {
@@ -264,7 +265,7 @@ export class StripeCardElementModal {
264
265
  "optional": false,
265
266
  "docs": {
266
267
  "tags": [],
267
- "text": "The component will provide a function to call the `stripe.confirmCardPayment`API.\nIf you want to customize the behavior, should set false.\nAnd listen the 'formSubmit' event on the element"
268
+ "text": "The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`,\n`stripe.confirmCardSetup` when it is `'setup'`.\nIf you want to customize the behavior, should set false.\nAnd listen the 'formSubmit' event on the element"
268
269
  },
269
270
  "getter": false,
270
271
  "setter": false,
@@ -83,6 +83,8 @@ export class StripeExpressCheckoutElement {
83
83
  await this.stripeService.initialize(publishableKey, {
84
84
  stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
85
85
  applicationName: this.applicationName,
86
+ clientSecret: this.clientSecret,
87
+ elementsOptions: this.buildElementsOptions(),
86
88
  });
87
89
  // If already successfully loaded, initialize elements immediately
88
90
  if (this.stripeService.state.loadStripeStatus === 'success') {
@@ -101,6 +103,22 @@ export class StripeExpressCheckoutElement {
101
103
  });
102
104
  }
103
105
  }
106
+ /**
107
+ * Options for `stripe.elements()` when there is no client secret.
108
+ * Stripe.js reads mode / amount / currency from the Elements group, not from the element itself.
109
+ */
110
+ buildElementsOptions() {
111
+ if (this.currency == null || this.currency === '') {
112
+ return undefined;
113
+ }
114
+ if (this.intentType === 'setup') {
115
+ return { mode: 'setup', currency: this.currency };
116
+ }
117
+ if (this.amount === undefined) {
118
+ return undefined;
119
+ }
120
+ return { mode: 'payment', amount: this.amount, currency: this.currency };
121
+ }
104
122
  /**
105
123
  * Update element options dynamically
106
124
  * @param options - Partial options to update
@@ -33,11 +33,13 @@
33
33
  opacity: 0;
34
34
  pointer-events: none;
35
35
  will-change: transform;
36
+ visibility: hidden;
36
37
  }
37
38
 
38
39
  .modal-row.open {
39
40
  opacity: 1;
40
41
  pointer-events: auto;
42
+ visibility: visible;
41
43
  position: fixed;
42
44
  top: 0;
43
45
  left: 0;
@@ -91,8 +93,28 @@
91
93
  padding-left: 8px;
92
94
  }
93
95
  .modal-close-button-wrap .modal-close-button {
96
+ display: block;
97
+ width: 32px;
98
+ cursor: pointer;
99
+ border-radius: 4px;
100
+ }
101
+ .modal-close-button-wrap .modal-close-button:focus-visible {
102
+ outline: 2px solid var(--color-label, #000);
103
+ outline-offset: 2px;
104
+ }
105
+ .modal-close-button-wrap .modal-close-button ion-icon {
94
106
  width: 32px;
95
107
  display: block;
96
108
  fill: var(--color-label);
97
- cursor: pointer;
109
+ }
110
+
111
+ .modal-child:focus {
112
+ outline: none;
113
+ }
114
+
115
+ .focus-guard {
116
+ position: absolute;
117
+ width: 1px;
118
+ height: 1px;
119
+ overflow: hidden;
98
120
  }
@@ -1,5 +1,7 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { checkPlatform } from "../../utils/utils";
3
+ import { getDeepActiveElement, getTabbableElements } from "../../utils/focus";
4
+ import { i18n } from "../../utils/i18n";
3
5
  export class StripeModal {
4
6
  constructor() {
5
7
  /**
@@ -16,14 +18,64 @@ export class StripeModal {
16
18
  * Ionic Ref: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/accordion/accordion.tsx#L83
17
19
  */
18
20
  this.renderedOpen = false;
21
+ /**
22
+ * The element that had focus before the modal opened. Focus returns to it when the modal closes.
23
+ */
24
+ this.returnFocusElement = null;
25
+ /**
26
+ * Set when the modal opens; the initial focus is moved after the open state has been rendered.
27
+ */
28
+ this.shouldFocusOnRender = false;
29
+ /**
30
+ * The last element inside the modal that received focus.
31
+ * `FocusEvent.relatedTarget` is `null` when focus crosses an iframe boundary (e.g. leaving a Stripe Elements field),
32
+ * so the guards fall back to this value to tell which way focus is moving.
33
+ */
34
+ this.lastFocusedInside = null;
35
+ this.handleKeyDown = (event) => {
36
+ if (!this.open || event.key !== 'Escape') {
37
+ return;
38
+ }
39
+ // Escape that cancels an IME composition (keyCode 229) or that a slotted widget (e.g. an autocomplete popup) already handled must not close the modal
40
+ if (event.isComposing || event.keyCode === 229 || event.defaultPrevented) {
41
+ return;
42
+ }
43
+ // Prevent an outer modal (or the page) from also reacting to the same key press
44
+ event.preventDefault();
45
+ event.stopPropagation();
46
+ this.closeModal();
47
+ };
48
+ /**
49
+ * Whether focus came from a focusable element inside the modal (not from the container itself or from outside).
50
+ * The guards use it to tell Tab from Shift+Tab: a guard cannot see the key, but it can see where focus came from.
51
+ */
52
+ this.handleFocusIn = (event) => {
53
+ var _a, _b;
54
+ const target = ((_b = (_a = event.composedPath) === null || _a === void 0 ? void 0 : _a.call(event)[0]) !== null && _b !== void 0 ? _b : event.target);
55
+ if ((target === null || target === void 0 ? void 0 : target.classList) !== undefined && !target.classList.contains('focus-guard')) {
56
+ this.lastFocusedInside = target;
57
+ }
58
+ };
59
+ this.handleStartGuardFocus = (event) => {
60
+ // Shift+Tab from the first element wraps to the last; Tab from the container (or from outside) enters at the first
61
+ this.cameFromFocusableInside(event) ? this.focusLastElement() : this.focusFirstElement();
62
+ };
63
+ this.handleEndGuardFocus = (event) => {
64
+ // Tab from the last element wraps to the first; Shift+Tab from outside enters at the last
65
+ this.isInsideModal(this.getFocusOrigin(event)) ? this.focusFirstElement() : this.focusLastElement();
66
+ };
19
67
  }
20
68
  onOpenChange(open) {
21
69
  if (open) {
70
+ this.rememberFocus();
22
71
  this.openModalAnimation();
23
72
  }
24
73
  else {
25
74
  this.renderedOpen = false;
75
+ this.shouldFocusOnRender = false;
76
+ this.lastFocusedInside = null;
26
77
  this.close.emit();
78
+ this.restoreFocus();
27
79
  }
28
80
  }
29
81
  /**
@@ -50,10 +102,85 @@ export class StripeModal {
50
102
  this.el.classList.add(platformName);
51
103
  }
52
104
  if (this.open) {
105
+ this.rememberFocus();
53
106
  this.openModalAnimation();
54
107
  }
55
108
  }
109
+ componentDidRender() {
110
+ if (this.shouldFocusOnRender && this.renderedOpen) {
111
+ this.shouldFocusOnRender = false;
112
+ this.focusFirstElement();
113
+ }
114
+ }
115
+ rememberFocus() {
116
+ var _a;
117
+ if (typeof document === 'undefined') {
118
+ return;
119
+ }
120
+ const active = getDeepActiveElement(document);
121
+ // Ignore focus that is already inside the modal and the default document focus
122
+ if (active === null || active === document.body || this.el.contains(active) || ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(active)) === true) {
123
+ return;
124
+ }
125
+ this.returnFocusElement = active;
126
+ }
127
+ restoreFocus() {
128
+ const target = this.returnFocusElement;
129
+ this.returnFocusElement = null;
130
+ if (target != null && target.isConnected && typeof target.focus === 'function') {
131
+ target.focus();
132
+ }
133
+ }
134
+ getTabbableElements() {
135
+ if (this.dialogElement === undefined) {
136
+ return [];
137
+ }
138
+ return getTabbableElements(this.dialogElement).filter(element => !element.classList.contains('focus-guard'));
139
+ }
140
+ isInsideModal(node) {
141
+ var _a;
142
+ return node !== null && (this.el.contains(node) || ((_a = this.dialogElement) === null || _a === void 0 ? void 0 : _a.contains(node)) === true);
143
+ }
144
+ getFocusOrigin(event) {
145
+ var _a;
146
+ return (_a = event.relatedTarget) !== null && _a !== void 0 ? _a : this.lastFocusedInside;
147
+ }
148
+ /**
149
+ * Whether focus came from a focusable element inside the modal (not from the container itself or from outside).
150
+ * The guards use it to tell Tab from Shift+Tab: a guard cannot see the key, but it can see where focus came from.
151
+ */
152
+ cameFromFocusableInside(event) {
153
+ const from = this.getFocusOrigin(event);
154
+ return from !== this.dialogElement && this.isInsideModal(from);
155
+ }
156
+ /**
157
+ * Slotted content is hidden (and therefore not focusable) while the open transition runs.
158
+ * When it ends, move focus from the placeholder (container / close button) into the content, unless the user already moved it.
159
+ */
160
+ focusContentAfterLoading() {
161
+ var _a;
162
+ if (!this.open || this.contentElement === undefined) {
163
+ return;
164
+ }
165
+ const active = getDeepActiveElement(document);
166
+ const focusIsIdle = active === null || active === document.body || active === this.dialogElement || active === this.closeButtonElement;
167
+ if (!focusIsIdle) {
168
+ return;
169
+ }
170
+ (_a = getTabbableElements(this.contentElement)[0]) === null || _a === void 0 ? void 0 : _a.focus();
171
+ }
172
+ focusFirstElement() {
173
+ var _a;
174
+ const [first] = this.getTabbableElements();
175
+ (_a = (first !== null && first !== void 0 ? first : this.dialogElement)) === null || _a === void 0 ? void 0 : _a.focus();
176
+ }
177
+ focusLastElement() {
178
+ var _a, _b;
179
+ const elements = this.getTabbableElements();
180
+ (_b = ((_a = elements[elements.length - 1]) !== null && _a !== void 0 ? _a : this.dialogElement)) === null || _b === void 0 ? void 0 : _b.focus();
181
+ }
56
182
  openModalAnimation() {
183
+ this.shouldFocusOnRender = true;
57
184
  if (!this.el.shadowRoot) {
58
185
  this.renderedOpen = true;
59
186
  return;
@@ -64,6 +191,7 @@ export class StripeModal {
64
191
  modalChild.addEventListener('transitionend', () => {
65
192
  modalChild.style.willChange = 'auto';
66
193
  modalChild.classList.remove('loading');
194
+ this.focusContentAfterLoading();
67
195
  }, { once: true });
68
196
  requestAnimationFrame(() => {
69
197
  this.renderedOpen = this.open;
@@ -71,7 +199,8 @@ export class StripeModal {
71
199
  }
72
200
  render() {
73
201
  const { renderedOpen, showCloseButton } = this;
74
- return (h(Host, { key: '38fb86acf7cf5887a426c67b1a1271f7fae7048c' }, h("div", { key: 'f751d92c327ee2e564edfcd4d18f4dca43c20c37', class: `modal-row${renderedOpen ? ' open' : ''}`, onClick: () => this.closeModal() }, h("div", { key: '11519ccd44a5069df3247c530a2c1e114eab7aef', class: "modal-child", onClick: e => e.stopPropagation() }, showCloseButton ? (h("div", { class: "modal-close-button-wrap" }, h("ion-icon", { name: "close", size: "large", class: "modal-close-button", onClick: () => this.closeModal() }))) : null, h("div", { key: 'a41f7f263b488b5bbc2a999cbabf6b9e407bca85', class: "modal-loading" }, h("svg", { key: '0b3b25cb2812bc4d837fb4b7e6af4a5f42f0247e', version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2400 2400" }, h("g", { key: '10a9f9ec59699e6d2988b9c65cd02da1754fd760', "stroke-width": "200", "stroke-linecap": "round", stroke: "currentColor", fill: "none", id: "spinner" }, h("line", { key: 'ed271fa584b930ceed5397c271b31e0d48c72f72', x1: "1200", y1: "600", x2: "1200", y2: "100" }), h("line", { key: '3cf855a84f3ab58b914b7aeb784fbc5b95d8ae94', opacity: "0.5", x1: "1200", y1: "2300", x2: "1200", y2: "1800" }), h("line", { key: '2cce4b62a276399235509e94f47a63acf9c69a0f', opacity: "0.917", x1: "900", y1: "680.4", x2: "650", y2: "247.4" }), h("line", { key: '64c175ef068591417b043f7630a44d34eae7cb59', opacity: "0.417", x1: "1750", y1: "2152.6", x2: "1500", y2: "1719.6" }), h("line", { key: '0856a654e3aa756dfb1e9fc316b8b379fa9d5a4e', opacity: "0.833", x1: "680.4", y1: "900", x2: "247.4", y2: "650" }), h("line", { key: 'c60f1f8495df9b8cdcc8941255d08c01a0e1c02f', opacity: "0.333", x1: "2152.6", y1: "1750", x2: "1719.6", y2: "1500" }), h("line", { key: '204bc2a7765e43b86f91c3fb9b1e72a3a39bb323', opacity: "0.75", x1: "600", y1: "1200", x2: "100", y2: "1200" }), h("line", { key: '7584b272f9efd7f746c1bcc5c8a5576098b02381', opacity: "0.25", x1: "2300", y1: "1200", x2: "1800", y2: "1200" }), h("line", { key: '7a053e9eb5f0da3fbf6fb7c9680bf73073bb126d', opacity: "0.667", x1: "680.4", y1: "1500", x2: "247.4", y2: "1750" }), h("line", { key: 'f8b817095143d739589e45c99b03c7afbdfc8293', opacity: "0.167", x1: "2152.6", y1: "650", x2: "1719.6", y2: "900" }), h("line", { key: 'aae0e36dbdfff44196f9758c8a5ed2337139ebe0', opacity: "0.583", x1: "900", y1: "1719.6", x2: "650", y2: "2152.6" }), h("line", { key: '3a257b30cb289f29ba386ccca7519bcdc22c3786', opacity: "0.083", x1: "1750", y1: "247.4", x2: "1500", y2: "680.4" }), h("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" })))), h("div", { key: 'da5ef8031e5b826d854a065d8172389cdd84fbf0', class: "modal-content" }, h("slot", { key: 'fbe97a3a4d5489de5ae6f49342c58d537b317842' }))))));
202
+ const guardTabIndex = renderedOpen ? 0 : -1;
203
+ return (h(Host, { key: '684539aa83388bec518e73bbd8aa19e73cfde07d', role: renderedOpen ? 'dialog' : undefined, "aria-modal": renderedOpen ? 'true' : undefined, onKeyDown: this.handleKeyDown, onFocusin: this.handleFocusIn }, h("div", { key: 'db6f1088c1ef7e35aefba06faaf3e9c2dcaa3419', class: `modal-row${renderedOpen ? ' open' : ''}`, onClick: () => this.closeModal() }, h("div", { key: '89c783c793261566b77ba962da730a973e8cbd8d', class: "modal-child", tabindex: "-1", ref: el => (this.dialogElement = el), onClick: e => e.stopPropagation() }, h("div", { key: '0e329b32c25509134f5a25adb266b03dd0bd71d8', class: "focus-guard", tabindex: guardTabIndex, onFocus: this.handleStartGuardFocus }), showCloseButton ? (h("div", { class: "modal-close-button-wrap" }, h("button", { type: "button", class: "modal-close-button", "aria-label": i18n.t('Close'), ref: el => (this.closeButtonElement = el), onClick: () => this.closeModal() }, h("ion-icon", { name: "close", size: "large", "aria-hidden": "true" })))) : null, h("div", { key: 'f2b5dcbc72ba3178dd920ceecd4fd339f69598d7', class: "modal-loading" }, h("svg", { key: '1f7afb6cc48be8fc84f9b69678f2c8ca1e2b145e', version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2400 2400" }, h("g", { key: 'ed40edfeabe02bf198b194eb04777e1f4a6b203e', "stroke-width": "200", "stroke-linecap": "round", stroke: "currentColor", fill: "none", id: "spinner" }, h("line", { key: '03c9170ee9e566227fddcc9037a92c48ed954b89', x1: "1200", y1: "600", x2: "1200", y2: "100" }), h("line", { key: '302aec0abf20ee8afe66245ecbc9d5e2adbade82', opacity: "0.5", x1: "1200", y1: "2300", x2: "1200", y2: "1800" }), h("line", { key: 'd3bea8de4d689a5c5c423a72dd23a0fbc64c29dd', opacity: "0.917", x1: "900", y1: "680.4", x2: "650", y2: "247.4" }), h("line", { key: '543e33091e87bf85c3a0e4d4881babdffbe4b825', opacity: "0.417", x1: "1750", y1: "2152.6", x2: "1500", y2: "1719.6" }), h("line", { key: '5c2e0a3722955a8ee17b57f3061097f18681ba7e', opacity: "0.833", x1: "680.4", y1: "900", x2: "247.4", y2: "650" }), h("line", { key: '1100d48a500bfca6075243cf69be9e6f575bdae6', opacity: "0.333", x1: "2152.6", y1: "1750", x2: "1719.6", y2: "1500" }), h("line", { key: '6c3f7c309a5ed15c6ffce11925efe09dbc8e6f3b', opacity: "0.75", x1: "600", y1: "1200", x2: "100", y2: "1200" }), h("line", { key: '7708c31b141f3a151e8dc78c89b20442f34ce1e2', opacity: "0.25", x1: "2300", y1: "1200", x2: "1800", y2: "1200" }), h("line", { key: 'd419fc4006e8063f9bbc35b4cb2a9a88010c623a', opacity: "0.667", x1: "680.4", y1: "1500", x2: "247.4", y2: "1750" }), h("line", { key: '78ccaf11a6e7c3183d210b787ce9374bd7c4aff4', opacity: "0.167", x1: "2152.6", y1: "650", x2: "1719.6", y2: "900" }), h("line", { key: 'acb1444de9fcd9aa1a3182d759d3b8aeb0906284', opacity: "0.583", x1: "900", y1: "1719.6", x2: "650", y2: "2152.6" }), h("line", { key: '6adef9d6a54f302c8da7c84cae32851723ce25cc', opacity: "0.083", x1: "1750", y1: "247.4", x2: "1500", y2: "680.4" }), h("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" })))), h("div", { key: '120bebc59c0fc013cb2bfbaf8957ad3731e1ddf4', class: "modal-content", ref: el => (this.contentElement = el) }, h("slot", { key: '0f371823f8fddd61e2b0ce24a59477103d979875' })), h("div", { key: 'fa8436f70871d59055dab2cf0fcfe5d4577328c1', class: "focus-guard", tabindex: guardTabIndex, onFocus: this.handleEndGuardFocus })))));
75
204
  }
76
205
  static get is() { return "stripe-modal"; }
77
206
  static get encapsulation() { return "shadow"; }
@@ -5,7 +5,7 @@ import { loadStripe } from "@stripe/stripe-js";
5
5
  * `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
6
6
  * Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
7
7
  * and more via the modern Express Checkout Element API.
8
- * Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/
8
+ * Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
9
9
  */
10
10
  export class StripePaymentRequestButton {
11
11
  constructor() {
@@ -87,7 +87,7 @@ export class StripePaymentRequestButton {
87
87
  console.warn('[stripe-pwa-elements] <stripe-payment-request-button> is deprecated. ' +
88
88
  'stripe.paymentRequest() is being removed in Stripe.js 9.x (deprecated 2025-09-30 / removed 2026-03-25). ' +
89
89
  'Please migrate to <stripe-express-checkout-element>, which supports Apple Pay, Google Pay, Link, PayPal, and more. ' +
90
- 'Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/');
90
+ 'Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/');
91
91
  }
92
92
  /**
93
93
  * @param option
@@ -194,7 +194,7 @@ export class StripePaymentRequestButton {
194
194
  this.stripe = undefined;
195
195
  }
196
196
  render() {
197
- return (h(Host, { key: 'dd3ae348f9e9c798acdeca095ad9c157afd4734f' }, h("div", { key: 'f2e13b6980318ede1812d4f54223b7aeb9cfc51b', id: "payment-request" }, h("div", { key: 'ff6c1218924044d1ffc11354909f25c1745ef254', id: "payment-request-button" })), h("slot", { key: 'ec2131a0503baa15cdcf3571040e9ce6040da708' })));
197
+ return (h(Host, { key: '644a4b729c72e87b42df5e1b43262d3195e7ebc6' }, h("div", { key: 'aff26789868bbec0f1f6abc463fb14d7f3e73c1b', id: "payment-request" }, h("div", { key: '074a25f3c5b2575696ddaeacf2715935212964a5', id: "payment-request-button" })), h("slot", { key: '5173400bd63ab201f02934cea4edcab4bb7eed9c' })));
198
198
  }
199
199
  static get is() { return "stripe-payment-request-button"; }
200
200
  static get originalStyleUrls() {
@@ -0,0 +1,179 @@
1
+ /**
2
+ * State machine behind `<stripe-payment-sheet>`.
3
+ *
4
+ * Pure functions only: the component feeds events in and performs the returned effects
5
+ * (loading Stripe.js, showing the modal, confirming, emitting events, resolving `present()`).
6
+ * The same rules are model-checked in Quint; see the exhaustive test next to this file.
7
+ */
8
+ export const initialSheetState = {
9
+ phase: 'idle',
10
+ generation: 0,
11
+ pendingPresent: false,
12
+ openRequested: false,
13
+ };
14
+ const CLIENT_SECRET_PATTERNS = [
15
+ [/^pi_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/, 'payment'],
16
+ [/^seti_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/, 'setup'],
17
+ ];
18
+ /**
19
+ * Tell whether a client secret belongs to a PaymentIntent or a SetupIntent from its prefix.
20
+ * @param clientSecret - The `client_secret` of a PaymentIntent (`pi_..._secret_...`) or SetupIntent (`seti_..._secret_...`)
21
+ * @returns The intent kind, or undefined when the format is not recognized
22
+ */
23
+ export const intentKindFromClientSecret = (clientSecret) => {
24
+ const match = CLIENT_SECRET_PATTERNS.find(([pattern]) => pattern.test(clientSecret));
25
+ return match === null || match === void 0 ? void 0 : match[1];
26
+ };
27
+ const unchanged = (state) => ({ state, effects: [] });
28
+ /**
29
+ * Resolve the pending `present()` promise, if any.
30
+ */
31
+ const resolvePending = (state, result) => {
32
+ if (!state.pendingPresent) {
33
+ return unchanged(state);
34
+ }
35
+ return { state: Object.assign(Object.assign({}, state), { pendingPresent: false }), effects: [{ type: 'resolvePresent', result }] };
36
+ };
37
+ /**
38
+ * Close the sheet as canceled: hide it, emit the event and resolve `present()`.
39
+ */
40
+ const cancel = (state) => {
41
+ const resolved = resolvePending(Object.assign(Object.assign({}, state), { openRequested: false }), 'paymentSheetCanceled');
42
+ const visible = state.phase === 'presented' || state.phase === 'confirming';
43
+ return {
44
+ state: resolved.state,
45
+ effects: [...(visible ? [{ type: 'hide' }] : []), { type: 'emit', event: 'paymentSheetCanceled' }, ...resolved.effects],
46
+ };
47
+ };
48
+ const changeSecret = (state, clientSecret) => {
49
+ if (clientSecret === '') {
50
+ return unchanged(state);
51
+ }
52
+ // Never drop the result of a running confirmation; apply the new secret once it finishes
53
+ if (state.phase === 'confirming') {
54
+ return unchanged(Object.assign(Object.assign({}, state), { deferredClientSecret: clientSecret }));
55
+ }
56
+ const canceled = state.phase === 'presented' ? cancel(state) : unchanged(state);
57
+ const generation = state.generation + 1;
58
+ const intentKind = intentKindFromClientSecret(clientSecret);
59
+ if (intentKind == null) {
60
+ const resolved = resolvePending(Object.assign(Object.assign({}, canceled.state), { phase: 'loadFailed', generation, intentKind: undefined, openRequested: false }), 'paymentSheetFailed');
61
+ return {
62
+ state: resolved.state,
63
+ effects: [...canceled.effects, { type: 'emit', event: 'paymentSheetFailedToLoad' }, ...resolved.effects],
64
+ };
65
+ }
66
+ return {
67
+ state: Object.assign(Object.assign({}, canceled.state), { phase: 'loading', generation, intentKind }),
68
+ effects: [...canceled.effects, { type: 'load', generation, clientSecret, intentKind }],
69
+ };
70
+ };
71
+ /**
72
+ * Apply a secret that arrived while confirming.
73
+ */
74
+ const applyDeferredSecret = (result) => {
75
+ const { deferredClientSecret } = result.state;
76
+ if (deferredClientSecret == null) {
77
+ return result;
78
+ }
79
+ const next = changeSecret(Object.assign(Object.assign({}, result.state), { deferredClientSecret: undefined }), deferredClientSecret);
80
+ return { state: next.state, effects: [...result.effects, ...next.effects] };
81
+ };
82
+ const isCurrentConfirmation = (state, generation) => state.phase === 'confirming' && state.generation === generation;
83
+ /**
84
+ * Compute the next state and the effects to perform for an event.
85
+ * @param state - Current state
86
+ * @param event - Event to handle
87
+ */
88
+ export const transition = (state, event) => {
89
+ switch (event.type) {
90
+ case 'secretChanged':
91
+ return changeSecret(state, event.clientSecret);
92
+ case 'loadSucceeded': {
93
+ if (event.generation !== state.generation || state.phase !== 'loading') {
94
+ return unchanged(state);
95
+ }
96
+ const open = state.openRequested;
97
+ return {
98
+ state: Object.assign(Object.assign({}, state), { phase: open ? 'presented' : 'ready', openRequested: false }),
99
+ effects: [{ type: 'emit', event: 'paymentSheetLoaded' }, ...(open ? [{ type: 'show' }] : [])],
100
+ };
101
+ }
102
+ case 'loadFailed': {
103
+ if (event.generation !== state.generation || state.phase !== 'loading') {
104
+ return unchanged(state);
105
+ }
106
+ const resolved = resolvePending(Object.assign(Object.assign({}, state), { phase: 'loadFailed', openRequested: false }), 'paymentSheetFailed');
107
+ return { state: resolved.state, effects: [{ type: 'emit', event: 'paymentSheetFailedToLoad' }, ...resolved.effects] };
108
+ }
109
+ case 'presentRequested':
110
+ if (state.pendingPresent) {
111
+ return unchanged(state);
112
+ }
113
+ switch (state.phase) {
114
+ case 'ready':
115
+ return { state: Object.assign(Object.assign({}, state), { phase: 'presented', pendingPresent: true }), effects: [{ type: 'show' }] };
116
+ case 'idle':
117
+ case 'loading':
118
+ return unchanged(Object.assign(Object.assign({}, state), { pendingPresent: true, openRequested: true }));
119
+ case 'presented':
120
+ case 'confirming':
121
+ // Already shown through the `open` attribute: wait for its result
122
+ return unchanged(Object.assign(Object.assign({}, state), { pendingPresent: true }));
123
+ default:
124
+ // loadFailed / completed / errored: nothing can be shown
125
+ return { state, effects: [{ type: 'resolvePresent', result: 'paymentSheetFailed' }] };
126
+ }
127
+ case 'openRequested':
128
+ if (state.phase === 'ready') {
129
+ return { state: Object.assign(Object.assign({}, state), { phase: 'presented' }), effects: [{ type: 'show' }] };
130
+ }
131
+ if (state.phase === 'idle' || state.phase === 'loading') {
132
+ return unchanged(Object.assign(Object.assign({}, state), { openRequested: true }));
133
+ }
134
+ return unchanged(state);
135
+ case 'closeRequested':
136
+ if (state.phase === 'presented') {
137
+ const canceled = cancel(state);
138
+ return { state: Object.assign(Object.assign({}, canceled.state), { phase: 'ready' }), effects: canceled.effects };
139
+ }
140
+ // Closing before the sheet was shown withdraws the request to open it
141
+ if ((state.phase === 'idle' || state.phase === 'loading') && state.openRequested) {
142
+ return cancel(state);
143
+ }
144
+ return unchanged(state);
145
+ case 'submitted':
146
+ if (state.phase !== 'presented' || state.intentKind == null) {
147
+ return unchanged(state);
148
+ }
149
+ return {
150
+ state: Object.assign(Object.assign({}, state), { phase: 'confirming' }),
151
+ effects: [{ type: 'confirm', generation: state.generation, intentKind: state.intentKind }],
152
+ };
153
+ case 'confirmSucceeded': {
154
+ if (!isCurrentConfirmation(state, event.generation)) {
155
+ return unchanged(state);
156
+ }
157
+ const resolved = resolvePending(Object.assign(Object.assign({}, state), { phase: 'completed' }), 'paymentSheetCompleted');
158
+ return applyDeferredSecret({
159
+ state: resolved.state,
160
+ effects: [{ type: 'hide' }, { type: 'emit', event: 'paymentSheetCompleted' }, ...resolved.effects],
161
+ });
162
+ }
163
+ case 'confirmDeclined':
164
+ if (!isCurrentConfirmation(state, event.generation)) {
165
+ return unchanged(state);
166
+ }
167
+ return applyDeferredSecret({ state: Object.assign(Object.assign({}, state), { phase: 'presented' }), effects: [{ type: 'showError', message: event.message }] });
168
+ case 'confirmFailed': {
169
+ if (!isCurrentConfirmation(state, event.generation)) {
170
+ return unchanged(state);
171
+ }
172
+ const resolved = resolvePending(Object.assign(Object.assign({}, state), { phase: 'errored' }), 'paymentSheetFailed');
173
+ return applyDeferredSecret({
174
+ state: resolved.state,
175
+ effects: [{ type: 'hide' }, { type: 'emit', event: 'paymentSheetFailed' }, ...resolved.effects],
176
+ });
177
+ }
178
+ }
179
+ };
@@ -0,0 +1,68 @@
1
+ :root {
2
+ --color-label: #565656;
3
+ --color-placeholder: #acacac;
4
+ --color-heading-text: #333;
5
+ --color-text-error: #ef4444;
6
+ --color-input-border: #e4e4e6;
7
+ --color-input-border-shadow: rgba(228, 228, 230, 0.6);
8
+ --color-button-text: rgba(255, 255, 255, 0.95);
9
+ --color-button-text-disabled: rgba(255, 255, 255, 0.4);
10
+ --color-primary: #0074d4;
11
+ }
12
+
13
+ /* Remove all the styles of the "User-Agent-Stylesheet", except for the 'display' property */
14
+ stripe-payment-sheet {
15
+ display: contents;
16
+ }
17
+
18
+ .stripe-payment-sheet-wrap {
19
+ box-sizing: border-box;
20
+ }
21
+ .stripe-payment-sheet-wrap *:where(:not(iframe, canvas, img, svg, video):not(svg *)) {
22
+ all: unset;
23
+ display: revert;
24
+ background: none;
25
+ border: none;
26
+ font-family: "Roboto", sans-serif;
27
+ box-sizing: border-box;
28
+ }
29
+ .stripe-payment-sheet-wrap button {
30
+ cursor: pointer;
31
+ }
32
+ .stripe-payment-sheet-wrap {
33
+ display: block;
34
+ width: 100%;
35
+ background: #fff;
36
+ padding: 32px 16px;
37
+ }
38
+ .stripe-payment-sheet-wrap .stripe-heading {
39
+ font-size: 24px;
40
+ font-weight: bold;
41
+ color: var(--color-heading-text);
42
+ margin-bottom: 24px;
43
+ }
44
+ .stripe-payment-sheet-wrap .payment-info {
45
+ margin-top: 8px;
46
+ }
47
+ .stripe-payment-sheet-wrap .stripe-element-errors {
48
+ margin-top: 8px;
49
+ font-size: 14px;
50
+ color: var(--color-text-error);
51
+ }
52
+ .stripe-payment-sheet-wrap .stripe-submit {
53
+ margin-top: 32px;
54
+ }
55
+ .stripe-payment-sheet-wrap button {
56
+ display: block;
57
+ color: var(--color-button-text);
58
+ background-color: var(--color-primary);
59
+ width: 100%;
60
+ text-align: center;
61
+ padding: 16px 16px;
62
+ font-size: 18px;
63
+ border-radius: 6px;
64
+ min-height: 42px;
65
+ }
66
+ .stripe-payment-sheet-wrap button:disabled {
67
+ color: var(--color-button-text-disabled);
68
+ }
@@ -0,0 +1,90 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s)
4
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ const SUPPORTED_OPTION_KEYS = ['merchantDisplayName', 'paymentMethodLayout', 'defaultBillingDetails', 'returnURL', 'style'];
14
+ const LAYOUTS = {
15
+ horizontal: 'tabs',
16
+ vertical: 'accordion',
17
+ automatic: 'auto',
18
+ };
19
+ const THEMES = {
20
+ alwaysLight: 'stripe',
21
+ alwaysDark: 'night',
22
+ };
23
+ /**
24
+ * Drop keys whose value is undefined.
25
+ */
26
+ const compact = (value) => Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined));
27
+ /**
28
+ * Build the Payment Element options from the payment sheet options.
29
+ * @param options - Payment sheet options
30
+ */
31
+ export const toPaymentElementOptions = (options) => {
32
+ if (options == null) {
33
+ return {};
34
+ }
35
+ const { merchantDisplayName, paymentMethodLayout, defaultBillingDetails } = options;
36
+ const elementOptions = {};
37
+ if (merchantDisplayName != null) {
38
+ elementOptions.business = { name: merchantDisplayName };
39
+ }
40
+ if (paymentMethodLayout != null) {
41
+ elementOptions.layout = LAYOUTS[paymentMethodLayout];
42
+ }
43
+ if (defaultBillingDetails != null) {
44
+ const { address } = defaultBillingDetails, contact = __rest(defaultBillingDetails, ["address"]);
45
+ const billingDetails = compact(contact);
46
+ if (address != null) {
47
+ const { postalCode } = address, rest = __rest(address, ["postalCode"]);
48
+ billingDetails.address = compact(Object.assign(Object.assign({}, rest), { postal_code: postalCode }));
49
+ }
50
+ elementOptions.defaultValues = { billingDetails };
51
+ }
52
+ return elementOptions;
53
+ };
54
+ /**
55
+ * Build the Elements appearance from the payment sheet style.
56
+ * @param style - `alwaysLight` or `alwaysDark`
57
+ */
58
+ export const toAppearance = (style) => {
59
+ if (style == null) {
60
+ return undefined;
61
+ }
62
+ return { theme: THEMES[style] };
63
+ };
64
+ /**
65
+ * List the given options that have no effect on the web (yet), sorted by name.
66
+ * @param options - Payment sheet options
67
+ */
68
+ export const unsupportedOptionKeys = (options) => {
69
+ if (options == null) {
70
+ return [];
71
+ }
72
+ return Object.entries(options)
73
+ .filter(([key, value]) => value !== undefined && !SUPPORTED_OPTION_KEYS.includes(key))
74
+ .map(([key]) => key)
75
+ .sort();
76
+ };
77
+ /**
78
+ * Stripe error types after which the customer can fix the input or simply try again.
79
+ * Types are listed at https://docs.stripe.com/api/errors and in `StripeErrorType` of @stripe/stripe-js.
80
+ */
81
+ const RECOVERABLE_ERROR_TYPES = ['card_error', 'validation_error', 'api_connection_error', 'rate_limit_error', 'api_error'];
82
+ /**
83
+ * Tell whether a confirmation error lets the customer try again in the open sheet.
84
+ * Other errors (for example `invalid_request_error` for an intent that already succeeded) end the sheet with `paymentSheetFailed`.
85
+ * @param error - Error thrown while confirming
86
+ */
87
+ export const isRecoverableConfirmError = (error) => {
88
+ const type = error === null || error === void 0 ? void 0 : error.type;
89
+ return typeof type === 'string' && RECOVERABLE_ERROR_TYPES.includes(type);
90
+ };