@lydianpay/sdk-web 3.1.0 → 3.3.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/README.md +6 -5
- package/dist/chunks/{index-DNg377cf.js → index-CZgQVAU2.js} +1 -1
- package/dist/chunks/{index-DSXTLyjq.js → index-D3Zl7b5P.js} +30 -33
- package/dist/chunks/{metamask-sdk-BqxWzRzO.js → metamask-sdk-B-CyZW84.js} +1 -1
- package/dist/chunks/{mountEngine-DjacHrH_.js → mountEngine-CSp6_9R-.js} +8791 -8806
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/ui/components/icons.d.ts +0 -1
- package/dist/types/ui/flowConfig.d.ts +2 -1
- package/dist/types/ui/networkListHelpers.d.ts +9 -1
- package/dist/types/ui/react/checkoutActions.d.ts +1 -1
- package/dist/types/ui/react/checkoutStore.d.ts +3 -4
- package/dist/types/ui/walletConnection.d.ts +0 -2
- package/package.json +2 -2
- package/dist/types/ui/react/DownloadWalletScreen.d.ts +0 -2
package/README.md
CHANGED
|
@@ -102,9 +102,10 @@ Optional per-embed settings. Only settings your Lydian account cannot express li
|
|
|
102
102
|
here — everything else is configured once on the merchant portal and applies to
|
|
103
103
|
every checkout automatically.
|
|
104
104
|
|
|
105
|
-
| Field | Type | Default | Description
|
|
106
|
-
| --------------- | --------- | ------- |
|
|
107
|
-
| `walletConnect` | `boolean` | `false` | Offer wallet connection alongside the QR code. Not available from account config.
|
|
105
|
+
| Field | Type | Default | Description |
|
|
106
|
+
| --------------- | --------- | ------- | ------------------------------------------------------------------------------------------------- |
|
|
107
|
+
| `walletConnect` | `boolean` | `false` | Offer wallet connection alongside the QR code. Not available from account config. |
|
|
108
|
+
| `assetFirst` | `boolean` | `false` | Ask the customer to pick the coin before the network, instead of the default network-first order. |
|
|
108
109
|
|
|
109
110
|
Configured on your Lydian account, not here. They apply to every checkout and there
|
|
110
111
|
is no per-embed override:
|
|
@@ -112,12 +113,12 @@ is no per-embed override:
|
|
|
112
113
|
| Setting | Description |
|
|
113
114
|
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
114
115
|
| `showApprovalPage` | Show the scan-to-pay screen as a confirmation step before asking a connected wallet to sign. Off by default — the wallet opens straight away. |
|
|
115
|
-
| `hideNoWalletOption` |
|
|
116
|
+
| `hideNoWalletOption` | Legacy field name retained for compatibility. When true, hides the "Other wallets" option on the wallet selection screen. |
|
|
116
117
|
|
|
117
118
|
```js
|
|
118
119
|
window.Lydian.init({
|
|
119
120
|
// ...
|
|
120
|
-
flow: { walletConnect: true },
|
|
121
|
+
flow: { walletConnect: true, assetFirst: true },
|
|
121
122
|
});
|
|
122
123
|
```
|
|
123
124
|
|
|
@@ -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-CSp6_9R-.js";
|
|
2
2
|
function Wn(t, e) {
|
|
3
3
|
if (!Fe(t, { strict: !1 }))
|
|
4
4
|
throw new ft({ address: t });
|
|
@@ -2,7 +2,7 @@ const g = ["USD", "TRY", "PHP"];
|
|
|
2
2
|
function S(t) {
|
|
3
3
|
return typeof t == "string" && g.includes(t);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function c(t) {
|
|
6
6
|
return "sessionID" in t && typeof t.sessionID == "string" && t.sessionID.length > 0;
|
|
7
7
|
}
|
|
8
8
|
class u {
|
|
@@ -41,14 +41,14 @@ class u {
|
|
|
41
41
|
throw new Error(s.statusText);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
class
|
|
44
|
+
const l = "transaction";
|
|
45
|
+
class N extends u {
|
|
46
46
|
async getCryptoTransaction(e) {
|
|
47
|
-
return await this.request(`/${
|
|
47
|
+
return await this.request(`/${l}/${e}`);
|
|
48
48
|
}
|
|
49
49
|
async createPaymentRequest(e, a) {
|
|
50
50
|
return await this.request(
|
|
51
|
-
`/${
|
|
51
|
+
`/${l}/${e}/payment`,
|
|
52
52
|
{
|
|
53
53
|
method: "POST",
|
|
54
54
|
body: JSON.stringify(a)
|
|
@@ -57,7 +57,7 @@ class I extends u {
|
|
|
57
57
|
}
|
|
58
58
|
async cancelCryptoTransaction(e, a) {
|
|
59
59
|
return await this.request(
|
|
60
|
-
`/${
|
|
60
|
+
`/${l}/${e}/cancel`,
|
|
61
61
|
{
|
|
62
62
|
method: "PATCH",
|
|
63
63
|
body: JSON.stringify(a)
|
|
@@ -67,7 +67,7 @@ class I extends u {
|
|
|
67
67
|
async kycVerification(e, a) {
|
|
68
68
|
const n = new FormData();
|
|
69
69
|
return n.append("asset", a.asset), n.append("network", a.network), n.append("firstName", a.firstName), n.append("lastName", a.lastName), n.append("email", a.email), n.append("street", a.street), n.append("city", a.city), n.append("region", a.region), n.append("postalCode", a.postalCode), n.append("country", a.country), n.append("storeKYC", a.storeKYC ? "true" : "false"), a.customerUUID && n.append("customerUUID", a.customerUUID), a.documentType && n.append("documentType", a.documentType), a.documentFiles.forEach((o) => n.append("documentFiles", o)), await this.requestWithFormData(
|
|
70
|
-
`/${
|
|
70
|
+
`/${l}/${e}/verification`,
|
|
71
71
|
{
|
|
72
72
|
method: "POST",
|
|
73
73
|
body: n
|
|
@@ -75,7 +75,7 @@ class I extends u {
|
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function I(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 A(t, e) {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const w = "customer/otp";
|
|
87
|
-
class
|
|
87
|
+
class A 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
|
+
I(P, [N, A, L]);
|
|
137
137
|
const R = P;
|
|
138
138
|
var y = {
|
|
139
139
|
API_CANCELLED: -9,
|
|
@@ -178,17 +178,17 @@ function C(t) {
|
|
|
178
178
|
return (e = t.flow) != null && e.walletConnect && !t.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
|
|
179
179
|
}
|
|
180
180
|
function X(t) {
|
|
181
|
-
return t !== null && !
|
|
181
|
+
return t !== null && !c(t) && !!t.publishableKey;
|
|
182
182
|
}
|
|
183
183
|
function V(t) {
|
|
184
|
-
return t !== null && !
|
|
184
|
+
return t !== null && !c(t);
|
|
185
185
|
}
|
|
186
186
|
function ee({
|
|
187
187
|
options: t,
|
|
188
188
|
session: e,
|
|
189
189
|
settled: a
|
|
190
190
|
}) {
|
|
191
|
-
return !a && e !== null && t !== null &&
|
|
191
|
+
return !a && e !== null && t !== null && c(t);
|
|
192
192
|
}
|
|
193
193
|
function T(t, e, a) {
|
|
194
194
|
try {
|
|
@@ -218,7 +218,7 @@ async function F({
|
|
|
218
218
|
api: t,
|
|
219
219
|
options: e
|
|
220
220
|
}) {
|
|
221
|
-
return
|
|
221
|
+
return c(e) ? e.sessionID : (await t.createSession({
|
|
222
222
|
amount: e.transaction.amount,
|
|
223
223
|
amountCurrency: e.transaction.currency,
|
|
224
224
|
descriptor: e.transaction.descriptor,
|
|
@@ -285,7 +285,7 @@ function Y({
|
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
const
|
|
288
|
+
const B = {
|
|
289
289
|
"common.cancelTransaction": "Cancel Transaction",
|
|
290
290
|
"common.cancel": "Cancel",
|
|
291
291
|
"common.back": "Back",
|
|
@@ -311,27 +311,24 @@ const q = {
|
|
|
311
311
|
"header.merchantLogoAlt": "Merchant logo",
|
|
312
312
|
"header.changePaymentMethod": "Change payment method",
|
|
313
313
|
"wallet.chooseWallet": "Choose your crypto wallet",
|
|
314
|
-
"wallet.noSupportedWallet": "I don't have a supported wallet",
|
|
315
314
|
"wallet.featured": "FEATURED",
|
|
316
315
|
"wallet.manualQrName": "Manual QR Code",
|
|
317
316
|
"wallet.otherWallets": "Other wallets",
|
|
318
317
|
"wallet.connectingTo": "Connecting to {wallet}",
|
|
319
|
-
"wallet.approveInApp": "Open
|
|
318
|
+
"wallet.approveInApp": "Open {wallet} to connect your wallet, then navigate back to this page.",
|
|
320
319
|
"wallet.openFailedHint": "Didn't see {wallet} open? Tap the button above to try again, or make sure it's installed.",
|
|
321
320
|
"wallet.openApp": "Open {wallet}",
|
|
322
321
|
"wallet.openInBrowser": "Try a different way to open {wallet}",
|
|
323
322
|
"wallet.install": "Install {wallet}",
|
|
324
323
|
"wallet.connectNamed": "Connect {wallet}",
|
|
325
324
|
"wallet.scanToConnect": "Scan with your phone to connect with {wallet}.",
|
|
326
|
-
"wallet.downloadLydian": "Download Lydian",
|
|
327
|
-
"wallet.downloadLydianDescription": "Download the Lydian Wallet to easily load funds, manage your assets, and make seamless payments with crypto.",
|
|
328
|
-
"wallet.downloadFromAppStore": "Download from the App Store",
|
|
329
|
-
"wallet.downloadFromGooglePlay": "Get it on Google Play",
|
|
330
325
|
"wallet.backToWallets": "Back to wallets",
|
|
331
326
|
"asset.chooseCoin": "Choose a coin",
|
|
332
327
|
"asset.markupNotice": "Conversion includes a {percent}% markup fee",
|
|
333
328
|
"network.chooseNetwork": "Choose a network",
|
|
334
329
|
"network.walletSupportWarning": "Please make sure you choose a network that your crypto wallet supports.",
|
|
330
|
+
"network.noSupportedNetworks": "{wallet} doesn't support any of the networks available for this payment.",
|
|
331
|
+
"network.noSupportedNetworksForMerchant": "{wallet} doesn't support any of the networks available for {merchant}.",
|
|
335
332
|
"network.recommended": "RECOMMENDED",
|
|
336
333
|
"network.fee": "Network fee: {fee}",
|
|
337
334
|
"kyc.additionalInfoRequired": "Additional info required",
|
|
@@ -482,7 +479,7 @@ const q = {
|
|
|
482
479
|
"validation.customerDetailsMissing": "Customer details are missing.",
|
|
483
480
|
"validation.invalidOtp": "Please enter a valid 6-digit code.",
|
|
484
481
|
"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>.'
|
|
485
|
-
}, f = { en:
|
|
482
|
+
}, f = { en: B }, D = "en";
|
|
486
483
|
let E = D;
|
|
487
484
|
function te() {
|
|
488
485
|
return E;
|
|
@@ -495,7 +492,7 @@ function v(t, e) {
|
|
|
495
492
|
(o, r) => e[r] != null ? String(e[r]) : `{${r}}`
|
|
496
493
|
) : a;
|
|
497
494
|
}
|
|
498
|
-
function
|
|
495
|
+
function q(t) {
|
|
499
496
|
return t === y.SUCCESS ? "succeeded" : t < y.PENDING && t !== y.KYC_VERIFICATION_PENDING ? "failed" : "active";
|
|
500
497
|
}
|
|
501
498
|
function _({
|
|
@@ -503,7 +500,7 @@ function _({
|
|
|
503
500
|
session: e
|
|
504
501
|
}) {
|
|
505
502
|
var o, r, s;
|
|
506
|
-
const a =
|
|
503
|
+
const a = q(t.status);
|
|
507
504
|
if (a === "active")
|
|
508
505
|
return null;
|
|
509
506
|
if (a === "failed")
|
|
@@ -570,7 +567,7 @@ class j extends HTMLElement {
|
|
|
570
567
|
this.isTornDown = !1;
|
|
571
568
|
}
|
|
572
569
|
async initialize(e) {
|
|
573
|
-
const a =
|
|
570
|
+
const a = H(e), n = z({ api: a, options: e }), o = await this.loadEngine(e, n);
|
|
574
571
|
!o || this.isTornDown || (this.engine = o, await o.initialize(e, { api: a, sessionLoad: n }));
|
|
575
572
|
}
|
|
576
573
|
async loadEngine(e, a) {
|
|
@@ -598,7 +595,7 @@ class j extends HTMLElement {
|
|
|
598
595
|
// Not started in the constructor: a page can carry the tag and never check out.
|
|
599
596
|
// Overlapping initialize() calls share one download.
|
|
600
597
|
getOrLoadEngine() {
|
|
601
|
-
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-
|
|
598
|
+
return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-CSp6_9R-.js").then((e) => e.m).then((e) => {
|
|
602
599
|
const a = e.mountCheckoutEngine({
|
|
603
600
|
host: this,
|
|
604
601
|
shadowRoot: this.shadow
|
|
@@ -663,13 +660,13 @@ class j extends HTMLElement {
|
|
|
663
660
|
e == null || e.teardown(), e == null || e.unmount(), this.engine = null, this.engineLoadPromise = null;
|
|
664
661
|
}
|
|
665
662
|
}
|
|
666
|
-
function
|
|
663
|
+
function H(t) {
|
|
667
664
|
return new R(
|
|
668
665
|
O(t),
|
|
669
|
-
|
|
666
|
+
c(t) ? void 0 : t.publishableKey
|
|
670
667
|
);
|
|
671
668
|
}
|
|
672
|
-
function
|
|
669
|
+
function z({
|
|
673
670
|
api: t,
|
|
674
671
|
options: e
|
|
675
672
|
}) {
|
|
@@ -683,7 +680,7 @@ customElements.get("lydian-checkout") || customElements.define("lydian-checkout"
|
|
|
683
680
|
function h() {
|
|
684
681
|
return document.querySelector("lydian-checkout");
|
|
685
682
|
}
|
|
686
|
-
async function
|
|
683
|
+
async function G(t) {
|
|
687
684
|
if (!t.publishableKey || !t.transaction.amount || !t.transaction.currency)
|
|
688
685
|
throw new Error("SDK initialization requires publishableKey and a transaction");
|
|
689
686
|
const e = C(t);
|
|
@@ -718,7 +715,7 @@ async function Q(t) {
|
|
|
718
715
|
async function J(t) {
|
|
719
716
|
await h().updateTransaction(t);
|
|
720
717
|
}
|
|
721
|
-
window.Lydian = { init:
|
|
718
|
+
window.Lydian = { init: G, initExistingSession: Q, updateTransaction: J };
|
|
722
719
|
export {
|
|
723
720
|
U as P,
|
|
724
721
|
y as T,
|
|
@@ -729,9 +726,9 @@ export {
|
|
|
729
726
|
$ as e,
|
|
730
727
|
M as f,
|
|
731
728
|
te as g,
|
|
732
|
-
|
|
729
|
+
c as h,
|
|
733
730
|
S as i,
|
|
734
|
-
|
|
731
|
+
q as j,
|
|
735
732
|
_ as k,
|
|
736
733
|
k as l,
|
|
737
734
|
ee as m,
|
|
@@ -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-CSp6_9R-.js";
|
|
5
5
|
var ti = { exports: {} }, cc;
|
|
6
6
|
function Zf() {
|
|
7
7
|
return cc || (cc = 1, (function(t, e) {
|