@lydianpay/sdk-web 3.19.3 → 3.19.4

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-DSq2OWCh.js";
1
+ import { g as c } from "./mountEngine-_G66fuAB.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-OiCybnPL.js";
5
- import { g as ri, c as gr } from "./mountEngine-DSq2OWCh.js";
4
+ import { E as Ja } from "./index-D5YydOtF.js";
5
+ import { g as ri, c as gr } from "./mountEngine-_G66fuAB.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-ChVUIuMS.js").then((n) => n.i), r = yield t.create(e);
7882
+ const { kvstore: e } = this, { SessionStore: t } = yield import("./index-DORsWhf1.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-DThdDCxn.js").then((i) => i.i);
8061
+ const { decrypt: e, encrypt: t, PrivateKey: r, PublicKey: n } = yield import("./index-CTmDBwNd.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-ChVUIuMS.js").then((h) => h.i),
9333
- import("./dist-LOUNdWsS.js"),
9332
+ import("./index-DORsWhf1.js").then((h) => h.i),
9333
+ import("./dist-BNHS8iis.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-BZZwoMeg.js").then((h) => h.b)).WebSocket
9337
+ typeof window < "u" ? WebSocket : (yield import("./browser-Gupuc6-M.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-ChVUIuMS.js").then((y) => y.i);
9402
+ const { ProtocolError: d, ErrorCode: h } = yield import("./index-DORsWhf1.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-ChVUIuMS.js").then((l) => l.i);
9459
+ const { ProtocolError: o } = yield import("./index-DORsWhf1.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-ChVUIuMS.js";
5
- import { v as w } from "./connect-multichain-BX6y692K.js";
6
- import { a as l } from "./mountEngine-DSq2OWCh.js";
4
+ import { d as s } from "./index-DORsWhf1.js";
5
+ import { v as w } from "./connect-multichain-Bch0gsrc.js";
6
+ import { a as l } from "./mountEngine-_G66fuAB.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-DSq2OWCh.js";
1
+ import { i as Te, I as Xe, h as et, g as yn, b as vn, s as kn } from "./mountEngine-_G66fuAB.js";
2
2
  import { r as En, a as In } from "./utils-Ca8X9WUu.js";
3
- import { E as Cn } from "./index-OiCybnPL.js";
3
+ import { E as Cn } from "./index-D5YydOtF.js";
4
4
  function Sn(t, e) {
5
5
  if (!Te(t, { strict: !1 }))
6
6
  throw new Xe({ address: t });
@@ -1,4 +1,4 @@
1
- import { g as cn } from "./mountEngine-DSq2OWCh.js";
1
+ import { g as cn } from "./mountEngine-_G66fuAB.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-DSq2OWCh.js";
1
+ import { g as L } from "./mountEngine-_G66fuAB.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-DSq2OWCh.js";
2
- import { r as Ti } from "./index-OiCybnPL.js";
1
+ import { d as Si, g as wi } from "./mountEngine-_G66fuAB.js";
2
+ import { r as Ti } from "./index-D5YydOtF.js";
3
3
  function Pi(r, u) {
4
4
  for (var f = 0; f < u.length; f++) {
5
5
  const h = u[f];
@@ -14,7 +14,7 @@ class O extends Error {
14
14
  super(t, { cause: n }), this.name = "GatewayRequestError", this.errorCode = a;
15
15
  }
16
16
  }
17
- async function f(e) {
17
+ async function w(e) {
18
18
  const t = await e.clone().json().catch(() => null);
19
19
  return new O({
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 f(s);
47
+ throw await w(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 f(s);
56
+ throw await w(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 f(s);
62
+ throw await w(s);
63
63
  }
64
64
  }
65
65
  const l = "transaction", W = [
@@ -70,6 +70,7 @@ const l = "transaction", W = [
70
70
  "city",
71
71
  "region",
72
72
  "postalCode",
73
+ "addressCountry",
73
74
  "country",
74
75
  "yearOfBirth",
75
76
  "monthOfBirth",
@@ -144,18 +145,18 @@ function M(e, t) {
144
145
  });
145
146
  });
146
147
  }
147
- const w = "customer";
148
+ const h = "customer";
148
149
  class Y extends y {
149
150
  // PATCH /customer/otp -> text/plain "OTP sent" (no JSON body).
150
151
  async sendCustomerOTP(t) {
151
- return await this.requestText(`/${w}/otp`, {
152
+ return await this.requestText(`/${h}/otp`, {
152
153
  method: "PATCH",
153
154
  body: JSON.stringify(t)
154
155
  });
155
156
  }
156
157
  // PUT /customer/otp -> { customerUUID, kycValidated }.
157
158
  async authenticateCustomerOTP(t) {
158
- return await this.request(`/${w}/otp`, {
159
+ return await this.request(`/${h}/otp`, {
159
160
  method: "PUT",
160
161
  body: JSON.stringify(t)
161
162
  });
@@ -163,11 +164,17 @@ class Y extends y {
163
164
  // PUT /customer/pii -> the stored record, masked. Verifies the same code as
164
165
  // PUT /customer/otp; a code serves both until it expires.
165
166
  async getCustomerPII(t) {
166
- return await this.request(`/${w}/pii`, {
167
+ return await this.request(`/${h}/pii`, {
167
168
  method: "PUT",
168
169
  body: JSON.stringify(t)
169
170
  });
170
171
  }
172
+ async updateCustomerPII(t) {
173
+ return await this.request(`/${h}/pii`, {
174
+ method: "PATCH",
175
+ body: JSON.stringify(t)
176
+ });
177
+ }
171
178
  }
172
179
  const _ = "places", x = { "X-User": "lydian" };
173
180
  class B extends y {
@@ -295,7 +302,7 @@ function I(e, t, a) {
295
302
  console.error(`onEvent("${t}") threw:`, n);
296
303
  }
297
304
  }
298
- function h(e) {
305
+ function m(e) {
299
306
  if (!e)
300
307
  return;
301
308
  let t;
@@ -334,15 +341,15 @@ async function X(e) {
334
341
  try {
335
342
  const n = await t.json();
336
343
  return {
337
- failureURL: C(n == null ? void 0 : n.failureURL),
338
- cancelURL: C(n == null ? void 0 : n.cancelURL)
344
+ failureURL: k(n == null ? void 0 : n.failureURL),
345
+ cancelURL: k(n == null ? void 0 : n.cancelURL)
339
346
  };
340
347
  } catch {
341
348
  return {};
342
349
  }
343
350
  }
344
- function C(e) {
345
- return typeof e == "string" ? h(e) : void 0;
351
+ function k(e) {
352
+ return typeof e == "string" ? m(e) : void 0;
346
353
  }
347
354
  async function V({
348
355
  api: e,
@@ -399,7 +406,7 @@ function P({
399
406
  // Only a failure that ends the checkout carries a redirect. A retryable one
400
407
  // leaves the customer mid-flow with something still to do, and a host that
401
408
  // navigated on it would eject them on a hiccup.
402
- redirectURL: a ? h(o == null ? void 0 : o.failureURL) : void 0
409
+ redirectURL: a ? m(o == null ? void 0 : o.failureURL) : void 0
403
410
  }
404
411
  };
405
412
  }
@@ -647,11 +654,13 @@ const ae = {
647
654
  "errors.unsupportedRequirements": "We can't collect the details this payment needs. Please contact support.",
648
655
  "errors.verificationRejected": "We couldn't verify your identity, so this payment can't continue. Please contact support.",
649
656
  "errors.unableToVerifyDetails": "We could not verify your details. Please try again or contact support.",
657
+ "errors.unableToSaveDetails": "We could not save your changes. Please try again or contact support.",
650
658
  "errors.unableToRestoreDetails": "Unable to restore your details. Please try again.",
651
659
  "errors.couldNotRestoreDetails": "We could not restore your details. Please try again or contact support.",
652
660
  "validation.emailOrCountryMissing": "Email or country is missing.",
653
661
  "validation.invalidEmail": "Please enter a valid email address.",
654
662
  "validation.invalidDateOfBirth": "Please enter a valid date of birth.",
663
+ "validation.reenterFullAddress": "Enter your full new address.",
655
664
  "validation.customerDetailsMissing": "Customer details are missing.",
656
665
  "validation.invalidOtp": "Please enter a valid 6-digit code.",
657
666
  "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>.'
@@ -660,7 +669,7 @@ let L = R;
660
669
  function fe() {
661
670
  return L;
662
671
  }
663
- function m(e, t) {
672
+ function f(e, t) {
664
673
  var n;
665
674
  const a = ((n = T[L]) == null ? void 0 : n[e]) ?? T[R][e] ?? e;
666
675
  return t ? a.replace(
@@ -694,13 +703,13 @@ function re({
694
703
  const p = e.status === i.PAYMENT_TIMEOUT && e.paymentStatus === H.PARTIALLY_PAID || e.status === i.SINGLE_PAYMENT_REQUIRED;
695
704
  return {
696
705
  outcome: a,
697
- message: m(p ? "errors.paymentShortRefundRequested" : "errors.paymentCouldNotComplete"),
706
+ message: f(p ? "errors.paymentShortRefundRequested" : "errors.paymentCouldNotComplete"),
698
707
  failure: {
699
708
  shouldEndCheckout: !0,
700
709
  // Negative (non-KYC) status — cancelled / fraud / timeout.
701
710
  reason: "blocked",
702
711
  transactionID: e.transactionID,
703
- redirectURL: h(t == null ? void 0 : t.failureURL)
712
+ redirectURL: m(t == null ? void 0 : t.failureURL)
704
713
  }
705
714
  };
706
715
  }
@@ -721,7 +730,7 @@ function re({
721
730
  asset: n == null ? void 0 : n.cryptoAsset,
722
731
  network: n == null ? void 0 : n.cryptoNetwork,
723
732
  completedAt: n == null ? void 0 : n.completedAt,
724
- redirectURL: h(t == null ? void 0 : t.successURL)
733
+ redirectURL: m(t == null ? void 0 : t.successURL)
725
734
  }
726
735
  };
727
736
  }
@@ -784,7 +793,7 @@ class ie extends HTMLElement {
784
793
  // Not started in the constructor: a page can carry the tag and never check out.
785
794
  // Overlapping initialize() calls share one download.
786
795
  getOrLoadEngine() {
787
- return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-DSq2OWCh.js").then((t) => t.m).then((t) => {
796
+ return this.engineLoadPromise ?? (this.engineLoadPromise = import("./mountEngine-_G66fuAB.js").then((t) => t.m).then((t) => {
788
797
  const a = t.mountCheckoutEngine({
789
798
  host: this,
790
799
  shadowRoot: this.shadow
@@ -840,16 +849,16 @@ class ie extends HTMLElement {
840
849
  return;
841
850
  }
842
851
  if (!n.ok && n.failureURL) {
843
- const p = m("errors.unableToCreateSession"), k = P({
852
+ const p = f("errors.unableToCreateSession"), C = P({
844
853
  message: p,
845
854
  reason: "sessionExpired",
846
855
  shouldEndCheckout: !0,
847
856
  session: { failureURL: n.failureURL }
848
857
  });
849
- o.emit("payment.failed", k.event), o.paymentFailed(p, k.failure);
858
+ o.emit("payment.failed", C.event), o.paymentFailed(p, C.failure);
850
859
  return;
851
860
  }
852
- const s = m("errors.checkoutUnavailable"), c = P({
861
+ const s = f("errors.checkoutUnavailable"), c = P({
853
862
  message: s,
854
863
  reason: "error",
855
864
  shouldEndCheckout: !0,
@@ -946,6 +955,6 @@ export {
946
955
  pe as o,
947
956
  se as p,
948
957
  V as r,
949
- h as s,
950
- m as t
958
+ m as s,
959
+ f as t
951
960
  };