@payfurl/client 4.6.1 → 4.6.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.
Files changed (40) hide show
  1. package/README.md +4 -0
  2. package/dist/sdk/{CxPayThreeDsProvider-068b25ce.mjs → CxPayThreeDsProvider-40d2c5fb.mjs} +3 -3
  3. package/dist/sdk/{DefaultThreeDsProvider-e98c909f.mjs → DefaultThreeDsProvider-5cb383f3.mjs} +21 -20
  4. package/dist/sdk/EcentricThreeDsProvider-3dcd4237.mjs +90 -0
  5. package/dist/sdk/{EpnaThreeDsProvider-189e652c.mjs → EpnaThreeDsProvider-a660b17d.mjs} +3 -3
  6. package/dist/sdk/{FlashBancThreeDsProvider-36e453b8.mjs → FlashBancThreeDsProvider-b99fd0a8.mjs} +3 -3
  7. package/dist/sdk/{GPaymentsThreeDsProvider-fe5a9704.mjs → GPaymentsThreeDsProvider-5cf80737.mjs} +4 -4
  8. package/dist/sdk/MetricsGlobalThreeDsProvider-d1b2c081.mjs +153 -0
  9. package/dist/sdk/{NmiThreeDsProvider-f7c7a154.mjs → NmiThreeDsProvider-396a0ddd.mjs} +3 -3
  10. package/dist/sdk/NuveiThreeDsProvider-26959462.mjs +182 -0
  11. package/dist/sdk/PayWayAppleButton-c8432bce.mjs +115 -0
  12. package/dist/sdk/{PayabliThreeDsProvider-66b568d3.mjs → PayabliThreeDsProvider-a7d94b89.mjs} +3 -3
  13. package/dist/sdk/{SkyBankThreeDsProvider-fbfe9597.mjs → SkyBankThreeDsProvider-20cd542d.mjs} +3 -3
  14. package/dist/sdk/{ThreeDsProvider.interface-da0ab2aa.mjs → ThreeDsProvider.interface-370c3a6b.mjs} +9 -3
  15. package/dist/sdk/cxpay-6d57641b.mjs +10 -0
  16. package/dist/sdk/{default-957c2000.mjs → default-76303d08.mjs} +2 -2
  17. package/dist/sdk/ecentric-81f3631c.mjs +9 -0
  18. package/dist/sdk/epna-b6806a36.mjs +10 -0
  19. package/dist/sdk/flashbanc-a06cb783.mjs +10 -0
  20. package/dist/sdk/{gpayments-dce1eccd.mjs → gpayments-49110aa8.mjs} +3 -3
  21. package/dist/sdk/main-55a85033.mjs +9835 -0
  22. package/dist/sdk/{metrics_global-5f5b54ee.mjs → metrics_global-ba0fb545.mjs} +3 -3
  23. package/dist/sdk/nmi-8ce29228.mjs +10 -0
  24. package/dist/sdk/nuvei-f2384e2a.mjs +9 -0
  25. package/dist/sdk/payabli-1a296ee4.mjs +10 -0
  26. package/dist/sdk/payfurl.es.js +1 -1
  27. package/dist/sdk/payfurl.umd.js +13 -51
  28. package/dist/sdk/payway_rest-e2ce2046.mjs +8 -0
  29. package/dist/sdk/skybank-bc06021d.mjs +10 -0
  30. package/dist/sdk/style.css +1 -1
  31. package/package.json +3 -2
  32. package/dist/sdk/MetricsGlobalThreeDsProvider-7f36be7b.mjs +0 -147
  33. package/dist/sdk/cxpay-6ff3d8ba.mjs +0 -10
  34. package/dist/sdk/ecentric-7741cdc3.mjs +0 -165
  35. package/dist/sdk/epna-1da33a88.mjs +0 -10
  36. package/dist/sdk/flashbanc-6eb51520.mjs +0 -10
  37. package/dist/sdk/main-eb4bb451.mjs +0 -18753
  38. package/dist/sdk/nmi-d67f1324.mjs +0 -10
  39. package/dist/sdk/payabli-02b4bd3b.mjs +0 -10
  40. package/dist/sdk/skybank-53b51d4e.mjs +0 -10
package/README.md CHANGED
@@ -90,3 +90,7 @@ so ensure that the environment name in the `payfurl.init` method is
90
90
  - enjoy *
91
91
 
92
92
  (* - optional)
