htech-pay 1.0.4 → 1.0.5
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 +11 -11
- package/dist/htechPay.umd.js +1 -1
- package/package.json +1 -1
package/dist/htechPay.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/*! HtechPay | MIT License */
|
|
2
|
-
async function
|
|
2
|
+
async function g(c, m = {}) {
|
|
3
3
|
const {
|
|
4
4
|
environment: d = "qa",
|
|
5
5
|
isPaymentWithToken: i = !1,
|
|
6
6
|
onViewForm: n,
|
|
7
7
|
onPaymentResult: a,
|
|
8
8
|
theme: u = ""
|
|
9
|
-
} =
|
|
9
|
+
} = m, l = `${{
|
|
10
10
|
qa: "https://sp-checkout-qa.pagoshtechstage.com/index.html",
|
|
11
11
|
stage: "https://sp-checkout-stage.pagoshtechstage.com/index.html",
|
|
12
|
-
prod: ""
|
|
12
|
+
prod: "https://sp-checkout.pagoshtech.com/index.html"
|
|
13
13
|
}[d]}?orderId=${c}&theme=${u}${i ? "#/paymentToken" : ""}`, e = document.createElement("iframe");
|
|
14
14
|
e.src = l, e.width = "100%", e.height = "635", e.frameBorder = "0", e.allowFullscreen = !0, e.title = "Payment form";
|
|
15
|
-
const
|
|
15
|
+
const s = {
|
|
16
16
|
onViewForm: () => n == null ? void 0 : n(!0),
|
|
17
17
|
onPaymentResult: (t) => a == null ? void 0 : a(t.data.payload || {})
|
|
18
|
-
},
|
|
19
|
-
var
|
|
20
|
-
const o = (
|
|
21
|
-
!o || !
|
|
18
|
+
}, r = (t) => {
|
|
19
|
+
var h;
|
|
20
|
+
const o = (h = t.data) == null ? void 0 : h.hook;
|
|
21
|
+
!o || !s[o] || s[o](t.data);
|
|
22
22
|
};
|
|
23
|
-
return window.addEventListener("message",
|
|
23
|
+
return window.addEventListener("message", r), {
|
|
24
24
|
mount: (t) => {
|
|
25
25
|
const o = typeof t == "string" ? document.querySelector(t) : t;
|
|
26
26
|
if (!o)
|
|
@@ -28,10 +28,10 @@ async function f(c, h = {}) {
|
|
|
28
28
|
o.appendChild(e);
|
|
29
29
|
},
|
|
30
30
|
destroy: () => {
|
|
31
|
-
window.removeEventListener("message",
|
|
31
|
+
window.removeEventListener("message", r), e.remove();
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
g as htechPay
|
|
37
37
|
};
|
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(d,m={}){const{environment:u="qa",isPaymentWithToken:f=!1,onViewForm:a,onPaymentResult:i,theme:p=""}=m,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"}[u]}?orderId=${d}&theme=${p}${f?"#/paymentToken":""}`,e=document.createElement("iframe");e.src=l,e.width="100%",e.height="635",e.frameBorder="0",e.allowFullscreen=!0,e.title="Payment form";const r={onViewForm:()=>a==null?void 0:a(!0),onPaymentResult:t=>i==null?void 0:i(t.data.payload||{})},h=t=>{var c;const n=(c=t.data)==null?void 0:c.hook;!n||!r[n]||r[n](t.data)};return window.addEventListener("message",h),{mount:t=>{const n=typeof t=="string"?document.querySelector(t):t;if(!n)throw new Error("The container to mount the form could not be found");n.appendChild(e)},destroy:()=>{window.removeEventListener("message",h),e.remove()}}}o.htechPay=s,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|