@payfurl/react-plugin 1.3.2 → 1.5.0

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 (43) hide show
  1. package/README.md +131 -0
  2. package/dist/{DefaultThreeDsProvider-ChnRLzKI-DO_0wVUN.js → DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js} +28 -44
  3. package/dist/MetricsGlobalThreeDsProvider-C93ttqbB-SRsVMed4.js +143 -0
  4. package/dist/{PayWayAppleButton-7Gi89Gij-aVF9l1aY.js → PayWayAppleButton-BzAwlGS--DB5BVl1o.js} +3 -13
  5. package/dist/components/PayfurlDropin.d.ts +22 -0
  6. package/dist/{cxpay-CGIndAf1-BblBk3-x.js → cxpay-DblHb5vN-C-l0lncv.js} +1 -1
  7. package/dist/{default-CgpOZU3K-CKDCWPRX.js → default-C7f86Fx--2njdEIN4.js} +1 -1
  8. package/dist/ecentric-B3UohyO_-XSxfe46h.js +82 -0
  9. package/dist/{epna-uXpYJKOA-B_n5GhIL.js → epna-DwUg2IlB-60mxqUE4.js} +1 -1
  10. package/dist/{flashbanc-9XKA8Wrl-CbS2P90X.js → flashbanc-LXs8bahL-z2X9avF_.js} +1 -1
  11. package/dist/forter-CLFaJUYa-0_gstIhb.js +36 -0
  12. package/dist/forter-DXQjpKVH-DaJPhK3m.js +57 -0
  13. package/dist/{gpayments-DsXj9xbu-BOBji_fr.js → gpayments-DoZug3PV-r91JBiIn.js} +15 -26
  14. package/dist/index-DxOlzt-Z.js +11576 -0
  15. package/dist/index.d.ts +3 -6
  16. package/dist/managedOrders-ojoMZ0Ab-B94-Nsp-.js +44 -0
  17. package/dist/metrics_global-BM-ooge--CapUrY7a.js +7 -0
  18. package/dist/{nmi-BzHX8wqW-Bq6oBsVL.js → nmi-BA3ZTdQa-DHWaU-52.js} +1 -1
  19. package/dist/nuvei-DIWsLlLz-Dnx1Hmez.js +165 -0
  20. package/dist/{payabli-C4YuB7Sr-BzB8PV73.js → payabli-DgrTI1Et-aNWdpC9M.js} +1 -1
  21. package/dist/payfurl-react.es.js +1 -1
  22. package/dist/payfurl-react.umd.js +19 -19
  23. package/dist/payglocal-ezp0MsaZ-CA7TeuKm.js +109 -0
  24. package/dist/{payway_rest-ZMjPv2si-Dd1VuLdw.js → payway_rest-D8-T-ULx-Dt-XGc-v.js} +1 -1
  25. package/dist/{skybank-C6ZmVyX6-DWxUPtI7.js → skybank-BgDLlFXX-BnauHbzw.js} +1 -1
  26. package/package.json +6 -4
  27. package/dist/MetricsGlobalThreeDsProvider-DW-gsG6q-BYJaEFfc.js +0 -148
  28. package/dist/ecentric-F3nn_MwX-B9dBXDe_.js +0 -81
  29. package/dist/forter-Bm2GJ2Hs-BABaUju5.js +0 -60
  30. package/dist/index-CACzT3Rb.js +0 -11783
  31. package/dist/metrics_global-L-Rm7bcl-DYSYHN2y.js +0 -7
  32. package/dist/nuvei-CS-nW8SB-v_HhomTx.js +0 -167
  33. package/dist/payglocal-Cy6Qd8ve-NfcHP9iv.js +0 -120
  34. package/dist/plugins/payfurl/react/src/components/PayfurlDropin.d.ts +0 -16
  35. package/dist/plugins/payfurl/react/src/index.d.ts +0 -6
  36. package/dist/src/click2pay/ClickToPayOptions.type.d.ts +0 -30
  37. package/dist/src/sdk/checkout/checkoutProvider.type.d.ts +0 -66
  38. package/dist/src/sdk/fraud/fraudProvider.type.d.ts +0 -3
  39. package/dist/src/sdk/types/DropInOptions.type.d.ts +0 -88
  40. package/dist/src/sdk/types/GooglePayButtonOptions.type.d.ts +0 -10
  41. package/dist/src/sdk/types/NetworkTokenOptions.type.d.ts +0 -6
  42. package/dist/src/sdk/types/PaymentType.type.d.ts +0 -15
  43. package/dist/src/sdk/types/UpiOptions.type.d.ts +0 -12
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # @payfurl/react-plugin
2
+
3
+ The payFURL drop-in for React. `PayfurlDropin` renders payFURL's payment form: cards, Google Pay, Apple
4
+ Pay, PayPal, PayTo and the other payment methods your payFURL account offers. It collects the payment
5
+ details without them touching your servers. It wraps the payFURL Client SDK
6
+ ([`@payfurl/client`](https://www.npmjs.com/package/@payfurl/client)), which it includes.
7
+
8
+ Full guide: [React on docs.payfurl.com](https://docs.payfurl.com/client_sdk/frameworks/react).
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ npm install @payfurl/react-plugin
14
+ ```
15
+
16
+ React 18 is a peer dependency.
17
+
18
+ ## Use
19
+
20
+ ```tsx
21
+ import { PayfurlDropin, type SuccessResponseType, type FailureResponseType } from "@payfurl/react-plugin";
22
+
23
+ export function Checkout() {
24
+ return (
25
+ <PayfurlDropin
26
+ environment="sandbox"
27
+ publicKey="<your public key>"
28
+ amount={20}
29
+ currency="AUD"
30
+ onSuccess={(message: SuccessResponseType) => console.log("token", message.token)}
31
+ onFailure={(message: FailureResponseType) => console.error(message.error)}
32
+ onLoaded={() => console.log("drop-in ready")}
33
+ />
34
+ );
35
+ }
36
+ ```
37
+
38
+ Send the token from `onSuccess` to your server and charge it with payFURL's API.
39
+
40
+ ## Props
41
+
42
+ | Prop | Type | |
43
+ |---|---|---|
44
+ | `environment` | `"sandbox"` or `"production"` | Required |
45
+ | `publicKey` | `string` | Required. Your account's public key |
46
+ | `amount` | `number` | Required. In the currency's major unit (`20` is $20.00) |
47
+ | `currency` | `string` | Required. A 3-letter ISO 4217 code, e.g. `"AUD"` |
48
+ | `options` | `DropInOptionsType` | Optional. See [Drop In UI options](https://docs.payfurl.com/client_sdk/payment_methods/drop_in) |
49
+ | `debug` | `boolean` | Optional. Logs the SDK's activity to the browser console |
50
+ | `successMessage` | `string` | Optional. Shown when the payment details are collected |
51
+ | `customer` | `CustomerInfoType` | Optional, 1.5.0+. The shopper: name, email, phone. See [Customer and order details](https://docs.payfurl.com/client_sdk/use_cases/customer_and_order) |
52
+ | `billingAddress` | `AddressInfoType` | Optional, 1.5.0+. The shopper's billing address |
53
+ | `order` | `OrderInfoType` | Optional, 1.5.0+. The order: items, tax, shipping, discount |
54
+ | `onSuccess` | `(message: SuccessResponseType) => void` | Required. The payment details were collected: `message.token`, or `message.transactionId` for payment methods that complete the payment themselves. In JavaScript without it, the SDK puts the token in a hidden `token` input and submits the `<form>` around the component; with neither, the console warns |
55
+ | `onFailure` | `(message: FailureResponseType) => void` | Required. `message.error`, and `message.errorDetails` when the provider declined |
56
+ | `onLoaded` | `() => void` | Optional (required before 1.5.0). The form, or a payment method's button, is ready |
57
+ | `onValidationStatusChange` | `(status: string, message: string) => void` | Optional (required before 1.5.0). The card form's validation changed |
58
+ | `onValidate` | `() => boolean` | Optional. Return `false` to stop the submission, e.g. while your terms checkbox is unchecked |
59
+ | `onPaymentMethodStatus` | `(status: PaymentMethodStatusType) => void` | Optional, 1.5.0+. A payment method's button rendered, or won't and why. See [Payment method status handler](https://docs.payfurl.com/client_sdk/handlers#payment-method-status-handler) |
60
+ | `onThreeDsProgress` | `(progress: ThreeDsProgressType) => void` | Optional, 1.5.0+. 3-D Secure started, showed a challenge, completed. See [3-D Secure progress handler](https://docs.payfurl.com/client_sdk/handlers#3-d-secure-progress-handler) |
61
+
62
+ 3D Secure, fraud checks, Click to Pay and checkout providers use `customer`, `billingAddress` and `order`, so pass
63
+ what you know.
64
+
65
+ ## Changing props
66
+
67
+ - **`amount`, `successMessage`, `customer`, `billingAddress`, `order`**: a new value updates the drop-in in place,
68
+ and the shopper keeps what they typed. To change the amount on the fly, change the `amount` prop: the
69
+ component calls the SDK's `setAmount()` for you.
70
+ - **`currency`, `options`**: a new value rebuilds the drop-in. PayPal loads its buttons for one currency.
71
+ - **`environment`, `publicKey`, `debug`**: read once, when the component mounts. The SDK runs one instance per
72
+ page, so switching account or environment takes a page reload.
73
+ - Objects are compared by value: a new object with the same values changes nothing.
74
+ - Handlers, `onValidate` included, are read when they fire, so passing new functions on every render changes
75
+ nothing.
76
+
77
+ Don't call `setAmount()` (or any other SDK method) on your own `import payfurl from "@payfurl/client"`: this
78
+ package includes its own copy of the SDK, so the call doesn't reach the drop-in. Change the props instead.
79
+
80
+ ## Types
81
+
82
+ The package re-exports the SDK's types: `DropInOptionsType`, `UpiOptionsType`, `DropInGooglePayOptionsType`,
83
+ `DropInApplePayOptionsType`, `ClickToPayOptionsType`, `NetworkTokenOptionsType`, `SuccessResponseType`,
84
+ `FailureResponseType`, `PaymentMethodStatusType`, `ThreeDsProgressType`, `CustomerInfoType`, `AddressInfoType`
85
+ and `OrderInfoType`.
86
+
87
+ ## Support
88
+
89
+ [Documentation](https://docs.payfurl.com/client_sdk/frameworks/react) ·
90
+ [SDK changelog](https://docs.payfurl.com/client_sdk/changelog) ·
91
+ [Support](https://docs.payfurl.com/support)
92
+
93
+ ## Changelog
94
+
95
+ What changed in each version of `@payfurl/react-plugin`. Changes to the payment form itself are in the
96
+ [Client SDK changelog](https://docs.payfurl.com/client_sdk/changelog). This changelog starts with version 1.4.0.
97
+
98
+ ### 1.5.0
99
+
100
+ #### Added
101
+
102
+ - `onPaymentMethodStatus` and `onThreeDsProgress` props: a payment method's button rendered or won't render
103
+ and why, and 3-D Secure's progress (started, challenge shown, completed).
104
+ - `customer`, `billingAddress` and `order` props: the shopper and the order, which 3-D Secure, fraud checks,
105
+ Click to Pay and checkout providers use. Before, the drop-in had no way to receive them. A changed value
106
+ updates the drop-in in place.
107
+ - The `PaymentMethodStatusType`, `ThreeDsProgressType`, `CustomerInfoType`, `AddressInfoType` and
108
+ `OrderInfoType` types.
109
+
110
+ #### Changed
111
+
112
+ - In JavaScript, leaving out `onSuccess` no longer throws and loses the token: the SDK puts the token in a hidden
113
+ `token` input and submits the `<form>` around the component, and with no form the console warns. Leaving out
114
+ `onFailure` no longer throws either. TypeScript still requires both.
115
+ - A new `environment`, `publicKey` or `debug` no longer re-runs the SDK's `init()`: they are read once, at mount.
116
+ The SDK keeps one instance per page, so it never switched account or environment, and it left the instance
117
+ half-changed. A new `options` object with the same values no longer rebuilds the drop-in.
118
+ - `onLoaded` and `onValidationStatusChange` are optional. Before, TypeScript required them and leaving one out
119
+ in JavaScript threw an error each time it would have been called.
120
+ - Depends on `@payfurl/client` 4.11.0 or later, which adds these handlers.
121
+
122
+ ### 1.4.0
123
+
124
+ #### Added
125
+
126
+ - TypeScript types for every prop, from `@payfurl/client`, and the package's own type definitions now load.
127
+
128
+ #### Fixed
129
+
130
+ - `PayfurlDropin` no longer fails when it mounts, and no longer rebuilds the drop-in, losing what the shopper
131
+ typed, each time its parent re-renders. A new `amount` or `successMessage` updates the drop-in in place.
@@ -1,8 +1,8 @@
1
1
  var S = Object.defineProperty;
2
2
  var g = (t, s, e) => s in t ? S(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
3
  var r = (t, s, e) => g(t, typeof s != "symbol" ? s + "" : s, e);
4
- import { y as p, k as m, F as T, J as u, $ as I, Q as f, K as v, s as y, V as A, a as C, Y as l, X as R, r as b, b as P, D as U, Z as $, e as w } from "./index-CACzT3Rb.js";
5
- var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" }, k = ["action"], V = ["value"], F = /* @__PURE__ */ f(/* @__PURE__ */ v({
4
+ import { t as p, A as m, W as T, i as u, h as I, s as v, Z as f, a as y, Q as A, X as l, b as C, g as R, e as P, I as U, c as b, q as w, o as E } from "./index-DxOlzt-Z.js";
5
+ var $ = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" }, k = ["action"], q = ["value"], V = /* @__PURE__ */ v(/* @__PURE__ */ f({
6
6
  __name: "ThreeDsChallenge",
7
7
  props: {
8
8
  threeDSServerTransID: {},
@@ -11,7 +11,7 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
11
11
  },
12
12
  emits: ["close", "submit"],
13
13
  setup(t, { emit: s }) {
14
- let e = t, a = s, n = U(() => $(e.formAction) ? e.formAction : ""), o = w(null), c = JSON.stringify({
14
+ let e = t, a = s, o = U(() => E(e.formAction) ? e.formAction : ""), n = b(null), c = JSON.stringify({
15
15
  threeDSServerTransID: e.threeDSServerTransID,
16
16
  acsTransID: e.acsTransID,
17
17
  messageVersion: "2.2.0",
@@ -20,24 +20,24 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
20
20
  }), D = encodeURI(window.btoa(c).replace(/=*$/, ""));
21
21
  return y(() => {
22
22
  var i;
23
- n.value && ((i = o.value) == null || i.submit());
24
- }), (i, h) => (A(), C("div", E, [l("div", M, [l("div", L, [
25
- R(b, {
23
+ o.value && ((i = n.value) == null || i.submit());
24
+ }), (i, h) => (w(), A("div", $, [l("div", M, [l("div", L, [
25
+ C(R, {
26
26
  onClick: h[0] || (h[0] = (N) => a("close")),
27
27
  id: "3ds-challenge-close"
28
28
  }),
29
29
  h[1] || (h[1] = l("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)),
30
30
  l("form", {
31
- action: n.value,
31
+ action: o.value,
32
32
  target: "ThreeDsChallengeIFrame",
33
33
  method: "post",
34
34
  ref_key: "form",
35
- ref: o
35
+ ref: n
36
36
  }, [l("input", {
37
37
  type: "hidden",
38
38
  name: "creq",
39
39
  value: P(D)
40
- }, null, 8, V)], 8, k)
40
+ }, null, 8, q)], 8, k)
41
41
  ])])]));
42
42
  }
43
43
  }), [["__scopeId", "data-v-07081e85"]]), _ = class {
@@ -50,18 +50,18 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
50
50
  createIFrame() {
51
51
  this.iframe || (this.container = document.createElement("div"), this.container.id = this.containerId, document.body.appendChild(this.container), this.iframe = document.createElement("iframe"), this.iframe.name = this.iframeId, this.iframe.style.display = "none", this.container.appendChild(this.iframe));
52
52
  }
53
- invoke(t, s, e, a, n) {
53
+ invoke(t, s, e, a, o) {
54
54
  var c;
55
55
  this.createIFrame();
56
- let o = document.createElement("form");
57
- o.action = t, o.target = this.iframeId, o.method = "post", (c = this.container) == null || c.appendChild(o);
56
+ let n = document.createElement("form");
57
+ n.action = t, n.target = this.iframeId, n.method = "post", (c = this.container) == null || c.appendChild(n);
58
58
  for (let D in e) {
59
59
  let i = document.createElement("input");
60
- i.type = "hidden", i.name = D, i.value = e[D], o.appendChild(i);
60
+ i.type = "hidden", i.name = D, i.value = e[D], n.appendChild(i);
61
61
  }
62
- o.submit();
62
+ n.submit();
63
63
  }
64
- }, { hideSpinner: d, showSpinner: q } = I(), H = class {
64
+ }, { hideSpinner: d, showSpinner: F } = I(), H = class {
65
65
  constructor(t, s, e) {
66
66
  r(this, "log");
67
67
  r(this, "container");
@@ -76,37 +76,26 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
76
76
  r(this, "internalMessageHandler", this.messageHandler.bind(this));
77
77
  r(this, "onError", (t, s) => {
78
78
  var e, a;
79
- if (this.closeChallenge(), d(), t === 404) {
80
- (e = this.threeDsProcessor) == null || e.onError({ error: "This feature is only supported by ActiveServer v1.1.2+" });
81
- return;
82
- }
83
- (a = this.threeDsProcessor) == null || a.onError({
79
+ this.closeChallenge(), d(), t === 404 ? (e = this.threeDsProcessor) == null || e.onError({ error: "This feature is only supported by ActiveServer v1.1.2+" }) : (a = this.threeDsProcessor) == null || a.onError({
84
80
  error: u,
85
81
  body: s
86
82
  });
87
83
  });
88
84
  r(this, "onSuccess", (t, s) => {
89
- var a, n;
85
+ var a, o;
90
86
  this.closeChallenge(), d();
91
87
  let e = JSON.parse(s);
92
- ["Y", "A"].includes(e.transStatus) ? (a = this.threeDsProcessor) == null || a.onSuccess(e) : (this.log(`[${this.getType()}]: ${u}`, e), (n = this.threeDsProcessor) == null || n.onError({ error: u }));
88
+ ["Y", "A"].includes(e.transStatus) ? (a = this.threeDsProcessor) == null || a.onSuccess(e) : (this.log(`[${this.getType()}]: ${u}`, e), (o = this.threeDsProcessor) == null || o.onError({ error: u }));
93
89
  });
94
90
  r(this, "onInitAuthSuccess", (t, s) => {
95
91
  let e = JSON.parse(s);
96
- if (this.log(`[${this.getType()}][onInitAuthSuccess]`, e), this.threeDSRequestorTransID = e.threeDSRequestorTransID, this.threeDSServerTransID = e.threeDSServerTransID, this.threeDSMonitorURL = e.threeDSMonitorURL, this.threeDSAuthURL = e.threeDSAuthURL, e.threeDSMethodURL) {
97
- this.threeDsMethodInvoke(e.threeDSServerTransID, e.threeDSMethodURL);
98
- return;
99
- }
100
- this.onAuth(!1, "");
92
+ this.log(`[${this.getType()}][onInitAuthSuccess]`, e), this.threeDSRequestorTransID = e.threeDSRequestorTransID, this.threeDSServerTransID = e.threeDSServerTransID, this.threeDSMonitorURL = e.threeDSMonitorURL, this.threeDSAuthURL = e.threeDSAuthURL, e.threeDSMethodURL ? this.threeDsMethodInvoke(e.threeDSServerTransID, e.threeDSMethodURL) : this.onAuth(!1, "");
101
93
  });
102
94
  r(this, "onDoAuthSuccess", (t, s) => {
103
95
  var a;
104
96
  let e = JSON.parse(s);
105
- if (this.log(`[${this.getType()}][onDoAuthSuccess]`, e), !e.transStatus) {
106
- this.onError(t, "No transStatus specified");
107
- return;
108
- }
109
- switch (e.transStatus) {
97
+ if (this.log(`[${this.getType()}][onDoAuthSuccess]`, e), !e.transStatus) this.onError(t, "No transStatus specified");
98
+ else switch (e.transStatus) {
110
99
  case "C":
111
100
  if (!e.acsURL) {
112
101
  this.onError(t, "Invalid Challenge Url");
@@ -153,7 +142,7 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
153
142
  return "";
154
143
  }
155
144
  onPreAuth() {
156
- this.log(`[${this.getType()}][onPreAuth]`), this.threeDsProcessor && (q(), this.threeDsProcessor.onPreAuth(this.onInitAuthSuccess, this.onError), window.addEventListener("message", this.internalMessageHandler));
145
+ this.log(`[${this.getType()}][onPreAuth]`), this.threeDsProcessor && (F(), this.threeDsProcessor.onPreAuth(this.onInitAuthSuccess, this.onError), window.addEventListener("message", this.internalMessageHandler));
157
146
  }
158
147
  onAuth(t, s) {
159
148
  var e;
@@ -173,13 +162,7 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
173
162
  }
174
163
  messageHandler(t) {
175
164
  var s, e;
176
- if ((s = t == null ? void 0 : t.data) != null && s.status && ((e = t == null ? void 0 : t.data) == null ? void 0 : e.status) !== "tokenise-card-failure") {
177
- if (t.data.status === "3ds_method_invocation_complete") {
178
- t.stopPropagation(), this.invocationComplete(t);
179
- return;
180
- }
181
- t.data.status === "3ds_challenge_complete" && (t.stopPropagation(), this.challengeComplete(t));
182
- }
165
+ (s = t == null ? void 0 : t.data) != null && s.status && ((e = t == null ? void 0 : t.data) == null ? void 0 : e.status) !== "tokenise-card-failure" && (t.data.status === "3ds_method_invocation_complete" ? (t.stopPropagation(), this.invocationComplete(t)) : t.data.status === "3ds_challenge_complete" && (t.stopPropagation(), this.challengeComplete(t)));
183
166
  }
184
167
  invocationComplete(t) {
185
168
  this.log(`[${this.getType()}]: 3Ds Method invocation complete`), this.onAuth(!0, "");
@@ -194,13 +177,14 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
194
177
  ].includes(s.transStatus) && (this.log(`[${this.getType()}]: Failed 3DS Challenge`, t.data), this.onError(400, "Failed 3DS Challenge"));
195
178
  }
196
179
  setChallengeFrameVisible(t) {
197
- window.self !== window.top && window.parent.postMessage({ status: t ? p : m }, "*");
180
+ var s;
181
+ t && ((s = this.threeDsProcessor) == null || s.challengeShown()), window.self !== window.top && window.parent.postMessage({ status: t ? p : m }, "*");
198
182
  }
199
183
  doChallenge(t, s, e) {
200
184
  this.log(`[${this.getType()}][doChallenge]`), d(), this.setChallengeFrameVisible(!0);
201
185
  let { destroy: a } = T({
202
186
  el: document.body,
203
- component: F,
187
+ component: V,
204
188
  props: {
205
189
  threeDSServerTransID: this.threeDSServerTransID,
206
190
  acsTransID: s,
@@ -208,9 +192,9 @@ var E = { class: "mask" }, M = { class: "wrapper" }, L = { class: "container" },
208
192
  authenticationValue: e
209
193
  },
210
194
  on: { close: () => {
211
- var n;
195
+ var o;
212
196
  a(), this.threeDSDestroy = () => {
213
- }, (n = this.threeDsProcessor) == null || n.onError({ error: "Challenge cancelled" });
197
+ }, (o = this.threeDsProcessor) == null || o.onError({ error: "Challenge cancelled" });
214
198
  } }
215
199
  });
216
200
  this.threeDSDestroy = a;
@@ -0,0 +1,143 @@
1
+ var L = Object.defineProperty;
2
+ var _ = (h, s, e) => s in h ? L(h, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[s] = e;
3
+ var c = (h, s, e) => _(h, typeof s != "symbol" ? s + "" : s, e);
4
+ import { O as x } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
5
+ import { j as d, p as I, W as G, h as N, s as H, Z as F, a as M, k as O, P as k, r as W, Q as Z, X as m, b as j, g as U, c as V, q } from "./index-DxOlzt-Z.js";
6
+ var J = { class: "mask" }, Q = { class: "wrapper" }, R = { class: "container" }, X = /* @__PURE__ */ H(/* @__PURE__ */ F({
7
+ __name: "MetricsGlobalThreeDsChallenge",
8
+ emits: ["close", "submit"],
9
+ setup(h, { emit: s }) {
10
+ let e = s, t = V(!1);
11
+ function i(n) {
12
+ var r;
13
+ ["3DS_CHALLENGE_SHOW", "3DS_CHALLENGE_CLOSE"].includes((r = n.data) == null ? void 0 : r.message) && (t.value = n.data.message === "3DS_CHALLENGE_SHOW");
14
+ }
15
+ return M(() => {
16
+ window.addEventListener("message", i);
17
+ }), O(() => {
18
+ window.removeEventListener("message", i);
19
+ }), (n, r) => k((q(), Z("div", J, [m("div", Q, [m("div", R, [j(U, {
20
+ onClick: r[0] || (r[0] = (p) => e("close")),
21
+ id: "3ds-challenge-close"
22
+ }), r[1] || (r[1] = m("div", { id: "ThreeDsChallengeIFrame" }, null, -1))])])], 512)), [[W, t.value]]);
23
+ }
24
+ }), [["__scopeId", "data-v-8a0b6dcb"]]), { hideSpinner: l, showSpinner: $ } = N(), u = 5, B = class extends x {
25
+ constructor(s, e, t) {
26
+ var i;
27
+ super(s, e, t);
28
+ c(this, "gateway");
29
+ c(this, "threeDS");
30
+ c(this, "numAttempts", 0);
31
+ this.initScript(((i = t.clientParameters) == null ? void 0 : i.PublicKey) || "");
32
+ }
33
+ getType() {
34
+ return "MetricsGlobal";
35
+ }
36
+ getDomain() {
37
+ return "secure.metricsglobalgateway.com";
38
+ }
39
+ onPreAuth() {
40
+ var s;
41
+ this.log(`[${this.getType()}]: onPreAuth`), !this.threeDS && this.numAttempts >= u ? (l(), d(this.container, "Error loading 3D Secure")) : !this.threeDS && this.numAttempts < u ? (this.numAttempts++, this.log(`[${this.getType()}]: 3DS not ready, retrying in 1s`), setTimeout(() => this.onPreAuth(), 1e3)) : (s = this.threeDsProcessor) != null && s.getTokenId() ? this.threeDsProcessor.getGatewayData(this.threeDsProcessor.getProviderId(), this.threeDsProcessor.getTokenId(), (e) => this.startAuth(e), () => {
42
+ var e;
43
+ return (e = this.threeDsProcessor) == null ? void 0 : e.onError({ error: "Unable to get card information" });
44
+ }) : this.startAuth();
45
+ }
46
+ onAuth(s, e) {
47
+ }
48
+ onPostAuth() {
49
+ }
50
+ startAuth(s) {
51
+ var y, w, C, S, b, E, P, v;
52
+ this.log(`[${this.getType()}]: startAuth`);
53
+ let e = (y = this.threeDsProcessor) == null ? void 0 : y.getPaymentInfo();
54
+ if (!e) {
55
+ l(), d(this.container, "Payment information is missing");
56
+ return;
57
+ }
58
+ $();
59
+ let t = (w = this.threeDsProcessor) == null ? void 0 : w.getAddressInfo(), i = e.expiryDate.length === 4 ? e.expiryDate.slice(2, 4) : "", n = e.expiryDate.length === 4 ? e.expiryDate.slice(0, 2) : "", [r = "", p = ""] = ((C = e.cardholder) == null ? void 0 : C.split(/\s+/)) || [], A = ((S = this.threeDsProcessor) == null ? void 0 : S.getCurrency()) || "", f = ((b = this.threeDsProcessor) == null ? void 0 : b.getAmount()) || 0;
60
+ if (!s && (!i || !n)) {
61
+ l(), d(this.container, "Card expiry date is invalid"), (E = this.threeDsProcessor) == null || E.onError({ error: "Card expiry date is invalid" });
62
+ return;
63
+ }
64
+ let D = (P = s == null ? void 0 : s.gatewayMetadata) == null ? void 0 : P.billing_id, T = {
65
+ ...s ? {
66
+ customerVaultId: s.gatewayTokenId,
67
+ ...D ? { billingId: D } : {}
68
+ } : {
69
+ cardNumber: e.cardNumber,
70
+ cardExpMonth: i,
71
+ cardExpYear: String(parseInt(n, 10) + 2e3)
72
+ },
73
+ currency: A,
74
+ amount: f.toFixed(2),
75
+ email: (v = this.threeDsProcessor) == null ? void 0 : v.getEmail(),
76
+ phone: t == null ? void 0 : t.phoneNumber,
77
+ city: t == null ? void 0 : t.city,
78
+ state: t == null ? void 0 : t.state,
79
+ address1: t == null ? void 0 : t.streetAddress,
80
+ country: t == null ? void 0 : t.country,
81
+ firstName: (t == null ? void 0 : t.firstName) || r || "payFURL",
82
+ lastName: (t == null ? void 0 : t.lastName) || p || "payFURL",
83
+ postalCode: t == null ? void 0 : t.postalCode,
84
+ deviceChannel: "02",
85
+ browserJavascriptEnabled: !0,
86
+ browserJavaEnabled: !1,
87
+ browserLanguage: window.navigator.language,
88
+ browserColorDepth: String(I()),
89
+ browserScreenHeight: String(screen.height),
90
+ browserScreenWidth: String(screen.width),
91
+ browserTimeZone: String(Math.round((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60)),
92
+ userAgent: navigator.userAgent
93
+ }, g = this.threeDS.createUI(T);
94
+ g.start("#ThreeDsChallengeIFrame"), g.on("challenge", (a) => {
95
+ this.log(`[${this.getType()}][onChallenge]`, a), l(), this.showChallenge();
96
+ }), g.on("complete", (a) => {
97
+ var o;
98
+ this.log(`[${this.getType()}][onComplete]`, a), this.removeChallenge(), (o = this.threeDsProcessor) == null || o.onSuccess({ externalThreeDsData: a });
99
+ }), g.on("failure", (a) => {
100
+ var o;
101
+ this.log(`[${this.getType()}][onFailure]`, a), l(), this.closeChallenge(), (o = this.threeDsProcessor) == null || o.onError({ error: a.message });
102
+ }), g.on("error", (a) => {
103
+ var o;
104
+ this.log(`[${this.getType()}][error]`, a), l(), this.closeChallenge(), (o = this.threeDsProcessor) == null || o.onError({ error: a.message });
105
+ });
106
+ }
107
+ initScript(s) {
108
+ let e = document.createElement("script");
109
+ e.type = "text/javascript", e.src = `https://${this.getDomain()}/js/v1/Gateway.js`, e.onload = () => {
110
+ this.initGateway(s), this.initChallenge();
111
+ }, document.head.appendChild(e);
112
+ }
113
+ initGateway(s) {
114
+ this.gateway = window.Gateway.create(s), this.threeDS = this.gateway.get3DSecure(), this.gateway.on("error", (e) => {
115
+ var t;
116
+ this.log(`[${this.getType()}]: gateway error`, e), (t = this.threeDsProcessor) == null || t.onError({ error: e.message }), this.threeDS = null, this.numAttempts = u;
117
+ });
118
+ }
119
+ initChallenge() {
120
+ let { destroy: s } = G({
121
+ el: document.body,
122
+ component: X,
123
+ on: { close: () => {
124
+ var e;
125
+ this.closeChallenge(), (e = this.threeDsProcessor) == null || e.onError({ error: "Challenge cancelled" });
126
+ } }
127
+ });
128
+ this.threeDSDestroy = s;
129
+ }
130
+ showChallenge() {
131
+ this.setChallengeFrameVisible(!0), window.postMessage({ message: "3DS_CHALLENGE_SHOW" }, "*");
132
+ }
133
+ closeChallenge() {
134
+ this.setChallengeFrameVisible(!1), window.postMessage({ message: "3DS_CHALLENGE_CLOSE" }, "*");
135
+ }
136
+ removeChallenge() {
137
+ var s;
138
+ (s = this.threeDSDestroy) == null || s.call(this);
139
+ }
140
+ };
141
+ export {
142
+ B as w
143
+ };
@@ -1,7 +1,7 @@
1
1
  var m = Object.defineProperty;
