htech-pay 0.0.7-beta → 0.0.9-beta
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/htechPay.mjs +20 -20
- package/dist/htechPay.umd.js +1 -1
- package/package.json +1 -1
package/dist/htechPay.mjs
CHANGED
|
@@ -6,10 +6,10 @@ async function b(h, w = {}) {
|
|
|
6
6
|
onPaymentResult: p,
|
|
7
7
|
theme: P = "",
|
|
8
8
|
on3dsChallengeOpen: g,
|
|
9
|
-
onProcessPayment:
|
|
10
|
-
onNeedCvv:
|
|
9
|
+
onProcessPayment: f,
|
|
10
|
+
onNeedCvv: y
|
|
11
11
|
} = w;
|
|
12
|
-
let { type:
|
|
12
|
+
let { type: r } = w;
|
|
13
13
|
const s = {
|
|
14
14
|
//qa: "http://localhost:5173",
|
|
15
15
|
qa: "https://sp-checkout-qa.pagoshtechstage.com/index.html",
|
|
@@ -17,11 +17,11 @@ async function b(h, w = {}) {
|
|
|
17
17
|
prod: "https://sp-checkout.pagoshtech.com/index.html"
|
|
18
18
|
};
|
|
19
19
|
let a = null;
|
|
20
|
-
const
|
|
20
|
+
const m = {
|
|
21
21
|
defaultUrl: {
|
|
22
22
|
url: `${s[i]}?orderId=${h}&theme=${P}`,
|
|
23
23
|
height: "670",
|
|
24
|
-
style: "
|
|
24
|
+
style: ""
|
|
25
25
|
},
|
|
26
26
|
widget: {
|
|
27
27
|
url: `${s[i]}?orderId=${h}#/widget`,
|
|
@@ -31,15 +31,15 @@ async function b(h, w = {}) {
|
|
|
31
31
|
paymentToken: {
|
|
32
32
|
url: `${s[i]}?orderId=${h}&theme=${P}#/paymentToken`,
|
|
33
33
|
height: "520",
|
|
34
|
-
style: "
|
|
34
|
+
style: ""
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
let
|
|
37
|
+
m[r] || (r = "defaultUrl");
|
|
38
|
+
let l = null, d = null, u = null, v = !1;
|
|
39
39
|
const n = document.createElement("iframe");
|
|
40
|
-
n.id = "iframe_htechPay", n.src =
|
|
40
|
+
n.id = "iframe_htechPay", n.src = m[r].url, n.width = "100%", n.height = m[r].height, n.frameBorder = "0", n.allowFullscreen = !0, n.title = "Payment form", n.style = m[r].style;
|
|
41
41
|
const C = () => new Promise((e, t) => {
|
|
42
|
-
|
|
42
|
+
l = e, document.getElementById("iframe_htechPay").contentWindow.postMessage(
|
|
43
43
|
"htechPayment_onPayment",
|
|
44
44
|
new URL(s[i]).origin
|
|
45
45
|
), setTimeout(() => {
|
|
@@ -49,15 +49,15 @@ async function b(h, w = {}) {
|
|
|
49
49
|
});
|
|
50
50
|
}, 600);
|
|
51
51
|
}), $ = () => new Promise((e) => {
|
|
52
|
-
const t = (
|
|
53
|
-
|
|
52
|
+
const t = (o) => {
|
|
53
|
+
e({ needCvv: o });
|
|
54
54
|
};
|
|
55
55
|
if (a !== null) {
|
|
56
56
|
t(a);
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
u = (
|
|
60
|
-
t(
|
|
59
|
+
u = (o) => {
|
|
60
|
+
t(o.needCvv);
|
|
61
61
|
};
|
|
62
62
|
}), _ = () => new Promise((e, t) => {
|
|
63
63
|
d = e, document.getElementById("iframe_htechPay").contentWindow.postMessage(
|
|
@@ -73,10 +73,10 @@ async function b(h, w = {}) {
|
|
|
73
73
|
onViewForm: () => c == null ? void 0 : c(!0),
|
|
74
74
|
onPaymentResult: (e) => {
|
|
75
75
|
const t = e.data.payload || {};
|
|
76
|
-
return
|
|
76
|
+
return l && (l(t), l = null), p == null ? void 0 : p(t);
|
|
77
77
|
},
|
|
78
|
-
on3dsChallengeOpen: (e) => (e.isOpen && (n.style = "position: fixed !important; z-
|
|
79
|
-
onProcessPayment: () => (v = !0,
|
|
78
|
+
on3dsChallengeOpen: (e) => (r === "widget" && e.isOpen && (n.style = "position: fixed !important; z-index: 2147483647 !important; background: rgba(40, 40, 40, 0.75) !important; transition: background 400ms !important; will-change: background !important; inset: 0px !important; margin: 0px !important; padding: 0px !important; border-radius: 0px; height:100vh"), e.isOpen || (n.style = ""), g == null ? void 0 : g(e.isOpen)),
|
|
79
|
+
onProcessPayment: () => (v = !0, f == null ? void 0 : f(!0)),
|
|
80
80
|
onValidForm: (e) => {
|
|
81
81
|
const t = {
|
|
82
82
|
isValid: e.formIsValid,
|
|
@@ -86,10 +86,10 @@ async function b(h, w = {}) {
|
|
|
86
86
|
},
|
|
87
87
|
onNeedCvv: (e) => (a = e.value, u && (u({
|
|
88
88
|
needCvv: a
|
|
89
|
-
}), u = null),
|
|
89
|
+
}), u = null), y == null ? void 0 : y(e))
|
|
90
90
|
}, x = (e) => {
|
|
91
|
-
var
|
|
92
|
-
const t = (
|
|
91
|
+
var o;
|
|
92
|
+
const t = (o = e.data) == null ? void 0 : o.hook;
|
|
93
93
|
!t || !k[t] || k[t](e.data);
|
|
94
94
|
};
|
|
95
95
|
return window.addEventListener("message", x), {
|
package/dist/htechPay.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(o,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.HtechPay={}))})(this,function(o){"use strict";/*! HtechPay | MIT License */async function s(p,k={}){const{environment:a="qa",onViewForm:f,onPaymentResult:g,theme:x="",on3dsChallengeOpen:y,onProcessPayment:v,onNeedCvv:w}=k;let{type:r}=k;const l={qa:"https://sp-checkout-qa.pagoshtechstage.com/index.html",stage:"https://sp-checkout-stage.pagoshtechstage.com/index.html",prod:"https://sp-checkout.pagoshtech.com/index.html"};let m=null;const d={defaultUrl:{url:`${l[a]}?orderId=${p}&theme=${x}`,height:"670",style:""},widget:{url:`${l[a]}?orderId=${p}#/widget`,height:"88",style:""},paymentToken:{url:`${l[a]}?orderId=${p}&theme=${x}#/paymentToken`,height:"520",style:""}};d[r]||(r="defaultUrl");let u=null,h=null,c=null,P=!1;const n=document.createElement("iframe");n.id="iframe_htechPay",n.src=d[r].url,n.width="100%",n.height=d[r].height,n.frameBorder="0",n.allowFullscreen=!0,n.title="Payment form",n.style=d[r].style;const T=()=>new Promise((e,t)=>{u=e,document.getElementById("iframe_htechPay").contentWindow.postMessage("htechPayment_onPayment",new URL(l[a]).origin),setTimeout(()=>{P||e({status:"validation_error",message:"Unknown error"})},600)}),$=()=>new Promise(e=>{const t=i=>{e({needCvv:i})};if(m!==null){t(m);return}c=i=>{t(i.needCvv)}}),_=()=>new Promise((e,t)=>{h=e,document.getElementById("iframe_htechPay").contentWindow.postMessage("htechPayment_onValidateForm",new URL(l[a]).origin),setTimeout(()=>{P||e({status:"validation_error",message:"Unknown error"})},600)}),b={onViewForm:()=>f==null?void 0:f(!0),onPaymentResult:e=>{const t=e.data.payload||{};return u&&(u(t),u=null),g==null?void 0:g(t)},on3dsChallengeOpen:e=>(r==="widget"&&e.isOpen&&(n.style="position: fixed !important; z-index: 2147483647 !important; background: rgba(40, 40, 40, 0.75) !important; transition: background 400ms !important; will-change: background !important; inset: 0px !important; margin: 0px !important; padding: 0px !important; border-radius: 0px; height:100vh"),e.isOpen||(n.style=""),y==null?void 0:y(e.isOpen)),onProcessPayment:()=>(P=!0,v==null?void 0:v(!0)),onValidForm:e=>{const t={isValid:e.formIsValid,errors:e.errors};return h&&(h(t),h=null),t},onNeedCvv:e=>(m=e.value,c&&(c({needCvv:m}),c=null),w==null?void 0:w(e))},C=e=>{var i;const t=(i=e.data)==null?void 0:i.hook;!t||!b[t]||b[t](e.data)};return window.addEventListener("message",C),{mount:e=>{const t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error("The container to mount the form could not be found");t.appendChild(n)},destroy:()=>{window.removeEventListener("message",C),n.remove()},processPayment:T,validateForm:_,verifyNeedCvv:$}}o.htechPay=s,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|