@tap-payments/connect 2.6.8-test → 2.6.9
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 +34 -27
- package/build/@types/config.d.ts +63 -0
- package/build/@types/config.js +1 -0
- package/build/@types/index.d.ts +12 -22
- 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.js +25 -14
- package/build/features/Connect/ConnectAuth.d.ts +7 -0
- package/build/features/Connect/ConnectAuth.js +115 -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/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 +3 -1
- package/build/utils/validation.d.ts +6 -0
- package/build/utils/validation.js +133 -4
- package/package.json +2 -2
|
@@ -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 Password = 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-password-js is ready!');
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
console.error('connect-password-js failed to load!');
|
|
62
|
+
}, [status]);
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
if (status !== 'ready')
|
|
66
|
+
return;
|
|
67
|
+
var renderPasswordLib = window['TapAuth'].renderPasswordLib;
|
|
68
|
+
var unmount = renderPasswordLib({
|
|
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-password-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-password-lib-id' });
|
|
99
|
+
};
|
|
100
|
+
export var TapPassword = React.memo(function (props) {
|
|
101
|
+
validateBoardOtherKitsProps(props);
|
|
102
|
+
return _jsx(Password, __assign({}, props));
|
|
103
|
+
});
|
|
104
|
+
var tapConnectInstance = null;
|
|
105
|
+
export var renderTapPassword = 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(TapPassword, __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 TaxProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
+
export type TapTaxProps = TaxProps & {
|
|
5
|
+
verifyToken: string;
|
|
6
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const TapTax: React.MemoExoticComponent<(props: TapTaxProps & {
|
|
9
|
+
id?: string;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export declare const renderTapTax: (props: TapTaxProps, 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 Tax = 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-tax-js is ready!');
|
|
60
|
+
if (status === 'error')
|
|
61
|
+
console.error('connect-tax-js failed to load!');
|
|
62
|
+
}, [status]);
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
if (status !== 'ready')
|
|
66
|
+
return;
|
|
67
|
+
var renderTaxLib = window['TapAuth'].renderTaxLib;
|
|
68
|
+
var unmount = renderTaxLib({
|
|
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-tax-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-tax-lib-id' });
|
|
99
|
+
};
|
|
100
|
+
export var TapTax = React.memo(function (props) {
|
|
101
|
+
validateBoardOtherKitsProps(props);
|
|
102
|
+
return _jsx(Tax, __assign({}, props));
|
|
103
|
+
});
|
|
104
|
+
var tapConnectInstance = null;
|
|
105
|
+
export var renderTapTax = 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(TapTax, __assign({}, props)));
|
|
111
|
+
unmount = function () {
|
|
112
|
+
root.unmount();
|
|
113
|
+
tapConnectInstance = null;
|
|
114
|
+
};
|
|
115
|
+
tapConnectInstance = { unmount: unmount };
|
|
116
|
+
return [2, tapConnectInstance];
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { TapConnect, ConnectProps as TapConnectProps, renderTapConnect } from './Connect';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { ConnectAuthProps, TapConnectAuth, renderTapConnectAuth } from './ConnectAuth';
|
|
3
|
+
import { TapBoardProps, TapBoard, renderTapBoard } from './ConnectBoard';
|
|
4
|
+
import { TapBrandProps, TapBrand, renderTapBrand } from './ConnectBrand';
|
|
5
|
+
import { TapBankProps, TapBank, renderTapBank } from './ConnectBank';
|
|
6
|
+
import { TapEntityProps, TapEntity, renderTapEntity } from './ConnectEntity';
|
|
7
|
+
import { TapIndividual, TapIndividualProps, renderTapIndividual } from './ConnectIndividual';
|
|
8
|
+
import { TapPassword, TapPasswordProps, renderTapPassword } from './ConnectPassword';
|
|
9
|
+
import { TapTax, TapTaxProps, renderTapTax } from './ConnectTax';
|
|
10
|
+
export type { TapConnectProps, ConnectAuthProps, TapBoardProps, TapBrandProps, TapBankProps, TapEntityProps, TapIndividualProps, TapPasswordProps, TapTaxProps };
|
|
11
|
+
export { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax };
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { TapConnect, renderTapConnect } from './Connect';
|
|
2
|
-
|
|
2
|
+
import { TapConnectAuth, renderTapConnectAuth } from './ConnectAuth';
|
|
3
|
+
import { TapBoard, renderTapBoard } from './ConnectBoard';
|
|
4
|
+
import { TapBrand, renderTapBrand } from './ConnectBrand';
|
|
5
|
+
import { TapBank, renderTapBank } from './ConnectBank';
|
|
6
|
+
import { TapEntity, renderTapEntity } from './ConnectEntity';
|
|
7
|
+
import { TapIndividual, renderTapIndividual } from './ConnectIndividual';
|
|
8
|
+
import { TapPassword, renderTapPassword } from './ConnectPassword';
|
|
9
|
+
import { TapTax, renderTapTax } from './ConnectTax';
|
|
10
|
+
export { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax };
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TapConnect, TapConnectProps, renderTapConnect } from './features/Connect';
|
|
1
|
+
import { TapConnect, TapConnectProps, renderTapConnect, ConnectAuthProps, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoardProps, TapBoard, TapBrand, TapBrandProps, renderTapBrand, TapBank, TapBankProps, renderTapBank, TapEntity, TapEntityProps, renderTapEntity, TapIndividual, TapIndividualProps, renderTapIndividual, TapPassword, TapPasswordProps, renderTapPassword, TapTax, TapTaxProps, renderTapTax } from './features/Connect';
|
|
2
2
|
import { Language } from './constants';
|
|
3
|
-
export type { TapConnectProps };
|
|
4
|
-
export { Language, TapConnect, renderTapConnect };
|
|
3
|
+
export type { TapConnectProps, ConnectAuthProps, TapBoardProps, TapBrandProps, TapBankProps, TapEntityProps, TapIndividualProps, TapPasswordProps, TapTaxProps };
|
|
4
|
+
export { Language, TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax };
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { TapConnect, renderTapConnect } from './features/Connect';
|
|
1
|
+
import { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax } from './features/Connect';
|
|
2
2
|
import { Language } from './constants';
|
|
3
|
-
export { Language, TapConnect, renderTapConnect };
|
|
3
|
+
export { Language, TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax };
|
|
4
4
|
window['TapPayments'] = {
|
|
5
5
|
renderTapConnect: renderTapConnect,
|
|
6
|
-
Language: Language
|
|
6
|
+
Language: Language,
|
|
7
|
+
renderTapConnectAuth: renderTapConnectAuth,
|
|
8
|
+
renderTapBoard: renderTapBoard,
|
|
9
|
+
renderTapBrand: renderTapBrand,
|
|
10
|
+
renderTapBank: renderTapBank,
|
|
11
|
+
renderTapEntity: renderTapEntity,
|
|
12
|
+
renderTapPassword: renderTapPassword,
|
|
13
|
+
renderTapTax: renderTapTax
|
|
7
14
|
};
|
package/build/utils/common.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getBaseUrl: (publicKey: string) => "https://connect-mw.tap.company/middleware/" | "https://connect-mw.
|
|
2
|
-
export declare const getRedirectBaseUrl: (publicKey: string) => "https://connect.tap.company/" | "https://connect.
|
|
1
|
+
export declare const getBaseUrl: (publicKey: string) => "https://connect-mw.tap.company/middleware/" | "https://connect-mw.sandbox.tap.company/middleware/";
|
|
2
|
+
export declare const getRedirectBaseUrl: (publicKey: string) => "https://connect.tap.company/" | "https://connect.sandbox.tap.company/";
|
package/build/utils/common.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONNECT_MW_URL,
|
|
1
|
+
import { CONNECT_MW_URL, CONNECT_SANDBOX_MW_URL, CONNECT_SANDBOX_URL, CONNECT_URL } from '../constants';
|
|
2
2
|
var isProd = function (publicKey) {
|
|
3
3
|
return publicKey.includes('pk_live');
|
|
4
4
|
};
|
|
@@ -6,11 +6,11 @@ export var getBaseUrl = function (publicKey) {
|
|
|
6
6
|
if (isProd(publicKey)) {
|
|
7
7
|
return CONNECT_MW_URL;
|
|
8
8
|
}
|
|
9
|
-
return
|
|
9
|
+
return CONNECT_SANDBOX_MW_URL;
|
|
10
10
|
};
|
|
11
11
|
export var getRedirectBaseUrl = function (publicKey) {
|
|
12
12
|
if (isProd(publicKey)) {
|
|
13
13
|
return CONNECT_URL;
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return CONNECT_SANDBOX_URL;
|
|
16
16
|
};
|
package/build/utils/config.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ type ExtraProps = {
|
|
|
3
3
|
verifyToken?: string;
|
|
4
4
|
onBoardButtonClick?: (data: Record<string, string>) => void;
|
|
5
5
|
};
|
|
6
|
-
export declare const wrapLibConfig: ({ publicKey, open, mode, language, country, scope, lead, postURL, onError, onReady, onSuccess, board, verifyToken, domain, onBoardButtonClick, onClose, onCreated, onBoardCompleted, boardMaturity, data, redirectUrl }: ConnectProps & ExtraProps) => OriginalConnectProps;
|
|
6
|
+
export declare const wrapLibConfig: ({ publicKey, open, mode, language, country, scope, lead, postURL, onError, onReady, onSuccess, board, verifyToken, domain, onBoardButtonClick, onClose, onCreated, onBoardCompleted, boardMaturity, data, redirectUrl, features, notification }: ConnectProps & ExtraProps) => OriginalConnectProps;
|
|
7
7
|
export {};
|
package/build/utils/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export var wrapLibConfig = function (_a) {
|
|
2
|
-
var publicKey = _a.publicKey, open = _a.open, mode = _a.mode, language = _a.language, country = _a.country, scope = _a.scope, lead = _a.lead, postURL = _a.postURL, onError = _a.onError, onReady = _a.onReady, onSuccess = _a.onSuccess, board = _a.board, verifyToken = _a.verifyToken, domain = _a.domain, onBoardButtonClick = _a.onBoardButtonClick, onClose = _a.onClose, onCreated = _a.onCreated, onBoardCompleted = _a.onBoardCompleted, boardMaturity = _a.boardMaturity, data = _a.data, redirectUrl = _a.redirectUrl;
|
|
2
|
+
var publicKey = _a.publicKey, open = _a.open, mode = _a.mode, language = _a.language, country = _a.country, scope = _a.scope, lead = _a.lead, postURL = _a.postURL, onError = _a.onError, onReady = _a.onReady, onSuccess = _a.onSuccess, board = _a.board, verifyToken = _a.verifyToken, domain = _a.domain, onBoardButtonClick = _a.onBoardButtonClick, onClose = _a.onClose, onCreated = _a.onCreated, onBoardCompleted = _a.onBoardCompleted, boardMaturity = _a.boardMaturity, data = _a.data, redirectUrl = _a.redirectUrl, features = _a.features, notification = _a.notification;
|
|
3
3
|
return {
|
|
4
4
|
appInfo: {
|
|
5
5
|
name: window.location.hostname || window.location.origin
|
|
@@ -18,6 +18,8 @@ export var wrapLibConfig = function (_a) {
|
|
|
18
18
|
showBoard: board,
|
|
19
19
|
boardMaturity: boardMaturity,
|
|
20
20
|
verifyToken: verifyToken,
|
|
21
|
+
features: features,
|
|
22
|
+
notification: notification,
|
|
21
23
|
onFlowCompleted: function (res) {
|
|
22
24
|
onSuccess && onSuccess(res);
|
|
23
25
|
},
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { ConnectProps } from '../@types';
|
|
2
2
|
export declare const validateConnectProps: (props: ConnectProps) => void;
|
|
3
|
+
export declare const validateConnectAuthProps: (props: Pick<ConnectProps, 'open' | 'domain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'lead' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose'>) => void;
|
|
4
|
+
export declare const validateBoardProps: (props: Pick<ConnectProps, 'open' | 'domain' | 'scope' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'boardId'>) => void;
|
|
5
|
+
export declare const validateBoardOtherKitsProps: (props: Pick<ConnectProps, "open" | "domain" | "publicKey" | "postURL" | "country" | "language" | "onSuccess" | "onError" | "onReady" | "onClose" | "scope"> & {
|
|
6
|
+
verifyToken: string;
|
|
7
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
8
|
+
}) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Language } from '../constants';
|
|
2
2
|
export var validateConnectProps = function (props) {
|
|
3
|
-
var mode = props.mode, publicKey = props.publicKey, mature = props.mature,
|
|
3
|
+
var mode = props.mode, publicKey = props.publicKey, mature = props.mature, language = props.language, scope = props.scope, open = props.open, domain = props.domain, board = props.board, lead = props.lead, onClose = props.onClose, onCreated = props.onCreated, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, redirectUrl = props.redirectUrl;
|
|
4
4
|
if (!mode) {
|
|
5
5
|
throw new Error('mode is required');
|
|
6
6
|
}
|
|
@@ -10,9 +10,6 @@ export var validateConnectProps = function (props) {
|
|
|
10
10
|
if (!publicKey) {
|
|
11
11
|
throw new Error('publicKey is required');
|
|
12
12
|
}
|
|
13
|
-
if (!country) {
|
|
14
|
-
throw new Error('country is required');
|
|
15
|
-
}
|
|
16
13
|
if (!language) {
|
|
17
14
|
throw new Error('language is required');
|
|
18
15
|
}
|
|
@@ -59,3 +56,135 @@ export var validateConnectProps = function (props) {
|
|
|
59
56
|
throw new Error('onSuccess must be a function');
|
|
60
57
|
}
|
|
61
58
|
};
|
|
59
|
+
export var validateConnectAuthProps = function (props) {
|
|
60
|
+
var publicKey = props.publicKey, country = props.country, language = props.language, open = props.open, domain = props.domain, lead = props.lead, onClose = props.onClose, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, data = props.data;
|
|
61
|
+
if (!data) {
|
|
62
|
+
throw new Error('data is required');
|
|
63
|
+
}
|
|
64
|
+
if (!Array.isArray(data)) {
|
|
65
|
+
throw new Error('data must be an array');
|
|
66
|
+
}
|
|
67
|
+
if (!publicKey) {
|
|
68
|
+
throw new Error('publicKey is required');
|
|
69
|
+
}
|
|
70
|
+
if (typeof country !== 'string') {
|
|
71
|
+
throw new Error('country should be from type string');
|
|
72
|
+
}
|
|
73
|
+
if (!language) {
|
|
74
|
+
throw new Error('language is required');
|
|
75
|
+
}
|
|
76
|
+
if (![Language.AR, Language.EN].includes(language)) {
|
|
77
|
+
throw new Error('you can only use AR or EN for language');
|
|
78
|
+
}
|
|
79
|
+
if (!domain) {
|
|
80
|
+
throw new Error('domain is required');
|
|
81
|
+
}
|
|
82
|
+
if (typeof open !== 'boolean') {
|
|
83
|
+
throw new Error('open is required, and must be a boolean');
|
|
84
|
+
}
|
|
85
|
+
if (typeof lead !== 'undefined' && typeof lead !== 'string') {
|
|
86
|
+
throw new Error('lead must be a string');
|
|
87
|
+
}
|
|
88
|
+
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
89
|
+
throw new Error('postURL must be a string');
|
|
90
|
+
}
|
|
91
|
+
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
92
|
+
throw new Error('onClose must be a function');
|
|
93
|
+
}
|
|
94
|
+
if (typeof onError !== 'undefined' && typeof onError !== 'function') {
|
|
95
|
+
throw new Error('onError must be a function');
|
|
96
|
+
}
|
|
97
|
+
if (typeof onReady !== 'undefined' && typeof onReady !== 'function') {
|
|
98
|
+
throw new Error('onReady must be a function');
|
|
99
|
+
}
|
|
100
|
+
if (typeof onSuccess !== 'undefined' && typeof onSuccess !== 'function') {
|
|
101
|
+
throw new Error('onSuccess must be a function');
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
export var validateBoardProps = function (props) {
|
|
105
|
+
var publicKey = props.publicKey, country = props.country, scope = props.scope, language = props.language, open = props.open, domain = props.domain, onClose = props.onClose, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, boardId = props.boardId;
|
|
106
|
+
if (!publicKey) {
|
|
107
|
+
throw new Error('publicKey is required');
|
|
108
|
+
}
|
|
109
|
+
if (typeof country !== 'string') {
|
|
110
|
+
throw new Error('country should be from type string');
|
|
111
|
+
}
|
|
112
|
+
if (!language) {
|
|
113
|
+
throw new Error('language is required');
|
|
114
|
+
}
|
|
115
|
+
if (!scope) {
|
|
116
|
+
throw new Error('scope is required');
|
|
117
|
+
}
|
|
118
|
+
if (![Language.AR, Language.EN].includes(language)) {
|
|
119
|
+
throw new Error('you can only use AR or EN for language');
|
|
120
|
+
}
|
|
121
|
+
if (!domain) {
|
|
122
|
+
throw new Error('domain is required');
|
|
123
|
+
}
|
|
124
|
+
if (!boardId) {
|
|
125
|
+
throw new Error('board id is required');
|
|
126
|
+
}
|
|
127
|
+
if (typeof open !== 'boolean') {
|
|
128
|
+
throw new Error('open is required, and must be a boolean');
|
|
129
|
+
}
|
|
130
|
+
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
131
|
+
throw new Error('postURL must be a string');
|
|
132
|
+
}
|
|
133
|
+
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
134
|
+
throw new Error('onClose must be a function');
|
|
135
|
+
}
|
|
136
|
+
if (typeof onError !== 'undefined' && typeof onError !== 'function') {
|
|
137
|
+
throw new Error('onError must be a function');
|
|
138
|
+
}
|
|
139
|
+
if (typeof onReady !== 'undefined' && typeof onReady !== 'function') {
|
|
140
|
+
throw new Error('onReady must be a function');
|
|
141
|
+
}
|
|
142
|
+
if (typeof onSuccess !== 'undefined' && typeof onSuccess !== 'function') {
|
|
143
|
+
throw new Error('onSuccess must be a function');
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
export var validateBoardOtherKitsProps = function (props) {
|
|
147
|
+
var publicKey = props.publicKey, country = props.country, scope = props.scope, language = props.language, open = props.open, domain = props.domain, onClose = props.onClose, onError = props.onError, onReady = props.onReady, onSuccess = props.onSuccess, postURL = props.postURL, verifyToken = props.verifyToken, onBoardButtonClick = props.onBoardButtonClick;
|
|
148
|
+
if (!publicKey) {
|
|
149
|
+
throw new Error('publicKey is required');
|
|
150
|
+
}
|
|
151
|
+
if (typeof country !== 'string') {
|
|
152
|
+
throw new Error('country should be from type string');
|
|
153
|
+
}
|
|
154
|
+
if (!language) {
|
|
155
|
+
throw new Error('language is required');
|
|
156
|
+
}
|
|
157
|
+
if (!scope) {
|
|
158
|
+
throw new Error('scope is required');
|
|
159
|
+
}
|
|
160
|
+
if (![Language.AR, Language.EN].includes(language)) {
|
|
161
|
+
throw new Error('you can only use AR or EN for language');
|
|
162
|
+
}
|
|
163
|
+
if (!domain) {
|
|
164
|
+
throw new Error('domain is required');
|
|
165
|
+
}
|
|
166
|
+
if (!verifyToken) {
|
|
167
|
+
throw new Error('token is required');
|
|
168
|
+
}
|
|
169
|
+
if (typeof open !== 'boolean') {
|
|
170
|
+
throw new Error('open is required, and must be a boolean');
|
|
171
|
+
}
|
|
172
|
+
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
173
|
+
throw new Error('postURL must be a string');
|
|
174
|
+
}
|
|
175
|
+
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
176
|
+
throw new Error('onClose must be a function');
|
|
177
|
+
}
|
|
178
|
+
if (typeof onError !== 'undefined' && typeof onError !== 'function') {
|
|
179
|
+
throw new Error('onError must be a function');
|
|
180
|
+
}
|
|
181
|
+
if (typeof onReady !== 'undefined' && typeof onReady !== 'function') {
|
|
182
|
+
throw new Error('onReady must be a function');
|
|
183
|
+
}
|
|
184
|
+
if (typeof onSuccess !== 'undefined' && typeof onSuccess !== 'function') {
|
|
185
|
+
throw new Error('onSuccess must be a function');
|
|
186
|
+
}
|
|
187
|
+
if (typeof onBoardButtonClick !== 'undefined' && typeof onBoardButtonClick !== 'function') {
|
|
188
|
+
throw new Error('onBoardButtonClick must be a function');
|
|
189
|
+
}
|
|
190
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/connect",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.9",
|
|
4
4
|
"description": "Tap Connect",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"module": "build/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"
|
|
13
|
+
"prepare": "npx husky install",
|
|
14
14
|
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
|
|
15
15
|
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
|
|
16
16
|
"lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
|