@lydianpay/sdk-web 3.19.1 → 3.19.3

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-DSq2OWCh.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-OiCybnPL.js";
5
+ import { g as ri, c as gr } from "./mountEngine-DSq2OWCh.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-ChVUIuMS.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-DThdDCxn.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-ChVUIuMS.js").then((h) => h.i),
9333
+ import("./dist-LOUNdWsS.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-BZZwoMeg.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-ChVUIuMS.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-ChVUIuMS.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,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-DSq2OWCh.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-OiCybnPL.js";
4
4
  function Sn(t, e) {
5
5
  if (!Te(t, { strict: !1 }))
6
6
  throw new Xe({ address: t });
@@ -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-ChVUIuMS.js";
5
+ import { v as w } from "./connect-multichain-BX6y692K.js";
6
+ import { a as l } from "./mountEngine-DSq2OWCh.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,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-DSq2OWCh.js";
2
+ import { r as Ti } from "./index-OiCybnPL.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-DSq2OWCh.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,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
@@ -496,6 +496,7 @@ const ae = {
496
496
  "kyc.physicalAddressChoice": "Address",
497
497
  "kyc.notCitizenOf": "I'm not a citizen of {country}",
498
498
  "kyc.citizenshipLabel": "Country of Citizenship",
499
+ "kyc.citizenshipPlaceholder": "Select country of citizenship",
499
500
  "kyc.cityOfBirthLabel": "City of birth",
500
501
  "kyc.cityOfBirthPlaceholder": "Enter city",
501
502
  "kyc.nationalIdLabel": "ID number",
@@ -656,7 +657,7 @@ const ae = {
656
657
  "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
658
  }, T = { en: ae }, R = "en";
658
659
  let L = R;
659
- function me() {
660
+ function fe() {
660
661
  return L;
661
662
  }
662
663
  function m(e, t) {
@@ -667,15 +668,26 @@ function m(e, t) {
667
668
  (o, r) => t[r] != null ? String(t[r]) : `{${r}}`
668
669
  ) : a;
669
670
  }
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({
671
+ const ne = /* @__PURE__ */ new Set([
672
+ i.SINGLE_PAYMENT_REQUIRED,
673
+ i.API_CANCELLED,
674
+ i.PAYMENT_TIMEOUT,
675
+ i.FRAUD_DECLINED,
676
+ i.FRAUD_REFUNDED,
677
+ i.FRAUD_HELD,
678
+ i.FORFEITED,
679
+ i.CANCELLED,
680
+ i.FRAUD
681
+ ]);
682
+ function oe(e) {
683
+ return e === i.SUCCESS ? "succeeded" : ne.has(e) ? "failed" : "active";
684
+ }
685
+ function re({
674
686
  transaction: e,
675
687
  session: t
676
688
  }) {
677
689
  var o, r, s;
678
- const a = ne(e.status);
690
+ const a = oe(e.status);
679
691
  if (a === "active")
680
692
  return null;
681
693
  if (a === "failed") {
@@ -693,7 +705,7 @@ function oe({
693
705
  };
694
706
  }
695
707
  const n = (o = e.payments) == null ? void 0 : o.find(
696
- (c) => c.status === K.CONFIRMED
708
+ (c) => c.status === j.CONFIRMED
697
709
  );
698
710
  return {
699
711
  outcome: a,
@@ -713,7 +725,7 @@ function oe({
713
725
  }
714
726
  };
715
727
  }
716
- function re() {
728
+ function se() {
717
729
  let e = null;
718
730
  return {
719
731
  setOptions: (t) => {
@@ -734,7 +746,7 @@ function re() {
734
746
  }
735
747
  };
736
748
  }
737
- class se extends HTMLElement {
749
+ class ie extends HTMLElement {
738
750
  constructor() {
739
751
  super(), this.engine = null, this.engineLoadPromise = null, this.isTornDown = !1, this.shadow = this.attachShadow({ mode: "open" });
740
752
  }
@@ -744,7 +756,7 @@ class se extends HTMLElement {
744
756
  this.isTornDown = !1;
745
757
  }
746
758
  async initialize(t) {
747
- const a = ie(t), n = ce({ api: a, options: t }), o = await this.loadEngine(t, n);
759
+ const a = ce(t), n = le({ api: a, options: t }), o = await this.loadEngine(t, n);
748
760
  !o || this.isTornDown || (this.engine = o, await o.initialize(t, { api: a, sessionLoad: n }));
749
761
  }
750
762
  async loadEngine(t, a) {
@@ -772,7 +784,7 @@ class se extends HTMLElement {
772
784
  // Not started in the constructor: a page can carry the tag and never check out.
773
785
  // Overlapping initialize() calls share one download.
774
786
  getOrLoadEngine() {
775
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-BlCoRuML.js").then((t) => t.m).then((t) => {
787
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-DSq2OWCh.js").then((t) => t.m).then((t) => {
776
788
  const a = t.mountCheckoutEngine({
777
789
  host: this,
778
790
  shadowRoot: this.shadow
@@ -805,9 +817,9 @@ class se extends HTMLElement {
805
817
  const n = await a;
806
818
  if (this.isDismissedByHost)
807
819
  return;
808
- const o = re();
820
+ const o = se();
809
821
  o.setOptions(t);
810
- const r = n.ok && n.linkedTransaction ? oe({
822
+ const r = n.ok && n.linkedTransaction ? re({
811
823
  transaction: n.linkedTransaction,
812
824
  session: n.session
813
825
  }) : null;
@@ -851,13 +863,13 @@ class se extends HTMLElement {
851
863
  t == null || t.teardown(), t == null || t.unmount(), this.engine = null, this.engineLoadPromise = null;
852
864
  }
853
865
  }
854
- function ie(e) {
855
- return new q(
856
- j(e),
866
+ function ce(e) {
867
+ return new G(
868
+ K(e),
857
869
  u(e) ? void 0 : e.publishableKey
858
870
  );
859
871
  }
860
- function ce({
872
+ function le({
861
873
  api: e,
862
874
  options: t
863
875
  }) {
@@ -867,22 +879,22 @@ function ce({
867
879
  emit: (a, n) => I(t.onEvent, a, n)
868
880
  });
869
881
  }
870
- customElements.get("lydian-checkout") || customElements.define("lydian-checkout", se);
882
+ customElements.get("lydian-checkout") || customElements.define("lydian-checkout", ie);
871
883
  function b() {
872
884
  return document.querySelector("lydian-checkout");
873
885
  }
874
- async function le(e) {
886
+ async function de(e) {
875
887
  if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
876
888
  throw new Error("SDK initialization requires publishableKey and a transaction");
877
- const t = v(e);
889
+ const t = A(e);
878
890
  if (t)
879
891
  throw new Error(t);
880
- const a = A(e);
892
+ const a = v(e);
881
893
  if (a)
882
894
  throw new Error(a);
883
- if (!O(e.transaction.currency))
895
+ if (!U(e.transaction.currency))
884
896
  throw new Error("Invalid value for currency, valid values are: " + E.join(", "));
885
- const n = D({
897
+ const n = S({
886
898
  options: e,
887
899
  unsupportedKeys: ["sessionID"],
888
900
  entryPoint: "init"
@@ -891,16 +903,16 @@ async function le(e) {
891
903
  throw new Error(n);
892
904
  await b().initialize(e);
893
905
  }
894
- async function de(e) {
906
+ async function ue(e) {
895
907
  if (!e.sessionID)
896
908
  throw new Error("initExistingSession requires a sessionID");
897
- const t = v(e);
909
+ const t = A(e);
898
910
  if (t)
899
911
  throw new Error(t);
900
- const a = A(e);
912
+ const a = v(e);
901
913
  if (a)
902
914
  throw new Error(a);
903
- const n = D({
915
+ const n = S({
904
916
  options: e,
905
917
  unsupportedKeys: ["publishableKey", "transaction"],
906
918
  entryPoint: "initExistingSession"
@@ -909,30 +921,30 @@ async function de(e) {
909
921
  throw new Error(n);
910
922
  await b().initialize(e);
911
923
  }
912
- async function ue(e) {
924
+ async function ye(e) {
913
925
  await b().updateTransaction(e);
914
926
  }
915
- window.Lydian = { init: le, initExistingSession: de, updateTransaction: ue };
927
+ window.Lydian = { init: de, initExistingSession: ue, updateTransaction: ye };
916
928
  export {
917
- U as G,
929
+ O as G,
918
930
  H as P,
919
931
  i as T,
920
- K as a,
921
- pe as b,
932
+ j as a,
933
+ he as b,
922
934
  E as c,
923
935
  Z as d,
924
936
  ee as e,
925
937
  te as f,
926
- me as g,
938
+ fe as g,
927
939
  u as h,
928
- O as i,
929
- ne as j,
930
- oe as k,
940
+ U as i,
941
+ oe as j,
942
+ re as k,
931
943
  N as l,
932
- he as m,
944
+ me as m,
933
945
  P as n,
934
- ye as o,
935
- re as p,
946
+ pe as o,
947
+ se as p,
936
948
  V as r,
937
949
  h as s,
938
950
  m as t
@@ -1,4 +1,4 @@
1
- import { g as L } from "./mountEngine-BlCoRuML.js";
1
+ import { g as L } from "./mountEngine-DSq2OWCh.js";
2
2
  var x = { exports: {} }, E;
3
3
  function C() {
4
4
  return E || (E = 1, (function(g) {