@payfurl/react-plugin 1.4.0 → 1.6.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 (30) hide show
  1. package/README.md +142 -0
  2. package/dist/DefaultThreeDsProvider-BS9pznAi-fDl8jKzq.js +248 -0
  3. package/dist/{MetricsGlobalThreeDsProvider-B-EQQsEV-BYhakAA4.js → MetricsGlobalThreeDsProvider-C2mH6Z-m-BTiFsRgv.js} +25 -25
  4. package/dist/PayWayAppleButton-BcXMphiU-BwJKfUAJ.js +184 -0
  5. package/dist/components/PayfurlDropin.d.ts +8 -3
  6. package/dist/{cxpay-VbaQA3_P-DlS7yCqQ.js → cxpay-Bdz9DX5E-9-_yu7t4.js} +1 -1
  7. package/dist/{default-Diji0SXY-ghmIvhgy.js → default-CmqRUII8-B6Im_IPh.js} +1 -1
  8. package/dist/{ecentric-BlNDCZo_-Bd8Q_3ZG.js → ecentric-CZzDL4aQ-BRg09Y8f.js} +24 -21
  9. package/dist/{epna-CxmJ_mqR-D4gbP4NT.js → epna-A5WIS8Rv-DhjWr-Wx.js} +1 -1
  10. package/dist/{flashbanc-BAxvqtBB-DVXrWV0Z.js → flashbanc-BnKR75SO-BStfAWAb.js} +1 -1
  11. package/dist/forter-DtCvNxaz-D5SEPByD.js +36 -0
  12. package/dist/{gpayments-B5KWQV4S-QV7caEyB.js → gpayments-C98_oxi_-D02_MfHY.js} +23 -23
  13. package/dist/index-CqIxTjar.js +12169 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/metrics_global-c4lRSySk-WxebdZ3j.js +7 -0
  16. package/dist/{nmi-Ch7qQ6Av-DbPjmA5v.js → nmi-CrPg94-y-Bco-VeX9.js} +1 -1
  17. package/dist/{nuvei-DRmlfpTL-ByeKEnae.js → nuvei-8V5Z1Bqi-7VHagYOe.js} +31 -32
  18. package/dist/{payabli-CiBJ1-vC-BthvUlRk.js → payabli-CAvI6xn--Nz5dJc0q.js} +1 -1
  19. package/dist/payfurl-react.es.js +1 -1
  20. package/dist/payfurl-react.umd.js +24 -22
  21. package/dist/payglocal-BcbX7wj--Dd68qYZO.js +114 -0
  22. package/dist/{payway_rest-CjgIP42z-7zwBGwnD.js → payway_rest-Det6oVYM-BzfFo5sS.js} +1 -1
  23. package/dist/{skybank-D7uRF17E-BXng_6yf.js → skybank-CldRW65N-BFprFe0k.js} +1 -1
  24. package/package.json +4 -3
  25. package/dist/DefaultThreeDsProvider-CzqbXEws-C21Rr7_5.js +0 -219
  26. package/dist/PayWayAppleButton-C-XfcgNS-rgWe-QJM.js +0 -163
  27. package/dist/forter-R2alfHeE-C5KHGNgt.js +0 -33
  28. package/dist/index-CL6hUU-f.js +0 -11224
  29. package/dist/metrics_global-HMMDzPlb-CXHJ1NHy.js +0 -7
  30. package/dist/payglocal-uAPlijwL-CvGatUVh.js +0 -109
