@lydianpay/sdk-web 3.19.1 → 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.
@@ -1,4 +1,4 @@
1
- import { g as c } from "./mountEngine-BlCoRuML.js";
1
+ import { g as c } from "./mountEngine-D2BUJ6XE.js";
2
2
  function f(t, i) {
3
3
  for (var o = 0; o < i.length; o++) {
4
4
  const e = i[o];
@@ -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-dI__rqKb.js";
5
- import { g as ri, c as gr } from "./mountEngine-BlCoRuML.js";
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-DF2KOMki.js").then((n) => n.i), r = yield t.create(e);
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-DxqjdB8F.js").then((i) => i.i);
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-DF2KOMki.js").then((h) => h.i),
9333
- import("./dist-0Dd5FSyY.js"),
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-Da7U5b-F.js").then((h) => h.b)).WebSocket
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-DF2KOMki.js").then((y) => y.i);
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-DF2KOMki.js").then((l) => l.i);
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-DF2KOMki.js";
5
- import { v as w } from "./connect-multichain-Di5u--8V.js";
6
- import { a as l } from "./mountEngine-BlCoRuML.js";
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-BlCoRuML.js";
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-dI__rqKb.js";
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 O(e) {
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 U extends Error {
8
+ class O extends Error {
9
9
  constructor({
10
10
  statusText: t,
11
11
  errorCode: a,
@@ -16,7 +16,7 @@ class U extends Error {
16
16
  }
17
17
  async function f(e) {
18
18
  const t = await e.clone().json().catch(() => null);
19
- return new U({
19
+ return new O({
20
20
  statusText: e.statusText,
21
21
  errorCode: F(t),
22
22
  response: e
@@ -169,17 +169,17 @@ class Y extends y {
169
169
  });
170
170
  }
171
171
  }
172
- const x = "places", B = { "X-User": "lydian" };
173
- class _ extends y {
172
+ const _ = "places", x = { "X-User": "lydian" };
173
+ class B extends y {
174
174
  async getCountries(t) {
175
- return await this.request(`/${x}/countries`, {
176
- headers: B,
175
+ return await this.request(`/${_}/countries`, {
176
+ headers: x,
177
177
  signal: t
178
178
  });
179
179
  }
180
180
  }
181
181
  const d = "session";
182
- class G extends y {
182
+ class q extends y {
183
183
  async createSession(t) {
184
184
  return await this.request(`/${d}`, {
185
185
  method: "POST",
@@ -190,7 +190,7 @@ class G 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 (-3) response does not consume the promotion, which is
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,13 +215,12 @@ class G extends y {
215
215
  });
216
216
  }
217
217
  }
218
- class S extends y {
218
+ class D extends y {
219
219
  }
220
- M(S, [$, Y, _, G]);
221
- const q = S;
220
+ M(D, [$, Y, B, q]);
221
+ const G = D;
222
222
  var i = {
223
223
  SINGLE_PAYMENT_REQUIRED: -11,
224
- COMPLIANCE_PENDING: -10,
225
224
  API_CANCELLED: -9,
226
225
  PAYMENT_TIMEOUT: -8,
227
226
  FRAUD_DECLINED: -7,
@@ -230,17 +229,18 @@ var i = {
230
229
  // continuity with the merchant dashboard's existing call sites.
231
230
  FRAUD_HELD: -5,
232
231
  FORFEITED: -4,
233
- // A KYC-pending promote is NOT terminal and does not consume the session's
234
- // one promotion — the OTP restore flow re-promotes the same session.
235
- KYC_VERIFICATION_PENDING: -3,
236
232
  CANCELLED: -2,
237
233
  FRAUD: -1,
238
234
  PENDING: 0,
239
- 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
240
240
  }, H = {
241
241
  PARTIALLY_PAID: 1,
242
242
  OVERPAID: 3
243
- }, K = {
243
+ }, j = {
244
244
  PENDING: 0,
245
245
  CONFIRMED: 1
246
246
  }, g = {
@@ -248,10 +248,10 @@ var i = {
248
248
  sandbox: "https://api.sandbox.lydian.com",
249
249
  prod: "https://api.lydian.com"
250
250
  };
251
- function j(e) {
251
+ function K(e) {
252
252
  return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? g.dev : e.sandbox ? g.sandbox : g.prod;
253
253
  }
254
- function D({
254
+ function S({
255
255
  options: e,
256
256
  unsupportedKeys: t,
257
257
  entryPoint: a
@@ -259,11 +259,11 @@ function D({
259
259
  const n = t.filter((o) => e[o] !== void 0);
260
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.`;
261
261
  }
262
- function v(e) {
262
+ function A(e) {
263
263
  var t;
264
264
  return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
265
265
  }
266
- function A(e) {
266
+ function v(e) {
267
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)}`;
268
268
  }
269
269
  function z(e) {
@@ -275,13 +275,13 @@ function z(e) {
275
275
  }
276
276
  return (t.protocol === "http:" || t.protocol === "https:") && t.pathname === "/" && t.search === "" && t.hash === "";
277
277
  }
278
- function ye(e) {
278
+ function pe(e) {
279
279
  return e !== null && !u(e) && !!e.publishableKey;
280
280
  }
281
- function pe(e) {
281
+ function he(e) {
282
282
  return e !== null && !u(e);
283
283
  }
284
- function he({
284
+ function me({
285
285
  options: e,
286
286
  session: t,
287
287
  settled: a
@@ -656,7 +656,7 @@ const ae = {
656
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>.'
657
657
  }, T = { en: ae }, R = "en";
658
658
  let L = R;
659
- function me() {
659
+ function fe() {
660
660
  return L;
661
661
  }
662
662
  function m(e, t) {
@@ -667,15 +667,26 @@ function m(e, t) {
667
667
  (o, r) => t[r] != null ? String(t[r]) : `{${r}}`
668
668
  ) : a;
669
669
  }
670
- function ne(e) {
671
- return e === i.SUCCESS ? "succeeded" : e < i.PENDING && e !== i.KYC_VERIFICATION_PENDING && e !== i.COMPLIANCE_PENDING ? "failed" : "active";
672
- }
673
- function oe({
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({
674
685
  transaction: e,
675
686
  session: t
676
687
  }) {
677
688
  var o, r, s;
678
- const a = ne(e.status);
689
+ const a = oe(e.status);
679
690
  if (a === "active")
680
691
  return null;
681
692
  if (a === "failed") {
@@ -693,7 +704,7 @@ function oe({
693
704
  };
694
705
  }
695
706
  const n = (o = e.payments) == null ? void 0 : o.find(
696
- (c) => c.status === K.CONFIRMED
707
+ (c) => c.status === j.CONFIRMED
697
708
  );
698
709
  return {
699
710
  outcome: a,
@@ -713,7 +724,7 @@ function oe({
713
724
  }
714
725
  };
715
726
  }
716
- function re() {
727
+ function se() {
717
728
  let e = null;
718
729
  return {
719
730
  setOptions: (t) => {
@@ -734,7 +745,7 @@ function re() {
734
745
  }
735
746
  };
736
747
  }
737
- class se extends HTMLElement {
748
+ class ie extends HTMLElement {
738
749
  constructor() {
739
750
  super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
740
751
  }
@@ -744,7 +755,7 @@ class se extends HTMLElement {
744
755
  this.isTornDown = !1;
745
756
  }
746
757
  async initialize(t) {
747
- const a = ie(t), n = ce({ api: a, options: t }), o = await this.loadEngine(t, n);
758
+ const a = ce(t), n = le({ api: a, options: t }), o = await this.loadEngine(t, n);
748
759
  !o || this.isTornDown || (this.engine = o, await o.initialize(t, { api: a, sessionLoad: n }));
749
760
  }
750
761
  async loadEngine(t, a) {
@@ -772,7 +783,7 @@ class se extends HTMLElement {
772
783
  // Not started in the constructor: a page can carry the tag and never check out.
773
784
  // Overlapping initialize() calls share one download.
774
785
  getOrLoadEngine() {
775
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-BlCoRuML.js").then((t) => t.m).then((t) => {
786
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-D2BUJ6XE.js").then((t) => t.m).then((t) => {
776
787
  const a = t.mountCheckoutEngine({
777
788
  host: this,
778
789
  shadowRoot: this.shadow
@@ -805,9 +816,9 @@ class se extends HTMLElement {
805
816
  const n = await a;
806
817
  if (this.isDismissedByHost)
807
818
  return;
808
- const o = re();
819
+ const o = se();
809
820
  o.setOptions(t);
810
- const r = n.ok && n.linkedTransaction ? oe({
821
+ const r = n.ok && n.linkedTransaction ? re({
811
822
  transaction: n.linkedTransaction,
812
823
  session: n.session
813
824
  }) : null;
@@ -851,13 +862,13 @@ class se extends HTMLElement {
851
862
  t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
852
863
  }
853
864
  }
854
- function ie(e) {
855
- return new q(
856
- j(e),
865
+ function ce(e) {
866
+ return new G(
867
+ K(e),
857
868
  u(e) ? void 0 : e.publishableKey
858
869
  );
859
870
  }
860
- function ce({
871
+ function le({
861
872
  api: e,
862
873
  options: t
863
874
  }) {
@@ -867,22 +878,22 @@ function ce({
867
878
  emit: (a, n) => I(t.onEvent, a, n)
868
879
  });
869
880
  }
870
- customElements.get("lydian-checkout") || customElements.define("lydian-checkout", se);
881
+ customElements.get("lydian-checkout") || customElements.define("lydian-checkout", ie);
871
882
  function b() {
872
883
  return document.querySelector("lydian-checkout");
873
884
  }
874
- async function le(e) {
885
+ async function de(e) {
875
886
  if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
876
887
  throw new Error("SDK initialization requires publishableKey and a transaction");
877
- const t = v(e);
888
+ const t = A(e);
878
889
  if (t)
879
890
  throw new Error(t);
880
- const a = A(e);
891
+ const a = v(e);
881
892
  if (a)
882
893
  throw new Error(a);
883
- if (!O(e.transaction.currency))
894
+ if (!U(e.transaction.currency))
884
895
  throw new Error("Invalid value for currency, valid values are: " + E.join(", "));
885
- const n = D({
896
+ const n = S({
886
897
  options: e,
887
898
  unsupportedKeys: ["sessionID"],
888
899
  entryPoint: "init"
@@ -891,16 +902,16 @@ async function le(e) {
891
902
  throw new Error(n);
892
903
  await b().initialize(e);
893
904
  }
894
- async function de(e) {
905
+ async function ue(e) {
895
906
  if (!e.sessionID)
896
907
  throw new Error("initExistingSession requires a sessionID");
897
- const t = v(e);
908
+ const t = A(e);
898
909
  if (t)
899
910
  throw new Error(t);
900
- const a = A(e);
911
+ const a = v(e);
901
912
  if (a)
902
913
  throw new Error(a);
903
- const n = D({
914
+ const n = S({
904
915
  options: e,
905
916
  unsupportedKeys: ["publishableKey", "transaction"],
906
917
  entryPoint: "initExistingSession"
@@ -909,30 +920,30 @@ async function de(e) {
909
920
  throw new Error(n);
910
921
  await b().initialize(e);
911
922
  }
912
- async function ue(e) {
923
+ async function ye(e) {
913
924
  await b().updateTransaction(e);
914
925
  }
915
- window.Lydian = { init: le, initExistingSession: de, updateTransaction: ue };
926
+ window.Lydian = { init: de, initExistingSession: ue, updateTransaction: ye };
916
927
  export {
917
- U as G,
928
+ O as G,
918
929
  H as P,
919
930
  i as T,
920
- K as a,
921
- pe as b,
931
+ j as a,
932
+ he as b,
922
933
  E as c,
923
934
  Z as d,
924
935
  ee as e,
925
936
  te as f,
926
- me as g,
937
+ fe as g,
927
938
  u as h,
928
- O as i,
929
- ne as j,
930
- oe as k,
939
+ U as i,
940
+ oe as j,
941
+ re as k,
931
942
  N as l,
932
- he as m,
943
+ me as m,
933
944
  P as n,
934
- ye as o,
935
- re as p,
945
+ pe as o,
946
+ se as p,
936
947
  V as r,
937
948
  h as s,
938
949
  m as t
@@ -1,4 +1,4 @@
1
- import { g as L } from "./mountEngine-BlCoRuML.js";
1
+ import { g as L } from "./mountEngine-D2BUJ6XE.js";
2
2
  var x = { exports: {} }, E;
3
3
  function C() {
4
4
  return E || (E = 1, (function(g) {
@@ -1,5 +1,5 @@
1
- import { d as Si, g as wi } from "./mountEngine-BlCoRuML.js";
2
- import { r as Ti } from "./index-dI__rqKb.js";
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,4 +1,4 @@
1
- import { g as cn } from "./mountEngine-BlCoRuML.js";
1
+ import { g as cn } from "./mountEngine-D2BUJ6XE.js";
2
2
  import { a as Ot, r as an } from "./utils-Ca8X9WUu.js";
3
3
  function fn(t, f) {
4
4
  for (var y = 0; y < f.length; y++) {
@@ -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-BGAgYaji.js";
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 -3 (KYC-pending) promote response does not consume the session's single
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-Di5u--8V.js").then((i) => i.c), t = J6(), n = await e({
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-CWcQKmv5.js"), i = new t({
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-BGAgYaji.js";
1
+ import "./chunks/index-2aSnC3v4.js";