@tap-payments/connect 2.5.23-test → 2.6.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/README.md +39 -24
- package/build/@types/config.d.ts +54 -0
- package/build/@types/config.js +1 -0
- package/build/@types/index.d.ts +16 -19
- package/build/api/index.js +14 -26
- package/build/constants/index.d.ts +5 -2
- package/build/constants/index.js +5 -2
- package/build/features/Connect/Connect.d.ts +1 -1
- package/build/features/Connect/Connect.js +23 -13
- package/build/features/Connect/ConnectAuth.d.ts +7 -0
- package/build/features/Connect/ConnectAuth.js +117 -0
- package/build/features/Connect/ConnectBank.d.ts +12 -0
- package/build/features/Connect/ConnectBank.js +118 -0
- package/build/features/Connect/ConnectBoard.d.ts +10 -0
- package/build/features/Connect/ConnectBoard.js +117 -0
- package/build/features/Connect/ConnectBrand.d.ts +12 -0
- package/build/features/Connect/ConnectBrand.js +118 -0
- package/build/features/Connect/ConnectEntity.d.ts +12 -0
- package/build/features/Connect/ConnectEntity.js +118 -0
- package/build/features/Connect/ConnectExpress.js +1 -13
- package/build/features/Connect/ConnectIndividual.d.ts +12 -0
- package/build/features/Connect/ConnectIndividual.js +118 -0
- package/build/features/Connect/ConnectPassword.d.ts +12 -0
- package/build/features/Connect/ConnectPassword.js +118 -0
- package/build/features/Connect/ConnectTax.d.ts +12 -0
- package/build/features/Connect/ConnectTax.js +118 -0
- package/build/features/Connect/index.d.ts +10 -2
- package/build/features/Connect/index.js +9 -1
- package/build/index.d.ts +3 -3
- package/build/index.js +10 -3
- package/build/utils/common.d.ts +2 -2
- package/build/utils/common.js +3 -3
- package/build/utils/config.d.ts +1 -1
- package/build/utils/config.js +5 -1
- package/build/utils/validation.d.ts +6 -0
- package/build/utils/validation.js +143 -5
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
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, validateBoardOtherKitsProps } from '../../utils';
|
|
52
|
+
import { useScript, useStyle } from '../../hooks';
|
|
53
|
+
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
54
|
+
var Bank = 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-bank-js is ready!');
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
console.error('connect-bank-js failed to load!');
|
|
62
|
+
}, [status]);
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
if (status !== 'ready')
|
|
66
|
+
return;
|
|
67
|
+
var renderBankLib = window['TapAuth'].renderBankLib;
|
|
68
|
+
var unmount = renderBankLib({
|
|
69
|
+
open: props.open,
|
|
70
|
+
mode: props.mode,
|
|
71
|
+
scope: props.scope,
|
|
72
|
+
merchantDomain: props.domain,
|
|
73
|
+
showBoard: props.board,
|
|
74
|
+
publicKey: props.publicKey,
|
|
75
|
+
postURL: props.postURL,
|
|
76
|
+
appInfo: {
|
|
77
|
+
name: window.location.hostname || window.location.origin
|
|
78
|
+
},
|
|
79
|
+
businessCountryCode: props.country,
|
|
80
|
+
language: props.language,
|
|
81
|
+
onFlowCompleted: props.onSuccess,
|
|
82
|
+
onError: props.onError,
|
|
83
|
+
onReady: props.onReady,
|
|
84
|
+
onClose: props.onClose,
|
|
85
|
+
loaderColor: props.loaderColor,
|
|
86
|
+
verifyToken: props.verifyToken,
|
|
87
|
+
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
|
+
settingData: props.settingData,
|
|
89
|
+
onSettingFetched: props.onSettingFetched,
|
|
90
|
+
features: props.features
|
|
91
|
+
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-bank-lib-id').unmount;
|
|
92
|
+
return function () {
|
|
93
|
+
unmount();
|
|
94
|
+
};
|
|
95
|
+
}, [status]);
|
|
96
|
+
if (status !== 'ready')
|
|
97
|
+
return null;
|
|
98
|
+
return _jsx("div", { id: 'tap-connect-bank-lib-id' });
|
|
99
|
+
};
|
|
100
|
+
export var TapBank = React.memo(function (props) {
|
|
101
|
+
validateBoardOtherKitsProps(props);
|
|
102
|
+
return _jsx(Bank, __assign({}, props));
|
|
103
|
+
});
|
|
104
|
+
var tapConnectInstance = null;
|
|
105
|
+
export var renderTapBank = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
+
var el, root, unmount;
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
el = findOrCreateElementAndInject(elementId);
|
|
109
|
+
root = createRoot(el);
|
|
110
|
+
root.render(_jsx(TapBank, __assign({}, props)));
|
|
111
|
+
unmount = function () {
|
|
112
|
+
root.unmount();
|
|
113
|
+
tapConnectInstance = null;
|
|
114
|
+
};
|
|
115
|
+
tapConnectInstance = { unmount: unmount };
|
|
116
|
+
return [2, tapConnectInstance];
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
+
export type BoardProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'boardId' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
+
export type TapBoardProps = BoardProps & {
|
|
5
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const TapBoard: React.MemoExoticComponent<(props: TapBoardProps & {
|
|
8
|
+
id?: string;
|
|
9
|
+
}) => JSX.Element>;
|
|
10
|
+
export declare const renderTapBoard: (props: TapBoardProps, elementId: string) => Promise<any>;
|
|
@@ -0,0 +1,117 @@
|
|
|
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, validateBoardProps } from '../../utils';
|
|
52
|
+
import { useScript, useStyle } from '../../hooks';
|
|
53
|
+
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
54
|
+
var Board = 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-board-js is ready!');
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
console.error('connect-board-js failed to load!');
|
|
62
|
+
}, [status]);
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
if (status !== 'ready')
|
|
66
|
+
return;
|
|
67
|
+
var renderBoardLib = window['TapAuth'].renderBoardLib;
|
|
68
|
+
var unmount = renderBoardLib({
|
|
69
|
+
open: props.open,
|
|
70
|
+
mode: props.mode,
|
|
71
|
+
scope: props.scope,
|
|
72
|
+
merchantDomain: props.domain,
|
|
73
|
+
publicKey: props.publicKey,
|
|
74
|
+
postURL: props.postURL,
|
|
75
|
+
appInfo: {
|
|
76
|
+
name: window.location.hostname || window.location.origin
|
|
77
|
+
},
|
|
78
|
+
businessCountryCode: props.country,
|
|
79
|
+
language: props.language,
|
|
80
|
+
onFlowCompleted: props.onSuccess,
|
|
81
|
+
onError: props.onError,
|
|
82
|
+
onReady: props.onReady,
|
|
83
|
+
onClose: props.onClose,
|
|
84
|
+
loaderColor: props.loaderColor,
|
|
85
|
+
boardId: props.boardId,
|
|
86
|
+
onBoardButtonClick: props.onBoardButtonClick,
|
|
87
|
+
settingData: props.settingData,
|
|
88
|
+
onSettingFetched: props.onSettingFetched,
|
|
89
|
+
features: props.features
|
|
90
|
+
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-board-lib-id').unmount;
|
|
91
|
+
return function () {
|
|
92
|
+
unmount();
|
|
93
|
+
};
|
|
94
|
+
}, [status]);
|
|
95
|
+
if (status !== 'ready')
|
|
96
|
+
return null;
|
|
97
|
+
return _jsx("div", { id: 'tap-connect-board-lib-id' });
|
|
98
|
+
};
|
|
99
|
+
export var TapBoard = React.memo(function (props) {
|
|
100
|
+
validateBoardProps(props);
|
|
101
|
+
return _jsx(Board, __assign({}, props));
|
|
102
|
+
});
|
|
103
|
+
var tapConnectInstance = null;
|
|
104
|
+
export var renderTapBoard = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
+
var el, root, unmount;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
el = findOrCreateElementAndInject(elementId);
|
|
108
|
+
root = createRoot(el);
|
|
109
|
+
root.render(_jsx(TapBoard, __assign({}, props)));
|
|
110
|
+
unmount = function () {
|
|
111
|
+
root.unmount();
|
|
112
|
+
tapConnectInstance = null;
|
|
113
|
+
};
|
|
114
|
+
tapConnectInstance = { unmount: unmount };
|
|
115
|
+
return [2, tapConnectInstance];
|
|
116
|
+
});
|
|
117
|
+
}); };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
+
type BrandProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
+
export type TapBrandProps = BrandProps & {
|
|
5
|
+
verifyToken: string;
|
|
6
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const TapBrand: React.MemoExoticComponent<(props: TapBrandProps & {
|
|
9
|
+
id?: string;
|
|
10
|
+
}) => JSX.Element>;
|
|
11
|
+
export declare const renderTapBrand: (props: TapBrandProps, elementId: string) => Promise<any>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
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, validateBoardOtherKitsProps } from '../../utils';
|
|
52
|
+
import { useScript, useStyle } from '../../hooks';
|
|
53
|
+
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
54
|
+
var Brand = 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-brand-js is ready!');
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
console.error('connect-brand-js failed to load!');
|
|
62
|
+
}, [status]);
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
if (status !== 'ready')
|
|
66
|
+
return;
|
|
67
|
+
var renderBrandLib = window['TapAuth'].renderBrandLib;
|
|
68
|
+
var unmount = renderBrandLib({
|
|
69
|
+
open: props.open,
|
|
70
|
+
mode: props.mode,
|
|
71
|
+
scope: props.scope,
|
|
72
|
+
merchantDomain: props.domain,
|
|
73
|
+
showBoard: props.board,
|
|
74
|
+
publicKey: props.publicKey,
|
|
75
|
+
postURL: props.postURL,
|
|
76
|
+
appInfo: {
|
|
77
|
+
name: window.location.hostname || window.location.origin
|
|
78
|
+
},
|
|
79
|
+
businessCountryCode: props.country,
|
|
80
|
+
language: props.language,
|
|
81
|
+
onFlowCompleted: props.onSuccess,
|
|
82
|
+
onError: props.onError,
|
|
83
|
+
onReady: props.onReady,
|
|
84
|
+
onClose: props.onClose,
|
|
85
|
+
loaderColor: props.loaderColor,
|
|
86
|
+
verifyToken: props.verifyToken,
|
|
87
|
+
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
|
+
settingData: props.settingData,
|
|
89
|
+
onSettingFetched: props.onSettingFetched,
|
|
90
|
+
features: props.features
|
|
91
|
+
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-brand-lib-id').unmount;
|
|
92
|
+
return function () {
|
|
93
|
+
unmount();
|
|
94
|
+
};
|
|
95
|
+
}, [status]);
|
|
96
|
+
if (status !== 'ready')
|
|
97
|
+
return null;
|
|
98
|
+
return _jsx("div", { id: 'tap-connect-brand-lib-id' });
|
|
99
|
+
};
|
|
100
|
+
export var TapBrand = React.memo(function (props) {
|
|
101
|
+
validateBoardOtherKitsProps(props);
|
|
102
|
+
return _jsx(Brand, __assign({}, props));
|
|
103
|
+
});
|
|
104
|
+
var tapConnectInstance = null;
|
|
105
|
+
export var renderTapBrand = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
+
var el, root, unmount;
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
el = findOrCreateElementAndInject(elementId);
|
|
109
|
+
root = createRoot(el);
|
|
110
|
+
root.render(_jsx(TapBrand, __assign({}, props)));
|
|
111
|
+
unmount = function () {
|
|
112
|
+
root.unmount();
|
|
113
|
+
tapConnectInstance = null;
|
|
114
|
+
};
|
|
115
|
+
tapConnectInstance = { unmount: unmount };
|
|
116
|
+
return [2, tapConnectInstance];
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
+
type EntityProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
+
export type TapEntityProps = EntityProps & {
|
|
5
|
+
verifyToken: string;
|
|
6
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const TapEntity: React.MemoExoticComponent<(props: TapEntityProps & {
|
|
9
|
+
id?: string;
|
|
10
|
+
}) => JSX.Element>;
|
|
11
|
+
export declare const renderTapEntity: (props: TapEntityProps, elementId: string) => Promise<any>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
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, validateBoardOtherKitsProps } from '../../utils';
|
|
52
|
+
import { useScript, useStyle } from '../../hooks';
|
|
53
|
+
import { CDN_LIBRARY_BASE_URL } from '../../constants';
|
|
54
|
+
var Entity = 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-entity-js is ready!');
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
console.error('connect-entity-js failed to load!');
|
|
62
|
+
}, [status]);
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
if (status !== 'ready')
|
|
66
|
+
return;
|
|
67
|
+
var renderEntityLib = window['TapAuth'].renderEntityLib;
|
|
68
|
+
var unmount = renderEntityLib({
|
|
69
|
+
open: props.open,
|
|
70
|
+
mode: props.mode,
|
|
71
|
+
scope: props.scope,
|
|
72
|
+
merchantDomain: props.domain,
|
|
73
|
+
showBoard: props.board,
|
|
74
|
+
publicKey: props.publicKey,
|
|
75
|
+
postURL: props.postURL,
|
|
76
|
+
appInfo: {
|
|
77
|
+
name: window.location.hostname || window.location.origin
|
|
78
|
+
},
|
|
79
|
+
businessCountryCode: props.country,
|
|
80
|
+
language: props.language,
|
|
81
|
+
onFlowCompleted: props.onSuccess,
|
|
82
|
+
onError: props.onError,
|
|
83
|
+
onReady: props.onReady,
|
|
84
|
+
onClose: props.onClose,
|
|
85
|
+
loaderColor: props.loaderColor,
|
|
86
|
+
verifyToken: props.verifyToken,
|
|
87
|
+
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
|
+
settingData: props.settingData,
|
|
89
|
+
onSettingFetched: props.onSettingFetched,
|
|
90
|
+
features: props.features
|
|
91
|
+
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-entity-lib-id').unmount;
|
|
92
|
+
return function () {
|
|
93
|
+
unmount();
|
|
94
|
+
};
|
|
95
|
+
}, [status]);
|
|
96
|
+
if (status !== 'ready')
|
|
97
|
+
return null;
|
|
98
|
+
return _jsx("div", { id: 'tap-connect-entity-lib-id' });
|
|
99
|
+
};
|
|
100
|
+
export var TapEntity = React.memo(function (props) {
|
|
101
|
+
validateBoardOtherKitsProps(props);
|
|
102
|
+
return _jsx(Entity, __assign({}, props));
|
|
103
|
+
});
|
|
104
|
+
var tapConnectInstance = null;
|
|
105
|
+
export var renderTapEntity = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
+
var el, root, unmount;
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
el = findOrCreateElementAndInject(elementId);
|
|
109
|
+
root = createRoot(el);
|
|
110
|
+
root.render(_jsx(TapEntity, __assign({}, props)));
|
|
111
|
+
unmount = function () {
|
|
112
|
+
root.unmount();
|
|
113
|
+
tapConnectInstance = null;
|
|
114
|
+
};
|
|
115
|
+
tapConnectInstance = { unmount: unmount };
|
|
116
|
+
return [2, tapConnectInstance];
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
12
|
import * as React from 'react';
|
|
24
13
|
import { wrapLibConfig } from '../../utils';
|
|
25
14
|
var ConnectExpress = function (props) {
|
|
@@ -64,8 +53,7 @@ var ConnectExpress = function (props) {
|
|
|
64
53
|
break;
|
|
65
54
|
default:
|
|
66
55
|
unmountComponent();
|
|
67
|
-
var
|
|
68
|
-
var configAttrs = wrapLibConfig(__assign(__assign({}, rest), { verifyToken: token, onBoardButtonClick: onButtonClick }));
|
|
56
|
+
var configAttrs = wrapLibConfig(__assign(__assign({}, props), { verifyToken: token, onBoardButtonClick: onButtonClick }));
|
|
69
57
|
var unmountExpress = renderConnectExpressLib(configAttrs, elementId).unmount;
|
|
70
58
|
unmountComponent = unmountExpress;
|
|
71
59
|
break;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
+
type IndividualProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
+
export type TapIndividualProps = IndividualProps & {
|
|
5
|
+
verifyToken: string;
|
|
6
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const TapIndividual: React.MemoExoticComponent<(props: TapIndividualProps & {
|
|
9
|
+
id?: string;
|
|
10
|
+
}) => JSX.Element>;
|
|
11
|
+
export declare const renderTapIndividual: (props: TapIndividualProps, elementId: string) => Promise<any>;
|
|
12
|
+
export {};
|