idpay-b2b-sdk 2.0.3 → 2.1.1
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/assets/.version.d.ts +2 -0
- package/index.d.ts +1 -1
- package/index.esm.d.ts +1 -1
- package/index.esm.js +1 -1
- package/index.js +1 -1
- package/lib/index.d.ts +46 -0
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./index";
|
|
1
|
+
export * from "./lib/index";
|
package/index.esm.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./index";
|
|
1
|
+
export * from "./lib/index";
|
package/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n="2.1.1";let e,t,o,i,s=!1,c=!1;const a="IFRAME",r="REDIRECT",l="SILENT",d="dev",u="uat",p="prod",h={[d]:"https://idpay-dev.unico.io",[u]:"https://idpay-uat.unico.io",[p]:"https://idpay.unico.io"},k=()=>{console.log(">>> reset"),e=void 0,t=void 0,s=!1,c=!1,o=void 0},S=async d=>{let{token:u,useCurrentOrigin:k,env:S=p,type:I=a}=d;switch(e=I,t=k?window.location.origin:h[S],await(()=>{if(i)return Promise.resolve();i=document.createElement("script"),i.src=`${t}/sdk-assets/index.js`;const n=new Promise((n=>{i.onload=n}));return document.body.appendChild(i),Promise.all([n])})(),UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),e){case l:o=await UnicoSDKAssets.clientBoxControl.initSilent();break;case r:break;default:await(()=>{const n=document.createElement("link");n.setAttribute("href",`${t}/sdk-assets/assets/styles.css`),n.setAttribute("rel","stylesheet");const e=new Promise((e=>{n.onload=e}));return document.head.appendChild(n),Promise.all([e])})(),UnicoSDKAssets.clientBoxControl.create({host:t,token:u,sdkVersion:n})}if(s=!0,c&&y(c),o)return o},I=i=>{let{transactionId:a,token:d,onFinish:u}=i;const p={transactionId:a,token:d,onFinish:u,host:t,sdkVersion:n,collectionId:o};if(console.log("open",p),s)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,p),e){case l:UnicoSDKAssets.clientBoxControl.verify(p);break;case r:UnicoSDKAssets.clientBoxControl.redirect(a,d,t,n);break;default:UnicoSDKAssets.clientBoxControl.open(p)}else c=p},y=n=>{let{transactionId:e,token:t,onFinish:o}=n;I({transactionId:e,token:t,onFinish:o})},D=()=>{k(),UnicoSDKAssets.clientBoxControl.close()},A={init:async n=>(console.log(">>> initByUnicoSDK > options:",n),S({...n})),close:D,open:n=>{let{transactionId:e,token:t,onFinish:o}=n;I({transactionId:e,token:t,onFinish:n=>{k(),o?.(n)}})}},E={init:async n=>(console.log(">>> initIDPaySDK > options:",n),S({...n,token:null})),close:D,open:n=>{let{transactionId:e,token:t,onFinish:o}=n;I({transactionId:e,token:t,onFinish:o})}},m={init:async n=>(console.warn("Warning: The `init()` function is deprecated and will be removed in future versions. Please initialize directly on the product object, e.g., `IDPaySDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),S(n)),close:D,open:y};export{A as ByUnicoSDK,E as IDPaySDK,m as UnicoSDK};
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).UnicoSDK={})}(this,(function(e){"use strict";var n="2.1.1";let o,t,i,s,c=!1,a=!1;const r="IFRAME",l="REDIRECT",d="SILENT",u="dev",p="uat",h="prod",S={[u]:"https://idpay-dev.unico.io",[p]:"https://idpay-uat.unico.io",[h]:"https://idpay.unico.io"},f=()=>{console.log(">>> reset"),o=void 0,t=void 0,c=!1,a=!1,i=void 0},y=async e=>{let{token:u,useCurrentOrigin:p,env:f=h,type:y=r}=e;switch(o=y,t=p?window.location.origin:S[f],await(()=>{if(s)return Promise.resolve();s=document.createElement("script"),s.src=`${t}/sdk-assets/index.js`;const e=new Promise((e=>{s.onload=e}));return document.body.appendChild(s),Promise.all([e])})(),UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),o){case d:i=await UnicoSDKAssets.clientBoxControl.initSilent();break;case l:break;default:await(()=>{const e=document.createElement("link");e.setAttribute("href",`${t}/sdk-assets/assets/styles.css`),e.setAttribute("rel","stylesheet");const n=new Promise((n=>{e.onload=n}));return document.head.appendChild(e),Promise.all([n])})(),UnicoSDKAssets.clientBoxControl.create({host:t,token:u,sdkVersion:n})}if(c=!0,a&&D(a),i)return i},k=e=>{let{transactionId:s,token:r,onFinish:u}=e;const p={transactionId:s,token:r,onFinish:u,host:t,sdkVersion:n,collectionId:i};if(console.log("open",p),c)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,p),o){case d:UnicoSDKAssets.clientBoxControl.verify(p);break;case l:UnicoSDKAssets.clientBoxControl.redirect(s,r,t,n);break;default:UnicoSDKAssets.clientBoxControl.open(p)}else a=p},D=e=>{let{transactionId:n,token:o,onFinish:t}=e;k({transactionId:n,token:o,onFinish:t})},I=()=>{f(),UnicoSDKAssets.clientBoxControl.close()},K={init:async e=>(console.log(">>> initByUnicoSDK > options:",e),y({...e})),close:I,open:e=>{let{transactionId:n,token:o,onFinish:t}=e;k({transactionId:n,token:o,onFinish:e=>{f(),t?.(e)}})}},m={init:async e=>(console.log(">>> initIDPaySDK > options:",e),y({...e,token:null})),close:I,open:e=>{let{transactionId:n,token:o,onFinish:t}=e;k({transactionId:n,token:o,onFinish:t})}},A={init:async e=>(console.warn("Warning: The `init()` function is deprecated and will be removed in future versions. Please initialize directly on the product object, e.g., `IDPaySDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),y(e)),close:I,open:D};e.ByUnicoSDK=K,e.IDPaySDK=m,e.UnicoSDK=A}));
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export namespace ByUnicoSDK {
|
|
2
|
+
export { initByUnicoSDK as init };
|
|
3
|
+
export { close };
|
|
4
|
+
export { openByUnicoSDK as open };
|
|
5
|
+
}
|
|
6
|
+
export namespace IDPaySDK {
|
|
7
|
+
export { initIDPaySDK as init };
|
|
8
|
+
export { close };
|
|
9
|
+
export { openIDPaySDK as open };
|
|
10
|
+
}
|
|
11
|
+
export namespace UnicoSDK {
|
|
12
|
+
export { init };
|
|
13
|
+
export { close };
|
|
14
|
+
export { open };
|
|
15
|
+
}
|
|
16
|
+
declare function initByUnicoSDK(options: any): Promise<any>;
|
|
17
|
+
declare function close(): void;
|
|
18
|
+
declare function openByUnicoSDK({ transactionId, token, onFinish }: {
|
|
19
|
+
transactionId: any;
|
|
20
|
+
token: any;
|
|
21
|
+
onFinish: any;
|
|
22
|
+
}): void;
|
|
23
|
+
declare function initIDPaySDK(options: any): Promise<any>;
|
|
24
|
+
declare function openIDPaySDK({ transactionId, token, onFinish }: {
|
|
25
|
+
transactionId: any;
|
|
26
|
+
token: any;
|
|
27
|
+
onFinish: any;
|
|
28
|
+
}): void;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated
|
|
31
|
+
* The `init()` function is deprecated.
|
|
32
|
+
* Please initialize directly on the product object.
|
|
33
|
+
*
|
|
34
|
+
* Examples:
|
|
35
|
+
* - `IDPaySDK.init({ ... })`
|
|
36
|
+
* - `ByUnicoSDK.init({ ... })`
|
|
37
|
+
*
|
|
38
|
+
* See our documentation for more details.
|
|
39
|
+
*/
|
|
40
|
+
declare function init(options: any): Promise<any>;
|
|
41
|
+
declare function open({ transactionId, token, onFinish }: {
|
|
42
|
+
transactionId: any;
|
|
43
|
+
token: any;
|
|
44
|
+
onFinish: any;
|
|
45
|
+
}): void;
|
|
46
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "idpay-b2b-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"module": "./index.esm.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/acesso-io/frontend.git",
|
|
9
|
+
"url": "git+https://github.com/acesso-io/frontend.git",
|
|
10
10
|
"directory": "libs/pay/sdk/idpay-b2b-sdk"
|
|
11
11
|
},
|
|
12
12
|
"publishConfig": {
|