package/README.md ADDED
@@ -0,0 +1,142 @@
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.6.0
99
+
100
+ #### Changed
101
+
102
+ - Bundles `@payfurl/client` 4.12.0 (see its changelog). Each payment attempt is recorded with payFURL from its first
103
+ request to its end, PayPal and the checkout payment methods create their checkout when the shopper clicks, and a
104
+ payment page polled for too long stops with `onFailure`.
105
+ - When the component unmounts, the drop-in is removed: its status checks and listeners stop, a payment window it
106
+ opened closes, and `onSuccess` and `onFailure` no longer fire for it.
107
+ - Depends on `@payfurl/client` 4.12.0 or later.
108
+
109
+ ### 1.5.0
110
+
111
+ #### Added
112
+
113
+ - `onPaymentMethodStatus` and `onThreeDsProgress` props: a payment method's button rendered or won't render
114
+ and why, and 3-D Secure's progress (started, challenge shown, completed).
115
+ - `customer`, `billingAddress` and `order` props: the shopper and the order, which 3-D Secure, fraud checks,
116
+ Click to Pay and checkout providers use. Before, the drop-in had no way to receive them. A changed value
117
+ updates the drop-in in place.
118
+ - The `PaymentMethodStatusType`, `ThreeDsProgressType`, `CustomerInfoType`, `AddressInfoType` and
119
+ `OrderInfoType` types.
120
+
121
+ #### Changed
122
+
123
+ - In JavaScript, leaving out `onSuccess` no longer throws and loses the token: the SDK puts the token in a hidden
124
+ `token` input and submits the `<form>` around the component, and with no form the console warns. Leaving out
125
+ `onFailure` no longer throws either. TypeScript still requires both.
126
+ - A new `environment`, `publicKey` or `debug` no longer re-runs the SDK's `init()`: they are read once, at mount.
127
+ The SDK keeps one instance per page, so it never switched account or environment, and it left the instance
128
+ half-changed. A new `options` object with the same values no longer rebuilds the drop-in.
129
+ - `onLoaded` and `onValidationStatusChange` are optional. Before, TypeScript required them and leaving one out
130
+ in JavaScript threw an error each time it would have been called.
131
+ - Depends on `@payfurl/client` 4.11.0 or later, which adds these handlers.
132
+
133
+ ### 1.4.0
134
+
135
+ #### Added
136
+
137
+ - TypeScript types for every prop, from `@payfurl/client`, and the package's own type definitions now load.
138
+
139
+ #### Fixed
140
+
141
+ - `PayfurlDropin` no longer fails when it mounts, and no longer rebuilds the drop-in, losing what the shopper
142
+ typed, each time its parent re-renders. A new `amount` or `successMessage` updates the drop-in in place.
@@ -0,0 +1,248 @@
1
+ var g = Object.defineProperty;
2
+ var m = (o, e, s) => e in o ? g(o, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[e] = s;
3
+ var r = (o, e, s) => m(o, typeof e != "symbol" ? e + "" : e, s);
4
+ import { M as p, N as T, q as I, i as u, v as f, u as v, e as y, a as A, t as M, X as c, Z as w, S as C, r as R, z as U, b, c as P, l as E } from "./index-CqIxTjar.js";
5
+ var $ = { class: "mask" }, L = { class: "wrapper" }, _ = { class: "container" }, k = ["action"], q = ["value"], O = /* @__PURE__ */ v(/* @__PURE__ */ y({
6
+ __name: "ThreeDsChallenge",
7
+ props: {
8
+ threeDSServerTransID: {},
9
+ acsTransID: {},
10
+ formAction: {}
11
+ },
12
+ emits: ["close", "submit"],
13
+ setup(o, { emit: e }) {
14
+ let s = o, t = e, i = U(() => E(s.formAction) ? s.formAction : ""), a = b(null), d = JSON.stringify({
15
+ threeDSServerTransID: s.threeDSServerTransID,
16
+ acsTransID: s.acsTransID,
17
+ messageVersion: "2.2.0",
18
+ messageType: "CReq",
19
+ challengeWindowSize: "01"
20
+ }), D = encodeURI(window.btoa(d).replace(/=*$/, ""));
21
+ return A(() => {
22
+ var n;
23
+ i.value && ((n = a.value) == null || n.submit());
24
+ }), (n, l) => (P(), M("div", $, [c("div", L, [c("div", _, [
25
+ w(C, {
26
+ onClick: l[0] || (l[0] = (F) => t("close")),
27
+ id: "3ds-challenge-close"
28
+ }),
29
+ l[1] || (l[1] = c("iframe", { name: "ThreeDsChallengeIFrame" }, null, -1)),
30
+ c("form", {
31
+ action: i.value,
32
+ target: "ThreeDsChallengeIFrame",
33
+ method: "post",
34
+ ref_key: "form",
35
+ ref: a
36
+ }, [c("input", {
37
+ type: "hidden",
38
+ name: "creq",
39
+ value: R(D)
40
+ }, null, 8, q)], 8, k)
41
+ ])])]));
42
+ }
43
+ }), [["__scopeId", "data-v-07081e85"]]), V = class {
44
+ constructor() {
45
+ r(this, "iframeId", "threeDsIframeMethod");
46
+ r(this, "containerId", "payfurlContainerFormInvoker");
47
+ r(this, "iframe", null);
48
+ r(this, "container", null);
49
+ }
50
+ createIFrame() {
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
+ }
53
+ invoke(o, e, s, t, i) {
54
+ var d;
55
+ this.createIFrame();
56
+ let a = document.createElement("form");
57
+ a.action = o, a.target = this.iframeId, a.method = "post", (d = this.container) == null || d.appendChild(a);
58
+ for (let D in s) {
59
+ let n = document.createElement("input");
60
+ n.type = "hidden", n.name = D, n.value = s[D], a.appendChild(n);
61
+ }
62
+ a.submit();
63
+ }
64
+ }, { hideSpinner: S, showSpinner: N } = f(), h, x = (h = class {
65
+ constructor(e, s, t) {
66
+ r(this, "log");
67
+ r(this, "container");
68
+ r(this, "options");
69
+ r(this, "threeDsProcessor", null);
70
+ r(this, "threeDSDestroy", () => {
71
+ });
72
+ r(this, "threeDSServerTransID", "");
73
+ r(this, "threeDSAuthURL", "");
74
+ r(this, "threeDSRequestorTransID", "");
75
+ r(this, "threeDSMonitorURL", "");
76
+ r(this, "internalMessageHandler", this.messageHandler.bind(this));
77
+ r(this, "awaitingMethod", !1);
78
+ r(this, "methodTimer");
79
+ r(this, "onError", (e, s) => {
80
+ this.fail(e, s, "error");
81
+ });
82
+ r(this, "onSuccess", (e, s) => {
83
+ var i, a;
84
+ this.closeChallenge(), S();
85
+ let t = JSON.parse(s);
86
+ ["Y", "A"].includes(t.transStatus) ? (i = this.threeDsProcessor) == null || i.onSuccess(t) : (this.log(`[${this.getType()}]: ${u}`, t), (a = this.threeDsProcessor) == null || a.onError({
87
+ error: u,
88
+ threeDSServerTransID: t.threeDSServerTransID
89
+ }));
90
+ });
91
+ r(this, "onInitAuthSuccess", (e, s) => {
92
+ let t = JSON.parse(s);
93
+ this.log(`[${this.getType()}][onInitAuthSuccess]`, t), this.threeDSRequestorTransID = t.threeDSRequestorTransID, this.threeDSServerTransID = t.threeDSServerTransID, this.threeDSMonitorURL = t.threeDSMonitorURL, this.threeDSAuthURL = t.threeDSAuthURL, t.threeDSMethodURL ? (this.awaitMethod(), this.threeDsMethodInvoke(t.threeDSServerTransID, t.threeDSMethodURL)) : this.onAuth(!1, "");
94
+ });
95
+ r(this, "onDoAuthSuccess", (e, s) => {
96
+ var i;
97
+ let t = JSON.parse(s);
98
+ if (this.log(`[${this.getType()}][onDoAuthSuccess]`, t), !t.transStatus) this.onError(e, "No transStatus specified");
99
+ else switch (t.transStatus) {
100
+ case "C":
101
+ if (!t.acsURL) {
102
+ this.onError(e, "Invalid Challenge Url");
103
+ return;
104
+ }
105
+ this.doChallenge(t.acsURL, t.acsTransID, t.authenticationValue);
106
+ break;
107
+ case "N":
108
+ this.log(`[${this.getType()}][threeDsAuth], 3DS Verification failed, transaction denied`), this.decline("3DS Verification failed, transaction denied");
109
+ break;
110
+ case "U":
111
+ this.log(`[${this.getType()}][threeDsAuth], Unable to perform 3DS verification`), this.decline("Unable to perform 3DS verification");
112
+ break;
113
+ case "R":
114
+ this.log(`[${this.getType()}][threeDsAuth], Unable to perform 3DS verification, rejected at issuer`), this.decline("Unable to perform 3DS verification, rejected at issuer");
115
+ break;
116
+ default:
117
+ this.log(`[${this.getType()}][threeDsAuth], 3DS challenge not required, tranStatus: ${t.transStatus}`), (i = this.threeDsProcessor) == null || i.onSuccess({
118
+ threeDSServerTransID: t.threeDSServerTransID,
119
+ threeDSRequestorTransID: "",
120
+ acsRenderingType: t.acsRenderingType,
121
+ acsTransID: t.acsTransID,
122
+ authenticationType: t.authenticationType,
123
+ authenticationValue: t.authenticationValue,
124
+ challengeCancel: "",
125
+ dsTransID: t.dsTransID,
126
+ eci: t.eci,
127
+ interactionCounter: "",
128
+ messageCategory: "",
129
+ messageExtension: t.messageExtension,
130
+ messageType: t.messageType,
131
+ messageVersion: t.messageVersion,
132
+ transStatus: t.transStatus,
133
+ transStatusReason: t.transStatusReason
134
+ });
135
+ }
136
+ });
137
+ this.log = e, this.container = s, this.options = t;
138
+ }
139
+ getType() {
140
+ return "Default";
141
+ }
142
+ getDomain() {
143
+ return "";
144
+ }
145
+ onPreAuth() {
146
+ this.log(`[${this.getType()}][onPreAuth]`), this.threeDsProcessor && (this.stopAwaitingMethod(), N(), this.threeDsProcessor.onPreAuth(this.onInitAuthSuccess, this.onError), window.addEventListener("message", this.internalMessageHandler));
147
+ }
148
+ onAuth(e, s) {
149
+ var t;
150
+ this.log(`[${this.getType()}][onAuth]`, {
151
+ threeDSAuthURL: this.threeDSAuthURL,
152
+ threeDSRequestorTransID: this.threeDSRequestorTransID,
153
+ threeDSServerTransID: this.threeDSServerTransID,
154
+ isMethodPerformed: e
155
+ }), (t = this.threeDsProcessor) == null || t.onAuth(this.threeDSAuthURL, this.threeDSRequestorTransID, this.threeDSServerTransID, e, s, this.onDoAuthSuccess, this.onError);
156
+ }
157
+ onPostAuth() {
158
+ var e;
159
+ this.log(`[${this.getType()}][onPostAuth]`, { threeDSServerTransID: this.threeDSServerTransID }), (e = this.threeDsProcessor) == null || e.onPostAuth({ threeDSServerTransID: this.threeDSServerTransID }, this.onSuccess, this.onError);
160
+ }
161
+ setThreeDsProcessor(e) {
162
+ this.log(`[${this.getType()}][setThreeDsProcessor]`), this.threeDsProcessor = e;
163
+ }
164
+ messageHandler(e) {
165
+ var s, t;
166
+ (s = e == null ? void 0 : e.data) != null && s.status && ((t = e == null ? void 0 : e.data) == null ? void 0 : t.status) !== "tokenise-card-failure" && (e.data.status === "3ds_method_invocation_complete" ? (e.stopPropagation(), this.invocationComplete(e)) : e.data.status === "3ds_challenge_complete" && (e.stopPropagation(), this.challengeComplete(e)));
167
+ }
168
+ invocationComplete(e) {
169
+ this.awaitingMethod && (this.awaitingMethod = !1, clearTimeout(this.methodTimer), this.log(`[${this.getType()}]: 3Ds Method invocation complete`), this.onAuth(!0, ""));
170
+ }
171
+ stopAwaitingMethod() {
172
+ this.awaitingMethod = !1, clearTimeout(this.methodTimer);
173
+ }
174
+ awaitMethod() {
175
+ this.awaitingMethod = !0, clearTimeout(this.methodTimer), this.methodTimer = setTimeout(() => {
176
+ this.awaitingMethod && (this.awaitingMethod = !1, this.log(`[${this.getType()}]: 3Ds Method did not answer, continuing without it`), this.onAuth(!1, ""));
177
+ }, h.METHOD_TIMEOUT_MS);
178
+ }
179
+ challengeComplete(e) {
180
+ this.log(`[${this.getType()}]: 3Ds Challenge complete`, e.data), this.closeChallenge();
181
+ let s = {};
182
+ try {
183
+ s = JSON.parse(window.atob(e.data.cres));
184
+ } catch {
185
+ this.onError(400, "Unreadable challenge result");
186
+ return;
187
+ }
188
+ this.log(`[${this.getType()}]: cresData`, s), ["Y", "A"].includes(String(s.transStatus)) ? this.onPostAuth() : (this.log(`[${this.getType()}]: Failed 3DS Challenge`, e.data), this.decline("Failed 3DS Challenge"));
189
+ }
190
+ setChallengeFrameVisible(e) {
191
+ var s;
192
+ e && ((s = this.threeDsProcessor) == null || s.challengeShown()), window.self !== window.top && window.parent.postMessage({ status: e ? p : T }, "*");
193
+ }
194
+ doChallenge(e, s, t) {
195
+ this.log(`[${this.getType()}][doChallenge]`), S(), this.setChallengeFrameVisible(!0);
196
+ let { destroy: i } = I({
197
+ el: document.body,
198
+ component: O,
199
+ props: {
200
+ threeDSServerTransID: this.threeDSServerTransID,
201
+ acsTransID: s,
202
+ formAction: e,
203
+ authenticationValue: t
204
+ },
205
+ on: { close: () => {
206
+ var a;
207
+ i(), this.threeDSDestroy = () => {
208
+ }, (a = this.threeDsProcessor) == null || a.onError({
209
+ error: "Challenge cancelled",
210
+ cancelReason: "abandoned"
211
+ });
212
+ } }
213
+ });
214
+ this.threeDSDestroy = i;
215
+ }
216
+ closeChallenge() {
217
+ var e;
218
+ this.stopAwaitingMethod(), (e = this.threeDSDestroy) == null || e.call(this), this.setChallengeFrameVisible(!1), window.removeEventListener("message", this.internalMessageHandler);
219
+ }
220
+ decline(e) {
221
+ this.fail(400, e, "declined");
222
+ }
223
+ fail(e, s, t) {
224
+ var i, a;
225
+ this.closeChallenge(), S(), e === 404 ? (i = this.threeDsProcessor) == null || i.onError({
226
+ error: "This feature is only supported by ActiveServer v1.1.2+",
227
+ cancelReason: t
228
+ }) : (a = this.threeDsProcessor) == null || a.onError({
229
+ error: u,
230
+ body: s,
231
+ cancelReason: t
232
+ });
233
+ }
234
+ threeDsMethodInvoke(e, s) {
235
+ this.log(`[${this.getType()}][threeDsMethodInvoke]`, {
236
+ threeDSServerTransID: e,
237
+ threeDSMethodURL: s
238
+ });
239
+ let t = {
240
+ threeDSServerTransID: e,
241
+ threeDSMethodNotificationURL: this.options.apiUrl + "/3ds/method_invocation"
242
+ }, i = encodeURI(window.btoa(JSON.stringify(t)).replace(/=*$/, ""));
243
+ new V().invoke(s, "POST", { threeDSMethodData: i });
244
+ }
245
+ }, r(h, "METHOD_TIMEOUT_MS", 1e4), h);
246
+ export {
247
+ x as O
248
+ };
@@ -1,27 +1,27 @@
1
- var L = Object.defineProperty;
2
- var _ = (n, s, e) => s in n ? L(n, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[s] = e;
3
- var g = (n, s, e) => _(n, typeof s != "symbol" ? s + "" : s, e);
4
- import { O as x } from "./DefaultThreeDsProvider-CzqbXEws-C21Rr7_5.js";
5
- import { h as d, n as I, H as G, o as N, a as H, Z as F, b as M, j as O, p as Z, J as k, c as j, X as m, d as J, u as U, g as W, K } from "./index-CL6hUU-f.js";
6
- var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" }, z = /* @__PURE__ */ H(/* @__PURE__ */ F({
1
+ var f = Object.defineProperty;
2
+ var _ = (h, s, e) => s in h ? f(h, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[s] = e;
3
+ var g = (h, s, e) => _(h, typeof s != "symbol" ? s + "" : s, e);
4
+ import { O as x } from "./DefaultThreeDsProvider-BS9pznAi-fDl8jKzq.js";
5
+ import { j as d, m as I, q as G, v as N, u as H, e as F, a as M, y as O, L as k, $ as j, t as U, X as m, Z as W, S as $, b as V, c as q } from "./index-CqIxTjar.js";
6
+ var J = { class: "mask" }, R = { class: "wrapper" }, X = { class: "container" }, Z = /* @__PURE__ */ H(/* @__PURE__ */ F({
7
7
  __name: "MetricsGlobalThreeDsChallenge",
8
8
  emits: ["close", "submit"],
9
- setup(n, { emit: s }) {
10
- let e = s, t = W(!1);
11
- function i(h) {
9
+ setup(h, { emit: s }) {
10
+ let e = s, t = V(!1);
11
+ function i(n) {
12
12
  var r;
13
- ["3DS_CHALLENGE_SHOW", "3DS_CHALLENGE_CLOSE"].includes((r = h.data) == null ? void 0 : r.message) && (t.value = h.data.message === "3DS_CHALLENGE_SHOW");
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
14
  }
15
15
  return M(() => {
16
16
  window.addEventListener("message", i);
17
17
  }), O(() => {
18
18
  window.removeEventListener("message", i);
19
- }), (h, r) => Z((K(), j("div", V, [m("div", R, [m("div", $, [J(U, {
19
+ }), (n, r) => k((q(), U("div", J, [m("div", R, [m("div", X, [W($, {
20
20
  onClick: r[0] || (r[0] = (p) => e("close")),
21
21
  id: "3ds-challenge-close"
22
- }), r[1] || (r[1] = m("div", { id: "ThreeDsChallengeIFrame" }, null, -1))])])], 512)), [[k, t.value]]);
22
+ }), r[1] || (r[1] = m("div", { id: "ThreeDsChallengeIFrame" }, null, -1))])])], 512)), [[j, t.value]]);
23
23
  }
24
- }), [["__scopeId", "data-v-8a0b6dcb"]]), { hideSpinner: l, showSpinner: X } = N(), u = 5, Q = class extends x {
24
+ }), [["__scopeId", "data-v-8a0b6dcb"]]), { hideSpinner: l, showSpinner: z } = N(), u = 5, Q = class extends x {
25
25
  constructor(s, e, t) {
26
26
  var i;
27
27
  super(s, e, t);
@@ -48,31 +48,31 @@ var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" },
48
48
  onPostAuth() {
49
49
  }
50
50
  startAuth(s) {
51
- var y, w, C, S, b, E, P, v;
51
+ var D, w, S, C, b, E, v, P;
52
52
  this.log(`[${this.getType()}]: startAuth`);
53
- let e = (y = this.threeDsProcessor) == null ? void 0 : y.getPaymentInfo();
53
+ let e = (D = this.threeDsProcessor) == null ? void 0 : D.getPaymentInfo();
54
54
  if (!e) {
55
55
  l(), d(this.container, "Payment information is missing");
56
56
  return;
57
57
  }
58
- X();
59
- let t = (w = this.threeDsProcessor) == null ? void 0 : w.getAddressInfo(), i = e.expiryDate.length === 4 ? e.expiryDate.slice(2, 4) : "", h = 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()) || "", T = ((b = this.threeDsProcessor) == null ? void 0 : b.getAmount()) || 0;
60
- if (!s && (!i || !h)) {
58
+ z();
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 = ""] = ((S = e.cardholder) == null ? void 0 : S.split(/\s+/)) || [], A = ((C = this.threeDsProcessor) == null ? void 0 : C.getCurrency()) || "", L = ((b = this.threeDsProcessor) == null ? void 0 : b.getAmount()) || 0;
60
+ if (!s && (!i || !n)) {
61
61
  l(), d(this.container, "Card expiry date is invalid"), (E = this.threeDsProcessor) == null || E.onError({ error: "Card expiry date is invalid" });
62
62
  return;
63
63
  }
64
- let D = (P = s == null ? void 0 : s.gatewayMetadata) == null ? void 0 : P.billing_id, f = {
64
+ let y = (v = s == null ? void 0 : s.gatewayMetadata) == null ? void 0 : v.billing_id, T = {
65
65
  ...s ? {
66
66
  customerVaultId: s.gatewayTokenId,
67
- ...D ? { billingId: D } : {}
67
+ ...y ? { billingId: y } : {}
68
68
  } : {
69
69
  cardNumber: e.cardNumber,
70
70
  cardExpMonth: i,
71
- cardExpYear: String(parseInt(h, 10) + 2e3)
71
+ cardExpYear: String(parseInt(n, 10) + 2e3)
72
72
  },
73
73
  currency: A,
74
- amount: T.toFixed(2),
75
- email: (v = this.threeDsProcessor) == null ? void 0 : v.getEmail(),
74
+ amount: L.toFixed(2),
75
+ email: (P = this.threeDsProcessor) == null ? void 0 : P.getEmail(),
76
76
  phone: t == null ? void 0 : t.phoneNumber,
77
77
  city: t == null ? void 0 : t.city,
78
78
  state: t == null ? void 0 : t.state,
@@ -90,7 +90,7 @@ var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" },
90
90
  browserScreenWidth: String(screen.width),
91
91
  browserTimeZone: String(Math.round((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60)),
92
92
  userAgent: navigator.userAgent
93
- }, c = this.threeDS.createUI(f);
93
+ }, c = this.threeDS.createUI(T);
94
94
  c.start("#ThreeDsChallengeIFrame"), c.on("challenge", (a) => {
95
95
  this.log(`[${this.getType()}][onChallenge]`, a), l(), this.showChallenge();
96
96
  }), c.on("complete", (a) => {
@@ -119,7 +119,7 @@ var V = { class: "mask" }, R = { class: "wrapper" }, $ = { class: "container" },
119
119
  initChallenge() {
120
120
  let { destroy: s } = G({
121
121
  el: document.body,
122
- component: z,
122
+ component: Z,
123
123
  on: { close: () => {
124
124
  var e;
125
125
  this.closeChallenge(), (e = this.threeDsProcessor) == null || e.onError({ error: "Challenge cancelled" });