@amos.com/amos-js 0.9.17 → 0.10.0

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