@lydianpay/sdk-web 3.3.0 → 3.5.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.
@@ -42,7 +42,7 @@ class u {
42
42
  }
43
43
  }
44
44
  const l = "transaction";
45
- class N extends u {
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 I(t, e) {
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 A extends u {
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
- I(P, [N, A, L]);
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 C(t) {
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,7 +190,7 @@ function ee({
190
190
  }) {
191
191
  return !a && e !== null && t !== null && c(t);
192
192
  }
193
- function T(t, e, a) {
193
+ function k(t, e, a) {
194
194
  try {
195
195
  t == null || t(e, a);
196
196
  } catch (n) {
@@ -230,16 +230,16 @@ async function x({
230
230
  sessionID: e
231
231
  }) {
232
232
  const a = await t.getSession(e);
233
- return { session: a, sessionPromoted: k(a) };
233
+ return { session: a, sessionPromoted: C(a) };
234
234
  }
235
235
  function $(t) {
236
236
  return {
237
237
  sessionID: t.sessionID,
238
238
  merchantName: t.merchantName,
239
- alreadyPromoted: k(t)
239
+ alreadyPromoted: C(t)
240
240
  };
241
241
  }
242
- function k(t) {
242
+ function C(t) {
243
243
  return !!t.transactionID;
244
244
  }
245
245
  async function M({
@@ -325,6 +325,10 @@ const B = {
325
325
  "wallet.backToWallets": "Back to wallets",
326
326
  "asset.chooseCoin": "Choose a coin",
327
327
  "asset.markupNotice": "Conversion includes a {percent}% markup fee",
328
+ "asset.insufficientBalance": "Insufficient balance",
329
+ "asset.insufficientBalanceWarning": "Your {codes} balance won't fully cover this payment. Top up, or choose a different coin.",
330
+ "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.",
331
+ "asset.backToNetworks": "Back to networks",
328
332
  "network.chooseNetwork": "Choose a network",
329
333
  "network.walletSupportWarning": "Please make sure you choose a network that your crypto wallet supports.",
330
334
  "network.noSupportedNetworks": "{wallet} doesn't support any of the networks available for this payment.",
@@ -411,6 +415,10 @@ const B = {
411
415
  "success.totalAmountPaid": "Total amount paid",
412
416
  "success.cryptoMethod": "Crypto – {asset} on {network}",
413
417
  "success.cryptoMethodWallet": "Crypto – {wallet}",
418
+ "success.getAppHeading": "GET THE APP",
419
+ "success.getAppBody": "Want a simpler checkout experience? Try the <strong>Lydian Wallet</strong> next time.",
420
+ "success.downloadFromAppStore": "Download from the App Store",
421
+ "success.downloadFromGooglePlay": "Get it on Google Play",
414
422
  "failure.title": "We couldn't complete your payment",
415
423
  "failure.paymentId": "Payment ID",
416
424
  "failure.copyPaymentId": "Copy payment ID",
@@ -542,7 +550,7 @@ function K() {
542
550
  setOptions: (e) => {
543
551
  t = e;
544
552
  },
545
- emit: (e, a) => T(t == null ? void 0 : t.onEvent, e, a),
553
+ emit: (e, a) => k(t == null ? void 0 : t.onEvent, e, a),
546
554
  paymentFailed: (e, a) => {
547
555
  var n;
548
556
  return (n = t == null ? void 0 : t.paymentFailedListener) == null ? void 0 : n.call(t, e, a);
@@ -567,7 +575,7 @@ class j extends HTMLElement {
567
575
  this.isTornDown = !1;
568
576
  }
569
577
  async initialize(e) {
570
- const a = H(e), n = z({ api: a, options: e }), o = await this.loadEngine(e, n);
578
+ const a = G(e), n = H({ api: a, options: e }), o = await this.loadEngine(e, n);
571
579
  !o || this.isTornDown || (this.engine = o, await o.initialize(e, { api: a, sessionLoad: n }));
572
580
  }
573
581
  async loadEngine(e, a) {
@@ -595,7 +603,7 @@ class j extends HTMLElement {
595
603
  // Not started in the constructor: a page can carry the tag and never check out.
596
604
  // Overlapping initialize() calls share one download.
597
605
  getOrLoadEngine() {
598
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-CSp6_9R-.js").then((e) => e.m).then((e) => {
606
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-DI19rA1h.js").then((e) => e.m).then((e) => {
599
607
  const a = e.mountCheckoutEngine({
600
608
  host: this,
601
609
  shadowRoot: this.shadow
@@ -660,30 +668,30 @@ class j extends HTMLElement {
660
668
  e == null || e.teardown(), e == null || e.unmount(), this.engine = null, this.engineLoadPromise = null;
661
669
  }
662
670
  }
663
- function H(t) {
671
+ function G(t) {
664
672
  return new R(
665
673
  O(t),
666
674
  c(t) ? void 0 : t.publishableKey
667
675
  );
668
676
  }
669
- function z({
677
+ function H({
670
678
  api: t,
671
679
  options: e
672
680
  }) {
673
681
  return W({
674
682
  api: t,
675
683
  options: e,
676
- emit: (a, n) => T(e.onEvent, a, n)
684
+ emit: (a, n) => k(e.onEvent, a, n)
677
685
  });
678
686
  }
679
687
  customElements.get("lydian-checkout") || customElements.define("lydian-checkout", j);
680
688
  function h() {
681
689
  return document.querySelector("lydian-checkout");
682
690
  }
683
- async function G(t) {
691
+ async function z(t) {
684
692
  if (!t.publishableKey || !t.transaction.amount || !t.transaction.currency)
685
693
  throw new Error("SDK initialization requires publishableKey and a transaction");
686
- const e = C(t);
694
+ const e = T(t);
687
695
  if (e)
688
696
  throw new Error(e);
689
697
  if (!S(t.transaction.currency))
@@ -700,7 +708,7 @@ async function G(t) {
700
708
  async function Q(t) {
701
709
  if (!t.sessionID)
702
710
  throw new Error("initExistingSession requires a sessionID");
703
- const e = C(t);
711
+ const e = T(t);
704
712
  if (e)
705
713
  throw new Error(e);
706
714
  const a = b({
@@ -715,7 +723,7 @@ async function Q(t) {
715
723
  async function J(t) {
716
724
  await h().updateTransaction(t);
717
725
  }
718
- window.Lydian = { init: G, initExistingSession: Q, updateTransaction: J };
726
+ window.Lydian = { init: z, initExistingSession: Q, updateTransaction: J };
719
727
  export {
720
728
  U as P,
721
729
  y as T,
@@ -730,7 +738,7 @@ export {
730
738
  S as i,
731
739
  q as j,
732
740
  _ as k,
733
- k as l,
741
+ C as l,
734
742
  ee as m,
735
743
  Y as n,
736
744
  X as o,
@@ -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-CSp6_9R-.js";
1
+ import { i as Fe, I as ft, g as Qt, h as pt, b as jn, s as Bn } from "./mountEngine-DI19rA1h.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-CSp6_9R-.js";
4
+ import { c as ei, g as ga } from "./mountEngine-DI19rA1h.js";
5
5
  var ti = { exports: {} }, cc;
6
6
  function Zf() {
7
7
  return cc || (cc = 1, (function(t, e) {