@amos.com/amos-js 0.10.3 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.mjs +257 -324
- package/dist/jwt.d.ts +0 -4
- package/dist/types.d.ts +0 -10
- package/package.json +1 -1
- package/src/jwt.ts +0 -25
- package/src/messaging.ts +0 -19
- package/src/plaid-bank-ui.ts +0 -11
- package/src/types.ts +0 -11
- package/dist/log.d.ts +0 -12
- package/src/log.ts +0 -74
package/dist/index.mjs
CHANGED
|
@@ -74,13 +74,7 @@ function r(e) {
|
|
|
74
74
|
signature: r
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
function i() {
|
|
78
|
-
if (typeof window > "u") return !1;
|
|
79
|
-
let { hostname: e } = window.location;
|
|
80
|
-
return e === "localhost" || e.endsWith(".localhost");
|
|
81
|
-
}
|
|
82
|
-
function a(e) {
|
|
83
|
-
if (i()) return "https://embed.localhost";
|
|
77
|
+
function i(e) {
|
|
84
78
|
let { env: t = "sandbox" } = r(e).payload;
|
|
85
79
|
switch (t) {
|
|
86
80
|
case "production": return "https://embed.amos.com";
|
|
@@ -89,108 +83,71 @@ function a(e) {
|
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
85
|
//#endregion
|
|
92
|
-
//#region src/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/log.ts
|
|
98
|
-
var s = /* @__PURE__ */ new Set([
|
|
99
|
-
"authorization",
|
|
100
|
-
"cookie",
|
|
101
|
-
"set-cookie",
|
|
102
|
-
"x-api-key"
|
|
103
|
-
]), c = /* @__PURE__ */ new Set([
|
|
104
|
-
"authorization",
|
|
105
|
-
"encrypted_account_number",
|
|
106
|
-
"link_token",
|
|
107
|
-
"public_token",
|
|
108
|
-
"token"
|
|
109
|
-
]);
|
|
110
|
-
function l(e) {
|
|
111
|
-
let t = {};
|
|
112
|
-
for (let [n, r] of Object.entries(e)) t[n] = s.has(n.toLowerCase()) ? "[REDACTED]" : r;
|
|
113
|
-
return t;
|
|
86
|
+
//#region src/plaid-session.ts
|
|
87
|
+
var a = /* @__PURE__ */ new WeakMap();
|
|
88
|
+
function o(e, t) {
|
|
89
|
+
a.set(e, t);
|
|
114
90
|
}
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
if (typeof e == "object" && e) {
|
|
118
|
-
let t = {};
|
|
119
|
-
for (let [n, r] of Object.entries(e)) t[n] = c.has(n) ? "[REDACTED]" : u(r);
|
|
120
|
-
return t;
|
|
121
|
-
}
|
|
122
|
-
return e;
|
|
91
|
+
function s(e) {
|
|
92
|
+
if (e) return a.get(e);
|
|
123
93
|
}
|
|
124
|
-
function
|
|
125
|
-
e.
|
|
126
|
-
type: "PARENT_INFO_LOG",
|
|
127
|
-
message: t,
|
|
128
|
-
endpoint: n,
|
|
129
|
-
headers: l(r),
|
|
130
|
-
body: u(i)
|
|
131
|
-
}), new URL(e.src).origin);
|
|
94
|
+
function c(e) {
|
|
95
|
+
e && a.delete(e);
|
|
132
96
|
}
|
|
133
97
|
//#endregion
|
|
134
|
-
//#region src/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
f.set(e, t);
|
|
138
|
-
}
|
|
139
|
-
function m(e) {
|
|
140
|
-
if (e) return f.get(e);
|
|
141
|
-
}
|
|
142
|
-
function h(e) {
|
|
143
|
-
e && f.delete(e);
|
|
98
|
+
//#region src/types.ts
|
|
99
|
+
function l(e) {
|
|
100
|
+
return e;
|
|
144
101
|
}
|
|
145
102
|
//#endregion
|
|
146
103
|
//#region src/messaging.ts
|
|
147
|
-
function
|
|
104
|
+
function u(e) {
|
|
148
105
|
return new URL(e.src).origin;
|
|
149
106
|
}
|
|
150
|
-
function
|
|
151
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
107
|
+
function d(e) {
|
|
108
|
+
e?.contentWindow && e.contentWindow.postMessage(l({ type: "PARENT_ACKNOWLEDGED_IFRAME_READY" }), u(e));
|
|
152
109
|
}
|
|
153
|
-
function
|
|
154
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
110
|
+
function f({ iframe: e, appearance: t = {} }) {
|
|
111
|
+
e?.contentWindow && e.contentWindow.postMessage(l({
|
|
155
112
|
type: "UPDATE_APPEARANCE",
|
|
156
113
|
appearance: t
|
|
157
|
-
}),
|
|
114
|
+
}), u(e));
|
|
158
115
|
}
|
|
159
|
-
function
|
|
160
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
116
|
+
function p({ iframe: e, props: t, height: n }) {
|
|
117
|
+
e?.contentWindow && e.contentWindow.postMessage(l({
|
|
161
118
|
type: "UPDATE_APPLE_PAY_BUTTON",
|
|
162
119
|
height: n,
|
|
163
120
|
props: t
|
|
164
|
-
}),
|
|
121
|
+
}), u(e));
|
|
165
122
|
}
|
|
166
|
-
function
|
|
167
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
123
|
+
function m({ iframe: e, props: t, height: n }) {
|
|
124
|
+
e?.contentWindow && e.contentWindow.postMessage(l({
|
|
168
125
|
type: "UPDATE_GOOGLE_PAY_BUTTON",
|
|
169
126
|
height: n,
|
|
170
127
|
props: t
|
|
171
|
-
}),
|
|
128
|
+
}), u(e));
|
|
172
129
|
}
|
|
173
|
-
function
|
|
174
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
130
|
+
function h({ iframe: e, amount: t }) {
|
|
131
|
+
e?.contentWindow && e.contentWindow.postMessage(l({
|
|
175
132
|
type: "UPDATE_AMOUNT",
|
|
176
133
|
amount: t
|
|
177
|
-
}),
|
|
134
|
+
}), u(e));
|
|
178
135
|
}
|
|
179
|
-
function
|
|
180
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
136
|
+
function g({ iframe: e, merchantName: t }) {
|
|
137
|
+
e?.contentWindow && e.contentWindow.postMessage(l({
|
|
181
138
|
type: "UPDATE_MERCHANT_NAME",
|
|
182
139
|
merchantName: t
|
|
183
|
-
}),
|
|
140
|
+
}), u(e));
|
|
184
141
|
}
|
|
185
|
-
function
|
|
186
|
-
let t =
|
|
142
|
+
function _({ iframe: e }) {
|
|
143
|
+
let t = s(e);
|
|
187
144
|
if (t?.requiresVerification) return Promise.resolve(!!t.plaid);
|
|
188
145
|
let n = crypto.randomUUID();
|
|
189
146
|
return new Promise((t) => {
|
|
190
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
147
|
+
e?.contentWindow && e.contentWindow.postMessage(l({
|
|
191
148
|
type: "VALIDATE_FORM",
|
|
192
149
|
requestId: n
|
|
193
|
-
}),
|
|
150
|
+
}), u(e));
|
|
194
151
|
let r = setTimeout(() => {
|
|
195
152
|
window.removeEventListener("message", i), t(!1);
|
|
196
153
|
}, 5e3);
|
|
@@ -200,7 +157,7 @@ function C({ iframe: e }) {
|
|
|
200
157
|
window.addEventListener("message", i);
|
|
201
158
|
});
|
|
202
159
|
}
|
|
203
|
-
var
|
|
160
|
+
var v = 1e4;
|
|
204
161
|
function ee({ iframe: e }) {
|
|
205
162
|
let t = crypto.randomUUID();
|
|
206
163
|
return new Promise((n, r) => {
|
|
@@ -209,111 +166,96 @@ function ee({ iframe: e }) {
|
|
|
209
166
|
return;
|
|
210
167
|
}
|
|
211
168
|
let i = e.contentWindow;
|
|
212
|
-
i.postMessage(
|
|
169
|
+
i.postMessage(l({
|
|
213
170
|
type: "CREATE_PLAID_LINK_TOKEN",
|
|
214
171
|
requestId: t
|
|
215
|
-
}),
|
|
172
|
+
}), u(e));
|
|
216
173
|
let a = setTimeout(() => {
|
|
217
|
-
window.removeEventListener("message",
|
|
218
|
-
},
|
|
219
|
-
function
|
|
174
|
+
window.removeEventListener("message", o), r(/* @__PURE__ */ Error("Timed out waiting for Plaid Link token."));
|
|
175
|
+
}, v);
|
|
176
|
+
function o(e) {
|
|
220
177
|
if (e.source === i && e.data.type === "PLAID_LINK_TOKEN" && e.data.requestId === t) {
|
|
221
|
-
if (window.removeEventListener("message",
|
|
178
|
+
if (window.removeEventListener("message", o), clearTimeout(a), e.data.link_token) {
|
|
222
179
|
n(e.data.link_token);
|
|
223
180
|
return;
|
|
224
181
|
}
|
|
225
182
|
r(Error(e.data.error ?? "Could not create Plaid Link token."));
|
|
226
183
|
}
|
|
227
184
|
}
|
|
228
|
-
window.addEventListener("message",
|
|
185
|
+
window.addEventListener("message", o);
|
|
229
186
|
});
|
|
230
187
|
}
|
|
231
|
-
function
|
|
232
|
-
|
|
188
|
+
function y({ iframe: e }) {
|
|
189
|
+
s(e)?.clearLinked?.(), b(e);
|
|
233
190
|
}
|
|
234
|
-
function
|
|
235
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
191
|
+
function b(e) {
|
|
192
|
+
e?.contentWindow && e.contentWindow.postMessage(l({ type: "RESET_FORM" }), u(e));
|
|
236
193
|
}
|
|
237
|
-
function
|
|
238
|
-
let i =
|
|
239
|
-
i?.requiresVerification && !a &&
|
|
240
|
-
let s = g(e);
|
|
241
|
-
d({
|
|
242
|
-
iframe: e,
|
|
243
|
-
message: t === "CONFIRM_PAYMENT_INTENT" ? "confirmPaymentIntent" : "confirmSetupIntent",
|
|
244
|
-
endpoint: t === "CONFIRM_PAYMENT_INTENT" ? "POST /embed/payment_intents/{id}/confirm_with_payment_method" : "POST /embed/setup_intents/{id}/confirm_with_payment_method",
|
|
245
|
-
headers: {
|
|
246
|
-
origin: window.location.origin,
|
|
247
|
-
"iframe-origin": s
|
|
248
|
-
},
|
|
249
|
-
body: {
|
|
250
|
-
id: r,
|
|
251
|
-
token: n,
|
|
252
|
-
...a ? { plaid: a } : {}
|
|
253
|
-
}
|
|
254
|
-
}), e.contentWindow?.postMessage(o({
|
|
194
|
+
function x({ iframe: e, type: t, token: n, id: r }) {
|
|
195
|
+
let i = s(e), a = i?.plaid;
|
|
196
|
+
i?.requiresVerification && !a && b(e), e.contentWindow?.postMessage(l({
|
|
255
197
|
type: t,
|
|
256
198
|
token: n,
|
|
257
199
|
id: r,
|
|
258
200
|
...a ? { plaid: a } : {}
|
|
259
|
-
}),
|
|
201
|
+
}), u(e));
|
|
260
202
|
}
|
|
261
|
-
function
|
|
203
|
+
function S({ iframe: e, token: t }) {
|
|
262
204
|
if (!e?.contentWindow) return;
|
|
263
205
|
let { payment_intent_id: n } = r(t).payload;
|
|
264
|
-
|
|
206
|
+
x({
|
|
265
207
|
iframe: e,
|
|
266
208
|
type: "CONFIRM_PAYMENT_INTENT",
|
|
267
209
|
token: t,
|
|
268
210
|
id: n ?? void 0
|
|
269
211
|
});
|
|
270
212
|
}
|
|
271
|
-
function
|
|
213
|
+
function C({ iframe: e, token: t }) {
|
|
272
214
|
if (!e?.contentWindow) return;
|
|
273
215
|
let { setup_intent_id: n } = r(t).payload;
|
|
274
|
-
|
|
216
|
+
x({
|
|
275
217
|
iframe: e,
|
|
276
218
|
type: "CONFIRM_SETUP_INTENT",
|
|
277
219
|
token: t,
|
|
278
220
|
id: n ?? void 0
|
|
279
221
|
});
|
|
280
222
|
}
|
|
281
|
-
function
|
|
282
|
-
e?.contentWindow && e.contentWindow.postMessage(
|
|
223
|
+
function w({ iframe: e, result: t }) {
|
|
224
|
+
e?.contentWindow && e.contentWindow.postMessage(l({
|
|
283
225
|
type: "CONFIRMATION_RESULT",
|
|
284
226
|
result: t
|
|
285
|
-
}),
|
|
227
|
+
}), u(e));
|
|
286
228
|
}
|
|
287
229
|
//#endregion
|
|
288
230
|
//#region src/apple-pay.ts
|
|
289
|
-
function
|
|
290
|
-
return `${
|
|
231
|
+
function T(e) {
|
|
232
|
+
return `${i(e)}/iframe/apple-pay?token=${e}`;
|
|
291
233
|
}
|
|
292
|
-
function
|
|
234
|
+
function E() {
|
|
293
235
|
return "48px";
|
|
294
236
|
}
|
|
295
|
-
function
|
|
296
|
-
e.contentWindow?.postMessage(
|
|
237
|
+
function D(e) {
|
|
238
|
+
e.contentWindow?.postMessage(l({ type: "APPLE_PAY_CANCEL" }), u(e));
|
|
297
239
|
}
|
|
298
|
-
function
|
|
240
|
+
function O(e, { height: r = "48px", ...i }) {
|
|
299
241
|
let a = {
|
|
300
242
|
...i,
|
|
301
243
|
height: r
|
|
302
244
|
};
|
|
303
245
|
function o() {
|
|
304
|
-
|
|
246
|
+
h({
|
|
305
247
|
iframe: e,
|
|
306
248
|
amount: a.amount
|
|
307
249
|
});
|
|
308
250
|
}
|
|
309
251
|
function s() {
|
|
310
|
-
|
|
252
|
+
g({
|
|
311
253
|
iframe: e,
|
|
312
254
|
merchantName: a.merchantName
|
|
313
255
|
});
|
|
314
256
|
}
|
|
315
257
|
function c() {
|
|
316
|
-
|
|
258
|
+
p({
|
|
317
259
|
iframe: e,
|
|
318
260
|
height: a.height ?? "48px",
|
|
319
261
|
props: a.buttonProps ?? {}
|
|
@@ -322,7 +264,7 @@ function M(e, { height: r = "48px", ...i }) {
|
|
|
322
264
|
function l(r) {
|
|
323
265
|
if (r.source === e.contentWindow) switch (r.data.type) {
|
|
324
266
|
case "IFRAME_READY":
|
|
325
|
-
|
|
267
|
+
d(e), f({
|
|
326
268
|
iframe: e,
|
|
327
269
|
appearance: {}
|
|
328
270
|
}), o(), s(), c();
|
|
@@ -331,7 +273,7 @@ function M(e, { height: r = "48px", ...i }) {
|
|
|
331
273
|
a.onHeightChange?.(r.data.height);
|
|
332
274
|
break;
|
|
333
275
|
case "UPDATE_APPEARANCE":
|
|
334
|
-
|
|
276
|
+
f({
|
|
335
277
|
iframe: e,
|
|
336
278
|
appearance: r.data.appearance
|
|
337
279
|
});
|
|
@@ -341,7 +283,7 @@ function M(e, { height: r = "48px", ...i }) {
|
|
|
341
283
|
break;
|
|
342
284
|
case "APPLE_PAY_WINDOW_OPEN":
|
|
343
285
|
t({ onCancel: () => {
|
|
344
|
-
|
|
286
|
+
D(e), n();
|
|
345
287
|
} });
|
|
346
288
|
break;
|
|
347
289
|
case "APPLE_PAY_WINDOW_CLOSE":
|
|
@@ -352,7 +294,7 @@ function M(e, { height: r = "48px", ...i }) {
|
|
|
352
294
|
paymentIntentCreateAttributes: r.data.paymentIntentCreateAttributes,
|
|
353
295
|
customerCreateAttributes: r.data.customerCreateAttributes
|
|
354
296
|
}).then((t) => {
|
|
355
|
-
|
|
297
|
+
S({
|
|
356
298
|
iframe: e,
|
|
357
299
|
token: t
|
|
358
300
|
});
|
|
@@ -381,7 +323,7 @@ function M(e, { height: r = "48px", ...i }) {
|
|
|
381
323
|
}
|
|
382
324
|
//#endregion
|
|
383
325
|
//#region src/form-skeleton.ts
|
|
384
|
-
var
|
|
326
|
+
var k = "amos-js-form-skeleton-styles", te = {
|
|
385
327
|
"--accent": "oklch(0.97 0 0)",
|
|
386
328
|
"--radius": "0.625rem",
|
|
387
329
|
"--input-height": "2.25rem",
|
|
@@ -389,123 +331,123 @@ var N = "amos-js-form-skeleton-styles", re = {
|
|
|
389
331
|
"--field-gap": "1rem",
|
|
390
332
|
"--control-gap": "0.5rem",
|
|
391
333
|
"--label-font-size": "0.875rem"
|
|
392
|
-
},
|
|
393
|
-
function
|
|
394
|
-
if (document.getElementById(
|
|
334
|
+
}, ne = "\n.amos-js-form-skeleton {\n box-sizing: border-box;\n container-type: inline-size;\n display: flex;\n flex-direction: column;\n gap: var(--field-gap);\n margin: 0 -4px;\n padding-block: 0.25rem;\n pointer-events: none;\n width: calc(100% + 8px);\n}\n.amos-js-form-skeleton-field {\n display: flex;\n flex: 1 1 0;\n flex-direction: column;\n min-width: 0;\n width: 100%;\n}\n.amos-js-form-skeleton-label {\n flex-shrink: 0;\n font-size: var(--label-font-size);\n height: 1.75rem;\n line-height: 1.75rem;\n}\n.amos-js-form-skeleton-input {\n animation: amos-js-skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n background: var(--accent);\n border-radius: calc(var(--radius) * 0.8);\n box-sizing: border-box;\n height: var(--input-height);\n width: 100%;\n}\n.amos-js-form-skeleton-input-floating {\n height: var(--floating-input-height);\n}\n.amos-js-form-skeleton-row {\n align-items: flex-start;\n display: flex;\n gap: var(--control-gap);\n width: 100%;\n}\n.amos-js-form-skeleton-row-stack {\n display: flex;\n flex-direction: column;\n gap: var(--field-gap);\n width: 100%;\n}\n@container (min-width: 24rem) {\n .amos-js-form-skeleton-row-stack {\n align-items: flex-start;\n flex-direction: row;\n gap: var(--control-gap);\n }\n}\n.amos-js-wallet-skeleton {\n flex: none;\n width: 100%;\n}\n@keyframes amos-js-skeleton-pulse {\n 50% { opacity: 0.5; }\n}\n@media (prefers-reduced-motion: reduce) {\n .amos-js-form-skeleton-input {\n animation: none;\n }\n}\n";
|
|
335
|
+
function A() {
|
|
336
|
+
if (document.getElementById(k)) return;
|
|
395
337
|
let e = document.createElement("style");
|
|
396
|
-
e.id =
|
|
338
|
+
e.id = k, e.textContent = ne, document.head.appendChild(e);
|
|
397
339
|
}
|
|
398
|
-
function
|
|
399
|
-
for (let [t, n] of Object.entries(
|
|
340
|
+
function j(e, t) {
|
|
341
|
+
for (let [t, n] of Object.entries(te)) e.style.setProperty(t, n);
|
|
400
342
|
let n = t?.themeVariables;
|
|
401
343
|
if (n) for (let [t, r] of Object.entries(n)) typeof r == "string" && r.trim() !== "" && e.style.setProperty(t, r.trim());
|
|
402
344
|
}
|
|
403
|
-
function
|
|
345
|
+
function M(e, t) {
|
|
404
346
|
let n = document.createElement("div");
|
|
405
347
|
if (n.className = e, t) for (let e of t) n.appendChild(e);
|
|
406
348
|
return n;
|
|
407
349
|
}
|
|
408
|
-
function
|
|
409
|
-
let n =
|
|
410
|
-
t !== void 0 && (n.style.flexGrow = String(t)), e === "above" && n.appendChild(
|
|
411
|
-
let r =
|
|
350
|
+
function N(e, t) {
|
|
351
|
+
let n = M("amos-js-form-skeleton-field");
|
|
352
|
+
t !== void 0 && (n.style.flexGrow = String(t)), e === "above" && n.appendChild(M("amos-js-form-skeleton-label"));
|
|
353
|
+
let r = M("amos-js-form-skeleton-input");
|
|
412
354
|
return e === "floating" && r.classList.add("amos-js-form-skeleton-input-floating"), n.appendChild(r), n;
|
|
413
355
|
}
|
|
414
|
-
function
|
|
415
|
-
return
|
|
356
|
+
function P(e, t) {
|
|
357
|
+
return M(t ? "amos-js-form-skeleton-row-stack" : "amos-js-form-skeleton-row", e);
|
|
416
358
|
}
|
|
417
|
-
function
|
|
359
|
+
function re({ labels: e, requirement: t, wrapCountryZip: n }) {
|
|
418
360
|
return t === "full" ? [
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
361
|
+
N(e),
|
|
362
|
+
N(e),
|
|
363
|
+
P([
|
|
364
|
+
N(e, 1.4),
|
|
365
|
+
N(e, .7),
|
|
366
|
+
N(e, .8)
|
|
425
367
|
], !1),
|
|
426
|
-
|
|
427
|
-
] : [
|
|
368
|
+
N(e)
|
|
369
|
+
] : [P([N(e), N(e)], n)];
|
|
428
370
|
}
|
|
429
|
-
function
|
|
371
|
+
function ie(e) {
|
|
430
372
|
let t = e.appearance?.labels ?? "above", n = e.billingAddressRequirement ?? "country";
|
|
431
373
|
if (e.kind === "card") {
|
|
432
|
-
let r = [
|
|
433
|
-
return e.additionalFields?.cardholderName && r.push(
|
|
374
|
+
let r = [N(t), P([N(t), N(t)], !1)];
|
|
375
|
+
return e.additionalFields?.cardholderName && r.push(N(t)), r.push(...re({
|
|
434
376
|
labels: t,
|
|
435
377
|
requirement: n,
|
|
436
378
|
wrapCountryZip: !1
|
|
437
379
|
})), r;
|
|
438
380
|
}
|
|
439
381
|
return [
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
...
|
|
382
|
+
N(t),
|
|
383
|
+
P([N(t), N(t)], !0),
|
|
384
|
+
N(t),
|
|
385
|
+
P([N("above"), N("above")], !0),
|
|
386
|
+
...re({
|
|
445
387
|
labels: t,
|
|
446
388
|
requirement: n,
|
|
447
389
|
wrapCountryZip: !0
|
|
448
390
|
})
|
|
449
391
|
];
|
|
450
392
|
}
|
|
451
|
-
function
|
|
452
|
-
|
|
453
|
-
let t =
|
|
393
|
+
function ae(e) {
|
|
394
|
+
A();
|
|
395
|
+
let t = M("amos-js-form-skeleton");
|
|
454
396
|
t.setAttribute("aria-hidden", "true");
|
|
455
397
|
function n(e) {
|
|
456
|
-
|
|
398
|
+
j(t, e.appearance), t.replaceChildren(...ie(e));
|
|
457
399
|
}
|
|
458
400
|
return n(e), {
|
|
459
401
|
element: t,
|
|
460
402
|
update: n
|
|
461
403
|
};
|
|
462
404
|
}
|
|
463
|
-
function
|
|
464
|
-
|
|
465
|
-
let t =
|
|
405
|
+
function F(e) {
|
|
406
|
+
A();
|
|
407
|
+
let t = M("amos-js-form-skeleton-input amos-js-wallet-skeleton");
|
|
466
408
|
t.setAttribute("aria-hidden", "true");
|
|
467
409
|
function n(e) {
|
|
468
|
-
|
|
410
|
+
j(t, void 0), t.style.height = e.height, t.style.borderRadius = e.borderRadius ?? "4px";
|
|
469
411
|
}
|
|
470
412
|
return n(e), {
|
|
471
413
|
element: t,
|
|
472
414
|
update: n
|
|
473
415
|
};
|
|
474
416
|
}
|
|
475
|
-
function
|
|
417
|
+
function I(e) {
|
|
476
418
|
if (typeof e == "number" && Number.isFinite(e)) return `${e}px`;
|
|
477
419
|
if (typeof e == "string" && e.trim() !== "") return e.trim();
|
|
478
420
|
}
|
|
479
|
-
function
|
|
480
|
-
return
|
|
421
|
+
function L({ iframeStyle: e, buttonProps: t }) {
|
|
422
|
+
return I(e?.borderRadius) ?? I(t?.buttonRadius) ?? I(t?.style?.borderRadius) ?? I(t?.style?.["--apple-pay-button-border-radius"]) ?? "4px";
|
|
481
423
|
}
|
|
482
424
|
//#endregion
|
|
483
425
|
//#region src/google-pay.ts
|
|
484
|
-
function
|
|
485
|
-
return `${
|
|
426
|
+
function R(e) {
|
|
427
|
+
return `${i(e)}/iframe/google-pay?token=${e}`;
|
|
486
428
|
}
|
|
487
|
-
function
|
|
429
|
+
function z() {
|
|
488
430
|
return "48px";
|
|
489
431
|
}
|
|
490
|
-
function
|
|
432
|
+
function B(e, { height: t = "48px", ...n }) {
|
|
491
433
|
let r = {
|
|
492
434
|
...n,
|
|
493
435
|
height: t
|
|
494
436
|
};
|
|
495
437
|
function i() {
|
|
496
|
-
|
|
438
|
+
h({
|
|
497
439
|
iframe: e,
|
|
498
440
|
amount: r.amount
|
|
499
441
|
});
|
|
500
442
|
}
|
|
501
443
|
function a() {
|
|
502
|
-
|
|
444
|
+
g({
|
|
503
445
|
iframe: e,
|
|
504
446
|
merchantName: r.merchantName
|
|
505
447
|
});
|
|
506
448
|
}
|
|
507
449
|
function o() {
|
|
508
|
-
|
|
450
|
+
m({
|
|
509
451
|
iframe: e,
|
|
510
452
|
height: r.height ?? "48px",
|
|
511
453
|
props: r.buttonProps ?? {}
|
|
@@ -514,7 +456,7 @@ function G(e, { height: t = "48px", ...n }) {
|
|
|
514
456
|
function s(t) {
|
|
515
457
|
if (t.source === e.contentWindow) switch (t.data.type) {
|
|
516
458
|
case "IFRAME_READY":
|
|
517
|
-
|
|
459
|
+
d(e), f({
|
|
518
460
|
iframe: e,
|
|
519
461
|
appearance: {}
|
|
520
462
|
}), i(), a(), o();
|
|
@@ -523,7 +465,7 @@ function G(e, { height: t = "48px", ...n }) {
|
|
|
523
465
|
r.onHeightChange?.(t.data.height);
|
|
524
466
|
break;
|
|
525
467
|
case "UPDATE_APPEARANCE":
|
|
526
|
-
|
|
468
|
+
f({
|
|
527
469
|
iframe: e,
|
|
528
470
|
appearance: t.data.appearance
|
|
529
471
|
});
|
|
@@ -536,7 +478,7 @@ function G(e, { height: t = "48px", ...n }) {
|
|
|
536
478
|
paymentIntentCreateAttributes: t.data.paymentIntentCreateAttributes,
|
|
537
479
|
customerCreateAttributes: t.data.customerCreateAttributes
|
|
538
480
|
}).then((t) => {
|
|
539
|
-
|
|
481
|
+
S({
|
|
540
482
|
iframe: e,
|
|
541
483
|
token: t
|
|
542
484
|
});
|
|
@@ -563,7 +505,7 @@ function G(e, { height: t = "48px", ...n }) {
|
|
|
563
505
|
}
|
|
564
506
|
};
|
|
565
507
|
}
|
|
566
|
-
function
|
|
508
|
+
function oe({ paymentData: e }) {
|
|
567
509
|
return { paymentMethod: {
|
|
568
510
|
type: "googlepay",
|
|
569
511
|
billing_address_attributes: {
|
|
@@ -582,40 +524,40 @@ function se({ paymentData: e }) {
|
|
|
582
524
|
}
|
|
583
525
|
//#endregion
|
|
584
526
|
//#region src/payment-method-form.ts
|
|
585
|
-
var
|
|
527
|
+
var V = {
|
|
586
528
|
country: 212,
|
|
587
529
|
full: 452
|
|
588
|
-
},
|
|
530
|
+
}, se = 80, H = {
|
|
589
531
|
country: 400,
|
|
590
532
|
full: 640
|
|
591
533
|
};
|
|
592
|
-
function
|
|
593
|
-
let r = Object.entries(t).filter(([, e]) => e).map(([e]) => e).join(","),
|
|
534
|
+
function U(e, t = { cardholderName: !1 }, n = "country") {
|
|
535
|
+
let r = Object.entries(t).filter(([, e]) => e).map(([e]) => e).join(","), a = new URLSearchParams({
|
|
594
536
|
token: e,
|
|
595
537
|
additionalFields: r,
|
|
596
538
|
billingAddressRequirement: n
|
|
597
539
|
});
|
|
598
|
-
return `${
|
|
540
|
+
return `${i(e)}/iframe/card?${a}`;
|
|
599
541
|
}
|
|
600
|
-
function
|
|
542
|
+
function W(e, t = "country", n = "payment") {
|
|
601
543
|
let r = new URLSearchParams({
|
|
602
544
|
token: e,
|
|
603
545
|
billingAddressRequirement: t
|
|
604
546
|
});
|
|
605
|
-
return n === "setup" && r.set("intent", "setup"), `${
|
|
547
|
+
return n === "setup" && r.set("intent", "setup"), `${i(e)}/iframe/bank?${r}`;
|
|
606
548
|
}
|
|
607
|
-
function
|
|
608
|
-
return `${(
|
|
549
|
+
function G(e = { cardholderName: !1 }, t = "country") {
|
|
550
|
+
return `${(V[t] ?? V.country) + (e.cardholderName ? se : 0)}px`;
|
|
609
551
|
}
|
|
610
|
-
function
|
|
611
|
-
return `${
|
|
552
|
+
function K(e = "country") {
|
|
553
|
+
return `${H[e] ?? H.country}px`;
|
|
612
554
|
}
|
|
613
|
-
function
|
|
555
|
+
function q(e, t) {
|
|
614
556
|
let n = { ...t };
|
|
615
557
|
function r(t) {
|
|
616
558
|
if (t.source === e.contentWindow) switch (t.data.type) {
|
|
617
559
|
case "IFRAME_READY":
|
|
618
|
-
|
|
560
|
+
d(e), f({
|
|
619
561
|
iframe: e,
|
|
620
562
|
appearance: n.appearance
|
|
621
563
|
});
|
|
@@ -624,7 +566,7 @@ function de(e, t) {
|
|
|
624
566
|
n.onHeightChange?.(t.data.height);
|
|
625
567
|
break;
|
|
626
568
|
case "UPDATE_APPEARANCE":
|
|
627
|
-
|
|
569
|
+
f({
|
|
628
570
|
iframe: e,
|
|
629
571
|
appearance: t.data.appearance
|
|
630
572
|
});
|
|
@@ -633,7 +575,7 @@ function de(e, t) {
|
|
|
633
575
|
n.onAppearanceReady?.();
|
|
634
576
|
break;
|
|
635
577
|
case "FORM_VALIDITY_CHANGE":
|
|
636
|
-
if (
|
|
578
|
+
if (s(e)?.requiresVerification) break;
|
|
637
579
|
n.onValidityChange?.({ isValid: t.data.isValid });
|
|
638
580
|
break;
|
|
639
581
|
case "CARD_BRAND_CHANGE":
|
|
@@ -648,7 +590,7 @@ function de(e, t) {
|
|
|
648
590
|
n = {
|
|
649
591
|
...n,
|
|
650
592
|
...t
|
|
651
|
-
}, r &&
|
|
593
|
+
}, r && f({
|
|
652
594
|
iframe: e,
|
|
653
595
|
appearance: n.appearance
|
|
654
596
|
});
|
|
@@ -660,21 +602,21 @@ function de(e, t) {
|
|
|
660
602
|
}
|
|
661
603
|
//#endregion
|
|
662
604
|
//#region src/plaid.ts
|
|
663
|
-
var
|
|
664
|
-
function
|
|
605
|
+
var J = "https://cdn.plaid.com/link/v2/stable/link-initialize.js";
|
|
606
|
+
function Y({ amount: e, achThreshold: t }) {
|
|
665
607
|
return t != null && (e ?? 0) >= t;
|
|
666
608
|
}
|
|
667
|
-
function
|
|
609
|
+
function ce(e) {
|
|
668
610
|
if (e == null) return;
|
|
669
611
|
let t = e.trim();
|
|
670
612
|
if (t === "") return;
|
|
671
613
|
let n = Number(t.replace(/[^\d.]/g, ""));
|
|
672
614
|
if (Number.isFinite(n)) return Math.round(n * 100);
|
|
673
615
|
}
|
|
674
|
-
function
|
|
616
|
+
function le(e) {
|
|
675
617
|
return e.account_id ?? e.account?.id ?? e.accounts?.[0]?.id;
|
|
676
618
|
}
|
|
677
|
-
function
|
|
619
|
+
function ue(e) {
|
|
678
620
|
let t = e.account ?? e.accounts?.[0];
|
|
679
621
|
return {
|
|
680
622
|
bankName: e.institution?.name ?? "Bank account",
|
|
@@ -682,13 +624,13 @@ function ge(e) {
|
|
|
682
624
|
};
|
|
683
625
|
}
|
|
684
626
|
var X;
|
|
685
|
-
function
|
|
686
|
-
for (let e of document.querySelectorAll(`script[src="${
|
|
627
|
+
function de() {
|
|
628
|
+
for (let e of document.querySelectorAll(`script[src="${J}"]`)) e.remove();
|
|
687
629
|
}
|
|
688
|
-
function
|
|
689
|
-
return typeof window > "u" ? Promise.reject(/* @__PURE__ */ Error("Plaid Link requires a browser")) : window.Plaid ? Promise.resolve() : X || (
|
|
630
|
+
function fe() {
|
|
631
|
+
return typeof window > "u" ? Promise.reject(/* @__PURE__ */ Error("Plaid Link requires a browser")) : window.Plaid ? Promise.resolve() : X || (de(), X = new Promise((e, t) => {
|
|
690
632
|
let n = document.createElement("script");
|
|
691
|
-
n.src =
|
|
633
|
+
n.src = J, n.async = !0;
|
|
692
634
|
let r = (e) => {
|
|
693
635
|
n.remove(), X = void 0, t(Error(e));
|
|
694
636
|
};
|
|
@@ -701,8 +643,8 @@ function ve() {
|
|
|
701
643
|
}, { once: !0 }), n.addEventListener("error", () => r("Failed to load Plaid Link"), { once: !0 }), document.head.append(n);
|
|
702
644
|
}), X);
|
|
703
645
|
}
|
|
704
|
-
async function
|
|
705
|
-
if (await
|
|
646
|
+
async function pe({ token: e, onSuccess: t, onExit: n, signal: r }) {
|
|
647
|
+
if (await fe(), r?.aborted) return () => {};
|
|
706
648
|
if (!window.Plaid) throw Error("Plaid Link failed to initialize");
|
|
707
649
|
let i = window.Plaid.create({
|
|
708
650
|
token: e,
|
|
@@ -717,135 +659,126 @@ async function ye({ token: e, onSuccess: t, onExit: n, signal: r }) {
|
|
|
717
659
|
}
|
|
718
660
|
//#endregion
|
|
719
661
|
//#region src/plaid-bank-ui.ts
|
|
720
|
-
var
|
|
721
|
-
function
|
|
722
|
-
if (document.getElementById(
|
|
662
|
+
var me = "amos-js-plaid-bank-ui-styles", he = "\n.amos-js-plaid-panel {\n box-sizing: border-box;\n color: var(--foreground, oklch(0.145 0 0));\n display: none;\n flex-direction: column;\n font-family: inherit;\n gap: var(--control-gap, 0.5rem);\n width: 100%;\n}\n.amos-js-plaid-panel[data-mode=\"connect\"],\n.amos-js-plaid-panel[data-mode=\"linked\"] {\n display: flex;\n}\n.amos-js-plaid-connect {\n align-items: center;\n background: var(--background, oklch(1 0 0));\n border: var(--input-border-width, 1px) solid var(--border, oklch(0.922 0 0));\n border-radius: calc(var(--radius, 0.625rem) * 0.8);\n box-shadow: var(--input-shadow, 0 1px 2px 0 rgb(0 0 0 / 0.05));\n box-sizing: border-box;\n color: var(--foreground, oklch(0.145 0 0));\n cursor: pointer;\n display: inline-flex;\n flex-shrink: 0;\n font: inherit;\n font-size: var(--input-font-size, 0.875rem);\n font-weight: 500;\n height: var(--input-height, 2.25rem);\n justify-content: center;\n line-height: 1.25;\n outline: none;\n padding: 0 var(--input-padding, 0.75rem);\n transition: color 150ms, background-color 150ms, border-color 150ms, box-shadow 150ms;\n width: 100%;\n}\n.amos-js-plaid-panel[data-mode=\"linked\"] .amos-js-plaid-connect {\n display: none;\n}\n.amos-js-plaid-connect:hover:not(:disabled) {\n background: var(--accent, oklch(0.97 0 0));\n color: var(--accent-foreground, oklch(0.205 0 0));\n}\n.amos-js-plaid-connect:focus-visible {\n border-color: var(--ring, oklch(0.708 0 0));\n box-shadow:\n var(--input-shadow, 0 1px 2px 0 rgb(0 0 0 / 0.05)),\n 0 0 0 var(--ring-width, 3px)\n color-mix(in oklab, var(--ring, oklch(0.708 0 0)) 50%, transparent);\n}\n.amos-js-plaid-connect:disabled {\n cursor: default;\n opacity: 0.5;\n pointer-events: none;\n}\n.amos-js-plaid-linked {\n display: none;\n flex-direction: column;\n gap: 0.25rem;\n}\n.amos-js-plaid-panel[data-mode=\"linked\"] .amos-js-plaid-linked {\n display: flex;\n}\n.amos-js-plaid-linked-name {\n font-size: var(--input-font-size, 0.875rem);\n font-weight: 500;\n}\n.amos-js-plaid-linked-meta {\n color: var(--muted-foreground, oklch(0.556 0 0));\n font-size: 0.75rem;\n}\n.amos-js-plaid-disconnect {\n align-self: flex-start;\n background: none;\n border: none;\n border-radius: calc(var(--radius, 0.625rem) * 0.8);\n color: var(--muted-foreground, oklch(0.556 0 0));\n cursor: pointer;\n font: inherit;\n font-size: var(--input-font-size, 0.875rem);\n margin-top: 0.25rem;\n outline: none;\n padding: 0;\n}\n.amos-js-plaid-disconnect:hover {\n color: var(--accent-foreground, oklch(0.205 0 0));\n}\n.amos-js-plaid-disconnect:focus-visible {\n box-shadow:\n 0 0 0 var(--ring-width, 3px)\n color-mix(in oklab, var(--ring, oklch(0.708 0 0)) 50%, transparent);\n}\n.amos-js-plaid-error {\n color: var(--destructive, oklch(0.577 0.245 27.325));\n display: none;\n font-size: var(--error-font-size, 0.875rem);\n margin: 0;\n}\n.amos-js-plaid-error:not(:empty) {\n display: block;\n}\n@media (prefers-reduced-motion: reduce) {\n .amos-js-plaid-connect {\n transition: none;\n }\n}\n";
|
|
663
|
+
function ge() {
|
|
664
|
+
if (document.getElementById(me)) return;
|
|
723
665
|
let e = document.createElement("style");
|
|
724
|
-
e.id =
|
|
666
|
+
e.id = me, e.textContent = he, document.head.append(e);
|
|
725
667
|
}
|
|
726
|
-
function
|
|
668
|
+
function _e(e, t, n) {
|
|
727
669
|
for (let t of n) e.style.removeProperty(t);
|
|
728
670
|
n.length = 0;
|
|
729
671
|
let r = t?.themeVariables;
|
|
730
672
|
if (r) for (let [t, i] of Object.entries(r)) typeof i == "string" && i.trim() !== "" && (e.style.setProperty(t, i.trim()), n.push(t));
|
|
731
673
|
}
|
|
732
|
-
function
|
|
733
|
-
|
|
674
|
+
function ve({ host: e, iframe: t, options: n }) {
|
|
675
|
+
ge();
|
|
734
676
|
let r = {
|
|
735
677
|
...n,
|
|
736
678
|
amount: n.amount ?? "0"
|
|
737
|
-
}, i = [], a = !1,
|
|
738
|
-
|
|
739
|
-
let
|
|
740
|
-
|
|
741
|
-
let
|
|
742
|
-
|
|
679
|
+
}, i = [], a = !1, s, l = !1, u, d = !1, f, p, m = new AbortController(), h, g = document.createElement("div");
|
|
680
|
+
g.className = "amos-js-plaid-panel", g.setAttribute("data-amos-plaid-panel", "true"), g.dataset.mode = "hidden", _e(g, r.appearance, i);
|
|
681
|
+
let _ = document.createElement("button");
|
|
682
|
+
_.type = "button", _.className = "amos-js-plaid-connect", _.textContent = "Connect bank account", _.setAttribute("data-testid", "amos-plaid-connect");
|
|
683
|
+
let v = document.createElement("div");
|
|
684
|
+
v.className = "amos-js-plaid-linked";
|
|
685
|
+
let y = document.createElement("span");
|
|
686
|
+
y.className = "amos-js-plaid-linked-name";
|
|
743
687
|
let b = document.createElement("span");
|
|
744
|
-
b.className = "amos-js-plaid-linked-
|
|
745
|
-
let x = document.createElement("
|
|
746
|
-
x.className = "amos-js-plaid-
|
|
747
|
-
let S = document.createElement("
|
|
748
|
-
S.
|
|
749
|
-
let C =
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
function T(e) {
|
|
753
|
-
C.textContent = e ?? "";
|
|
688
|
+
b.className = "amos-js-plaid-linked-meta";
|
|
689
|
+
let x = document.createElement("button");
|
|
690
|
+
x.type = "button", x.className = "amos-js-plaid-disconnect", x.textContent = "Disconnect", x.setAttribute("aria-label", "Disconnect bank account");
|
|
691
|
+
let S = document.createElement("p");
|
|
692
|
+
S.className = "amos-js-plaid-error", S.setAttribute("role", "alert"), v.append(y, b, x), g.append(_, v, S), e.append(g);
|
|
693
|
+
let C = t.parentElement;
|
|
694
|
+
function w(e) {
|
|
695
|
+
S.textContent = e ?? "";
|
|
754
696
|
}
|
|
755
|
-
function
|
|
756
|
-
return a ?
|
|
757
|
-
amount:
|
|
758
|
-
achThreshold:
|
|
697
|
+
function T() {
|
|
698
|
+
return a ? l ? !0 : Y({
|
|
699
|
+
amount: ce(r.amount),
|
|
700
|
+
achThreshold: s
|
|
759
701
|
}) : !1;
|
|
760
702
|
}
|
|
761
|
-
function
|
|
762
|
-
let e = !!
|
|
763
|
-
|
|
703
|
+
function E() {
|
|
704
|
+
let e = !!h;
|
|
705
|
+
f !== e && (f = e, r.onValidityChange?.({ isValid: e }));
|
|
764
706
|
}
|
|
765
|
-
function
|
|
766
|
-
let e =
|
|
767
|
-
if (
|
|
707
|
+
function D() {
|
|
708
|
+
let e = T();
|
|
709
|
+
if (o(t, {
|
|
768
710
|
requiresVerification: e,
|
|
769
|
-
plaid: e ?
|
|
770
|
-
clearLinked:
|
|
711
|
+
plaid: e ? h?.credentials : void 0,
|
|
712
|
+
clearLinked: O
|
|
771
713
|
}), !e) {
|
|
772
|
-
|
|
714
|
+
g.dataset.mode = "hidden", C && (C.style.display = ""), f = void 0;
|
|
773
715
|
return;
|
|
774
716
|
}
|
|
775
|
-
|
|
717
|
+
g.dataset.mode = h ? "linked" : "connect", C && (C.style.display = "none"), h && (y.textContent = h.bankName, b.textContent = h.last4 ? `****${h.last4}` : "Connected"), E();
|
|
776
718
|
}
|
|
777
|
-
function
|
|
778
|
-
|
|
719
|
+
function O() {
|
|
720
|
+
h = void 0, u = void 0, p?.(), p = void 0, w(void 0), D();
|
|
779
721
|
}
|
|
780
|
-
function
|
|
722
|
+
function k(e) {
|
|
781
723
|
if (e.source === t.contentWindow && e.data.type === "ACH_THRESHOLD") {
|
|
782
|
-
if (a = !0,
|
|
783
|
-
|
|
784
|
-
message: "merchant ach_threshold",
|
|
785
|
-
endpoint: "ACH_THRESHOLD",
|
|
786
|
-
headers: { origin: e.origin },
|
|
787
|
-
body: {
|
|
788
|
-
achThreshold: o,
|
|
789
|
-
requireVerification: s
|
|
790
|
-
}
|
|
791
|
-
}), g && !E()) {
|
|
792
|
-
k();
|
|
724
|
+
if (a = !0, s = e.data.achThreshold ?? void 0, l = e.data.requireVerification === !0, h && !T()) {
|
|
725
|
+
O();
|
|
793
726
|
return;
|
|
794
727
|
}
|
|
795
|
-
|
|
728
|
+
D();
|
|
796
729
|
}
|
|
797
730
|
}
|
|
798
|
-
return window.addEventListener("message",
|
|
799
|
-
|
|
800
|
-
}),
|
|
731
|
+
return window.addEventListener("message", k), D(), x.addEventListener("click", () => {
|
|
732
|
+
O();
|
|
733
|
+
}), _.addEventListener("click", () => {
|
|
801
734
|
(async () => {
|
|
802
|
-
if (!(m.signal.aborted ||
|
|
803
|
-
|
|
735
|
+
if (!(m.signal.aborted || d)) {
|
|
736
|
+
d = !0, _.disabled = !0, w(void 0);
|
|
804
737
|
try {
|
|
805
|
-
if (
|
|
806
|
-
let e =
|
|
807
|
-
|
|
738
|
+
if (u ||= await ee({ iframe: t }), m.signal.aborted) return;
|
|
739
|
+
let e = u;
|
|
740
|
+
p?.(), p = await pe({
|
|
808
741
|
token: e,
|
|
809
742
|
signal: m.signal,
|
|
810
743
|
onSuccess: (e, t) => {
|
|
811
744
|
if (m.signal.aborted) return;
|
|
812
|
-
let n =
|
|
745
|
+
let n = le(t);
|
|
813
746
|
if (!n) {
|
|
814
|
-
|
|
747
|
+
w("Select a bank account to continue.");
|
|
815
748
|
return;
|
|
816
749
|
}
|
|
817
|
-
let r =
|
|
818
|
-
|
|
750
|
+
let r = ue(t);
|
|
751
|
+
h = {
|
|
819
752
|
credentials: {
|
|
820
753
|
public_token: e,
|
|
821
754
|
account_id: n
|
|
822
755
|
},
|
|
823
756
|
bankName: r.bankName,
|
|
824
757
|
last4: r.last4
|
|
825
|
-
},
|
|
758
|
+
}, u = void 0, D();
|
|
826
759
|
},
|
|
827
760
|
onExit: (e) => {
|
|
828
|
-
m.signal.aborted || e?.error_code === "INVALID_LINK_TOKEN" && (
|
|
761
|
+
m.signal.aborted || e?.error_code === "INVALID_LINK_TOKEN" && (u = void 0);
|
|
829
762
|
}
|
|
830
|
-
}), m.signal.aborted && (
|
|
763
|
+
}), m.signal.aborted && (p(), p = void 0);
|
|
831
764
|
} catch (e) {
|
|
832
|
-
if (
|
|
833
|
-
|
|
765
|
+
if (u = void 0, m.signal.aborted) return;
|
|
766
|
+
w(e instanceof Error ? e.message : "Could not connect bank.");
|
|
834
767
|
} finally {
|
|
835
|
-
|
|
768
|
+
d = !1, m.signal.aborted || (_.disabled = !1);
|
|
836
769
|
}
|
|
837
770
|
}
|
|
838
771
|
})();
|
|
839
772
|
}), {
|
|
840
773
|
update(e) {
|
|
841
|
-
if ("amount" in e && (r.amount = e.amount ?? "0"), "onValidityChange" in e && (r.onValidityChange = e.onValidityChange), "appearance" in e && (r.appearance = e.appearance,
|
|
842
|
-
|
|
774
|
+
if ("amount" in e && (r.amount = e.amount ?? "0"), "onValidityChange" in e && (r.onValidityChange = e.onValidityChange), "appearance" in e && (r.appearance = e.appearance, _e(g, r.appearance, i)), h && !T()) {
|
|
775
|
+
O();
|
|
843
776
|
return;
|
|
844
777
|
}
|
|
845
|
-
|
|
778
|
+
D();
|
|
846
779
|
},
|
|
847
780
|
destroy() {
|
|
848
|
-
m.abort(), window.removeEventListener("message",
|
|
781
|
+
m.abort(), window.removeEventListener("message", k), p?.(), p = void 0, c(t), g.remove();
|
|
849
782
|
}
|
|
850
783
|
};
|
|
851
784
|
}
|
|
@@ -859,19 +792,19 @@ function Z(e) {
|
|
|
859
792
|
}
|
|
860
793
|
return e;
|
|
861
794
|
}
|
|
862
|
-
var
|
|
795
|
+
var ye = {
|
|
863
796
|
width: "calc(100% + 8px)",
|
|
864
797
|
transition: "opacity 150ms ease-in, height 200ms ease-in-out",
|
|
865
798
|
margin: "0 -4px",
|
|
866
799
|
opacity: "0",
|
|
867
800
|
border: "0"
|
|
868
|
-
},
|
|
801
|
+
}, be = {
|
|
869
802
|
width: "100%",
|
|
870
803
|
transition: "height 200ms ease-in-out",
|
|
871
804
|
margin: "0",
|
|
872
805
|
opacity: "0",
|
|
873
806
|
border: "0"
|
|
874
|
-
},
|
|
807
|
+
}, xe = {
|
|
875
808
|
position: "absolute",
|
|
876
809
|
top: "0",
|
|
877
810
|
left: "0",
|
|
@@ -881,7 +814,7 @@ var Q = {
|
|
|
881
814
|
opacity: "0",
|
|
882
815
|
transition: "none",
|
|
883
816
|
pointerEvents: "none"
|
|
884
|
-
},
|
|
817
|
+
}, Se = {
|
|
885
818
|
position: "absolute",
|
|
886
819
|
top: "0",
|
|
887
820
|
left: "-4px",
|
|
@@ -891,15 +824,15 @@ var Q = {
|
|
|
891
824
|
transition: "none",
|
|
892
825
|
pointerEvents: "none"
|
|
893
826
|
};
|
|
894
|
-
function
|
|
827
|
+
function Q({ src: e, title: t, name: n, height: r, allow: i, className: a, style: o = ye }) {
|
|
895
828
|
let s = document.createElement("iframe");
|
|
896
829
|
return s.src = e, s.title = t, s.name = n, s.setAttribute("role", "presentation"), s.scrolling = "no", i && (s.allow = i), a != null && (s.className = a), Object.assign(s.style, o, { height: r }), s;
|
|
897
830
|
}
|
|
898
|
-
function
|
|
831
|
+
function Ce({ host: e, iframe: t, listenerOptions: n, skeletonOptions: r }) {
|
|
899
832
|
let i = document.createElement("div");
|
|
900
833
|
i.style.position = "relative", i.style.width = "100%", i.setAttribute("aria-busy", "true");
|
|
901
|
-
let a =
|
|
902
|
-
Object.assign(t.style,
|
|
834
|
+
let a = ae(r);
|
|
835
|
+
Object.assign(t.style, Se), i.append(a.element, t), e.appendChild(i);
|
|
903
836
|
let o = !1, s = !1, c, l = r.appearance, u, d;
|
|
904
837
|
function f() {
|
|
905
838
|
return i.getBoundingClientRect().height;
|
|
@@ -911,7 +844,7 @@ function Oe({ host: e, iframe: t, listenerOptions: n, skeletonOptions: r }) {
|
|
|
911
844
|
if (o) return;
|
|
912
845
|
o = !0, d !== void 0 && (clearTimeout(d), d = void 0);
|
|
913
846
|
let e = f(), n = p(), r = Number.isFinite(n) ? Math.max(n, e) : e;
|
|
914
|
-
t.style.transition = "none", t.style.position = "", t.style.top = "", t.style.left = "", t.style.margin =
|
|
847
|
+
t.style.transition = "none", t.style.position = "", t.style.top = "", t.style.left = "", t.style.margin = ye.margin ?? "", t.style.height = `${r}px`, t.style.opacity = "1", t.style.pointerEvents = "", a.element.remove(), i.removeAttribute("aria-busy"), u = setTimeout(() => {
|
|
915
848
|
t.style.transition = "height 200ms ease-in-out";
|
|
916
849
|
}, 400);
|
|
917
850
|
}
|
|
@@ -920,7 +853,7 @@ function Oe({ host: e, iframe: t, listenerOptions: n, skeletonOptions: r }) {
|
|
|
920
853
|
let e = p(), t = f();
|
|
921
854
|
Number.isFinite(e) && e >= t - 2 && m();
|
|
922
855
|
}
|
|
923
|
-
let g =
|
|
856
|
+
let g = q(t, {
|
|
924
857
|
...n,
|
|
925
858
|
onHeightChange: (e) => {
|
|
926
859
|
c = e, o ? t.style.height = e : h(), n.onHeightChange?.(e);
|
|
@@ -944,15 +877,15 @@ function Oe({ host: e, iframe: t, listenerOptions: n, skeletonOptions: r }) {
|
|
|
944
877
|
}
|
|
945
878
|
};
|
|
946
879
|
}
|
|
947
|
-
function
|
|
880
|
+
function $({ host: e, iframe: t, listenerOptions: n, iframeStyle: r, attachListeners: i }) {
|
|
948
881
|
let a = {
|
|
949
882
|
height: n.height ?? "48px",
|
|
950
|
-
borderRadius:
|
|
883
|
+
borderRadius: L({
|
|
951
884
|
iframeStyle: r,
|
|
952
885
|
buttonProps: n.buttonProps
|
|
953
886
|
})
|
|
954
|
-
}, o =
|
|
955
|
-
s.style.position = "relative", s.style.width = "100%", s.style.height = a.height, s.style.overflow = "hidden", s.setAttribute("aria-busy", "true"), Object.assign(t.style,
|
|
887
|
+
}, o = F(a), s = document.createElement("div");
|
|
888
|
+
s.style.position = "relative", s.style.width = "100%", s.style.height = a.height, s.style.overflow = "hidden", s.setAttribute("aria-busy", "true"), Object.assign(t.style, xe), t.style.height = "100%", s.append(o.element, t), e.appendChild(s);
|
|
956
889
|
let c = !1, l = !1, u, d = n;
|
|
957
890
|
function f() {
|
|
958
891
|
c || (c = !0, u !== void 0 && (clearTimeout(u), u = void 0), t.style.opacity = "1", t.style.pointerEvents = "", o.element.remove(), s.removeAttribute("aria-busy"));
|
|
@@ -981,7 +914,7 @@ function ke({ host: e, iframe: t, listenerOptions: n, iframeStyle: r, attachList
|
|
|
981
914
|
let t = { ...e };
|
|
982
915
|
delete t.onAppearanceReady, delete t.onHeightChange, m.update(t), a = {
|
|
983
916
|
height: d.height ?? a.height,
|
|
984
|
-
borderRadius:
|
|
917
|
+
borderRadius: L({
|
|
985
918
|
iframeStyle: r,
|
|
986
919
|
buttonProps: d.buttonProps
|
|
987
920
|
})
|
|
@@ -992,15 +925,15 @@ function ke({ host: e, iframe: t, listenerOptions: n, iframeStyle: r, attachList
|
|
|
992
925
|
}
|
|
993
926
|
};
|
|
994
927
|
}
|
|
995
|
-
function
|
|
928
|
+
function we(e, t) {
|
|
996
929
|
let n = Z(e), { renderToken: r, additionalFields: i = { cardholderName: !1 }, billingAddressRequirement: a = "country", ...o } = t;
|
|
997
|
-
return
|
|
930
|
+
return Ce({
|
|
998
931
|
host: n,
|
|
999
|
-
iframe:
|
|
1000
|
-
src:
|
|
932
|
+
iframe: Q({
|
|
933
|
+
src: U(r, i, a),
|
|
1001
934
|
title: "Secure credit card payment method form powered by Amos",
|
|
1002
935
|
name: "amos-credit-card-payment-method-form",
|
|
1003
|
-
height:
|
|
936
|
+
height: G(i, a)
|
|
1004
937
|
}),
|
|
1005
938
|
listenerOptions: o,
|
|
1006
939
|
skeletonOptions: {
|
|
@@ -1011,13 +944,13 @@ function Ae(e, t) {
|
|
|
1011
944
|
}
|
|
1012
945
|
});
|
|
1013
946
|
}
|
|
1014
|
-
function
|
|
1015
|
-
let n = Z(e), { renderToken: r, billingAddressRequirement: i = "country", amount: a = "0", intent: o = "payment", ...s } = t, c =
|
|
1016
|
-
src:
|
|
947
|
+
function Te(e, t) {
|
|
948
|
+
let n = Z(e), { renderToken: r, billingAddressRequirement: i = "country", amount: a = "0", intent: o = "payment", ...s } = t, c = Q({
|
|
949
|
+
src: W(r, i, o),
|
|
1017
950
|
title: "Secure bank account payment method form powered by Amos",
|
|
1018
951
|
name: "amos-bank-account-payment-method-form",
|
|
1019
|
-
height:
|
|
1020
|
-
}), l =
|
|
952
|
+
height: K(i)
|
|
953
|
+
}), l = Ce({
|
|
1021
954
|
host: n,
|
|
1022
955
|
iframe: c,
|
|
1023
956
|
listenerOptions: s,
|
|
@@ -1026,7 +959,7 @@ function je(e, t) {
|
|
|
1026
959
|
appearance: s.appearance,
|
|
1027
960
|
billingAddressRequirement: i
|
|
1028
961
|
}
|
|
1029
|
-
}), u =
|
|
962
|
+
}), u = ve({
|
|
1030
963
|
host: n,
|
|
1031
964
|
iframe: c,
|
|
1032
965
|
options: {
|
|
@@ -1045,41 +978,41 @@ function je(e, t) {
|
|
|
1045
978
|
}
|
|
1046
979
|
};
|
|
1047
980
|
}
|
|
1048
|
-
function
|
|
1049
|
-
let n = Z(e), { renderToken: r, iframeClassName: i, iframeStyle: a, ...o } = t, s =
|
|
1050
|
-
src:
|
|
981
|
+
function Ee(e, t) {
|
|
982
|
+
let n = Z(e), { renderToken: r, iframeClassName: i, iframeStyle: a, ...o } = t, s = Q({
|
|
983
|
+
src: R(r),
|
|
1051
984
|
title: "Secure Google Pay button powered by Amos",
|
|
1052
985
|
name: "amos-google-pay-button",
|
|
1053
|
-
height: o.height ??
|
|
986
|
+
height: o.height ?? z(),
|
|
1054
987
|
allow: "payment",
|
|
1055
988
|
className: i,
|
|
1056
|
-
style:
|
|
989
|
+
style: be
|
|
1057
990
|
});
|
|
1058
|
-
return Object.assign(s.style, a),
|
|
991
|
+
return Object.assign(s.style, a), $({
|
|
1059
992
|
host: n,
|
|
1060
993
|
iframe: s,
|
|
1061
994
|
listenerOptions: o,
|
|
1062
995
|
iframeStyle: a,
|
|
1063
|
-
attachListeners:
|
|
996
|
+
attachListeners: B
|
|
1064
997
|
});
|
|
1065
998
|
}
|
|
1066
|
-
function
|
|
1067
|
-
let n = Z(e), { renderToken: r, iframeClassName: i, iframeStyle: a, ...o } = t, s =
|
|
1068
|
-
src:
|
|
999
|
+
function De(e, t) {
|
|
1000
|
+
let n = Z(e), { renderToken: r, iframeClassName: i, iframeStyle: a, ...o } = t, s = Q({
|
|
1001
|
+
src: T(r),
|
|
1069
1002
|
title: "Secure Apple Pay button powered by Amos",
|
|
1070
1003
|
name: "amos-apple-pay-button",
|
|
1071
|
-
height: o.height ??
|
|
1004
|
+
height: o.height ?? E(),
|
|
1072
1005
|
allow: "payment",
|
|
1073
1006
|
className: i,
|
|
1074
|
-
style:
|
|
1007
|
+
style: be
|
|
1075
1008
|
});
|
|
1076
|
-
return Object.assign(s.style, a),
|
|
1009
|
+
return Object.assign(s.style, a), $({
|
|
1077
1010
|
host: n,
|
|
1078
1011
|
iframe: s,
|
|
1079
1012
|
listenerOptions: o,
|
|
1080
1013
|
iframeStyle: a,
|
|
1081
|
-
attachListeners:
|
|
1014
|
+
attachListeners: O
|
|
1082
1015
|
});
|
|
1083
1016
|
}
|
|
1084
1017
|
//#endregion
|
|
1085
|
-
export {
|
|
1018
|
+
export { ne as SKELETON_STYLES, O as attachApplePayButtonListeners, B as attachGooglePayButtonListeners, q as attachPaymentMethodFormListeners, S as confirmPaymentIntent, C as confirmSetupIntent, l as createMessage, ae as createPaymentMethodFormSkeleton, F as createWalletButtonSkeleton, r as decodeJwt, A as ensureSkeletonStyles, oe as formatGooglePayPaymentData, E as getApplePayButtonInitialHeight, T as getApplePayButtonSrc, K as getBankAccountFormInitialHeight, W as getBankAccountFormSrc, G as getCreditCardFormInitialHeight, U as getCreditCardFormSrc, i as getEmbedOrigin, z as getGooglePayButtonInitialHeight, R as getGooglePayButtonSrc, ue as linkedBankLabelFromMetadata, fe as loadPlaidScript, De as mountAmosApplePayButton, Te as mountAmosBankAccountPaymentMethodForm, we as mountAmosCreditCardPaymentMethodForm, Ee as mountAmosGooglePayButton, pe as openPlaidLink, le as plaidAccountIdFromMetadata, Y as requiresAchVerification, y as resetForm, L as resolveWalletButtonSkeletonBorderRadius, w as sendConfirmationResult, d as sendParentReadyMessage, h as updateAmount, f as updateAppearance, p as updateApplePayButton, m as updateGooglePayButton, g as updateMerchantName, _ as validateForm };
|