2
2
  var g = (t, e, r) => e in t ? m(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
3
  var i = (t, e, r) => g(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { d as b, p as A, c as v } from "./index-CACzT3Rb.js";
4
+ import { f as b, m as A, l as v } from "./index-DxOlzt-Z.js";
5
5
  var l = {
6
6
  CHECKOUT: "CHECKOUT",
7
7
  CHARGE: "CHARGE"
@@ -41,13 +41,7 @@ var l = {
41
41
  let c = new b(s.environment, A(s.publicKey));
42
42
  this.httpInvoker = new v(s.publicKey, s.version, c), this.init(), setInterval(() => {
43
43
  var d;
44
- if (this.validator) {
45
- if (((d = this.userOnValidate) == null ? void 0 : d.call(this)) === !1) {
46
- this.validator.style.display = "block";
47
- return;
48
- }
49
- this.validator.style.display = "none", this.validationError && (this.validationError.style.display = "none");
50
- }
44
+ this.validator && (((d = this.userOnValidate) == null ? void 0 : d.call(this)) === !1 ? this.validator.style.display = "block" : (this.validator.style.display = "none", this.validationError && (this.validationError.style.display = "none")));
51
45
  }, 1e3);
52
46
  }
53
47
  draw() {
@@ -63,11 +57,7 @@ var l = {
63
57
  };
64
58
  this.log("[createPaymentRequestButton]", e), window.payway.createPaymentRequestButton(e, (r, a) => {
65
59
  var o;
66
- if (this.log("[createPaymentRequestButton]", r, a), r) {
67
- (o = this.onFailure) == null || o.call(this, r);
68
- return;
69
- }
70
- this.checkout(a.singleUseTokenId);
60
+ this.log("[createPaymentRequestButton]", r, a), r ? (o = this.onFailure) == null || o.call(this, r) : this.checkout(a.singleUseTokenId);
71
61
  }), this.addValidator();
72
62
  };
73
63
  window.payway ? t() : this.onLoad = t;
@@ -0,0 +1,22 @@
1
+ import type { AddressInfoType, CustomerInfoType, DropInOptionsType, EnvironmentName, FailureResponseType, OrderInfoType, PaymentMethodStatusType, SuccessResponseType, ThreeDsProgressType } from "@payfurl/client";
2
+ interface PayfurlDropinProps {
3
+ environment: EnvironmentName;
4
+ publicKey: string;
5
+ debug?: boolean;
6
+ amount: number;
7
+ currency: string;
8
+ successMessage?: string;
9
+ options?: DropInOptionsType;
10
+ customer?: CustomerInfoType;
11
+ billingAddress?: AddressInfoType;
12
+ order?: OrderInfoType;
13
+ onSuccess: (message: SuccessResponseType) => void;
14
+ onFailure: (message: FailureResponseType) => void;
15
+ onLoaded?: () => void;
16
+ onValidationStatusChange?: (status: string, message: string) => void;
17
+ onValidate?: () => boolean;
18
+ onPaymentMethodStatus?: (status: PaymentMethodStatusType) => void;
19
+ onThreeDsProgress?: (progress: ThreeDsProgressType) => void;
20
+ }
21
+ declare const PayfurlDropin: (props: PayfurlDropinProps) => import("react").JSX.Element;
22
+ export default PayfurlDropin;
@@ -1,4 +1,4 @@
1
- import { w as n } from "./MetricsGlobalThreeDsProvider-DW-gsG6q-BYJaEFfc.js";
1
+ import { w as n } from "./MetricsGlobalThreeDsProvider-C93ttqbB-SRsVMed4.js";
2
2
  var r = class extends n {
3
3
  getType() {
4
4
  return "CxPay";
@@ -1,4 +1,4 @@
1
- import { O as n } from "./DefaultThreeDsProvider-ChnRLzKI-DO_0wVUN.js";
1
+ import { O as n } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
2
2
  function f(t, r, e) {
3
3
  return new n(t, r, e);
4
4
  }
@@ -0,0 +1,82 @@
1
+ var u = Object.defineProperty;
2
+ var m = (s, e, a) => e in s ? u(s, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[e] = a;
3
+ var h = (s, e, a) => m(s, typeof e != "symbol" ? e + "" : e, a);
4
+ import { O as d } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
5
+ import { W as D, s as g, Z as p, a as S, Q as f, X as n, b as v, g as y, e as T, I, c as C, q as P, o as b } from "./index-DxOlzt-Z.js";
6
+ var A = { class: "mask" }, V = { class: "wrapper" }, F = { class: "container" }, _ = ["action"], R = ["value"], $ = /* @__PURE__ */ g(/* @__PURE__ */ p({
7
+ __name: "ecentric",
8
+ props: {
9
+ threeDSServerTransID: {},
10
+ acsTransID: {},
11
+ formAction: {},
12
+ authenticationValue: {}
13
+ },
14
+ emits: ["close", "submit"],
15
+ setup(s, { emit: e }) {
16
+ let a = s, l = e, r = I(() => b(a.formAction) ? a.formAction : ""), o = C(null), c = a.authenticationValue;
17
+ return S(() => {
18
+ var i;
19
+ r.value && ((i = o.value) == null || i.submit());
20
+ }), (i, t) => (P(), f("div", A, [n("div", V, [n("div", F, [
21
+ v(y, { onClick: t[0] || (t[0] = (E) => l("close")) }),
22
+ t[1] || (t[1] = n("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)),
23
+ n("form", {
24
+ action: r.value,
25
+ target: "ThreeDsChallengeIFrame",
26
+ method: "post",
27
+ ref_key: "form",
28
+ ref: o
29
+ }, [n("input", {
30
+ type: "hidden",
31
+ name: "PaReq",
32
+ value: T(c)
33
+ }, null, 8, R)], 8, _)
34
+ ])])]));
35
+ }
36
+ }), [["__scopeId", "data-v-bdfafa40"]]), x = class extends d {
37
+ constructor() {
38
+ super(...arguments);
39
+ h(this, "paResPayload", "");
40
+ }
41
+ getType() {
42
+ return "Ecentric";
43
+ }
44
+ onPostAuth() {
45
+ var e;
46
+ this.log(`[${this.getType()}][onPostAuth]`, {
47
+ threeDSServerTransID: this.threeDSServerTransID,
48
+ authenticationValue: this.paResPayload
49
+ }), (e = this.threeDsProcessor) == null || e.onPostAuth({
50
+ threeDSServerTransID: this.threeDSServerTransID,
51
+ authenticationValue: this.paResPayload
52
+ }, this.onSuccess, this.onError);
53
+ }
54
+ doChallenge(e, a, l) {
55
+ this.log(`[${this.getType()}][doChallenge]`), this.setChallengeFrameVisible(!0);
56
+ let { destroy: r } = D({
57
+ el: document.body,
58
+ component: $,
59
+ props: {
60
+ threeDSServerTransID: this.threeDSServerTransID,
61
+ acsTransID: a,
62
+ formAction: e,
63
+ authenticationValue: l
64
+ },
65
+ on: { close: () => {
66
+ var o;
67
+ r(), this.setChallengeFrameVisible(!1), this.threeDSDestroy = () => {
68
+ }, (o = this.threeDsProcessor) == null || o.onError({ error: "Challenge cancelled" });
69
+ } }
70
+ });
71
+ this.threeDSDestroy = r;
72
+ }
73
+ challengeComplete(e) {
74
+ 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"));
75
+ }
76
+ };
77
+ function w(s, e, a) {
78
+ return new x(s, e, a);
79
+ }
80
+ export {
81
+ w as default
82
+ };
@@ -1,4 +1,4 @@
1
- import { w as r } from "./MetricsGlobalThreeDsProvider-DW-gsG6q-BYJaEFfc.js";
1
+ import { w as r } from "./MetricsGlobalThreeDsProvider-C93ttqbB-SRsVMed4.js";
2
2
  var a = class extends r {
3
3
  getType() {
4
4
  return "EPNA";
@@ -1,4 +1,4 @@
1
- import { w as e } from "./MetricsGlobalThreeDsProvider-DW-gsG6q-BYJaEFfc.js";
1
+ import { w as e } from "./MetricsGlobalThreeDsProvider-C93ttqbB-SRsVMed4.js";
2
2
  var r = class extends e {
3
3
  getType() {
4
4
  return "FlashBanc";
@@ -0,0 +1,36 @@
1
+ var c = Object.defineProperty;
2
+ var u = (t, e, s) => e in t ? c(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
+ var h = (t, e, s) => u(t, typeof e != "symbol" ? e + "" : e, s);
4
+ import { O as g } from "./DefaultThreeDsProvider-bLoDSnkd-CuWxvLku.js";
5
+ import { e as m, a as f, s as p } from "./managedOrders-ojoMZ0Ab-B94-Nsp-.js";
6
+ import { d as S, h as D } from "./index-DxOlzt-Z.js";
7
+ var { hideSpinner: O } = D(), T = class extends g {
8
+ constructor() {
9
+ super(...arguments);
10
+ h(this, "onDoAuthSuccess", (e, s) => {
11
+ var n;
12
+ let o = JSON.parse(s);
13
+ this.log(`[${this.getType()}][onDoAuthSuccess]`, o);
14
+ let i = ((n = this.options.clientParameters) == null ? void 0 : n.SiteId) || "", a = o.managedOrderToken;
15
+ !a || !m.test(i) ? this.onError(e, "3DS could not be started") : f(i).then(() => {
16
+ let r = !1, d = S(this.container, () => {
17
+ r = !0, this.setChallengeFrameVisible(!0), O();
18
+ });
19
+ p(a, this.container, (l) => {
20
+ d(), r && this.setChallengeFrameVisible(!1), l ? (this.log(`[${this.getType()}]: manageOrder failed`, l), this.onError(400, "3DS failed")) : this.onPostAuth();
21
+ });
22
+ }, (r) => {
23
+ this.log(`[${this.getType()}]: managedOrders.js failed to load`, r), this.onError(400, "3DS could not be started");
24
+ });
25
+ });
26
+ }
27
+ getType() {
28
+ return "Forter";
29
+ }
30
+ };
31
+ function E(t, e, s) {
32
+ return new T(t, e, s);
33
+ }
34
+ export {
35
+ E as default
36
+ };