@lydianpay/sdk-web 3.18.2 → 3.18.4
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-ByUw6qxL.js → browser-DdTVGR0z.js} +1 -1
- package/dist/chunks/{connect-multichain-B5TudJIg.js → connect-multichain-BrcN2dNL.js} +9 -9
- package/dist/chunks/{dist-CgyqdZZP.js → dist-B5EhMLUz.js} +3 -3
- package/dist/chunks/{dist-DxDvLdBX.js → dist-BQ3n2-E0.js} +2 -2
- package/dist/chunks/{index-CF-D_uxJ.js → index-1dDAk3NM.js} +1 -1
- package/dist/chunks/{index-CxHFTZ5V.js → index-C6Fwd4Bo.js} +1 -1
- package/dist/chunks/{index-BJAiOYNA.js → index-D6FuIfZo.js} +127 -131
- package/dist/chunks/{index-BMvT5fJ_.js → index-Dq_OOR8t.js} +2 -2
- package/dist/chunks/{mountEngine-DURf9AtR.js → mountEngine-DLOTZV_w.js} +8118 -8166
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/network/places/index.d.ts +1 -2
- package/dist/types/types.d.ts +5 -5
- package/dist/types/ui/flowConfig.d.ts +1 -0
- package/dist/types/ui/kycValidation.d.ts +1 -5
- package/dist/types/ui/paymentFlow.d.ts +3 -1
- package/dist/types/ui/react/AssetSelectScreen/AssetSelectOption.d.ts +2 -1
- package/dist/types/ui/react/OptionButton.d.ts +2 -1
- package/dist/types/ui/react/checkoutStore.d.ts +0 -4
- package/dist/types/ui/regionDirectory.d.ts +2 -7
- package/package.json +1 -1
- package/dist/types/ui/kycRegions.d.ts +0 -12
- package/dist/types/ui/react/useRegionOptions.d.ts +0 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
return typeof e == "string" &&
|
|
1
|
+
const E = ["USD", "TRY", "PHP"];
|
|
2
|
+
function U(e) {
|
|
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
|
|
8
|
+
class O extends Error {
|
|
9
9
|
constructor({
|
|
10
10
|
statusText: t,
|
|
11
11
|
errorCode: a,
|
|
@@ -14,19 +14,19 @@ class W extends Error {
|
|
|
14
14
|
super(t, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
17
|
+
async function m(e) {
|
|
18
18
|
const t = await e.clone().json().catch(() => null);
|
|
19
|
-
return new
|
|
19
|
+
return new O({
|
|
20
20
|
statusText: e.statusText,
|
|
21
|
-
errorCode:
|
|
21
|
+
errorCode: F(t),
|
|
22
22
|
response: e
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function F(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 y {
|
|
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.
|
|
@@ -44,7 +44,7 @@ class u {
|
|
|
44
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
45
|
if (s.ok)
|
|
46
46
|
return await s.json();
|
|
47
|
-
throw await
|
|
47
|
+
throw await m(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
|
|
@@ -53,22 +53,21 @@ class u {
|
|
|
53
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
54
|
if (s.ok)
|
|
55
55
|
return await s.text();
|
|
56
|
-
throw await
|
|
56
|
+
throw await m(s);
|
|
57
57
|
}
|
|
58
58
|
async requestWithFormData(t, a) {
|
|
59
59
|
const n = `${this.baseUri}${t}`, o = this.headers(), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
|
|
60
60
|
if (s.ok)
|
|
61
61
|
return await s.json();
|
|
62
|
-
throw await
|
|
62
|
+
throw await m(s);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
const c = "transaction",
|
|
65
|
+
const c = "transaction", W = [
|
|
66
66
|
"firstName",
|
|
67
67
|
"lastName",
|
|
68
68
|
"email",
|
|
69
69
|
"street",
|
|
70
70
|
"city",
|
|
71
|
-
"subdivision",
|
|
72
71
|
"region",
|
|
73
72
|
"postalCode",
|
|
74
73
|
"country",
|
|
@@ -81,7 +80,7 @@ const c = "transaction", x = [
|
|
|
81
80
|
"nationalIDNumber",
|
|
82
81
|
"customerIDNumber"
|
|
83
82
|
];
|
|
84
|
-
class
|
|
83
|
+
class $ extends y {
|
|
85
84
|
async getCryptoTransaction(t) {
|
|
86
85
|
return await this.request(`/${c}/${t}`);
|
|
87
86
|
}
|
|
@@ -123,7 +122,7 @@ class B extends u {
|
|
|
123
122
|
}
|
|
124
123
|
async kycVerification(t, a) {
|
|
125
124
|
const n = new FormData();
|
|
126
|
-
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) => {
|
|
127
126
|
const r = a[o];
|
|
128
127
|
r && n.append(o, r);
|
|
129
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(
|
|
@@ -146,7 +145,7 @@ function Y(e, t) {
|
|
|
146
145
|
});
|
|
147
146
|
}
|
|
148
147
|
const k = "customer/otp";
|
|
149
|
-
class
|
|
148
|
+
class x extends y {
|
|
150
149
|
// PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
|
|
151
150
|
async sendCustomerOTP(t) {
|
|
152
151
|
return await this.requestText(`/${k}`, {
|
|
@@ -162,23 +161,17 @@ class M extends u {
|
|
|
162
161
|
});
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
|
-
const
|
|
166
|
-
class
|
|
164
|
+
const B = "places", M = { "X-User": "lydian" };
|
|
165
|
+
class _ extends y {
|
|
167
166
|
async getCountries(t) {
|
|
168
|
-
return await this.request(`/${
|
|
169
|
-
headers:
|
|
167
|
+
return await this.request(`/${B}/countries`, {
|
|
168
|
+
headers: M,
|
|
170
169
|
signal: t
|
|
171
170
|
});
|
|
172
171
|
}
|
|
173
|
-
async getStates(t, a) {
|
|
174
|
-
return await this.request(
|
|
175
|
-
`/${C}/states?country=${encodeURIComponent(t)}`,
|
|
176
|
-
{ headers: P, signal: a }
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
172
|
}
|
|
180
173
|
const l = "session";
|
|
181
|
-
class
|
|
174
|
+
class q extends y {
|
|
182
175
|
async createSession(t) {
|
|
183
176
|
return await this.request(`/${l}`, {
|
|
184
177
|
method: "POST",
|
|
@@ -214,11 +207,11 @@ class _ extends u {
|
|
|
214
207
|
});
|
|
215
208
|
}
|
|
216
209
|
}
|
|
217
|
-
class
|
|
210
|
+
class v extends y {
|
|
218
211
|
}
|
|
219
|
-
Y(
|
|
220
|
-
const
|
|
221
|
-
var
|
|
212
|
+
Y(v, [$, x, _, q]);
|
|
213
|
+
const G = v;
|
|
214
|
+
var d = {
|
|
222
215
|
COMPLIANCE_PENDING: -10,
|
|
223
216
|
API_CANCELLED: -9,
|
|
224
217
|
PAYMENT_TIMEOUT: -8,
|
|
@@ -235,21 +228,21 @@ var y = {
|
|
|
235
228
|
FRAUD: -1,
|
|
236
229
|
PENDING: 0,
|
|
237
230
|
SUCCESS: 1
|
|
238
|
-
},
|
|
231
|
+
}, j = {
|
|
239
232
|
PARTIALLY_PAID: 1,
|
|
240
233
|
OVERPAID: 3
|
|
241
|
-
},
|
|
234
|
+
}, H = {
|
|
242
235
|
PENDING: 0,
|
|
243
236
|
CONFIRMED: 1
|
|
244
|
-
},
|
|
237
|
+
}, w = {
|
|
245
238
|
dev: "https://api.lydian.dev",
|
|
246
239
|
sandbox: "https://api.sandbox.lydian.com",
|
|
247
240
|
prod: "https://api.lydian.com"
|
|
248
241
|
};
|
|
249
|
-
function
|
|
250
|
-
return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ?
|
|
242
|
+
function K(e) {
|
|
243
|
+
return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? w.dev : e.sandbox ? w.sandbox : w.prod;
|
|
251
244
|
}
|
|
252
|
-
function
|
|
245
|
+
function S({
|
|
253
246
|
options: e,
|
|
254
247
|
unsupportedKeys: t,
|
|
255
248
|
entryPoint: a
|
|
@@ -257,14 +250,14 @@ function A({
|
|
|
257
250
|
const n = t.filter((o) => e[o] !== void 0);
|
|
258
251
|
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.`;
|
|
259
252
|
}
|
|
260
|
-
function
|
|
253
|
+
function D(e) {
|
|
261
254
|
var t;
|
|
262
255
|
return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
|
|
263
256
|
}
|
|
264
|
-
function
|
|
265
|
-
return e.gatewayUrl === void 0 ||
|
|
257
|
+
function A(e) {
|
|
258
|
+
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)}`;
|
|
266
259
|
}
|
|
267
|
-
function
|
|
260
|
+
function z(e) {
|
|
268
261
|
let t;
|
|
269
262
|
try {
|
|
270
263
|
t = new URL(e);
|
|
@@ -274,19 +267,19 @@ function K(e) {
|
|
|
274
267
|
return (t.protocol === "http:" || t.protocol === "https:") && t.pathname === "/" && t.search === "" && t.hash === "";
|
|
275
268
|
}
|
|
276
269
|
function ue(e) {
|
|
277
|
-
return e !== null && !
|
|
270
|
+
return e !== null && !u(e) && !!e.publishableKey;
|
|
278
271
|
}
|
|
279
272
|
function ye(e) {
|
|
280
|
-
return e !== null && !
|
|
273
|
+
return e !== null && !u(e);
|
|
281
274
|
}
|
|
282
275
|
function pe({
|
|
283
276
|
options: e,
|
|
284
277
|
session: t,
|
|
285
278
|
settled: a
|
|
286
279
|
}) {
|
|
287
|
-
return !a && t !== null && e !== null &&
|
|
280
|
+
return !a && t !== null && e !== null && u(e);
|
|
288
281
|
}
|
|
289
|
-
function
|
|
282
|
+
function N(e, t, a) {
|
|
290
283
|
try {
|
|
291
284
|
e == null || e(t, a);
|
|
292
285
|
} catch (n) {
|
|
@@ -304,69 +297,69 @@ function p(e) {
|
|
|
304
297
|
}
|
|
305
298
|
return t.protocol === "https:" || t.protocol === "http:" ? e : void 0;
|
|
306
299
|
}
|
|
307
|
-
async function
|
|
300
|
+
async function J({
|
|
308
301
|
api: e,
|
|
309
302
|
options: t,
|
|
310
303
|
emit: a
|
|
311
304
|
}) {
|
|
312
305
|
try {
|
|
313
|
-
const n = await
|
|
306
|
+
const n = await X({ api: e, options: t }), { session: o, sessionPromoted: r } = await V({ api: e, sessionID: n });
|
|
314
307
|
a("session.loaded", Z(o));
|
|
315
|
-
const s = await
|
|
308
|
+
const s = await ee({
|
|
316
309
|
api: e,
|
|
317
310
|
transactionID: o.transactionID
|
|
318
311
|
});
|
|
319
312
|
return { ok: !0, session: o, sessionPromoted: r, linkedTransaction: s };
|
|
320
313
|
} catch (n) {
|
|
321
|
-
return { ok: !1, ...await
|
|
314
|
+
return { ok: !1, ...await Q(n) };
|
|
322
315
|
}
|
|
323
316
|
}
|
|
324
|
-
async function
|
|
317
|
+
async function Q(e) {
|
|
325
318
|
const t = e instanceof Error ? e.cause : void 0;
|
|
326
319
|
if (!(t instanceof Response && t.status === 404))
|
|
327
320
|
return {};
|
|
328
321
|
try {
|
|
329
322
|
const n = await t.json();
|
|
330
323
|
return {
|
|
331
|
-
failureURL:
|
|
332
|
-
cancelURL:
|
|
324
|
+
failureURL: C(n == null ? void 0 : n.failureURL),
|
|
325
|
+
cancelURL: C(n == null ? void 0 : n.cancelURL)
|
|
333
326
|
};
|
|
334
327
|
} catch {
|
|
335
328
|
return {};
|
|
336
329
|
}
|
|
337
330
|
}
|
|
338
|
-
function
|
|
331
|
+
function C(e) {
|
|
339
332
|
return typeof e == "string" ? p(e) : void 0;
|
|
340
333
|
}
|
|
341
|
-
async function
|
|
334
|
+
async function X({
|
|
342
335
|
api: e,
|
|
343
336
|
options: t
|
|
344
337
|
}) {
|
|
345
|
-
return
|
|
338
|
+
return u(t) ? t.sessionID : (await e.createSession({
|
|
346
339
|
amount: t.transaction.amount,
|
|
347
340
|
amountCurrency: t.transaction.currency,
|
|
348
341
|
descriptor: t.transaction.descriptor,
|
|
349
342
|
referenceNumber: t.transaction.referenceNumber
|
|
350
343
|
})).sessionID;
|
|
351
344
|
}
|
|
352
|
-
async function
|
|
345
|
+
async function V({
|
|
353
346
|
api: e,
|
|
354
347
|
sessionID: t
|
|
355
348
|
}) {
|
|
356
349
|
const a = await e.getSession(t);
|
|
357
|
-
return { session: a, sessionPromoted:
|
|
350
|
+
return { session: a, sessionPromoted: I(a) };
|
|
358
351
|
}
|
|
359
352
|
function Z(e) {
|
|
360
353
|
return {
|
|
361
354
|
sessionID: e.sessionID,
|
|
362
355
|
merchantName: e.merchantName,
|
|
363
|
-
alreadyPromoted:
|
|
356
|
+
alreadyPromoted: I(e)
|
|
364
357
|
};
|
|
365
358
|
}
|
|
366
|
-
function
|
|
359
|
+
function I(e) {
|
|
367
360
|
return !!e.transactionID;
|
|
368
361
|
}
|
|
369
|
-
async function
|
|
362
|
+
async function ee({
|
|
370
363
|
api: e,
|
|
371
364
|
transactionID: t
|
|
372
365
|
}) {
|
|
@@ -378,7 +371,7 @@ async function V({
|
|
|
378
371
|
return console.error("Failed to resolve the session transaction:", a), null;
|
|
379
372
|
}
|
|
380
373
|
}
|
|
381
|
-
function
|
|
374
|
+
function P({
|
|
382
375
|
message: e,
|
|
383
376
|
reason: t,
|
|
384
377
|
shouldEndCheckout: a,
|
|
@@ -398,7 +391,7 @@ function E({
|
|
|
398
391
|
}
|
|
399
392
|
};
|
|
400
393
|
}
|
|
401
|
-
const
|
|
394
|
+
const te = {
|
|
402
395
|
"common.cancelTransaction": "Cancel Transaction",
|
|
403
396
|
"common.cancel": "Cancel",
|
|
404
397
|
"common.back": "Back",
|
|
@@ -473,17 +466,16 @@ const ee = {
|
|
|
473
466
|
"kyc.lastNameLabel": "Last name",
|
|
474
467
|
"kyc.lastNamePlaceholder": "Enter last name",
|
|
475
468
|
"kyc.emailPlaceholder": "Enter email address",
|
|
476
|
-
"kyc.streetLabel": "Address",
|
|
469
|
+
"kyc.streetLabel": "Address line 1",
|
|
477
470
|
"kyc.streetPlaceholder": "Enter address",
|
|
478
|
-
"kyc.
|
|
479
|
-
"kyc.
|
|
480
|
-
"kyc.
|
|
481
|
-
"kyc.
|
|
482
|
-
"kyc.
|
|
483
|
-
"kyc.
|
|
484
|
-
"kyc.
|
|
485
|
-
"kyc.
|
|
486
|
-
"kyc.postalCodePlaceholder": "Enter ZIP or postal code",
|
|
471
|
+
"kyc.street2Label": "Address line 2 (optional)",
|
|
472
|
+
"kyc.street2Placeholder": "Enter address",
|
|
473
|
+
"kyc.regionLabel": "State or province",
|
|
474
|
+
"kyc.regionPlaceholder": "Enter state or province",
|
|
475
|
+
"kyc.cityLabel": "Town or city",
|
|
476
|
+
"kyc.cityPlaceholder": "Enter town or city",
|
|
477
|
+
"kyc.postalCodeLabel": "Postcode",
|
|
478
|
+
"kyc.postalCodePlaceholder": "Enter postcode",
|
|
487
479
|
"kyc.walletAddressLabel": "Wallet address",
|
|
488
480
|
"kyc.walletAddressPlaceholder": "Enter wallet address",
|
|
489
481
|
"kyc.dateOfBirthLabel": "Date of birth",
|
|
@@ -491,6 +483,7 @@ const ee = {
|
|
|
491
483
|
"kyc.dateAndPlaceOfBirthChoice": "Place and date of birth",
|
|
492
484
|
"kyc.physicalAddressChoice": "Address",
|
|
493
485
|
"kyc.cityOfBirthLabel": "City of birth",
|
|
486
|
+
"kyc.cityOfBirthPlaceholder": "Enter city",
|
|
494
487
|
"kyc.nationalIdLabel": "ID number",
|
|
495
488
|
"kyc.nationalIdPlaceholder": "Enter 16-digit ID number",
|
|
496
489
|
"kyc.nationalIdChoice": "National ID number",
|
|
@@ -617,6 +610,7 @@ const ee = {
|
|
|
617
610
|
"errors.assetNetworkRequired": "Choose a coin and network to continue.",
|
|
618
611
|
"errors.notInitialized": "Checkout isn't ready yet. Please refresh the page and try again.",
|
|
619
612
|
"errors.paymentCouldNotComplete": "Your payment could not be completed. Please try again and choose an available payment method.",
|
|
613
|
+
"errors.paymentShortRefundRequested": "Less than the full amount arrived, so this payment can't be completed. A refund of the amount received has been requested.",
|
|
620
614
|
"errors.unableToCollectUnderpaid": "We couldn't set up the remaining balance. Please try again.",
|
|
621
615
|
"errors.paymentTimedOut": "Your payment timed out. Please try again and choose an available payment method.",
|
|
622
616
|
"errors.paymentStatusUnavailable": "We’re having trouble confirming your payment. If you’ve already sent it, it will still be picked up — keep this page open.",
|
|
@@ -644,34 +638,35 @@ const ee = {
|
|
|
644
638
|
"validation.customerDetailsMissing": "Customer details are missing.",
|
|
645
639
|
"validation.invalidOtp": "Please enter a valid 6-digit code.",
|
|
646
640
|
"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>.'
|
|
647
|
-
},
|
|
648
|
-
let
|
|
641
|
+
}, T = { en: te }, L = "en";
|
|
642
|
+
let R = L;
|
|
649
643
|
function he() {
|
|
650
|
-
return
|
|
644
|
+
return R;
|
|
651
645
|
}
|
|
652
|
-
function
|
|
646
|
+
function h(e, t) {
|
|
653
647
|
var n;
|
|
654
|
-
const a = ((n =
|
|
648
|
+
const a = ((n = T[R]) == null ? void 0 : n[e]) ?? T[L][e] ?? e;
|
|
655
649
|
return t ? a.replace(
|
|
656
650
|
/\{(\w+)\}/g,
|
|
657
651
|
(o, r) => t[r] != null ? String(t[r]) : `{${r}}`
|
|
658
652
|
) : a;
|
|
659
653
|
}
|
|
660
|
-
function
|
|
661
|
-
return e ===
|
|
654
|
+
function ae(e) {
|
|
655
|
+
return e === d.SUCCESS ? "succeeded" : e < d.PENDING && e !== d.KYC_VERIFICATION_PENDING && e !== d.COMPLIANCE_PENDING ? "failed" : "active";
|
|
662
656
|
}
|
|
663
|
-
function
|
|
657
|
+
function ne({
|
|
664
658
|
transaction: e,
|
|
665
659
|
session: t
|
|
666
660
|
}) {
|
|
667
661
|
var o, r, s;
|
|
668
|
-
const a =
|
|
662
|
+
const a = ae(e.status);
|
|
669
663
|
if (a === "active")
|
|
670
664
|
return null;
|
|
671
|
-
if (a === "failed")
|
|
665
|
+
if (a === "failed") {
|
|
666
|
+
const i = e.status === d.PAYMENT_TIMEOUT && e.paymentStatus === j.PARTIALLY_PAID;
|
|
672
667
|
return {
|
|
673
668
|
outcome: a,
|
|
674
|
-
message:
|
|
669
|
+
message: h(i ? "errors.paymentShortRefundRequested" : "errors.paymentCouldNotComplete"),
|
|
675
670
|
failure: {
|
|
676
671
|
shouldEndCheckout: !0,
|
|
677
672
|
// Negative (non-KYC) status — cancelled / fraud / timeout.
|
|
@@ -680,8 +675,9 @@ function ae({
|
|
|
680
675
|
redirectURL: p(t == null ? void 0 : t.failureURL)
|
|
681
676
|
}
|
|
682
677
|
};
|
|
678
|
+
}
|
|
683
679
|
const n = (o = e.payments) == null ? void 0 : o.find(
|
|
684
|
-
(i) => i.status ===
|
|
680
|
+
(i) => i.status === H.CONFIRMED
|
|
685
681
|
);
|
|
686
682
|
return {
|
|
687
683
|
outcome: a,
|
|
@@ -701,13 +697,13 @@ function ae({
|
|
|
701
697
|
}
|
|
702
698
|
};
|
|
703
699
|
}
|
|
704
|
-
function
|
|
700
|
+
function oe() {
|
|
705
701
|
let e = null;
|
|
706
702
|
return {
|
|
707
703
|
setOptions: (t) => {
|
|
708
704
|
e = t;
|
|
709
705
|
},
|
|
710
|
-
emit: (t, a) =>
|
|
706
|
+
emit: (t, a) => N(e == null ? void 0 : e.onEvent, t, a),
|
|
711
707
|
paymentFailed: (t, a) => {
|
|
712
708
|
var n;
|
|
713
709
|
return (n = e == null ? void 0 : e.paymentFailedListener) == null ? void 0 : n.call(e, t, a);
|
|
@@ -722,7 +718,7 @@ function ne() {
|
|
|
722
718
|
}
|
|
723
719
|
};
|
|
724
720
|
}
|
|
725
|
-
class
|
|
721
|
+
class re extends HTMLElement {
|
|
726
722
|
constructor() {
|
|
727
723
|
super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
|
|
728
724
|
}
|
|
@@ -732,7 +728,7 @@ class oe extends HTMLElement {
|
|
|
732
728
|
this.isTornDown = !1;
|
|
733
729
|
}
|
|
734
730
|
async initialize(t) {
|
|
735
|
-
const a =
|
|
731
|
+
const a = se(t), n = ie({ api: a, options: t }), o = await this.loadEngine(t, n);
|
|
736
732
|
!o || this.isTornDown || (this.engine = o, await o.initialize(t, { api: a, sessionLoad: n }));
|
|
737
733
|
}
|
|
738
734
|
async loadEngine(t, a) {
|
|
@@ -760,7 +756,7 @@ class oe extends HTMLElement {
|
|
|
760
756
|
// Not started in the constructor: a page can carry the tag and never check out.
|
|
761
757
|
// Overlapping initialize() calls share one download.
|
|
762
758
|
getOrLoadEngine() {
|
|
763
|
-
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-
|
|
759
|
+
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-DLOTZV_w.js").then((t) => t.m).then((t) => {
|
|
764
760
|
const a = t.mountCheckoutEngine({
|
|
765
761
|
host: this,
|
|
766
762
|
shadowRoot: this.shadow
|
|
@@ -793,9 +789,9 @@ class oe extends HTMLElement {
|
|
|
793
789
|
const n = await a;
|
|
794
790
|
if (this.isDismissedByHost)
|
|
795
791
|
return;
|
|
796
|
-
const o =
|
|
792
|
+
const o = oe();
|
|
797
793
|
o.setOptions(t);
|
|
798
|
-
const r = n.ok && n.linkedTransaction ?
|
|
794
|
+
const r = n.ok && n.linkedTransaction ? ne({
|
|
799
795
|
transaction: n.linkedTransaction,
|
|
800
796
|
session: n.session
|
|
801
797
|
}) : null;
|
|
@@ -816,7 +812,7 @@ class oe extends HTMLElement {
|
|
|
816
812
|
return;
|
|
817
813
|
}
|
|
818
814
|
if (!n.ok && n.failureURL) {
|
|
819
|
-
const g =
|
|
815
|
+
const g = h("errors.unableToCreateSession"), b = P({
|
|
820
816
|
message: g,
|
|
821
817
|
reason: "sessionExpired",
|
|
822
818
|
shouldEndCheckout: !0,
|
|
@@ -825,7 +821,7 @@ class oe extends HTMLElement {
|
|
|
825
821
|
o.emit("payment.failed", b.event), o.paymentFailed(g, b.failure);
|
|
826
822
|
return;
|
|
827
823
|
}
|
|
828
|
-
const s =
|
|
824
|
+
const s = h("errors.checkoutUnavailable"), i = P({
|
|
829
825
|
message: s,
|
|
830
826
|
reason: "error",
|
|
831
827
|
shouldEndCheckout: !0,
|
|
@@ -839,38 +835,38 @@ class oe extends HTMLElement {
|
|
|
839
835
|
t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
|
|
840
836
|
}
|
|
841
837
|
}
|
|
842
|
-
function
|
|
843
|
-
return new
|
|
844
|
-
|
|
845
|
-
|
|
838
|
+
function se(e) {
|
|
839
|
+
return new G(
|
|
840
|
+
K(e),
|
|
841
|
+
u(e) ? void 0 : e.publishableKey
|
|
846
842
|
);
|
|
847
843
|
}
|
|
848
|
-
function
|
|
844
|
+
function ie({
|
|
849
845
|
api: e,
|
|
850
846
|
options: t
|
|
851
847
|
}) {
|
|
852
|
-
return
|
|
848
|
+
return J({
|
|
853
849
|
api: e,
|
|
854
850
|
options: t,
|
|
855
|
-
emit: (a, n) =>
|
|
851
|
+
emit: (a, n) => N(t.onEvent, a, n)
|
|
856
852
|
});
|
|
857
853
|
}
|
|
858
|
-
customElements.get("lydian-checkout") || customElements.define("lydian-checkout",
|
|
854
|
+
customElements.get("lydian-checkout") || customElements.define("lydian-checkout", re);
|
|
859
855
|
function f() {
|
|
860
856
|
return document.querySelector("lydian-checkout");
|
|
861
857
|
}
|
|
862
|
-
async function
|
|
858
|
+
async function ce(e) {
|
|
863
859
|
if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
|
|
864
860
|
throw new Error("SDK initialization requires publishableKey and a transaction");
|
|
865
|
-
const t =
|
|
861
|
+
const t = D(e);
|
|
866
862
|
if (t)
|
|
867
863
|
throw new Error(t);
|
|
868
|
-
const a =
|
|
864
|
+
const a = A(e);
|
|
869
865
|
if (a)
|
|
870
866
|
throw new Error(a);
|
|
871
|
-
if (!
|
|
872
|
-
throw new Error("Invalid value for currency, valid values are: " +
|
|
873
|
-
const n =
|
|
867
|
+
if (!U(e.transaction.currency))
|
|
868
|
+
throw new Error("Invalid value for currency, valid values are: " + E.join(", "));
|
|
869
|
+
const n = S({
|
|
874
870
|
options: e,
|
|
875
871
|
unsupportedKeys: ["sessionID"],
|
|
876
872
|
entryPoint: "init"
|
|
@@ -879,16 +875,16 @@ async function ie(e) {
|
|
|
879
875
|
throw new Error(n);
|
|
880
876
|
await f().initialize(e);
|
|
881
877
|
}
|
|
882
|
-
async function
|
|
878
|
+
async function le(e) {
|
|
883
879
|
if (!e.sessionID)
|
|
884
880
|
throw new Error("initExistingSession requires a sessionID");
|
|
885
|
-
const t =
|
|
881
|
+
const t = D(e);
|
|
886
882
|
if (t)
|
|
887
883
|
throw new Error(t);
|
|
888
|
-
const a =
|
|
884
|
+
const a = A(e);
|
|
889
885
|
if (a)
|
|
890
886
|
throw new Error(a);
|
|
891
|
-
const n =
|
|
887
|
+
const n = S({
|
|
892
888
|
options: e,
|
|
893
889
|
unsupportedKeys: ["publishableKey", "transaction"],
|
|
894
890
|
entryPoint: "initExistingSession"
|
|
@@ -897,31 +893,31 @@ async function ce(e) {
|
|
|
897
893
|
throw new Error(n);
|
|
898
894
|
await f().initialize(e);
|
|
899
895
|
}
|
|
900
|
-
async function
|
|
896
|
+
async function de(e) {
|
|
901
897
|
await f().updateTransaction(e);
|
|
902
898
|
}
|
|
903
|
-
window.Lydian = { init:
|
|
899
|
+
window.Lydian = { init: ce, initExistingSession: le, updateTransaction: de };
|
|
904
900
|
export {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
901
|
+
O as G,
|
|
902
|
+
j as P,
|
|
903
|
+
d as T,
|
|
904
|
+
H as a,
|
|
909
905
|
ye as b,
|
|
910
|
-
|
|
911
|
-
|
|
906
|
+
E as c,
|
|
907
|
+
V as d,
|
|
912
908
|
Z as e,
|
|
913
|
-
|
|
909
|
+
ee as f,
|
|
914
910
|
he as g,
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
911
|
+
u as h,
|
|
912
|
+
U as i,
|
|
913
|
+
ae as j,
|
|
914
|
+
ne as k,
|
|
915
|
+
I as l,
|
|
920
916
|
pe as m,
|
|
921
|
-
|
|
917
|
+
P as n,
|
|
922
918
|
ue as o,
|
|
923
|
-
|
|
924
|
-
|
|
919
|
+
oe as p,
|
|
920
|
+
X as r,
|
|
925
921
|
p as s,
|
|
926
|
-
|
|
922
|
+
h as t
|
|
927
923
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as Si, g as wi } from "./mountEngine-
|
|
2
|
-
import { r as Ti } from "./index-
|
|
1
|
+
import { d as Si, g as wi } from "./mountEngine-DLOTZV_w.js";
|
|
2
|
+
import { r as Ti } from "./index-1dDAk3NM.js";
|
|
3
3
|
function Pi(r, u) {
|
|
4
4
|
for (var f = 0; f < u.length; f++) {
|
|
5
5
|
const h = u[f];
|