@lydianpay/sdk-web 3.18.8 → 3.19.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,4 +1,4 @@
1
- import { g as c } from "./mountEngine-CPjfwc2K.js";
1
+ import { g as c } from "./mountEngine-BlCoRuML.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-DALnpVfN.js";
5
- import { g as ri, c as gr } from "./mountEngine-CPjfwc2K.js";
4
+ import { E as Ja } from "./index-dI__rqKb.js";
5
+ import { g as ri, c as gr } from "./mountEngine-BlCoRuML.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-B30eQbcz.js").then((n) => n.i), r = yield t.create(e);
7882
+ const { kvstore: e } = this, { SessionStore: t } = yield import("./index-DF2KOMki.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-Fw-eeN-M.js").then((i) => i.i);
8061
+ const { decrypt: e, encrypt: t, PrivateKey: r, PublicKey: n } = yield import("./index-DxqjdB8F.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-B30eQbcz.js").then((h) => h.i),
9333
- import("./dist-406JwPI2.js"),
9332
+ import("./index-DF2KOMki.js").then((h) => h.i),
9333
+ import("./dist-0Dd5FSyY.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-Cv7DBBbB.js").then((h) => h.b)).WebSocket
9337
+ typeof window < "u" ? WebSocket : (yield import("./browser-Da7U5b-F.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-B30eQbcz.js").then((y) => y.i);
9402
+ const { ProtocolError: d, ErrorCode: h } = yield import("./index-DF2KOMki.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-B30eQbcz.js").then((l) => l.i);
9459
+ const { ProtocolError: o } = yield import("./index-DF2KOMki.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-B30eQbcz.js";
5
- import { v as w } from "./connect-multichain-BdeuvYdb.js";
6
- import { a as l } from "./mountEngine-CPjfwc2K.js";
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";
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-CPjfwc2K.js";
1
+ import { i as Te, I as Xe, h as et, g as yn, b as vn, s as kn } from "./mountEngine-BlCoRuML.js";
2
2
  import { r as En, a as In } from "./utils-Ca8X9WUu.js";
3
- import { E as Cn } from "./index-DALnpVfN.js";
3
+ import { E as Cn } from "./index-dI__rqKb.js";
4
4
  function Sn(t, e) {
5
5
  if (!Te(t, { strict: !1 }))
6
6
  throw new Xe({ address: t });
@@ -14,7 +14,7 @@ class U extends Error {
14
14
  super(t, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
15
15
  }
16
16
  }
17
- async function m(e) {
17
+ async function f(e) {
18
18
  const t = await e.clone().json().catch(() => null);
19
19
  return new U({
20
20
  statusText: e.statusText,
@@ -44,7 +44,7 @@ class y {
44
44
  const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json", ...a == null ? void 0 : a.headers }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
45
45
  if (s.ok)
46
46
  return await s.json();
47
- throw await m(s);
47
+ throw await f(s);
48
48
  }
49
49
  // For endpoints that reply text/plain rather than JSON (e.g. PATCH
50
50
  // /customer/otp -> "OTP sent"). Sends the same JSON request headers but does
@@ -53,13 +53,13 @@ class y {
53
53
  const n = `${this.baseUri}${t}`, o = this.headers({ "Content-Type": "application/json" }), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
54
54
  if (s.ok)
55
55
  return await s.text();
56
- throw await m(s);
56
+ throw await f(s);
57
57
  }
58
58
  async requestWithFormData(t, a) {
59
59
  const n = `${this.baseUri}${t}`, o = this.headers(), r = Object.assign({}, a, { headers: o }), s = await fetch(n, r);
60
60
  if (s.ok)
61
61
  return await s.json();
62
- throw await m(s);
62
+ throw await f(s);
63
63
  }
64
64
  }
65
65
  const l = "transaction", W = [
@@ -144,18 +144,18 @@ function M(e, t) {
144
144
  });
145
145
  });
146
146
  }
147
- const f = "customer";
147
+ const w = "customer";
148
148
  class Y extends y {
149
149
  // PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
150
150
  async sendCustomerOTP(t) {
151
- return await this.requestText(`/${f}/otp`, {
151
+ return await this.requestText(`/${w}/otp`, {
152
152
  method: "PATCH",
153
153
  body: JSON.stringify(t)
154
154
  });
155
155
  }
156
156
  // PUT /customer/otp -> { customerUUID, kycValidated }.
157
157
  async authenticateCustomerOTP(t) {
158
- return await this.request(`/${f}/otp`, {
158
+ return await this.request(`/${w}/otp`, {
159
159
  method: "PUT",
160
160
  body: JSON.stringify(t)
161
161
  });
@@ -163,7 +163,7 @@ class Y extends y {
163
163
  // PUT /customer/pii -> the stored record, masked. Verifies the same code as
164
164
  // PUT /customer/otp; a code serves both until it expires.
165
165
  async getCustomerPII(t) {
166
- return await this.request(`/${f}/pii`, {
166
+ return await this.request(`/${w}/pii`, {
167
167
  method: "PUT",
168
168
  body: JSON.stringify(t)
169
169
  });
@@ -179,7 +179,7 @@ class _ extends y {
179
179
  }
180
180
  }
181
181
  const d = "session";
182
- class q extends y {
182
+ class G extends y {
183
183
  async createSession(t) {
184
184
  return await this.request(`/${d}`, {
185
185
  method: "POST",
@@ -217,9 +217,10 @@ class q extends y {
217
217
  }
218
218
  class S extends y {
219
219
  }
220
- M(S, [$, Y, _, q]);
221
- const G = S;
222
- var c = {
220
+ M(S, [$, Y, _, G]);
221
+ const q = S;
222
+ var i = {
223
+ SINGLE_PAYMENT_REQUIRED: -11,
223
224
  COMPLIANCE_PENDING: -10,
224
225
  API_CANCELLED: -9,
225
226
  PAYMENT_TIMEOUT: -8,
@@ -242,15 +243,15 @@ var c = {
242
243
  }, K = {
243
244
  PENDING: 0,
244
245
  CONFIRMED: 1
245
- }, w = {
246
+ }, g = {
246
247
  dev: "https://api.lydian.dev",
247
248
  sandbox: "https://api.sandbox.lydian.com",
248
249
  prod: "https://api.lydian.com"
249
250
  };
250
251
  function j(e) {
251
- return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? w.dev : e.sandbox ? w.sandbox : w.prod;
252
+ return e.gatewayUrl ? new URL(e.gatewayUrl).origin : e.dev ? g.dev : e.sandbox ? g.sandbox : g.prod;
252
253
  }
253
- function v({
254
+ function D({
254
255
  options: e,
255
256
  unsupportedKeys: t,
256
257
  entryPoint: a
@@ -258,7 +259,7 @@ function v({
258
259
  const n = t.filter((o) => e[o] !== void 0);
259
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.`;
260
261
  }
261
- function D(e) {
262
+ function v(e) {
262
263
  var t;
263
264
  return (t = e.flow) != null && t.walletConnect && !e.walletConnectProjectId ? "walletConnectProjectId is required when flow.walletConnect is on" : null;
264
265
  }
@@ -294,7 +295,7 @@ function I(e, t, a) {
294
295
  console.error(`onEvent("${t}") threw:`, n);
295
296
  }
296
297
  }
297
- function p(e) {
298
+ function h(e) {
298
299
  if (!e)
299
300
  return;
300
301
  let t;
@@ -306,8 +307,8 @@ function p(e) {
306
307
  return t.protocol === "https:" || t.protocol === "http:" ? e : void 0;
307
308
  }
308
309
  const J = [
309
- c.KYC_VERIFICATION_PENDING,
310
- c.COMPLIANCE_PENDING
310
+ i.KYC_VERIFICATION_PENDING,
311
+ i.COMPLIANCE_PENDING
311
312
  ];
312
313
  async function Q({
313
314
  api: e,
@@ -341,7 +342,7 @@ async function X(e) {
341
342
  }
342
343
  }
343
344
  function C(e) {
344
- return typeof e == "string" ? p(e) : void 0;
345
+ return typeof e == "string" ? h(e) : void 0;
345
346
  }
346
347
  async function V({
347
348
  api: e,
@@ -398,7 +399,7 @@ function P({
398
399
  // Only a failure that ends the checkout carries a redirect. A retryable one
399
400
  // leaves the customer mid-flow with something still to do, and a host that
400
401
  // navigated on it would eject them on a hiccup.
401
- redirectURL: a ? p(o == null ? void 0 : o.failureURL) : void 0
402
+ redirectURL: a ? h(o == null ? void 0 : o.failureURL) : void 0
402
403
  }
403
404
  };
404
405
  }
@@ -493,6 +494,8 @@ const ae = {
493
494
  "kyc.dateOfBirthPlaceholder": "Enter your date of birth",
494
495
  "kyc.dateAndPlaceOfBirthChoice": "Place and date of birth",
495
496
  "kyc.physicalAddressChoice": "Address",
497
+ "kyc.notCitizenOf": "I'm not a citizen of {country}",
498
+ "kyc.citizenshipLabel": "Country of Citizenship",
496
499
  "kyc.cityOfBirthLabel": "City of birth",
497
500
  "kyc.cityOfBirthPlaceholder": "Enter city",
498
501
  "kyc.nationalIdLabel": "ID number",
@@ -656,7 +659,7 @@ let L = R;
656
659
  function me() {
657
660
  return L;
658
661
  }
659
- function h(e, t) {
662
+ function m(e, t) {
660
663
  var n;
661
664
  const a = ((n = T[L]) == null ? void 0 : n[e]) ?? T[R][e] ?? e;
662
665
  return t ? a.replace(
@@ -665,7 +668,7 @@ function h(e, t) {
665
668
  ) : a;
666
669
  }
667
670
  function ne(e) {
668
- return e === c.SUCCESS ? "succeeded" : e < c.PENDING && e !== c.KYC_VERIFICATION_PENDING && e !== c.COMPLIANCE_PENDING ? "failed" : "active";
671
+ return e === i.SUCCESS ? "succeeded" : e < i.PENDING && e !== i.KYC_VERIFICATION_PENDING && e !== i.COMPLIANCE_PENDING ? "failed" : "active";
669
672
  }
670
673
  function oe({
671
674
  transaction: e,
@@ -676,21 +679,21 @@ function oe({
676
679
  if (a === "active")
677
680
  return null;
678
681
  if (a === "failed") {
679
- const i = e.status === c.PAYMENT_TIMEOUT && e.paymentStatus === H.PARTIALLY_PAID;
682
+ const p = e.status === i.PAYMENT_TIMEOUT && e.paymentStatus === H.PARTIALLY_PAID || e.status === i.SINGLE_PAYMENT_REQUIRED;
680
683
  return {
681
684
  outcome: a,
682
- message: h(i ? "errors.paymentShortRefundRequested" : "errors.paymentCouldNotComplete"),
685
+ message: m(p ? "errors.paymentShortRefundRequested" : "errors.paymentCouldNotComplete"),
683
686
  failure: {
684
687
  shouldEndCheckout: !0,
685
688
  // Negative (non-KYC) status — cancelled / fraud / timeout.
686
689
  reason: "blocked",
687
690
  transactionID: e.transactionID,
688
- redirectURL: p(t == null ? void 0 : t.failureURL)
691
+ redirectURL: h(t == null ? void 0 : t.failureURL)
689
692
  }
690
693
  };
691
694
  }
692
695
  const n = (o = e.payments) == null ? void 0 : o.find(
693
- (i) => i.status === K.CONFIRMED
696
+ (c) => c.status === K.CONFIRMED
694
697
  );
695
698
  return {
696
699
  outcome: a,
@@ -706,7 +709,7 @@ function oe({
706
709
  asset: n == null ? void 0 : n.cryptoAsset,
707
710
  network: n == null ? void 0 : n.cryptoNetwork,
708
711
  completedAt: n == null ? void 0 : n.completedAt,
709
- redirectURL: p(t == null ? void 0 : t.successURL)
712
+ redirectURL: h(t == null ? void 0 : t.successURL)
710
713
  }
711
714
  };
712
715
  }
@@ -769,7 +772,7 @@ class se extends HTMLElement {
769
772
  // Not started in the constructor: a page can carry the tag and never check out.
770
773
  // Overlapping initialize() calls share one download.
771
774
  getOrLoadEngine() {
772
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-CPjfwc2K.js").then((t) => t.m).then((t) => {
775
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-BlCoRuML.js").then((t) => t.m).then((t) => {
773
776
  const a = t.mountCheckoutEngine({
774
777
  host: this,
775
778
  shadowRoot: this.shadow
@@ -825,22 +828,22 @@ class se extends HTMLElement {
825
828
  return;
826
829
  }
827
830
  if (!n.ok && n.failureURL) {
828
- const b = h("errors.unableToCreateSession"), k = P({
829
- message: b,
831
+ const p = m("errors.unableToCreateSession"), k = P({
832
+ message: p,
830
833
  reason: "sessionExpired",
831
834
  shouldEndCheckout: !0,
832
835
  session: { failureURL: n.failureURL }
833
836
  });
834
- o.emit("payment.failed", k.event), o.paymentFailed(b, k.failure);
837
+ o.emit("payment.failed", k.event), o.paymentFailed(p, k.failure);
835
838
  return;
836
839
  }
837
- const s = h("errors.checkoutUnavailable"), i = P({
840
+ const s = m("errors.checkoutUnavailable"), c = P({
838
841
  message: s,
839
842
  reason: "error",
840
843
  shouldEndCheckout: !0,
841
844
  session: n.ok ? n.session : null
842
845
  });
843
- o.emit("payment.failed", i.event), o.paymentFailed(s, i.failure);
846
+ o.emit("payment.failed", c.event), o.paymentFailed(s, c.failure);
844
847
  }
845
848
  // Always teardown and unmount together to avoid leaking the React engine.
846
849
  // Clear the cached load so a later initialize() creates a fresh engine.
@@ -849,7 +852,7 @@ class se extends HTMLElement {
849
852
  }
850
853
  }
851
854
  function ie(e) {
852
- return new G(
855
+ return new q(
853
856
  j(e),
854
857
  u(e) ? void 0 : e.publishableKey
855
858
  );
@@ -865,13 +868,13 @@ function ce({
865
868
  });
866
869
  }
867
870
  customElements.get("lydian-checkout") || customElements.define("lydian-checkout", se);
868
- function g() {
871
+ function b() {
869
872
  return document.querySelector("lydian-checkout");
870
873
  }
871
874
  async function le(e) {
872
875
  if (!e.publishableKey || !e.transaction.amount || !e.transaction.currency)
873
876
  throw new Error("SDK initialization requires publishableKey and a transaction");
874
- const t = D(e);
877
+ const t = v(e);
875
878
  if (t)
876
879
  throw new Error(t);
877
880
  const a = A(e);
@@ -879,41 +882,41 @@ async function le(e) {
879
882
  throw new Error(a);
880
883
  if (!O(e.transaction.currency))
881
884
  throw new Error("Invalid value for currency, valid values are: " + E.join(", "));
882
- const n = v({
885
+ const n = D({
883
886
  options: e,
884
887
  unsupportedKeys: ["sessionID"],
885
888
  entryPoint: "init"
886
889
  });
887
890
  if (n)
888
891
  throw new Error(n);
889
- await g().initialize(e);
892
+ await b().initialize(e);
890
893
  }
891
894
  async function de(e) {
892
895
  if (!e.sessionID)
893
896
  throw new Error("initExistingSession requires a sessionID");
894
- const t = D(e);
897
+ const t = v(e);
895
898
  if (t)
896
899
  throw new Error(t);
897
900
  const a = A(e);
898
901
  if (a)
899
902
  throw new Error(a);
900
- const n = v({
903
+ const n = D({
901
904
  options: e,
902
905
  unsupportedKeys: ["publishableKey", "transaction"],
903
906
  entryPoint: "initExistingSession"
904
907
  });
905
908
  if (n)
906
909
  throw new Error(n);
907
- await g().initialize(e);
910
+ await b().initialize(e);
908
911
  }
909
912
  async function ue(e) {
910
- await g().updateTransaction(e);
913
+ await b().updateTransaction(e);
911
914
  }
912
915
  window.Lydian = { init: le, initExistingSession: de, updateTransaction: ue };
913
916
  export {
914
917
  U as G,
915
918
  H as P,
916
- c as T,
919
+ i as T,
917
920
  K as a,
918
921
  pe as b,
919
922
  E as c,
@@ -931,6 +934,6 @@ export {
931
934
  ye as o,
932
935
  re as p,
933
936
  V as r,
934
- p as s,
935
- h as t
937
+ h as s,
938
+ m as t
936
939
  };
@@ -1,5 +1,5 @@
1
- import { d as Si, g as wi } from "./mountEngine-CPjfwc2K.js";
2
- import { r as Ti } from "./index-DALnpVfN.js";
1
+ import { d as Si, g as wi } from "./mountEngine-BlCoRuML.js";
2
+ import { r as Ti } from "./index-dI__rqKb.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-CPjfwc2K.js";
1
+ import { g as cn } from "./mountEngine-BlCoRuML.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,4 +1,4 @@
1
- import { g as L } from "./mountEngine-CPjfwc2K.js";
1
+ import { g as L } from "./mountEngine-BlCoRuML.js";
2
2
  var x = { exports: {} }, E;
3
3
  function C() {
4
4
  return E || (E = 1, (function(g) {