93
+
94
+ ### Analyzing size
95
+ 1. Run `npm run build-sdk`
96
+ 2. Open `stats.html`
@@ -1,6 +1,6 @@
1
- import { MetricsGlobalThreeDsProvider as r } from "./MetricsGlobalThreeDsProvider-7f36be7b.mjs";
2
- import "./DefaultThreeDsProvider-e98c909f.mjs";
3
- import "./main-eb4bb451.mjs";
1
+ import { MetricsGlobalThreeDsProvider as r } from "./MetricsGlobalThreeDsProvider-d1b2c081.mjs";
2
+ import "./DefaultThreeDsProvider-5cb383f3.mjs";
3
+ import "./main-55a85033.mjs";
4
4
  class i extends r {
5
5
  getType() {
6
6
  return "CxPay";
@@ -1,8 +1,8 @@
1
1
  var D = Object.defineProperty;
2
2
  var u = (a, e, s) => e in a ? D(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
3
3
  var o = (a, e, s) => (u(a, typeof e != "symbol" ? e + "" : e, s), s);
4
- import { d as S, r as d, o as g, a as p, c as T, b as n, e as _, C as m, u as I, p as f, f as y, _ as A, j as v, T as C, i as c, g as E, F as R } from "./main-eb4bb451.mjs";
5
- const P = (a) => (f("data-v-c82daa22"), a = a(), y(), a), U = { class: "mask" }, $ = { class: "wrapper" }, L = { class: "container" }, b = /* @__PURE__ */ P(() => /* @__PURE__ */ n("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)), M = ["action"], w = ["value"], N = /* @__PURE__ */ S({
4
+ import { d as S, r as d, o as g, a as p, c as T, b as i, e as _, C as m, u as I, p as f, f as y, _ as A, k as v, T as C, j as c, h as E, F as R } from "./main-55a85033.mjs";
5
+ const P = (a) => (f("data-v-c82daa22"), a = a(), y(), a), U = { class: "mask" }, $ = { class: "wrapper" }, L = { class: "container" }, b = /* @__PURE__ */ P(() => /* @__PURE__ */ i("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)), M = ["action"], w = ["value"], k = /* @__PURE__ */ S({
6
6
  __name: "ThreeDsChallenge",
7
7
  props: {
8
8
  threeDSServerTransID: null,
@@ -17,29 +17,29 @@ const P = (a) => (f("data-v-c82daa22"), a = a(), y(), a), U = { class: "mask" },
17
17
  messageVersion: "2.1.0",
18
18
  messageType: "CReq",
19
19
  challengeWindowSize: "01"
20
- }), i = encodeURI(window.btoa(r).replace(/=*$/, ""));
20
+ }), n = encodeURI(window.btoa(r).replace(/=*$/, ""));
21
21
  return g(() => {
22
22
  var h;
23
23
  (h = t.value) == null || h.submit();
24
24
  }), (h, l) => (p(), T("div", U, [
25
- n("div", $, [
26
- n("div", L, [
25
+ i("div", $, [
26
+ i("div", L, [
27
27
  _(m, {
28
28
  onClick: l[0] || (l[0] = (V) => e("close")),
29
29
  id: "3ds-challenge-close"
30
30
  }),
31
31
  b,
32
- n("form", {
32
+ i("form", {
33
33
  action: s.formAction,
34
34
  target: "ThreeDsChallengeIFrame",
35
35
  method: "post",
36
36
  ref_key: "form",
37
37
  ref: t
38
38
  }, [
39
- n("input", {
39
+ i("input", {
40
40
  type: "hidden",
41
41
  name: "creq",
42
- value: I(i)
42
+ value: I(n)
43
43
  }, null, 8, w)
44
44
  ], 8, M)
45
45
  ])
@@ -47,7 +47,7 @@ const P = (a) => (f("data-v-c82daa22"), a = a(), y(), a), U = { class: "mask" },
47
47
  ]));
48
48
  }
49
49
  });
50
- const k = /* @__PURE__ */ A(N, [["__scopeId", "data-v-c82daa22"]]), O = "3ds_method_invocation_complete", q = "3ds_challenge_complete";
50
+ const N = /* @__PURE__ */ A(k, [["__scopeId", "data-v-c82daa22"]]), O = "3ds_method_invocation_complete", q = "3ds_challenge_complete";
51
51
  class F {
52
52
  constructor(e, s, t) {
53
53
  o(this, "log");
@@ -70,10 +70,10 @@ class F {
70
70
  (r = this.threeDsProcessor) == null || r.onError({ error: "3D Secure failed", body: s });
71
71
  });
72
72
  o(this, "onSuccess", (e, s) => {
73
- var r, i;
73
+ var r, n;
74
74
  this.closeChallenge(), c();
75
75
  const t = JSON.parse(s);
76
- ["Y", "A"].includes(t.transStatus) ? (r = this.threeDsProcessor) == null || r.onSuccess(t) : (this.log(`[${this.getType()}]: 3D Secure failed`, t), (i = this.threeDsProcessor) == null || i.onError({ error: "3D Secure failed" }));
76
+ ["Y", "A"].includes(t.transStatus) ? (r = this.threeDsProcessor) == null || r.onSuccess(t) : (this.log(`[${this.getType()}]: 3D Secure failed`, t), (n = this.threeDsProcessor) == null || n.onError({ error: "3D Secure failed" }));
77
77
  });
78
78
  o(this, "onInitAuthSuccess", (e, s) => {
79
79
  const t = JSON.parse(s);
@@ -96,7 +96,7 @@ class F {
96
96
  this.onError(e, "Invalid Challenge Url");
97
97
  return;
98
98
  }
99
- this.doChallenge(t.acsURL, t.acsTransID);
99
+ this.doChallenge(t.acsURL, t.acsTransID, t.authenticationValue);
100
100
  break;
101
101
  case "N":
102
102
  this.log(`[${this.getType()}][threeDsAuth], 3DS Verification failed, transaction denied`), this.onError(400, "3DS Verification failed, transaction denied");
@@ -178,25 +178,26 @@ class F {
178
178
  const s = JSON.parse(window.atob(e.data.cres));
179
179
  this.log(`[${this.getType()}]: cresData`, s), ["Y", "A"].includes(s.transStatus) ? this.onPostAuth() : ["N", "U", "R"].includes(s.transStatus) && (this.log(`[${this.getType()}]: Failed 3DS Challenge`, e.data), this.onError(400, "Failed 3DS Challenge"));
180
180
  }
181
- doChallenge(e, s) {
181
+ doChallenge(e, s, t) {
182
182
  this.log(`[${this.getType()}][doChallenge]`), c();
183
- const { destroy: t } = E({
183
+ const { destroy: r } = E({
184
184
  el: document.body,
185
- component: k,
185
+ component: N,
186
186
  props: {
187
187
  threeDSServerTransID: this.threeDSServerTransID,
188
188
  acsTransID: s,
189
- formAction: e
189
+ formAction: e,
190
+ authenticationValue: t
190
191
  },
191
192
  on: {
192
193
  close: () => {
193
- var r;
194
- t(), this.threeDSDestroy = () => {
195
- }, (r = this.threeDsProcessor) == null || r.onError({ error: "Challenge cancelled" });
194
+ var n;
195
+ r(), this.threeDSDestroy = () => {
196
+ }, (n = this.threeDsProcessor) == null || n.onError({ error: "Challenge cancelled" });
196
197
  }
197
198
  }
198
199
  });
199
- this.threeDSDestroy = t;
200
+ this.threeDSDestroy = r;
200
201
  }
201
202
  closeChallenge() {
202
203
  var e;
@@ -0,0 +1,90 @@
1
+ var c = Object.defineProperty;
2
+ var h = (t, s, e) => s in t ? c(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var i = (t, s, e) => (h(t, typeof s != "symbol" ? s + "" : s, e), e);
4
+ import { DefaultThreeDsProvider as d } from "./DefaultThreeDsProvider-5cb383f3.mjs";
5
+ import { d as p, r as u, o as _, a as D, c as m, b as r, e as g, C as S, u as y, p as f, f as T, _ as v, h as C } from "./main-55a85033.mjs";
6
+ const I = (t) => (f("data-v-82a75009"), t = t(), T(), t), P = { class: "mask" }, A = { class: "wrapper" }, V = { class: "container" }, E = /* @__PURE__ */ I(() => /* @__PURE__ */ r("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)), $ = ["action"], k = ["value"], x = /* @__PURE__ */ p({
7
+ __name: "ecentric",
8
+ props: {
9
+ threeDSServerTransID: null,
10
+ acsTransID: null,
11
+ formAction: null,
12
+ authenticationValue: null
13
+ },
14
+ setup(t) {
15
+ const s = t, e = u(null), n = s.authenticationValue;
16
+ return _(() => {
17
+ var o;
18
+ (o = e.value) == null || o.submit();
19
+ }), (o, a) => (D(), m("div", P, [
20
+ r("div", A, [
21
+ r("div", V, [
22
+ g(S, {
23
+ onClick: a[0] || (a[0] = (l) => o.emit("close"))
24
+ }),
25
+ E,
26
+ r("form", {
27
+ action: s.formAction,
28
+ target: "ThreeDsChallengeIFrame",
29
+ method: "post",
30
+ ref_key: "form",
31
+ ref: e
32
+ }, [
33
+ r("input", {
34
+ type: "hidden",
35
+ name: "PaReq",
36
+ value: y(n)
37
+ }, null, 8, k)
38
+ ], 8, $)
39
+ ])
40
+ ])
41
+ ]));
42
+ }
43
+ });
44
+ const R = /* @__PURE__ */ v(x, [["__scopeId", "data-v-82a75009"]]);
45
+ class w extends d {
46
+ constructor() {
47
+ super(...arguments);
48
+ i(this, "paResPayload", "");
49
+ }
50
+ getType() {
51
+ return "Ecentric";
52
+ }
53
+ onPostAuth() {
54
+ var e;
55
+ this.log(`[${this.getType()}][onPostAuth]`, {
56
+ threeDSServerTransID: this.threeDSServerTransID,
57
+ authenticationValue: this.paResPayload
58
+ }), (e = this.threeDsProcessor) == null || e.onPostAuth({
59
+ threeDSServerTransID: this.threeDSServerTransID,
60
+ authenticationValue: this.paResPayload
61
+ }, this.onSuccess, this.onError);
62
+ }
63
+ doChallenge(e, n, o) {
64
+ this.log(`[${this.getType()}][doChallenge]`);
65
+ const { destroy: a } = C({
66
+ el: document.body,
67
+ component: R,
68
+ props: {
69
+ threeDSServerTransID: this.threeDSServerTransID,
70
+ acsTransID: n,
71
+ formAction: e,
72
+ authenticationValue: o
73
+ },
74
+ on: {
75
+ close: () => {
76
+ var l;
77
+ a(), this.threeDSDestroy = () => {
78
+ }, (l = this.threeDsProcessor) == null || l.onError({ error: "Challenge cancelled" });
79
+ }
80
+ }
81
+ });
82
+ this.threeDSDestroy = a;
83
+ }
84
+ challengeComplete(e) {
85
+ this.log(`[${this.getType()}]: 3Ds Challenge complete`, e.data), this.closeChallenge(), this.log(`[${this.getType()}]: cresData`, e.data.cres), e.data.cres ? (this.paResPayload = e.data.cres, this.onPostAuth()) : (this.log(`[${this.getType()}]: Failed 3DS Challenge`, e.data), this.onError(400, "Failed 3DS Challenge"));
86
+ }
87
+ }
88
+ export {
89
+ w as EcentricThreeDsProvider
90
+ };
@@ -1,6 +1,6 @@
1
- import { MetricsGlobalThreeDsProvider as e } from "./MetricsGlobalThreeDsProvider-7f36be7b.mjs";
2
- import "./DefaultThreeDsProvider-e98c909f.mjs";
3
- import "./main-eb4bb451.mjs";
1
+ import { MetricsGlobalThreeDsProvider as e } from "./MetricsGlobalThreeDsProvider-d1b2c081.mjs";
2
+ import "./DefaultThreeDsProvider-5cb383f3.mjs";
3
+ import "./main-55a85033.mjs";
4
4
  class i extends e {
5
5
  getType() {
6
6
  return "EPNA";
@@ -1,6 +1,6 @@
1
- import { MetricsGlobalThreeDsProvider as r } from "./MetricsGlobalThreeDsProvider-7f36be7b.mjs";
2
- import "./DefaultThreeDsProvider-e98c909f.mjs";
3
- import "./main-eb4bb451.mjs";
1
+ import { MetricsGlobalThreeDsProvider as r } from "./MetricsGlobalThreeDsProvider-d1b2c081.mjs";
2
+ import "./DefaultThreeDsProvider-5cb383f3.mjs";
3
+ import "./main-55a85033.mjs";
4
4
  class s extends r {
5
5
  getType() {
6
6
  return "FlashBanc";
@@ -1,8 +1,8 @@
1
1
  var i = Object.defineProperty;
2
2
  var l = (n, r, e) => r in n ? i(n, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[r] = e;
3
3
  var o = (n, r, e) => (l(n, typeof r != "symbol" ? r + "" : r, e), e);
4
- import { DefaultThreeDsProvider as c } from "./DefaultThreeDsProvider-e98c909f.mjs";
5
- import { d as u, a as d, c as p, b as a, n as h, _ as g, g as _ } from "./main-eb4bb451.mjs";
4
+ import { DefaultThreeDsProvider as c } from "./DefaultThreeDsProvider-5cb383f3.mjs";
5
+ import { d as u, a as d, c as p, b as a, n as h, _, h as g } from "./main-55a85033.mjs";
6
6
  const m = { class: "mask" }, D = { class: "wrapper" }, S = ["src"], y = /* @__PURE__ */ u({
7
7
  __name: "GPayments",
8
8
  props: {
@@ -33,7 +33,7 @@ const m = { class: "mask" }, D = { class: "wrapper" }, S = ["src"], y = /* @__PU
33
33
  ]));
34
34
  }
35
35
  });
36
- const f = /* @__PURE__ */ g(y, [["__scopeId", "data-v-9b0ef3a8"]]);
36
+ const f = /* @__PURE__ */ _(y, [["__scopeId", "data-v-9b0ef3a8"]]);
37
37
  class A extends c {
38
38
  constructor() {
39
39
  super(...arguments);
@@ -74,7 +74,7 @@ class A extends c {
74
74
  }
75
75
  doChallenge(e) {
76
76
  this.log(`[${this.getType()}][doChallenge]`);
77
- const { destroy: s } = _({
77
+ const { destroy: s } = g({
78
78
  el: document.body,
79
79
  component: f,
80
80
  props: {
@@ -0,0 +1,153 @@
1
+ var w = Object.defineProperty;
2
+ var S = (o, n, t) => n in o ? w(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
+ var l = (o, n, t) => (S(o, typeof n != "symbol" ? n + "" : n, t), t);
4
+ import { DefaultThreeDsProvider as P } from "./DefaultThreeDsProvider-5cb383f3.mjs";
5
+ import { d as f, r as v, o as E, i as A, w as b, v as T, a as I, c as x, b as p, e as G, C as L, p as N, f as M, _ as $, j as c, s as g, k as H, h as k } from "./main-55a85033.mjs";
6
+ const O = (o) => (N("data-v-8a0b6dcb"), o = o(), M(), o), j = { class: "mask" }, B = { class: "wrapper" }, F = { class: "container" }, U = /* @__PURE__ */ O(() => /* @__PURE__ */ p("div", { id: "ThreeDsChallengeIFrame" }, null, -1)), W = /* @__PURE__ */ f({
7
+ __name: "MetricsGlobalThreeDsChallenge",
8
+ emits: ["close", "submit"],
9
+ setup(o, { emit: n }) {
10
+ const t = v(!1);
11
+ function e(s) {
12
+ var r;
13
+ ["3DS_CHALLENGE_SHOW", "3DS_CHALLENGE_CLOSE"].includes((r = s.data) == null ? void 0 : r.message) && (t.value = s.data.message === "3DS_CHALLENGE_SHOW");
14
+ }
15
+ return E(() => {
16
+ window.addEventListener("message", e);
17
+ }), A(() => {
18
+ window.removeEventListener("message", e);
19
+ }), (s, r) => b((I(), x("div", j, [
20
+ p("div", B, [
21
+ p("div", F, [
22
+ G(L, {
23
+ onClick: r[0] || (r[0] = (u) => n("close")),
24
+ id: "3ds-challenge-close"
25
+ }),
26
+ U
27
+ ])
28
+ ])
29
+ ], 512)), [
30
+ [T, t.value]
31
+ ]);
32
+ }
33
+ });
34
+ const V = /* @__PURE__ */ $(W, [["__scopeId", "data-v-8a0b6dcb"]]), m = 5;
35
+ class z extends P {
36
+ constructor(t, e, s) {
37
+ var r;
38
+ super(t, e, s);
39
+ l(this, "gateway");
40
+ l(this, "threeDS");
41
+ l(this, "numAttempts", 0);
42
+ this.initScript(((r = s.clientParameters) == null ? void 0 : r.PublicKey) || "");
43
+ }
44
+ getType() {
45
+ return "MetricsGlobal";
46
+ }
47
+ getDomain() {
48
+ return "secure.metricsglobalgateway.com";
49
+ }
50
+ onPreAuth() {
51
+ var t, e;
52
+ if (this.log(`[${this.getType()}]: onPreAuth`), !this.threeDS && this.numAttempts >= m) {
53
+ c(), g(this.container, "Error loading 3D Secure");
54
+ return;
55
+ }
56
+ if (!this.threeDS && this.numAttempts < m) {
57
+ this.numAttempts++, this.log(`[${this.getType()}]: 3DS not ready, retrying in 1s`), setTimeout(() => this.onPreAuth(), 1e3);
58
+ return;
59
+ }
60
+ (t = this.threeDsProcessor) != null && t.getTokenId() ? (e = this.threeDsProcessor) == null || e.getCardDetails(this.threeDsProcessor.getProviderId(), this.threeDsProcessor.getTokenId(), (s) => {
61
+ var r;
62
+ (r = this.threeDsProcessor) == null || r.setPaymentInfo(s), this.startAuth();
63
+ }, () => {
64
+ g(this.container, "Unable to get card information");
65
+ }) : this.startAuth();
66
+ }
67
+ onAuth(t, e) {
68
+ }
69
+ onPostAuth() {
70
+ }
71
+ startAuth() {
72
+ var D, y, d, _, C;
73
+ this.log(`[${this.getType()}]: startAuth`);
74
+ const t = (D = this.threeDsProcessor) == null ? void 0 : D.getPaymentInfo();
75
+ if (!t) {
76
+ c(), g(this.container, "Payment information is missing");
77
+ return;
78
+ }
79
+ H();
80
+ const e = (y = this.threeDsProcessor) == null ? void 0 : y.getAddressInfo(), s = t.expiryDate.length === 4 ? t.expiryDate[2] + t.expiryDate[3] : "", r = t.expiryDate.length === 4 ? t.expiryDate[0] + t.expiryDate[1] : "", u = {
81
+ cardNumber: t.cardNumber,
82
+ cardExpMonth: s,
83
+ cardExpYear: parseInt(r) + 2e3,
84
+ currency: (d = this.threeDsProcessor) == null ? void 0 : d.getCurrency(),
85
+ amount: (_ = this.threeDsProcessor) == null ? void 0 : _.getAmount(),
86
+ email: (C = this.threeDsProcessor) == null ? void 0 : C.getEmail(),
87
+ phone: e == null ? void 0 : e.phoneNumber,
88
+ city: e == null ? void 0 : e.city,
89
+ state: e == null ? void 0 : e.state,
90
+ address1: e == null ? void 0 : e.streetAddress,
91
+ country: e == null ? void 0 : e.country,
92
+ firstName: e == null ? void 0 : e.firstName,
93
+ lastName: e == null ? void 0 : e.lastName,
94
+ postalCode: e == null ? void 0 : e.postalCode
95
+ }, h = this.threeDS.createUI(u);
96
+ h.start("#ThreeDsChallengeIFrame"), h.on("challenge", (i) => {
97
+ this.log(`[${this.getType()}][onChallenge]`, i), c(), this.showChallenge();
98
+ }), h.on("complete", (i) => {
99
+ var a;
100
+ this.log(`[${this.getType()}][onComplete]`, i), this.removeChallenge(), (a = this.threeDsProcessor) == null || a.onSuccess({
101
+ externalThreeDsData: i
102
+ });
103
+ }), h.on("failure", (i) => {
104
+ var a;
105
+ this.log(`[${this.getType()}][onFailure]`, i), c(), this.closeChallenge(), (a = this.threeDsProcessor) == null || a.onError({ error: i.message });
106
+ }), h.on("error", (i) => {
107
+ var a;
108
+ this.log(`[${this.getType()}][error]`, i), c(), this.closeChallenge(), (a = this.threeDsProcessor) == null || a.onError({ error: i.message });
109
+ });
110
+ }
111
+ initScript(t) {
112
+ const e = document.createElement("script");
113
+ e.type = "text/javascript", e.src = `https://${this.getDomain()}/js/v1/Gateway.js`, e.onload = () => {
114
+ this.initGateway(t), this.initChallenge();
115
+ }, document.head.appendChild(e);
116
+ }
117
+ initGateway(t) {
118
+ this.gateway = window.Gateway.create(t), this.threeDS = this.gateway.get3DSecure(), this.gateway.on("error", (e) => {
119
+ var s;
120
+ this.log(`[${this.getType()}]: gateway error`, e), (s = this.threeDsProcessor) == null || s.onError({ error: e.message }), this.threeDS = null, this.numAttempts = m;
121
+ });
122
+ }
123
+ initChallenge() {
124
+ const { destroy: t } = k({
125
+ el: document.body,
126
+ component: V,
127
+ on: {
128
+ close: () => {
129
+ var e;
130
+ this.closeChallenge(), (e = this.threeDsProcessor) == null || e.onError({ error: "Challenge cancelled" });
131
+ }
132
+ }
133
+ });
134
+ this.threeDSDestroy = t;
135
+ }
136
+ showChallenge() {
137
+ window.postMessage({
138
+ message: "3DS_CHALLENGE_SHOW"
139
+ }, "*");
140
+ }
141
+ closeChallenge() {
142
+ window.postMessage({
143
+ message: "3DS_CHALLENGE_CLOSE"
144
+ }, "*");
145
+ }
146
+ removeChallenge() {
147
+ var t;
148
+ (t = this.threeDSDestroy) == null || t.call(this);
149
+ }
150
+ }
151
+ export {
152
+ z as MetricsGlobalThreeDsProvider
153
+ };
@@ -1,6 +1,6 @@
1
- import { MetricsGlobalThreeDsProvider as e } from "./MetricsGlobalThreeDsProvider-7f36be7b.mjs";
2
- import "./DefaultThreeDsProvider-e98c909f.mjs";
3
- import "./main-eb4bb451.mjs";
1
+ import { MetricsGlobalThreeDsProvider as e } from "./MetricsGlobalThreeDsProvider-d1b2c081.mjs";
2
+ import "./DefaultThreeDsProvider-5cb383f3.mjs";
3
+ import "./main-55a85033.mjs";
4
4
  class m extends e {
5
5
  getType() {
6
6
  return "NMI";
@@ -0,0 +1,182 @@
1
+ var d = Object.defineProperty;
2
+ var p = (n, r, s) => r in n ? d(n, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[r] = s;
3
+ var c = (n, r, s) => (p(n, typeof r != "symbol" ? r + "" : r, s), s);
4
+ import { d as m, o as g, k as D, j as u, a as S, c as _, p as f, f as y, b as h, _ as T, s as P, h as I, T as N } from "./main-55a85033.mjs";
5
+ import { DefaultThreeDsProvider as C, THREE_DS_METHOD_INVOCATION_COMPLETE as E, THREE_DS_CHALLENGE_COMPLETE as x } from "./DefaultThreeDsProvider-5cb383f3.mjs";
6
+ const A = (n) => (f("data-v-e3afa988"), n = n(), y(), n), V = { class: "mask" }, v = /* @__PURE__ */ A(() => /* @__PURE__ */ h("div", { class: "wrapper" }, [
7
+ /* @__PURE__ */ h("div", { class: "container" })
8
+ ], -1)), b = [
9
+ v
10
+ ], R = /* @__PURE__ */ m({
11
+ __name: "nuvei",
12
+ props: {
13
+ threeDSServerTransID: null,
14
+ sessionToken: null,
15
+ env: null,
16
+ merchantId: null,
17
+ merchantSiteId: null,
18
+ cardNumber: null,
19
+ cardHolderName: null,
20
+ expirationMonth: null,
21
+ expirationYear: null,
22
+ CVV: null,
23
+ firstName: null,
24
+ lastName: null,
25
+ email: null,
26
+ country: null
27
+ },
28
+ setup(n) {
29
+ const r = n;
30
+ g(() => {
31
+ D();
32
+ const a = document.createElement("script");
33
+ a.type = "text/javascript", a.src = "https://cdn.safecharge.com/safecharge_resources/v1/websdk/safecharge.js", a.onload = () => {
34
+ const e = new MutationObserver(function() {
35
+ document.getElementsByClassName("sfcModal-dialog")[0] && (u(), e.disconnect());
36
+ }), t = { childList: !0 }, o = document.querySelector("body");
37
+ e.observe(o, t), s();
38
+ }, document.head.appendChild(a);
39
+ });
40
+ function s() {
41
+ var a = SafeCharge({
42
+ env: r.env,
43
+ // Nuvei API environment - 'int' (integration) or 'prod' (production - default if omitted)
44
+ merchantId: r.merchantId,
45
+ //as assigned by Nuvei
46
+ merchantSiteId: r.merchantSiteId
47
+ // your Merchant Site ID provided by Nuvei
48
+ });
49
+ a.fields({
50
+ fonts: [
51
+ {
52
+ cssUrl: "https://fonts.googleapis.com/css?family=Source+Code+Pro"
53
+ }
54
+ // include your custom fonts
55
+ ],
56
+ locale: "en"
57
+ // You can set your users preferred locale. If not provided, we try to auto-detect.
58
+ }), a.authenticate3d({
59
+ sessionToken: r.sessionToken,
60
+ // received from openOrder API
61
+ paymentOption: {
62
+ card: {
63
+ cardNumber: r.cardNumber,
64
+ cardHolderName: r.cardHolderName,
65
+ expirationMonth: r.expirationMonth,
66
+ expirationYear: r.expirationYear,
67
+ CVV: r.CVV
68
+ }
69
+ },
70
+ billingAddress: {
71
+ firstName: r.firstName,
72
+ lastName: r.lastName,
73
+ email: r.email,
74
+ country: r.country
75
+ }
76
+ }, function(e) {
77
+ window.postMessage({ status: "3ds_challenge_complete", cres: e }, "*");
78
+ });
79
+ }
80
+ return (a, e) => (S(), _("div", V, b));
81
+ }
82
+ });
83
+ const M = /* @__PURE__ */ T(R, [["__scopeId", "data-v-e3afa988"]]);
84
+ class w extends C {
85
+ constructor() {
86
+ super(...arguments);
87
+ c(this, "_paResPayload", null);
88
+ c(this, "onSuccess", (s, a) => {
89
+ var t, o;
90
+ this.closeChallenge(), u();
91
+ const e = JSON.parse(a);
92
+ e.authenticationValue ? (t = this.threeDsProcessor) == null || t.onSuccess(e) : (this.log(`[${this.getType()}][_onSuccess] 3D Secure failed`, e), (o = this.threeDsProcessor) == null || o.onError({ error: "3D Secure failed" }));
93
+ });
94
+ c(this, "onDoAuthSuccess", (s, a) => {
95
+ var t, o, i;
96
+ const e = JSON.parse(a);
97
+ if (this.log(`[${this.getType()}][onDoAuthSuccess]`, e), !e.transStatus || !e.authenticationValue) {
98
+ this.onError(s, "No transStatus specified");
99
+ return;
100
+ }
101
+ switch (e.transStatus) {
102
+ case "C":
103
+ this.doNuveiChallenge(e.authenticationValue, (t = this.threeDsProcessor) == null ? void 0 : t.getAddressInfo(), (o = this.threeDsProcessor) == null ? void 0 : o.getPaymentInfo());
104
+ break;
105
+ default:
106
+ this.log(`[${this.getType()}][threeDsAuth], 3DS challenge not required, tranStatus: ` + e.transStatus), (i = this.threeDsProcessor) == null || i.onSuccess({
107
+ threeDSServerTransID: e.threeDSServerTransID,
108
+ threeDSRequestorTransID: "",
109
+ acsRenderingType: e.acsRenderingType,
110
+ acsTransID: e.acsTransID,
111
+ authenticationType: e.authenticationType,
112
+ authenticationValue: e.authenticationValue,
113
+ challengeCancel: "",
114
+ dsTransID: e.dsTransID,
115
+ eci: e.eci,
116
+ interactionCounter: "",
117
+ messageCategory: "",
118
+ messageExtension: e.messageExtension,
119
+ messageType: e.messageType,
120
+ messageVersion: e.messageVersion,
121
+ transStatus: e.transStatus,
122
+ transStatusReason: e.transStatusReason
123
+ });
124
+ break;
125
+ }
126
+ });
127
+ }
128
+ getType() {
129
+ return "Nuvei";
130
+ }
131
+ onPreAuth() {
132
+ var s, a;
133
+ this.log(`[${this.getType()}]: onPreAuth`), (s = this.threeDsProcessor) != null && s.getTokenId() ? (a = this.threeDsProcessor) == null || a.getCardDetails(this.threeDsProcessor.getProviderId(), this.threeDsProcessor.getTokenId(), (e) => {
134
+ var t;
135
+ (t = this.threeDsProcessor) == null || t.setPaymentInfo(e), super.onPreAuth();
136
+ }, () => {
137
+ P(this.container, "Unable to get card information");
138
+ }) : super.onPreAuth();
139
+ }
140
+ onPostAuth() {
141
+ var s;
142
+ this.log(`[${this.getType()}][onAuth] Do Post Authentication for transId`, this.threeDSServerTransID, this._paResPayload), (s = this.threeDsProcessor) == null || s.onPostAuth({
143
+ threeDSServerTransID: this.threeDSServerTransID,
144
+ authenticationValue: this._paResPayload.cavv,
145
+ eci: this._paResPayload.eci,
146
+ dsTransID: this._paResPayload.dsTransID,
147
+ threeDsVersion: this._paResPayload.threeDVersion,
148
+ xid: this._paResPayload.xid
149
+ }, this.onSuccess, this.onError);
150
+ }
151
+ doNuveiChallenge(s, a, e) {
152
+ var i;
153
+ const t = JSON.parse(s);
154
+ (t === null || !t.merchantId || !t.merchantSiteId) && ((i = this.threeDsProcessor) == null || i.onError({ error: "3D Secure failed" })), a && (t.firstName = a.firstName, t.lastName = a.lastName, t.email = a.email, t.country = a.country), e && (t.cardNumber = e.cardNumber, t.cardHolderName = e.cardholder, t.expirationMonth = e.expiryDate.substring(2, 4), t.expirationYear = e.expiryDate.substring(0, 2), t.CVV = e.ccv);
155
+ const { destroy: o } = I({
156
+ el: document.body,
157
+ component: M,
158
+ props: t,
159
+ on: {
160
+ close: () => {
161
+ var l;
162
+ o(), this.threeDSDestroy = () => {
163
+ }, (l = this.threeDsProcessor) == null || l.onError({ error: "Challenge cancelled" });
164
+ }
165
+ }
166
+ });
167
+ this.threeDSDestroy = o;
168
+ }
169
+ messageHandler(s) {
170
+ var a, e, t, o;
171
+ if (!(!((a = s == null ? void 0 : s.data) != null && a.status) || ((e = s == null ? void 0 : s.data) == null ? void 0 : e.status) === N)) {
172
+ if (s.data.status === E) {
173
+ this.log(`[${this.getType()}][messageHandler] 3Ds Method invocation complete`), s.stopPropagation(), this.onAuth(!0, "");
174
+ return;
175
+ }
176
+ s.data.status === x && (this.log(`[${this.getType()}][messageHandler] 3Ds Challenge complete`, s.data), s.stopPropagation(), this.closeChallenge(), s.data.cres && ((t = s.data.cres) == null ? void 0 : t.result) === "APPROVED" && ((o = s.data.cres) == null ? void 0 : o.errCode) === "0" ? (this._paResPayload = s.data.cres, this.onPostAuth()) : (this.log(`[${this.getType()}][messageHandler] Failed 3DS Challenge`, s.data), this.onError(400, "Failed 3DS Challenge")));
177
+ }
178
+ }
179
+ }
180
+ export {
181
+ w as NuveiThreeDsProvider
182
+ };