moyasar-payment-form 2.0.8 → 2.0.9
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/__vite-browser-external-DYxpcVy9.mjs +1 -1
- package/dist/moyasar.css +2 -2
- package/dist/moyasar.mjs +379 -375
- package/dist/moyasar.umd.js +3 -3
- package/package.json +1 -1
package/dist/moyasar.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: moyasar-payment-form
|
|
3
|
-
* version: v2.0.
|
|
3
|
+
* version: v2.0.9
|
|
4
4
|
* description: Moyasar payment form utilities
|
|
5
5
|
* author: Jan Jagieła - Railwaymen Team
|
|
6
6
|
* homepage: https://docs.moyasar.com/credit-card
|
|
@@ -9,14 +9,14 @@ var ye = Object.defineProperty, we = Object.defineProperties;
|
|
|
9
9
|
var he = Object.getOwnPropertyDescriptors;
|
|
10
10
|
var hA = Object.getOwnPropertySymbols;
|
|
11
11
|
var it = Object.prototype.hasOwnProperty, ct = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var ut = Math.pow, lt = (A, t, e) => t in A ? ye(A, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[t] = e,
|
|
12
|
+
var ut = Math.pow, lt = (A, t, e) => t in A ? ye(A, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[t] = e, D = (A, t) => {
|
|
13
13
|
for (var e in t || (t = {}))
|
|
14
14
|
it.call(t, e) && lt(A, e, t[e]);
|
|
15
15
|
if (hA)
|
|
16
16
|
for (var e of hA(t))
|
|
17
17
|
ct.call(t, e) && lt(A, e, t[e]);
|
|
18
18
|
return A;
|
|
19
|
-
},
|
|
19
|
+
}, Q = (A, t) => we(A, he(t));
|
|
20
20
|
var bA = (A, t) => {
|
|
21
21
|
var e = {};
|
|
22
22
|
for (var n in A)
|
|
@@ -91,8 +91,8 @@ function XA() {
|
|
|
91
91
|
XA.__r = 0;
|
|
92
92
|
}
|
|
93
93
|
function Vt(A, t, e, n, r, a, s, o, c, l, u) {
|
|
94
|
-
var i,
|
|
95
|
-
for (e.__d = c, Ce(e, t, d), c = e.__d, i = 0; i <
|
|
94
|
+
var i, g, p, y, w, d = n && n.__k || qt, m = t.length;
|
|
95
|
+
for (e.__d = c, Ce(e, t, d), c = e.__d, i = 0; i < m; i++) (p = e.__k[i]) != null && typeof p != "boolean" && typeof p != "function" && (g = p.__i === -1 ? fA : d[p.__i] || fA, p.__i = i, nt(A, p, g, r, a, s, o, c, l, u), y = p.__e, p.ref && g.ref != p.ref && (g.ref && rt(g.ref, null, p), u.push(p.ref, p.__c || y, p)), w == null && y != null && (w = y), 65536 & p.__u || g.__k === p.__k ? (c && typeof p.type == "string" && !A.contains(c) && (c = aA(g)), c = Kt(p, c, A)) : typeof p.type == "function" && p.__d !== void 0 ? c = p.__d : y && (c = y.nextSibling), p.__d = void 0, p.__u &= -196609);
|
|
96
96
|
e.__d = c, e.__e = w;
|
|
97
97
|
}
|
|
98
98
|
function Ce(A, t, e) {
|
|
@@ -164,30 +164,30 @@ function dt(A) {
|
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
function nt(A, t, e, n, r, a, s, o, c, l) {
|
|
167
|
-
var u, i,
|
|
167
|
+
var u, i, g, p, y, w, d, m, v, h, b, M, C, X, N, O, P = t.type;
|
|
168
168
|
if (t.constructor !== void 0) return null;
|
|
169
169
|
128 & e.__u && (c = !!(32 & e.__u), a = [o = t.__e = e.__e]), (u = k.__b) && u(t);
|
|
170
170
|
A: if (typeof P == "function") try {
|
|
171
|
-
if (
|
|
171
|
+
if (m = t.props, v = "prototype" in P && P.prototype.render, h = (u = P.contextType) && n[u.__c], b = u ? h ? h.props.value : u.__ : n, e.__c ? d = (i = t.__c = e.__c).__ = i.__E : (v ? t.__c = i = new P(m, b) : (t.__c = i = new H(m, b), i.constructor = P, i.render = Me), h && h.sub(i), i.props = m, i.state || (i.state = {}), i.context = b, i.__n = n, g = i.__d = !0, i.__h = [], i._sb = []), v && i.__s == null && (i.__s = i.state), v && P.getDerivedStateFromProps != null && (i.__s == i.state && (i.__s = AA({}, i.__s)), AA(i.__s, P.getDerivedStateFromProps(m, i.__s))), p = i.props, y = i.state, i.__v = t, g) v && P.getDerivedStateFromProps == null && i.componentWillMount != null && i.componentWillMount(), v && i.componentDidMount != null && i.__h.push(i.componentDidMount);
|
|
172
172
|
else {
|
|
173
|
-
if (v && P.getDerivedStateFromProps == null &&
|
|
174
|
-
for (t.__v !== e.__v && (i.props =
|
|
173
|
+
if (v && P.getDerivedStateFromProps == null && m !== p && i.componentWillReceiveProps != null && i.componentWillReceiveProps(m, b), !i.__e && (i.shouldComponentUpdate != null && i.shouldComponentUpdate(m, i.__s, b) === !1 || t.__v === e.__v)) {
|
|
174
|
+
for (t.__v !== e.__v && (i.props = m, i.state = i.__s, i.__d = !1), t.__e = e.__e, t.__k = e.__k, t.__k.forEach(function(S) {
|
|
175
175
|
S && (S.__ = t);
|
|
176
|
-
}),
|
|
176
|
+
}), M = 0; M < i._sb.length; M++) i.__h.push(i._sb[M]);
|
|
177
177
|
i._sb = [], i.__h.length && s.push(i);
|
|
178
178
|
break A;
|
|
179
179
|
}
|
|
180
|
-
i.componentWillUpdate != null && i.componentWillUpdate(
|
|
181
|
-
i.componentDidUpdate(p,
|
|
180
|
+
i.componentWillUpdate != null && i.componentWillUpdate(m, i.__s, b), v && i.componentDidUpdate != null && i.__h.push(function() {
|
|
181
|
+
i.componentDidUpdate(p, y, w);
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
-
if (i.context = b, i.props =
|
|
185
|
-
for (i.state = i.__s, i.__d = !1,
|
|
184
|
+
if (i.context = b, i.props = m, i.__P = A, i.__e = !1, C = k.__r, X = 0, v) {
|
|
185
|
+
for (i.state = i.__s, i.__d = !1, C && C(t), u = i.render(i.props, i.state, i.context), N = 0; N < i._sb.length; N++) i.__h.push(i._sb[N]);
|
|
186
186
|
i._sb = [];
|
|
187
187
|
} else do
|
|
188
|
-
i.__d = !1,
|
|
188
|
+
i.__d = !1, C && C(t), u = i.render(i.props, i.state, i.context), i.state = i.__s;
|
|
189
189
|
while (i.__d && ++X < 25);
|
|
190
|
-
i.state = i.__s, i.getChildContext != null && (n = AA(AA({}, n), i.getChildContext())), v && !
|
|
190
|
+
i.state = i.__s, i.getChildContext != null && (n = AA(AA({}, n), i.getChildContext())), v && !g && i.getSnapshotBeforeUpdate != null && (w = i.getSnapshotBeforeUpdate(p, y)), Vt(A, OA(O = u != null && u.type === j && u.key == null ? u.props.children : u) ? O : [O], t, e, n, r, a, s, o, c, l), i.base = t.__e, t.__u &= -161, i.__h.length && s.push(i), d && (i.__E = i.__ = null);
|
|
191
191
|
} catch (S) {
|
|
192
192
|
t.__v = null, c || a != null ? (t.__e = o, t.__u |= c ? 160 : 32, a[a.indexOf(o)] = null) : (t.__e = e.__e, t.__k = e.__k), k.__e(S, t, e);
|
|
193
193
|
}
|
|
@@ -208,7 +208,7 @@ function Zt(A, t, e) {
|
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
function ke(A, t, e, n, r, a, s, o, c) {
|
|
211
|
-
var l, u, i,
|
|
211
|
+
var l, u, i, g, p, y, w, d = e.props, m = t.props, v = t.type;
|
|
212
212
|
if (v === "svg" ? r = "http://www.w3.org/2000/svg" : v === "math" ? r = "http://www.w3.org/1998/Math/MathML" : r || (r = "http://www.w3.org/1999/xhtml"), a != null) {
|
|
213
213
|
for (l = 0; l < a.length; l++) if ((p = a[l]) && "setAttribute" in p == !!v && (v ? p.localName === v : p.nodeType === 3)) {
|
|
214
214
|
A = p, a[l] = null;
|
|
@@ -216,23 +216,23 @@ function ke(A, t, e, n, r, a, s, o, c) {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
if (A == null) {
|
|
219
|
-
if (v === null) return document.createTextNode(
|
|
220
|
-
A = document.createElementNS(r, v,
|
|
219
|
+
if (v === null) return document.createTextNode(m);
|
|
220
|
+
A = document.createElementNS(r, v, m.is && m), a = null, o = !1;
|
|
221
221
|
}
|
|
222
|
-
if (v === null) d ===
|
|
222
|
+
if (v === null) d === m || o && A.data === m || (A.data = m);
|
|
223
223
|
else {
|
|
224
224
|
if (a = a && IA.call(A.childNodes), d = e.props || fA, !o && a != null) for (d = {}, l = 0; l < A.attributes.length; l++) d[(p = A.attributes[l]).name] = p.value;
|
|
225
225
|
for (l in d) if (p = d[l], l != "children") {
|
|
226
226
|
if (l == "dangerouslySetInnerHTML") i = p;
|
|
227
|
-
else if (l !== "key" && !(l in
|
|
228
|
-
if (l == "value" && "defaultValue" in
|
|
227
|
+
else if (l !== "key" && !(l in m)) {
|
|
228
|
+
if (l == "value" && "defaultValue" in m || l == "checked" && "defaultChecked" in m) continue;
|
|
229
229
|
CA(A, l, null, p, r);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
for (l in
|
|
232
|
+
for (l in m) p = m[l], l == "children" ? g = p : l == "dangerouslySetInnerHTML" ? u = p : l == "value" ? y = p : l == "checked" ? w = p : l === "key" || o && typeof p != "function" || d[l] === p || CA(A, l, p, d[l], r);
|
|
233
233
|
if (u) o || i && (u.__html === i.__html || u.__html === A.innerHTML) || (A.innerHTML = u.__html), t.__k = [];
|
|
234
|
-
else if (i && (A.innerHTML = ""), Vt(A, OA(
|
|
235
|
-
o || (l = "value",
|
|
234
|
+
else if (i && (A.innerHTML = ""), Vt(A, OA(g) ? g : [g], t, e, n, v === "foreignObject" ? "http://www.w3.org/1999/xhtml" : r, a, s, a ? a[0] : e.__k && aA(e, 0), o, c), a != null) for (l = a.length; l--; ) a[l] != null && xt(a[l]);
|
|
235
|
+
o || (l = "value", y !== void 0 && (y !== A[l] || v === "progress" && !y || v === "option" && y !== d[l]) && CA(A, l, y, d[l], r), l = "checked", w !== void 0 && w !== A[l] && CA(A, l, w, d[l], r));
|
|
236
236
|
}
|
|
237
237
|
return A;
|
|
238
238
|
}
|
|
@@ -310,14 +310,14 @@ function f(A, t, e, n, r, a) {
|
|
|
310
310
|
if (typeof A == "function" && (s = A.defaultProps)) for (o in s) c[o] === void 0 && (c[o] = s[o]);
|
|
311
311
|
return k.vnode && k.vnode(l), l;
|
|
312
312
|
}
|
|
313
|
-
const Rt = "2.0.
|
|
314
|
-
var lA,
|
|
313
|
+
const Rt = "2.0.9", E = at({});
|
|
314
|
+
var lA, I, JA, vt, dA = 0, Ht = [], z = k, gt = z.__b, yt = z.__r, wt = z.diffed, ht = z.__c, bt = z.unmount, Ct = z.__;
|
|
315
315
|
function UA(A, t) {
|
|
316
|
-
|
|
317
|
-
var e =
|
|
316
|
+
z.__h && z.__h(I, A, dA || t), dA = 0;
|
|
317
|
+
var e = I.__H || (I.__H = { __: [], __h: [] });
|
|
318
318
|
return A >= e.__.length && e.__.push({}), e.__[A];
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function L(A) {
|
|
321
321
|
return dA = 1, Se($t, A);
|
|
322
322
|
}
|
|
323
323
|
function Se(A, t, e) {
|
|
@@ -325,38 +325,38 @@ function Se(A, t, e) {
|
|
|
325
325
|
if (n.t = A, !n.__c && (n.__ = [e ? e(t) : $t(void 0, t), function(o) {
|
|
326
326
|
var c = n.__N ? n.__N[0] : n.__[0], l = n.t(c, o);
|
|
327
327
|
c !== l && (n.__N = [l, n.__[1]], n.__c.setState({}));
|
|
328
|
-
}], n.__c =
|
|
328
|
+
}], n.__c = I, !I.u)) {
|
|
329
329
|
var r = function(o, c, l) {
|
|
330
330
|
if (!n.__c.__H) return !0;
|
|
331
|
-
var u = n.__c.__H.__.filter(function(
|
|
332
|
-
return !!
|
|
331
|
+
var u = n.__c.__H.__.filter(function(g) {
|
|
332
|
+
return !!g.__c;
|
|
333
333
|
});
|
|
334
|
-
if (u.every(function(
|
|
335
|
-
return !
|
|
334
|
+
if (u.every(function(g) {
|
|
335
|
+
return !g.__N;
|
|
336
336
|
})) return !a || a.call(this, o, c, l);
|
|
337
337
|
var i = !1;
|
|
338
|
-
return u.forEach(function(
|
|
339
|
-
if (
|
|
340
|
-
var p =
|
|
341
|
-
|
|
338
|
+
return u.forEach(function(g) {
|
|
339
|
+
if (g.__N) {
|
|
340
|
+
var p = g.__[0];
|
|
341
|
+
g.__ = g.__N, g.__N = void 0, p !== g.__[0] && (i = !0);
|
|
342
342
|
}
|
|
343
343
|
}), !(!i && n.__c.props === o) && (!a || a.call(this, o, c, l));
|
|
344
344
|
};
|
|
345
|
-
|
|
346
|
-
var a =
|
|
347
|
-
|
|
345
|
+
I.u = !0;
|
|
346
|
+
var a = I.shouldComponentUpdate, s = I.componentWillUpdate;
|
|
347
|
+
I.componentWillUpdate = function(o, c, l) {
|
|
348
348
|
if (this.__e) {
|
|
349
349
|
var u = a;
|
|
350
350
|
a = void 0, r(o, c, l), a = u;
|
|
351
351
|
}
|
|
352
352
|
s && s.call(this, o, c, l);
|
|
353
|
-
},
|
|
353
|
+
}, I.shouldComponentUpdate = r;
|
|
354
354
|
}
|
|
355
355
|
return n.__N || n.__;
|
|
356
356
|
}
|
|
357
357
|
function q(A, t) {
|
|
358
358
|
var e = UA(lA++, 3);
|
|
359
|
-
!
|
|
359
|
+
!z.__s && Ft(e.__H, t) && (e.__ = A, e.i = t, I.__H.__h.push(e));
|
|
360
360
|
}
|
|
361
361
|
function Z(A) {
|
|
362
362
|
return dA = 5, oA(function() {
|
|
@@ -372,34 +372,34 @@ function jt(A, t) {
|
|
|
372
372
|
return A;
|
|
373
373
|
}, t);
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
var t =
|
|
377
|
-
return e.c = A, t ? (e.__ == null && (e.__ = !0, t.sub(
|
|
375
|
+
function U(A) {
|
|
376
|
+
var t = I.context[A.__c], e = UA(lA++, 9);
|
|
377
|
+
return e.c = A, t ? (e.__ == null && (e.__ = !0, t.sub(I)), t.props.value) : A.__;
|
|
378
378
|
}
|
|
379
379
|
function Pe() {
|
|
380
380
|
for (var A; A = Ht.shift(); ) if (A.__P && A.__H) try {
|
|
381
381
|
A.__H.__h.forEach(SA), A.__H.__h.forEach(RA), A.__H.__h = [];
|
|
382
382
|
} catch (t) {
|
|
383
|
-
A.__H.__h = [],
|
|
383
|
+
A.__H.__h = [], z.__e(t, A.__v);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
},
|
|
386
|
+
z.__b = function(A) {
|
|
387
|
+
I = null, gt && gt(A);
|
|
388
|
+
}, z.__ = function(A, t) {
|
|
389
389
|
A && t.__k && t.__k.__m && (A.__m = t.__k.__m), Ct && Ct(A, t);
|
|
390
|
-
},
|
|
390
|
+
}, z.__r = function(A) {
|
|
391
391
|
yt && yt(A), lA = 0;
|
|
392
|
-
var t = (
|
|
393
|
-
t && (JA ===
|
|
392
|
+
var t = (I = A.__c).__H;
|
|
393
|
+
t && (JA === I ? (t.__h = [], I.__h = [], t.__.forEach(function(e) {
|
|
394
394
|
e.__N && (e.__ = e.__N), e.i = e.__N = void 0;
|
|
395
|
-
})) : (t.__h.forEach(SA), t.__h.forEach(RA), t.__h = [], lA = 0)), JA =
|
|
396
|
-
},
|
|
395
|
+
})) : (t.__h.forEach(SA), t.__h.forEach(RA), t.__h = [], lA = 0)), JA = I;
|
|
396
|
+
}, z.diffed = function(A) {
|
|
397
397
|
wt && wt(A);
|
|
398
398
|
var t = A.__c;
|
|
399
|
-
t && t.__H && (t.__H.__h.length && (Ht.push(t) !== 1 && vt ===
|
|
399
|
+
t && t.__H && (t.__H.__h.length && (Ht.push(t) !== 1 && vt === z.requestAnimationFrame || ((vt = z.requestAnimationFrame) || Xe)(Pe)), t.__H.__.forEach(function(e) {
|
|
400
400
|
e.i && (e.__H = e.i), e.i = void 0;
|
|
401
|
-
})), JA =
|
|
402
|
-
},
|
|
401
|
+
})), JA = I = null;
|
|
402
|
+
}, z.__c = function(A, t) {
|
|
403
403
|
t.some(function(e) {
|
|
404
404
|
try {
|
|
405
405
|
e.__h.forEach(SA), e.__h = e.__h.filter(function(n) {
|
|
@@ -408,10 +408,10 @@ U.__b = function(A) {
|
|
|
408
408
|
} catch (n) {
|
|
409
409
|
t.some(function(r) {
|
|
410
410
|
r.__h && (r.__h = []);
|
|
411
|
-
}), t = [],
|
|
411
|
+
}), t = [], z.__e(n, e.__v);
|
|
412
412
|
}
|
|
413
413
|
}), ht && ht(A, t);
|
|
414
|
-
},
|
|
414
|
+
}, z.unmount = function(A) {
|
|
415
415
|
bt && bt(A);
|
|
416
416
|
var t, e = A.__c;
|
|
417
417
|
e && e.__H && (e.__H.__.forEach(function(n) {
|
|
@@ -420,7 +420,7 @@ U.__b = function(A) {
|
|
|
420
420
|
} catch (r) {
|
|
421
421
|
t = r;
|
|
422
422
|
}
|
|
423
|
-
}), e.__H = void 0, t &&
|
|
423
|
+
}), e.__H = void 0, t && z.__e(t, e.__v));
|
|
424
424
|
};
|
|
425
425
|
var Dt = typeof requestAnimationFrame == "function";
|
|
426
426
|
function Xe(A) {
|
|
@@ -430,12 +430,12 @@ function Xe(A) {
|
|
|
430
430
|
Dt && (t = requestAnimationFrame(e));
|
|
431
431
|
}
|
|
432
432
|
function SA(A) {
|
|
433
|
-
var t =
|
|
434
|
-
typeof e == "function" && (A.__c = void 0, e()),
|
|
433
|
+
var t = I, e = A.__c;
|
|
434
|
+
typeof e == "function" && (A.__c = void 0, e()), I = t;
|
|
435
435
|
}
|
|
436
436
|
function RA(A) {
|
|
437
|
-
var t =
|
|
438
|
-
A.__c = A.__(),
|
|
437
|
+
var t = I;
|
|
438
|
+
A.__c = A.__(), I = t;
|
|
439
439
|
}
|
|
440
440
|
function Ft(A, t) {
|
|
441
441
|
return !A || A.length !== t.length || t.some(function(e, n) {
|
|
@@ -446,7 +446,7 @@ function $t(A, t) {
|
|
|
446
446
|
return typeof t == "function" ? t(A) : t;
|
|
447
447
|
}
|
|
448
448
|
function x() {
|
|
449
|
-
const { language: A, translations: t } =
|
|
449
|
+
const { language: A, translations: t } = U(E);
|
|
450
450
|
function e(n) {
|
|
451
451
|
if (!t)
|
|
452
452
|
return n;
|
|
@@ -458,7 +458,7 @@ function x() {
|
|
|
458
458
|
};
|
|
459
459
|
}
|
|
460
460
|
const Qe = () => {
|
|
461
|
-
const { t: A } = x(), { isTestMode: t } =
|
|
461
|
+
const { t: A } = x(), { isTestMode: t } = U(E);
|
|
462
462
|
return /* @__PURE__ */ f("footer", { class: "flex flex-col items-center gap-4 text-xs", children: [
|
|
463
463
|
/* @__PURE__ */ f("a", { href: "https://moyasar.com/?ref=payment-form-v1.14.0", target: "_blank", class: "text-black/70", children: [
|
|
464
464
|
A("form.powered_by"),
|
|
@@ -642,24 +642,24 @@ const tA = (...A) => Oe(A), HA = (A) => {
|
|
|
642
642
|
"busy",
|
|
643
643
|
"fail",
|
|
644
644
|
"success"
|
|
645
|
-
]), { isProcessing: u } =
|
|
645
|
+
]), { isProcessing: u } = U(E), i = {
|
|
646
646
|
primary: "bg-primary text-white",
|
|
647
647
|
stc: "bg-stc text-white",
|
|
648
648
|
error: "bg-error text-white pointer-events-none",
|
|
649
649
|
success: "bg-success text-white"
|
|
650
650
|
};
|
|
651
|
-
function
|
|
651
|
+
function g() {
|
|
652
652
|
return o ? i.error : c ? i.success : i[n];
|
|
653
653
|
}
|
|
654
654
|
return /* @__PURE__ */ f(
|
|
655
655
|
"button",
|
|
656
|
-
|
|
656
|
+
Q(D({}, l), {
|
|
657
657
|
type: e,
|
|
658
658
|
disabled: u || a,
|
|
659
659
|
onClick: r,
|
|
660
660
|
class: tA([
|
|
661
661
|
"flex h-11 w-full cursor-pointer items-center justify-center gap-2 rounded-lg px-3 py-2 transition-colors disabled:cursor-default disabled:opacity-70",
|
|
662
|
-
|
|
662
|
+
g(),
|
|
663
663
|
A.class,
|
|
664
664
|
u && !o && "pointer-events-none grayscale"
|
|
665
665
|
]),
|
|
@@ -742,10 +742,10 @@ const tA = (...A) => Oe(A), HA = (A) => {
|
|
|
742
742
|
/* @__PURE__ */ f(ze, { currency: A }),
|
|
743
743
|
/* @__PURE__ */ f("span", { children: t })
|
|
744
744
|
] }), iA = (A) => {
|
|
745
|
-
const c = A, { name: t, placeholder: e, type: n = "text", onBlur: r, disabled: a } = c, s = bA(c, ["name", "placeholder", "type", "onBlur", "disabled"]), { isProcessing: o } =
|
|
745
|
+
const c = A, { name: t, placeholder: e, type: n = "text", onBlur: r, disabled: a } = c, s = bA(c, ["name", "placeholder", "type", "onBlur", "disabled"]), { isProcessing: o } = U(E);
|
|
746
746
|
return /* @__PURE__ */ f(
|
|
747
747
|
"input",
|
|
748
|
-
|
|
748
|
+
Q(D({}, s), {
|
|
749
749
|
dir: "ltr",
|
|
750
750
|
id: t,
|
|
751
751
|
name: t,
|
|
@@ -930,10 +930,10 @@ k.diffed = function(A) {
|
|
|
930
930
|
function cA(A, t, e) {
|
|
931
931
|
var n = this, r = Z(null), a = Z(0), s = Z(null), o = Z([]), c = Z(), l = Z(), u = Z(A), i = Z(!0);
|
|
932
932
|
u.current = A;
|
|
933
|
-
var
|
|
933
|
+
var g = typeof window != "undefined", p = !t && t !== 0 && g;
|
|
934
934
|
if (typeof A != "function") throw new TypeError("Expected a function");
|
|
935
935
|
t = +t || 0;
|
|
936
|
-
var
|
|
936
|
+
var y = !!(e = e || {}).leading, w = !("trailing" in e) || !!e.trailing, d = "maxWait" in e, m = "debounceOnServer" in e && !!e.debounceOnServer, v = d ? Math.max(+e.maxWait || 0, t) : null;
|
|
937
937
|
q(function() {
|
|
938
938
|
return i.current = !0, function() {
|
|
939
939
|
i.current = !1;
|
|
@@ -943,29 +943,29 @@ function cA(A, t, e) {
|
|
|
943
943
|
var b = function(P) {
|
|
944
944
|
var S = o.current, G = c.current;
|
|
945
945
|
return o.current = c.current = null, a.current = P, l.current = u.current.apply(G, S);
|
|
946
|
-
},
|
|
946
|
+
}, M = function(P, S) {
|
|
947
947
|
p && cancelAnimationFrame(s.current), s.current = p ? requestAnimationFrame(P) : setTimeout(P, S);
|
|
948
|
-
},
|
|
948
|
+
}, C = function(P) {
|
|
949
949
|
if (!i.current) return !1;
|
|
950
950
|
var S = P - r.current;
|
|
951
951
|
return !r.current || S >= t || S < 0 || d && P - a.current >= v;
|
|
952
952
|
}, X = function(P) {
|
|
953
953
|
return s.current = null, w && o.current ? b(P) : (o.current = c.current = null, l.current);
|
|
954
|
-
},
|
|
954
|
+
}, N = function P() {
|
|
955
955
|
var S = Date.now();
|
|
956
|
-
if (
|
|
956
|
+
if (C(S)) return X(S);
|
|
957
957
|
if (i.current) {
|
|
958
958
|
var G = t - (S - r.current), F = d ? Math.min(G, v - (S - a.current)) : G;
|
|
959
|
-
|
|
959
|
+
M(P, F);
|
|
960
960
|
}
|
|
961
961
|
}, O = function() {
|
|
962
|
-
if (
|
|
963
|
-
var P = Date.now(), S =
|
|
962
|
+
if (g || m) {
|
|
963
|
+
var P = Date.now(), S = C(P);
|
|
964
964
|
if (o.current = [].slice.call(arguments), c.current = n, r.current = P, S) {
|
|
965
|
-
if (!s.current && i.current) return a.current = r.current,
|
|
966
|
-
if (d) return
|
|
965
|
+
if (!s.current && i.current) return a.current = r.current, M(N, t), y ? b(r.current) : l.current;
|
|
966
|
+
if (d) return M(N, t), b(r.current);
|
|
967
967
|
}
|
|
968
|
-
return s.current ||
|
|
968
|
+
return s.current || M(N, t), l.current;
|
|
969
969
|
}
|
|
970
970
|
};
|
|
971
971
|
return O.cancel = function() {
|
|
@@ -975,7 +975,7 @@ function cA(A, t, e) {
|
|
|
975
975
|
}, O.flush = function() {
|
|
976
976
|
return s.current ? X(Date.now()) : l.current;
|
|
977
977
|
}, O;
|
|
978
|
-
}, [
|
|
978
|
+
}, [y, d, t, v, w, p, g, m]);
|
|
979
979
|
return h;
|
|
980
980
|
}
|
|
981
981
|
var He = Object.defineProperty, je = (A, t, e) => t in A ? He(A, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : A[t] = e, TA = (A, t, e) => je(A, typeof t != "symbol" ? t + "" : t, e);
|
|
@@ -992,27 +992,27 @@ const Lt = {
|
|
|
992
992
|
roundingMode: "trunc"
|
|
993
993
|
});
|
|
994
994
|
}, Fe = (A, t = !0, e) => {
|
|
995
|
-
var d,
|
|
995
|
+
var d, m, v;
|
|
996
996
|
var n, r, a, s;
|
|
997
997
|
const o = ((n = e.number) == null ? void 0 : n.unsigned) == null && A.startsWith("-") ? "-" : "", c = (d = (r = e.number) == null ? void 0 : r.fraction) != null ? d : 0;
|
|
998
998
|
let l = Ot(0, c, e);
|
|
999
|
-
const u = l.formatToParts(1000.12), i = (
|
|
999
|
+
const u = l.formatToParts(1000.12), i = (m = (a = u.find((h) => h.type === "group")) == null ? void 0 : a.value) != null ? m : " ", g = (v = (s = u.find((h) => h.type === "decimal")) == null ? void 0 : s.value) != null ? v : ".", p = It(A, i, g);
|
|
1000
1000
|
if (Number.isNaN(parseFloat(p))) return o;
|
|
1001
|
-
const
|
|
1002
|
-
if (
|
|
1003
|
-
const h =
|
|
1001
|
+
const y = p.split(".");
|
|
1002
|
+
if (y[1] != null && y[1].length >= 1) {
|
|
1003
|
+
const h = y[1].length <= c ? y[1].length : c;
|
|
1004
1004
|
l = Ot(h, c, e);
|
|
1005
1005
|
}
|
|
1006
1006
|
let w = l.format(parseFloat(p));
|
|
1007
|
-
return t ? c > 0 && p.endsWith(".") && !p.slice(0, -1).includes(".") && (w +=
|
|
1007
|
+
return t ? c > 0 && p.endsWith(".") && !p.slice(0, -1).includes(".") && (w += g) : w = It(w, i, g), o + w;
|
|
1008
1008
|
};
|
|
1009
1009
|
class $e {
|
|
1010
1010
|
constructor(t = {}) {
|
|
1011
1011
|
var n;
|
|
1012
1012
|
TA(this, "opts", {}), TA(this, "memo", /* @__PURE__ */ new Map());
|
|
1013
|
-
const e =
|
|
1013
|
+
const e = D({}, t);
|
|
1014
1014
|
if (e.tokens != null) {
|
|
1015
|
-
e.tokens = e.tokensReplace ?
|
|
1015
|
+
e.tokens = e.tokensReplace ? D({}, e.tokens) : D(D({}, Lt), e.tokens);
|
|
1016
1016
|
for (const r of Object.values(e.tokens))
|
|
1017
1017
|
typeof r.pattern == "string" && (r.pattern = new RegExp(r.pattern));
|
|
1018
1018
|
} else
|
|
@@ -1060,18 +1060,18 @@ class $e {
|
|
|
1060
1060
|
if (e == null) return t;
|
|
1061
1061
|
const r = `v=${t},mr=${e},m=${n ? 1 : 0}`;
|
|
1062
1062
|
if (this.memo.has(r)) return this.memo.get(r);
|
|
1063
|
-
const { mask: a, escaped: s } = this.escapeMask(e), o = [], c = this.opts.tokens != null ? this.opts.tokens : {}, l = this.isReversed() ? -1 : 1, u = this.isReversed() ? "unshift" : "push", i = this.isReversed() ? 0 : a.length - 1,
|
|
1064
|
-
let
|
|
1065
|
-
for (;
|
|
1066
|
-
const h = a.charAt(d), b = c[h],
|
|
1067
|
-
if (!s.includes(d) && b != null ? (
|
|
1063
|
+
const { mask: a, escaped: s } = this.escapeMask(e), o = [], c = this.opts.tokens != null ? this.opts.tokens : {}, l = this.isReversed() ? -1 : 1, u = this.isReversed() ? "unshift" : "push", i = this.isReversed() ? 0 : a.length - 1, g = this.isReversed() ? () => d > -1 && m > -1 : () => d < a.length && m < t.length, p = (h) => !this.isReversed() && h <= i || this.isReversed() && h >= i;
|
|
1064
|
+
let y, w = -1, d = this.isReversed() ? a.length - 1 : 0, m = this.isReversed() ? t.length - 1 : 0, v = !1;
|
|
1065
|
+
for (; g(); ) {
|
|
1066
|
+
const h = a.charAt(d), b = c[h], M = (b == null ? void 0 : b.transform) != null ? b.transform(t.charAt(m)) : t.charAt(m);
|
|
1067
|
+
if (!s.includes(d) && b != null ? (M.match(b.pattern) != null ? (o[u](M), b.repeated ? (w === -1 ? w = d : d === i && d !== w && (d = w - l), i === w && (d -= l)) : b.multiple && (v = !0, d -= l), d += l) : b.multiple ? v && (d += l, m -= l, v = !1) : M === y ? y = void 0 : b.optional && (d += l, m -= l), m += l) : (n && !this.isEager() && o[u](h), M === h && !this.isEager() ? m += l : y = h, this.isEager() || (d += l)), this.isEager())
|
|
1068
1068
|
for (; p(d) && (c[a.charAt(d)] == null || s.includes(d)); ) {
|
|
1069
1069
|
if (n) {
|
|
1070
|
-
if (o[u](a.charAt(d)), t.charAt(
|
|
1071
|
-
d += l,
|
|
1070
|
+
if (o[u](a.charAt(d)), t.charAt(m) === a.charAt(d)) {
|
|
1071
|
+
d += l, m += l;
|
|
1072
1072
|
continue;
|
|
1073
1073
|
}
|
|
1074
|
-
} else a.charAt(d) === t.charAt(
|
|
1074
|
+
} else a.charAt(d) === t.charAt(m) && (m += l);
|
|
1075
1075
|
d += l;
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
@@ -1079,7 +1079,7 @@ class $e {
|
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
1081
|
const ae = (A) => JSON.parse(A.replaceAll("'", '"')), An = (A, t = {}) => {
|
|
1082
|
-
const e =
|
|
1082
|
+
const e = D({}, t);
|
|
1083
1083
|
A.dataset.maska != null && A.dataset.maska !== "" && (e.mask = tn(A.dataset.maska)), A.dataset.maskaEager != null && (e.eager = kA(A.dataset.maskaEager)), A.dataset.maskaReversed != null && (e.reversed = kA(A.dataset.maskaReversed)), A.dataset.maskaTokensReplace != null && (e.tokensReplace = kA(A.dataset.maskaTokensReplace)), A.dataset.maskaTokens != null && (e.tokens = en(A.dataset.maskaTokens));
|
|
1084
1084
|
const n = {};
|
|
1085
1085
|
return A.dataset.maskaNumberLocale != null && (n.locale = A.dataset.maskaNumberLocale), A.dataset.maskaNumberFraction != null && (n.fraction = parseInt(A.dataset.maskaNumberFraction)), A.dataset.maskaNumberUnsigned != null && (n.unsigned = kA(A.dataset.maskaNumberUnsigned)), (A.dataset.maskaNumber != null || Object.values(n).length > 0) && (e.number = n), e;
|
|
@@ -1107,7 +1107,7 @@ class zA {
|
|
|
1107
1107
|
}), this.options = e, this.init(this.getInputs(t));
|
|
1108
1108
|
}
|
|
1109
1109
|
update(t = {}) {
|
|
1110
|
-
this.options =
|
|
1110
|
+
this.options = D({}, t), this.init(Array.from(this.items.keys()));
|
|
1111
1111
|
}
|
|
1112
1112
|
updateValue(t) {
|
|
1113
1113
|
t.value !== "" && t.value !== this.processInput(t).masked && this.setValue(t, t.value);
|
|
@@ -1156,7 +1156,7 @@ class zA {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
const nn = ({ showOtp: A, value: t, setValue: e }) => {
|
|
1159
|
-
const { t: n } = x(), { handleBlur: r, err: a } =
|
|
1159
|
+
const { t: n } = x(), { handleBlur: r, err: a } = U(ot), s = "### ### ####", o = (l) => {
|
|
1160
1160
|
const u = l.target, { value: i } = u;
|
|
1161
1161
|
e(i);
|
|
1162
1162
|
}, c = cA(r, 1e3);
|
|
@@ -1187,7 +1187,7 @@ const nn = ({ showOtp: A, value: t, setValue: e }) => {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
);
|
|
1189
1189
|
}, rn = ({ showPhone: A, value: t, setValue: e }) => {
|
|
1190
|
-
const { t: n } = x(), { handleBlur: r, err: a } =
|
|
1190
|
+
const { t: n } = x(), { handleBlur: r, err: a } = U(ot), s = (c) => {
|
|
1191
1191
|
const l = c.target, { value: u } = l;
|
|
1192
1192
|
e(u);
|
|
1193
1193
|
}, o = cA(r, 1e3);
|
|
@@ -1216,14 +1216,14 @@ const nn = ({ showOtp: A, value: t, setValue: e }) => {
|
|
|
1216
1216
|
"data-maska-eager": !0
|
|
1217
1217
|
}
|
|
1218
1218
|
);
|
|
1219
|
-
},
|
|
1219
|
+
}, W = (A) => A.split(" ").join(""), an = ({
|
|
1220
1220
|
countTo: A,
|
|
1221
1221
|
callback: t
|
|
1222
1222
|
}) => {
|
|
1223
1223
|
const e = Z(null), n = jt(() => {
|
|
1224
1224
|
const o = A ? new Date(A).getTime() - (/* @__PURE__ */ new Date()).getTime() : 0;
|
|
1225
1225
|
return o < 0 ? 0 : o;
|
|
1226
|
-
}, [A]), [r, a] =
|
|
1226
|
+
}, [A]), [r, a] = L(n());
|
|
1227
1227
|
q(() => (e.current = setInterval(() => {
|
|
1228
1228
|
a(n());
|
|
1229
1229
|
}, 500), () => {
|
|
@@ -1245,7 +1245,7 @@ function oe(A) {
|
|
|
1245
1245
|
return A.errors !== void 0;
|
|
1246
1246
|
}
|
|
1247
1247
|
const sn = () => {
|
|
1248
|
-
const { t: A } = x(), [t, e] =
|
|
1248
|
+
const { t: A } = x(), [t, e] = L(!1), {
|
|
1249
1249
|
amount: n,
|
|
1250
1250
|
currency: r,
|
|
1251
1251
|
description: a,
|
|
@@ -1255,24 +1255,24 @@ const sn = () => {
|
|
|
1255
1255
|
version: l,
|
|
1256
1256
|
base_url: u,
|
|
1257
1257
|
on_failure: i,
|
|
1258
|
-
setFormSettings:
|
|
1259
|
-
} =
|
|
1260
|
-
|
|
1258
|
+
setFormSettings: g
|
|
1259
|
+
} = U(E), p = (v) => {
|
|
1260
|
+
g && (e(v), g((h) => Q(D({}, h), {
|
|
1261
1261
|
isProcessing: v
|
|
1262
1262
|
})));
|
|
1263
|
-
},
|
|
1263
|
+
}, y = {
|
|
1264
1264
|
amount: n,
|
|
1265
1265
|
currency: r,
|
|
1266
1266
|
description: a,
|
|
1267
1267
|
publishable_api_key: s
|
|
1268
1268
|
};
|
|
1269
|
-
o && Object.keys(o).length > 0 && (
|
|
1269
|
+
o && Object.keys(o).length > 0 && (y.metadata = o), c && (y.invoice_id = c.toLowerCase());
|
|
1270
1270
|
const w = (v) => {
|
|
1271
|
-
|
|
1271
|
+
g && g((h) => Q(D({}, h), {
|
|
1272
1272
|
apiError: `${A("error." + v.type)}, ${v.message}`
|
|
1273
1273
|
}));
|
|
1274
1274
|
}, d = () => {
|
|
1275
|
-
|
|
1275
|
+
g && g((v) => Q(D({}, v), { apiError: "" }));
|
|
1276
1276
|
};
|
|
1277
1277
|
return {
|
|
1278
1278
|
processing: t,
|
|
@@ -1281,47 +1281,47 @@ const sn = () => {
|
|
|
1281
1281
|
path: h
|
|
1282
1282
|
}) {
|
|
1283
1283
|
p(!0), d();
|
|
1284
|
-
const
|
|
1284
|
+
const M = h || `${u}/v1/payments`;
|
|
1285
1285
|
try {
|
|
1286
|
-
const
|
|
1286
|
+
const C = yield fetch(M, {
|
|
1287
1287
|
method: "POST",
|
|
1288
1288
|
headers: {
|
|
1289
1289
|
"Content-Type": "application/json",
|
|
1290
1290
|
"X-Moyasar-Form-Version": l
|
|
1291
1291
|
},
|
|
1292
|
-
body: JSON.stringify(
|
|
1292
|
+
body: JSON.stringify(D(D({}, y), v))
|
|
1293
1293
|
});
|
|
1294
|
-
if (!
|
|
1295
|
-
if (typeof
|
|
1296
|
-
const X = yield
|
|
1294
|
+
if (!C.ok) {
|
|
1295
|
+
if (typeof C == "object") {
|
|
1296
|
+
const X = yield C.json();
|
|
1297
1297
|
if (console.log("fetch error:", X), !oe(X)) {
|
|
1298
1298
|
w({
|
|
1299
1299
|
type: "api_error",
|
|
1300
|
-
message: `Error code: ${
|
|
1300
|
+
message: `Error code: ${C.status}`,
|
|
1301
1301
|
errors: null
|
|
1302
1302
|
});
|
|
1303
1303
|
return;
|
|
1304
1304
|
}
|
|
1305
1305
|
return w(X), X;
|
|
1306
1306
|
}
|
|
1307
|
-
return yield Promise.reject(
|
|
1307
|
+
return yield Promise.reject(C);
|
|
1308
1308
|
}
|
|
1309
|
-
return
|
|
1310
|
-
} catch (
|
|
1309
|
+
return C.json();
|
|
1310
|
+
} catch (C) {
|
|
1311
1311
|
if (i)
|
|
1312
1312
|
try {
|
|
1313
|
-
yield i(
|
|
1313
|
+
yield i(C);
|
|
1314
1314
|
} catch (X) {
|
|
1315
1315
|
console.error("An error happened when firing failure callback"), console.error(X);
|
|
1316
1316
|
}
|
|
1317
|
-
console.error(
|
|
1317
|
+
console.error(C);
|
|
1318
1318
|
} finally {
|
|
1319
1319
|
p(!1);
|
|
1320
1320
|
}
|
|
1321
1321
|
})
|
|
1322
1322
|
};
|
|
1323
1323
|
}, ln = () => {
|
|
1324
|
-
const { apiError: A } =
|
|
1324
|
+
const { apiError: A } = U(E), [t, e] = L(!1);
|
|
1325
1325
|
return q(() => {
|
|
1326
1326
|
e(!!A);
|
|
1327
1327
|
}, [A]), q(() => {
|
|
@@ -1345,7 +1345,7 @@ const sn = () => {
|
|
|
1345
1345
|
for (const o in a)
|
|
1346
1346
|
if (!s.includes(o))
|
|
1347
1347
|
throw new Error(`Changing ${o} is not allowed!`);
|
|
1348
|
-
t((o) =>
|
|
1348
|
+
t((o) => D(D({}, o), a));
|
|
1349
1349
|
};
|
|
1350
1350
|
if (!A)
|
|
1351
1351
|
return Promise.resolve();
|
|
@@ -1377,22 +1377,22 @@ const sn = () => {
|
|
|
1377
1377
|
}), mA = ({
|
|
1378
1378
|
defaultError: A
|
|
1379
1379
|
}) => {
|
|
1380
|
-
const { callback_url: t, on_initiating: e, on_redirect: n, on_completed: r, setFormSettings: a } =
|
|
1380
|
+
const { callback_url: t, on_initiating: e, on_redirect: n, on_completed: r, setFormSettings: a } = U(E), [s, o] = L(A), { processing: c, postData: l } = sn(), [u, i] = L(!1), [g, p] = L(!1), { fail: y } = ln();
|
|
1381
1381
|
function w(X) {
|
|
1382
|
-
return K(this, arguments, function* ({ data: v, path: h, onSuccess: b, onFailed:
|
|
1383
|
-
const
|
|
1382
|
+
return K(this, arguments, function* ({ data: v, path: h, onSuccess: b, onFailed: M, initPayment: C }) {
|
|
1383
|
+
const N = yield l({
|
|
1384
1384
|
data: v,
|
|
1385
1385
|
path: h
|
|
1386
1386
|
});
|
|
1387
|
-
oe(
|
|
1388
|
-
payment:
|
|
1387
|
+
oe(N) || (N && (b && b(N), r && !C && (yield pn({
|
|
1388
|
+
payment: N,
|
|
1389
1389
|
on_completed: r
|
|
1390
1390
|
}).catch((O) => {
|
|
1391
1391
|
console.error(O);
|
|
1392
|
-
})),
|
|
1393
|
-
un(t,
|
|
1392
|
+
})), N.status === "paid" && (p(!0), setTimeout(() => {
|
|
1393
|
+
un(t, N, n).catch(() => {
|
|
1394
1394
|
});
|
|
1395
|
-
}, 100)),
|
|
1395
|
+
}, 100)), N.status === "failed" && M && M(N)), i(!1));
|
|
1396
1396
|
});
|
|
1397
1397
|
}
|
|
1398
1398
|
function d(v) {
|
|
@@ -1416,40 +1416,40 @@ const sn = () => {
|
|
|
1416
1416
|
yield w(v);
|
|
1417
1417
|
});
|
|
1418
1418
|
}
|
|
1419
|
-
const
|
|
1419
|
+
const m = oA(() => c || u, [c, u]);
|
|
1420
1420
|
return {
|
|
1421
1421
|
makePayment: d,
|
|
1422
1422
|
busy: u,
|
|
1423
|
-
fail:
|
|
1424
|
-
success:
|
|
1423
|
+
fail: y,
|
|
1424
|
+
success: g,
|
|
1425
1425
|
processing: c,
|
|
1426
|
-
loading:
|
|
1426
|
+
loading: m,
|
|
1427
1427
|
error: s,
|
|
1428
1428
|
setError: o
|
|
1429
1429
|
};
|
|
1430
1430
|
}, se = ({ inForm: A = !1 }) => {
|
|
1431
|
-
const { apiError: t, showForm: e } =
|
|
1431
|
+
const { apiError: t, showForm: e } = U(E);
|
|
1432
1432
|
return e && !A ? null : /* @__PURE__ */ f("p", { class: "flex flex-col gap-2 rounded-md border border-error bg-red-100 px-4 py-2 text-xs font-medium text-error empty:hidden", children: t });
|
|
1433
1433
|
}, fn = () => {
|
|
1434
|
-
const { t: A } = x(), { formattedAmount: t, currency: e, isRtl: n, fixed_width: r, setFormSettings: a, showForm: s } =
|
|
1434
|
+
const { t: A } = x(), { formattedAmount: t, currency: e, isRtl: n, fixed_width: r, setFormSettings: a, showForm: s } = U(E), [o, c] = L(null), [l, u] = L(!1), i = {
|
|
1435
1435
|
phone: "",
|
|
1436
1436
|
otp: ""
|
|
1437
1437
|
}, {
|
|
1438
|
-
makePayment:
|
|
1438
|
+
makePayment: g,
|
|
1439
1439
|
busy: p,
|
|
1440
|
-
fail:
|
|
1440
|
+
fail: y,
|
|
1441
1441
|
success: w,
|
|
1442
1442
|
loading: d,
|
|
1443
|
-
error:
|
|
1443
|
+
error: m,
|
|
1444
1444
|
setError: v
|
|
1445
|
-
} = mA({ defaultError: i }), [h, b] =
|
|
1446
|
-
const T = /^05[503649187][0-9]{7}$/.test(
|
|
1447
|
-
return v((Y) =>
|
|
1445
|
+
} = mA({ defaultError: i }), [h, b] = L(""), [M, C] = L(""), [X, N] = L(""), O = (_) => {
|
|
1446
|
+
const T = /^05[503649187][0-9]{7}$/.test(W(_));
|
|
1447
|
+
return v((Y) => Q(D({}, Y), {
|
|
1448
1448
|
phone: T ? "" : "error.invalid_mobile"
|
|
1449
1449
|
})), T;
|
|
1450
1450
|
}, P = (_) => {
|
|
1451
|
-
const T = /^[0-9]{4,}$/.test(
|
|
1452
|
-
return v((Y) =>
|
|
1451
|
+
const T = /^[0-9]{4,}$/.test(W(_));
|
|
1452
|
+
return v((Y) => Q(D({}, Y), {
|
|
1453
1453
|
otp: T ? "" : "error.invalid_otp"
|
|
1454
1454
|
})), T;
|
|
1455
1455
|
}, S = (_) => {
|
|
@@ -1463,13 +1463,13 @@ const sn = () => {
|
|
|
1463
1463
|
if (!O(h)) return;
|
|
1464
1464
|
function _(T) {
|
|
1465
1465
|
const { transaction_url: Y } = T.source;
|
|
1466
|
-
|
|
1466
|
+
N(Y), c((/* @__PURE__ */ new Date()).getTime() + 5 * 60 * 1e3);
|
|
1467
1467
|
}
|
|
1468
|
-
|
|
1468
|
+
g({
|
|
1469
1469
|
data: {
|
|
1470
1470
|
source: {
|
|
1471
1471
|
type: "stcpay",
|
|
1472
|
-
mobile:
|
|
1472
|
+
mobile: W(h)
|
|
1473
1473
|
}
|
|
1474
1474
|
},
|
|
1475
1475
|
onSuccess: _,
|
|
@@ -1478,16 +1478,16 @@ const sn = () => {
|
|
|
1478
1478
|
console.error(T);
|
|
1479
1479
|
});
|
|
1480
1480
|
}, F = () => {
|
|
1481
|
-
if (!o || !P(
|
|
1481
|
+
if (!o || !P(M)) return;
|
|
1482
1482
|
function _(T) {
|
|
1483
1483
|
var Y;
|
|
1484
|
-
T.status === "failed" && ((Y = T.source) == null ? void 0 : Y.message) === "Invalid OTP" && (v(($) =>
|
|
1484
|
+
T.status === "failed" && ((Y = T.source) == null ? void 0 : Y.message) === "Invalid OTP" && (v(($) => Q(D({}, $), {
|
|
1485
1485
|
otp: "error.invalid_otp"
|
|
1486
|
-
})),
|
|
1486
|
+
})), C(""), c(null));
|
|
1487
1487
|
}
|
|
1488
|
-
|
|
1488
|
+
g({
|
|
1489
1489
|
data: {
|
|
1490
|
-
otp_value:
|
|
1490
|
+
otp_value: W(M)
|
|
1491
1491
|
},
|
|
1492
1492
|
path: X,
|
|
1493
1493
|
onFailed: _
|
|
@@ -1501,19 +1501,19 @@ const sn = () => {
|
|
|
1501
1501
|
}
|
|
1502
1502
|
F();
|
|
1503
1503
|
}, gA = (_) => {
|
|
1504
|
-
_ > 0 || (v((T) =>
|
|
1504
|
+
_ > 0 || (v((T) => Q(D({}, T), {
|
|
1505
1505
|
otp: "error.otp_time_out"
|
|
1506
|
-
})),
|
|
1507
|
-
}, yA = oA(() =>
|
|
1506
|
+
})), C(""), c(null));
|
|
1507
|
+
}, yA = oA(() => m.phone || o && m.otp && m.otp !== "error.otp_time_out" ? !0 : l || d, [m, l, d]), uA = (_) => a((T) => Q(D({}, T), { showForm: _ })), [sA, pA] = L(!1), wA = () => {
|
|
1508
1508
|
pA(!0);
|
|
1509
1509
|
}, EA = () => {
|
|
1510
|
-
sA && (b(""),
|
|
1510
|
+
sA && (b(""), C(""), v(i), uA(!1), pA(!1), u(!1));
|
|
1511
1511
|
};
|
|
1512
1512
|
return /* @__PURE__ */ f(
|
|
1513
1513
|
ot.Provider,
|
|
1514
1514
|
{
|
|
1515
1515
|
value: {
|
|
1516
|
-
err:
|
|
1516
|
+
err: m,
|
|
1517
1517
|
setErr: v,
|
|
1518
1518
|
handleBlur: S
|
|
1519
1519
|
},
|
|
@@ -1570,8 +1570,8 @@ const sn = () => {
|
|
|
1570
1570
|
/* @__PURE__ */ f(
|
|
1571
1571
|
rn,
|
|
1572
1572
|
{
|
|
1573
|
-
value:
|
|
1574
|
-
setValue:
|
|
1573
|
+
value: M,
|
|
1574
|
+
setValue: C,
|
|
1575
1575
|
showPhone: !o && typeof o != "number"
|
|
1576
1576
|
}
|
|
1577
1577
|
)
|
|
@@ -1580,7 +1580,7 @@ const sn = () => {
|
|
|
1580
1580
|
HA,
|
|
1581
1581
|
{
|
|
1582
1582
|
success: w,
|
|
1583
|
-
fail:
|
|
1583
|
+
fail: y,
|
|
1584
1584
|
busy: p,
|
|
1585
1585
|
variant: "stc",
|
|
1586
1586
|
class: "flex gap-1",
|
|
@@ -1594,7 +1594,7 @@ const sn = () => {
|
|
|
1594
1594
|
}
|
|
1595
1595
|
)
|
|
1596
1596
|
] }),
|
|
1597
|
-
/* @__PURE__ */ f("p", { class: "flex flex-col gap-2 text-xs font-medium text-error empty:hidden", children: Object.entries(
|
|
1597
|
+
/* @__PURE__ */ f("p", { class: "flex flex-col gap-2 text-xs font-medium text-error empty:hidden", children: Object.entries(m).map(([_, T]) => /* @__PURE__ */ f("span", { class: "empty:hidden", children: A(T) }, _)) })
|
|
1598
1598
|
]
|
|
1599
1599
|
}
|
|
1600
1600
|
) })
|
|
@@ -1605,96 +1605,84 @@ const sn = () => {
|
|
|
1605
1605
|
}, dn = () => {
|
|
1606
1606
|
const { t: A } = x(), {
|
|
1607
1607
|
base_url: t,
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
function m() {
|
|
1608
|
+
publishable_api_key: e,
|
|
1609
|
+
apple_pay: n,
|
|
1610
|
+
payment_options: r,
|
|
1611
|
+
currency: a,
|
|
1612
|
+
supported_networks: s,
|
|
1613
|
+
decimalAmount: o,
|
|
1614
|
+
statement_descriptor: c,
|
|
1615
|
+
setFormSettings: l
|
|
1616
|
+
} = U(E), { makePayment: u } = mA({ defaultError: {} });
|
|
1617
|
+
function i() {
|
|
1619
1618
|
if (!ApplePaySession)
|
|
1620
1619
|
return;
|
|
1621
|
-
const
|
|
1622
|
-
countryCode: (
|
|
1623
|
-
currencyCode:
|
|
1624
|
-
supportedNetworks:
|
|
1625
|
-
merchantCapabilities:
|
|
1620
|
+
const g = (n == null ? void 0 : n.label) || (r == null ? void 0 : r.label), y = {
|
|
1621
|
+
countryCode: (n == null ? void 0 : n.country) || (r == null ? void 0 : r.country),
|
|
1622
|
+
currencyCode: a,
|
|
1623
|
+
supportedNetworks: s,
|
|
1624
|
+
merchantCapabilities: n.merchant_capabilities,
|
|
1626
1625
|
total: {
|
|
1627
|
-
label:
|
|
1628
|
-
amount:
|
|
1626
|
+
label: g,
|
|
1627
|
+
amount: o
|
|
1629
1628
|
}
|
|
1630
|
-
},
|
|
1631
|
-
|
|
1632
|
-
const
|
|
1633
|
-
validation_url:
|
|
1634
|
-
display_name:
|
|
1629
|
+
}, w = new ApplePaySession(n.version, y);
|
|
1630
|
+
w.onvalidatemerchant = (d) => {
|
|
1631
|
+
const m = {
|
|
1632
|
+
validation_url: d.validationURL,
|
|
1633
|
+
display_name: g,
|
|
1635
1634
|
domain_name: window.location.hostname,
|
|
1636
|
-
publishable_api_key:
|
|
1637
|
-
},
|
|
1638
|
-
fetch(
|
|
1635
|
+
publishable_api_key: e
|
|
1636
|
+
}, v = n.validate_merchant_url || `${t}/v1/applepay/initiate`;
|
|
1637
|
+
fetch(v, {
|
|
1639
1638
|
method: "POST",
|
|
1640
1639
|
headers: {
|
|
1641
1640
|
"Content-Type": "application/json"
|
|
1642
1641
|
},
|
|
1643
|
-
body: JSON.stringify(
|
|
1644
|
-
}).then((
|
|
1645
|
-
|
|
1646
|
-
}).catch((
|
|
1647
|
-
console.error("Apple Pay error:",
|
|
1642
|
+
body: JSON.stringify(m)
|
|
1643
|
+
}).then((h) => h.ok ? h : Promise.reject(h)).then((h) => h.json()).then((h) => {
|
|
1644
|
+
w.completeMerchantValidation(h);
|
|
1645
|
+
}).catch((h) => {
|
|
1646
|
+
console.error("Apple Pay error:", h), l((b) => Q(D({}, b), {
|
|
1648
1647
|
apiError: A("error.applePay")
|
|
1649
|
-
})),
|
|
1648
|
+
})), w.abort();
|
|
1650
1649
|
});
|
|
1651
|
-
},
|
|
1652
|
-
const
|
|
1650
|
+
}, w.onpaymentauthorized = (d) => {
|
|
1651
|
+
const m = {
|
|
1653
1652
|
source: {
|
|
1654
1653
|
type: "applepay",
|
|
1655
|
-
token: JSON.stringify(
|
|
1654
|
+
token: JSON.stringify(d.payment.token)
|
|
1656
1655
|
}
|
|
1657
1656
|
};
|
|
1658
|
-
|
|
1659
|
-
function
|
|
1660
|
-
var
|
|
1661
|
-
|
|
1657
|
+
c && (m.statement_descriptor = c);
|
|
1658
|
+
function v(b) {
|
|
1659
|
+
var C;
|
|
1660
|
+
w.completePayment({
|
|
1662
1661
|
status: ApplePaySession.STATUS_FAILURE,
|
|
1663
1662
|
errors: []
|
|
1664
1663
|
});
|
|
1665
|
-
let
|
|
1666
|
-
|
|
1667
|
-
apiError:
|
|
1664
|
+
let M = "Payment failed.";
|
|
1665
|
+
b instanceof Response ? M += " Error: " + b.statusText : typeof b == "string" ? M += " Error: " + b : b.status === "failed" && (M += " Error: " + ((C = b.source) == null ? void 0 : C.message)), l((X) => Q(D({}, X), {
|
|
1666
|
+
apiError: M
|
|
1668
1667
|
}));
|
|
1669
1668
|
}
|
|
1670
|
-
function b
|
|
1671
|
-
console.error(
|
|
1669
|
+
function h(b) {
|
|
1670
|
+
console.error(b), w.completePayment({
|
|
1672
1671
|
status: ApplePaySession.STATUS_SUCCESS
|
|
1673
1672
|
});
|
|
1674
1673
|
}
|
|
1675
|
-
|
|
1676
|
-
data:
|
|
1677
|
-
onFailed:
|
|
1678
|
-
onSuccess:
|
|
1679
|
-
}).catch((
|
|
1680
|
-
console.error(
|
|
1674
|
+
u({
|
|
1675
|
+
data: m,
|
|
1676
|
+
onFailed: v,
|
|
1677
|
+
onSuccess: h
|
|
1678
|
+
}).catch((b) => {
|
|
1679
|
+
console.error(b);
|
|
1681
1680
|
});
|
|
1682
|
-
},
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
} catch (y) {
|
|
1686
|
-
console.error(y);
|
|
1687
|
-
}
|
|
1688
|
-
}, d.begin();
|
|
1681
|
+
}, w.oncancel = () => {
|
|
1682
|
+
console.log("Apple Pay payment cancelled by user");
|
|
1683
|
+
}, w.begin();
|
|
1689
1684
|
}
|
|
1690
|
-
return /* @__PURE__ */ f(
|
|
1691
|
-
"button",
|
|
1692
|
-
{
|
|
1693
|
-
class: "apple-pay-button",
|
|
1694
|
-
style: { "-apple-pay-button-type": e },
|
|
1695
|
-
onClick: m
|
|
1696
|
-
}
|
|
1697
|
-
);
|
|
1685
|
+
return /* @__PURE__ */ f("apple-pay-button", { buttonstyle: "black", type: "plain", onClick: i });
|
|
1698
1686
|
}, mn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeEAAABLCAMAAABwZM8AAAADAFBMVEUAAAD////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v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8+aM+vyi4fUmulbQu0jwJC6vFu8hWaI7AvAGfz6s/q+tco+WifD5hKZkLanPWo7uZ5bZNaUyQSQhow/7Uzvd//cXCNo6FfG8UoBGHf3hj1v5nLtR7Y1zaoLqRlQfMTsay9LrRRhwsGsUCwJqVViVO85pDOXlFai82v6VfSTFOhmCKmK01UJ0YWnlH1Zv+4/YuSQXnbpiZKPUKGW3gg9RDnjkEpppXiSv7fgGx7L+67vz/9CotKWr7y1xuZCsEFMMrzeSixvg0YVHxiUd3Mp3y8Y0NF+qP6PncqDxo+tn7WyuoQrEKzBKspWqqg0RLdf+bSlSnAlIqoz8mle1UhXICTG20D7q3VVP6sC4ZRKLKsu4QqEQN+j5qgUjK1uwxUIbe8G9mlzleBKhLBqcZ++XDXSFQiFSyiwl7VU/awKRHRNjkdLqku4AiEx6E0qhNqyjpHVbbgCodFoE8NPQKGKSoOA2kGncm+hnb5QZbgiUWNkZyOHVb2sKqr4QEIadOJl/R9/eIVAmWuIbgAAAABJRU5ErkJggg==", vn = () => {
|
|
1699
1687
|
const {
|
|
1700
1688
|
payment_button_type: A,
|
|
@@ -1704,7 +1692,7 @@ const sn = () => {
|
|
|
1704
1692
|
currency: r,
|
|
1705
1693
|
decimalAmount: a,
|
|
1706
1694
|
setFormSettings: s
|
|
1707
|
-
} =
|
|
1695
|
+
} = U(E), [o, c] = L(!1), [l, u] = L(!1), { makePayment: i } = mA({ defaultError: {} }), { t: g } = x(), p = Z(null);
|
|
1708
1696
|
q(() => {
|
|
1709
1697
|
let d = null;
|
|
1710
1698
|
return o || (d = setInterval(() => {
|
|
@@ -1713,24 +1701,24 @@ const sn = () => {
|
|
|
1713
1701
|
clearInterval(d);
|
|
1714
1702
|
};
|
|
1715
1703
|
}, [o]);
|
|
1716
|
-
const
|
|
1704
|
+
const y = oA(() => {
|
|
1717
1705
|
if (!(!o || !t))
|
|
1718
1706
|
return new SamsungPay.PaymentClient({ environment: t.environment });
|
|
1719
1707
|
}, [o]);
|
|
1720
1708
|
if (q(() => K(void 0, null, function* () {
|
|
1721
|
-
if (!
|
|
1709
|
+
if (!y || !t)
|
|
1722
1710
|
return;
|
|
1723
|
-
const d = n == null ? void 0 : n.map((v) => v.toLowerCase()),
|
|
1711
|
+
const d = n == null ? void 0 : n.map((v) => v.toLowerCase()), m = {
|
|
1724
1712
|
version: t.version.toString(),
|
|
1725
1713
|
serviceId: t.service_id,
|
|
1726
1714
|
protocol: "PROTOCOL_3DS",
|
|
1727
1715
|
allowedBrands: d
|
|
1728
1716
|
};
|
|
1729
1717
|
p.current = () => K(void 0, null, function* () {
|
|
1730
|
-
const { order_number: v, id: h, country: b, label:
|
|
1718
|
+
const { order_number: v, id: h, country: b, label: M } = t, C = M || (e == null ? void 0 : e.label), X = b || (e == null ? void 0 : e.country), N = {
|
|
1731
1719
|
orderNumber: v,
|
|
1732
1720
|
merchant: {
|
|
1733
|
-
name:
|
|
1721
|
+
name: C,
|
|
1734
1722
|
id: h,
|
|
1735
1723
|
countryCode: X,
|
|
1736
1724
|
url: window.location.hostname
|
|
@@ -1741,25 +1729,25 @@ const sn = () => {
|
|
|
1741
1729
|
total: a
|
|
1742
1730
|
}
|
|
1743
1731
|
}, O = () => {
|
|
1744
|
-
|
|
1732
|
+
y.notify({
|
|
1745
1733
|
status: "CHARGED",
|
|
1746
1734
|
provider: "Moyasar"
|
|
1747
1735
|
});
|
|
1748
1736
|
}, P = (S) => {
|
|
1749
1737
|
var F;
|
|
1750
|
-
|
|
1738
|
+
y.notify({
|
|
1751
1739
|
status: "REJECTED",
|
|
1752
1740
|
provider: "Moyasar"
|
|
1753
1741
|
});
|
|
1754
1742
|
let G = "Payment failed.";
|
|
1755
|
-
S instanceof Response ? G += " Error: " + S.statusText : typeof S == "string" ? G += " Error: " + S : S.status === "failed" && (G += " Error: " + ((F = S.source) == null ? void 0 : F.message)), console.log("Samsung Pay error: ", G), s((eA) =>
|
|
1743
|
+
S instanceof Response ? G += " Error: " + S.statusText : typeof S == "string" ? G += " Error: " + S : S.status === "failed" && (G += " Error: " + ((F = S.source) == null ? void 0 : F.message)), console.log("Samsung Pay error: ", G), s((eA) => Q(D({}, eA), {
|
|
1756
1744
|
apiError: G
|
|
1757
1745
|
}));
|
|
1758
1746
|
};
|
|
1759
1747
|
try {
|
|
1760
|
-
const S = yield
|
|
1761
|
-
|
|
1762
|
-
|
|
1748
|
+
const S = yield y.loadPaymentSheet(
|
|
1749
|
+
m,
|
|
1750
|
+
N
|
|
1763
1751
|
);
|
|
1764
1752
|
i({
|
|
1765
1753
|
initPayment: !0,
|
|
@@ -1774,7 +1762,7 @@ const sn = () => {
|
|
|
1774
1762
|
});
|
|
1775
1763
|
} catch (S) {
|
|
1776
1764
|
try {
|
|
1777
|
-
|
|
1765
|
+
y.notify({
|
|
1778
1766
|
status: "ERRED",
|
|
1779
1767
|
provider: "Moyasar"
|
|
1780
1768
|
});
|
|
@@ -1784,10 +1772,10 @@ const sn = () => {
|
|
|
1784
1772
|
}
|
|
1785
1773
|
});
|
|
1786
1774
|
try {
|
|
1787
|
-
(yield
|
|
1775
|
+
(yield y.isReadyToPay(m)).result ? u(!0) : console.error("Cannot initialize Samsung Pay");
|
|
1788
1776
|
} catch (v) {
|
|
1789
1777
|
try {
|
|
1790
|
-
|
|
1778
|
+
y.notify({
|
|
1791
1779
|
status: "ERRED",
|
|
1792
1780
|
provider: "Moyasar"
|
|
1793
1781
|
});
|
|
@@ -1795,7 +1783,7 @@ const sn = () => {
|
|
|
1795
1783
|
}
|
|
1796
1784
|
console.error("Samsung Pay Error: ", v);
|
|
1797
1785
|
}
|
|
1798
|
-
}), [
|
|
1786
|
+
}), [y, t]), !o || !l)
|
|
1799
1787
|
return null;
|
|
1800
1788
|
const w = A === "pay" ? "pay-with" : A;
|
|
1801
1789
|
return /* @__PURE__ */ f(
|
|
@@ -1804,7 +1792,7 @@ const sn = () => {
|
|
|
1804
1792
|
class: "flex h-11 w-full items-center justify-center gap-1 rounded-md bg-black text-white",
|
|
1805
1793
|
onClick: p.current,
|
|
1806
1794
|
children: [
|
|
1807
|
-
/* @__PURE__ */ f("span", { children:
|
|
1795
|
+
/* @__PURE__ */ f("span", { children: g(`button.${w}`) }),
|
|
1808
1796
|
/* @__PURE__ */ f("img", { src: mn, alt: "", class: "-mb-[3px] h-[22px]" }),
|
|
1809
1797
|
/* @__PURE__ */ f("div", { class: "mb-0.5 h-[9px] w-[9px] rotate-45 rounded-sm border-r-[3px] border-t-[3px] border-white" })
|
|
1810
1798
|
]
|
|
@@ -1820,14 +1808,14 @@ const sn = () => {
|
|
|
1820
1808
|
currency: a,
|
|
1821
1809
|
decimalAmount: s,
|
|
1822
1810
|
setFormSettings: o
|
|
1823
|
-
} =
|
|
1811
|
+
} = U(E), [c, l] = L(!1), { makePayment: u } = mA({ defaultError: {} });
|
|
1824
1812
|
q(() => {
|
|
1825
|
-
let
|
|
1826
|
-
return c || (
|
|
1827
|
-
var p,
|
|
1828
|
-
(
|
|
1813
|
+
let g = null;
|
|
1814
|
+
return c || (g = setInterval(() => {
|
|
1815
|
+
var p, y;
|
|
1816
|
+
(y = (p = window.google) == null ? void 0 : p.payments) != null && y.api && l(!0);
|
|
1829
1817
|
}, 100)), () => {
|
|
1830
|
-
clearInterval(
|
|
1818
|
+
clearInterval(g);
|
|
1831
1819
|
};
|
|
1832
1820
|
}, [c]);
|
|
1833
1821
|
const i = oA(() => {
|
|
@@ -1837,26 +1825,26 @@ const sn = () => {
|
|
|
1837
1825
|
});
|
|
1838
1826
|
}, [c]);
|
|
1839
1827
|
return q(() => K(void 0, null, function* () {
|
|
1840
|
-
const
|
|
1841
|
-
if (!i || !e || (
|
|
1828
|
+
const g = document.getElementById("googlePay-container");
|
|
1829
|
+
if (!i || !e || (g == null ? void 0 : g.children.length) >= 1)
|
|
1842
1830
|
return;
|
|
1843
1831
|
e.merchant_id;
|
|
1844
|
-
const p = r == null ? void 0 : r.filter((
|
|
1832
|
+
const p = r == null ? void 0 : r.filter((C) => C !== "mada").map((C) => C.toUpperCase()), y = e.auth_methods, w = {
|
|
1845
1833
|
apiVersion: 2,
|
|
1846
1834
|
apiVersionMinor: 0
|
|
1847
1835
|
}, d = {
|
|
1848
1836
|
type: "CARD",
|
|
1849
1837
|
parameters: {
|
|
1850
|
-
allowedAuthMethods:
|
|
1838
|
+
allowedAuthMethods: y,
|
|
1851
1839
|
allowedCardNetworks: p
|
|
1852
1840
|
}
|
|
1853
|
-
},
|
|
1854
|
-
|
|
1841
|
+
}, m = Object.assign({}, w);
|
|
1842
|
+
m.allowedPaymentMethods = [d];
|
|
1855
1843
|
const v = () => K(void 0, null, function* () {
|
|
1856
|
-
const { country:
|
|
1857
|
-
allowedPaymentMethods: [
|
|
1844
|
+
const { country: C, label: X, merchant_id: N } = e, O = X || (n == null ? void 0 : n.label), P = C || (n == null ? void 0 : n.country), S = Q(D({}, w), {
|
|
1845
|
+
allowedPaymentMethods: [M],
|
|
1858
1846
|
merchantInfo: {
|
|
1859
|
-
merchantId:
|
|
1847
|
+
merchantId: N,
|
|
1860
1848
|
merchantName: O
|
|
1861
1849
|
},
|
|
1862
1850
|
transactionInfo: {
|
|
@@ -1881,7 +1869,7 @@ const sn = () => {
|
|
|
1881
1869
|
console.error(G);
|
|
1882
1870
|
}
|
|
1883
1871
|
}), h = () => {
|
|
1884
|
-
const
|
|
1872
|
+
const C = i.createButton({
|
|
1885
1873
|
onClick: v,
|
|
1886
1874
|
buttonLocale: A,
|
|
1887
1875
|
buttonColor: "black",
|
|
@@ -1889,24 +1877,24 @@ const sn = () => {
|
|
|
1889
1877
|
buttonRadius: 6,
|
|
1890
1878
|
buttonSizeMode: "fill"
|
|
1891
1879
|
});
|
|
1892
|
-
|
|
1880
|
+
g.appendChild(C);
|
|
1893
1881
|
}, b = {
|
|
1894
1882
|
type: "PAYMENT_GATEWAY",
|
|
1895
1883
|
parameters: {
|
|
1896
1884
|
gateway: "moyasar",
|
|
1897
1885
|
gatewayMerchantId: e.gateway_merchant_id
|
|
1898
1886
|
}
|
|
1899
|
-
},
|
|
1887
|
+
}, M = Object.assign({}, d, {
|
|
1900
1888
|
tokenizationSpecification: b
|
|
1901
1889
|
});
|
|
1902
1890
|
try {
|
|
1903
|
-
(yield i.isReadyToPay(
|
|
1891
|
+
(yield i.isReadyToPay(m)).result ? h() : o((X) => Q(D({}, X), {
|
|
1904
1892
|
apiError: "Cannot initialize Google Pay"
|
|
1905
1893
|
}));
|
|
1906
|
-
} catch (
|
|
1907
|
-
o((X) =>
|
|
1894
|
+
} catch (C) {
|
|
1895
|
+
o((X) => Q(D({}, X), {
|
|
1908
1896
|
apiError: "Cannot initialize Google Pay"
|
|
1909
|
-
})), console.error("Google Pay Error: ",
|
|
1897
|
+
})), console.error("Google Pay Error: ", C);
|
|
1910
1898
|
}
|
|
1911
1899
|
}), [i, e]), c ? /* @__PURE__ */ f(
|
|
1912
1900
|
"div",
|
|
@@ -1916,7 +1904,7 @@ const sn = () => {
|
|
|
1916
1904
|
}
|
|
1917
1905
|
) : null;
|
|
1918
1906
|
}, yn = () => {
|
|
1919
|
-
const { t: A } = x(), { methods: t, apple_pay: e, samsung_pay: n, google_pay: r } =
|
|
1907
|
+
const { t: A } = x(), { methods: t, apple_pay: e, samsung_pay: n, google_pay: r } = U(E), a = t.includes("stcpay"), s = t.includes("creditcard"), o = location.protocol === "https:" && t.includes("applepay") && typeof window.ApplePaySession != "undefined" && ApplePaySession.canMakePayments() && (e == null ? void 0 : e.version) && ApplePaySession.supportsVersion(e == null ? void 0 : e.version), c = !!(n != null && n.service_id), l = !!(r != null && r.merchant_id);
|
|
1920
1908
|
return !o && !a && !c && !l ? null : /* @__PURE__ */ f("div", { class: "flex w-full flex-col gap-4", role: "main", children: [
|
|
1921
1909
|
a && /* @__PURE__ */ f(fn, {}),
|
|
1922
1910
|
o && /* @__PURE__ */ f(dn, {}),
|
|
@@ -1928,7 +1916,7 @@ const sn = () => {
|
|
|
1928
1916
|
/* @__PURE__ */ f("hr", { class: "grow bg-neutral-300" })
|
|
1929
1917
|
] })
|
|
1930
1918
|
] });
|
|
1931
|
-
}, jA = ["mada", "visa", "amex", "
|
|
1919
|
+
}, jA = ["mada", "visa", "amex", "mastercard"], wn = [
|
|
1932
1920
|
"creditcard",
|
|
1933
1921
|
"applepay",
|
|
1934
1922
|
"stcpay",
|
|
@@ -2145,24 +2133,24 @@ const sn = () => {
|
|
|
2145
2133
|
isValid: !t && e && n
|
|
2146
2134
|
};
|
|
2147
2135
|
}, Cn = ({ value: A, setValue: t, err: e, setErr: n }) => {
|
|
2148
|
-
const { t: r } = x(), [a, s] =
|
|
2149
|
-
const i = u.target.value.trim(), { isEmpty:
|
|
2150
|
-
if (
|
|
2136
|
+
const { t: r } = x(), [a, s] = L(!1), o = (u) => {
|
|
2137
|
+
const i = u.target.value.trim(), { isEmpty: g, isEnglishOnly: p, isValidFormat: y } = le(i);
|
|
2138
|
+
if (g) {
|
|
2151
2139
|
s(!i);
|
|
2152
2140
|
return;
|
|
2153
2141
|
}
|
|
2154
2142
|
if (!p) {
|
|
2155
|
-
n((w) =>
|
|
2143
|
+
n((w) => Q(D({}, w), { name: "validation.should_be_english_letters_only" }));
|
|
2156
2144
|
return;
|
|
2157
2145
|
}
|
|
2158
|
-
if (!
|
|
2159
|
-
n((w) =>
|
|
2146
|
+
if (!y) {
|
|
2147
|
+
n((w) => Q(D({}, w), { name: "validation.first_and_last_name_required" }));
|
|
2160
2148
|
return;
|
|
2161
2149
|
}
|
|
2162
|
-
s(!1), n((w) =>
|
|
2150
|
+
s(!1), n((w) => Q(D({}, w), { name: "" }));
|
|
2163
2151
|
}, c = (u) => {
|
|
2164
|
-
const i = u.target, { value:
|
|
2165
|
-
t(
|
|
2152
|
+
const i = u.target, { value: g } = i;
|
|
2153
|
+
t(g);
|
|
2166
2154
|
}, l = cA(o, 1e3);
|
|
2167
2155
|
return /* @__PURE__ */ f("div", { class: "space-y-2", role: "complementary", "aria-label": r("form.name_on_card"), children: [
|
|
2168
2156
|
/* @__PURE__ */ f("div", { class: "flex items-end justify-between text-xs font-medium", children: [
|
|
@@ -2194,7 +2182,7 @@ const sn = () => {
|
|
|
2194
2182
|
msg: e ? "" : "error.invalid_csc"
|
|
2195
2183
|
};
|
|
2196
2184
|
}, GA = at({}), Dn = ({ setValue: A }) => {
|
|
2197
|
-
const { t } = x(), { handleBlur: e, err: n } =
|
|
2185
|
+
const { t } = x(), { handleBlur: e, err: n } = U(GA), r = "** / **", a = (o) => {
|
|
2198
2186
|
const c = o.target, { value: l } = c;
|
|
2199
2187
|
A(l);
|
|
2200
2188
|
}, s = cA(e, 1e3);
|
|
@@ -2220,7 +2208,7 @@ const sn = () => {
|
|
|
2220
2208
|
}
|
|
2221
2209
|
);
|
|
2222
2210
|
}, kn = ({ value: A, setValue: t }) => {
|
|
2223
|
-
const { t: e } = x(), { handleBlur: n, err: r, config: a } =
|
|
2211
|
+
const { t: e } = x(), { handleBlur: n, err: r, config: a } = U(GA), s = (c) => {
|
|
2224
2212
|
const l = c.target, { value: u } = l;
|
|
2225
2213
|
t(u);
|
|
2226
2214
|
}, o = cA(n, 1e3);
|
|
@@ -2242,23 +2230,23 @@ const sn = () => {
|
|
|
2242
2230
|
error: r.csc
|
|
2243
2231
|
}
|
|
2244
2232
|
);
|
|
2245
|
-
}, Mn = (A) => /^4/.test(
|
|
2246
|
-
const t =
|
|
2233
|
+
}, Mn = (A) => /^4/.test(W(A)), Bn = (A) => /^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)/.test(W(A)), ce = (A) => /^3[47]/.test(W(A)), ue = (A) => {
|
|
2234
|
+
const t = W(A), e = t.slice(0, 6), n = t.slice(0, 8);
|
|
2247
2235
|
for (const r of bn)
|
|
2248
2236
|
if (r == e || r == n)
|
|
2249
2237
|
return !0;
|
|
2250
2238
|
return !1;
|
|
2251
2239
|
}, st = () => {
|
|
2252
|
-
const { supported_networks: A } =
|
|
2240
|
+
const { supported_networks: A } = U(E);
|
|
2253
2241
|
function t(e) {
|
|
2254
2242
|
let n = "";
|
|
2255
|
-
return Mn(e) && (n = "visa"), Bn(e) && (n = "
|
|
2243
|
+
return Mn(e) && (n = "visa"), Bn(e) && (n = "mastercard"), ce(e) && (n = "amex"), ue(e) && (n = "mada"), n === "" || !A.includes(n) ? "" : n;
|
|
2256
2244
|
}
|
|
2257
2245
|
return {
|
|
2258
2246
|
getCardSchema: t
|
|
2259
2247
|
};
|
|
2260
2248
|
}, Sn = ({ value: A, setValue: t }) => {
|
|
2261
|
-
const { t: e } = x(), { handleBlur: n, err: r, setType: a } =
|
|
2249
|
+
const { t: e } = x(), { handleBlur: n, err: r, setType: a } = U(GA), { getCardSchema: s } = st(), o = (l) => {
|
|
2262
2250
|
const u = l.target, { value: i } = u;
|
|
2263
2251
|
t(i), a(s(i));
|
|
2264
2252
|
}, c = cA(n, 1e3);
|
|
@@ -2285,50 +2273,53 @@ const sn = () => {
|
|
|
2285
2273
|
}
|
|
2286
2274
|
);
|
|
2287
2275
|
}, Pn = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cclipPath%20id='_clip1'%3e%3crect%20x='7.179'%20y='18.832'%20width='81.642'%20height='26.336'/%3e%3c/clipPath%3e%3cg%20clip-path='url(%23_clip1)'%3e%3cg%3e%3cpath%20d='M47.418,19.387l-5.431,25.384l-6.567,0l5.432,-25.384l6.566,0Zm27.627,16.39l3.457,-9.532l1.989,9.532l-5.446,0Zm7.326,8.994l6.074,0l-5.3,-25.384l-5.607,0c-1.259,0%20-2.323,0.733%20-2.795,1.863l-9.852,23.521l6.895,0l1.37,-3.79l8.424,-0l0.791,3.79Zm-17.137,-8.287c0.028,-6.701%20-9.267,-7.069%20-9.201,-10.062c0.019,-0.912%200.887,-1.879%202.784,-2.127c0.943,-0.123%203.534,-0.218%206.476,1.136l1.152,-5.383c-1.58,-0.574%20-3.614,-1.125%20-6.143,-1.125c-6.49,-0%20-11.059,3.451%20-11.097,8.391c-0.041,3.655%203.261,5.693%205.75,6.908c2.557,1.245%203.417,2.041%203.406,3.154c-0.017,1.704%20-2.041,2.455%20-3.929,2.485c-3.302,0.052%20-5.218,-0.892%20-6.745,-1.603l-1.19,5.562c1.534,0.705%204.365,1.317%207.303,1.348c6.898,0%2011.411,-3.408%2011.434,-8.684Zm-27.2,-17.097l-10.639,25.384l-6.942,0l-5.235,-20.258c-0.318,-1.248%20-0.595,-1.705%20-1.562,-2.23c-1.576,-0.857%20-4.183,-1.66%20-6.477,-2.158l0.157,-0.738l11.173,0c1.423,0%202.705,0.948%203.028,2.588l2.765,14.69l6.833,-17.278l6.899,0Z'%20style='fill:%230d357f;fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e", Xn = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,7.094c0,-3.363%20-2.731,-6.094%20-6.094,-6.094l-81.812,0c-3.363,0%20-6.094,2.731%20-6.094,6.094l-0,49.812c-0,3.363%202.731,6.094%206.094,6.094l81.812,0c3.363,0%206.094,-2.731%206.094,-6.094l0,-49.812Z'%20style='fill:%23fff;stroke:%23b1b1b1;stroke-width:0.5px;'/%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%20opacity='0'%3e%3crect%20x='14.04'%20y='9.539'%20width='67.919'%20height='44.921'%20style='fill:%23fff;'/%3e%3c/g%3e%3crect%20x='39.044'%20y='17.366'%20width='17.917'%20height='29.263'%20style='fill:%23ff5f00;'/%3e%3cpath%20d='M40.89,32c-0.005,-5.706%202.619,-11.106%207.107,-14.629c-3.278,-2.576%20-7.329,-3.978%20-11.498,-3.978c-10.209,0%20-18.61,8.401%20-18.61,18.61c0,10.208%208.401,18.609%2018.61,18.609c4.169,-0%208.22,-1.401%2011.498,-3.978c-4.489,-3.524%20-7.113,-8.927%20-7.107,-14.634Z'%20style='fill:%23eb001b;fill-rule:nonzero;'/%3e%3cpath%20d='M76.33,43.533l0,-0.6l0.259,0l-0,-0.124l-0.615,-0l-0,0.124l0.242,0l0,0.6l0.114,-0Zm1.194,-0l0,-0.724l-0.186,-0l-0.217,0.517l-0.217,-0.517l-0.186,-0l-0,0.724l0.134,-0l0,-0.548l0.202,0.47l0.139,0l0.202,-0.47l0,0.548l0.129,-0Z'%20style='fill:%23f79e1b;fill-rule:nonzero;'/%3e%3cpath%20d='M78.108,32c0,10.209%20-8.4,18.609%20-18.609,18.609c-4.171,-0%20-8.223,-1.402%20-11.502,-3.98c4.487,-3.526%207.111,-8.926%207.111,-14.632c-0,-5.705%20-2.624,-11.106%20-7.111,-14.631c3.279,-2.578%207.331,-3.98%2011.502,-3.98c10.209,-0%2018.609,8.4%2018.609,18.609l0,0.005Z'%20style='fill:%23f79e1b;fill-rule:nonzero;'/%3e%3c/svg%3e", Qn = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,7.053c0,-3.341%20-2.712,-6.053%20-6.053,-6.053l-81.894,-0c-3.341,-0%20-6.053,2.712%20-6.053,6.053l0,49.894c0,3.341%202.712,6.053%206.053,6.053l81.894,0c3.341,0%206.053,-2.712%206.053,-6.053l0,-49.894Z'%20style='fill:%23006fcf;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%3e%3cpath%20d='M54.459,9.71l-10.404,23.609l8.342,0l0,21.172l26.31,0l4.061,-4.51l4.063,4.534l7.933,0l0,-2.672l-6.538,0l-5.395,-5.867l-5.44,5.88l-22.088,0l0,-18.444l22.202,0l5.408,5.938l5.476,-5.963l6.352,-0l0,-2.626l-4.935,-0l-0,-12.769l-4.686,12.699l-4.45,0l-4.823,-12.608l0,12.647l-10.546,0l-1.49,-3.637l-8.559,0l-1.457,3.589l-5.544,0l8.116,-18.39l6.498,-0l8.058,18.438l-0,-18.443l7.875,-0l4.161,11.351l4.127,-11.364l7.714,0.003l0,-2.656l-9.767,-0l-2.048,5.839l-2.2,-5.8l-12.552,-0l-0.077,7.83l-3.474,-7.76l-10.223,-0.02Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M59.526,16.941l-2.53,5.961l5.011,0l-2.481,-5.961Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M60.312,37.605l10.641,-0l0,-4.147l8.738,9.184l-8.621,9.204l-0.101,0l0,-4.221l-10.669,-0l-0,-2.905l10.397,0l-0,-4.077l-10.397,0l0.012,-3.038Z'%20style='fill:%23fff;'/%3e%3cpath%20d='M94.723,47.865l0,3.969l-8.581,-9.23l8.59,-9.225l-0,3.95l-4.946,5.265l4.937,5.271Z'%20style='fill:%23fff;'/%3e%3c/g%3e%3c/svg%3e", Tn = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2064'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;'%3e%3cpath%20d='M95,6.894c0,-3.253%20-2.641,-5.894%20-5.894,-5.894l-82.212,0c-3.253,0%20-5.894,2.641%20-5.894,5.894l0,50.212c0,3.253%202.641,5.894%205.894,5.894l82.212,0c3.253,0%205.894,-2.641%205.894,-5.894l0,-50.212Z'%20style='fill:%23fff;stroke:%237e7e7e;stroke-width:0.5px;'/%3e%3cg%3e%3crect%20x='5.311'%20y='34.182'%20width='36.116'%20height='12.031'%20style='fill:%2384b740;'/%3e%3crect%20x='5.311'%20y='17.765'%20width='36.116'%20height='12.042'%20style='fill:%23259bd6;'/%3e%3cpath%20d='M77.542,43.769l-0.161,0.032c-0.557,0.107%20-0.761,0.15%20-1.168,0.15c-0.944,-0%20-2.059,-0.483%20-2.059,-2.756c-0,-1.169%200.193,-2.724%201.951,-2.724l0.011,0c0.3,0.022%200.644,0.054%201.287,0.247l0.139,0.043l0,5.008Zm0.29,-11.335l-0.29,0.054l0,4.203l-0.257,-0.075l-0.075,-0.021c-0.29,-0.086%20-0.954,-0.279%20-1.598,-0.279c-3.517,0%20-4.257,2.659%20-4.257,4.89c0,3.056%201.716,4.815%204.708,4.815c1.265,-0%202.198,-0.129%203.141,-0.44c0.869,-0.279%201.18,-0.676%201.18,-1.523l-0,-12.063c-0.836,0.15%20-1.705,0.3%20-2.552,0.439'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M87.997,43.844l-0.15,0.043l-0.536,0.139c-0.504,0.129%20-0.954,0.204%20-1.297,0.204c-0.826,-0%20-1.319,-0.408%20-1.319,-1.105c-0,-0.45%200.203,-1.211%201.555,-1.211l1.747,-0l0,1.93Zm-1.233,-7.582c-1.083,0%20-2.198,0.193%20-3.581,0.622l-0.901,0.268l0.3,2.038l0.88,-0.29c0.922,-0.3%202.069,-0.493%202.927,-0.493c0.386,0%201.566,0%201.566,1.276l-0,0.558l-1.641,-0c-2.992,-0%20-4.375,0.954%20-4.375,3.002c-0,1.748%201.276,2.799%203.421,2.799c0.664,-0%201.587,-0.129%202.38,-0.322l0.043,-0.01l0.043,0.01l0.268,0.043c0.836,0.15%201.705,0.3%202.552,0.461l0,-6.691c0,-2.166%20-1.308,-3.271%20-3.882,-3.271'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M67.162,43.844l-0.15,0.043l-0.536,0.139c-0.504,0.129%20-0.944,0.204%20-1.297,0.204c-0.826,-0%20-1.319,-0.408%20-1.319,-1.105c-0,-0.45%200.203,-1.211%201.544,-1.211l1.748,-0l0.01,1.93Zm-1.222,-7.582c-1.094,0%20-2.198,0.193%20-3.582,0.622l-0.9,0.268l0.3,2.038l0.879,-0.29c0.922,-0.3%202.07,-0.493%202.928,-0.493c0.386,0%201.565,0%201.565,1.276l0,0.558l-1.641,-0c-2.991,-0%20-4.385,0.954%20-4.385,3.002c-0,1.748%201.276,2.799%203.431,2.799c0.665,-0%201.587,-0.129%202.381,-0.322l0.043,-0.01l0.042,0.01l0.258,0.043c0.847,0.15%201.705,0.3%202.552,0.472l-0,-6.691c0.011,-2.188%20-1.298,-3.282%20-3.871,-3.282'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M55.871,36.284c-1.362,-0%20-2.488,0.45%20-2.906,0.643l-0.107,0.054l-0.097,-0.075c-0.579,-0.418%20-1.426,-0.633%20-2.606,-0.633c-1.04,0%20-2.016,0.15%20-3.077,0.461c-0.912,0.279%20-1.266,0.719%20-1.266,1.544l0,7.646l2.853,0l-0,-7.067l0.139,-0.042c0.579,-0.193%200.922,-0.226%201.255,-0.226c0.826,0%201.244,0.44%201.244,1.298l-0,6.048l2.809,-0l0,-6.166c0,-0.365%20-0.075,-0.579%20-0.086,-0.622l-0.096,-0.182l0.193,-0.086c0.429,-0.193%200.901,-0.29%201.394,-0.29c0.568,0%201.244,0.226%201.244,1.298l-0,6.048l2.799,-0l-0,-6.327c-0,-2.241%20-1.201,-3.324%20-3.689,-3.324'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M85.896,25.614c-0.419,0%20-1.116,-0.043%20-1.662,-0.15l-0.161,-0.032l-0,-4.128c-0,-0.344%20-0.065,-0.558%20-0.075,-0.59l-0.086,-0.172l0.182,-0.075c0.043,-0.021%200.086,-0.032%200.14,-0.053l0.032,-0.022c0.064,-0.021%200.128,-0.043%200.193,-0.064c0.032,-0.011%200.053,-0.022%200.075,-0.022c0.633,-0.171%201.212,-0.15%201.469,-0.171l0.011,-0c1.748,-0%201.951,1.555%201.951,2.723c-0.01,2.274%20-1.136,2.756%20-2.069,2.756m-0.011,-7.849l-0.075,-0c-1.641,-0%20-3.324,0.45%20-3.925,1.33c-0.321,0.429%20-0.504,0.965%20-0.514,1.597l-0,4.258c-0,0.364%20-0.076,0.504%20-0.086,0.536l-0.097,0.182l-5.179,-0l-0,-2.96l-0.011,0c-0.064,-3.12%20-1.909,-4.836%20-4.579,-4.836l-2.605,0c-0.108,0.762%20-0.193,1.298%20-0.301,2.059l2.595,0c1.362,0%202.081,1.158%202.081,2.938l-0,2.981l-0.183,-0.096c-0.032,-0.011%20-0.257,-0.086%20-0.611,-0.086l-4.482,-0c-0.086,0.568%20-0.193,1.308%20-0.311,2.048l13.779,0c0.472,-0.096%201.019,-0.182%201.491,-0.257c0.697,0.343%201.994,0.525%202.884,0.525c2.992,0%204.933,-2.005%204.933,-5.093c-0.011,-3.056%20-1.887,-5.062%20-4.804,-5.126'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3cpath%20d='M57.78,28.971l4.074,-0c2.992,-0%204.386,-0.987%204.386,-3.421c0,-1.748%20-1.276,-3.142%20-3.421,-3.142l-2.755,0c-0.826,0%20-1.319,-0.472%20-1.319,-1.265c-0,-0.536%200.203,-1.201%201.554,-1.201l6.027,-0c0.129,-0.783%200.193,-1.276%200.311,-2.059l-6.262,-0c-2.917,-0%20-4.386,1.222%20-4.386,3.26c-0,2.016%201.276,3.067%203.42,3.067l2.756,-0c0.826,-0%201.319,0.654%201.319,1.34c0,0.45%20-0.203,1.383%20-1.544,1.383l-0.461,0l-8.825,-0.021l-1.609,-0c-1.361,-0%20-2.316,-0.772%20-2.316,-2.563l0,-1.233c0,-1.866%200.74,-3.024%202.316,-3.024l2.617,-0c0.118,-0.794%200.193,-1.298%200.3,-2.048l-3.571,-0c-2.67,-0%20-4.514,1.791%20-4.579,4.911l0,1.394c0.065,3.12%201.909,4.611%204.579,4.611l2.606,-0l4.783,0.011Z'%20style='fill:%2327292d;fill-rule:nonzero;'/%3e%3c/g%3e%3c/svg%3e", Nn = ({ type: A }) => {
|
|
2288
|
-
const t = "h-4 sm:h-5 w-auto object-contain object-center";
|
|
2276
|
+
const { supported_networks: t } = U(E), e = "h-4 sm:h-5 w-auto object-contain object-center";
|
|
2289
2277
|
return /* @__PURE__ */ f("div", { class: "absolute right-2 top-1/4 z-[2] flex -translate-y-1/2 items-center gap-1", children: [
|
|
2290
2278
|
{
|
|
2291
2279
|
alt: "AMEX",
|
|
2292
|
-
src: Qn
|
|
2280
|
+
src: Qn,
|
|
2281
|
+
network: "amex"
|
|
2293
2282
|
},
|
|
2294
2283
|
{
|
|
2295
2284
|
alt: "MADA",
|
|
2296
|
-
src: Tn
|
|
2285
|
+
src: Tn,
|
|
2286
|
+
network: "mada"
|
|
2297
2287
|
},
|
|
2298
2288
|
{
|
|
2299
2289
|
alt: "Visa",
|
|
2300
|
-
src: Pn
|
|
2290
|
+
src: Pn,
|
|
2291
|
+
network: "visa"
|
|
2301
2292
|
},
|
|
2302
2293
|
{
|
|
2303
2294
|
alt: "MasterCard",
|
|
2304
|
-
src: Xn
|
|
2295
|
+
src: Xn,
|
|
2296
|
+
network: "mastercard"
|
|
2305
2297
|
}
|
|
2306
|
-
].filter((
|
|
2298
|
+
].filter((r) => A !== "" ? A.toLowerCase() === r.alt.toLowerCase() : t == null ? void 0 : t.includes(r.network)).map((r) => /* @__PURE__ */ f("img", { class: e, alt: r.alt, src: r.src, loading: "lazy" }, r.network)) });
|
|
2307
2299
|
}, pe = (A) => {
|
|
2308
|
-
const t = "#### #### #### ####",
|
|
2309
|
-
mask: t,
|
|
2310
|
-
validator: (r) => /^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/.test(
|
|
2311
|
-
J(r)
|
|
2312
|
-
),
|
|
2313
|
-
csc: 3
|
|
2314
|
-
}, n = {
|
|
2300
|
+
const t = "#### #### #### ####", n = {
|
|
2315
2301
|
amex: {
|
|
2316
2302
|
mask: "#### ###### #####",
|
|
2317
|
-
validator: (r) => /^3[47][0-9]{13}$/.test(
|
|
2303
|
+
validator: (r) => /^3[47][0-9]{13}$/.test(W(r)),
|
|
2318
2304
|
csc: 4
|
|
2319
2305
|
},
|
|
2320
2306
|
mada: {
|
|
2321
2307
|
mask: t,
|
|
2322
|
-
validator: (r) => ue(r) && /\d{16}/.test(
|
|
2308
|
+
validator: (r) => ue(r) && /\d{16}/.test(W(r)),
|
|
2323
2309
|
csc: 3
|
|
2324
2310
|
},
|
|
2325
2311
|
visa: {
|
|
2326
2312
|
mask: t,
|
|
2327
|
-
validator: (r) => /^4[0-9]{12}(?:[0-9]{3})?$/.test(
|
|
2313
|
+
validator: (r) => /^4[0-9]{12}(?:[0-9]{3})?$/.test(W(r)),
|
|
2328
2314
|
csc: 3
|
|
2329
2315
|
},
|
|
2330
|
-
mastercard:
|
|
2331
|
-
|
|
2316
|
+
mastercard: {
|
|
2317
|
+
mask: t,
|
|
2318
|
+
validator: (r) => /^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/.test(
|
|
2319
|
+
W(r)
|
|
2320
|
+
),
|
|
2321
|
+
csc: 3
|
|
2322
|
+
}
|
|
2332
2323
|
};
|
|
2333
2324
|
return A === "" ? n.visa : n[A];
|
|
2334
2325
|
}, fe = (A) => {
|
|
@@ -2363,27 +2354,27 @@ const sn = () => {
|
|
|
2363
2354
|
isValidCc: t
|
|
2364
2355
|
};
|
|
2365
2356
|
}, In = ({ cc: A, setCc: t, cvc: e, setCvc: n, exp: r, setExp: a, err: s, setErr: o }) => {
|
|
2366
|
-
const { t: c } = x(), [l, u] =
|
|
2367
|
-
const { value:
|
|
2357
|
+
const { t: c } = x(), [l, u] = L(!1), [i, g] = L(""), { isValidCc: p } = de(), y = jt(() => pe(i), [i]), w = (d) => {
|
|
2358
|
+
const { value: m, name: v } = d.target, h = W(m.trim());
|
|
2368
2359
|
if (!h) {
|
|
2369
2360
|
u(!h);
|
|
2370
2361
|
return;
|
|
2371
2362
|
}
|
|
2372
2363
|
if (v === "mysr-cc-csc") {
|
|
2373
2364
|
const { msg: b } = ie(h, i);
|
|
2374
|
-
o((
|
|
2365
|
+
o((M) => Q(D({}, M), {
|
|
2375
2366
|
csc: b
|
|
2376
2367
|
}));
|
|
2377
2368
|
}
|
|
2378
2369
|
if (v === "mysr-cc-exp") {
|
|
2379
|
-
const { isValidExpFormat: b, isValidYear:
|
|
2380
|
-
o((X) =>
|
|
2381
|
-
exp_month:
|
|
2382
|
-
exp_year:
|
|
2370
|
+
const { isValidExpFormat: b, isValidYear: M, inValidMonth: C } = fe(h);
|
|
2371
|
+
o((X) => Q(D({}, X), {
|
|
2372
|
+
exp_month: C ? "" : "error.invalid_month",
|
|
2373
|
+
exp_year: M ? "" : "error.invalid_year",
|
|
2383
2374
|
exp: b ? "" : "error.invalid_date"
|
|
2384
2375
|
}));
|
|
2385
2376
|
}
|
|
2386
|
-
v === "mysr-cc-number" && o((b) =>
|
|
2377
|
+
v === "mysr-cc-number" && o((b) => Q(D({}, b), {
|
|
2387
2378
|
cc: i === "" ? "error.unsupported_cc_type" : p(h) ? "" : "error.invalid_cc_number"
|
|
2388
2379
|
}));
|
|
2389
2380
|
};
|
|
@@ -2397,8 +2388,8 @@ const sn = () => {
|
|
|
2397
2388
|
setErr: o,
|
|
2398
2389
|
handleBlur: w,
|
|
2399
2390
|
type: i,
|
|
2400
|
-
setType:
|
|
2401
|
-
config:
|
|
2391
|
+
setType: g,
|
|
2392
|
+
config: y()
|
|
2402
2393
|
},
|
|
2403
2394
|
children: /* @__PURE__ */ f("div", { class: "space-y-2", role: "complementary", "aria-label": c("form.card_info"), children: [
|
|
2404
2395
|
/* @__PURE__ */ f("div", { class: "flex items-end justify-between text-xs font-medium", children: [
|
|
@@ -2411,7 +2402,7 @@ const sn = () => {
|
|
|
2411
2402
|
/* @__PURE__ */ f(Dn, { value: r, setValue: a }),
|
|
2412
2403
|
/* @__PURE__ */ f(kn, { value: e, setValue: n })
|
|
2413
2404
|
] }),
|
|
2414
|
-
/* @__PURE__ */ f("p", { class: "flex flex-col gap-2 text-xs font-medium text-error", children: Object.entries(s).filter(([d]) => d !== "name").map(([d,
|
|
2405
|
+
/* @__PURE__ */ f("p", { class: "flex flex-col gap-2 text-xs font-medium text-error", children: Object.entries(s).filter(([d]) => d !== "name").map(([d, m]) => /* @__PURE__ */ f("span", { class: "empty:hidden", children: c(m) }, d)) })
|
|
2415
2406
|
] })
|
|
2416
2407
|
}
|
|
2417
2408
|
);
|
|
@@ -2424,7 +2415,7 @@ const sn = () => {
|
|
|
2424
2415
|
callback_url: a,
|
|
2425
2416
|
payment_button_type: s,
|
|
2426
2417
|
currency: o
|
|
2427
|
-
} =
|
|
2418
|
+
} = U(E), [c, l] = L(""), [u, i] = L(""), [g, p] = L(""), [y, w] = L(""), { getCardSchema: d } = st(), { isValidCc: m } = de(), v = {
|
|
2428
2419
|
name: "",
|
|
2429
2420
|
csc: "",
|
|
2430
2421
|
cc: "",
|
|
@@ -2434,17 +2425,17 @@ const sn = () => {
|
|
|
2434
2425
|
}, {
|
|
2435
2426
|
makePayment: h,
|
|
2436
2427
|
busy: b,
|
|
2437
|
-
fail:
|
|
2438
|
-
success:
|
|
2428
|
+
fail: M,
|
|
2429
|
+
success: C,
|
|
2439
2430
|
loading: X,
|
|
2440
|
-
error:
|
|
2431
|
+
error: N,
|
|
2441
2432
|
setError: O
|
|
2442
2433
|
} = mA({ defaultError: v });
|
|
2443
2434
|
return /* @__PURE__ */ f("form", { class: "space-y-6", onSubmit: (G) => {
|
|
2444
2435
|
G.preventDefault();
|
|
2445
|
-
const { isValid: F } = le(c), eA =
|
|
2436
|
+
const { isValid: F } = le(c), eA = W(u), gA = W(y), yA = W(g), uA = d(eA), sA = m(eA, uA), { isValid: pA } = ie(yA, uA), { isValid: wA } = fe(gA);
|
|
2446
2437
|
if (!F || !sA || !pA || !wA) {
|
|
2447
|
-
const V =
|
|
2438
|
+
const V = D({}, v);
|
|
2448
2439
|
F || (V.name = A("error.invalid_name")), sA || (V.cc = A("error.invalid_cc_number")), pA || (V.csc = A("error.invalid_csc")), wA || (V.exp = A("error.invalid_date")), O(V);
|
|
2449
2440
|
return;
|
|
2450
2441
|
}
|
|
@@ -2476,21 +2467,21 @@ const sn = () => {
|
|
|
2476
2467
|
console.error(V);
|
|
2477
2468
|
});
|
|
2478
2469
|
}, children: [
|
|
2479
|
-
/* @__PURE__ */ f(Cn, { value: c, setValue: l, err:
|
|
2470
|
+
/* @__PURE__ */ f(Cn, { value: c, setValue: l, err: N, setErr: O }),
|
|
2480
2471
|
/* @__PURE__ */ f(
|
|
2481
2472
|
In,
|
|
2482
2473
|
{
|
|
2483
2474
|
cc: u,
|
|
2484
2475
|
setCc: i,
|
|
2485
|
-
cvc:
|
|
2476
|
+
cvc: g,
|
|
2486
2477
|
setCvc: p,
|
|
2487
|
-
exp:
|
|
2478
|
+
exp: y,
|
|
2488
2479
|
setExp: w,
|
|
2489
|
-
err:
|
|
2480
|
+
err: N,
|
|
2490
2481
|
setErr: O
|
|
2491
2482
|
}
|
|
2492
2483
|
),
|
|
2493
|
-
/* @__PURE__ */ f(HA, { type: "submit", disabled: X, success:
|
|
2484
|
+
/* @__PURE__ */ f(HA, { type: "submit", disabled: X, success: C, fail: M, busy: b, children: /* @__PURE__ */ f(j, { children: [
|
|
2494
2485
|
(s !== "plain" || !e) && A(`button.${s}`),
|
|
2495
2486
|
" ",
|
|
2496
2487
|
/* @__PURE__ */ f("span", { class: "currency-amount", children: /* @__PURE__ */ f(te, { currency: o, formattedAmount: t }) })
|
|
@@ -2929,7 +2920,7 @@ var Wn = function() {
|
|
|
2929
2920
|
t === void 0 && (t = this._duration);
|
|
2930
2921
|
var n = PA(), r = 1.3, a = function() {
|
|
2931
2922
|
return _A(e, void 0, void 0, function() {
|
|
2932
|
-
var s, o, c, l, u, i,
|
|
2923
|
+
var s, o, c, l, u, i, g;
|
|
2933
2924
|
return vA(this, function(p) {
|
|
2934
2925
|
switch (p.label) {
|
|
2935
2926
|
case 0:
|
|
@@ -2953,7 +2944,7 @@ var Wn = function() {
|
|
|
2953
2944
|
return u = p.sent(), i = { error: u }, [3, 9];
|
|
2954
2945
|
case 8:
|
|
2955
2946
|
try {
|
|
2956
|
-
o && !o.done && (
|
|
2947
|
+
o && !o.done && (g = s.return) && g.call(s);
|
|
2957
2948
|
} finally {
|
|
2958
2949
|
if (i) throw i.error;
|
|
2959
2950
|
}
|
|
@@ -3145,7 +3136,7 @@ function er({ config: A }) {
|
|
|
3145
3136
|
minimumFractionDigits: o
|
|
3146
3137
|
}).format(c);
|
|
3147
3138
|
e === "SAR" && (l = l.replace("SAR", "").trim());
|
|
3148
|
-
const [u, i] =
|
|
3139
|
+
const [u, i] = L(Q(D({
|
|
3149
3140
|
version: Rt,
|
|
3150
3141
|
base_url: void 0
|
|
3151
3142
|
}, A), {
|
|
@@ -3156,22 +3147,37 @@ function er({ config: A }) {
|
|
|
3156
3147
|
isRtl: s,
|
|
3157
3148
|
showForm: !1,
|
|
3158
3149
|
isTestMode: (a == null ? void 0 : a.startsWith("pk_test")) || location.protocol === "http:"
|
|
3159
|
-
}))
|
|
3150
|
+
})), [g, p] = L({
|
|
3151
|
+
samsung: !A.samsung_pay,
|
|
3152
|
+
google: !A.google_pay,
|
|
3153
|
+
apple: !A.apple_pay
|
|
3154
|
+
});
|
|
3160
3155
|
return q(() => {
|
|
3161
|
-
var
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
}
|
|
3156
|
+
var w, d;
|
|
3157
|
+
const y = (m, v) => {
|
|
3158
|
+
document.body.append(
|
|
3159
|
+
Object.assign(document.createElement("script"), {
|
|
3160
|
+
src: m,
|
|
3161
|
+
onload: v
|
|
3162
|
+
})
|
|
3163
|
+
);
|
|
3164
|
+
};
|
|
3165
|
+
!window.SamsungPay && A.samsung_pay && y(
|
|
3166
|
+
"https://img.mpay.samsung.com/gsmpi/sdk/samsungpay_web_sdk.js",
|
|
3167
|
+
() => p((m) => Q(D({}, m), { samsung: !0 }))
|
|
3168
|
+
), !((d = (w = window.google) == null ? void 0 : w.payments) != null && d.api) && A.google_pay && y(
|
|
3169
|
+
"https://pay.google.com/gp/p/js/pay.js",
|
|
3170
|
+
() => p((m) => Q(D({}, m), { google: !0 }))
|
|
3171
|
+
), A.apple_pay && y(
|
|
3172
|
+
"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",
|
|
3173
|
+
() => p((m) => Q(D({}, m), { apple: !0 }))
|
|
3174
|
+
);
|
|
3170
3175
|
}, []), /* @__PURE__ */ f(
|
|
3171
|
-
|
|
3176
|
+
E.Provider,
|
|
3172
3177
|
{
|
|
3173
|
-
value:
|
|
3174
|
-
setFormSettings: i
|
|
3178
|
+
value: Q(D({}, u), {
|
|
3179
|
+
setFormSettings: i,
|
|
3180
|
+
scriptsLoaded: g
|
|
3175
3181
|
}),
|
|
3176
3182
|
children: /* @__PURE__ */ f(
|
|
3177
3183
|
Ar,
|
|
@@ -3206,50 +3212,50 @@ const nr = (A) => {
|
|
|
3206
3212
|
const n = (e == null ? void 0 : e.constructor.prototype.constructor.name) === "AsyncFunction", r = e.toString().startsWith("async");
|
|
3207
3213
|
return n || r;
|
|
3208
3214
|
}
|
|
3209
|
-
return A.on_initiating && !t(A.on_initiating) &&
|
|
3215
|
+
return A.on_initiating && !t(A.on_initiating) && B(
|
|
3210
3216
|
"On initiating must be a promise based callback, check documentation for implementation details"
|
|
3211
|
-
), A.on_completed && !t(A.on_completed) &&
|
|
3217
|
+
), A.on_completed && !t(A.on_completed) && B(
|
|
3212
3218
|
"On completed must be a promise based callback, check documentation for implementation details"
|
|
3213
|
-
), A.on_failure && !t(A.on_failure) &&
|
|
3219
|
+
), A.on_failure && !t(A.on_failure) && B(
|
|
3214
3220
|
"On failure must be a promise based callback, check documentation for implementation details"
|
|
3215
|
-
), A.on_redirect && !t(A.on_redirect) &&
|
|
3221
|
+
), A.on_redirect && !t(A.on_redirect) && B(
|
|
3216
3222
|
"On redirect must be a promise based callback, check documentation for implementation details"
|
|
3217
3223
|
), !0;
|
|
3218
3224
|
}, rr = (A) => {
|
|
3219
3225
|
var t, e;
|
|
3220
|
-
return A.payment_button_type && typeof A.payment_button_type != "string" && rA("Payment button type"), A.payment_button_type && !hn.includes(A.payment_button_type) &&
|
|
3226
|
+
return A.payment_button_type && typeof A.payment_button_type != "string" && rA("Payment button type"), A.payment_button_type && !hn.includes(A.payment_button_type) && B("Unsupported button type, check documentation for list of supported types"), A.language && typeof A.language != "string" && rA("Language"), A.translations && typeof A.translations != "object" && rA("Translations"), A.metadata && typeof A.metadata != "object" && B("Metadata must be and object"), A.metadata && Object.entries(A.metadata).length > 50 && B("Only 50 Key/Value pairs are allowed in metadata"), A.invoice_id && typeof A.invoice_id != "string" && B("Invoice ID must be a string"), A.invoice_id && (/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/.test(
|
|
3221
3227
|
(t = A.invoice_id) != null ? t : ""
|
|
3222
|
-
) ||
|
|
3228
|
+
) || B("Invalid invoice ID format")), A.statement_descriptor && typeof A.statement_descriptor != "string" && B("Statement descriptor must be a string"), A.statement_descriptor && (/^[\w\s\d\-~]{1,64}$/.test((e = A.statement_descriptor) != null ? e : "") || B(
|
|
3223
3229
|
'Invalid format for the statement descriptor [length between 1 and 64 characters, allowed alphanumeric characters, white-spaces, "/", "-" and "~" symbols] '
|
|
3224
|
-
)), A.fixed_width && typeof A.fixed_width != "boolean" &&
|
|
3230
|
+
)), A.fixed_width && typeof A.fixed_width != "boolean" && B("Fixed width expects boolean value"), !0;
|
|
3225
3231
|
}, _t = (A, t) => A.every((e) => t.includes(e)), ar = (A) => {
|
|
3226
|
-
var t, e, n, r, a, s, o, c, l, u, i,
|
|
3227
|
-
if (A.methods && !Array.isArray(A.methods) &&
|
|
3228
|
-
const p = A.apple_pay.country || ((n = A.payment_options) == null ? void 0 : n.country),
|
|
3229
|
-
p ||
|
|
3232
|
+
var t, e, n, r, a, s, o, c, l, u, i, g;
|
|
3233
|
+
if (A.methods && !Array.isArray(A.methods) && B("Methods must be an array"), A.methods.includes("creditcard") && ((t = A.credit_card) != null && t.manual && typeof A.credit_card.manual != "boolean" && B("Credit Card manual option must be a boolean"), (e = A.credit_card) != null && e.save_card && typeof A.credit_card.save_card != "boolean" && B("Credit Card save card option must be a boolean")), A.methods.includes("applepay") && (A.apple_pay || J("Apple Pay configuration"), A.apple_pay)) {
|
|
3234
|
+
const p = A.apple_pay.country || ((n = A.payment_options) == null ? void 0 : n.country), y = A.apple_pay.label || ((r = A.payment_options) == null ? void 0 : r.label);
|
|
3235
|
+
p || J("Apple Pay country or Payment Options country"), (p == null ? void 0 : p.trim().length) !== 2 && B("Country must be two-letter ISO 3166 country code"), y || J("Apple Pay label or Payment Options label"), (y == null ? void 0 : y.trim().length) === 0 && B("Apple Pay label or Payment Options label can't be empty"), A.apple_pay.validate_merchant_url && !ve(A.apple_pay.validate_merchant_url) && rA("Apple Pay Validate Merchant URL"), (a = A.apple_pay) != null && a.merchant_capabilities && (_t(A.apple_pay.merchant_capabilities, FA) || B(`Apple Pay merchant capabilities supports only ${FA.join(", ")}`)), (s = A.apple_pay) != null && s.supported_countries && !Array.isArray(A.apple_pay.supported_countries) && B("Apple Pay Supported Countries must be an array of country codes");
|
|
3230
3236
|
}
|
|
3231
3237
|
if (A.samsung_pay) {
|
|
3232
|
-
const p = A.samsung_pay.country || ((o = A.payment_options) == null ? void 0 : o.country),
|
|
3238
|
+
const p = A.samsung_pay.country || ((o = A.payment_options) == null ? void 0 : o.country), y = A.samsung_pay.label || ((c = A.payment_options) == null ? void 0 : c.label), w = A.samsung_pay.order_number, d = A.publishable_api_key.startsWith("pk_test") || location.protocol === "http:";
|
|
3233
3239
|
!window.SamsungPay && d && console.warn(
|
|
3234
3240
|
"To speed up loading of Samsung Pay button you can include the Samsung Pay Web SDK JavaScript file in your website front-end directly. If there will be no Samsung Pay available on form initialization it will be loaded automatically"
|
|
3235
|
-
), A.samsung_pay.service_id ||
|
|
3241
|
+
), A.samsung_pay.service_id || J("Samsung Pay service_id"), A.samsung_pay.service_id.trim().length === 0 && B("Samsung Pay service_id can't be empty"), w || J("Samsung Pay order_number or Payment Options order_number"), (w == null ? void 0 : w.trim().length) === 0 && B("Order number can't be empty"), p || J("Samsung Pay country or Payment Options country"), (p == null ? void 0 : p.trim().length) !== 2 && B("Country must be two-letter ISO 3166 country code"), y || J("Samsung Pay label or Payment Options label"), (y == null ? void 0 : y.trim().length) === 0 && B("Samsung Pay label or Payment Options label can't be empty");
|
|
3236
3242
|
}
|
|
3237
3243
|
if (A.google_pay) {
|
|
3238
|
-
const p = A.google_pay.country || ((l = A.payment_options) == null ? void 0 : l.country),
|
|
3239
|
-
!((
|
|
3244
|
+
const p = A.google_pay.country || ((l = A.payment_options) == null ? void 0 : l.country), y = A.google_pay.label || ((u = A.payment_options) == null ? void 0 : u.label), w = A.publishable_api_key.startsWith("pk_test") || location.protocol === "http:", d = A.google_pay.environment;
|
|
3245
|
+
!((g = (i = window.google) == null ? void 0 : i.payments) != null && g.api) && w && console.warn(
|
|
3240
3246
|
"To speed up loading of Google Pay button you can include the Google Pay Web SDK JavaScript file in your website front-end directly. If there will be no Google Pay available on form initialization it will be loaded automatically"
|
|
3241
|
-
), A.google_pay.merchant_id ||
|
|
3242
|
-
const { auth_methods:
|
|
3243
|
-
|
|
3247
|
+
), A.google_pay.merchant_id || J("Google Pay service_id"), A.google_pay.merchant_id.trim().length === 0 && B("Google Pay service_id can't be empty"), p || J("Google Pay country or Payment Options country"), (p == null ? void 0 : p.trim().length) !== 2 && B("Country must be two-letter ISO 3166 country code"), y || J("Google Pay label or Payment Options label"), (y == null ? void 0 : y.trim().length) === 0 && B("Google Pay label or Payment Options label can't be empty"), d && !["PRODUCTION", "TEST"].includes(d) && B("Google Pay environment can be set to `TEST` or `PRODUCTION`");
|
|
3248
|
+
const { auth_methods: m } = A.google_pay;
|
|
3249
|
+
m && !Array.isArray(m) && B("Google Pay auth_methods must be an array"), m && !m.every((v) => v === "PAN_ONLY" || v === "CRYPTOGRAM_3DS") && B("Google Pay auth_methods must contain 'CRYPTOGRAM_3DS' and/or 'PAN_ONLY'");
|
|
3244
3250
|
}
|
|
3245
|
-
return A.supported_networks && (_t(A.supported_networks, jA) ||
|
|
3246
|
-
}, or = (A) => (A.element ||
|
|
3251
|
+
return A.supported_networks && (_t(A.supported_networks, jA) || B(`Moyasar form supports only ${jA.join(", ")} networks`)), !0;
|
|
3252
|
+
}, or = (A) => (A.element || J("element"), typeof A.element != "string" && !(A.element instanceof Element) && rA("Element"), typeof A.element == "string" && !document.querySelector(A.element) && B(`Selector ${A.element} does't exist id DOM`), A.publishable_api_key.trim() || J("publishable_api_key"), A.publishable_api_key && (/^pk_(test|live)_.{40}$/.test(A.publishable_api_key) || rA("Publishable API Key"), location.protocol.toLowerCase() === "http:" && A.publishable_api_key.startsWith("pk_live") && B(
|
|
3247
3253
|
"Production key (pk_live) require secure connection, for development use key starting with pk_test"
|
|
3248
|
-
)), A.amount ||
|
|
3254
|
+
)), A.amount || J("amount"), A.amount && ((typeof A.amount != "number" || A.amount < 100) && B("Amount must be a non-negative integer. Minimal supported value is 100."), Number.isInteger(A.amount) || B(
|
|
3249
3255
|
"Amount must be in minor unit of selected currency, e.g. for $19.99 set amount to 1999."
|
|
3250
|
-
)), A.currency ||
|
|
3256
|
+
)), A.currency || J("currency"), A.currency && A.currency.trim().length !== 3 && B("Currency must be in ISO 3166-1 alpha-3 country code format"), A.description || J("description"), A.description && A.description.trim().length === 0 && B("Description can't be empty"), A.callback_url || J("callback_url"), ve(A.callback_url) || rA("Callback URL"), !0), B = (A) => {
|
|
3251
3257
|
throw window.silentError && console.error(A), new Error(A);
|
|
3252
|
-
},
|
|
3258
|
+
}, J = (A) => B(`Missing entry: ${A} is required`), rA = (A) => B(`${A} is invalid`), ve = (A) => typeof A == "string" && /^https?:\/\/.+/.test(A), sr = (A, t = !1) => (t && (window.silentError = t), or(A), ar(A), rr(A), nr(A), !0), lr = (A) => {
|
|
3253
3259
|
const t = A.publishable_api_key.startsWith("pk_test") || location.protocol === "http:", e = A.element;
|
|
3254
3260
|
let n;
|
|
3255
3261
|
if (typeof e == "string" && (n = document.querySelector(e)), e instanceof Element && (n = e), !n) {
|
|
@@ -3277,10 +3283,8 @@ let cr = (A = 21) => {
|
|
|
3277
3283
|
return t;
|
|
3278
3284
|
};
|
|
3279
3285
|
const ur = (A) => {
|
|
3280
|
-
const t =
|
|
3281
|
-
return A.payment_button_type || (t.payment_button_type = "pay"), A.language || (t.language = document.documentElement.lang || "en"), A.methods || (t.methods = wn), A.supported_networks
|
|
3282
|
-
(e) => e === "mastercard" ? "masterCard" : e
|
|
3283
|
-
)), A.supported_networks || (t.supported_networks = jA.filter((e) => e !== "amex")), !A.fixed_width && A.fixed_width !== !1 && (t.fixed_width = !0), A.apple_pay && (A.apple_pay.version || (t.apple_pay.version = 6), A.apple_pay.merchant_capabilities || (t.apple_pay.merchant_capabilities = FA.filter(
|
|
3286
|
+
const t = D({}, A);
|
|
3287
|
+
return A.payment_button_type || (t.payment_button_type = "pay"), A.language || (t.language = document.documentElement.lang || "en"), A.methods || (t.methods = wn), A.supported_networks || (t.supported_networks = jA.filter((e) => e !== "amex")), !A.fixed_width && A.fixed_width !== !1 && (t.fixed_width = !0), A.apple_pay && (A.apple_pay.version || (t.apple_pay.version = 6), A.apple_pay.merchant_capabilities || (t.apple_pay.merchant_capabilities = FA.filter(
|
|
3284
3288
|
(e) => e !== "supportsEMV"
|
|
3285
3289
|
)), A.apple_pay.supported_countries || (t.apple_pay.supported_countries = ["SA"])), A.samsung_pay && (A.samsung_pay.version || (t.samsung_pay.version = 2), A.samsung_pay.environment || (t.samsung_pay.environment = "PRODUCTION")), A.google_pay && (A.google_pay.environment || (t.google_pay.environment = "PRODUCTION"), A.google_pay.auth_methods || (t.google_pay.auth_methods = ["PAN_ONLY", "CRYPTOGRAM_3DS"]), A.google_pay.gateway_merchant_id || (t.google_pay.gateway_merchant_id = cr(36))), t;
|
|
3286
3290
|
};
|