@lydianpay/sdk-web 3.19.4 → 3.20.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.
Files changed (37) hide show
  1. package/dist/chunks/{browser-Gupuc6-M.js → browser-rxX-1RlV.js} +1 -1
  2. package/dist/chunks/{connect-multichain-Bch0gsrc.js → connect-multichain-BwOA1L8N.js} +9 -9
  3. package/dist/chunks/{dist-CczZUfp3.js → dist-BTA0E_b3.js} +2 -2
  4. package/dist/chunks/{dist-BNHS8iis.js → dist-Bnz-_T3x.js} +3 -3
  5. package/dist/chunks/{index-ilCIr0ZQ.js → index-C7WgU0CK.js} +317 -285
  6. package/dist/chunks/{index-DORsWhf1.js → index-DbCr6lts.js} +2 -2
  7. package/dist/chunks/{index-CTmDBwNd.js → index-_SoQft4L.js} +1 -1
  8. package/dist/chunks/{index-D5YydOtF.js → index-hVXeCXXz.js} +1 -1
  9. package/dist/chunks/{mountEngine-_G66fuAB.js → mountEngine-CjLQCm5Y.js} +11691 -11077
  10. package/dist/lydian.js +1 -1
  11. package/dist/types/.tsbuildinfo +1 -1
  12. package/dist/types/network/base.d.ts +1 -0
  13. package/dist/types/network/customer/index.d.ts +2 -2
  14. package/dist/types/types.d.ts +6 -0
  15. package/dist/types/ui/countries.d.ts +2 -0
  16. package/dist/types/ui/kycFlow.d.ts +11 -0
  17. package/dist/types/ui/kycValidation.d.ts +33 -9
  18. package/dist/types/ui/otpValidation.d.ts +5 -0
  19. package/dist/types/ui/react/ContactInfoSection/ContactInfoSection.d.ts +11 -0
  20. package/dist/types/ui/react/ContactInfoSection/EmailCodeCard.d.ts +10 -0
  21. package/dist/types/ui/react/ContactInfoSection/EmailEntryStep.d.ts +10 -0
  22. package/dist/types/ui/react/ContactInfoSection/NotYouButton.d.ts +6 -0
  23. package/dist/types/ui/react/ContactInfoSection/Reveal.d.ts +5 -0
  24. package/dist/types/ui/react/ContactInfoSection/SavedLoginStep.d.ts +9 -0
  25. package/dist/types/ui/react/ContactInfoSection/SendCodeButton.d.ts +5 -0
  26. package/dist/types/ui/react/ContactInfoSection/StepCard.d.ts +5 -0
  27. package/dist/types/ui/react/ContactInfoSection/VerifiedEmailCard.d.ts +5 -0
  28. package/dist/types/ui/react/ContactInfoSection/emailStep.d.ts +20 -0
  29. package/dist/types/ui/react/ContactInfoSection/useEmailVerification.d.ts +17 -0
  30. package/dist/types/ui/react/ErrorText.d.ts +5 -0
  31. package/dist/types/ui/react/FormField.d.ts +2 -1
  32. package/dist/types/ui/react/KycFields.d.ts +3 -3
  33. package/dist/types/ui/react/SearchSelect.d.ts +2 -1
  34. package/dist/types/ui/react/checkoutStore.d.ts +11 -0
  35. package/dist/types/ui/restoredCustomer.d.ts +23 -3
  36. package/dist/types/ui/sessionHelpers.d.ts +9 -1
  37. package/package.json +1 -1
@@ -1,68 +1,82 @@
1
1
  const E = ["USD", "TRY", "PHP"];
