idpay-b2b-sdk 0.0.16 → 0.0.17
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 +19 -2
- package/index.js +5 -0
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
return then(result);
|
|
27
27
|
}
|
|
28
28
|
let _initialized = false;
|
|
29
|
+
function _async(f) {
|
|
30
|
+
return function () {
|
|
31
|
+
for (var args = [], i = 0; i < arguments.length; i++) {
|
|
32
|
+
args[i] = arguments[i];
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return Promise.resolve(f.apply(this, args));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
return Promise.reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
29
41
|
let _openWhileInitializing = false;
|
|
30
42
|
const TYPE__IFRAME = 'IFRAME';
|
|
31
43
|
const _createScript = () => {
|
|
@@ -47,7 +59,8 @@
|
|
|
47
59
|
document.head.appendChild(style);
|
|
48
60
|
return Promise.all([prmStyle]);
|
|
49
61
|
};
|
|
50
|
-
const init = function (options) {
|
|
62
|
+
const init = _async(function (options) {
|
|
63
|
+
console.log('init', options);
|
|
51
64
|
return _call(_createScript, function () {
|
|
52
65
|
IDPaySDKAssets.trackEvent(IDPaySDKAssets.EVENT_TYPES.INITIALIZE);
|
|
53
66
|
_type = options?.type;
|
|
@@ -64,11 +77,15 @@
|
|
|
64
77
|
}
|
|
65
78
|
});
|
|
66
79
|
});
|
|
67
|
-
};
|
|
80
|
+
});
|
|
68
81
|
const startPayFlow = ({
|
|
69
82
|
transactionId,
|
|
70
83
|
onFinish
|
|
71
84
|
}) => {
|
|
85
|
+
console.log('startPayFlow', {
|
|
86
|
+
transactionId,
|
|
87
|
+
onFinish
|
|
88
|
+
});
|
|
72
89
|
if (!_initialized) {
|
|
73
90
|
_openWhileInitializing = {
|
|
74
91
|
transactionId,
|
package/index.js
CHANGED
|
@@ -24,6 +24,7 @@ const _createStyles = () => {
|
|
|
24
24
|
return Promise.all([prmStyle]);
|
|
25
25
|
};
|
|
26
26
|
const init = async options => {
|
|
27
|
+
console.log('init', options);
|
|
27
28
|
await _createScript();
|
|
28
29
|
IDPaySDKAssets.trackEvent(IDPaySDKAssets.EVENT_TYPES.INITIALIZE);
|
|
29
30
|
_type = options?.type;
|
|
@@ -40,6 +41,10 @@ const startPayFlow = ({
|
|
|
40
41
|
transactionId,
|
|
41
42
|
onFinish
|
|
42
43
|
}) => {
|
|
44
|
+
console.log('startPayFlow', {
|
|
45
|
+
transactionId,
|
|
46
|
+
onFinish
|
|
47
|
+
});
|
|
43
48
|
if (!_initialized) {
|
|
44
49
|
_openWhileInitializing = {
|
|
45
50
|
transactionId,
|