@tap-payments/connect 2.10.6-beta → 2.10.7-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/README.md +171 -171
- package/build/@types/config.d.ts +63 -63
- package/build/@types/config.js +1 -1
- package/build/@types/index.d.ts +74 -74
- package/build/@types/index.js +1 -1
- package/build/api/index.d.ts +12 -12
- package/build/api/index.js +95 -95
- package/build/constants/index.d.ts +17 -17
- package/build/constants/index.js +17 -17
- package/build/features/Connect/Connect.d.ts +5 -5
- package/build/features/Connect/Connect.js +150 -150
- package/build/features/Connect/ConnectAuth.d.ts +7 -7
- package/build/features/Connect/ConnectAuth.js +115 -115
- package/build/features/Connect/ConnectBank.d.ts +12 -12
- package/build/features/Connect/ConnectBank.js +118 -118
- package/build/features/Connect/ConnectBoard.d.ts +10 -10
- package/build/features/Connect/ConnectBoard.js +117 -117
- package/build/features/Connect/ConnectBrand.d.ts +12 -12
- package/build/features/Connect/ConnectBrand.js +118 -118
- package/build/features/Connect/ConnectEntity.d.ts +12 -12
- package/build/features/Connect/ConnectEntity.js +118 -118
- package/build/features/Connect/ConnectExpress.d.ts +4 -4
- package/build/features/Connect/ConnectExpress.js +78 -78
- package/build/features/Connect/ConnectFull.d.ts +4 -4
- package/build/features/Connect/ConnectFull.js +13 -13
- package/build/features/Connect/ConnectIndividual.d.ts +12 -12
- package/build/features/Connect/ConnectIndividual.js +118 -118
- package/build/features/Connect/ConnectPassword.d.ts +12 -12
- package/build/features/Connect/ConnectPassword.js +118 -118
- package/build/features/Connect/ConnectTax.d.ts +12 -12
- package/build/features/Connect/ConnectTax.js +118 -118
- package/build/features/Connect/index.d.ts +11 -11
- package/build/features/Connect/index.js +10 -10
- package/build/hooks/index.d.ts +2 -2
- package/build/hooks/index.js +2 -2
- package/build/hooks/useScript.d.ts +1 -1
- package/build/hooks/useScript.js +39 -39
- package/build/hooks/useStyle.d.ts +1 -1
- package/build/hooks/useStyle.js +13 -13
- package/build/index.d.ts +4 -4
- package/build/index.js +14 -14
- package/build/utils/common.d.ts +2 -2
- package/build/utils/common.js +16 -16
- package/build/utils/config.d.ts +7 -7
- package/build/utils/config.js +47 -47
- package/build/utils/html.d.ts +1 -1
- package/build/utils/html.js +9 -9
- package/build/utils/index.d.ts +4 -4
- package/build/utils/index.js +4 -4
- package/build/utils/validation.d.ts +8 -8
- package/build/utils/validation.js +190 -190
- package/package.json +106 -108
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
-
var t = {};
|
|
50
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
-
t[p] = s[p];
|
|
52
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
-
t[p[i]] = s[p[i]];
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
};
|
|
59
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
60
|
-
import * as React from 'react';
|
|
61
|
-
import { createRoot } from 'react-dom/client';
|
|
62
|
-
import { findOrCreateElementAndInject, getRedirectBaseUrl, validateConnectProps } from '../../utils';
|
|
63
|
-
import { useScript, useStyle } from '../../hooks';
|
|
64
|
-
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
65
|
-
import { generateConfigToken } from '../../api';
|
|
66
|
-
import ConnectFull from './ConnectFull';
|
|
67
|
-
import ConnectExpress from './ConnectExpress';
|
|
68
|
-
var Connect = function (_a) {
|
|
69
|
-
var elementId = _a.elementId, props = __rest(_a, ["elementId"]);
|
|
70
|
-
useStyle("".concat(CDN_LIBRARY_BASE_URL, "/main.css"));
|
|
71
|
-
var status = useScript("".concat(CDN_LIBRARY_BASE_URL, "/main.js"));
|
|
72
|
-
React.useEffect(function () {
|
|
73
|
-
if (status === 'ready')
|
|
74
|
-
console.info('connect-auth-js is ready!');
|
|
75
|
-
if (status === 'error')
|
|
76
|
-
console.error('connect-auth-js failed to load!');
|
|
77
|
-
}, [status]);
|
|
78
|
-
if (status !== 'ready')
|
|
79
|
-
return null;
|
|
80
|
-
if (!props.mature)
|
|
81
|
-
return _jsx(ConnectExpress, __assign({}, props, { elementId: elementId }));
|
|
82
|
-
return _jsx(ConnectFull, __assign({}, props, { elementId: elementId }));
|
|
83
|
-
};
|
|
84
|
-
export var TapConnect = React.memo(function (props) {
|
|
85
|
-
validateConnectProps(props);
|
|
86
|
-
return _jsx(Connect, __assign({}, props));
|
|
87
|
-
});
|
|
88
|
-
var tapConnectInstance = null;
|
|
89
|
-
export var renderTapConnect = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
|
-
var mode, board, publicKey, boardMaturity, language, country, scope, lead, postURL, mature, onError, redirectUrl, AuthData, payload, _a, data, publicKeyValue, _b, token, connect, baseUrl, url_1, countryCode, url, el, root, unmount;
|
|
91
|
-
return __generator(this, function (_c) {
|
|
92
|
-
switch (_c.label) {
|
|
93
|
-
case 0:
|
|
94
|
-
props.mode = props.mode || 'popup';
|
|
95
|
-
mode = props.mode, board = props.board, publicKey = props.publicKey, boardMaturity = props.boardMaturity, language = props.language, country = props.country, scope = props.scope, lead = props.lead, postURL = props.postURL, mature = props.mature, onError = props.onError, redirectUrl = props.redirectUrl, AuthData = props.data;
|
|
96
|
-
if (!(mode === 'page')) return [3, 2];
|
|
97
|
-
payload = __assign(__assign(__assign(__assign({ operator: {
|
|
98
|
-
public_key: publicKey
|
|
99
|
-
}, scope: scope }, (AuthData && {
|
|
100
|
-
data: AuthData
|
|
101
|
-
})), { lead: {
|
|
102
|
-
id: lead || ''
|
|
103
|
-
}, board: {
|
|
104
|
-
display: board,
|
|
105
|
-
editable: boardMaturity
|
|
106
|
-
}, interface: {
|
|
107
|
-
locale: language
|
|
108
|
-
} }), (redirectUrl && {
|
|
109
|
-
redirect: {
|
|
110
|
-
url: redirectUrl
|
|
111
|
-
}
|
|
112
|
-
})), (postURL && {
|
|
113
|
-
post: {
|
|
114
|
-
url: postURL
|
|
115
|
-
}
|
|
116
|
-
}));
|
|
117
|
-
return [4, generateConfigToken(payload)];
|
|
118
|
-
case 1:
|
|
119
|
-
_a = _c.sent(), data = _a.data, publicKeyValue = _a.publicKey;
|
|
120
|
-
if (data === null || data === void 0 ? void 0 : data.error) {
|
|
121
|
-
onError === null || onError === void 0 ? void 0 : onError(data.error);
|
|
122
|
-
return [2];
|
|
123
|
-
}
|
|
124
|
-
_b = data || {}, token = _b.token, connect = _b.connect;
|
|
125
|
-
baseUrl = getRedirectBaseUrl(publicKeyValue || '');
|
|
126
|
-
if (!mature || scope === 'auth') {
|
|
127
|
-
url_1 = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl, "?config_token=").concat(token);
|
|
128
|
-
window.location.href = url_1;
|
|
129
|
-
return [2];
|
|
130
|
-
}
|
|
131
|
-
countryCode = country.toLowerCase();
|
|
132
|
-
url = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl).concat(countryCode, "?config_token=").concat(token);
|
|
133
|
-
window.location.href = url;
|
|
134
|
-
return [2];
|
|
135
|
-
case 2:
|
|
136
|
-
if (tapConnectInstance) {
|
|
137
|
-
return [2, tapConnectInstance];
|
|
138
|
-
}
|
|
139
|
-
el = findOrCreateElementAndInject(elementId);
|
|
140
|
-
root = createRoot(el);
|
|
141
|
-
root.render(_jsx(TapConnect, __assign({}, props, { elementId: elementId })));
|
|
142
|
-
unmount = function () {
|
|
143
|
-
root.unmount();
|
|
144
|
-
tapConnectInstance = null;
|
|
145
|
-
};
|
|
146
|
-
tapConnectInstance = { unmount: unmount };
|
|
147
|
-
return [2, tapConnectInstance];
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}); };
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
60
|
+
import * as React from 'react';
|
|
61
|
+
import { createRoot } from 'react-dom/client';
|
|
62
|
+
import { findOrCreateElementAndInject, getRedirectBaseUrl, validateConnectProps } from '../../utils';
|
|
63
|
+
import { useScript, useStyle } from '../../hooks';
|
|
64
|
+
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
65
|
+
import { generateConfigToken } from '../../api';
|
|
66
|
+
import ConnectFull from './ConnectFull';
|
|
67
|
+
import ConnectExpress from './ConnectExpress';
|
|
68
|
+
var Connect = function (_a) {
|
|
69
|
+
var elementId = _a.elementId, props = __rest(_a, ["elementId"]);
|
|
70
|
+
useStyle("".concat(CDN_LIBRARY_BASE_URL, "/main.css"));
|
|
71
|
+
var status = useScript("".concat(CDN_LIBRARY_BASE_URL, "/main.js"));
|
|
72
|
+
React.useEffect(function () {
|
|
73
|
+
if (status === 'ready')
|
|
74
|
+
console.info('connect-auth-js is ready!');
|
|
75
|
+
if (status === 'error')
|
|
76
|
+
console.error('connect-auth-js failed to load!');
|
|
77
|
+
}, [status]);
|
|
78
|
+
if (status !== 'ready')
|
|
79
|
+
return null;
|
|
80
|
+
if (!props.mature)
|
|
81
|
+
return _jsx(ConnectExpress, __assign({}, props, { elementId: elementId }));
|
|
82
|
+
return _jsx(ConnectFull, __assign({}, props, { elementId: elementId }));
|
|
83
|
+
};
|
|
84
|
+
export var TapConnect = React.memo(function (props) {
|
|
85
|
+
validateConnectProps(props);
|
|
86
|
+
return _jsx(Connect, __assign({}, props));
|
|
87
|
+
});
|
|
88
|
+
var tapConnectInstance = null;
|
|
89
|
+
export var renderTapConnect = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
|
+
var mode, board, publicKey, boardMaturity, language, country, scope, lead, postURL, mature, onError, redirectUrl, AuthData, payload, _a, data, publicKeyValue, _b, token, connect, baseUrl, url_1, countryCode, url, el, root, unmount;
|
|
91
|
+
return __generator(this, function (_c) {
|
|
92
|
+
switch (_c.label) {
|
|
93
|
+
case 0:
|
|
94
|
+
props.mode = props.mode || 'popup';
|
|
95
|
+
mode = props.mode, board = props.board, publicKey = props.publicKey, boardMaturity = props.boardMaturity, language = props.language, country = props.country, scope = props.scope, lead = props.lead, postURL = props.postURL, mature = props.mature, onError = props.onError, redirectUrl = props.redirectUrl, AuthData = props.data;
|
|
96
|
+
if (!(mode === 'page')) return [3, 2];
|
|
97
|
+
payload = __assign(__assign(__assign(__assign({ operator: {
|
|
98
|
+
public_key: publicKey
|
|
99
|
+
}, scope: scope }, (AuthData && {
|
|
100
|
+
data: AuthData
|
|
101
|
+
})), { lead: {
|
|
102
|
+
id: lead || ''
|
|
103
|
+
}, board: {
|
|
104
|
+
display: board,
|
|
105
|
+
editable: boardMaturity
|
|
106
|
+
}, interface: {
|
|
107
|
+
locale: language
|
|
108
|
+
} }), (redirectUrl && {
|
|
109
|
+
redirect: {
|
|
110
|
+
url: redirectUrl
|
|
111
|
+
}
|
|
112
|
+
})), (postURL && {
|
|
113
|
+
post: {
|
|
114
|
+
url: postURL
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
return [4, generateConfigToken(payload)];
|
|
118
|
+
case 1:
|
|
119
|
+
_a = _c.sent(), data = _a.data, publicKeyValue = _a.publicKey;
|
|
120
|
+
if (data === null || data === void 0 ? void 0 : data.error) {
|
|
121
|
+
onError === null || onError === void 0 ? void 0 : onError(data.error);
|
|
122
|
+
return [2];
|
|
123
|
+
}
|
|
124
|
+
_b = data || {}, token = _b.token, connect = _b.connect;
|
|
125
|
+
baseUrl = getRedirectBaseUrl(publicKeyValue || '');
|
|
126
|
+
if (!mature || scope === 'auth') {
|
|
127
|
+
url_1 = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl, "?config_token=").concat(token);
|
|
128
|
+
window.location.href = url_1;
|
|
129
|
+
return [2];
|
|
130
|
+
}
|
|
131
|
+
countryCode = country.toLowerCase();
|
|
132
|
+
url = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl).concat(countryCode, "?config_token=").concat(token);
|
|
133
|
+
window.location.href = url;
|
|
134
|
+
return [2];
|
|
135
|
+
case 2:
|
|
136
|
+
if (tapConnectInstance) {
|
|
137
|
+
return [2, tapConnectInstance];
|
|
138
|
+
}
|
|
139
|
+
el = findOrCreateElementAndInject(elementId);
|
|
140
|
+
root = createRoot(el);
|
|
141
|
+
root.render(_jsx(TapConnect, __assign({}, props, { elementId: elementId })));
|
|
142
|
+
unmount = function () {
|
|
143
|
+
root.unmount();
|
|
144
|
+
tapConnectInstance = null;
|
|
145
|
+
};
|
|
146
|
+
tapConnectInstance = { unmount: unmount };
|
|
147
|
+
return [2, tapConnectInstance];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}); };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
-
export type ConnectAuthProps = Pick<ConnectAttrs, 'open' | 'domain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'lead' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'features'>;
|
|
4
|
-
export declare const TapConnectAuth: React.MemoExoticComponent<(props: ConnectAuthProps & {
|
|
5
|
-
id?: string;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
-
export declare const renderTapConnectAuth: (props: ConnectAuthProps, elementId: string) => Promise<any>;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
+
export type ConnectAuthProps = Pick<ConnectAttrs, 'open' | 'domain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'lead' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'features'>;
|
|
4
|
+
export declare const TapConnectAuth: React.MemoExoticComponent<(props: ConnectAuthProps & {
|
|
5
|
+
id?: string;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
7
|
+
export declare const renderTapConnectAuth: (props: ConnectAuthProps, elementId: string) => Promise<any>;
|
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
-
import * as React from 'react';
|
|
50
|
-
import { createRoot } from 'react-dom/client';
|
|
51
|
-
import { findOrCreateElementAndInject, validateConnectAuthProps } from '../../utils';
|
|
52
|
-
import { useScript, useStyle } from '../../hooks';
|
|
53
|
-
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
54
|
-
var ConnectAuth = function (props) {
|
|
55
|
-
useStyle("".concat(CDN_LIBRARY_BASE_URL, "/main.css"));
|
|
56
|
-
var status = useScript("".concat(CDN_LIBRARY_BASE_URL, "/main.js"));
|
|
57
|
-
React.useEffect(function () {
|
|
58
|
-
if (status === 'ready')
|
|
59
|
-
console.info('connect-auth-js is ready!');
|
|
60
|
-
if (status === 'error')
|
|
61
|
-
console.error('connect-auth-js failed to load!');
|
|
62
|
-
}, [status]);
|
|
63
|
-
React.useEffect(function () {
|
|
64
|
-
var _a;
|
|
65
|
-
if (status !== 'ready')
|
|
66
|
-
return;
|
|
67
|
-
var renderAuthLib = window['TapAuth'].renderAuthLib;
|
|
68
|
-
var unmount = renderAuthLib({
|
|
69
|
-
open: props.open,
|
|
70
|
-
mode: 'popup',
|
|
71
|
-
scope: 'auth',
|
|
72
|
-
merchantDomain: props.domain,
|
|
73
|
-
publicKey: props.publicKey,
|
|
74
|
-
redirectUrl: props.redirectUrl,
|
|
75
|
-
data: props.data,
|
|
76
|
-
postURL: props.postURL,
|
|
77
|
-
leadId: props.lead,
|
|
78
|
-
appInfo: {
|
|
79
|
-
name: window.location.hostname || window.location.origin
|
|
80
|
-
},
|
|
81
|
-
businessCountryCode: props.country,
|
|
82
|
-
language: props.language,
|
|
83
|
-
onFlowCompleted: props.onSuccess,
|
|
84
|
-
onError: props.onError,
|
|
85
|
-
onReady: props.onReady,
|
|
86
|
-
onClose: props.onClose,
|
|
87
|
-
features: props.features
|
|
88
|
-
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-auth-lib-id').unmount;
|
|
89
|
-
return function () {
|
|
90
|
-
unmount();
|
|
91
|
-
};
|
|
92
|
-
}, [status]);
|
|
93
|
-
if (status !== 'ready')
|
|
94
|
-
return null;
|
|
95
|
-
return _jsx("div", { id: 'tap-connect-auth-lib-id' });
|
|
96
|
-
};
|
|
97
|
-
export var TapConnectAuth = React.memo(function (props) {
|
|
98
|
-
validateConnectAuthProps(props);
|
|
99
|
-
return _jsx(ConnectAuth, __assign({}, props));
|
|
100
|
-
});
|
|
101
|
-
var tapConnectInstance = null;
|
|
102
|
-
export var renderTapConnectAuth = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
-
var el, root, unmount;
|
|
104
|
-
return __generator(this, function (_a) {
|
|
105
|
-
el = findOrCreateElementAndInject(elementId);
|
|
106
|
-
root = createRoot(el);
|
|
107
|
-
root.render(_jsx(TapConnectAuth, __assign({}, props)));
|
|
108
|
-
unmount = function () {
|
|
109
|
-
root.unmount();
|
|
110
|
-
tapConnectInstance = null;
|
|
111
|
-
};
|
|
112
|
-
tapConnectInstance = { unmount: unmount };
|
|
113
|
-
return [2, tapConnectInstance];
|
|
114
|
-
});
|
|
115
|
-
}); };
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
+
import * as React from 'react';
|
|
50
|
+
import { createRoot } from 'react-dom/client';
|
|
51
|
+
import { findOrCreateElementAndInject, validateConnectAuthProps } from '../../utils';
|
|
52
|
+
import { useScript, useStyle } from '../../hooks';
|
|
53
|
+
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
54
|
+
var ConnectAuth = function (props) {
|
|
55
|
+
useStyle("".concat(CDN_LIBRARY_BASE_URL, "/main.css"));
|
|
56
|
+
var status = useScript("".concat(CDN_LIBRARY_BASE_URL, "/main.js"));
|
|
57
|
+
React.useEffect(function () {
|
|
58
|
+
if (status === 'ready')
|
|
59
|
+
console.info('connect-auth-js is ready!');
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
console.error('connect-auth-js failed to load!');
|
|
62
|
+
}, [status]);
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
if (status !== 'ready')
|
|
66
|
+
return;
|
|
67
|
+
var renderAuthLib = window['TapAuth'].renderAuthLib;
|
|
68
|
+
var unmount = renderAuthLib({
|
|
69
|
+
open: props.open,
|
|
70
|
+
mode: 'popup',
|
|
71
|
+
scope: 'auth',
|
|
72
|
+
merchantDomain: props.domain,
|
|
73
|
+
publicKey: props.publicKey,
|
|
74
|
+
redirectUrl: props.redirectUrl,
|
|
75
|
+
data: props.data,
|
|
76
|
+
postURL: props.postURL,
|
|
77
|
+
leadId: props.lead,
|
|
78
|
+
appInfo: {
|
|
79
|
+
name: window.location.hostname || window.location.origin
|
|
80
|
+
},
|
|
81
|
+
businessCountryCode: props.country,
|
|
82
|
+
language: props.language,
|
|
83
|
+
onFlowCompleted: props.onSuccess,
|
|
84
|
+
onError: props.onError,
|
|
85
|
+
onReady: props.onReady,
|
|
86
|
+
onClose: props.onClose,
|
|
87
|
+
features: props.features
|
|
88
|
+
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-auth-lib-id').unmount;
|
|
89
|
+
return function () {
|
|
90
|
+
unmount();
|
|
91
|
+
};
|
|
92
|
+
}, [status]);
|
|
93
|
+
if (status !== 'ready')
|
|
94
|
+
return null;
|
|
95
|
+
return _jsx("div", { id: 'tap-connect-auth-lib-id' });
|
|
96
|
+
};
|
|
97
|
+
export var TapConnectAuth = React.memo(function (props) {
|
|
98
|
+
validateConnectAuthProps(props);
|
|
99
|
+
return _jsx(ConnectAuth, __assign({}, props));
|
|
100
|
+
});
|
|
101
|
+
var tapConnectInstance = null;
|
|
102
|
+
export var renderTapConnectAuth = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
+
var el, root, unmount;
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
el = findOrCreateElementAndInject(elementId);
|
|
106
|
+
root = createRoot(el);
|
|
107
|
+
root.render(_jsx(TapConnectAuth, __assign({}, props)));
|
|
108
|
+
unmount = function () {
|
|
109
|
+
root.unmount();
|
|
110
|
+
tapConnectInstance = null;
|
|
111
|
+
};
|
|
112
|
+
tapConnectInstance = { unmount: unmount };
|
|
113
|
+
return [2, tapConnectInstance];
|
|
114
|
+
});
|
|
115
|
+
}); };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
-
type BankProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
-
export type TapBankProps = BankProps & {
|
|
5
|
-
verifyToken: string;
|
|
6
|
-
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const TapBank: React.MemoExoticComponent<(props: TapBankProps & {
|
|
9
|
-
id?: string;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
-
export declare const renderTapBank: (props: TapBankProps, elementId: string) => Promise<any>;
|
|
12
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
+
type BankProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
+
export type TapBankProps = BankProps & {
|
|
5
|
+
verifyToken: string;
|
|
6
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const TapBank: React.MemoExoticComponent<(props: TapBankProps & {
|
|
9
|
+
id?: string;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export declare const renderTapBank: (props: TapBankProps, elementId: string) => Promise<any>;
|
|
12
|
+
export {};
|