2
- function U(e) {
3
- return typeof e == "string" && E.includes(e);
2
+ function U(t) {
3
+ return typeof t == "string" && E.includes(t);
4
4
  }
5
- function u(e) {
6
- return "sessionID" in e && typeof e.sessionID == "string" && e.sessionID.length > 0;
5
+ function u(t) {
6
+ return "sessionID" in t && typeof t.sessionID == "string" && t.sessionID.length > 0;
7
7
  }
8
8
  class O extends Error {
9
9
  constructor({
10
- statusText: t,
10
+ statusText: e,
11
11
  errorCode: a,
12
12
  response: n
13
13
  }) {
14
- super(t, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
14
+ super(e, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
15
15
  }
16
16
  }
17
- async function w(e) {
18
- const t = await e.clone().json().catch(() => null);
17
+ async function F(t) {
18
+ const e = await t.clone().json().catch(() => null);
19
19
  return new O({
20
- statusText: e.statusText,
21
- errorCode: F(t),
22
- response: e
20
+ statusText: t.statusText,
21
+ errorCode: W(e),
22
+ response: t
23
23
  });
24
24
  }
25
- function F(e) {
26
- if (!(typeof e != "object" || e === null || !("errorCode" in e)))
27
- return typeof e.errorCode == "number" ? e.errorCode : void 0;
25
+ function W(t) {
26
+ if (!(typeof t != "object" || t === null || !("errorCode" in t)))
27
+ return typeof t.errorCode == "number" ? t.errorCode : void 0;
28
28
  }
29
+ const k = { "Content-Type": "application/json" };
29
30
  class y {
30
31
  // Optional: a caller-supplied session has no key and needs none (see Sessions).
31
32
  // The key is still required when the SDK creates the session, enforced in
32
33
  // index.ts where that is known.
33
- constructor(t, a) {
34
- if (this.baseUri = t, this.publishableKey = a, !this.baseUri)
34
+ constructor(e, a) {
35
+ if (this.baseUri = e, this.publishableKey = a, !this.baseUri)
35
36
  throw new Error("baseUri is required");
36
37
  }
37
38
  // Omitted rather than blank when there is no key: the gateway checks the pk_
38
39
  // prefix first, so an empty header is a 400 where an absent one is anonymous.
39
- headers(t) {
40
- const a = { ...t };
40
+ headers(e) {
41
+ const a = { ...e };
41
42
  return this.publishableKey && (a["X-Publishable-Key"] = this.publishableKey), a;
42
43
  }
43
- async request(t, a) {
44
- const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json", ...a == null ? void 0 : a.headers }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
45
- if (s.ok)
46
- return await s.json();
47
- throw await w(s);
44
+ async send({
45
+ endpoint: e,
46
+ options: a,
47
+ requestHeaders: n
48
+ }) {
49
+ const o = await fetch(`${this.baseUri}${e}`, {
50
+ ...a,
51
+ headers: this.headers(n)
52
+ });
53
+ if (o.ok)
54
+ return o;
55
+ throw await F(o);
56
+ }
57
+ async request(e, a) {
58
+ return await (await this.send({
59
+ endpoint: e,
60
+ options: a,
61
+ requestHeaders: { ...k, ...a == null ? void 0 : a.headers }
62
+ })).json();
48
63
  }
49
64
  // For endpoints that reply text/plain rather than JSON (e.g. PATCH
50
65
  // /customer/otp -> "OTP sent"). Sends the same JSON request headers but does
51
66
  // not call response.json(), which would throw on a non-JSON body.
52
- async requestText(t, a) {
53
- const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
54
- if (s.ok)
55
- return await s.text();
56
- throw await w(s);
67
+ async requestText(e, a) {
68
+ return await (await this.send({
69
+ endpoint: e,
70
+ options: a,
71
+ requestHeaders: k
72
+ })).text();
57
73
  }
58
- async requestWithFormData(t, a) {
59
- const n = `${this.baseUri}${t}`, o = this.headers(), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
60
- if (s.ok)
61
- return await s.json();
62
- throw await w(s);
74
+ // No Content-Type: the browser sets the multipart boundary.
75
+ async requestWithFormData(e, a) {
76
+ return await (await this.send({ endpoint: e, options: a })).json();
63
77
  }
64
78
  }
65
- const l = "transaction", W = [
79
+ const c = "transaction", _ = [
66
80
  "firstName",
67
81
  "lastName",
68
82
  "email",
@@ -81,55 +95,55 @@ const l = "transaction", W = [
81
95
  "nationalIDNumber",
82
96
  "customerIDNumber"
83
97
  ];
84
- class $ extends y {
85
- async getCryptoTransaction(t) {
86
- return await this.request(`/${l}/${t}`);
98
+ class M extends y {
99
+ async getCryptoTransaction(e) {
100
+ return await this.request(`/${c}/${e}`);
87
101
  }
88
- async createPaymentRequest(t, a) {
102
+ async createPaymentRequest(e, a) {
89
103
  return await this.request(
90
- `/${l}/${t}/payment`,
104
+ `/${c}/${e}/payment`,
91
105
  {
92
106
  method: "POST",
93
107
  body: JSON.stringify(a)
94
108
  }
95
109
  );
96
110
  }
97
- async buildTransfer(t, a, n) {
111
+ async buildTransfer(e, a, n) {
98
112
  return await this.request(
99
- `/${l}/${t}/payment/${a}/transfer`,
113
+ `/${c}/${e}/payment/${a}/transfer`,
100
114
  {
101
115
  method: "POST",
102
116
  body: JSON.stringify(n)
103
117
  }
104
118
  );
105
119
  }
106
- async broadcastTransfer(t, a, n) {
120
+ async broadcastTransfer(e, a, n) {
107
121
  return await this.request(
108
- `/${l}/${t}/payment/${a}/transfer/broadcast`,
122
+ `/${c}/${e}/payment/${a}/transfer/broadcast`,
109
123
  {
110
124
  method: "POST",
111
125
  body: JSON.stringify(n)
112
126
  }
113
127
  );
114
128
  }
115
- async cancelCryptoTransaction(t, a) {
129
+ async cancelCryptoTransaction(e, a) {
116
130
  return await this.request(
117
- `/${l}/${t}/cancel`,
131
+ `/${c}/${e}/cancel`,
118
132
  {
119
133
  method: "PATCH",
120
134
  body: JSON.stringify(a)
121
135
  }
122
136
  );
123
137
  }
124
- async kycVerification(t, a) {
138
+ async kycVerification(e, a) {
125
139
  const n = new FormData();
126
- return n.append("asset", a.asset), n.append("network", a.network), W.forEach((o) => {
140
+ return n.append("asset", a.asset), n.append("network", a.network), _.forEach((o) => {
127
141
  const r = a[o];
128
142
  r && n.append(o, r);
129
143
  }), 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(
130
144
  (o, r) => n.append("documentFiles", o, `${r + 1}-${o.name}`)
131
145
  ), await this.requestWithFormData(
132
- `/${l}/${t}/verification`,
146
+ `/${c}/${e}/verification`,
133
147
  {
134
148
  method: "POST",
135
149
  body: n
@@ -137,71 +151,72 @@ class $ extends y {
137
151
  );
138
152
  }
139
153
  }
140
- function M(e, t) {
141
- t.forEach((a) => {
154
+ function Y(t, e) {
155
+ e.forEach((a) => {
142
156
  Object.getOwnPropertyNames(a.prototype).forEach((n) => {
143
157
  const o = Object.getOwnPropertyDescriptor(a.prototype, n);
144
- o && Object.defineProperty(e.prototype, n, o);
158
+ o && Object.defineProperty(t.prototype, n, o);
145
159
  });
146
160
  });
147
161
  }
148
162
  const h = "customer";
149
- class Y extends y {
163
+ class B extends y {
150
164
  // PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
151
- async sendCustomerOTP(t) {
165
+ async sendCustomerOTP(e) {
152
166
  return await this.requestText(`/${h}/otp`, {
153
167
  method: "PATCH",
154
- body: JSON.stringify(t)
168
+ body: JSON.stringify(e)
155
169
  });
156
170
  }
157
171
  // PUT /customer/otp -> { customerUUID, kycValidated }.
158
- async authenticateCustomerOTP(t) {
172
+ async authenticateCustomerOTP(e) {
159
173
  return await this.request(`/${h}/otp`, {
160
174
  method: "PUT",
161
- body: JSON.stringify(t)
175
+ body: JSON.stringify(e)
162
176
  });
163
177
  }
164
- // PUT /customer/pii -> the stored record, masked. Verifies the same code as
165
- // PUT /customer/otp; a code serves both until it expires.
166
- async getCustomerPII(t) {
178
+ // PUT /customer/pii -> the stored record, masked unless the merchant shows it
179
+ // as stored. Verifies the same code as PUT /customer/otp; a code serves both
180
+ // until it expires.
181
+ async getCustomerPII(e) {
167
182
  return await this.request(`/${h}/pii`, {
168
183
  method: "PUT",
169
- body: JSON.stringify(t)
184
+ body: JSON.stringify(e)
170
185
  });
171
186
  }
172
- async updateCustomerPII(t) {
187
+ async updateCustomerPII(e) {
173
188
  return await this.request(`/${h}/pii`, {
174
189
  method: "PATCH",
175
- body: JSON.stringify(t)
190
+ body: JSON.stringify(e)
176
191
  });
177
192
  }
178
193
  }
179
- const _ = "places", x = { "X-User": "lydian" };
180
- class B extends y {
181
- async getCountries(t) {
182
- return await this.request(`/${_}/countries`, {
194
+ const $ = "places", x = { "X-User": "lydian" };
195
+ class q extends y {
196
+ async getCountries(e) {
197
+ return await this.request(`/${$}/countries`, {
183
198
  headers: x,
184
- signal: t
199
+ signal: e
185
200
  });
186
201
  }
187
202
  }
188
203
  const d = "session";
189
- class q extends y {
190
- async createSession(t) {
204
+ class G extends y {
205
+ async createSession(e) {
191
206
  return await this.request(`/${d}`, {
192
207
  method: "POST",
193
- body: JSON.stringify(t)
208
+ body: JSON.stringify(e)
194
209
  });
195
210
  }
196
- async getSession(t) {
197
- return await this.request(`/${d}/${t}`);
211
+ async getSession(e) {
212
+ return await this.request(`/${d}/${e}`);
198
213
  }
199
214
  // Promotes the session into a transaction. Allowed once per session — except
200
215
  // that a KYC-pending (3) response does not consume the promotion, which is
201
216
  // what lets the restore-details flow re-promote with a customerUUID.
202
- async createSessionTransaction(t, a) {
217
+ async createSessionTransaction(e, a) {
203
218
  return await this.request(
204
- `/${d}/${t}/transaction`,
219
+ `/${d}/${e}/transaction`,
205
220
  {
206
221
  method: "POST",
207
222
  body: JSON.stringify(a)
@@ -210,13 +225,13 @@ class q extends y {
210
225
  }
211
226
  // PATCH /session/{id}/cancel replies text/plain (the merchant's cancel URL),
212
227
  // not JSON. Cancelling cascades to the linked transaction, if any.
213
- async cancelSession(t) {
214
- return await this.requestText(`/${d}/${t}/cancel`, {
228
+ async cancelSession(e) {
229
+ return await this.requestText(`/${d}/${e}/cancel`, {
215
230
  method: "PATCH"
216
231
  });
217
232
  }
218
- async sendReceipt(t, a) {
219
- await this.request(`/${d}/${t}/receipt`, {
233
+ async sendReceipt(e, a) {
234
+ await this.request(`/${d}/${e}/receipt`, {
220
235
  method: "POST",
221
236
  body: JSON.stringify(a)
222
237
  });
@@ -224,9 +239,9 @@ class q extends y {
224
239
  }
225
240
  class D extends y {
226
241
  }
227
- M(D, [$, Y, B, q]);
228
- const G = D;
229
- var i = {
242
+ Y(D, [M, B, q, G]);
243
+ const H = D;
244
+ var s = {
230
245
  SINGLE_PAYMENT_REQUIRED: -11,
231
246
  API_CANCELLED: -9,
232
247
  PAYMENT_TIMEOUT: -8,
@@ -244,164 +259,164 @@ var i = {
244
259
  // one promotion — the OTP restore flow re-promotes the same session.
245
260
  KYC_VERIFICATION_PENDING: 3,
246
261
  COMPLIANCE_PENDING: 10
247
- }, H = {
262
+ }, K = {
248
263
  PARTIALLY_PAID: 1,
249
264
  OVERPAID: 3
250
- }, j = {
265
+ }, z = {
251
266
  PENDING: 0,
252
267
  CONFIRMED: 1
253
- }, g = {
268
+ }, w = {
254
269
  dev: "https://api.lydian.dev",
255
270
  sandbox: "https://api.sandbox.lydian.com",
256
271
  prod: "https://api.lydian.com"
257
272
  };
258
- function K(e) {
259
- return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? g.dev : e.sandbox ? g.sandbox : g.prod;
273
+ function j(t) {
274
+ return t.gatewayUrl ? new URL(t.gatewayUrl).origin : t.dev ? w.dev : t.sandbox ? w.sandbox : w.prod;
260
275
  }
261
276
  function S({
262
- options: e,
263
- unsupportedKeys: t,
277
+ options: t,
278
+ unsupportedKeys: e,
264
279
  entryPoint: a
265
280
  }) {
266
- const n = t.filter((o) => e[o] !== void 0);
281
+ const n = e.filter((o) => t[o] !== void 0);
267
282
  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.`;
268
283
  }
269
- function A(e) {
270
- var t;
271
- return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
284
+ function A(t) {
285
+ var e;
286
+ return (e = t.flow) != null && e.walletConnect && !t.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
272
287
  }
273
- function v(e) {
274
- return e.gatewayUrl === void 0 || z(e.gatewayUrl) ? null : `gatewayUrl must be an http(s) origin such as http://localhost:8000, with no path, got ${JSON.stringify(e.gatewayUrl)}`;
288
+ function v(t) {
289
+ return t.gatewayUrl === void 0 || J(t.gatewayUrl) ? null : `gatewayUrl must be an http(s) origin such as http://localhost:8000, with no path, got ${JSON.stringify(t.gatewayUrl)}`;
275
290
  }
276
- function z(e) {
277
- let t;
291
+ function J(t) {
292
+ let e;
278
293
  try {
279
- t = new URL(e);
294
+ e = new URL(t);
280
295
  } catch {
281
296
  return !1;
282
297
  }
283
- return (t.protocol === "http:" || t.protocol === "https:") && t.pathname === "/" && t.search === "" && t.hash === "";
298
+ return (e.protocol === "http:" || e.protocol === "https:") && e.pathname === "/" && e.search === "" && e.hash === "";
284
299
  }
285
- function pe(e) {
286
- return e !== null && !u(e) && !!e.publishableKey;
300
+ function he(t) {
301
+ return t !== null && !u(t) && !!t.publishableKey;
287
302
  }
288
- function he(e) {
289
- return e !== null && !u(e);
303
+ function me(t) {
304
+ return t !== null && !u(t);
290
305
  }
291
- function me({
292
- options: e,
293
- session: t,
306
+ function fe({
307
+ options: t,
308
+ session: e,
294
309
  settled: a
295
310
  }) {
296
- return !a && t !== null && e !== null && u(e);
311
+ return !a && e !== null && t !== null && u(t);
297
312
  }
298
- function I(e, t, a) {
313
+ function I(t, e, a) {
299
314
  try {
300
- e == null || e(t, a);
315
+ t == null || t(e, a);
301
316
  } catch (n) {
302
- console.error(`onEvent("${t}") threw:`, n);
317
+ console.error(`onEvent("${e}") threw:`, n);
303
318
  }
304
319
  }
305
- function m(e) {
306
- if (!e)
320
+ function m(t) {
321
+ if (!t)
307
322
  return;
308
- let t;
323
+ let e;
309
324
  try {
310
- t = new URL(e);
325
+ e = new URL(t);
311
326
  } catch {
312
327
  return;
313
328
  }
314
- return t.protocol === "https:" || t.protocol === "http:" ? e : void 0;
329
+ return e.protocol === "https:" || e.protocol === "http:" ? t : void 0;
315
330
  }
316
- const J = [
317
- i.KYC_VERIFICATION_PENDING,
318
- i.COMPLIANCE_PENDING
331
+ const Q = [
332
+ s.KYC_VERIFICATION_PENDING,
333
+ s.COMPLIANCE_PENDING
319
334
  ];
320
- async function Q({
321
- api: e,
322
- options: t,
335
+ async function V({
336
+ api: t,
337
+ options: e,
323
338
  emit: a
324
339
  }) {
325
340
  try {
326
- const n = await V({ api: e, options: t }), o = await e.getSession(n);
327
- a("session.loaded", Z(o));
328
- const r = await te({
329
- api: e,
341
+ const n = await Z({ api: t, options: e }), o = await t.getSession(n);
342
+ a("session.loaded", ee(o));
343
+ const r = await ae({
344
+ api: t,
330
345
  transactionID: o.transactionID
331
- }), s = ee({ session: o, linkedTransaction: r });
332
- return { ok: !0, session: o, sessionPromoted: s, linkedTransaction: r };
346
+ }), i = te({ session: o, linkedTransaction: r });
347
+ return { ok: !0, session: o, sessionPromoted: i, linkedTransaction: r };
333
348
  } catch (n) {
334
349
  return { ok: !1, ...await X(n) };
335
350
  }
336
351
  }
337
- async function X(e) {
338
- const t = e instanceof Error ? e.cause : void 0;
339
- if (!(t instanceof Response && t.status === 404))
352
+ async function X(t) {
353
+ const e = t instanceof Error ? t.cause : void 0;
354
+ if (!(e instanceof Response && e.status === 404))
340
355
  return {};
341
356
  try {
342
- const n = await t.json();
357
+ const n = await e.json();
343
358
  return {
344
- failureURL: k(n == null ? void 0 : n.failureURL),
345
- cancelURL: k(n == null ? void 0 : n.cancelURL)
359
+ failureURL: P(n == null ? void 0 : n.failureURL),
360
+ cancelURL: P(n == null ? void 0 : n.cancelURL)
346
361
  };
347
362
  } catch {
348
363
  return {};
349
364
  }
350
365
  }
351
- function k(e) {
352
- return typeof e == "string" ? m(e) : void 0;
366
+ function P(t) {
367
+ return typeof t == "string" ? m(t) : void 0;
353
368
  }
354
- async function V({
355
- api: e,
356
- options: t
369
+ async function Z({
370
+ api: t,
371
+ options: e
357
372
  }) {
358
- return u(t) ? t.sessionID : (await e.createSession({
359
- amount: t.transaction.amount,
360
- amountCurrency: t.transaction.currency,
361
- descriptor: t.transaction.descriptor,
362
- referenceNumber: t.transaction.referenceNumber
373
+ return u(e) ? e.sessionID : (await t.createSession({
374
+ amount: e.transaction.amount,
375
+ amountCurrency: e.transaction.currency,
376
+ descriptor: e.transaction.descriptor,
377
+ referenceNumber: e.transaction.referenceNumber
363
378
  })).sessionID;
364
379
  }
365
- function Z(e) {
380
+ function ee(t) {
366
381
  return {
367
- sessionID: e.sessionID,
368
- merchantName: e.merchantName,
369
- alreadyPromoted: N(e)
382
+ sessionID: t.sessionID,
383
+ merchantName: t.merchantName,
384
+ alreadyPromoted: N(t)
370
385
  };
371
386
  }
372
- function N(e) {
373
- return !!e.transactionID;
387
+ function N(t) {
388
+ return !!t.transactionID;
374
389
  }
375
- function ee({
376
- session: e,
377
- linkedTransaction: t
390
+ function te({
391
+ session: t,
392
+ linkedTransaction: e
378
393
  }) {
379
- return N(e) ? t ? !J.includes(t.status) : !0 : !1;
394
+ return N(t) ? e ? !Q.includes(e.status) : !0 : !1;
380
395
  }
381
- async function te({
382
- api: e,
383
- transactionID: t
396
+ async function ae({
397
+ api: t,
398
+ transactionID: e
384
399
  }) {
385
- if (!t)
400
+ if (!e)
386
401
  return null;
387
402
  try {
388
- return await e.getCryptoTransaction(t);
403
+ return await t.getCryptoTransaction(e);
389
404
  } catch (a) {
390
405
  return console.error("Failed to resolve the session transaction:", a), null;
391
406
  }
392
407
  }
393
- function P({
394
- message: e,
395
- reason: t,
408
+ function C({
409
+ message: t,
410
+ reason: e,
396
411
  shouldEndCheckout: a,
397
412
  transactionID: n,
398
413
  session: o
399
414
  }) {
400
415
  return {
401
- event: { reason: t, shouldEndCheckout: a, message: e },
416
+ event: { reason: e, shouldEndCheckout: a, message: t },
402
417
  failure: {
403
418
  shouldEndCheckout: a,
404
- reason: t,
419
+ reason: e,
405
420
  transactionID: n,
406
421
  // Only a failure that ends the checkout carries a redirect. A retryable one
407
422
  // leaves the customer mid-flow with something still to do, and a host that
@@ -410,13 +425,12 @@ function P({
410
425
  }
411
426
  };
412
427
  }
413
- const ae = {
428
+ const ne = {
414
429
  "common.cancelTransaction": "Cancel Transaction",
415
430
  "common.cancel": "Cancel",
416
431
  "common.back": "Back",
417
432
  "common.close": "Close",
418
433
  "common.done": "Done",
419
- "common.continue": "Continue",
420
434
  "common.retry": "Retry",
421
435
  "common.warningAlt": "Warning",
422
436
  "common.checkoutAria": "Checkout",
@@ -474,7 +488,8 @@ const ae = {
474
488
  "network.recommended": "RECOMMENDED",
475
489
  "network.fee": "Network fee: {fee}",
476
490
  "kyc.yourDetails": "Additional info required",
477
- "kyc.basicDetails": "Basic details",
491
+ "kyc.contactInfo": "Contact info",
492
+ "kyc.basicDetails": "Basic info",
478
493
  "kyc.groupTitleOne": "Provide one of the following",
479
494
  "kyc.groupTitle": "Provide {count} of the following",
480
495
  "kyc.groupGuidanceAcrossForm": "Complete {required} of the {total} identity details to continue ({completed} done).",
@@ -501,13 +516,22 @@ const ae = {
501
516
  "kyc.dateOfBirthPlaceholder": "Enter your date of birth",
502
517
  "kyc.dateAndPlaceOfBirthChoice": "Place and date of birth",
503
518
  "kyc.physicalAddressChoice": "Address",
504
- "kyc.notCitizenOf": "I'm not a citizen of {country}",
505
- "kyc.citizenshipLabel": "Country of Citizenship",
519
+ "kyc.citizenOf": "I am a citizen of {country}",
520
+ "kyc.citizenshipLabel": "Country of citizenship",
506
521
  "kyc.citizenshipPlaceholder": "Select country of citizenship",
522
+ "kyc.residenceLabel": "Country of residence",
523
+ "kyc.residencePlaceholder": "Select country of residence",
507
524
  "kyc.cityOfBirthLabel": "City of birth",
508
525
  "kyc.cityOfBirthPlaceholder": "Enter city",
509
526
  "kyc.nationalIdLabel": "ID number",
510
- "kyc.nationalIdPlaceholder": "Enter 16-digit ID number",
527
+ "kyc.nationalIdPlaceholder": "Enter your {documentType} ID",
528
+ "kyc.idDocumentLabel": "ID type",
529
+ "kyc.idDocumentPlaceholder": "Select ID type",
530
+ "kyc.idDocumentPassport": "Passport",
531
+ "kyc.idDocumentSss": "SSS",
532
+ "kyc.idDocumentDriverLicense": "Drivers License",
533
+ "kyc.idDocumentTin": "TIN",
534
+ "kyc.idDocumentOther": "Other",
511
535
  "kyc.nationalIdChoice": "National ID number",
512
536
  "kyc.customerIdLabel": "Customer identification number",
513
537
  "kyc.customerIdPlaceholder": "Enter customer ID number",
@@ -522,6 +546,7 @@ const ae = {
522
546
  "kyc.fileHint": "PNG, JPG or PDF, up to 10 MB",
523
547
  "kyc.saveInfo": "Securely save this info for next time",
524
548
  "kyc.saveInfoDescription": "Next time, skip this step by entering the one-time code sent to your email.",
549
+ "kyc.next": "Next",
525
550
  "kyc.onFileHint": "Details we have on file are shown masked. Select a field to replace it.",
526
551
  "scan.exactAmountNotice": "Make sure you send the exact amount on the correct network to complete your payment smoothly.",
527
552
  "scan.scanWithWallet": "Scan the QR code with your preferred wallet",
@@ -618,6 +643,12 @@ const ae = {
618
643
  "restore.unableToSendOtpTitle": "Unable to send OTP",
619
644
  "restore.unableToSendOtpBody": "Check your email and try again.",
620
645
  "restore.unableToVerifyCode": "Unable to verify code.",
646
+ "emailVerification.sendOtp": "Send OTP",
647
+ "emailVerification.verifyHeading": "Verify it’s you",
648
+ "emailVerification.codePrompt": "Please enter the 6 digit code that we sent to",
649
+ "emailVerification.codeLabel": "OTP",
650
+ "emailVerification.codePlaceholder": "Enter 6 digit code",
651
+ "emailVerification.verifiedHeading": "Verified info",
621
652
  "modal.areYouSure": "Are you sure?",
622
653
  "modal.closeDescription": "Are you sure you want to cancel this payment? If you continue, you will lose any progress you have made.",
623
654
  "modal.approvedInWalletNote": "If you already approved in your wallet, the transaction is on-chain — cancelling here only stops this page from waiting.",
@@ -660,47 +691,48 @@ const ae = {
660
691
  "validation.emailOrCountryMissing": "Email or country is missing.",
661
692
  "validation.invalidEmail": "Please enter a valid email address.",
662
693
  "validation.invalidDateOfBirth": "Please enter a valid date of birth.",
694
+ "validation.invalidIdNumber": "Please enter an ID number of {min} to {max} characters.",
663
695
  "validation.reenterFullAddress": "Enter your full new address.",
664
696
  "validation.customerDetailsMissing": "Customer details are missing.",
665
697
  "validation.invalidOtp": "Please enter a valid 6-digit code.",
666
698
  "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>.'
667
- }, T = { en: ae }, R = "en";
668
- let L = R;
669
- function fe() {
670
- return L;
699
+ }, T = { en: ne }, L = "en";
700
+ let R = L;
701
+ function we() {
702
+ return R;
671
703
  }
672
- function f(e, t) {
704
+ function f(t, e) {
673
705
  var n;
674
- const a = ((n = T[L]) == null ? void 0 : n[e]) ?? T[R][e] ?? e;
675
- return t ? a.replace(
706
+ const a = ((n = T[R]) == null ? void 0 : n[t]) ?? T[L][t] ?? t;
707
+ return e ? a.replace(
676
708
  /\{(\w+)\}/g,
677
- (o, r) => t[r] != null ? String(t[r]) : `{${r}}`
709
+ (o, r) => e[r] != null ? String(e[r]) : `{${r}}`
678
710
  ) : a;
679
711
  }
680
- const ne = /* @__PURE__ */ new Set([
681
- i.SINGLE_PAYMENT_REQUIRED,
682
- i.API_CANCELLED,
683
- i.PAYMENT_TIMEOUT,
684
- i.FRAUD_DECLINED,
685
- i.FRAUD_REFUNDED,
686
- i.FRAUD_HELD,
687
- i.FORFEITED,
688
- i.CANCELLED,
689
- i.FRAUD
712
+ const oe = /* @__PURE__ */ new Set([
713
+ s.SINGLE_PAYMENT_REQUIRED,
714
+ s.API_CANCELLED,
715
+ s.PAYMENT_TIMEOUT,
716
+ s.FRAUD_DECLINED,
717
+ s.FRAUD_REFUNDED,
718
+ s.FRAUD_HELD,
719
+ s.FORFEITED,
720
+ s.CANCELLED,
721
+ s.FRAUD
690
722
  ]);
691
- function oe(e) {
692
- return e === i.SUCCESS ? "succeeded" : ne.has(e) ? "failed" : "active";
723
+ function re(t) {
724
+ return t === s.SUCCESS ? "succeeded" : oe.has(t) ? "failed" : "active";
693
725
  }
694
- function re({
695
- transaction: e,
696
- session: t
726
+ function se({
727
+ transaction: t,
728
+ session: e
697
729
  }) {
698
- var o, r, s;
699
- const a = oe(e.status);
730
+ var o, r, i;
731
+ const a = re(t.status);
700
732
  if (a === "active")
701
733
  return null;
702
734
  if (a === "failed") {
703
- const p = e.status === i.PAYMENT_TIMEOUT && e.paymentStatus === H.PARTIALLY_PAID || e.status === i.SINGLE_PAYMENT_REQUIRED;
735
+ const p = t.status === s.PAYMENT_TIMEOUT && t.paymentStatus === K.PARTIALLY_PAID || t.status === s.SINGLE_PAYMENT_REQUIRED;
704
736
  return {
705
737
  outcome: a,
706
738
  message: f(p ? "errors.paymentShortRefundRequested" : "errors.paymentCouldNotComplete"),
@@ -708,54 +740,54 @@ function re({
708
740
  shouldEndCheckout: !0,
709
741
  // Negative (non-KYC) status — cancelled / fraud / timeout.
710
742
  reason: "blocked",
711
- transactionID: e.transactionID,
712
- redirectURL: m(t == null ? void 0 : t.failureURL)
743
+ transactionID: t.transactionID,
744
+ redirectURL: m(e == null ? void 0 : e.failureURL)
713
745
  }
714
746
  };
715
747
  }
716
- const n = (o = e.payments) == null ? void 0 : o.find(
717
- (c) => c.status === j.CONFIRMED
748
+ const n = (o = t.payments) == null ? void 0 : o.find(
749
+ (l) => l.status === z.CONFIRMED
718
750
  );
719
751
  return {
720
752
  outcome: a,
721
753
  event: {
722
- transactionID: e.transactionID,
754
+ transactionID: t.transactionID,
723
755
  asset: n == null ? void 0 : n.cryptoAsset,
724
756
  network: n == null ? void 0 : n.cryptoNetwork
725
757
  },
726
758
  result: {
727
- transactionID: e.transactionID,
728
- amount: (r = e.amounts) == null ? void 0 : r.totalLocal,
729
- currency: (s = e.amounts) == null ? void 0 : s.currency,
759
+ transactionID: t.transactionID,
760
+ amount: (r = t.amounts) == null ? void 0 : r.totalLocal,
761
+ currency: (i = t.amounts) == null ? void 0 : i.currency,
730
762
  asset: n == null ? void 0 : n.cryptoAsset,
731
763
  network: n == null ? void 0 : n.cryptoNetwork,
732
764
  completedAt: n == null ? void 0 : n.completedAt,
733
- redirectURL: m(t == null ? void 0 : t.successURL)
765
+ redirectURL: m(e == null ? void 0 : e.successURL)
734
766
  }
735
767
  };
736
768
  }
737
- function se() {
738
- let e = null;
769
+ function ie() {
770
+ let t = null;
739
771
  return {
740
- setOptions: (t) => {
741
- e = t;
772
+ setOptions: (e) => {
773
+ t = e;
742
774
  },
743
- emit: (t, a) => I(e == null ? void 0 : e.onEvent, t, a),
744
- paymentFailed: (t, a) => {
775
+ emit: (e, a) => I(t == null ? void 0 : t.onEvent, e, a),
776
+ paymentFailed: (e, a) => {
745
777
  var n;
746
- return (n = e == null ? void 0 : e.paymentFailedListener) == null ? void 0 : n.call(e, t, a);
778
+ return (n = t == null ? void 0 : t.paymentFailedListener) == null ? void 0 : n.call(t, e, a);
747
779
  },
748
- paymentSucceeded: (t) => {
780
+ paymentSucceeded: (e) => {
749
781
  var a;
750
- return (a = e == null ? void 0 : e.paymentSuccessListener) == null ? void 0 : a.call(e, t);
782
+ return (a = t == null ? void 0 : t.paymentSuccessListener) == null ? void 0 : a.call(t, e);
751
783
  },
752
- paymentCanceled: (t) => {
784
+ paymentCanceled: (e) => {
753
785
  var a;
754
- return (a = e == null ? void 0 : e.paymentCanceledListener) == null ? void 0 : a.call(e, t);
786
+ return (a = t == null ? void 0 : t.paymentCanceledListener) == null ? void 0 : a.call(t, e);
755
787
  }
756
788
  };
757
789
  }
758
- class ie extends HTMLElement {
790
+ class ce extends HTMLElement {
759
791
  constructor() {
760
792
  super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
761
793
  }
@@ -764,26 +796,26 @@ class ie extends HTMLElement {
764
796
  connectedCallback() {
765
797
  this.isTornDown = !1;
766
798
  }
767
- async initialize(t) {
768
- const a = ce(t), n = le({ api: a, options: t }), o = await this.loadEngine(t, n);
769
- !o || this.isTornDown || (this.engine = o, await o.initialize(t, { api: a, sessionLoad: n }));
799
+ async initialize(e) {
800
+ const a = le(e), n = de({ api: a, options: e }), o = await this.loadEngine(e, n);
801
+ !o || this.isTornDown || (this.engine = o, await o.initialize(e, { api: a, sessionLoad: n }));
770
802
  }
771
- async loadEngine(t, a) {
803
+ async loadEngine(e, a) {
772
804
  const n = this.getOrLoadEngine();
773
805
  try {
774
806
  return await n;
775
807
  } catch {
776
808
  return await this.handleEngineLoadFailure({
777
809
  engineLoad: n,
778
- options: t,
810
+ options: e,
779
811
  sessionLoad: a
780
812
  }), null;
781
813
  }
782
814
  }
783
- async updateTransaction(t) {
815
+ async updateTransaction(e) {
784
816
  if (!this.engine)
785
817
  throw new Error("Tether Pay not initialized.");
786
- await this.engine.updateTransaction(t);
818
+ await this.engine.updateTransaction(e);
787
819
  }
788
820
  // A merchant SPA can unmount the element at any time; nothing else stops this
789
821
  // instance's timers.
@@ -793,8 +825,8 @@ class ie extends HTMLElement {
793
825
  // Not started in the constructor: a page can carry the tag and never check out.
794
826
  // Overlapping initialize() calls share one download.
795
827
  getOrLoadEngine() {
796
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-_G66fuAB.js").then((t) => t.m).then((t) => {
797
- const a = t.mountCheckoutEngine({
828
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-CjLQCm5Y.js").then((e) => e.m).then((e) => {
829
+ const a = e.mountCheckoutEngine({
798
830
  host: this,
799
831
  shadowRoot: this.shadow
800
832
  });
@@ -802,11 +834,11 @@ class ie extends HTMLElement {
802
834
  })), this.engineLoadPromise;
803
835
  }
804
836
  async handleEngineLoadFailure({
805
- engineLoad: t,
837
+ engineLoad: e,
806
838
  options: a,
807
839
  sessionLoad: n
808
840
  }) {
809
- this.engineLoadPromise === t && (this.engineLoadPromise = null, await this.reportEngineFailure({ options: a, sessionLoad: n }));
841
+ this.engineLoadPromise === e && (this.engineLoadPromise = null, await this.reportEngineFailure({ options: a, sessionLoad: n }));
810
842
  }
811
843
  // A host that removed the element has walked away; a failure report could send
812
844
  // it to a failureURL for a checkout it dismissed.
@@ -818,7 +850,7 @@ class ie extends HTMLElement {
818
850
  // an outcome the gateway has already decided — a session resumed after the
819
851
  // payment settled must report that payment, not a dead checkout.
820
852
  async reportEngineFailure({
821
- options: t,
853
+ options: e,
822
854
  sessionLoad: a
823
855
  }) {
824
856
  if (this.isDismissedByHost)
@@ -826,9 +858,9 @@ class ie extends HTMLElement {
826
858
  const n = await a;
827
859
  if (this.isDismissedByHost)
828
860
  return;
829
- const o = se();
830
- o.setOptions(t);
831
- const r = n.ok && n.linkedTransaction ? re({
861
+ const o = ie();
862
+ o.setOptions(e);
863
+ const r = n.ok && n.linkedTransaction ? se({
832
864
  transaction: n.linkedTransaction,
833
865
  session: n.session
834
866
  }) : null;
@@ -849,112 +881,112 @@ class ie extends HTMLElement {
849
881
  return;
850
882
  }
851
883
  if (!n.ok && n.failureURL) {
852
- const p = f("errors.unableToCreateSession"), C = P({
884
+ const p = f("errors.unableToCreateSession"), b = C({
853
885
  message: p,
854
886
  reason: "sessionExpired",
855
887
  shouldEndCheckout: !0,
856
888
  session: { failureURL: n.failureURL }
857
889
  });
858
- o.emit("payment.failed", C.event), o.paymentFailed(p, C.failure);
890
+ o.emit("payment.failed", b.event), o.paymentFailed(p, b.failure);
859
891
  return;
860
892
  }
861
- const s = f("errors.checkoutUnavailable"), c = P({
862
- message: s,
893
+ const i = f("errors.checkoutUnavailable"), l = C({
894
+ message: i,
863
895
  reason: "error",
864
896
  shouldEndCheckout: !0,
865
897
  session: n.ok ? n.session : null
866
898
  });
867
- o.emit("payment.failed", c.event), o.paymentFailed(s, c.failure);
899
+ o.emit("payment.failed", l.event), o.paymentFailed(i, l.failure);
868
900
  }
869
901
  // Always teardown and unmount together to avoid leaking the React engine.
870
902
  // Clear the cached load so a later initialize() creates a fresh engine.
871
- releaseEngine(t = this.engine) {
872
- t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
903
+ releaseEngine(e = this.engine) {
904
+ e == null || e.teardown(), e == null || e.unmount(), this.engine = null, this.engineLoadPromise = null;
873
905
  }
874
906
  }
875
- function ce(e) {
876
- return new G(
877
- K(e),
878
- u(e) ? void 0 : e.publishableKey
907
+ function le(t) {
908
+ return new H(
909
+ j(t),
910
+ u(t) ? void 0 : t.publishableKey
879
911
  );
880
912
  }
881
- function le({
882
- api: e,
883
- options: t
913
+ function de({
914
+ api: t,
915
+ options: e
884
916
  }) {
885
- return Q({
886
- api: e,
887
- options: t,
888
- emit: (a, n) => I(t.onEvent, a, n)
917
+ return V({
918
+ api: t,
919
+ options: e,
920
+ emit: (a, n) => I(e.onEvent, a, n)
889
921
  });
890
922
  }
891
- customElements.get("lydian-checkout") || customElements.define("lydian-checkout", ie);
892
- function b() {
923
+ customElements.get("lydian-checkout") || customElements.define("lydian-checkout", ce);
924
+ function g() {
893
925
  return document.querySelector("lydian-checkout");
894
926
  }
895
- async function de(e) {
896
- if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
927
+ async function ue(t) {
928
+ if (!t.publishableKey || !t.transaction.amount || !t.transaction.currency)
897
929
  throw new Error("SDK initialization requires publishableKey and a transaction");
898
- const t = A(e);
899
- if (t)
900
- throw new Error(t);
901
- const a = v(e);
930
+ const e = A(t);
931
+ if (e)
932
+ throw new Error(e);
933
+ const a = v(t);
902
934
  if (a)
903
935
  throw new Error(a);
904
- if (!U(e.transaction.currency))
936
+ if (!U(t.transaction.currency))
905
937
  throw new Error("Invalid value for currency, valid values are: " + E.join(", "));
906
938
  const n = S({
907
- options: e,
939
+ options: t,
908
940
  unsupportedKeys: ["sessionID"],
909
941
  entryPoint: "init"
910
942
  });
911
943
  if (n)
912
944
  throw new Error(n);
913
- await b().initialize(e);
945
+ await g().initialize(t);
914
946
  }
915
- async function ue(e) {
916
- if (!e.sessionID)
947
+ async function ye(t) {
948
+ if (!t.sessionID)
917
949
  throw new Error("initExistingSession requires a sessionID");
918
- const t = A(e);
919
- if (t)
920
- throw new Error(t);
921
- const a = v(e);
950
+ const e = A(t);
951
+ if (e)
952
+ throw new Error(e);
953
+ const a = v(t);
922
954
  if (a)
923
955
  throw new Error(a);
924
956
  const n = S({
925
- options: e,
957
+ options: t,
926
958
  unsupportedKeys: ["publishableKey", "transaction"],
927
959
  entryPoint: "initExistingSession"
928
960
  });
929
961
  if (n)
930
962
  throw new Error(n);
931
- await b().initialize(e);
963
+ await g().initialize(t);
932
964
  }
933
- async function ye(e) {
934
- await b().updateTransaction(e);
965
+ async function pe(t) {
966
+ await g().updateTransaction(t);
935
967
  }
936
- window.Lydian = { init: de, initExistingSession: ue, updateTransaction: ye };
968
+ window.Lydian = { init: ue, initExistingSession: ye, updateTransaction: pe };
937
969
  export {
938
970
  O as G,
939
- H as P,
940
- i as T,
941
- j as a,
942
- he as b,
971
+ K as P,
972
+ s as T,
973
+ z as a,
974
+ me as b,
943
975
  E as c,
944
- Z as d,
945
- ee as e,
946
- te as f,
947
- fe as g,
976
+ ee as d,
977
+ te as e,
978
+ ae as f,
979
+ we as g,
948
980
  u as h,
949
981
  U as i,
950
- oe as j,
951
- re as k,
982
+ re as j,
983
+ se as k,
952
984
  N as l,
953
- me as m,
954
- P as n,
955
- pe as o,
956
- se as p,
957
- V as r,
985
+ fe as m,
986
+ C as n,
987
+ he as o,
988
+ ie as p,
989
+ Z as r,
958
990
  m as s,
959
991
  f as t
960
992
  };