@lydianpay/sdk-web 3.4.0 → 3.6.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/{index-B0BHysWS.js → index-9i2S104v.js} +34 -23
- package/dist/chunks/{index-VfKF_MSs.js → index-bKFtUHLc.js} +1 -1
- package/dist/chunks/{metamask-sdk-C_765hQm.js → metamask-sdk-CK1SAg_K.js} +1 -1
- package/dist/chunks/{mountEngine-B8FwMr2r.js → mountEngine-CVnwr305.js} +16213 -15624
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/chains/adapters.d.ts +12 -5
- package/dist/types/chains/balanceReads.d.ts +23 -0
- package/dist/types/services/lydianConnectService.d.ts +3 -3
- package/dist/types/ui/components/storeBadges.d.ts +2 -0
- package/dist/types/ui/networkListHelpers.d.ts +24 -0
- package/dist/types/ui/paymentFlow.d.ts +4 -4
- package/dist/types/ui/react/AssetSelectOption.d.ts +9 -0
- package/dist/types/ui/react/GetAppPromo.d.ts +5 -0
- package/dist/types/ui/react/OptionButton.d.ts +3 -1
- package/dist/types/ui/react/checkoutActions.d.ts +9 -1
- package/dist/types/ui/react/checkoutStore.d.ts +12 -0
- package/dist/types/ui/walletConnection.d.ts +8 -5
- package/dist/types/ui/walletInstallLink.d.ts +2 -0
- package/dist/types/ui/walletRejection.d.ts +1 -0
- package/package.json +2 -2
|
@@ -42,7 +42,7 @@ class u {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const l = "transaction";
|
|
45
|
-
class
|
|
45
|
+
class A extends u {
|
|
46
46
|
async getCryptoTransaction(e) {
|
|
47
47
|
return await this.request(`/${l}/${e}`);
|
|
48
48
|
}
|
|
@@ -75,7 +75,7 @@ class N extends u {
|
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function N(t, e) {
|
|
79
79
|
e.forEach((a) => {
|
|
80
80
|
Object.getOwnPropertyNames(a.prototype).forEach((n) => {
|
|
81
81
|
const o = Object.getOwnPropertyDescriptor(a.prototype, n);
|
|
@@ -84,7 +84,7 @@ function I(t, e) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const w = "customer/otp";
|
|
87
|
-
class
|
|
87
|
+
class I extends u {
|
|
88
88
|
// PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
|
|
89
89
|
async sendCustomerOTP(e) {
|
|
90
90
|
return await this.requestText(`/${w}`, {
|
|
@@ -133,7 +133,7 @@ class L extends u {
|
|
|
133
133
|
}
|
|
134
134
|
class P extends u {
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
N(P, [A, I, L]);
|
|
137
137
|
const R = P;
|
|
138
138
|
var y = {
|
|
139
139
|
API_CANCELLED: -9,
|
|
@@ -173,7 +173,7 @@ function b({
|
|
|
173
173
|
const n = e.filter((o) => t[o] !== void 0);
|
|
174
174
|
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.`;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function T(t) {
|
|
177
177
|
var e;
|
|
178
178
|
return (e = t.flow) != null && e.walletConnect && !t.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
|
|
179
179
|
}
|
|
@@ -190,20 +190,20 @@ function ee({
|
|
|
190
190
|
}) {
|
|
191
191
|
return !a && e !== null && t !== null && c(t);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function C(t, e, a) {
|
|
194
194
|
try {
|
|
195
195
|
t == null || t(e, a);
|
|
196
196
|
} catch (n) {
|
|
197
197
|
console.error(`onEvent("${e}") threw:`, n);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
async function
|
|
200
|
+
async function F({
|
|
201
201
|
api: t,
|
|
202
202
|
options: e,
|
|
203
203
|
emit: a
|
|
204
204
|
}) {
|
|
205
205
|
try {
|
|
206
|
-
const n = await
|
|
206
|
+
const n = await W({ api: t, options: e }), { session: o, sessionPromoted: r } = await x({ api: t, sessionID: n });
|
|
207
207
|
a("session.loaded", $(o));
|
|
208
208
|
const s = await M({
|
|
209
209
|
api: t,
|
|
@@ -214,7 +214,7 @@ async function W({
|
|
|
214
214
|
return { ok: !1 };
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
async function
|
|
217
|
+
async function W({
|
|
218
218
|
api: t,
|
|
219
219
|
options: e
|
|
220
220
|
}) {
|
|
@@ -315,6 +315,9 @@ const B = {
|
|
|
315
315
|
"wallet.manualQrName": "Manual QR Code",
|
|
316
316
|
"wallet.otherWallets": "Other wallets",
|
|
317
317
|
"wallet.connectingTo": "Connecting to {wallet}",
|
|
318
|
+
"wallet.discoveryFailedTitle": "Couldn't connect to {wallet}",
|
|
319
|
+
"wallet.discoveryFailedHint": "The connection didn't go through. Try again, or choose another way to pay.",
|
|
320
|
+
"wallet.tryAgain": "Try again",
|
|
318
321
|
"wallet.approveInApp": "Open {wallet} to connect your wallet, then navigate back to this page.",
|
|
319
322
|
"wallet.openFailedHint": "Didn't see {wallet} open? Tap the button above to try again, or make sure it's installed.",
|
|
320
323
|
"wallet.openApp": "Open {wallet}",
|
|
@@ -325,6 +328,10 @@ const B = {
|
|
|
325
328
|
"wallet.backToWallets": "Back to wallets",
|
|
326
329
|
"asset.chooseCoin": "Choose a coin",
|
|
327
330
|
"asset.markupNotice": "Conversion includes a {percent}% markup fee",
|
|
331
|
+
"asset.insufficientBalance": "Insufficient balance",
|
|
332
|
+
"asset.insufficientBalanceWarning": "Your {codes} balance won't fully cover this payment. Top up, or choose a different coin.",
|
|
333
|
+
"asset.noAssetsOnNetwork": "{wallet} doesn't have any of the accepted coins on {network}. Add {coins} to your wallet, or choose a different network or wallet.",
|
|
334
|
+
"asset.backToNetworks": "Back to networks",
|
|
328
335
|
"network.chooseNetwork": "Choose a network",
|
|
329
336
|
"network.walletSupportWarning": "Please make sure you choose a network that your crypto wallet supports.",
|
|
330
337
|
"network.noSupportedNetworks": "{wallet} doesn't support any of the networks available for this payment.",
|
|
@@ -411,6 +418,10 @@ const B = {
|
|
|
411
418
|
"success.totalAmountPaid": "Total amount paid",
|
|
412
419
|
"success.cryptoMethod": "Crypto – {asset} on {network}",
|
|
413
420
|
"success.cryptoMethodWallet": "Crypto – {wallet}",
|
|
421
|
+
"success.getAppHeading": "GET THE APP",
|
|
422
|
+
"success.getAppBody": "Want a simpler checkout experience? Try the <strong>Lydian Wallet</strong> next time.",
|
|
423
|
+
"success.downloadFromAppStore": "Download from the App Store",
|
|
424
|
+
"success.downloadFromGooglePlay": "Get it on Google Play",
|
|
414
425
|
"failure.title": "We couldn't complete your payment",
|
|
415
426
|
"failure.paymentId": "Payment ID",
|
|
416
427
|
"failure.copyPaymentId": "Copy payment ID",
|
|
@@ -542,7 +553,7 @@ function K() {
|
|
|
542
553
|
setOptions: (e) => {
|
|
543
554
|
t = e;
|
|
544
555
|
},
|
|
545
|
-
emit: (e, a) =>
|
|
556
|
+
emit: (e, a) => C(t == null ? void 0 : t.onEvent, e, a),
|
|
546
557
|
paymentFailed: (e, a) => {
|
|
547
558
|
var n;
|
|
548
559
|
return (n = t == null ? void 0 : t.paymentFailedListener) == null ? void 0 : n.call(t, e, a);
|
|
@@ -557,7 +568,7 @@ function K() {
|
|
|
557
568
|
}
|
|
558
569
|
};
|
|
559
570
|
}
|
|
560
|
-
class
|
|
571
|
+
class H extends HTMLElement {
|
|
561
572
|
constructor() {
|
|
562
573
|
super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
|
|
563
574
|
}
|
|
@@ -567,7 +578,7 @@ class j extends HTMLElement {
|
|
|
567
578
|
this.isTornDown = !1;
|
|
568
579
|
}
|
|
569
580
|
async initialize(e) {
|
|
570
|
-
const a =
|
|
581
|
+
const a = j(e), n = G({ api: a, options: e }), o = await this.loadEngine(e, n);
|
|
571
582
|
!o || this.isTornDown || (this.engine = o, await o.initialize(e, { api: a, sessionLoad: n }));
|
|
572
583
|
}
|
|
573
584
|
async loadEngine(e, a) {
|
|
@@ -595,7 +606,7 @@ class j extends HTMLElement {
|
|
|
595
606
|
// Not started in the constructor: a page can carry the tag and never check out.
|
|
596
607
|
// Overlapping initialize() calls share one download.
|
|
597
608
|
getOrLoadEngine() {
|
|
598
|
-
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-
|
|
609
|
+
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-CVnwr305.js").then((e) => e.m).then((e) => {
|
|
599
610
|
const a = e.mountCheckoutEngine({
|
|
600
611
|
host: this,
|
|
601
612
|
shadowRoot: this.shadow
|
|
@@ -660,30 +671,30 @@ class j extends HTMLElement {
|
|
|
660
671
|
e == null || e.teardown(), e == null || e.unmount(), this.engine = null, this.engineLoadPromise = null;
|
|
661
672
|
}
|
|
662
673
|
}
|
|
663
|
-
function
|
|
674
|
+
function j(t) {
|
|
664
675
|
return new R(
|
|
665
676
|
O(t),
|
|
666
677
|
c(t) ? void 0 : t.publishableKey
|
|
667
678
|
);
|
|
668
679
|
}
|
|
669
|
-
function
|
|
680
|
+
function G({
|
|
670
681
|
api: t,
|
|
671
682
|
options: e
|
|
672
683
|
}) {
|
|
673
|
-
return
|
|
684
|
+
return F({
|
|
674
685
|
api: t,
|
|
675
686
|
options: e,
|
|
676
|
-
emit: (a, n) =>
|
|
687
|
+
emit: (a, n) => C(e.onEvent, a, n)
|
|
677
688
|
});
|
|
678
689
|
}
|
|
679
|
-
customElements.get("lydian-checkout") || customElements.define("lydian-checkout",
|
|
690
|
+
customElements.get("lydian-checkout") || customElements.define("lydian-checkout", H);
|
|
680
691
|
function h() {
|
|
681
692
|
return document.querySelector("lydian-checkout");
|
|
682
693
|
}
|
|
683
|
-
async function
|
|
694
|
+
async function z(t) {
|
|
684
695
|
if (!t.publishableKey || !t.transaction.amount || !t.transaction.currency)
|
|
685
696
|
throw new Error("SDK initialization requires publishableKey and a transaction");
|
|
686
|
-
const e =
|
|
697
|
+
const e = T(t);
|
|
687
698
|
if (e)
|
|
688
699
|
throw new Error(e);
|
|
689
700
|
if (!S(t.transaction.currency))
|
|
@@ -700,7 +711,7 @@ async function G(t) {
|
|
|
700
711
|
async function Q(t) {
|
|
701
712
|
if (!t.sessionID)
|
|
702
713
|
throw new Error("initExistingSession requires a sessionID");
|
|
703
|
-
const e =
|
|
714
|
+
const e = T(t);
|
|
704
715
|
if (e)
|
|
705
716
|
throw new Error(e);
|
|
706
717
|
const a = b({
|
|
@@ -715,7 +726,7 @@ async function Q(t) {
|
|
|
715
726
|
async function J(t) {
|
|
716
727
|
await h().updateTransaction(t);
|
|
717
728
|
}
|
|
718
|
-
window.Lydian = { init:
|
|
729
|
+
window.Lydian = { init: z, initExistingSession: Q, updateTransaction: J };
|
|
719
730
|
export {
|
|
720
731
|
U as P,
|
|
721
732
|
y as T,
|
|
@@ -735,7 +746,7 @@ export {
|
|
|
735
746
|
Y as n,
|
|
736
747
|
X as o,
|
|
737
748
|
K as p,
|
|
738
|
-
|
|
749
|
+
W as r,
|
|
739
750
|
m as s,
|
|
740
751
|
v as t
|
|
741
752
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Fe, I as ft, g as Qt, h as pt, b as jn, s as Bn } from "./mountEngine-
|
|
1
|
+
import { i as Fe, I as ft, g as Qt, h as pt, b as jn, s as Bn } from "./mountEngine-CVnwr305.js";
|
|
2
2
|
function Wn(t, e) {
|
|
3
3
|
if (!Fe(t, { strict: !1 }))
|
|
4
4
|
throw new ft({ address: t });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Gf = Object.defineProperty;
|
|
2
2
|
var Yf = (t, e, n) => e in t ? Gf(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
3
|
var Ht = (t, e, n) => Yf(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { c as ei, g as ga } from "./mountEngine-
|
|
4
|
+
import { c as ei, g as ga } from "./mountEngine-CVnwr305.js";
|
|
5
5
|
var ti = { exports: {} }, cc;
|
|
6
6
|
function Zf() {
|
|
7
7
|
return cc || (cc = 1, (function(t, e) {
|