@lydianpay/sdk-web 3.15.0 → 3.15.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.
@@ -1,26 +1,26 @@
1
1
  const g = ["USD", "TRY", "PHP"];
2
- function A(e) {
3
- return typeof e == "string" && g.includes(e);
2
+ function S(t) {
3
+ return typeof t == "string" && g.includes(t);
4
4
  }
5
- function l(e) {
6
- return "sessionID" in e && typeof e.sessionID == "string" && e.sessionID.length > 0;
5
+ function c(t) {
6
+ return "sessionID" in t && typeof t.sessionID == "string" && t.sessionID.length > 0;
7
7
  }
8
8
  class y {
9
9
  // Optional: a caller-supplied session has no key and needs none (see Sessions).
10
10
  // The key is still required when the SDK creates the session, enforced in
11
11
  // index.ts where that is known.
12
- constructor(t, a) {
13
- if (this.baseUri = t, this.publishableKey = a, !this.baseUri)
12
+ constructor(e, a) {
13
+ if (this.baseUri = e, this.publishableKey = a, !this.baseUri)
14
14
  throw new Error("baseUri is required");
15
15
  }
16
16
  // Omitted rather than blank when there is no key: the gateway checks the pk_
17
17
  // prefix first, so an empty header is a 400 where an absent one is anonymous.
18
- headers(t) {
19
- const a = { ...t };
18
+ headers(e) {
19
+ const a = { ...e };
20
20
  return this.publishableKey && (a["X-Publishable-Key"] = this.publishableKey), a;
21
21
  }
22
- async request(t, a) {
23
- const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
22
+ async request(e, a) {
23
+ const n = `${this.baseUri}${e}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
24
24
  if (s.ok)
25
25
  return await s.json();
26
26
  throw new Error(s.statusText);
@@ -28,46 +28,64 @@ class y {
28
28
  // For endpoints that reply text/plain rather than JSON (e.g. PATCH
29
29
  // /customer/otp -> "OTP sent"). Sends the same JSON request headers but does
30
30
  // not call response.json(), which would throw on a non-JSON body.
31
- async requestText(t, a) {
32
- const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
31
+ async requestText(e, a) {
32
+ const n = `${this.baseUri}${e}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
33
33
  if (s.ok)
34
34
  return await s.text();
35
35
  throw new Error(s.statusText);
36
36
  }
37
- async requestWithFormData(t, a) {
38
- const n = `${this.baseUri}${t}`, o = this.headers(), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
37
+ async requestWithFormData(e, a) {
38
+ const n = `${this.baseUri}${e}`, o = this.headers(), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
39
39
  if (s.ok)
40
40
  return await s.json();
41
41
  throw new Error(s.statusText);
42
42
  }
43
43
  }
44
- const c = "transaction";
45
- class S extends y {
46
- async getCryptoTransaction(t) {
47
- return await this.request(`/${c}/${t}`);
44
+ const l = "transaction";
45
+ class A extends y {
46
+ async getCryptoTransaction(e) {
47
+ return await this.request(`/${l}/${e}`);
48
48
  }
49
- async createPaymentRequest(t, a) {
49
+ async createPaymentRequest(e, a) {
50
50
  return await this.request(
51
- `/${c}/${t}/payment`,
51
+ `/${l}/${e}/payment`,
52
52
  {
53
53
  method: "POST",
54
54
  body: JSON.stringify(a)
55
55
  }
56
56
  );
57
57
  }
58
- async cancelCryptoTransaction(t, a) {
58
+ async buildTransfer(e, a, n) {
59
59
  return await this.request(
60
- `/${c}/${t}/cancel`,
60
+ `/${l}/${e}/payment/${a}/transfer`,
61
+ {
62
+ method: "POST",
63
+ body: JSON.stringify(n)
64
+ }
65
+ );
66
+ }
67
+ async broadcastTransfer(e, a, n) {
68
+ return await this.request(
69
+ `/${l}/${e}/payment/${a}/transfer/broadcast`,
70
+ {
71
+ method: "POST",
72
+ body: JSON.stringify(n)
73
+ }
74
+ );
75
+ }
76
+ async cancelCryptoTransaction(e, a) {
77
+ return await this.request(
78
+ `/${l}/${e}/cancel`,
61
79
  {
62
80
  method: "PATCH",
63
81
  body: JSON.stringify(a)
64
82
  }
65
83
  );
66
84
  }
67
- async kycVerification(t, a) {
85
+ async kycVerification(e, a) {
68
86
  const n = new FormData();
69
87
  return n.append("asset", a.asset), n.append("network", a.network), n.append("firstName", a.firstName), n.append("lastName", a.lastName), n.append("email", a.email), n.append("street", a.street), n.append("city", a.city), n.append("region", a.region), n.append("postalCode", a.postalCode), n.append("country", a.country), n.append("storeKYC", a.storeKYC ? "true" : "false"), a.customerUUID && n.append("customerUUID", a.customerUUID), a.walletAddress && n.append("walletAddress", a.walletAddress), a.documentType && n.append("documentType", a.documentType), a.documentFiles.forEach((o) => n.append("documentFiles", o)), await this.requestWithFormData(
70
- `/${c}/${t}/verification`,
88
+ `/${l}/${e}/verification`,
71
89
  {
72
90
  method: "POST",
73
91
  body: n
@@ -75,48 +93,48 @@ class S extends y {
75
93
  );
76
94
  }
77
95
  }
78
- function I(e, t) {
79
- t.forEach((a) => {
96
+ function I(t, e) {
97
+ e.forEach((a) => {
80
98
  Object.getOwnPropertyNames(a.prototype).forEach((n) => {
81
99
  const o = Object.getOwnPropertyDescriptor(a.prototype, n);
82
- o && Object.defineProperty(e.prototype, n, o);
100
+ o && Object.defineProperty(t.prototype, n, o);
83
101
  });
84
102
  });
85
103
  }
86
104
  const w = "customer/otp";
87
105
  class L extends y {
88
106
  // PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
89
- async sendCustomerOTP(t) {
107
+ async sendCustomerOTP(e) {
90
108
  return await this.requestText(`/${w}`, {
91
109
  method: "PATCH",
92
- body: JSON.stringify(t)
110
+ body: JSON.stringify(e)
93
111
  });
94
112
  }
95
113
  // PUT /customer/otp -> { customerUUID, kycValidated }.
96
- async authenticateCustomerOTP(t) {
114
+ async authenticateCustomerOTP(e) {
97
115
  return await this.request(`/${w}`, {
98
116
  method: "PUT",
99
- body: JSON.stringify(t)
117
+ body: JSON.stringify(e)
100
118
  });
101
119
  }
102
120
  }
103
121
  const d = "session";
104
122
  class U extends y {
105
- async createSession(t) {
123
+ async createSession(e) {
106
124
  return await this.request(`/${d}`, {
107
125
  method: "POST",
108
- body: JSON.stringify(t)
126
+ body: JSON.stringify(e)
109
127
  });
110
128
  }
111
- async getSession(t) {
112
- return await this.request(`/${d}/${t}`);
129
+ async getSession(e) {
130
+ return await this.request(`/${d}/${e}`);
113
131
  }
114
132
  // Promotes the session into a transaction. Allowed once per session — except
115
133
  // that a KYC-pending (-3) response does not consume the promotion, which is
116
134
  // what lets the restore-details flow re-promote with a customerUUID.
117
- async createSessionTransaction(t, a) {
135
+ async createSessionTransaction(e, a) {
118
136
  return await this.request(
119
- `/${d}/${t}/transaction`,
137
+ `/${d}/${e}/transaction`,
120
138
  {
121
139
  method: "POST",
122
140
  body: JSON.stringify(a)
@@ -125,15 +143,15 @@ class U extends y {
125
143
  }
126
144
  // PATCH /session/{id}/cancel replies text/plain (the merchant's cancel URL),
127
145
  // not JSON. Cancelling cascades to the linked transaction, if any.
128
- async cancelSession(t) {
129
- return await this.requestText(`/${d}/${t}/cancel`, {
146
+ async cancelSession(e) {
147
+ return await this.requestText(`/${d}/${e}/cancel`, {
130
148
  method: "PATCH"
131
149
  });
132
150
  }
133
151
  }
134
152
  class b extends y {
135
153
  }
136
- I(b, [S, L, U]);
154
+ I(b, [A, L, U]);
137
155
  const R = b;
138
156
  var u = {
139
157
  COMPLIANCE_PENDING: -10,
@@ -163,63 +181,63 @@ var u = {
163
181
  sandbox: "https://api.sandbox.lydian.com",
164
182
  prod: "https://api.lydian.com"
165
183
  };
166
- function F(e) {
167
- return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? p.dev : e.sandbox ? p.sandbox : p.prod;
184
+ function F(t) {
185
+ return t.gatewayUrl ? new URL(t.gatewayUrl).origin : t.dev ? p.dev : t.sandbox ? p.sandbox : p.prod;
168
186
  }
169
- function C({
170
- options: e,
171
- unsupportedKeys: t,
187
+ function P({
188
+ options: t,
189
+ unsupportedKeys: e,
172
190
  entryPoint: a
173
191
  }) {
174
- const n = t.filter((o) => e[o] !== void 0);
192
+ const n = e.filter((o) => t[o] !== void 0);
175
193
  return n.length === 0 ? null : `${n.join(" and ")} ${n.length > 1 ? "are" : "is"} not used by ${a}. Passing it has no effect, so this is almost always a mistake.`;
176
194
  }
177
- function P(e) {
178
- var t;
179
- return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
195
+ function C(t) {
196
+ var e;
197
+ return (e = t.flow) != null && e.walletConnect && !t.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
180
198
  }
181
- function k(e) {
182
- return e.gatewayUrl === void 0 || W(e.gatewayUrl) ? null : `gatewayUrl must be an http(s) origin such as http://localhost:8000, with no path, got ${JSON.stringify(e.gatewayUrl)}`;
199
+ function k(t) {
200
+ return t.gatewayUrl === void 0 || W(t.gatewayUrl) ? null : `gatewayUrl must be an http(s) origin such as http://localhost:8000, with no path, got ${JSON.stringify(t.gatewayUrl)}`;
183
201
  }
184
- function W(e) {
185
- let t;
202
+ function W(t) {
203
+ let e;
186
204
  try {
187
- t = new URL(e);
205
+ e = new URL(t);
188
206
  } catch {
189
207
  return !1;
190
208
  }
191
- return (t.protocol === "http:" || t.protocol === "https:") && t.pathname === "/" && t.search === "" && t.hash === "";
209
+ return (e.protocol === "http:" || e.protocol === "https:") && e.pathname === "/" && e.search === "" && e.hash === "";
192
210
  }
193
- function ee(e) {
194
- return e !== null && !l(e) && !!e.publishableKey;
211
+ function ee(t) {
212
+ return t !== null && !c(t) && !!t.publishableKey;
195
213
  }
196
- function te(e) {
197
- return e !== null && !l(e);
214
+ function te(t) {
215
+ return t !== null && !c(t);
198
216
  }
199
217
  function ae({
200
- options: e,
201
- session: t,
218
+ options: t,
219
+ session: e,
202
220
  settled: a
203
221
  }) {
204
- return !a && t !== null && e !== null && l(e);
222
+ return !a && e !== null && t !== null && c(t);
205
223
  }
206
- function T(e, t, a) {
224
+ function T(t, e, a) {
207
225
  try {
208
- e == null || e(t, a);
226
+ t == null || t(e, a);
209
227
  } catch (n) {
210
- console.error(`onEvent("${t}") threw:`, n);
228
+ console.error(`onEvent("${e}") threw:`, n);
211
229
  }
212
230
  }
213
- async function x({
214
- api: e,
215
- options: t,
231
+ async function $({
232
+ api: t,
233
+ options: e,
216
234
  emit: a
217
235
  }) {
218
236
  try {
219
- const n = await M({ api: e, options: t }), { session: o, sessionPromoted: r } = await Y({ api: e, sessionID: n });
220
- a("session.loaded", $(o));
237
+ const n = await x({ api: t, options: e }), { session: o, sessionPromoted: r } = await M({ api: t, sessionID: n });
238
+ a("session.loaded", Y(o));
221
239
  const s = await B({
222
- api: e,
240
+ api: t,
223
241
  transactionID: o.transactionID
224
242
  });
225
243
  return { ok: !0, session: o, sessionPromoted: r, linkedTransaction: s };
@@ -227,69 +245,69 @@ async function x({
227
245
  return { ok: !1 };
228
246
  }
229
247
  }
230
- async function M({
231
- api: e,
232
- options: t
248
+ async function x({
249
+ api: t,
250
+ options: e
233
251
  }) {
234
- return l(t) ? t.sessionID : (await e.createSession({
235
- amount: t.transaction.amount,
236
- amountCurrency: t.transaction.currency,
237
- descriptor: t.transaction.descriptor,
238
- referenceNumber: t.transaction.referenceNumber
252
+ return c(e) ? e.sessionID : (await t.createSession({
253
+ amount: e.transaction.amount,
254
+ amountCurrency: e.transaction.currency,
255
+ descriptor: e.transaction.descriptor,
256
+ referenceNumber: e.transaction.referenceNumber
239
257
  })).sessionID;
240
258
  }
241
- async function Y({
242
- api: e,
243
- sessionID: t
259
+ async function M({
260
+ api: t,
261
+ sessionID: e
244
262
  }) {
245
- const a = await e.getSession(t);
263
+ const a = await t.getSession(e);
246
264
  return { session: a, sessionPromoted: E(a) };
247
265
  }
248
- function $(e) {
266
+ function Y(t) {
249
267
  return {
250
- sessionID: e.sessionID,
251
- merchantName: e.merchantName,
252
- alreadyPromoted: E(e)
268
+ sessionID: t.sessionID,
269
+ merchantName: t.merchantName,
270
+ alreadyPromoted: E(t)
253
271
  };
254
272
  }
255
- function E(e) {
256
- return !!e.transactionID;
273
+ function E(t) {
274
+ return !!t.transactionID;
257
275
  }
258
276
  async function B({
259
- api: e,
260
- transactionID: t
277
+ api: t,
278
+ transactionID: e
261
279
  }) {
262
- if (!t)
280
+ if (!e)
263
281
  return null;
264
282
  try {
265
- return await e.getCryptoTransaction(t);
283
+ return await t.getCryptoTransaction(e);
266
284
  } catch (a) {
267
285
  return console.error("Failed to resolve the session transaction:", a), null;
268
286
  }
269
287
  }
270
- function h(e) {
271
- if (!e)
288
+ function h(t) {
289
+ if (!t)
272
290
  return;
273
- let t;
291
+ let e;
274
292
  try {
275
- t = new URL(e);
293
+ e = new URL(t);
276
294
  } catch {
277
295
  return;
278
296
  }
279
- return t.protocol === "https:" || t.protocol === "http:" ? e : void 0;
297
+ return e.protocol === "https:" || e.protocol === "http:" ? t : void 0;
280
298
  }
281
299
  function _({
282
- message: e,
283
- reason: t,
300
+ message: t,
301
+ reason: e,
284
302
  shouldEndCheckout: a,
285
303
  transactionID: n,
286
304
  session: o
287
305
  }) {
288
306
  return {
289
- event: { reason: t, shouldEndCheckout: a, message: e },
307
+ event: { reason: e, shouldEndCheckout: a, message: t },
290
308
  failure: {
291
309
  shouldEndCheckout: a,
292
- reason: t,
310
+ reason: e,
293
311
  transactionID: n,
294
312
  // Only a failure that ends the checkout carries a redirect. A retryable one
295
313
  // leaves the customer mid-flow with something still to do, and a host that
@@ -298,7 +316,7 @@ function _({
298
316
  }
299
317
  };
300
318
  }
301
- const G = {
319
+ const q = {
302
320
  "common.cancelTransaction": "Cancel Transaction",
303
321
  "common.cancel": "Cancel",
304
322
  "common.back": "Back",
@@ -500,6 +518,7 @@ const G = {
500
518
  "errors.walletOnWrongNetwork": "Your wallet is on a different network. Switch to {network} to pay from it, or scan the code below instead.",
501
519
  "errors.walletDisconnected": "Your wallet disconnected. Reconnect it, or scan the code below to pay.",
502
520
  "errors.walletDeclinedScanInstead": "Your wallet didn’t approve the payment. You can still pay by scanning the code below.",
521
+ "errors.walletSignedNotSent": "Your wallet signed the payment, but it couldn’t be sent. You can still pay by scanning the code below.",
503
522
  "errors.unableToCreateCryptoTransaction": "We couldn't set up your payment. Please try again, or choose a different coin.",
504
523
  "errors.cryptoTransactionNotCreated": "Your payment hasn’t been set up yet. Choose a coin and network to continue.",
505
524
  "errors.unableToVerifyDetails": "We could not verify your details. Please try again or contact support.",
@@ -520,28 +539,28 @@ const G = {
520
539
  "validation.customerDetailsMissing": "Customer details are missing.",
521
540
  "validation.invalidOtp": "Please enter a valid 6-digit code.",
522
541
  "terms.notice": 'By continuing, you agree to Lydian <a href="https://lydian.com/privacy" target="_blank" rel="noopener noreferrer">Terms and Conditions</a> and understand your data will be processed according to the <a href="https://lydian.com/privacy" target="_blank" rel="noopener noreferrer">Privacy Notice</a>.'
523
- }, f = { en: G }, v = "en";
542
+ }, f = { en: q }, v = "en";
524
543
  let D = v;
525
544
  function ne() {
526
545
  return D;
527
546
  }
528
- function N(e, t) {
547
+ function N(t, e) {
529
548
  var n;
530
- const a = ((n = f[D]) == null ? void 0 : n[e]) ?? f[v][e] ?? e;
531
- return t ? a.replace(
549
+ const a = ((n = f[D]) == null ? void 0 : n[t]) ?? f[v][t] ?? t;
550
+ return e ? a.replace(
532
551
  /\{(\w+)\}/g,
533
- (o, r) => t[r] != null ? String(t[r]) : `{${r}}`
552
+ (o, r) => e[r] != null ? String(e[r]) : `{${r}}`
534
553
  ) : a;
535
554
  }
536
- function q(e) {
537
- return e === u.SUCCESS ? "succeeded" : e < u.PENDING && e !== u.KYC_VERIFICATION_PENDING && e !== u.COMPLIANCE_PENDING ? "failed" : "active";
555
+ function G(t) {
556
+ return t === u.SUCCESS ? "succeeded" : t < u.PENDING && t !== u.KYC_VERIFICATION_PENDING && t !== u.COMPLIANCE_PENDING ? "failed" : "active";
538
557
  }
539
558
  function H({
540
- transaction: e,
541
- session: t
559
+ transaction: t,
560
+ session: e
542
561
  }) {
543
562
  var o, r, s;
544
- const a = q(e.status);
563
+ const a = G(t.status);
545
564
  if (a === "active")
546
565
  return null;
547
566
  if (a === "failed")
@@ -552,49 +571,49 @@ function H({
552
571
  shouldEndCheckout: !0,
553
572
  // Negative (non-KYC) status — cancelled / fraud / timeout.
554
573
  reason: "blocked",
555
- transactionID: e.transactionID,
556
- redirectURL: h(t == null ? void 0 : t.failureURL)
574
+ transactionID: t.transactionID,
575
+ redirectURL: h(e == null ? void 0 : e.failureURL)
557
576
  }
558
577
  };
559
- const n = (o = e.payments) == null ? void 0 : o.find(
578
+ const n = (o = t.payments) == null ? void 0 : o.find(
560
579
  (i) => i.status === O.CONFIRMED
561
580
  );
562
581
  return {
563
582
  outcome: a,
564
583
  event: {
565
- transactionID: e.transactionID,
584
+ transactionID: t.transactionID,
566
585
  asset: n == null ? void 0 : n.cryptoAsset,
567
586
  network: n == null ? void 0 : n.cryptoNetwork
568
587
  },
569
588
  result: {
570
- transactionID: e.transactionID,
571
- amount: (r = e.amounts) == null ? void 0 : r.totalLocal,
572
- currency: (s = e.amounts) == null ? void 0 : s.currency,
589
+ transactionID: t.transactionID,
590
+ amount: (r = t.amounts) == null ? void 0 : r.totalLocal,
591
+ currency: (s = t.amounts) == null ? void 0 : s.currency,
573
592
  asset: n == null ? void 0 : n.cryptoAsset,
574
593
  network: n == null ? void 0 : n.cryptoNetwork,
575
594
  completedAt: n == null ? void 0 : n.completedAt,
576
- redirectURL: h(t == null ? void 0 : t.successURL)
595
+ redirectURL: h(e == null ? void 0 : e.successURL)
577
596
  }
578
597
  };
579
598
  }
580
599
  function K() {
581
- let e = null;
600
+ let t = null;
582
601
  return {
583
- setOptions: (t) => {
584
- e = t;
602
+ setOptions: (e) => {
603
+ t = e;
585
604
  },
586
- emit: (t, a) => T(e == null ? void 0 : e.onEvent, t, a),
587
- paymentFailed: (t, a) => {
605
+ emit: (e, a) => T(t == null ? void 0 : t.onEvent, e, a),
606
+ paymentFailed: (e, a) => {
588
607
  var n;
589
- return (n = e == null ? void 0 : e.paymentFailedListener) == null ? void 0 : n.call(e, t, a);
608
+ return (n = t == null ? void 0 : t.paymentFailedListener) == null ? void 0 : n.call(t, e, a);
590
609
  },
591
- paymentSucceeded: (t) => {
610
+ paymentSucceeded: (e) => {
592
611
  var a;
593
- return (a = e == null ? void 0 : e.paymentSuccessListener) == null ? void 0 : a.call(e, t);
612
+ return (a = t == null ? void 0 : t.paymentSuccessListener) == null ? void 0 : a.call(t, e);
594
613
  },
595
- paymentCanceled: (t) => {
614
+ paymentCanceled: (e) => {
596
615
  var a;
597
- return (a = e == null ? void 0 : e.paymentCanceledListener) == null ? void 0 : a.call(e, t);
616
+ return (a = t == null ? void 0 : t.paymentCanceledListener) == null ? void 0 : a.call(t, e);
598
617
  }
599
618
  };
600
619
  }
@@ -607,26 +626,26 @@ class j extends HTMLElement {
607
626
  connectedCallback() {
608
627
  this.isTornDown = !1;
609
628
  }
610
- async initialize(t) {
611
- const a = z(t), n = J({ api: a, options: t }), o = await this.loadEngine(t, n);
612
- !o || this.isTornDown || (this.engine = o, await o.initialize(t, { api: a, sessionLoad: n }));
629
+ async initialize(e) {
630
+ const a = z(e), n = J({ api: a, options: e }), o = await this.loadEngine(e, n);
631
+ !o || this.isTornDown || (this.engine = o, await o.initialize(e, { api: a, sessionLoad: n }));
613
632
  }
614
- async loadEngine(t, a) {
633
+ async loadEngine(e, a) {
615
634
  const n = this.getOrLoadEngine();
616
635
  try {
617
636
  return await n;
618
637
  } catch {
619
638
  return await this.handleEngineLoadFailure({
620
639
  engineLoad: n,
621
- options: t,
640
+ options: e,
622
641
  sessionLoad: a
623
642
  }), null;
624
643
  }
625
644
  }
626
- async updateTransaction(t) {
645
+ async updateTransaction(e) {
627
646
  if (!this.engine)
628
647
  throw new Error("Tether Pay not initialized.");
629
- await this.engine.updateTransaction(t);
648
+ await this.engine.updateTransaction(e);
630
649
  }
631
650
  // A merchant SPA can unmount the element at any time; nothing else stops this
632
651
  // instance's timers.
@@ -636,8 +655,8 @@ class j extends HTMLElement {
636
655
  // Not started in the constructor: a page can carry the tag and never check out.
637
656
  // Overlapping initialize() calls share one download.
638
657
  getOrLoadEngine() {
639
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-0Lj7ZkFh.js").then((t) => t.m).then((t) => {
640
- const a = t.mountCheckoutEngine({
658
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-SwisFe5z.js").then((e) => e.m).then((e) => {
659
+ const a = e.mountCheckoutEngine({
641
660
  host: this,
642
661
  shadowRoot: this.shadow
643
662
  });
@@ -645,11 +664,11 @@ class j extends HTMLElement {
645
664
  })), this.engineLoadPromise;
646
665
  }
647
666
  async handleEngineLoadFailure({
648
- engineLoad: t,
667
+ engineLoad: e,
649
668
  options: a,
650
669
  sessionLoad: n
651
670
  }) {
652
- this.engineLoadPromise === t && (this.engineLoadPromise = null, await this.reportEngineFailure({ options: a, sessionLoad: n }));
671
+ this.engineLoadPromise === e && (this.engineLoadPromise = null, await this.reportEngineFailure({ options: a, sessionLoad: n }));
653
672
  }
654
673
  // A host that removed the element has walked away; a failure report could send
655
674
  // it to a failureURL for a checkout it dismissed.
@@ -661,7 +680,7 @@ class j extends HTMLElement {
661
680
  // an outcome the gateway has already decided — a session resumed after the
662
681
  // payment settled must report that payment, not a dead checkout.
663
682
  async reportEngineFailure({
664
- options: t,
683
+ options: e,
665
684
  sessionLoad: a
666
685
  }) {
667
686
  if (this.isDismissedByHost)
@@ -670,7 +689,7 @@ class j extends HTMLElement {
670
689
  if (this.isDismissedByHost)
671
690
  return;
672
691
  const o = K();
673
- o.setOptions(t);
692
+ o.setOptions(e);
674
693
  const r = n.ok && n.linkedTransaction ? H({
675
694
  transaction: n.linkedTransaction,
676
695
  session: n.session
@@ -697,70 +716,70 @@ class j extends HTMLElement {
697
716
  }
698
717
  // Always teardown and unmount together to avoid leaking the React engine.
699
718
  // Clear the cached load so a later initialize() creates a fresh engine.
700
- releaseEngine(t = this.engine) {
701
- t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
719
+ releaseEngine(e = this.engine) {
720
+ e == null || e.teardown(), e == null || e.unmount(), this.engine = null, this.engineLoadPromise = null;
702
721
  }
703
722
  }
704
- function z(e) {
723
+ function z(t) {
705
724
  return new R(
706
- F(e),
707
- l(e) ? void 0 : e.publishableKey
725
+ F(t),
726
+ c(t) ? void 0 : t.publishableKey
708
727
  );
709
728
  }
710
729
  function J({
711
- api: e,
712
- options: t
730
+ api: t,
731
+ options: e
713
732
  }) {
714
- return x({
715
- api: e,
716
- options: t,
717
- emit: (a, n) => T(t.onEvent, a, n)
733
+ return $({
734
+ api: t,
735
+ options: e,
736
+ emit: (a, n) => T(e.onEvent, a, n)
718
737
  });
719
738
  }
720
739
  customElements.get("lydian-checkout") || customElements.define("lydian-checkout", j);
721
740
  function m() {
722
741
  return document.querySelector("lydian-checkout");
723
742
  }
724
- async function Q(e) {
725
- if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
743
+ async function Q(t) {
744
+ if (!t.publishableKey || !t.transaction.amount || !t.transaction.currency)
726
745
  throw new Error("SDK initialization requires publishableKey and a transaction");
727
- const t = P(e);
728
- if (t)
729
- throw new Error(t);
730
- const a = k(e);
746
+ const e = C(t);
747
+ if (e)
748
+ throw new Error(e);
749
+ const a = k(t);
731
750
  if (a)
732
751
  throw new Error(a);
733
- if (!A(e.transaction.currency))
752
+ if (!S(t.transaction.currency))
734
753
  throw new Error("Invalid value for currency, valid values are: " + g.join(", "));
735
- const n = C({
736
- options: e,
754
+ const n = P({
755
+ options: t,
737
756
  unsupportedKeys: ["sessionID"],
738
757
  entryPoint: "init"
739
758
  });
740
759
  if (n)
741
760
  throw new Error(n);
742
- await m().initialize(e);
761
+ await m().initialize(t);
743
762
  }
744
- async function Z(e) {
745
- if (!e.sessionID)
763
+ async function Z(t) {
764
+ if (!t.sessionID)
746
765
  throw new Error("initExistingSession requires a sessionID");
747
- const t = P(e);
748
- if (t)
749
- throw new Error(t);
750
- const a = k(e);
766
+ const e = C(t);
767
+ if (e)
768
+ throw new Error(e);
769
+ const a = k(t);
751
770
  if (a)
752
771
  throw new Error(a);
753
- const n = C({
754
- options: e,
772
+ const n = P({
773
+ options: t,
755
774
  unsupportedKeys: ["publishableKey", "transaction"],
756
775
  entryPoint: "initExistingSession"
757
776
  });
758
777
  if (n)
759
778
  throw new Error(n);
760
- await m().initialize(e);
779
+ await m().initialize(t);
761
780
  }
762
- async function X(e) {
763
- await m().updateTransaction(e);
781
+ async function X(t) {
782
+ await m().updateTransaction(t);
764
783
  }
765
784
  window.Lydian = { init: Q, initExistingSession: Z, updateTransaction: X };
766
785
  export {
@@ -769,20 +788,20 @@ export {
769
788
  V as a,
770
789
  te as b,
771
790
  g as c,
772
- Y as d,
773
- $ as e,
791
+ M as d,
792
+ Y as e,
774
793
  B as f,
775
794
  ne as g,
776
- l as h,
777
- A as i,
778
- q as j,
795
+ c as h,
796
+ S as i,
797
+ G as j,
779
798
  H as k,
780
799
  E as l,
781
800
  ae as m,
782
801
  _ as n,
783
802
  ee as o,
784
803
  K as p,
785
- M as r,
804
+ x as r,
786
805
  h as s,
787
806
  N as t
788
807
  };