@payconductor/react 1.2.5 → 1.2.6
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +22 -22
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -97,7 +97,7 @@ function be(e) {
|
|
|
97
97
|
function Pe() {
|
|
98
98
|
return crypto.randomUUID();
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Se(e, a) {
|
|
101
101
|
return a.some((t) => {
|
|
102
102
|
try {
|
|
103
103
|
return new URL(t).origin === e;
|
|
@@ -136,11 +136,11 @@ function x(e, a, t, n) {
|
|
|
136
136
|
}, we);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function Ce(e, a, t) {
|
|
140
140
|
return x(e, a, p.CONFIRM_PAYMENT, t);
|
|
141
141
|
}
|
|
142
142
|
async function Ae(e, a, t) {
|
|
143
|
-
return await
|
|
143
|
+
return await Ce(e, a, {
|
|
144
144
|
orderId: t.orderId
|
|
145
145
|
});
|
|
146
146
|
}
|
|
@@ -161,7 +161,7 @@ function xe(e, a, t, n, i, r, s, d, o, c, w, E) {
|
|
|
161
161
|
requestId: f,
|
|
162
162
|
type: u,
|
|
163
163
|
data: g,
|
|
164
|
-
error:
|
|
164
|
+
error: C
|
|
165
165
|
} = m;
|
|
166
166
|
if (u === p.READY) {
|
|
167
167
|
if (n == null || n(), f && (a != null && a.has(f))) {
|
|
@@ -172,17 +172,17 @@ function xe(e, a, t, n, i, r, s, d, o, c, w, E) {
|
|
|
172
172
|
}
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
|
-
if (
|
|
175
|
+
if (Se(e.origin, ge)) {
|
|
176
176
|
if (f && a && a.has(f)) {
|
|
177
177
|
const {
|
|
178
178
|
resolve: A,
|
|
179
179
|
reject: O
|
|
180
180
|
} = a.get(f);
|
|
181
|
-
a.delete(f),
|
|
181
|
+
a.delete(f), C ? O(new Error(String(C.message))) : A(g);
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
if (u === p.ERROR) {
|
|
185
|
-
t((
|
|
185
|
+
t((C == null ? void 0 : C.message) || "Unknown error"), i == null || i(new Error(String(C == null ? void 0 : C.message)));
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
188
|
if (u === p.PAYMENT_COMPLETE) {
|
|
@@ -234,8 +234,8 @@ function rt(e) {
|
|
|
234
234
|
let m = !1;
|
|
235
235
|
c("init", e.publicKey), c("iframeUrl", w);
|
|
236
236
|
const f = () => {
|
|
237
|
-
var
|
|
238
|
-
const h = (l = (
|
|
237
|
+
var S, l;
|
|
238
|
+
const h = (l = (S = window.PayConductor) == null ? void 0 : S.frame) == null ? void 0 : l.iframe;
|
|
239
239
|
if (h) {
|
|
240
240
|
if (h instanceof HTMLIFrameElement) return h;
|
|
241
241
|
if (typeof h == "object" && h !== null) {
|
|
@@ -266,14 +266,14 @@ function rt(e) {
|
|
|
266
266
|
locale: e.locale,
|
|
267
267
|
paymentMethods: e.paymentMethods,
|
|
268
268
|
defaultPaymentMethod: e.defaultPaymentMethod
|
|
269
|
-
},
|
|
269
|
+
}, C = {
|
|
270
270
|
confirmPayment: (h) => {
|
|
271
271
|
var l;
|
|
272
272
|
c("→ CONFIRM_PAYMENT", {
|
|
273
273
|
orderId: h.orderId
|
|
274
274
|
});
|
|
275
|
-
const
|
|
276
|
-
return
|
|
275
|
+
const S = f();
|
|
276
|
+
return S != null && S.contentWindow && S.contentWindow.postMessage(
|
|
277
277
|
{
|
|
278
278
|
type: p.CONFIG,
|
|
279
279
|
data: {
|
|
@@ -288,7 +288,7 @@ function rt(e) {
|
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
290
|
"*"
|
|
291
|
-
), g.orderId = h.orderId, (l = window.PayConductor) != null && l.config && (window.PayConductor.config.orderId = h.orderId), Ae(
|
|
291
|
+
), g.orderId = h.orderId, (l = window.PayConductor) != null && l.config && (window.PayConductor.config.orderId = h.orderId), Ae(S, E, h);
|
|
292
292
|
},
|
|
293
293
|
validate: (h) => (c("→ VALIDATE", h), Te(f(), E, h)),
|
|
294
294
|
reset: () => (c("→ RESET"), ve(f(), E)),
|
|
@@ -297,7 +297,7 @@ function rt(e) {
|
|
|
297
297
|
window.PayConductor = {
|
|
298
298
|
frame: u,
|
|
299
299
|
config: g,
|
|
300
|
-
api:
|
|
300
|
+
api: C,
|
|
301
301
|
selectedPaymentMethod: d
|
|
302
302
|
}, c("registered"), window.dispatchEvent(
|
|
303
303
|
new CustomEvent("payconductor:registered", {
|
|
@@ -327,8 +327,8 @@ function rt(e) {
|
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
329
|
}, O = (h) => {
|
|
330
|
-
var
|
|
331
|
-
(
|
|
330
|
+
var S;
|
|
331
|
+
(S = h.data) != null && S.type && c("←", h.data.type, h.data.data ?? ""), xe(
|
|
332
332
|
h,
|
|
333
333
|
E,
|
|
334
334
|
(l) => {
|
|
@@ -375,11 +375,11 @@ function rt(e) {
|
|
|
375
375
|
};
|
|
376
376
|
window.addEventListener("message", O);
|
|
377
377
|
const J = () => {
|
|
378
|
-
var
|
|
378
|
+
var S, l, y;
|
|
379
379
|
const h = f();
|
|
380
380
|
if (!h) return !1;
|
|
381
381
|
try {
|
|
382
|
-
if ((((
|
|
382
|
+
if ((((S = h.contentDocument) == null ? void 0 : S.readyState) ?? ((y = (l = h.contentWindow) == null ? void 0 : l.document) == null ? void 0 : y.readyState)) === "complete")
|
|
383
383
|
return A(), !0;
|
|
384
384
|
} catch {
|
|
385
385
|
}
|
|
@@ -430,8 +430,8 @@ function ot(e) {
|
|
|
430
430
|
}
|
|
431
431
|
let w = !1;
|
|
432
432
|
const E = (m) => {
|
|
433
|
-
var f, u, g,
|
|
434
|
-
if (((f = m.data) == null ? void 0 : f.type) === p.RESIZE && ((g = (u = m.data) == null ? void 0 : u.data) != null && g.height) && d(m.data.data.height + "px"), ((
|
|
433
|
+
var f, u, g, C;
|
|
434
|
+
if (((f = m.data) == null ? void 0 : f.type) === p.RESIZE && ((g = (u = m.data) == null ? void 0 : u.data) != null && g.height) && d(m.data.data.height + "px"), ((C = m.data) == null ? void 0 : C.type) === p.READY && e.height && !w) {
|
|
435
435
|
w = !0;
|
|
436
436
|
const A = document.querySelector(
|
|
437
437
|
".payconductor-element iframe"
|
|
@@ -1102,7 +1102,7 @@ class Ye {
|
|
|
1102
1102
|
});
|
|
1103
1103
|
t.ok || await this.parseResponseError("Failed to fetch 3DS data", t);
|
|
1104
1104
|
const n = await t.json();
|
|
1105
|
-
return Object.fromEntries(Object.entries(n).filter(([, i]) => i != null));
|
|
1105
|
+
return Object.fromEntries(Object.entries(n.threeDSecure).filter(([, i]) => i != null));
|
|
1106
1106
|
}
|
|
1107
1107
|
async parseResponseError(a, t) {
|
|
1108
1108
|
var i, r, s, d;
|
|
@@ -1391,7 +1391,7 @@ export {
|
|
|
1391
1391
|
rt as default,
|
|
1392
1392
|
at as defaultTheme,
|
|
1393
1393
|
Pe as generateRequestId,
|
|
1394
|
-
|
|
1394
|
+
Se as isValidOrigin,
|
|
1395
1395
|
L as loadScript,
|
|
1396
1396
|
dt as usePayConductor,
|
|
1397
1397
|
ct as usePayconductorElement,
|