@lydianpay/sdk-web 3.15.5 → 3.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{browser-CH7eaWyg.js → browser-D7hYBJ05.js} +1 -1
- package/dist/chunks/{connect-multichain-DUlpFu-U.js → connect-multichain-Cq0nfkUh.js} +9 -9
- package/dist/chunks/{index-DwADRT3v.js → index-CA1kNBo-.js} +203 -139
- package/dist/chunks/{index-B0KsTd4q.js → index-CXIhRfTO.js} +2 -2
- package/dist/chunks/{index-C3_NkCKr.js → index-Cg9sFEhj.js} +1 -1
- package/dist/chunks/{index-BWDzkEUT.js → index-D4W8-w8-.js} +1 -1
- package/dist/chunks/{index-Dgq02q9R.js → index-eNQBuUBY.js} +2 -2
- package/dist/chunks/{index-DLmUAaTw.js → index-iy5xf-sU.js} +3 -3
- package/dist/chunks/{mountEngine-Bk-qJ-ZC.js → mountEngine-CBqqdixh.js} +14567 -14251
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/network/gatewayRequestError.d.ts +9 -0
- package/dist/types/network/session/index.d.ts +2 -1
- package/dist/types/types.d.ts +27 -9
- package/dist/types/ui/flowConfig.d.ts +1 -0
- package/dist/types/ui/kycFlow.d.ts +6 -5
- package/dist/types/ui/kycValidation.d.ts +51 -18
- package/dist/types/ui/kycVerificationRequest.d.ts +5 -7
- package/dist/types/ui/otpValidation.d.ts +0 -4
- package/dist/types/ui/react/AlertBanner.d.ts +1 -1
- package/dist/types/ui/react/CheckboxField.d.ts +8 -0
- package/dist/types/ui/react/EmailReceiptCard/EmailReceiptCard.d.ts +4 -0
- package/dist/types/ui/react/EmailReceiptCard/EmailReceiptForm.d.ts +7 -0
- package/dist/types/ui/react/EmailReceiptCard/emailReceiptHelpers.d.ts +7 -0
- package/dist/types/ui/react/EmailReceiptCard/useEmailReceiptSender.d.ts +7 -0
- package/dist/types/ui/react/FormField.d.ts +2 -1
- package/dist/types/ui/react/KycDocumentFields.d.ts +11 -0
- package/dist/types/ui/react/KycFields.d.ts +15 -0
- package/dist/types/ui/react/checkoutActions.d.ts +1 -3
- package/dist/types/ui/react/checkoutStore.d.ts +10 -8
- package/package.json +1 -1
|
@@ -1,10 +1,31 @@
|
|
|
1
|
-
const
|
|
1
|
+
const E = ["USD", "TRY", "PHP"];
|
|
2
2
|
function U(e) {
|
|
3
|
-
return typeof e == "string" &&
|
|
3
|
+
return typeof e == "string" && E.includes(e);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function u(e) {
|
|
6
6
|
return "sessionID" in e && typeof e.sessionID == "string" && e.sessionID.length > 0;
|
|
7
7
|
}
|
|
8
|
+
class O extends Error {
|
|
9
|
+
constructor({
|
|
10
|
+
statusText: t,
|
|
11
|
+
errorCode: a,
|
|
12
|
+
response: n
|
|
13
|
+
}) {
|
|
14
|
+
super(t, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function h(e) {
|
|
18
|
+
const t = await e.clone().json().catch(() => null);
|
|
19
|
+
return new O({
|
|
20
|
+
statusText: e.statusText,
|
|
21
|
+
errorCode: F(t),
|
|
22
|
+
response: e
|
|
23
|
+
});
|
|
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;
|
|
28
|
+
}
|
|
8
29
|
class p {
|
|
9
30
|
// Optional: a caller-supplied session has no key and needs none (see Sessions).
|
|
10
31
|
// The key is still required when the SDK creates the session, enforced in
|
|
@@ -23,7 +44,7 @@ class p {
|
|
|
23
44
|
const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
|
|
24
45
|
if (s.ok)
|
|
25
46
|
return await s.json();
|
|
26
|
-
throw
|
|
47
|
+
throw await h(s);
|
|
27
48
|
}
|
|
28
49
|
// For endpoints that reply text/plain rather than JSON (e.g. PATCH
|
|
29
50
|
// /customer/otp -> "OTP sent"). Sends the same JSON request headers but does
|
|
@@ -32,17 +53,34 @@ class p {
|
|
|
32
53
|
const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
|
|
33
54
|
if (s.ok)
|
|
34
55
|
return await s.text();
|
|
35
|
-
throw
|
|
56
|
+
throw await h(s);
|
|
36
57
|
}
|
|
37
58
|
async requestWithFormData(t, a) {
|
|
38
59
|
const n = `${this.baseUri}${t}`, o = this.headers(), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
|
|
39
60
|
if (s.ok)
|
|
40
61
|
return await s.json();
|
|
41
|
-
throw
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const c = "transaction"
|
|
45
|
-
|
|
62
|
+
throw await h(s);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const c = "transaction", W = [
|
|
66
|
+
"firstName",
|
|
67
|
+
"lastName",
|
|
68
|
+
"email",
|
|
69
|
+
"street",
|
|
70
|
+
"city",
|
|
71
|
+
"region",
|
|
72
|
+
"postalCode",
|
|
73
|
+
"country",
|
|
74
|
+
"yearOfBirth",
|
|
75
|
+
"monthOfBirth",
|
|
76
|
+
"dayOfBirth",
|
|
77
|
+
"cityOfBirth",
|
|
78
|
+
"regionOfBirth",
|
|
79
|
+
"countryOfBirth",
|
|
80
|
+
"nationalIDNumber",
|
|
81
|
+
"customerIDNumber"
|
|
82
|
+
];
|
|
83
|
+
class $ extends p {
|
|
46
84
|
async getCryptoTransaction(t) {
|
|
47
85
|
return await this.request(`/${c}/${t}`);
|
|
48
86
|
}
|
|
@@ -84,7 +122,12 @@ class R extends p {
|
|
|
84
122
|
}
|
|
85
123
|
async kycVerification(t, a) {
|
|
86
124
|
const n = new FormData();
|
|
87
|
-
return n.append("asset", a.asset), n.append("network", a.network),
|
|
125
|
+
return n.append("asset", a.asset), n.append("network", a.network), W.forEach((o) => {
|
|
126
|
+
const r = a[o];
|
|
127
|
+
r && n.append(o, r);
|
|
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
|
+
(o, r) => n.append("documentFiles", o, `${r + 1}-${o.name}`)
|
|
130
|
+
), await this.requestWithFormData(
|
|
88
131
|
`/${c}/${t}/verification`,
|
|
89
132
|
{
|
|
90
133
|
method: "POST",
|
|
@@ -93,7 +136,7 @@ class R extends p {
|
|
|
93
136
|
);
|
|
94
137
|
}
|
|
95
138
|
}
|
|
96
|
-
function
|
|
139
|
+
function Y(e, t) {
|
|
97
140
|
t.forEach((a) => {
|
|
98
141
|
Object.getOwnPropertyNames(a.prototype).forEach((n) => {
|
|
99
142
|
const o = Object.getOwnPropertyDescriptor(a.prototype, n);
|
|
@@ -101,40 +144,40 @@ function O(e, t) {
|
|
|
101
144
|
});
|
|
102
145
|
});
|
|
103
146
|
}
|
|
104
|
-
const
|
|
105
|
-
class
|
|
147
|
+
const C = "customer/otp";
|
|
148
|
+
class x extends p {
|
|
106
149
|
// PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
|
|
107
150
|
async sendCustomerOTP(t) {
|
|
108
|
-
return await this.requestText(`/${
|
|
151
|
+
return await this.requestText(`/${C}`, {
|
|
109
152
|
method: "PATCH",
|
|
110
153
|
body: JSON.stringify(t)
|
|
111
154
|
});
|
|
112
155
|
}
|
|
113
156
|
// PUT /customer/otp -> { customerUUID, kycValidated }.
|
|
114
157
|
async authenticateCustomerOTP(t) {
|
|
115
|
-
return await this.request(`/${
|
|
158
|
+
return await this.request(`/${C}`, {
|
|
116
159
|
method: "PUT",
|
|
117
160
|
body: JSON.stringify(t)
|
|
118
161
|
});
|
|
119
162
|
}
|
|
120
163
|
}
|
|
121
|
-
const
|
|
122
|
-
class
|
|
164
|
+
const l = "session";
|
|
165
|
+
class B extends p {
|
|
123
166
|
async createSession(t) {
|
|
124
|
-
return await this.request(`/${
|
|
167
|
+
return await this.request(`/${l}`, {
|
|
125
168
|
method: "POST",
|
|
126
169
|
body: JSON.stringify(t)
|
|
127
170
|
});
|
|
128
171
|
}
|
|
129
172
|
async getSession(t) {
|
|
130
|
-
return await this.request(`/${
|
|
173
|
+
return await this.request(`/${l}/${t}`);
|
|
131
174
|
}
|
|
132
175
|
// Promotes the session into a transaction. Allowed once per session — except
|
|
133
176
|
// that a KYC-pending (-3) response does not consume the promotion, which is
|
|
134
177
|
// what lets the restore-details flow re-promote with a customerUUID.
|
|
135
178
|
async createSessionTransaction(t, a) {
|
|
136
179
|
return await this.request(
|
|
137
|
-
`/${
|
|
180
|
+
`/${l}/${t}/transaction`,
|
|
138
181
|
{
|
|
139
182
|
method: "POST",
|
|
140
183
|
body: JSON.stringify(a)
|
|
@@ -144,16 +187,22 @@ class W extends p {
|
|
|
144
187
|
// PATCH /session/{id}/cancel replies text/plain (the merchant's cancel URL),
|
|
145
188
|
// not JSON. Cancelling cascades to the linked transaction, if any.
|
|
146
189
|
async cancelSession(t) {
|
|
147
|
-
return await this.requestText(`/${
|
|
190
|
+
return await this.requestText(`/${l}/${t}/cancel`, {
|
|
148
191
|
method: "PATCH"
|
|
149
192
|
});
|
|
150
193
|
}
|
|
194
|
+
async sendReceipt(t, a) {
|
|
195
|
+
await this.request(`/${l}/${t}/receipt`, {
|
|
196
|
+
method: "POST",
|
|
197
|
+
body: JSON.stringify(a)
|
|
198
|
+
});
|
|
199
|
+
}
|
|
151
200
|
}
|
|
152
|
-
class
|
|
201
|
+
class S extends p {
|
|
153
202
|
}
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
var
|
|
203
|
+
Y(S, [$, x, B]);
|
|
204
|
+
const M = S;
|
|
205
|
+
var d = {
|
|
157
206
|
COMPLIANCE_PENDING: -10,
|
|
158
207
|
API_CANCELLED: -9,
|
|
159
208
|
PAYMENT_TIMEOUT: -8,
|
|
@@ -170,10 +219,10 @@ var u = {
|
|
|
170
219
|
FRAUD: -1,
|
|
171
220
|
PENDING: 0,
|
|
172
221
|
SUCCESS: 1
|
|
173
|
-
},
|
|
222
|
+
}, ie = {
|
|
174
223
|
PARTIALLY_PAID: 1,
|
|
175
224
|
OVERPAID: 3
|
|
176
|
-
},
|
|
225
|
+
}, G = {
|
|
177
226
|
PENDING: 0,
|
|
178
227
|
CONFIRMED: 1
|
|
179
228
|
}, m = {
|
|
@@ -181,10 +230,10 @@ var u = {
|
|
|
181
230
|
sandbox: "https://api.sandbox.lydian.com",
|
|
182
231
|
prod: "https://api.lydian.com"
|
|
183
232
|
};
|
|
184
|
-
function
|
|
233
|
+
function _(e) {
|
|
185
234
|
return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? m.dev : e.sandbox ? m.sandbox : m.prod;
|
|
186
235
|
}
|
|
187
|
-
function
|
|
236
|
+
function v({
|
|
188
237
|
options: e,
|
|
189
238
|
unsupportedKeys: t,
|
|
190
239
|
entryPoint: a
|
|
@@ -192,14 +241,14 @@ function E({
|
|
|
192
241
|
const n = t.filter((o) => e[o] !== void 0);
|
|
193
242
|
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.`;
|
|
194
243
|
}
|
|
195
|
-
function
|
|
244
|
+
function D(e) {
|
|
196
245
|
var t;
|
|
197
246
|
return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
|
|
198
247
|
}
|
|
199
|
-
function
|
|
200
|
-
return e.gatewayUrl === void 0 ||
|
|
248
|
+
function N(e) {
|
|
249
|
+
return e.gatewayUrl === void 0 || q(e.gatewayUrl) ? null : `gatewayUrl must be an http(s) origin such as http://localhost:8000, with no path, got ${JSON.stringify(e.gatewayUrl)}`;
|
|
201
250
|
}
|
|
202
|
-
function
|
|
251
|
+
function q(e) {
|
|
203
252
|
let t;
|
|
204
253
|
try {
|
|
205
254
|
t = new URL(e);
|
|
@@ -208,20 +257,20 @@ function Y(e) {
|
|
|
208
257
|
}
|
|
209
258
|
return (t.protocol === "http:" || t.protocol === "https:") && t.pathname === "/" && t.search === "" && t.hash === "";
|
|
210
259
|
}
|
|
211
|
-
function
|
|
212
|
-
return e !== null && !
|
|
260
|
+
function ce(e) {
|
|
261
|
+
return e !== null && !u(e) && !!e.publishableKey;
|
|
213
262
|
}
|
|
214
|
-
function
|
|
215
|
-
return e !== null && !
|
|
263
|
+
function le(e) {
|
|
264
|
+
return e !== null && !u(e);
|
|
216
265
|
}
|
|
217
|
-
function
|
|
266
|
+
function ue({
|
|
218
267
|
options: e,
|
|
219
268
|
session: t,
|
|
220
269
|
settled: a
|
|
221
270
|
}) {
|
|
222
|
-
return !a && t !== null && e !== null &&
|
|
271
|
+
return !a && t !== null && e !== null && u(e);
|
|
223
272
|
}
|
|
224
|
-
function
|
|
273
|
+
function A(e, t, a) {
|
|
225
274
|
try {
|
|
226
275
|
e == null || e(t, a);
|
|
227
276
|
} catch (n) {
|
|
@@ -239,69 +288,69 @@ function y(e) {
|
|
|
239
288
|
}
|
|
240
289
|
return t.protocol === "https:" || t.protocol === "http:" ? e : void 0;
|
|
241
290
|
}
|
|
242
|
-
async function
|
|
291
|
+
async function j({
|
|
243
292
|
api: e,
|
|
244
293
|
options: t,
|
|
245
294
|
emit: a
|
|
246
295
|
}) {
|
|
247
296
|
try {
|
|
248
|
-
const n = await
|
|
249
|
-
a("session.loaded",
|
|
250
|
-
const s = await
|
|
297
|
+
const n = await K({ api: e, options: t }), { session: o, sessionPromoted: r } = await z({ api: e, sessionID: n });
|
|
298
|
+
a("session.loaded", J(o));
|
|
299
|
+
const s = await Q({
|
|
251
300
|
api: e,
|
|
252
301
|
transactionID: o.transactionID
|
|
253
302
|
});
|
|
254
303
|
return { ok: !0, session: o, sessionPromoted: r, linkedTransaction: s };
|
|
255
304
|
} catch (n) {
|
|
256
|
-
return { ok: !1, ...await
|
|
305
|
+
return { ok: !1, ...await H(n) };
|
|
257
306
|
}
|
|
258
307
|
}
|
|
259
|
-
async function
|
|
308
|
+
async function H(e) {
|
|
260
309
|
const t = e instanceof Error ? e.cause : void 0;
|
|
261
310
|
if (!(t instanceof Response && t.status === 404))
|
|
262
311
|
return {};
|
|
263
312
|
try {
|
|
264
313
|
const n = await t.json();
|
|
265
314
|
return {
|
|
266
|
-
failureURL:
|
|
267
|
-
cancelURL:
|
|
315
|
+
failureURL: k(n == null ? void 0 : n.failureURL),
|
|
316
|
+
cancelURL: k(n == null ? void 0 : n.cancelURL)
|
|
268
317
|
};
|
|
269
318
|
} catch {
|
|
270
319
|
return {};
|
|
271
320
|
}
|
|
272
321
|
}
|
|
273
|
-
function
|
|
322
|
+
function k(e) {
|
|
274
323
|
return typeof e == "string" ? y(e) : void 0;
|
|
275
324
|
}
|
|
276
|
-
async function
|
|
325
|
+
async function K({
|
|
277
326
|
api: e,
|
|
278
327
|
options: t
|
|
279
328
|
}) {
|
|
280
|
-
return
|
|
329
|
+
return u(t) ? t.sessionID : (await e.createSession({
|
|
281
330
|
amount: t.transaction.amount,
|
|
282
331
|
amountCurrency: t.transaction.currency,
|
|
283
332
|
descriptor: t.transaction.descriptor,
|
|
284
333
|
referenceNumber: t.transaction.referenceNumber
|
|
285
334
|
})).sessionID;
|
|
286
335
|
}
|
|
287
|
-
async function
|
|
336
|
+
async function z({
|
|
288
337
|
api: e,
|
|
289
338
|
sessionID: t
|
|
290
339
|
}) {
|
|
291
340
|
const a = await e.getSession(t);
|
|
292
|
-
return { session: a, sessionPromoted:
|
|
341
|
+
return { session: a, sessionPromoted: I(a) };
|
|
293
342
|
}
|
|
294
|
-
function
|
|
343
|
+
function J(e) {
|
|
295
344
|
return {
|
|
296
345
|
sessionID: e.sessionID,
|
|
297
346
|
merchantName: e.merchantName,
|
|
298
|
-
alreadyPromoted:
|
|
347
|
+
alreadyPromoted: I(e)
|
|
299
348
|
};
|
|
300
349
|
}
|
|
301
|
-
function
|
|
350
|
+
function I(e) {
|
|
302
351
|
return !!e.transactionID;
|
|
303
352
|
}
|
|
304
|
-
async function
|
|
353
|
+
async function Q({
|
|
305
354
|
api: e,
|
|
306
355
|
transactionID: t
|
|
307
356
|
}) {
|
|
@@ -313,7 +362,7 @@ async function K({
|
|
|
313
362
|
return console.error("Failed to resolve the session transaction:", a), null;
|
|
314
363
|
}
|
|
315
364
|
}
|
|
316
|
-
function
|
|
365
|
+
function P({
|
|
317
366
|
message: e,
|
|
318
367
|
reason: t,
|
|
319
368
|
shouldEndCheckout: a,
|
|
@@ -333,7 +382,7 @@ function C({
|
|
|
333
382
|
}
|
|
334
383
|
};
|
|
335
384
|
}
|
|
336
|
-
const
|
|
385
|
+
const X = {
|
|
337
386
|
"common.cancelTransaction": "Cancel Transaction",
|
|
338
387
|
"common.cancel": "Cancel",
|
|
339
388
|
"common.back": "Back",
|
|
@@ -396,11 +445,13 @@ const j = {
|
|
|
396
445
|
"network.noNetworksAvailable": "No networks are available for this payment. Contact the merchant if you think this is wrong.",
|
|
397
446
|
"network.recommended": "RECOMMENDED",
|
|
398
447
|
"network.fee": "Network fee: {fee}",
|
|
399
|
-
"kyc.
|
|
448
|
+
"kyc.yourDetails": "Your details",
|
|
449
|
+
"kyc.yourDetailsDescription": "This information is required to comply with applicable regulations.",
|
|
450
|
+
"kyc.groupHeading": "Customer Identity",
|
|
451
|
+
"kyc.groupGuidance": "Complete {required} of the {total} fields below to continue.",
|
|
452
|
+
"kyc.groupGuidanceAcrossForm": "Complete {required} of the {total} identity details to continue ({completed} done).",
|
|
453
|
+
"kyc.groupComplete": "You've completed this section.",
|
|
400
454
|
"kyc.complianceWaiting": "Your details are being verified. This can take a few moments.",
|
|
401
|
-
"kyc.stepBasic": "Basic details",
|
|
402
|
-
"kyc.stepAddress": "Address",
|
|
403
|
-
"kyc.stepDocument": "Verification document",
|
|
404
455
|
"kyc.firstNamesLabel": "Legal first name",
|
|
405
456
|
"kyc.firstNamesPlaceholder": "Enter legal first name",
|
|
406
457
|
"kyc.lastNameLabel": "Legal last name",
|
|
@@ -413,6 +464,16 @@ const j = {
|
|
|
413
464
|
"kyc.regionPlaceholder": "Enter state or region",
|
|
414
465
|
"kyc.postalCodeLabel": "ZIP / Postal code",
|
|
415
466
|
"kyc.postalCodePlaceholder": "Enter ZIP or postal code",
|
|
467
|
+
"kyc.walletAddressLabel": "Wallet address",
|
|
468
|
+
"kyc.walletAddressPlaceholder": "Enter wallet address",
|
|
469
|
+
"kyc.dateOfBirthLabel": "Date of birth",
|
|
470
|
+
"kyc.cityOfBirthLabel": "City of birth",
|
|
471
|
+
"kyc.regionOfBirthLabel": "State / Region of birth",
|
|
472
|
+
"kyc.countryOfBirthLabel": "Country of birth",
|
|
473
|
+
"kyc.nationalIdLabel": "National identity number",
|
|
474
|
+
"kyc.nationalIdPlaceholder": "Enter national ID number",
|
|
475
|
+
"kyc.customerIdLabel": "Customer identification number",
|
|
476
|
+
"kyc.customerIdPlaceholder": "Enter customer ID number",
|
|
416
477
|
"kyc.documentTypeLabel": "Document type",
|
|
417
478
|
"kyc.documentTypeAria": "Document Type",
|
|
418
479
|
"kyc.docTypeIdCard": "Identity (ID) Card",
|
|
@@ -488,6 +549,15 @@ const j = {
|
|
|
488
549
|
"success.getAppBody": "Want a simpler checkout experience? Try the <strong>Lydian Wallet</strong> next time.",
|
|
489
550
|
"success.downloadFromAppStore": "Download from the App Store",
|
|
490
551
|
"success.downloadFromGooglePlay": "Get it on Google Play",
|
|
552
|
+
"receipt.title": "Email Receipt",
|
|
553
|
+
"receipt.subtitle": "Get a copy of these payment details by email.",
|
|
554
|
+
"receipt.marketingConsent": "I’d like to receive promotional updates, offers, and announcements from Lydian.",
|
|
555
|
+
"receipt.send": "Send Receipt",
|
|
556
|
+
"receipt.sending": "Sending...",
|
|
557
|
+
"receipt.sent": "Your receipt is on its way. Contact support if you need another copy.",
|
|
558
|
+
"receipt.sendFailed": "We couldn't send your receipt. Please try again.",
|
|
559
|
+
"receipt.unavailable": "Email receipts aren't available for this payment.",
|
|
560
|
+
"receipt.alreadySent": "A receipt has already been sent for this payment. Contact support if you need another copy.",
|
|
491
561
|
"failure.title": "We couldn't complete your payment",
|
|
492
562
|
"failure.paymentId": "Payment ID",
|
|
493
563
|
"failure.copyPaymentId": "Copy payment ID",
|
|
@@ -541,52 +611,45 @@ const j = {
|
|
|
541
611
|
"errors.walletSignedNotSent": "Your wallet signed the payment, but it couldn’t be sent. You can still pay by scanning the code below.",
|
|
542
612
|
"errors.unableToCreateCryptoTransaction": "We couldn't set up your payment. Please try again, or choose a different coin.",
|
|
543
613
|
"errors.cryptoTransactionNotCreated": "Your payment hasn’t been set up yet. Choose a coin and network to continue.",
|
|
614
|
+
"errors.unsupportedRequirements": "We can't collect the details this payment needs. Please contact support.",
|
|
615
|
+
"errors.verificationRejected": "We couldn't verify your identity, so this payment can't continue. Please contact support.",
|
|
544
616
|
"errors.unableToVerifyDetails": "We could not verify your details. Please try again or contact support.",
|
|
545
617
|
"errors.unableToRestoreDetails": "Unable to restore your details. Please try again.",
|
|
546
618
|
"errors.couldNotRestoreDetails": "We could not restore your details. Please try again or contact support.",
|
|
547
|
-
"validation.emailRequired": "Please enter your email address.",
|
|
548
|
-
"validation.firstNameRequired": "Please enter your legal first name.",
|
|
549
|
-
"validation.lastNameRequired": "Please enter your legal last name.",
|
|
550
|
-
"validation.countryRequired": "Please select your country.",
|
|
551
|
-
"validation.streetRequired": "Please enter your street address.",
|
|
552
|
-
"validation.cityRequired": "Please enter your city.",
|
|
553
|
-
"validation.regionRequired": "Please enter your state or region.",
|
|
554
|
-
"validation.postalCodeRequired": "Please enter your ZIP or postal code.",
|
|
555
|
-
"validation.documentFrontRequired": "Please upload the front image of the document.",
|
|
556
|
-
"validation.documentBackRequired": "Please upload the back image of the document.",
|
|
557
619
|
"validation.emailOrCountryMissing": "Email or country is missing.",
|
|
558
620
|
"validation.invalidEmail": "Please enter a valid email address.",
|
|
621
|
+
"validation.invalidDateOfBirth": "Please enter a valid date of birth.",
|
|
559
622
|
"validation.customerDetailsMissing": "Customer details are missing.",
|
|
560
623
|
"validation.invalidOtp": "Please enter a valid 6-digit code.",
|
|
561
624
|
"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>.'
|
|
562
|
-
},
|
|
563
|
-
let
|
|
564
|
-
function
|
|
565
|
-
return
|
|
625
|
+
}, T = { en: X }, L = "en";
|
|
626
|
+
let R = L;
|
|
627
|
+
function de() {
|
|
628
|
+
return R;
|
|
566
629
|
}
|
|
567
|
-
function
|
|
630
|
+
function w(e, t) {
|
|
568
631
|
var n;
|
|
569
|
-
const a = ((n =
|
|
632
|
+
const a = ((n = T[R]) == null ? void 0 : n[e]) ?? T[L][e] ?? e;
|
|
570
633
|
return t ? a.replace(
|
|
571
634
|
/\{(\w+)\}/g,
|
|
572
635
|
(o, r) => t[r] != null ? String(t[r]) : `{${r}}`
|
|
573
636
|
) : a;
|
|
574
637
|
}
|
|
575
|
-
function
|
|
576
|
-
return e ===
|
|
638
|
+
function Z(e) {
|
|
639
|
+
return e === d.SUCCESS ? "succeeded" : e < d.PENDING && e !== d.KYC_VERIFICATION_PENDING && e !== d.COMPLIANCE_PENDING ? "failed" : "active";
|
|
577
640
|
}
|
|
578
|
-
function
|
|
641
|
+
function V({
|
|
579
642
|
transaction: e,
|
|
580
643
|
session: t
|
|
581
644
|
}) {
|
|
582
645
|
var o, r, s;
|
|
583
|
-
const a =
|
|
646
|
+
const a = Z(e.status);
|
|
584
647
|
if (a === "active")
|
|
585
648
|
return null;
|
|
586
649
|
if (a === "failed")
|
|
587
650
|
return {
|
|
588
651
|
outcome: a,
|
|
589
|
-
message:
|
|
652
|
+
message: w("errors.paymentCouldNotComplete"),
|
|
590
653
|
failure: {
|
|
591
654
|
shouldEndCheckout: !0,
|
|
592
655
|
// Negative (non-KYC) status — cancelled / fraud / timeout.
|
|
@@ -596,7 +659,7 @@ function J({
|
|
|
596
659
|
}
|
|
597
660
|
};
|
|
598
661
|
const n = (o = e.payments) == null ? void 0 : o.find(
|
|
599
|
-
(i) => i.status ===
|
|
662
|
+
(i) => i.status === G.CONFIRMED
|
|
600
663
|
);
|
|
601
664
|
return {
|
|
602
665
|
outcome: a,
|
|
@@ -616,13 +679,13 @@ function J({
|
|
|
616
679
|
}
|
|
617
680
|
};
|
|
618
681
|
}
|
|
619
|
-
function
|
|
682
|
+
function ee() {
|
|
620
683
|
let e = null;
|
|
621
684
|
return {
|
|
622
685
|
setOptions: (t) => {
|
|
623
686
|
e = t;
|
|
624
687
|
},
|
|
625
|
-
emit: (t, a) =>
|
|
688
|
+
emit: (t, a) => A(e == null ? void 0 : e.onEvent, t, a),
|
|
626
689
|
paymentFailed: (t, a) => {
|
|
627
690
|
var n;
|
|
628
691
|
return (n = e == null ? void 0 : e.paymentFailedListener) == null ? void 0 : n.call(e, t, a);
|
|
@@ -637,7 +700,7 @@ function Q() {
|
|
|
637
700
|
}
|
|
638
701
|
};
|
|
639
702
|
}
|
|
640
|
-
class
|
|
703
|
+
class te extends HTMLElement {
|
|
641
704
|
constructor() {
|
|
642
705
|
super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
|
|
643
706
|
}
|
|
@@ -647,7 +710,7 @@ class Z extends HTMLElement {
|
|
|
647
710
|
this.isTornDown = !1;
|
|
648
711
|
}
|
|
649
712
|
async initialize(t) {
|
|
650
|
-
const a =
|
|
713
|
+
const a = ae(t), n = ne({ api: a, options: t }), o = await this.loadEngine(t, n);
|
|
651
714
|
!o || this.isTornDown || (this.engine = o, await o.initialize(t, { api: a, sessionLoad: n }));
|
|
652
715
|
}
|
|
653
716
|
async loadEngine(t, a) {
|
|
@@ -675,7 +738,7 @@ class Z extends HTMLElement {
|
|
|
675
738
|
// Not started in the constructor: a page can carry the tag and never check out.
|
|
676
739
|
// Overlapping initialize() calls share one download.
|
|
677
740
|
getOrLoadEngine() {
|
|
678
|
-
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-
|
|
741
|
+
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-CBqqdixh.js").then((t) => t.m).then((t) => {
|
|
679
742
|
const a = t.mountCheckoutEngine({
|
|
680
743
|
host: this,
|
|
681
744
|
shadowRoot: this.shadow
|
|
@@ -708,9 +771,9 @@ class Z extends HTMLElement {
|
|
|
708
771
|
const n = await a;
|
|
709
772
|
if (this.isDismissedByHost)
|
|
710
773
|
return;
|
|
711
|
-
const o =
|
|
774
|
+
const o = ee();
|
|
712
775
|
o.setOptions(t);
|
|
713
|
-
const r = n.ok && n.linkedTransaction ?
|
|
776
|
+
const r = n.ok && n.linkedTransaction ? V({
|
|
714
777
|
transaction: n.linkedTransaction,
|
|
715
778
|
session: n.session
|
|
716
779
|
}) : null;
|
|
@@ -731,16 +794,16 @@ class Z extends HTMLElement {
|
|
|
731
794
|
return;
|
|
732
795
|
}
|
|
733
796
|
if (!n.ok && n.failureURL) {
|
|
734
|
-
const
|
|
735
|
-
message:
|
|
797
|
+
const g = w("errors.unableToCreateSession"), b = P({
|
|
798
|
+
message: g,
|
|
736
799
|
reason: "sessionExpired",
|
|
737
800
|
shouldEndCheckout: !0,
|
|
738
801
|
session: { failureURL: n.failureURL }
|
|
739
802
|
});
|
|
740
|
-
o.emit("payment.failed",
|
|
803
|
+
o.emit("payment.failed", b.event), o.paymentFailed(g, b.failure);
|
|
741
804
|
return;
|
|
742
805
|
}
|
|
743
|
-
const s =
|
|
806
|
+
const s = w("errors.checkoutUnavailable"), i = P({
|
|
744
807
|
message: s,
|
|
745
808
|
reason: "error",
|
|
746
809
|
shouldEndCheckout: !0,
|
|
@@ -754,88 +817,89 @@ class Z extends HTMLElement {
|
|
|
754
817
|
t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
|
|
755
818
|
}
|
|
756
819
|
}
|
|
757
|
-
function
|
|
758
|
-
return new
|
|
759
|
-
|
|
760
|
-
|
|
820
|
+
function ae(e) {
|
|
821
|
+
return new M(
|
|
822
|
+
_(e),
|
|
823
|
+
u(e) ? void 0 : e.publishableKey
|
|
761
824
|
);
|
|
762
825
|
}
|
|
763
|
-
function
|
|
826
|
+
function ne({
|
|
764
827
|
api: e,
|
|
765
828
|
options: t
|
|
766
829
|
}) {
|
|
767
|
-
return
|
|
830
|
+
return j({
|
|
768
831
|
api: e,
|
|
769
832
|
options: t,
|
|
770
|
-
emit: (a, n) =>
|
|
833
|
+
emit: (a, n) => A(t.onEvent, a, n)
|
|
771
834
|
});
|
|
772
835
|
}
|
|
773
|
-
customElements.get("lydian-checkout") || customElements.define("lydian-checkout",
|
|
774
|
-
function
|
|
836
|
+
customElements.get("lydian-checkout") || customElements.define("lydian-checkout", te);
|
|
837
|
+
function f() {
|
|
775
838
|
return document.querySelector("lydian-checkout");
|
|
776
839
|
}
|
|
777
|
-
async function
|
|
840
|
+
async function oe(e) {
|
|
778
841
|
if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
|
|
779
842
|
throw new Error("SDK initialization requires publishableKey and a transaction");
|
|
780
|
-
const t =
|
|
843
|
+
const t = D(e);
|
|
781
844
|
if (t)
|
|
782
845
|
throw new Error(t);
|
|
783
|
-
const a =
|
|
846
|
+
const a = N(e);
|
|
784
847
|
if (a)
|
|
785
848
|
throw new Error(a);
|
|
786
849
|
if (!U(e.transaction.currency))
|
|
787
|
-
throw new Error("Invalid value for currency, valid values are: " +
|
|
788
|
-
const n =
|
|
850
|
+
throw new Error("Invalid value for currency, valid values are: " + E.join(", "));
|
|
851
|
+
const n = v({
|
|
789
852
|
options: e,
|
|
790
853
|
unsupportedKeys: ["sessionID"],
|
|
791
854
|
entryPoint: "init"
|
|
792
855
|
});
|
|
793
856
|
if (n)
|
|
794
857
|
throw new Error(n);
|
|
795
|
-
await
|
|
858
|
+
await f().initialize(e);
|
|
796
859
|
}
|
|
797
|
-
async function
|
|
860
|
+
async function re(e) {
|
|
798
861
|
if (!e.sessionID)
|
|
799
862
|
throw new Error("initExistingSession requires a sessionID");
|
|
800
|
-
const t =
|
|
863
|
+
const t = D(e);
|
|
801
864
|
if (t)
|
|
802
865
|
throw new Error(t);
|
|
803
|
-
const a =
|
|
866
|
+
const a = N(e);
|
|
804
867
|
if (a)
|
|
805
868
|
throw new Error(a);
|
|
806
|
-
const n =
|
|
869
|
+
const n = v({
|
|
807
870
|
options: e,
|
|
808
871
|
unsupportedKeys: ["publishableKey", "transaction"],
|
|
809
872
|
entryPoint: "initExistingSession"
|
|
810
873
|
});
|
|
811
874
|
if (n)
|
|
812
875
|
throw new Error(n);
|
|
813
|
-
await
|
|
876
|
+
await f().initialize(e);
|
|
814
877
|
}
|
|
815
|
-
async function
|
|
816
|
-
await
|
|
878
|
+
async function se(e) {
|
|
879
|
+
await f().updateTransaction(e);
|
|
817
880
|
}
|
|
818
|
-
window.Lydian = { init:
|
|
881
|
+
window.Lydian = { init: oe, initExistingSession: re, updateTransaction: se };
|
|
819
882
|
export {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
883
|
+
O as G,
|
|
884
|
+
ie as P,
|
|
885
|
+
d as T,
|
|
886
|
+
G as a,
|
|
887
|
+
le as b,
|
|
888
|
+
E as c,
|
|
889
|
+
z as d,
|
|
890
|
+
J as e,
|
|
891
|
+
Q as f,
|
|
892
|
+
de as g,
|
|
893
|
+
u as h,
|
|
830
894
|
U as i,
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
895
|
+
Z as j,
|
|
896
|
+
V as k,
|
|
897
|
+
I as l,
|
|
898
|
+
ue as m,
|
|
899
|
+
P as n,
|
|
900
|
+
ce as o,
|
|
901
|
+
ee as p,
|
|
902
|
+
K as r,
|
|
839
903
|
y as s,
|
|
840
|
-
|
|
904
|
+
w as t
|
|
841
905
|
};
|