@lydianpay/sdk-web 3.19.0 → 3.19.2
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-LUCPMqOV.js → browser-DCxGA3mE.js} +1 -1
- package/dist/chunks/{connect-multichain-ZoZGkReI.js → connect-multichain-CnxV2mL-.js} +9 -9
- package/dist/chunks/{dist-YaXkB10_.js → dist-CEYumuMG.js} +3 -3
- package/dist/chunks/{dist-RcKY9RHt.js → dist-DEg4yPGg.js} +2 -2
- package/dist/chunks/{index-d1CYqhfC.js → index-2aSnC3v4.js} +111 -99
- package/dist/chunks/{index-0LgMrBt6.js → index-Bw-rhy5J.js} +1 -1
- package/dist/chunks/{index-R_sAPlVY.js → index-DNZJZZug.js} +2 -2
- package/dist/chunks/{index-Ll9MJfyW.js → index-DT_xZLwf.js} +1 -1
- package/dist/chunks/{mountEngine-Zn0WefMk.js → mountEngine-D2BUJ6XE.js} +4 -4
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/ui/kycFlow.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Va = Object.defineProperty;
|
|
2
2
|
var Ka = (e, t, r) => t in e ? Va(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var Ee = (e, t, r) => Ka(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { E as Ja } from "./index-
|
|
5
|
-
import { g as ri, c as gr } from "./mountEngine-
|
|
4
|
+
import { E as Ja } from "./index-Bw-rhy5J.js";
|
|
5
|
+
import { g as ri, c as gr } from "./mountEngine-D2BUJ6XE.js";
|
|
6
6
|
var _r = { exports: {} }, on, Hi;
|
|
7
7
|
function Ya() {
|
|
8
8
|
if (Hi) return on;
|
|
@@ -7879,7 +7879,7 @@ var Cn, Rs, Is, Fs, qe, gt, _t, xr, Bs, Os, Cr, zt, Ps, Ns, Ds, ta, ra = V({
|
|
|
7879
7879
|
}
|
|
7880
7880
|
getActiveSession() {
|
|
7881
7881
|
return S(this, null, function* () {
|
|
7882
|
-
const { kvstore: e } = this, { SessionStore: t } = yield import("./index-
|
|
7882
|
+
const { kvstore: e } = this, { SessionStore: t } = yield import("./index-DNZJZZug.js").then((n) => n.i), r = yield t.create(e);
|
|
7883
7883
|
try {
|
|
7884
7884
|
const [n] = yield r.list();
|
|
7885
7885
|
return n;
|
|
@@ -8058,7 +8058,7 @@ Xr(na, {
|
|
|
8058
8058
|
});
|
|
8059
8059
|
function Qd() {
|
|
8060
8060
|
return S(this, null, function* () {
|
|
8061
|
-
const { decrypt: e, encrypt: t, PrivateKey: r, PublicKey: n } = yield import("./index-
|
|
8061
|
+
const { decrypt: e, encrypt: t, PrivateKey: r, PublicKey: n } = yield import("./index-DT_xZLwf.js").then((i) => i.i);
|
|
8062
8062
|
return {
|
|
8063
8063
|
generateKeyPair() {
|
|
8064
8064
|
const i = new r();
|
|
@@ -9329,12 +9329,12 @@ Ta = function() {
|
|
|
9329
9329
|
Ui = function() {
|
|
9330
9330
|
return S(this, null, function* () {
|
|
9331
9331
|
const [e, { DappClient: t }, { createKeyManager: r }] = yield Promise.all([
|
|
9332
|
-
import("./index-
|
|
9333
|
-
import("./dist-
|
|
9332
|
+
import("./index-DNZJZZug.js").then((h) => h.i),
|
|
9333
|
+
import("./dist-CEYumuMG.js"),
|
|
9334
9334
|
Promise.resolve().then(() => (eh(), na))
|
|
9335
9335
|
]), n = yield r(), { adapter: i } = this.options.storage, o = yield e.SessionStore.create(i), l = (
|
|
9336
9336
|
// eslint-disable-next-line no-negated-condition
|
|
9337
|
-
typeof window < "u" ? WebSocket : (yield import("./browser-
|
|
9337
|
+
typeof window < "u" ? WebSocket : (yield import("./browser-DCxGA3mE.js").then((h) => h.b)).WebSocket
|
|
9338
9338
|
), c = yield e.WebSocketTransport.create({
|
|
9339
9339
|
url: uh,
|
|
9340
9340
|
kvstore: i,
|
|
@@ -9399,7 +9399,7 @@ Ba = function(e, t, r, n) {
|
|
|
9399
9399
|
/* MWP */
|
|
9400
9400
|
);
|
|
9401
9401
|
})).catch((c) => S(this, null, function* () {
|
|
9402
|
-
const { ProtocolError: d, ErrorCode: h } = yield import("./index-
|
|
9402
|
+
const { ProtocolError: d, ErrorCode: h } = yield import("./index-DNZJZZug.js").then((y) => y.i);
|
|
9403
9403
|
if (c instanceof d)
|
|
9404
9404
|
c.code !== h.REQUEST_EXPIRED && (this.status = "disconnected", yield this.options.ui.factory.unload(c), i.reject(c));
|
|
9405
9405
|
else {
|
|
@@ -9456,7 +9456,7 @@ Pa = function(e, t, r) {
|
|
|
9456
9456
|
/* MWP */
|
|
9457
9457
|
);
|
|
9458
9458
|
} catch (i) {
|
|
9459
|
-
const { ProtocolError: o } = yield import("./index-
|
|
9459
|
+
const { ProtocolError: o } = yield import("./index-DNZJZZug.js").then((l) => l.i);
|
|
9460
9460
|
throw this.status = "disconnected", yield this.storage.removeTransportType(), i instanceof o || i instanceof Error ? i : new Error(String(i));
|
|
9461
9461
|
} finally {
|
|
9462
9462
|
this.dappClient.off("session_request", n);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
2
|
var S = (e, t, n) => t in e ? f(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var h = (e, t, n) => S(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { d as s } from "./index-
|
|
5
|
-
import { v as w } from "./connect-multichain-
|
|
6
|
-
import { a as l } from "./mountEngine-
|
|
4
|
+
import { d as s } from "./index-DNZJZZug.js";
|
|
5
|
+
import { v as w } from "./connect-multichain-CnxV2mL-.js";
|
|
6
|
+
import { a as l } from "./mountEngine-D2BUJ6XE.js";
|
|
7
7
|
function m(e) {
|
|
8
8
|
var t, n;
|
|
9
9
|
return typeof ((n = (t = e == null ? void 0 : e.prototype) == null ? void 0 : t.constructor) == null ? void 0 : n.name) == "string";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Te, I as Xe, h as et, g as yn, b as vn, s as kn } from "./mountEngine-
|
|
1
|
+
import { i as Te, I as Xe, h as et, g as yn, b as vn, s as kn } from "./mountEngine-D2BUJ6XE.js";
|
|
2
2
|
import { r as En, a as In } from "./utils-Ca8X9WUu.js";
|
|
3
|
-
import { E as Cn } from "./index-
|
|
3
|
+
import { E as Cn } from "./index-Bw-rhy5J.js";
|
|
4
4
|
function Sn(t, e) {
|
|
5
5
|
if (!Te(t, { strict: !1 }))
|
|
6
6
|
throw new Xe({ address: t });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const E = ["USD", "TRY", "PHP"];
|
|
2
|
-
function
|
|
2
|
+
function U(e) {
|
|
3
3
|
return typeof e == "string" && E.includes(e);
|
|
4
4
|
}
|
|
5
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,9 +14,9 @@ class U extends Error {
|
|
|
14
14
|
super(t, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
17
|
+
async function f(e) {
|
|
18
18
|
const t = await e.clone().json().catch(() => null);
|
|
19
|
-
return new
|
|
19
|
+
return new O({
|
|
20
20
|
statusText: e.statusText,
|
|
21
21
|
errorCode: F(t),
|
|
22
22
|
response: e
|
|
@@ -44,7 +44,7 @@ class y {
|
|
|
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 f(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,13 +53,13 @@ class y {
|
|
|
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 f(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 f(s);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
const l = "transaction", W = [
|
|
@@ -144,18 +144,18 @@ function M(e, t) {
|
|
|
144
144
|
});
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
const
|
|
147
|
+
const w = "customer";
|
|
148
148
|
class Y extends y {
|
|
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(`/${w}/otp`, {
|
|
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(`/${w}/otp`, {
|
|
159
159
|
method: "PUT",
|
|
160
160
|
body: JSON.stringify(t)
|
|
161
161
|
});
|
|
@@ -163,17 +163,17 @@ class Y extends y {
|
|
|
163
163
|
// PUT /customer/pii -> the stored record, masked. Verifies the same code as
|
|
164
164
|
// PUT /customer/otp; a code serves both until it expires.
|
|
165
165
|
async getCustomerPII(t) {
|
|
166
|
-
return await this.request(`/${
|
|
166
|
+
return await this.request(`/${w}/pii`, {
|
|
167
167
|
method: "PUT",
|
|
168
168
|
body: JSON.stringify(t)
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
class
|
|
172
|
+
const _ = "places", x = { "X-User": "lydian" };
|
|
173
|
+
class B extends y {
|
|
174
174
|
async getCountries(t) {
|
|
175
|
-
return await this.request(`/${
|
|
176
|
-
headers:
|
|
175
|
+
return await this.request(`/${_}/countries`, {
|
|
176
|
+
headers: x,
|
|
177
177
|
signal: t
|
|
178
178
|
});
|
|
179
179
|
}
|
|
@@ -190,7 +190,7 @@ class q extends y {
|
|
|
190
190
|
return await this.request(`/${d}/${t}`);
|
|
191
191
|
}
|
|
192
192
|
// Promotes the session into a transaction. Allowed once per session — except
|
|
193
|
-
// that a KYC-pending (
|
|
193
|
+
// that a KYC-pending (3) response does not consume the promotion, which is
|
|
194
194
|
// what lets the restore-details flow re-promote with a customerUUID.
|
|
195
195
|
async createSessionTransaction(t, a) {
|
|
196
196
|
return await this.request(
|
|
@@ -215,12 +215,12 @@ class q extends y {
|
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
class
|
|
218
|
+
class D extends y {
|
|
219
219
|
}
|
|
220
|
-
M(
|
|
221
|
-
const G =
|
|
222
|
-
var
|
|
223
|
-
|
|
220
|
+
M(D, [$, Y, B, q]);
|
|
221
|
+
const G = D;
|
|
222
|
+
var i = {
|
|
223
|
+
SINGLE_PAYMENT_REQUIRED: -11,
|
|
224
224
|
API_CANCELLED: -9,
|
|
225
225
|
PAYMENT_TIMEOUT: -8,
|
|
226
226
|
FRAUD_DECLINED: -7,
|
|
@@ -229,28 +229,29 @@ var c = {
|
|
|
229
229
|
// continuity with the merchant dashboard's existing call sites.
|
|
230
230
|
FRAUD_HELD: -5,
|
|
231
231
|
FORFEITED: -4,
|
|
232
|
-
// A KYC-pending promote is NOT terminal and does not consume the session's
|
|
233
|
-
// one promotion — the OTP restore flow re-promotes the same session.
|
|
234
|
-
KYC_VERIFICATION_PENDING: -3,
|
|
235
232
|
CANCELLED: -2,
|
|
236
233
|
FRAUD: -1,
|
|
237
234
|
PENDING: 0,
|
|
238
|
-
SUCCESS: 1
|
|
235
|
+
SUCCESS: 1,
|
|
236
|
+
// A KYC-pending promote is NOT terminal and does not consume the session's
|
|
237
|
+
// one promotion — the OTP restore flow re-promotes the same session.
|
|
238
|
+
KYC_VERIFICATION_PENDING: 3,
|
|
239
|
+
COMPLIANCE_PENDING: 10
|
|
239
240
|
}, H = {
|
|
240
241
|
PARTIALLY_PAID: 1,
|
|
241
242
|
OVERPAID: 3
|
|
242
|
-
},
|
|
243
|
+
}, j = {
|
|
243
244
|
PENDING: 0,
|
|
244
245
|
CONFIRMED: 1
|
|
245
|
-
},
|
|
246
|
+
}, g = {
|
|
246
247
|
dev: "https://api.lydian.dev",
|
|
247
248
|
sandbox: "https://api.sandbox.lydian.com",
|
|
248
249
|
prod: "https://api.lydian.com"
|
|
249
250
|
};
|
|
250
|
-
function
|
|
251
|
-
return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ?
|
|
251
|
+
function K(e) {
|
|
252
|
+
return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? g.dev : e.sandbox ? g.sandbox : g.prod;
|
|
252
253
|
}
|
|
253
|
-
function
|
|
254
|
+
function S({
|
|
254
255
|
options: e,
|
|
255
256
|
unsupportedKeys: t,
|
|
256
257
|
entryPoint: a
|
|
@@ -258,11 +259,11 @@ function v({
|
|
|
258
259
|
const n = t.filter((o) => e[o] !== void 0);
|
|
259
260
|
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.`;
|
|
260
261
|
}
|
|
261
|
-
function
|
|
262
|
+
function A(e) {
|
|
262
263
|
var t;
|
|
263
264
|
return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
|
|
264
265
|
}
|
|
265
|
-
function
|
|
266
|
+
function v(e) {
|
|
266
267
|
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)}`;
|
|
267
268
|
}
|
|
268
269
|
function z(e) {
|
|
@@ -274,13 +275,13 @@ function z(e) {
|
|
|
274
275
|
}
|
|
275
276
|
return (t.protocol === "http:" || t.protocol === "https:") && t.pathname === "/" && t.search === "" && t.hash === "";
|
|
276
277
|
}
|
|
277
|
-
function
|
|
278
|
+
function pe(e) {
|
|
278
279
|
return e !== null && !u(e) && !!e.publishableKey;
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
+
function he(e) {
|
|
281
282
|
return e !== null && !u(e);
|
|
282
283
|
}
|
|
283
|
-
function
|
|
284
|
+
function me({
|
|
284
285
|
options: e,
|
|
285
286
|
session: t,
|
|
286
287
|
settled: a
|
|
@@ -294,7 +295,7 @@ function I(e, t, a) {
|
|
|
294
295
|
console.error(`onEvent("${t}") threw:`, n);
|
|
295
296
|
}
|
|
296
297
|
}
|
|
297
|
-
function
|
|
298
|
+
function h(e) {
|
|
298
299
|
if (!e)
|
|
299
300
|
return;
|
|
300
301
|
let t;
|
|
@@ -306,8 +307,8 @@ function p(e) {
|
|
|
306
307
|
return t.protocol === "https:" || t.protocol === "http:" ? e : void 0;
|
|
307
308
|
}
|
|
308
309
|
const J = [
|
|
309
|
-
|
|
310
|
-
|
|
310
|
+
i.KYC_VERIFICATION_PENDING,
|
|
311
|
+
i.COMPLIANCE_PENDING
|
|
311
312
|
];
|
|
312
313
|
async function Q({
|
|
313
314
|
api: e,
|
|
@@ -341,7 +342,7 @@ async function X(e) {
|
|
|
341
342
|
}
|
|
342
343
|
}
|
|
343
344
|
function C(e) {
|
|
344
|
-
return typeof e == "string" ?
|
|
345
|
+
return typeof e == "string" ? h(e) : void 0;
|
|
345
346
|
}
|
|
346
347
|
async function V({
|
|
347
348
|
api: e,
|
|
@@ -398,7 +399,7 @@ function P({
|
|
|
398
399
|
// Only a failure that ends the checkout carries a redirect. A retryable one
|
|
399
400
|
// leaves the customer mid-flow with something still to do, and a host that
|
|
400
401
|
// navigated on it would eject them on a hiccup.
|
|
401
|
-
redirectURL: a ?
|
|
402
|
+
redirectURL: a ? h(o == null ? void 0 : o.failureURL) : void 0
|
|
402
403
|
}
|
|
403
404
|
};
|
|
404
405
|
}
|
|
@@ -653,46 +654,57 @@ const ae = {
|
|
|
653
654
|
"validation.customerDetailsMissing": "Customer details are missing.",
|
|
654
655
|
"validation.invalidOtp": "Please enter a valid 6-digit code.",
|
|
655
656
|
"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>.'
|
|
656
|
-
}, T = { en: ae },
|
|
657
|
-
let
|
|
658
|
-
function
|
|
659
|
-
return
|
|
657
|
+
}, T = { en: ae }, R = "en";
|
|
658
|
+
let L = R;
|
|
659
|
+
function fe() {
|
|
660
|
+
return L;
|
|
660
661
|
}
|
|
661
|
-
function
|
|
662
|
+
function m(e, t) {
|
|
662
663
|
var n;
|
|
663
|
-
const a = ((n = T[
|
|
664
|
+
const a = ((n = T[L]) == null ? void 0 : n[e]) ?? T[R][e] ?? e;
|
|
664
665
|
return t ? a.replace(
|
|
665
666
|
/\{(\w+)\}/g,
|
|
666
667
|
(o, r) => t[r] != null ? String(t[r]) : `{${r}}`
|
|
667
668
|
) : a;
|
|
668
669
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
670
|
+
const ne = /* @__PURE__ */ new Set([
|
|
671
|
+
i.SINGLE_PAYMENT_REQUIRED,
|
|
672
|
+
i.API_CANCELLED,
|
|
673
|
+
i.PAYMENT_TIMEOUT,
|
|
674
|
+
i.FRAUD_DECLINED,
|
|
675
|
+
i.FRAUD_REFUNDED,
|
|
676
|
+
i.FRAUD_HELD,
|
|
677
|
+
i.FORFEITED,
|
|
678
|
+
i.CANCELLED,
|
|
679
|
+
i.FRAUD
|
|
680
|
+
]);
|
|
681
|
+
function oe(e) {
|
|
682
|
+
return e === i.SUCCESS ? "succeeded" : ne.has(e) ? "failed" : "active";
|
|
683
|
+
}
|
|
684
|
+
function re({
|
|
673
685
|
transaction: e,
|
|
674
686
|
session: t
|
|
675
687
|
}) {
|
|
676
688
|
var o, r, s;
|
|
677
|
-
const a =
|
|
689
|
+
const a = oe(e.status);
|
|
678
690
|
if (a === "active")
|
|
679
691
|
return null;
|
|
680
692
|
if (a === "failed") {
|
|
681
|
-
const
|
|
693
|
+
const p = e.status === i.PAYMENT_TIMEOUT && e.paymentStatus === H.PARTIALLY_PAID || e.status === i.SINGLE_PAYMENT_REQUIRED;
|
|
682
694
|
return {
|
|
683
695
|
outcome: a,
|
|
684
|
-
message:
|
|
696
|
+
message: m(p ? "errors.paymentShortRefundRequested" : "errors.paymentCouldNotComplete"),
|
|
685
697
|
failure: {
|
|
686
698
|
shouldEndCheckout: !0,
|
|
687
699
|
// Negative (non-KYC) status — cancelled / fraud / timeout.
|
|
688
700
|
reason: "blocked",
|
|
689
701
|
transactionID: e.transactionID,
|
|
690
|
-
redirectURL:
|
|
702
|
+
redirectURL: h(t == null ? void 0 : t.failureURL)
|
|
691
703
|
}
|
|
692
704
|
};
|
|
693
705
|
}
|
|
694
706
|
const n = (o = e.payments) == null ? void 0 : o.find(
|
|
695
|
-
(
|
|
707
|
+
(c) => c.status === j.CONFIRMED
|
|
696
708
|
);
|
|
697
709
|
return {
|
|
698
710
|
outcome: a,
|
|
@@ -708,11 +720,11 @@ function oe({
|
|
|
708
720
|
asset: n == null ? void 0 : n.cryptoAsset,
|
|
709
721
|
network: n == null ? void 0 : n.cryptoNetwork,
|
|
710
722
|
completedAt: n == null ? void 0 : n.completedAt,
|
|
711
|
-
redirectURL:
|
|
723
|
+
redirectURL: h(t == null ? void 0 : t.successURL)
|
|
712
724
|
}
|
|
713
725
|
};
|
|
714
726
|
}
|
|
715
|
-
function
|
|
727
|
+
function se() {
|
|
716
728
|
let e = null;
|
|
717
729
|
return {
|
|
718
730
|
setOptions: (t) => {
|
|
@@ -733,7 +745,7 @@ function re() {
|
|
|
733
745
|
}
|
|
734
746
|
};
|
|
735
747
|
}
|
|
736
|
-
class
|
|
748
|
+
class ie extends HTMLElement {
|
|
737
749
|
constructor() {
|
|
738
750
|
super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
|
|
739
751
|
}
|
|
@@ -743,7 +755,7 @@ class se extends HTMLElement {
|
|
|
743
755
|
this.isTornDown = !1;
|
|
744
756
|
}
|
|
745
757
|
async initialize(t) {
|
|
746
|
-
const a =
|
|
758
|
+
const a = ce(t), n = le({ api: a, options: t }), o = await this.loadEngine(t, n);
|
|
747
759
|
!o || this.isTornDown || (this.engine = o, await o.initialize(t, { api: a, sessionLoad: n }));
|
|
748
760
|
}
|
|
749
761
|
async loadEngine(t, a) {
|
|
@@ -771,7 +783,7 @@ class se extends HTMLElement {
|
|
|
771
783
|
// Not started in the constructor: a page can carry the tag and never check out.
|
|
772
784
|
// Overlapping initialize() calls share one download.
|
|
773
785
|
getOrLoadEngine() {
|
|
774
|
-
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-
|
|
786
|
+
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-D2BUJ6XE.js").then((t) => t.m).then((t) => {
|
|
775
787
|
const a = t.mountCheckoutEngine({
|
|
776
788
|
host: this,
|
|
777
789
|
shadowRoot: this.shadow
|
|
@@ -804,9 +816,9 @@ class se extends HTMLElement {
|
|
|
804
816
|
const n = await a;
|
|
805
817
|
if (this.isDismissedByHost)
|
|
806
818
|
return;
|
|
807
|
-
const o =
|
|
819
|
+
const o = se();
|
|
808
820
|
o.setOptions(t);
|
|
809
|
-
const r = n.ok && n.linkedTransaction ?
|
|
821
|
+
const r = n.ok && n.linkedTransaction ? re({
|
|
810
822
|
transaction: n.linkedTransaction,
|
|
811
823
|
session: n.session
|
|
812
824
|
}) : null;
|
|
@@ -827,22 +839,22 @@ class se extends HTMLElement {
|
|
|
827
839
|
return;
|
|
828
840
|
}
|
|
829
841
|
if (!n.ok && n.failureURL) {
|
|
830
|
-
const
|
|
831
|
-
message:
|
|
842
|
+
const p = m("errors.unableToCreateSession"), k = P({
|
|
843
|
+
message: p,
|
|
832
844
|
reason: "sessionExpired",
|
|
833
845
|
shouldEndCheckout: !0,
|
|
834
846
|
session: { failureURL: n.failureURL }
|
|
835
847
|
});
|
|
836
|
-
o.emit("payment.failed", k.event), o.paymentFailed(
|
|
848
|
+
o.emit("payment.failed", k.event), o.paymentFailed(p, k.failure);
|
|
837
849
|
return;
|
|
838
850
|
}
|
|
839
|
-
const s =
|
|
851
|
+
const s = m("errors.checkoutUnavailable"), c = P({
|
|
840
852
|
message: s,
|
|
841
853
|
reason: "error",
|
|
842
854
|
shouldEndCheckout: !0,
|
|
843
855
|
session: n.ok ? n.session : null
|
|
844
856
|
});
|
|
845
|
-
o.emit("payment.failed",
|
|
857
|
+
o.emit("payment.failed", c.event), o.paymentFailed(s, c.failure);
|
|
846
858
|
}
|
|
847
859
|
// Always teardown and unmount together to avoid leaking the React engine.
|
|
848
860
|
// Clear the cached load so a later initialize() creates a fresh engine.
|
|
@@ -850,13 +862,13 @@ class se extends HTMLElement {
|
|
|
850
862
|
t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
|
|
851
863
|
}
|
|
852
864
|
}
|
|
853
|
-
function
|
|
865
|
+
function ce(e) {
|
|
854
866
|
return new G(
|
|
855
|
-
|
|
867
|
+
K(e),
|
|
856
868
|
u(e) ? void 0 : e.publishableKey
|
|
857
869
|
);
|
|
858
870
|
}
|
|
859
|
-
function
|
|
871
|
+
function le({
|
|
860
872
|
api: e,
|
|
861
873
|
options: t
|
|
862
874
|
}) {
|
|
@@ -866,73 +878,73 @@ function ce({
|
|
|
866
878
|
emit: (a, n) => I(t.onEvent, a, n)
|
|
867
879
|
});
|
|
868
880
|
}
|
|
869
|
-
customElements.get("lydian-checkout") || customElements.define("lydian-checkout",
|
|
870
|
-
function
|
|
881
|
+
customElements.get("lydian-checkout") || customElements.define("lydian-checkout", ie);
|
|
882
|
+
function b() {
|
|
871
883
|
return document.querySelector("lydian-checkout");
|
|
872
884
|
}
|
|
873
|
-
async function
|
|
885
|
+
async function de(e) {
|
|
874
886
|
if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
|
|
875
887
|
throw new Error("SDK initialization requires publishableKey and a transaction");
|
|
876
|
-
const t =
|
|
888
|
+
const t = A(e);
|
|
877
889
|
if (t)
|
|
878
890
|
throw new Error(t);
|
|
879
|
-
const a =
|
|
891
|
+
const a = v(e);
|
|
880
892
|
if (a)
|
|
881
893
|
throw new Error(a);
|
|
882
|
-
if (!
|
|
894
|
+
if (!U(e.transaction.currency))
|
|
883
895
|
throw new Error("Invalid value for currency, valid values are: " + E.join(", "));
|
|
884
|
-
const n =
|
|
896
|
+
const n = S({
|
|
885
897
|
options: e,
|
|
886
898
|
unsupportedKeys: ["sessionID"],
|
|
887
899
|
entryPoint: "init"
|
|
888
900
|
});
|
|
889
901
|
if (n)
|
|
890
902
|
throw new Error(n);
|
|
891
|
-
await
|
|
903
|
+
await b().initialize(e);
|
|
892
904
|
}
|
|
893
|
-
async function
|
|
905
|
+
async function ue(e) {
|
|
894
906
|
if (!e.sessionID)
|
|
895
907
|
throw new Error("initExistingSession requires a sessionID");
|
|
896
|
-
const t =
|
|
908
|
+
const t = A(e);
|
|
897
909
|
if (t)
|
|
898
910
|
throw new Error(t);
|
|
899
|
-
const a =
|
|
911
|
+
const a = v(e);
|
|
900
912
|
if (a)
|
|
901
913
|
throw new Error(a);
|
|
902
|
-
const n =
|
|
914
|
+
const n = S({
|
|
903
915
|
options: e,
|
|
904
916
|
unsupportedKeys: ["publishableKey", "transaction"],
|
|
905
917
|
entryPoint: "initExistingSession"
|
|
906
918
|
});
|
|
907
919
|
if (n)
|
|
908
920
|
throw new Error(n);
|
|
909
|
-
await
|
|
921
|
+
await b().initialize(e);
|
|
910
922
|
}
|
|
911
|
-
async function
|
|
912
|
-
await
|
|
923
|
+
async function ye(e) {
|
|
924
|
+
await b().updateTransaction(e);
|
|
913
925
|
}
|
|
914
|
-
window.Lydian = { init:
|
|
926
|
+
window.Lydian = { init: de, initExistingSession: ue, updateTransaction: ye };
|
|
915
927
|
export {
|
|
916
|
-
|
|
928
|
+
O as G,
|
|
917
929
|
H as P,
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
930
|
+
i as T,
|
|
931
|
+
j as a,
|
|
932
|
+
he as b,
|
|
921
933
|
E as c,
|
|
922
934
|
Z as d,
|
|
923
935
|
ee as e,
|
|
924
936
|
te as f,
|
|
925
|
-
|
|
937
|
+
fe as g,
|
|
926
938
|
u as h,
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
939
|
+
U as i,
|
|
940
|
+
oe as j,
|
|
941
|
+
re as k,
|
|
930
942
|
N as l,
|
|
931
|
-
|
|
943
|
+
me as m,
|
|
932
944
|
P as n,
|
|
933
|
-
|
|
934
|
-
|
|
945
|
+
pe as o,
|
|
946
|
+
se as p,
|
|
935
947
|
V as r,
|
|
936
|
-
|
|
937
|
-
|
|
948
|
+
h as s,
|
|
949
|
+
m as t
|
|
938
950
|
};
|
|
@@ -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-D2BUJ6XE.js";
|
|
2
|
+
import { r as Ti } from "./index-Bw-rhy5J.js";
|
|
3
3
|
function Pi(r, u) {
|
|
4
4
|
for (var f = 0; f < u.length; f++) {
|
|
5
5
|
const h = u[f];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var mA = Object.defineProperty;
|
|
2
2
|
var gA = (e, t, n) => t in e ? mA(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var Ge = (e, t, n) => gA(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { t as Z, g as $g, i as Pg, G as yA, P as Fg, a as qg, s as a5, h as Fm, c as bA, T as ps, b as $2, r as wA, d as vA, f as o5, e as EA, j as SA, k as xA, l as l5, m as _A, n as AA, o as CA, p as TA } from "./index-
|
|
4
|
+
import { t as Z, g as $g, i as Pg, G as yA, P as Fg, a as qg, s as a5, h as Fm, c as bA, T as ps, b as $2, r as wA, d as vA, f as o5, e as EA, j as SA, k as xA, l as l5, m as _A, n as AA, o as CA, p as TA } from "./index-2aSnC3v4.js";
|
|
5
5
|
function jg(e) {
|
|
6
6
|
return [...new Set(e)];
|
|
7
7
|
}
|
|
@@ -20677,7 +20677,7 @@ function JN({
|
|
|
20677
20677
|
canReplace() {
|
|
20678
20678
|
return $2(n());
|
|
20679
20679
|
},
|
|
20680
|
-
// A -
|
|
20680
|
+
// A KYC-pending (3) promote response does not consume the session's single
|
|
20681
20681
|
// promotion — only a response that actually created the payment marks it.
|
|
20682
20682
|
markPromotedFrom(f) {
|
|
20683
20683
|
var d;
|
|
@@ -36063,7 +36063,7 @@ var Wc = "metamask", eK = /* @__PURE__ */ new Set(["eip155", "solana"]), tK = /^
|
|
|
36063
36063
|
}
|
|
36064
36064
|
async getClient() {
|
|
36065
36065
|
if (this.client) return this.client;
|
|
36066
|
-
const { createMultichainClient: e } = await import("./connect-multichain-
|
|
36066
|
+
const { createMultichainClient: e } = await import("./connect-multichain-CnxV2mL-.js").then((i) => i.c), t = J6(), n = await e({
|
|
36067
36067
|
dapp: {
|
|
36068
36068
|
name: this.app.appName,
|
|
36069
36069
|
...t ? { url: t } : {},
|
|
@@ -36278,7 +36278,7 @@ var uK = class extends Eh {
|
|
|
36278
36278
|
}
|
|
36279
36279
|
async getProvider(e) {
|
|
36280
36280
|
if (this.provider) return this.provider;
|
|
36281
|
-
const { CoinbaseWalletSDK: t } = await import("./dist-
|
|
36281
|
+
const { CoinbaseWalletSDK: t } = await import("./dist-DEg4yPGg.js"), i = new t({
|
|
36282
36282
|
appName: this.app.appName,
|
|
36283
36283
|
appLogoUrl: this.app.icon,
|
|
36284
36284
|
appChainIds: e
|
package/dist/lydian.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "./chunks/index-
|
|
1
|
+
import "./chunks/index-2aSnC3v4.js";
|