@lydianpay/sdk-web 3.15.1 → 3.15.3

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