@lydianpay/sdk-web 3.7.0 → 3.7.1

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.
@@ -1,8 +1,8 @@
1
1
  const g = ["USD", "TRY", "PHP"];
2
- function A(e) {
2
+ function N(e) {
3
3
  return typeof e == "string" && g.includes(e);
4
4
  }
5
- function l(e) {
5
+ function c(e) {
6
6
  return "sessionID" in e && typeof e.sessionID == "string" && e.sessionID.length > 0;
7
7
  }
8
8
  class y {
@@ -41,14 +41,14 @@ class y {
41
41
  throw new Error(s.statusText);
42
42
  }
43
43
  }
44
- const c = "transaction";
45
- class N extends y {
44
+ const l = "transaction";
45
+ class A extends y {
46
46
  async getCryptoTransaction(t) {
47
- return await this.request(`/${c}/${t}`);
47
+ return await this.request(`/${l}/${t}`);
48
48
  }
49
49
  async createPaymentRequest(t, a) {
50
50
  return await this.request(
51
- `/${c}/${t}/payment`,
51
+ `/${l}/${t}/payment`,
52
52
  {
53
53
  method: "POST",
54
54
  body: JSON.stringify(a)
@@ -57,7 +57,7 @@ class N extends y {
57
57
  }
58
58
  async cancelCryptoTransaction(t, a) {
59
59
  return await this.request(
60
- `/${c}/${t}/cancel`,
60
+ `/${l}/${t}/cancel`,
61
61
  {
62
62
  method: "PATCH",
63
63
  body: JSON.stringify(a)
@@ -67,7 +67,7 @@ class N extends y {
67
67
  async kycVerification(t, 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.walletAddress && n.append("walletAddress", a.walletAddress), a.documentType && n.append("documentType", a.documentType), a.documentFiles.forEach((o) => n.append("documentFiles", o)), await this.requestWithFormData(
70
- `/${c}/${t}/verification`,
70
+ `/${l}/${t}/verification`,
71
71
  {
72
72
  method: "POST",
73
73
  body: n
@@ -131,10 +131,10 @@ class L extends y {
131
131
  });
132
132
  }
133
133
  }
134
- class P extends y {
134
+ class b extends y {
135
135
  }
136
- S(P, [N, I, L]);
137
- const R = P;
136
+ S(b, [A, I, L]);
137
+ const R = b;
138
138
  var u = {
139
139
  COMPLIANCE_PENDING: -10,
140
140
  API_CANCELLED: -9,
@@ -166,7 +166,7 @@ var u = {
166
166
  function U(e) {
167
167
  return e.dev ? p.dev : e.sandbox ? p.sandbox : p.prod;
168
168
  }
169
- function b({
169
+ function C({
170
170
  options: e,
171
171
  unsupportedKeys: t,
172
172
  entryPoint: a
@@ -174,37 +174,37 @@ function b({
174
174
  const n = t.filter((o) => e[o] !== void 0);
175
175
  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.`;
176
176
  }
177
- function T(e) {
177
+ function P(e) {
178
178
  var t;
179
179
  return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
180
180
  }
181
181
  function X(e) {
182
- return e !== null && !l(e) && !!e.publishableKey;
182
+ return e !== null && !c(e) && !!e.publishableKey;
183
183
  }
184
184
  function V(e) {
185
- return e !== null && !l(e);
185
+ return e !== null && !c(e);
186
186
  }
187
187
  function ee({
188
188
  options: e,
189
189
  session: t,
190
190
  settled: a
191
191
  }) {
192
- return !a && t !== null && e !== null && l(e);
192
+ return !a && t !== null && e !== null && c(e);
193
193
  }
194
- function C(e, t, a) {
194
+ function k(e, t, a) {
195
195
  try {
196
196
  e == null || e(t, a);
197
197
  } catch (n) {
198
198
  console.error(`onEvent("${t}") threw:`, n);
199
199
  }
200
200
  }
201
- async function W({
201
+ async function F({
202
202
  api: e,
203
203
  options: t,
204
204
  emit: a
205
205
  }) {
206
206
  try {
207
- const n = await F({ api: e, options: t }), { session: o, sessionPromoted: r } = await x({ api: e, sessionID: n });
207
+ const n = await W({ api: e, options: t }), { session: o, sessionPromoted: r } = await x({ api: e, sessionID: n });
208
208
  a("session.loaded", M(o));
209
209
  const s = await Y({
210
210
  api: e,
@@ -215,11 +215,11 @@ async function W({
215
215
  return { ok: !1 };
216
216
  }
217
217
  }
218
- async function F({
218
+ async function W({
219
219
  api: e,
220
220
  options: t
221
221
  }) {
222
- return l(t) ? t.sessionID : (await e.createSession({
222
+ return c(t) ? t.sessionID : (await e.createSession({
223
223
  amount: t.transaction.amount,
224
224
  amountCurrency: t.transaction.currency,
225
225
  descriptor: t.transaction.descriptor,
@@ -231,16 +231,16 @@ async function x({
231
231
  sessionID: t
232
232
  }) {
233
233
  const a = await e.getSession(t);
234
- return { session: a, sessionPromoted: k(a) };
234
+ return { session: a, sessionPromoted: T(a) };
235
235
  }
236
236
  function M(e) {
237
237
  return {
238
238
  sessionID: e.sessionID,
239
239
  merchantName: e.merchantName,
240
- alreadyPromoted: k(e)
240
+ alreadyPromoted: T(e)
241
241
  };
242
242
  }
243
- function k(e) {
243
+ function T(e) {
244
244
  return !!e.transactionID;
245
245
  }
246
246
  async function Y({
@@ -333,10 +333,16 @@ const B = {
333
333
  "asset.insufficientBalanceWarning": "Your {codes} balance won't fully cover this payment. Top up, or choose a different coin.",
334
334
  "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.",
335
335
  "asset.backToNetworks": "Back to networks",
336
+ "asset.noBalance": "No balance",
337
+ "asset.noSupportedCoins": "None of the coins accepted for this payment can be paid from this checkout.",
338
+ "asset.noSupportedCoinsForMerchant": "None of the coins {merchant} accepts can be paid from this checkout.",
339
+ "asset.noCoinsForWalletChains": "{wallet} didn't approve a network these coins can be sent on. Choose a different wallet, or reconnect and approve one.",
340
+ "asset.noAcceptedCoinsOnNetwork": "None of the coins accepted for this payment can be sent on {network}. Choose a different network.",
336
341
  "network.chooseNetwork": "Choose a network",
337
342
  "network.walletSupportWarning": "Please make sure you choose a network that your crypto wallet supports.",
338
343
  "network.noSupportedNetworks": "{wallet} doesn't support any of the networks available for this payment.",
339
344
  "network.noSupportedNetworksForMerchant": "{wallet} doesn't support any of the networks available for {merchant}.",
345
+ "network.noNetworksAvailable": "No networks are available for this payment. Contact the merchant if you think this is wrong.",
340
346
  "network.recommended": "RECOMMENDED",
341
347
  "network.fee": "Network fee: {fee}",
342
348
  "kyc.additionalInfoRequired": "Additional info required",
@@ -555,7 +561,7 @@ function K() {
555
561
  setOptions: (t) => {
556
562
  e = t;
557
563
  },
558
- emit: (t, a) => C(e == null ? void 0 : e.onEvent, t, a),
564
+ emit: (t, a) => k(e == null ? void 0 : e.onEvent, t, a),
559
565
  paymentFailed: (t, a) => {
560
566
  var n;
561
567
  return (n = e == null ? void 0 : e.paymentFailedListener) == null ? void 0 : n.call(e, t, a);
@@ -608,7 +614,7 @@ class G extends HTMLElement {
608
614
  // Not started in the constructor: a page can carry the tag and never check out.
609
615
  // Overlapping initialize() calls share one download.
610
616
  getOrLoadEngine() {
611
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-uNB2ytN4.js").then((t) => t.m).then((t) => {
617
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-7GpOY00I.js").then((t) => t.m).then((t) => {
612
618
  const a = t.mountCheckoutEngine({
613
619
  host: this,
614
620
  shadowRoot: this.shadow
@@ -676,17 +682,17 @@ class G extends HTMLElement {
676
682
  function H(e) {
677
683
  return new R(
678
684
  U(e),
679
- l(e) ? void 0 : e.publishableKey
685
+ c(e) ? void 0 : e.publishableKey
680
686
  );
681
687
  }
682
688
  function j({
683
689
  api: e,
684
690
  options: t
685
691
  }) {
686
- return W({
692
+ return F({
687
693
  api: e,
688
694
  options: t,
689
- emit: (a, n) => C(t.onEvent, a, n)
695
+ emit: (a, n) => k(t.onEvent, a, n)
690
696
  });
691
697
  }
692
698
  customElements.get("lydian-checkout") || customElements.define("lydian-checkout", G);
@@ -696,12 +702,12 @@ function h() {
696
702
  async function z(e) {
697
703
  if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
698
704
  throw new Error("SDK initialization requires publishableKey and a transaction");
699
- const t = T(e);
705
+ const t = P(e);
700
706
  if (t)
701
707
  throw new Error(t);
702
- if (!A(e.transaction.currency))
708
+ if (!N(e.transaction.currency))
703
709
  throw new Error("Invalid value for currency, valid values are: " + g.join(", "));
704
- const a = b({
710
+ const a = C({
705
711
  options: e,
706
712
  unsupportedKeys: ["sessionID"],
707
713
  entryPoint: "init"
@@ -713,10 +719,10 @@ async function z(e) {
713
719
  async function Q(e) {
714
720
  if (!e.sessionID)
715
721
  throw new Error("initExistingSession requires a sessionID");
716
- const t = T(e);
722
+ const t = P(e);
717
723
  if (t)
718
724
  throw new Error(t);
719
- const a = b({
725
+ const a = C({
720
726
  options: e,
721
727
  unsupportedKeys: ["publishableKey", "transaction"],
722
728
  entryPoint: "initExistingSession"
@@ -739,16 +745,16 @@ export {
739
745
  M as e,
740
746
  Y as f,
741
747
  te as g,
742
- l as h,
743
- A as i,
748
+ c as h,
749
+ N as i,
744
750
  _ as j,
745
751
  q as k,
746
- k as l,
752
+ T as l,
747
753
  ee as m,
748
754
  $ as n,
749
755
  X as o,
750
756
  K as p,
751
- F as r,
757
+ W as r,
752
758
  m as s,
753
759
  v as t
754
760
  };
@@ -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-uNB2ytN4.js";
1
+ import { i as Fe, I as ft, g as Qt, h as pt, b as jn, s as Bn } from "./mountEngine-7GpOY00I.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-uNB2ytN4.js";
4
+ import { c as ei, g as ga } from "./mountEngine-7GpOY00I.js";
5
5
  var ti = { exports: {} }, cc;
6
6
  function Zf() {
7
7
  return cc || (cc = 1, (function(t, e) {