@lydianpay/sdk-web 3.17.1 → 3.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{browser-D-wITOYv.js → browser-BUlIfLHb.js} +1 -1
- package/dist/chunks/{connect-multichain-BhbBjXAb.js → connect-multichain-DVWN1OPV.js} +9 -9
- package/dist/chunks/{index-BtfXd3M2.js → dist-DXXffMpA.js} +3 -3
- package/dist/chunks/{index-C7spYyCi.js → dist-GH_eP8Tg.js} +3 -4
- package/dist/chunks/{index-DynJfu9S.js → index-BMzgW9kD.js} +191 -160
- package/dist/chunks/{index-DPMWeBay.js → index-CwXeUlav.js} +1 -1
- package/dist/chunks/{index-DtsHVAzb.js → index-Cxvsb1M_.js} +2 -2
- package/dist/chunks/{index-CwLxCtBs.js → index-aLCprMse.js} +1 -1
- package/dist/chunks/{mountEngine-Dv4yxjrJ.js → mountEngine-C_tda95f.js} +12604 -11528
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/network/base.d.ts +3 -1
- package/dist/types/network/index.d.ts +2 -1
- package/dist/types/network/places/index.d.ts +6 -0
- package/dist/types/types.d.ts +25 -0
- package/dist/types/ui/components/googleMapsLogo.d.ts +1 -0
- package/dist/types/ui/countries.d.ts +1 -0
- package/dist/types/ui/kycPlaceAddress.d.ts +11 -0
- package/dist/types/ui/kycValidation.d.ts +21 -3
- package/dist/types/ui/react/AddressSearch/AddressSearch.d.ts +3 -0
- package/dist/types/ui/react/AddressSearch/AddressSearch.helpers.d.ts +21 -0
- package/dist/types/ui/react/AddressSearch/useAddressSearch.d.ts +21 -0
- package/dist/types/ui/react/KycFieldGroupCard.d.ts +6 -0
- package/dist/types/ui/react/KycFields.d.ts +10 -6
- package/dist/types/ui/react/RadioField.d.ts +8 -0
- package/dist/types/ui/react/checkoutStore.d.ts +9 -0
- package/package.json +11 -6
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
return typeof e == "string" &&
|
|
1
|
+
const v = ["USD", "TRY", "PHP"];
|
|
2
|
+
function F(e) {
|
|
3
|
+
return typeof e == "string" && v.includes(e);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function d(e) {
|
|
6
6
|
return "sessionID" in e && typeof e.sessionID == "string" && e.sessionID.length > 0;
|
|
7
7
|
}
|
|
8
|
-
class
|
|
8
|
+
class W extends Error {
|
|
9
9
|
constructor({
|
|
10
10
|
statusText: t,
|
|
11
11
|
errorCode: a,
|
|
@@ -14,19 +14,19 @@ class O extends Error {
|
|
|
14
14
|
super(t, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
17
|
+
async function p(e) {
|
|
18
18
|
const t = await e.clone().json().catch(() => null);
|
|
19
|
-
return new
|
|
19
|
+
return new W({
|
|
20
20
|
statusText: e.statusText,
|
|
21
|
-
errorCode:
|
|
21
|
+
errorCode: $(t),
|
|
22
22
|
response: e
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function $(e) {
|
|
26
26
|
if (!(typeof e != "object" || e === null || !("errorCode" in e)))
|
|
27
27
|
return typeof e.errorCode == "number" ? e.errorCode : void 0;
|
|
28
28
|
}
|
|
29
|
-
class
|
|
29
|
+
class u {
|
|
30
30
|
// Optional: a caller-supplied session has no key and needs none (see Sessions).
|
|
31
31
|
// The key is still required when the SDK creates the session, enforced in
|
|
32
32
|
// index.ts where that is known.
|
|
@@ -41,28 +41,28 @@ class p {
|
|
|
41
41
|
return this.publishableKey && (a["X-Publishable-Key"] = this.publishableKey), a;
|
|
42
42
|
}
|
|
43
43
|
async request(t, a) {
|
|
44
|
-
const n = `${this.baseUri}${t}`,
|
|
44
|
+
const n = `${this.baseUri}${t}`, r = this.headers({ "Content-Type": "application/json", ...a == null ? void 0 : a.headers }), o = Object.assign({}, a, { headers: r }), s = await fetch(n, o);
|
|
45
45
|
if (s.ok)
|
|
46
46
|
return await s.json();
|
|
47
|
-
throw await
|
|
47
|
+
throw await p(s);
|
|
48
48
|
}
|
|
49
49
|
// For endpoints that reply text/plain rather than JSON (e.g. PATCH
|
|
50
50
|
// /customer/otp -> "OTP sent"). Sends the same JSON request headers but does
|
|
51
51
|
// not call response.json(), which would throw on a non-JSON body.
|
|
52
52
|
async requestText(t, a) {
|
|
53
|
-
const n = `${this.baseUri}${t}`,
|
|
53
|
+
const n = `${this.baseUri}${t}`, r = this.headers({ "Content-Type": "application/json" }), o = Object.assign({}, a, { headers: r }), s = await fetch(n, o);
|
|
54
54
|
if (s.ok)
|
|
55
55
|
return await s.text();
|
|
56
|
-
throw await
|
|
56
|
+
throw await p(s);
|
|
57
57
|
}
|
|
58
58
|
async requestWithFormData(t, a) {
|
|
59
|
-
const n = `${this.baseUri}${t}`,
|
|
59
|
+
const n = `${this.baseUri}${t}`, r = this.headers(), o = Object.assign({}, a, { headers: r }), s = await fetch(n, o);
|
|
60
60
|
if (s.ok)
|
|
61
61
|
return await s.json();
|
|
62
|
-
throw await
|
|
62
|
+
throw await p(s);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
const c = "transaction",
|
|
65
|
+
const c = "transaction", B = [
|
|
66
66
|
"firstName",
|
|
67
67
|
"lastName",
|
|
68
68
|
"email",
|
|
@@ -80,7 +80,7 @@ const c = "transaction", W = [
|
|
|
80
80
|
"nationalIDNumber",
|
|
81
81
|
"customerIDNumber"
|
|
82
82
|
];
|
|
83
|
-
class
|
|
83
|
+
class x extends u {
|
|
84
84
|
async getCryptoTransaction(t) {
|
|
85
85
|
return await this.request(`/${c}/${t}`);
|
|
86
86
|
}
|
|
@@ -122,11 +122,11 @@ class $ extends p {
|
|
|
122
122
|
}
|
|
123
123
|
async kycVerification(t, a) {
|
|
124
124
|
const n = new FormData();
|
|
125
|
-
return n.append("asset", a.asset), n.append("network", a.network),
|
|
126
|
-
const
|
|
127
|
-
|
|
125
|
+
return n.append("asset", a.asset), n.append("network", a.network), B.forEach((r) => {
|
|
126
|
+
const o = a[r];
|
|
127
|
+
o && n.append(r, o);
|
|
128
128
|
}), 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(
|
|
129
|
-
(
|
|
129
|
+
(r, o) => n.append("documentFiles", r, `${o + 1}-${r.name}`)
|
|
130
130
|
), await this.requestWithFormData(
|
|
131
131
|
`/${c}/${t}/verification`,
|
|
132
132
|
{
|
|
@@ -139,30 +139,47 @@ class $ extends p {
|
|
|
139
139
|
function Y(e, t) {
|
|
140
140
|
t.forEach((a) => {
|
|
141
141
|
Object.getOwnPropertyNames(a.prototype).forEach((n) => {
|
|
142
|
-
const
|
|
143
|
-
|
|
142
|
+
const r = Object.getOwnPropertyDescriptor(a.prototype, n);
|
|
143
|
+
r && Object.defineProperty(e.prototype, n, r);
|
|
144
144
|
});
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
const
|
|
148
|
-
class
|
|
147
|
+
const k = "customer/otp";
|
|
148
|
+
class M extends u {
|
|
149
149
|
// PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
|
|
150
150
|
async sendCustomerOTP(t) {
|
|
151
|
-
return await this.requestText(`/${
|
|
151
|
+
return await this.requestText(`/${k}`, {
|
|
152
152
|
method: "PATCH",
|
|
153
153
|
body: JSON.stringify(t)
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
// PUT /customer/otp -> { customerUUID, kycValidated }.
|
|
157
157
|
async authenticateCustomerOTP(t) {
|
|
158
|
-
return await this.request(`/${
|
|
158
|
+
return await this.request(`/${k}`, {
|
|
159
159
|
method: "PUT",
|
|
160
160
|
body: JSON.stringify(t)
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
const C = "places", P = { "X-User": "lydian" };
|
|
165
|
+
class G extends u {
|
|
166
|
+
async autocompleteAddress(t, a) {
|
|
167
|
+
return await this.request(`/${C}/autocomplete`, {
|
|
168
|
+
method: "POST",
|
|
169
|
+
headers: P,
|
|
170
|
+
body: JSON.stringify({ input: t }),
|
|
171
|
+
signal: a
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
async getPlaceDetails(t, a) {
|
|
175
|
+
return await this.request(
|
|
176
|
+
`/${C}/details?placeid=${encodeURIComponent(t)}`,
|
|
177
|
+
{ headers: P, signal: a }
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
164
181
|
const l = "session";
|
|
165
|
-
class
|
|
182
|
+
class _ extends u {
|
|
166
183
|
async createSession(t) {
|
|
167
184
|
return await this.request(`/${l}`, {
|
|
168
185
|
method: "POST",
|
|
@@ -198,11 +215,11 @@ class B extends p {
|
|
|
198
215
|
});
|
|
199
216
|
}
|
|
200
217
|
}
|
|
201
|
-
class
|
|
218
|
+
class D extends u {
|
|
202
219
|
}
|
|
203
|
-
Y(
|
|
204
|
-
const
|
|
205
|
-
var
|
|
220
|
+
Y(D, [x, M, G, _]);
|
|
221
|
+
const q = D;
|
|
222
|
+
var y = {
|
|
206
223
|
COMPLIANCE_PENDING: -10,
|
|
207
224
|
API_CANCELLED: -9,
|
|
208
225
|
PAYMENT_TIMEOUT: -8,
|
|
@@ -219,10 +236,10 @@ var d = {
|
|
|
219
236
|
FRAUD: -1,
|
|
220
237
|
PENDING: 0,
|
|
221
238
|
SUCCESS: 1
|
|
222
|
-
},
|
|
239
|
+
}, de = {
|
|
223
240
|
PARTIALLY_PAID: 1,
|
|
224
241
|
OVERPAID: 3
|
|
225
|
-
},
|
|
242
|
+
}, K = {
|
|
226
243
|
PENDING: 0,
|
|
227
244
|
CONFIRMED: 1
|
|
228
245
|
}, m = {
|
|
@@ -230,25 +247,25 @@ var d = {
|
|
|
230
247
|
sandbox: "https://api.sandbox.lydian.com",
|
|
231
248
|
prod: "https://api.lydian.com"
|
|
232
249
|
};
|
|
233
|
-
function
|
|
250
|
+
function j(e) {
|
|
234
251
|
return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? m.dev : e.sandbox ? m.sandbox : m.prod;
|
|
235
252
|
}
|
|
236
|
-
function
|
|
253
|
+
function A({
|
|
237
254
|
options: e,
|
|
238
255
|
unsupportedKeys: t,
|
|
239
256
|
entryPoint: a
|
|
240
257
|
}) {
|
|
241
|
-
const n = t.filter((
|
|
258
|
+
const n = t.filter((r) => e[r] !== void 0);
|
|
242
259
|
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.`;
|
|
243
260
|
}
|
|
244
|
-
function
|
|
261
|
+
function N(e) {
|
|
245
262
|
var t;
|
|
246
263
|
return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
|
|
247
264
|
}
|
|
248
|
-
function
|
|
249
|
-
return e.gatewayUrl === void 0 ||
|
|
265
|
+
function I(e) {
|
|
266
|
+
return e.gatewayUrl === void 0 || H(e.gatewayUrl) ? null : `gatewayUrl must be an http(s) origin such as http://localhost:8000, with no path, got ${JSON.stringify(e.gatewayUrl)}`;
|
|
250
267
|
}
|
|
251
|
-
function
|
|
268
|
+
function H(e) {
|
|
252
269
|
let t;
|
|
253
270
|
try {
|
|
254
271
|
t = new URL(e);
|
|
@@ -257,27 +274,27 @@ function q(e) {
|
|
|
257
274
|
}
|
|
258
275
|
return (t.protocol === "http:" || t.protocol === "https:") && t.pathname === "/" && t.search === "" && t.hash === "";
|
|
259
276
|
}
|
|
260
|
-
function
|
|
261
|
-
return e !== null && !
|
|
277
|
+
function ue(e) {
|
|
278
|
+
return e !== null && !d(e) && !!e.publishableKey;
|
|
262
279
|
}
|
|
263
|
-
function
|
|
264
|
-
return e !== null && !
|
|
280
|
+
function ye(e) {
|
|
281
|
+
return e !== null && !d(e);
|
|
265
282
|
}
|
|
266
|
-
function
|
|
283
|
+
function he({
|
|
267
284
|
options: e,
|
|
268
285
|
session: t,
|
|
269
286
|
settled: a
|
|
270
287
|
}) {
|
|
271
|
-
return !a && t !== null && e !== null &&
|
|
288
|
+
return !a && t !== null && e !== null && d(e);
|
|
272
289
|
}
|
|
273
|
-
function
|
|
290
|
+
function L(e, t, a) {
|
|
274
291
|
try {
|
|
275
292
|
e == null || e(t, a);
|
|
276
293
|
} catch (n) {
|
|
277
294
|
console.error(`onEvent("${t}") threw:`, n);
|
|
278
295
|
}
|
|
279
296
|
}
|
|
280
|
-
function
|
|
297
|
+
function h(e) {
|
|
281
298
|
if (!e)
|
|
282
299
|
return;
|
|
283
300
|
let t;
|
|
@@ -288,69 +305,69 @@ function y(e) {
|
|
|
288
305
|
}
|
|
289
306
|
return t.protocol === "https:" || t.protocol === "http:" ? e : void 0;
|
|
290
307
|
}
|
|
291
|
-
async function
|
|
308
|
+
async function z({
|
|
292
309
|
api: e,
|
|
293
310
|
options: t,
|
|
294
311
|
emit: a
|
|
295
312
|
}) {
|
|
296
313
|
try {
|
|
297
|
-
const n = await
|
|
298
|
-
a("session.loaded",
|
|
299
|
-
const s = await
|
|
314
|
+
const n = await Q({ api: e, options: t }), { session: r, sessionPromoted: o } = await X({ api: e, sessionID: n });
|
|
315
|
+
a("session.loaded", Z(r));
|
|
316
|
+
const s = await V({
|
|
300
317
|
api: e,
|
|
301
|
-
transactionID:
|
|
318
|
+
transactionID: r.transactionID
|
|
302
319
|
});
|
|
303
|
-
return { ok: !0, session:
|
|
320
|
+
return { ok: !0, session: r, sessionPromoted: o, linkedTransaction: s };
|
|
304
321
|
} catch (n) {
|
|
305
|
-
return { ok: !1, ...await
|
|
322
|
+
return { ok: !1, ...await J(n) };
|
|
306
323
|
}
|
|
307
324
|
}
|
|
308
|
-
async function
|
|
325
|
+
async function J(e) {
|
|
309
326
|
const t = e instanceof Error ? e.cause : void 0;
|
|
310
327
|
if (!(t instanceof Response && t.status === 404))
|
|
311
328
|
return {};
|
|
312
329
|
try {
|
|
313
330
|
const n = await t.json();
|
|
314
331
|
return {
|
|
315
|
-
failureURL:
|
|
316
|
-
cancelURL:
|
|
332
|
+
failureURL: T(n == null ? void 0 : n.failureURL),
|
|
333
|
+
cancelURL: T(n == null ? void 0 : n.cancelURL)
|
|
317
334
|
};
|
|
318
335
|
} catch {
|
|
319
336
|
return {};
|
|
320
337
|
}
|
|
321
338
|
}
|
|
322
|
-
function
|
|
323
|
-
return typeof e == "string" ?
|
|
339
|
+
function T(e) {
|
|
340
|
+
return typeof e == "string" ? h(e) : void 0;
|
|
324
341
|
}
|
|
325
|
-
async function
|
|
342
|
+
async function Q({
|
|
326
343
|
api: e,
|
|
327
344
|
options: t
|
|
328
345
|
}) {
|
|
329
|
-
return
|
|
346
|
+
return d(t) ? t.sessionID : (await e.createSession({
|
|
330
347
|
amount: t.transaction.amount,
|
|
331
348
|
amountCurrency: t.transaction.currency,
|
|
332
349
|
descriptor: t.transaction.descriptor,
|
|
333
350
|
referenceNumber: t.transaction.referenceNumber
|
|
334
351
|
})).sessionID;
|
|
335
352
|
}
|
|
336
|
-
async function
|
|
353
|
+
async function X({
|
|
337
354
|
api: e,
|
|
338
355
|
sessionID: t
|
|
339
356
|
}) {
|
|
340
357
|
const a = await e.getSession(t);
|
|
341
|
-
return { session: a, sessionPromoted:
|
|
358
|
+
return { session: a, sessionPromoted: R(a) };
|
|
342
359
|
}
|
|
343
|
-
function
|
|
360
|
+
function Z(e) {
|
|
344
361
|
return {
|
|
345
362
|
sessionID: e.sessionID,
|
|
346
363
|
merchantName: e.merchantName,
|
|
347
|
-
alreadyPromoted:
|
|
364
|
+
alreadyPromoted: R(e)
|
|
348
365
|
};
|
|
349
366
|
}
|
|
350
|
-
function
|
|
367
|
+
function R(e) {
|
|
351
368
|
return !!e.transactionID;
|
|
352
369
|
}
|
|
353
|
-
async function
|
|
370
|
+
async function V({
|
|
354
371
|
api: e,
|
|
355
372
|
transactionID: t
|
|
356
373
|
}) {
|
|
@@ -362,12 +379,12 @@ async function Q({
|
|
|
362
379
|
return console.error("Failed to resolve the session transaction:", a), null;
|
|
363
380
|
}
|
|
364
381
|
}
|
|
365
|
-
function
|
|
382
|
+
function S({
|
|
366
383
|
message: e,
|
|
367
384
|
reason: t,
|
|
368
385
|
shouldEndCheckout: a,
|
|
369
386
|
transactionID: n,
|
|
370
|
-
session:
|
|
387
|
+
session: r
|
|
371
388
|
}) {
|
|
372
389
|
return {
|
|
373
390
|
event: { reason: t, shouldEndCheckout: a, message: e },
|
|
@@ -378,11 +395,11 @@ function P({
|
|
|
378
395
|
// Only a failure that ends the checkout carries a redirect. A retryable one
|
|
379
396
|
// leaves the customer mid-flow with something still to do, and a host that
|
|
380
397
|
// navigated on it would eject them on a hiccup.
|
|
381
|
-
redirectURL: a ?
|
|
398
|
+
redirectURL: a ? h(r == null ? void 0 : r.failureURL) : void 0
|
|
382
399
|
}
|
|
383
400
|
};
|
|
384
401
|
}
|
|
385
|
-
const
|
|
402
|
+
const ee = {
|
|
386
403
|
"common.cancelTransaction": "Cancel Transaction",
|
|
387
404
|
"common.cancel": "Cancel",
|
|
388
405
|
"common.back": "Back",
|
|
@@ -445,17 +462,28 @@ const X = {
|
|
|
445
462
|
"network.noNetworksAvailable": "No networks are available for this payment. Contact the merchant if you think this is wrong.",
|
|
446
463
|
"network.recommended": "RECOMMENDED",
|
|
447
464
|
"network.fee": "Network fee: {fee}",
|
|
448
|
-
"kyc.yourDetails": "
|
|
449
|
-
"kyc.
|
|
450
|
-
"kyc.
|
|
451
|
-
"kyc.
|
|
465
|
+
"kyc.yourDetails": "Additional info required",
|
|
466
|
+
"kyc.basicDetails": "Basic details",
|
|
467
|
+
"kyc.groupTitleOne": "Provide one of the following",
|
|
468
|
+
"kyc.groupTitle": "Provide {count} of the following",
|
|
452
469
|
"kyc.groupGuidanceAcrossForm": "Complete {required} of the {total} identity details to continue ({completed} done).",
|
|
453
470
|
"kyc.groupComplete": "You've completed this section.",
|
|
454
471
|
"kyc.complianceWaiting": "Your details are being verified. This can take a few moments.",
|
|
455
|
-
"kyc.firstNamesLabel": "
|
|
456
|
-
"kyc.firstNamesPlaceholder": "Enter
|
|
457
|
-
"kyc.lastNameLabel": "
|
|
458
|
-
"kyc.lastNamePlaceholder": "Enter
|
|
472
|
+
"kyc.firstNamesLabel": "First name",
|
|
473
|
+
"kyc.firstNamesPlaceholder": "Enter first name",
|
|
474
|
+
"kyc.lastNameLabel": "Last name",
|
|
475
|
+
"kyc.lastNamePlaceholder": "Enter last name",
|
|
476
|
+
"kyc.emailPlaceholder": "Enter email address",
|
|
477
|
+
"kyc.addressSearchLabel": "Find your address",
|
|
478
|
+
"kyc.addressSearchPlaceholder": "Start typing your address",
|
|
479
|
+
"kyc.addressSearchManual": "Enter address manually",
|
|
480
|
+
"kyc.addressSearchSearching": "Searching…",
|
|
481
|
+
"kyc.addressSearchSuggestionCount": "Suggestions: {count}",
|
|
482
|
+
"kyc.addressSearchFetching": "Getting address details…",
|
|
483
|
+
"kyc.addressSearchFilled": "Address filled. Check the details below.",
|
|
484
|
+
"kyc.addressSearchFilledWithBlanks": "Address filled. Some details are still needed.",
|
|
485
|
+
"kyc.addressSearchEditsKept": "Address not applied. Your edits were kept.",
|
|
486
|
+
"kyc.addressSearchUnavailable": "Address search isn't available. Enter your address below.",
|
|
459
487
|
"kyc.streetLabel": "Street address",
|
|
460
488
|
"kyc.streetPlaceholder": "Enter street address",
|
|
461
489
|
"kyc.cityLabel": "City",
|
|
@@ -467,11 +495,14 @@ const X = {
|
|
|
467
495
|
"kyc.walletAddressLabel": "Wallet address",
|
|
468
496
|
"kyc.walletAddressPlaceholder": "Enter wallet address",
|
|
469
497
|
"kyc.dateOfBirthLabel": "Date of birth",
|
|
498
|
+
"kyc.dateAndPlaceOfBirthChoice": "Place and date of birth",
|
|
499
|
+
"kyc.physicalAddressChoice": "Address",
|
|
470
500
|
"kyc.cityOfBirthLabel": "City of birth",
|
|
471
501
|
"kyc.regionOfBirthLabel": "State / Region of birth",
|
|
472
502
|
"kyc.countryOfBirthLabel": "Country of birth",
|
|
473
503
|
"kyc.nationalIdLabel": "National identity number",
|
|
474
504
|
"kyc.nationalIdPlaceholder": "Enter national ID number",
|
|
505
|
+
"kyc.nationalIdChoice": "National ID number",
|
|
475
506
|
"kyc.customerIdLabel": "Customer identification number",
|
|
476
507
|
"kyc.customerIdPlaceholder": "Enter customer ID number",
|
|
477
508
|
"kyc.documentTypeLabel": "Document type",
|
|
@@ -622,28 +653,28 @@ const X = {
|
|
|
622
653
|
"validation.customerDetailsMissing": "Customer details are missing.",
|
|
623
654
|
"validation.invalidOtp": "Please enter a valid 6-digit code.",
|
|
624
655
|
"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>.'
|
|
625
|
-
},
|
|
626
|
-
let
|
|
627
|
-
function
|
|
628
|
-
return
|
|
656
|
+
}, E = { en: ee }, U = "en";
|
|
657
|
+
let O = U;
|
|
658
|
+
function pe() {
|
|
659
|
+
return O;
|
|
629
660
|
}
|
|
630
661
|
function w(e, t) {
|
|
631
662
|
var n;
|
|
632
|
-
const a = ((n =
|
|
663
|
+
const a = ((n = E[O]) == null ? void 0 : n[e]) ?? E[U][e] ?? e;
|
|
633
664
|
return t ? a.replace(
|
|
634
665
|
/\{(\w+)\}/g,
|
|
635
|
-
(
|
|
666
|
+
(r, o) => t[o] != null ? String(t[o]) : `{${o}}`
|
|
636
667
|
) : a;
|
|
637
668
|
}
|
|
638
|
-
function
|
|
639
|
-
return e ===
|
|
669
|
+
function te(e) {
|
|
670
|
+
return e === y.SUCCESS ? "succeeded" : e < y.PENDING && e !== y.KYC_VERIFICATION_PENDING && e !== y.COMPLIANCE_PENDING ? "failed" : "active";
|
|
640
671
|
}
|
|
641
|
-
function
|
|
672
|
+
function ae({
|
|
642
673
|
transaction: e,
|
|
643
674
|
session: t
|
|
644
675
|
}) {
|
|
645
|
-
var
|
|
646
|
-
const a =
|
|
676
|
+
var r, o, s;
|
|
677
|
+
const a = te(e.status);
|
|
647
678
|
if (a === "active")
|
|
648
679
|
return null;
|
|
649
680
|
if (a === "failed")
|
|
@@ -655,11 +686,11 @@ function V({
|
|
|
655
686
|
// Negative (non-KYC) status — cancelled / fraud / timeout.
|
|
656
687
|
reason: "blocked",
|
|
657
688
|
transactionID: e.transactionID,
|
|
658
|
-
redirectURL:
|
|
689
|
+
redirectURL: h(t == null ? void 0 : t.failureURL)
|
|
659
690
|
}
|
|
660
691
|
};
|
|
661
|
-
const n = (
|
|
662
|
-
(i) => i.status ===
|
|
692
|
+
const n = (r = e.payments) == null ? void 0 : r.find(
|
|
693
|
+
(i) => i.status === K.CONFIRMED
|
|
663
694
|
);
|
|
664
695
|
return {
|
|
665
696
|
outcome: a,
|
|
@@ -670,22 +701,22 @@ function V({
|
|
|
670
701
|
},
|
|
671
702
|
result: {
|
|
672
703
|
transactionID: e.transactionID,
|
|
673
|
-
amount: (
|
|
704
|
+
amount: (o = e.amounts) == null ? void 0 : o.totalLocal,
|
|
674
705
|
currency: (s = e.amounts) == null ? void 0 : s.currency,
|
|
675
706
|
asset: n == null ? void 0 : n.cryptoAsset,
|
|
676
707
|
network: n == null ? void 0 : n.cryptoNetwork,
|
|
677
708
|
completedAt: n == null ? void 0 : n.completedAt,
|
|
678
|
-
redirectURL:
|
|
709
|
+
redirectURL: h(t == null ? void 0 : t.successURL)
|
|
679
710
|
}
|
|
680
711
|
};
|
|
681
712
|
}
|
|
682
|
-
function
|
|
713
|
+
function ne() {
|
|
683
714
|
let e = null;
|
|
684
715
|
return {
|
|
685
716
|
setOptions: (t) => {
|
|
686
717
|
e = t;
|
|
687
718
|
},
|
|
688
|
-
emit: (t, a) =>
|
|
719
|
+
emit: (t, a) => L(e == null ? void 0 : e.onEvent, t, a),
|
|
689
720
|
paymentFailed: (t, a) => {
|
|
690
721
|
var n;
|
|
691
722
|
return (n = e == null ? void 0 : e.paymentFailedListener) == null ? void 0 : n.call(e, t, a);
|
|
@@ -700,7 +731,7 @@ function ee() {
|
|
|
700
731
|
}
|
|
701
732
|
};
|
|
702
733
|
}
|
|
703
|
-
class
|
|
734
|
+
class re extends HTMLElement {
|
|
704
735
|
constructor() {
|
|
705
736
|
super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
|
|
706
737
|
}
|
|
@@ -710,8 +741,8 @@ class te extends HTMLElement {
|
|
|
710
741
|
this.isTornDown = !1;
|
|
711
742
|
}
|
|
712
743
|
async initialize(t) {
|
|
713
|
-
const a =
|
|
714
|
-
!
|
|
744
|
+
const a = oe(t), n = se({ api: a, options: t }), r = await this.loadEngine(t, n);
|
|
745
|
+
!r || this.isTornDown || (this.engine = r, await r.initialize(t, { api: a, sessionLoad: n }));
|
|
715
746
|
}
|
|
716
747
|
async loadEngine(t, a) {
|
|
717
748
|
const n = this.getOrLoadEngine();
|
|
@@ -738,7 +769,7 @@ class te extends HTMLElement {
|
|
|
738
769
|
// Not started in the constructor: a page can carry the tag and never check out.
|
|
739
770
|
// Overlapping initialize() calls share one download.
|
|
740
771
|
getOrLoadEngine() {
|
|
741
|
-
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-
|
|
772
|
+
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-C_tda95f.js").then((t) => t.m).then((t) => {
|
|
742
773
|
const a = t.mountCheckoutEngine({
|
|
743
774
|
host: this,
|
|
744
775
|
shadowRoot: this.shadow
|
|
@@ -771,45 +802,45 @@ class te extends HTMLElement {
|
|
|
771
802
|
const n = await a;
|
|
772
803
|
if (this.isDismissedByHost)
|
|
773
804
|
return;
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
const
|
|
805
|
+
const r = ne();
|
|
806
|
+
r.setOptions(t);
|
|
807
|
+
const o = n.ok && n.linkedTransaction ? ae({
|
|
777
808
|
transaction: n.linkedTransaction,
|
|
778
809
|
session: n.session
|
|
779
810
|
}) : null;
|
|
780
|
-
if ((
|
|
781
|
-
|
|
811
|
+
if ((o == null ? void 0 : o.outcome) === "succeeded") {
|
|
812
|
+
r.emit("payment.succeeded", o.event), r.paymentSucceeded(o.result);
|
|
782
813
|
return;
|
|
783
814
|
}
|
|
784
|
-
if (
|
|
785
|
-
|
|
786
|
-
reason:
|
|
815
|
+
if (o) {
|
|
816
|
+
r.emit("payment.failed", {
|
|
817
|
+
reason: o.failure.reason,
|
|
787
818
|
shouldEndCheckout: !0,
|
|
788
|
-
message:
|
|
789
|
-
}),
|
|
819
|
+
message: o.message
|
|
820
|
+
}), r.paymentFailed(o.message, o.failure);
|
|
790
821
|
return;
|
|
791
822
|
}
|
|
792
823
|
if (!n.ok && n.cancelURL) {
|
|
793
|
-
|
|
824
|
+
r.emit("payment.canceled"), r.paymentCanceled({ redirectURL: n.cancelURL });
|
|
794
825
|
return;
|
|
795
826
|
}
|
|
796
827
|
if (!n.ok && n.failureURL) {
|
|
797
|
-
const g = w("errors.unableToCreateSession"), b =
|
|
828
|
+
const g = w("errors.unableToCreateSession"), b = S({
|
|
798
829
|
message: g,
|
|
799
830
|
reason: "sessionExpired",
|
|
800
831
|
shouldEndCheckout: !0,
|
|
801
832
|
session: { failureURL: n.failureURL }
|
|
802
833
|
});
|
|
803
|
-
|
|
834
|
+
r.emit("payment.failed", b.event), r.paymentFailed(g, b.failure);
|
|
804
835
|
return;
|
|
805
836
|
}
|
|
806
|
-
const s = w("errors.checkoutUnavailable"), i =
|
|
837
|
+
const s = w("errors.checkoutUnavailable"), i = S({
|
|
807
838
|
message: s,
|
|
808
839
|
reason: "error",
|
|
809
840
|
shouldEndCheckout: !0,
|
|
810
841
|
session: n.ok ? n.session : null
|
|
811
842
|
});
|
|
812
|
-
|
|
843
|
+
r.emit("payment.failed", i.event), r.paymentFailed(s, i.failure);
|
|
813
844
|
}
|
|
814
845
|
// Always teardown and unmount together to avoid leaking the React engine.
|
|
815
846
|
// Clear the cached load so a later initialize() creates a fresh engine.
|
|
@@ -817,38 +848,38 @@ class te extends HTMLElement {
|
|
|
817
848
|
t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
|
|
818
849
|
}
|
|
819
850
|
}
|
|
820
|
-
function
|
|
821
|
-
return new
|
|
822
|
-
|
|
823
|
-
|
|
851
|
+
function oe(e) {
|
|
852
|
+
return new q(
|
|
853
|
+
j(e),
|
|
854
|
+
d(e) ? void 0 : e.publishableKey
|
|
824
855
|
);
|
|
825
856
|
}
|
|
826
|
-
function
|
|
857
|
+
function se({
|
|
827
858
|
api: e,
|
|
828
859
|
options: t
|
|
829
860
|
}) {
|
|
830
|
-
return
|
|
861
|
+
return z({
|
|
831
862
|
api: e,
|
|
832
863
|
options: t,
|
|
833
|
-
emit: (a, n) =>
|
|
864
|
+
emit: (a, n) => L(t.onEvent, a, n)
|
|
834
865
|
});
|
|
835
866
|
}
|
|
836
|
-
customElements.get("lydian-checkout") || customElements.define("lydian-checkout",
|
|
867
|
+
customElements.get("lydian-checkout") || customElements.define("lydian-checkout", re);
|
|
837
868
|
function f() {
|
|
838
869
|
return document.querySelector("lydian-checkout");
|
|
839
870
|
}
|
|
840
|
-
async function
|
|
871
|
+
async function ie(e) {
|
|
841
872
|
if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
|
|
842
873
|
throw new Error("SDK initialization requires publishableKey and a transaction");
|
|
843
|
-
const t =
|
|
874
|
+
const t = N(e);
|
|
844
875
|
if (t)
|
|
845
876
|
throw new Error(t);
|
|
846
|
-
const a =
|
|
877
|
+
const a = I(e);
|
|
847
878
|
if (a)
|
|
848
879
|
throw new Error(a);
|
|
849
|
-
if (!
|
|
850
|
-
throw new Error("Invalid value for currency, valid values are: " +
|
|
851
|
-
const n =
|
|
880
|
+
if (!F(e.transaction.currency))
|
|
881
|
+
throw new Error("Invalid value for currency, valid values are: " + v.join(", "));
|
|
882
|
+
const n = A({
|
|
852
883
|
options: e,
|
|
853
884
|
unsupportedKeys: ["sessionID"],
|
|
854
885
|
entryPoint: "init"
|
|
@@ -857,16 +888,16 @@ async function oe(e) {
|
|
|
857
888
|
throw new Error(n);
|
|
858
889
|
await f().initialize(e);
|
|
859
890
|
}
|
|
860
|
-
async function
|
|
891
|
+
async function ce(e) {
|
|
861
892
|
if (!e.sessionID)
|
|
862
893
|
throw new Error("initExistingSession requires a sessionID");
|
|
863
|
-
const t =
|
|
894
|
+
const t = N(e);
|
|
864
895
|
if (t)
|
|
865
896
|
throw new Error(t);
|
|
866
|
-
const a =
|
|
897
|
+
const a = I(e);
|
|
867
898
|
if (a)
|
|
868
899
|
throw new Error(a);
|
|
869
|
-
const n =
|
|
900
|
+
const n = A({
|
|
870
901
|
options: e,
|
|
871
902
|
unsupportedKeys: ["publishableKey", "transaction"],
|
|
872
903
|
entryPoint: "initExistingSession"
|
|
@@ -875,31 +906,31 @@ async function re(e) {
|
|
|
875
906
|
throw new Error(n);
|
|
876
907
|
await f().initialize(e);
|
|
877
908
|
}
|
|
878
|
-
async function
|
|
909
|
+
async function le(e) {
|
|
879
910
|
await f().updateTransaction(e);
|
|
880
911
|
}
|
|
881
|
-
window.Lydian = { init:
|
|
912
|
+
window.Lydian = { init: ie, initExistingSession: ce, updateTransaction: le };
|
|
882
913
|
export {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
914
|
+
W as G,
|
|
915
|
+
de as P,
|
|
916
|
+
y as T,
|
|
917
|
+
K as a,
|
|
918
|
+
ye as b,
|
|
919
|
+
v as c,
|
|
920
|
+
X as d,
|
|
921
|
+
Z as e,
|
|
922
|
+
V as f,
|
|
923
|
+
pe as g,
|
|
924
|
+
d as h,
|
|
925
|
+
F as i,
|
|
926
|
+
te as j,
|
|
927
|
+
ae as k,
|
|
928
|
+
R as l,
|
|
929
|
+
he as m,
|
|
930
|
+
S as n,
|
|
931
|
+
ue as o,
|
|
932
|
+
ne as p,
|
|
933
|
+
Q as r,
|
|
934
|
+
h as s,
|
|
904
935
|
w as t
|
|
905
936
|
};
|