idpay-b2b-sdk 0.0.18 → 0.0.20
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/index.cjs +13 -2
- package/index.js +13 -2
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -38,6 +38,14 @@
|
|
|
38
38
|
}
|
|
39
39
|
let _openWhileInitializing = false;
|
|
40
40
|
const TYPE__IFRAME = 'IFRAME';
|
|
41
|
+
const ENV_DEV = 'dev';
|
|
42
|
+
const ENV_UAT = 'uat';
|
|
43
|
+
const ENV_PROD = 'prod';
|
|
44
|
+
const _HOSTS = {
|
|
45
|
+
[ENV_DEV]: 'https://idpay-dev.unico.io',
|
|
46
|
+
[ENV_UAT]: 'https://idpay-uat.unico.io',
|
|
47
|
+
[ENV_PROD]: 'https://idpay.unico.io'
|
|
48
|
+
};
|
|
41
49
|
const _createScript = ({
|
|
42
50
|
host
|
|
43
51
|
}) => {
|
|
@@ -61,9 +69,10 @@
|
|
|
61
69
|
document.head.appendChild(style);
|
|
62
70
|
return Promise.all([prmStyle]);
|
|
63
71
|
};
|
|
72
|
+
const _getEnvHost = (env = ENV_PROD) => _HOSTS[env];
|
|
64
73
|
const init = _async(function (options) {
|
|
65
74
|
console.log('init', options);
|
|
66
|
-
const host = options?.useCurrentOrigin ? window.location.origin :
|
|
75
|
+
const host = options?.useCurrentOrigin ? window.location.origin : _getEnvHost(options?.env);
|
|
67
76
|
return _await(_createScript({
|
|
68
77
|
host
|
|
69
78
|
}), function () {
|
|
@@ -74,7 +83,9 @@
|
|
|
74
83
|
return _await(_createStyles({
|
|
75
84
|
host
|
|
76
85
|
}), function () {
|
|
77
|
-
IDPaySDKAssets.clientBoxControl.create(
|
|
86
|
+
IDPaySDKAssets.clientBoxControl.create({
|
|
87
|
+
host
|
|
88
|
+
});
|
|
78
89
|
});
|
|
79
90
|
}
|
|
80
91
|
}, function () {
|
package/index.js
CHANGED
|
@@ -4,6 +4,14 @@ let _type;
|
|
|
4
4
|
let _initialized = false;
|
|
5
5
|
let _openWhileInitializing = false;
|
|
6
6
|
const TYPE__IFRAME = 'IFRAME';
|
|
7
|
+
const ENV_DEV = 'dev';
|
|
8
|
+
const ENV_UAT = 'uat';
|
|
9
|
+
const ENV_PROD = 'prod';
|
|
10
|
+
const _HOSTS = {
|
|
11
|
+
[ENV_DEV]: 'https://idpay-dev.unico.io',
|
|
12
|
+
[ENV_UAT]: 'https://idpay-uat.unico.io',
|
|
13
|
+
[ENV_PROD]: 'https://idpay.unico.io'
|
|
14
|
+
};
|
|
7
15
|
const _createScript = ({
|
|
8
16
|
host
|
|
9
17
|
}) => {
|
|
@@ -27,9 +35,10 @@ const _createStyles = ({
|
|
|
27
35
|
document.head.appendChild(style);
|
|
28
36
|
return Promise.all([prmStyle]);
|
|
29
37
|
};
|
|
38
|
+
const _getEnvHost = (env = ENV_PROD) => _HOSTS[env];
|
|
30
39
|
const init = async options => {
|
|
31
40
|
console.log('init', options);
|
|
32
|
-
const host = options?.useCurrentOrigin ? window.location.origin :
|
|
41
|
+
const host = options?.useCurrentOrigin ? window.location.origin : _getEnvHost(options?.env);
|
|
33
42
|
await _createScript({
|
|
34
43
|
host
|
|
35
44
|
});
|
|
@@ -39,7 +48,9 @@ const init = async options => {
|
|
|
39
48
|
await _createStyles({
|
|
40
49
|
host
|
|
41
50
|
});
|
|
42
|
-
IDPaySDKAssets.clientBoxControl.create(
|
|
51
|
+
IDPaySDKAssets.clientBoxControl.create({
|
|
52
|
+
host
|
|
53
|
+
});
|
|
43
54
|
}
|
|
44
55
|
_initialized = true;
|
|
45
56
|
if (_openWhileInitializing) {
|