@tap-payments/connect 2.10.9-development → 2.10.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 +2 -2
- package/build/@types/config.d.ts +0 -1
- package/build/@types/index.d.ts +2 -0
- 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 +6 -12
- package/build/features/Connect/ConnectAuth.d.ts +2 -2
- package/build/features/Connect/ConnectAuth.js +2 -1
- package/build/features/Connect/ConnectBank.d.ts +2 -2
- package/build/features/Connect/ConnectBank.js +2 -1
- package/build/features/Connect/ConnectBoard.d.ts +2 -2
- package/build/features/Connect/ConnectBoard.js +2 -1
- package/build/features/Connect/ConnectBrand.d.ts +2 -2
- package/build/features/Connect/ConnectBrand.js +2 -1
- package/build/features/Connect/ConnectEntity.d.ts +2 -2
- package/build/features/Connect/ConnectEntity.js +2 -1
- package/build/features/Connect/ConnectExpress.js +5 -9
- package/build/features/Connect/ConnectIndividual.d.ts +2 -2
- package/build/features/Connect/ConnectIndividual.js +2 -1
- package/build/features/Connect/ConnectPassword.d.ts +2 -2
- package/build/features/Connect/ConnectPassword.js +2 -1
- package/build/features/Connect/ConnectTax.d.ts +2 -2
- package/build/features/Connect/ConnectTax.js +2 -1
- package/build/features/Connect/index.d.ts +2 -3
- package/build/features/Connect/index.js +1 -2
- package/build/index.d.ts +3 -3
- package/build/index.js +3 -4
- 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 +2 -1
- package/build/utils/validation.d.ts +3 -3
- package/build/utils/validation.js +16 -4
- package/package.json +3 -3
- package/build/features/Connect/ConnectTerminal.d.ts +0 -12
- package/build/features/Connect/ConnectTerminal.js +0 -118
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ const ConnectComponent = () => {
|
|
|
85
85
|
content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,shrink-to-fit=no"
|
|
86
86
|
/>
|
|
87
87
|
<title>Auth-JsConnect</title>
|
|
88
|
-
<script src="https://tap-sdks
|
|
88
|
+
<script src="https://cdn.tap.company/tap-sdks/connect/build-2.10.9/main.js"></script>
|
|
89
89
|
</head>
|
|
90
90
|
<body>
|
|
91
91
|
<div id="root"></div>
|
|
@@ -106,7 +106,7 @@ const ConnectComponent = () => {
|
|
|
106
106
|
mature: false,
|
|
107
107
|
board: true,
|
|
108
108
|
boardMaturity: false,
|
|
109
|
-
|
|
109
|
+
mode: "popup",
|
|
110
110
|
open: true,
|
|
111
111
|
postURL: 'https://api.example.com/post',
|
|
112
112
|
redirectUrl: '',
|
package/build/@types/config.d.ts
CHANGED
package/build/@types/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface ConnectProps {
|
|
|
21
21
|
settingData?: SettingAsyncData;
|
|
22
22
|
features?: ConnectFeatures;
|
|
23
23
|
notification?: Notification;
|
|
24
|
+
region?: string;
|
|
24
25
|
onError?: (err: Error) => void;
|
|
25
26
|
onReady?: () => void;
|
|
26
27
|
onClose?: () => void;
|
|
@@ -47,6 +48,7 @@ export interface OriginalConnectProps {
|
|
|
47
48
|
features?: ConnectFeatures;
|
|
48
49
|
notification?: Notification;
|
|
49
50
|
verifyToken?: string;
|
|
51
|
+
region?: string;
|
|
50
52
|
onFlowCompleted: (res: object, headers?: Record<string, string>) => void;
|
|
51
53
|
onError: (err: any) => void;
|
|
52
54
|
onStepCompleted?: (name: string, info: any) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect
|
|
1
|
+
export declare const CDN_LIBRARY_BASE_URL = "https://cdn.tap.company/tap-sdks/auth-jsconnect/build-2.10.10";
|
|
2
2
|
export declare const Maturity: {
|
|
3
3
|
readonly FULL: "full";
|
|
4
4
|
readonly EXPRESS: "express";
|
|
@@ -8,7 +8,10 @@ export declare const Language: {
|
|
|
8
8
|
readonly AR: "ar";
|
|
9
9
|
};
|
|
10
10
|
export declare const CONNECT_URL = "https://connect.tap.company/";
|
|
11
|
+
export declare const CONNECT_BETA_URL = "https://connect.beta.tap.company/";
|
|
12
|
+
export declare const CONNECT_SANDBOX_URL = "https://connect.sandbox.tap.company/";
|
|
11
13
|
export declare const CONNECT_DEV_URL = "https://connect.dev.tap.company/";
|
|
12
14
|
export declare const CONNECT_MW_URL = "https://connect-mw.tap.company/middleware/";
|
|
13
|
-
export declare const
|
|
15
|
+
export declare const CONNECT_MW_BETA_URL = "https://connect-mw.beta.tap.company/middleware/";
|
|
14
16
|
export declare const CONNECT_SANDBOX_MW_URL = "https://connect-mw.sandbox.tap.company/middleware/";
|
|
17
|
+
export declare const CONNECT_DEV_MW_URL = "https://connect-mw.dev.tap.company/middleware/";
|
package/build/constants/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export var CDN_LIBRARY_BASE_URL = 'https://auth-jsconnect
|
|
1
|
+
export var CDN_LIBRARY_BASE_URL = 'https://cdn.tap.company/tap-sdks/auth-jsconnect/build-2.10.10';
|
|
2
2
|
export var Maturity = {
|
|
3
3
|
FULL: 'full',
|
|
4
4
|
EXPRESS: 'express'
|
|
@@ -8,7 +8,10 @@ export var Language = {
|
|
|
8
8
|
AR: 'ar'
|
|
9
9
|
};
|
|
10
10
|
export var CONNECT_URL = 'https://connect.tap.company/';
|
|
11
|
+
export var CONNECT_BETA_URL = 'https://connect.beta.tap.company/';
|
|
12
|
+
export var CONNECT_SANDBOX_URL = 'https://connect.sandbox.tap.company/';
|
|
11
13
|
export var CONNECT_DEV_URL = 'https://connect.dev.tap.company/';
|
|
12
14
|
export var CONNECT_MW_URL = 'https://connect-mw.tap.company/middleware/';
|
|
13
|
-
export var
|
|
15
|
+
export var CONNECT_MW_BETA_URL = 'https://connect-mw.beta.tap.company/middleware/';
|
|
14
16
|
export var CONNECT_SANDBOX_MW_URL = 'https://connect-mw.sandbox.tap.company/middleware/';
|
|
17
|
+
export var CONNECT_DEV_MW_URL = 'https://connect-mw.dev.tap.company/middleware/';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
3
|
export type ConnectProps = Omit<ConnectAttrs, 'elementId'>;
|
|
4
|
-
export declare const TapConnect: React.MemoExoticComponent<(props: ConnectAttrs) => JSX.Element>;
|
|
4
|
+
export declare const TapConnect: React.MemoExoticComponent<(props: ConnectAttrs) => import("react/jsx-runtime").JSX.Element>;
|
|
5
5
|
export declare const renderTapConnect: (props: ConnectProps, elementId: string) => Promise<any>;
|
|
@@ -87,14 +87,14 @@ export var TapConnect = React.memo(function (props) {
|
|
|
87
87
|
});
|
|
88
88
|
var tapConnectInstance = null;
|
|
89
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,
|
|
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
91
|
return __generator(this, function (_c) {
|
|
92
92
|
switch (_c.label) {
|
|
93
93
|
case 0:
|
|
94
94
|
props.mode = props.mode || 'popup';
|
|
95
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
96
|
if (!(mode === 'page')) return [3, 2];
|
|
97
|
-
payload = __assign(__assign(__assign(__assign(
|
|
97
|
+
payload = __assign(__assign(__assign(__assign({ operator: {
|
|
98
98
|
public_key: publicKey
|
|
99
99
|
}, scope: scope }, (AuthData && {
|
|
100
100
|
data: AuthData
|
|
@@ -113,7 +113,7 @@ export var renderTapConnect = function (props, elementId) { return __awaiter(voi
|
|
|
113
113
|
post: {
|
|
114
114
|
url: postURL
|
|
115
115
|
}
|
|
116
|
-
}))
|
|
116
|
+
}));
|
|
117
117
|
return [4, generateConfigToken(payload)];
|
|
118
118
|
case 1:
|
|
119
119
|
_a = _c.sent(), data = _a.data, publicKeyValue = _a.publicKey;
|
|
@@ -123,19 +123,13 @@ export var renderTapConnect = function (props, elementId) { return __awaiter(voi
|
|
|
123
123
|
}
|
|
124
124
|
_b = data || {}, token = _b.token, connect = _b.connect;
|
|
125
125
|
baseUrl = getRedirectBaseUrl(publicKeyValue || '');
|
|
126
|
-
countryCode = (country !== null && country !== void 0 ? country : '').toLowerCase();
|
|
127
126
|
if (!mature || scope === 'auth') {
|
|
128
|
-
|
|
129
|
-
if (country)
|
|
130
|
-
fallbackURL_1 += "&country_code=".concat(country);
|
|
131
|
-
url_1 = (connect === null || connect === void 0 ? void 0 : connect.url) || fallbackURL_1;
|
|
127
|
+
url_1 = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl, "?config_token=").concat(token);
|
|
132
128
|
window.location.href = url_1;
|
|
133
129
|
return [2];
|
|
134
130
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
fallbackURL += "&country_code=".concat(country);
|
|
138
|
-
url = (connect === null || connect === void 0 ? void 0 : connect.url) || fallbackURL;
|
|
131
|
+
countryCode = country.toLowerCase();
|
|
132
|
+
url = (connect === null || connect === void 0 ? void 0 : connect.url) || "".concat(baseUrl).concat(countryCode, "?config_token=").concat(token);
|
|
139
133
|
window.location.href = url;
|
|
140
134
|
return [2];
|
|
141
135
|
case 2:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
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'>;
|
|
3
|
+
export type ConnectAuthProps = Pick<ConnectAttrs, 'open' | 'domain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'lead' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'features' | 'region'>;
|
|
4
4
|
export declare const TapConnectAuth: React.MemoExoticComponent<(props: ConnectAuthProps & {
|
|
5
5
|
id?: string;
|
|
6
|
-
}) => JSX.Element>;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
7
7
|
export declare const renderTapConnectAuth: (props: ConnectAuthProps, elementId: string) => Promise<any>;
|
|
@@ -84,7 +84,8 @@ var ConnectAuth = function (props) {
|
|
|
84
84
|
onError: props.onError,
|
|
85
85
|
onReady: props.onReady,
|
|
86
86
|
onClose: props.onClose,
|
|
87
|
-
features: props.features
|
|
87
|
+
features: props.features,
|
|
88
|
+
region: props.region
|
|
88
89
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-auth-lib-id').unmount;
|
|
89
90
|
return function () {
|
|
90
91
|
unmount();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
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'>;
|
|
3
|
+
type BankProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features' | 'region'>;
|
|
4
4
|
export type TapBankProps = BankProps & {
|
|
5
5
|
verifyToken: string;
|
|
6
6
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const TapBank: React.MemoExoticComponent<(props: TapBankProps & {
|
|
9
9
|
id?: string;
|
|
10
|
-
}) => JSX.Element>;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export declare const renderTapBank: (props: TapBankProps, elementId: string) => Promise<any>;
|
|
12
12
|
export {};
|
|
@@ -87,7 +87,8 @@ var Bank = function (props) {
|
|
|
87
87
|
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
88
|
settingData: props.settingData,
|
|
89
89
|
onSettingFetched: props.onSettingFetched,
|
|
90
|
-
features: props.features
|
|
90
|
+
features: props.features,
|
|
91
|
+
region: props.region
|
|
91
92
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-bank-lib-id').unmount;
|
|
92
93
|
return function () {
|
|
93
94
|
unmount();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
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'>;
|
|
3
|
+
export type BoardProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'boardId' | 'settingData' | 'onSettingFetched' | 'features' | 'region'>;
|
|
4
4
|
export type TapBoardProps = BoardProps & {
|
|
5
5
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
6
6
|
};
|
|
7
7
|
export declare const TapBoard: React.MemoExoticComponent<(props: TapBoardProps & {
|
|
8
8
|
id?: string;
|
|
9
|
-
}) => JSX.Element>;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
10
10
|
export declare const renderTapBoard: (props: TapBoardProps, elementId: string) => Promise<any>;
|
|
@@ -86,7 +86,8 @@ var Board = function (props) {
|
|
|
86
86
|
onBoardButtonClick: props.onBoardButtonClick,
|
|
87
87
|
settingData: props.settingData,
|
|
88
88
|
onSettingFetched: props.onSettingFetched,
|
|
89
|
-
features: props.features
|
|
89
|
+
features: props.features,
|
|
90
|
+
region: props.region
|
|
90
91
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-board-lib-id').unmount;
|
|
91
92
|
return function () {
|
|
92
93
|
unmount();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
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'>;
|
|
3
|
+
type BrandProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features' | 'region'>;
|
|
4
4
|
export type TapBrandProps = BrandProps & {
|
|
5
5
|
verifyToken: string;
|
|
6
6
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const TapBrand: React.MemoExoticComponent<(props: TapBrandProps & {
|
|
9
9
|
id?: string;
|
|
10
|
-
}) => JSX.Element>;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export declare const renderTapBrand: (props: TapBrandProps, elementId: string) => Promise<any>;
|
|
12
12
|
export {};
|
|
@@ -87,7 +87,8 @@ var Brand = function (props) {
|
|
|
87
87
|
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
88
|
settingData: props.settingData,
|
|
89
89
|
onSettingFetched: props.onSettingFetched,
|
|
90
|
-
features: props.features
|
|
90
|
+
features: props.features,
|
|
91
|
+
region: props.region
|
|
91
92
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-brand-lib-id').unmount;
|
|
92
93
|
return function () {
|
|
93
94
|
unmount();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
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'>;
|
|
3
|
+
type EntityProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features' | 'region'>;
|
|
4
4
|
export type TapEntityProps = EntityProps & {
|
|
5
5
|
verifyToken: string;
|
|
6
6
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const TapEntity: React.MemoExoticComponent<(props: TapEntityProps & {
|
|
9
9
|
id?: string;
|
|
10
|
-
}) => JSX.Element>;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export declare const renderTapEntity: (props: TapEntityProps, elementId: string) => Promise<any>;
|
|
12
12
|
export {};
|
|
@@ -87,7 +87,8 @@ var Entity = function (props) {
|
|
|
87
87
|
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
88
|
settingData: props.settingData,
|
|
89
89
|
onSettingFetched: props.onSettingFetched,
|
|
90
|
-
features: props.features
|
|
90
|
+
features: props.features,
|
|
91
|
+
region: props.region
|
|
91
92
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-entity-lib-id').unmount;
|
|
92
93
|
return function () {
|
|
93
94
|
unmount();
|
|
@@ -12,23 +12,19 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import { wrapLibConfig } from '../../utils';
|
|
14
14
|
var ConnectExpress = function (props) {
|
|
15
|
-
var _a;
|
|
16
|
-
var _b = React.useState(''),
|
|
17
|
-
var _c = React.useState('express'), name = _c[0], setName = _c[1];
|
|
18
|
-
var _d = React.useState((_a = props.country) !== null && _a !== void 0 ? _a : ''), busCountryCode = _d[0], setBusCountryCode = _d[1];
|
|
15
|
+
var _a = React.useState(''), token = _a[0], setToken = _a[1];
|
|
16
|
+
var _b = React.useState('express'), name = _b[0], setName = _b[1];
|
|
19
17
|
var onButtonClick = function (_a) {
|
|
20
|
-
var name = _a.name, token = _a.token
|
|
18
|
+
var name = _a.name, token = _a.token;
|
|
21
19
|
setToken(token);
|
|
22
20
|
setName(name);
|
|
23
|
-
if (countryCode)
|
|
24
|
-
setBusCountryCode(countryCode);
|
|
25
21
|
};
|
|
26
|
-
var
|
|
22
|
+
var _c = window['TapAuth'], renderConnectExpressLib = _c.renderConnectExpressLib, renderIndividualLib = _c.renderIndividualLib, renderBankLib = _c.renderBankLib, renderTaxLib = _c.renderTaxLib, renderEntityLib = _c.renderEntityLib, renderBrandLib = _c.renderBrandLib;
|
|
27
23
|
var elementId = props.elementId;
|
|
28
24
|
var unmountComponent = function () { };
|
|
29
25
|
React.useEffect(function () {
|
|
30
26
|
console.log('rendering: ', name);
|
|
31
|
-
var config = wrapLibConfig(__assign(__assign({}, props), {
|
|
27
|
+
var config = wrapLibConfig(__assign(__assign({}, props), { verifyToken: token, onBoardButtonClick: onButtonClick }));
|
|
32
28
|
switch (name) {
|
|
33
29
|
case 'brand':
|
|
34
30
|
unmountComponent();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
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'>;
|
|
3
|
+
type IndividualProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features' | 'region'>;
|
|
4
4
|
export type TapIndividualProps = IndividualProps & {
|
|
5
5
|
verifyToken: string;
|
|
6
6
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const TapIndividual: React.MemoExoticComponent<(props: TapIndividualProps & {
|
|
9
9
|
id?: string;
|
|
10
|
-
}) => JSX.Element>;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export declare const renderTapIndividual: (props: TapIndividualProps, elementId: string) => Promise<any>;
|
|
12
12
|
export {};
|
|
@@ -87,7 +87,8 @@ var Individual = function (props) {
|
|
|
87
87
|
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
88
|
settingData: props.settingData,
|
|
89
89
|
onSettingFetched: props.onSettingFetched,
|
|
90
|
-
features: props.features
|
|
90
|
+
features: props.features,
|
|
91
|
+
region: props.region
|
|
91
92
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-individual-lib-id').unmount;
|
|
92
93
|
return function () {
|
|
93
94
|
unmount();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
-
type PasswordProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
3
|
+
type PasswordProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features' | 'region'>;
|
|
4
4
|
export type TapPasswordProps = PasswordProps & {
|
|
5
5
|
verifyToken: string;
|
|
6
6
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const TapPassword: React.MemoExoticComponent<(props: TapPasswordProps & {
|
|
9
9
|
id?: string;
|
|
10
|
-
}) => JSX.Element>;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export declare const renderTapPassword: (props: TapPasswordProps, elementId: string) => Promise<any>;
|
|
12
12
|
export {};
|
|
@@ -87,7 +87,8 @@ var Password = function (props) {
|
|
|
87
87
|
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
88
|
settingData: props.settingData,
|
|
89
89
|
onSettingFetched: props.onSettingFetched,
|
|
90
|
-
features: props.features
|
|
90
|
+
features: props.features,
|
|
91
|
+
region: props.region
|
|
91
92
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-password-lib-id').unmount;
|
|
92
93
|
return function () {
|
|
93
94
|
unmount();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
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'>;
|
|
3
|
+
type TaxProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features' | 'region'>;
|
|
4
4
|
export type TapTaxProps = TaxProps & {
|
|
5
5
|
verifyToken: string;
|
|
6
6
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const TapTax: React.MemoExoticComponent<(props: TapTaxProps & {
|
|
9
9
|
id?: string;
|
|
10
|
-
}) => JSX.Element>;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export declare const renderTapTax: (props: TapTaxProps, elementId: string) => Promise<any>;
|
|
12
12
|
export {};
|
|
@@ -87,7 +87,8 @@ var Tax = function (props) {
|
|
|
87
87
|
onBoardButtonClick: props.onBoardButtonClick,
|
|
88
88
|
settingData: props.settingData,
|
|
89
89
|
onSettingFetched: props.onSettingFetched,
|
|
90
|
-
features: props.features
|
|
90
|
+
features: props.features,
|
|
91
|
+
region: props.region
|
|
91
92
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-tax-lib-id').unmount;
|
|
92
93
|
return function () {
|
|
93
94
|
unmount();
|
|
@@ -7,6 +7,5 @@ import { TapEntityProps, TapEntity, renderTapEntity } from './ConnectEntity';
|
|
|
7
7
|
import { TapIndividual, TapIndividualProps, renderTapIndividual } from './ConnectIndividual';
|
|
8
8
|
import { TapPassword, TapPasswordProps, renderTapPassword } from './ConnectPassword';
|
|
9
9
|
import { TapTax, TapTaxProps, renderTapTax } from './ConnectTax';
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax, TapTerminal, renderTapTerminal };
|
|
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 };
|
|
@@ -7,5 +7,4 @@ import { TapEntity, renderTapEntity } from './ConnectEntity';
|
|
|
7
7
|
import { TapIndividual, renderTapIndividual } from './ConnectIndividual';
|
|
8
8
|
import { TapPassword, renderTapPassword } from './ConnectPassword';
|
|
9
9
|
import { TapTax, renderTapTax } from './ConnectTax';
|
|
10
|
-
|
|
11
|
-
export { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax, TapTerminal, renderTapTerminal };
|
|
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, ConnectAuthProps, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoardProps, TapBoard, TapBrand, TapBrandProps, renderTapBrand, TapBank, TapBankProps, renderTapBank, TapEntity, TapEntityProps, renderTapEntity, TapIndividual, TapIndividualProps, renderTapIndividual, TapPassword, TapPasswordProps, renderTapPassword, TapTax, TapTaxProps, renderTapTax
|
|
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, 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
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax
|
|
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, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand, TapBank, renderTapBank, TapEntity, renderTapEntity, TapIndividual, renderTapIndividual, TapPassword, renderTapPassword, TapTax, renderTapTax
|
|
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
6
|
Language: Language,
|
|
@@ -10,6 +10,5 @@ window['TapPayments'] = {
|
|
|
10
10
|
renderTapBank: renderTapBank,
|
|
11
11
|
renderTapEntity: renderTapEntity,
|
|
12
12
|
renderTapPassword: renderTapPassword,
|
|
13
|
-
renderTapTax: renderTapTax
|
|
14
|
-
renderTapTerminal: renderTapTerminal
|
|
13
|
+
renderTapTax: renderTapTax
|
|
15
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, features, notification }: 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, region }: 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, features = _a.features, notification = _a.notification;
|
|
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, region = _a.region;
|
|
3
3
|
return {
|
|
4
4
|
appInfo: {
|
|
5
5
|
name: window.location.hostname || window.location.origin
|
|
@@ -20,6 +20,7 @@ export var wrapLibConfig = function (_a) {
|
|
|
20
20
|
verifyToken: verifyToken,
|
|
21
21
|
features: features,
|
|
22
22
|
notification: notification,
|
|
23
|
+
region: region,
|
|
23
24
|
onFlowCompleted: function (res) {
|
|
24
25
|
onSuccess && onSuccess(res);
|
|
25
26
|
},
|
|
@@ -1,8 +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"> & {
|
|
3
|
+
export declare const validateConnectAuthProps: (props: Pick<ConnectProps, 'open' | 'domain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'lead' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'region'>) => void;
|
|
4
|
+
export declare const validateBoardProps: (props: Pick<ConnectProps, 'open' | 'domain' | 'scope' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'boardId' | 'region'>) => void;
|
|
5
|
+
export declare const validateBoardOtherKitsProps: (props: Pick<ConnectProps, "open" | "domain" | "publicKey" | "postURL" | "country" | "language" | "onSuccess" | "onError" | "onReady" | "onClose" | "region" | "scope"> & {
|
|
6
6
|
verifyToken: string;
|
|
7
7
|
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
8
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, 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;
|
|
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, region = props.region;
|
|
4
4
|
if (!mode) {
|
|
5
5
|
throw new Error('mode is required');
|
|
6
6
|
}
|
|
@@ -40,6 +40,9 @@ export var validateConnectProps = function (props) {
|
|
|
40
40
|
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
41
41
|
throw new Error('postURL must be a string');
|
|
42
42
|
}
|
|
43
|
+
if (typeof region !== 'undefined' && typeof region !== 'string') {
|
|
44
|
+
throw new Error('region must be a string');
|
|
45
|
+
}
|
|
43
46
|
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
44
47
|
throw new Error('onClose must be a function');
|
|
45
48
|
}
|
|
@@ -57,7 +60,7 @@ export var validateConnectProps = function (props) {
|
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
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;
|
|
63
|
+
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, region = props.region;
|
|
61
64
|
if (!data) {
|
|
62
65
|
throw new Error('data is required');
|
|
63
66
|
}
|
|
@@ -88,6 +91,9 @@ export var validateConnectAuthProps = function (props) {
|
|
|
88
91
|
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
89
92
|
throw new Error('postURL must be a string');
|
|
90
93
|
}
|
|
94
|
+
if (typeof region !== 'undefined' && typeof region !== 'string') {
|
|
95
|
+
throw new Error('region must be a string');
|
|
96
|
+
}
|
|
91
97
|
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
92
98
|
throw new Error('onClose must be a function');
|
|
93
99
|
}
|
|
@@ -102,7 +108,7 @@ export var validateConnectAuthProps = function (props) {
|
|
|
102
108
|
}
|
|
103
109
|
};
|
|
104
110
|
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;
|
|
111
|
+
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, region = props.region;
|
|
106
112
|
if (!publicKey) {
|
|
107
113
|
throw new Error('publicKey is required');
|
|
108
114
|
}
|
|
@@ -130,6 +136,9 @@ export var validateBoardProps = function (props) {
|
|
|
130
136
|
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
131
137
|
throw new Error('postURL must be a string');
|
|
132
138
|
}
|
|
139
|
+
if (typeof region !== 'undefined' && typeof region !== 'string') {
|
|
140
|
+
throw new Error('region must be a string');
|
|
141
|
+
}
|
|
133
142
|
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
134
143
|
throw new Error('onClose must be a function');
|
|
135
144
|
}
|
|
@@ -144,7 +153,7 @@ export var validateBoardProps = function (props) {
|
|
|
144
153
|
}
|
|
145
154
|
};
|
|
146
155
|
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;
|
|
156
|
+
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, region = props.region;
|
|
148
157
|
if (!publicKey) {
|
|
149
158
|
throw new Error('publicKey is required');
|
|
150
159
|
}
|
|
@@ -172,6 +181,9 @@ export var validateBoardOtherKitsProps = function (props) {
|
|
|
172
181
|
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
173
182
|
throw new Error('postURL must be a string');
|
|
174
183
|
}
|
|
184
|
+
if (typeof region !== 'undefined' && typeof region !== 'string') {
|
|
185
|
+
throw new Error('region must be a string');
|
|
186
|
+
}
|
|
175
187
|
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
176
188
|
throw new Error('onClose must be a function');
|
|
177
189
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/connect",
|
|
3
|
-
"version": "2.10.9
|
|
3
|
+
"version": "2.10.9",
|
|
4
4
|
"description": "Tap Connect",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"module": "build/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
21
21
|
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
22
22
|
"ts:build": "rm -rf build && tsc && yarn tsc:alias && yarn copy:files",
|
|
23
|
-
"push": "npm publish --access public
|
|
23
|
+
"push": "npm publish --access public"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [],
|
|
26
26
|
"author": {
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"husky": "^8.0.1",
|
|
61
61
|
"lint-staged": "^13.0.3",
|
|
62
62
|
"mini-css-extract-plugin": "^2.6.1",
|
|
63
|
-
"prettier": "
|
|
63
|
+
"prettier": "2.7.1",
|
|
64
64
|
"sass": "^1.53.0",
|
|
65
65
|
"sass-loader": "^13.0.2",
|
|
66
66
|
"style-loader": "^3.3.1",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
-
type TerminalProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'board' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'settingData' | 'onSettingFetched' | 'features'>;
|
|
4
|
-
export type TapTerminalProps = TerminalProps & {
|
|
5
|
-
verifyToken: string;
|
|
6
|
-
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const TapTerminal: React.MemoExoticComponent<(props: TapTerminalProps & {
|
|
9
|
-
id?: string;
|
|
10
|
-
}) => JSX.Element>;
|
|
11
|
-
export declare const renderTapTerminal: (props: TapTerminalProps, elementId: string) => Promise<any>;
|
|
12
|
-
export {};
|
|
@@ -1,118 +0,0 @@
|
|
|
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 Terminal = 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-terminal-js is ready!');
|
|
60
|
-
if (status === 'error')
|
|
61
|
-
console.error('connect-terminal-js failed to load!');
|
|
62
|
-
}, [status]);
|
|
63
|
-
React.useEffect(function () {
|
|
64
|
-
var _a;
|
|
65
|
-
if (status !== 'ready')
|
|
66
|
-
return;
|
|
67
|
-
var renderTerminalLib = window['TapAuth'].renderTerminalLib;
|
|
68
|
-
var unmount = renderTerminalLib({
|
|
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-terminal-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-terminal-lib-id' });
|
|
99
|
-
};
|
|
100
|
-
export var TapTerminal = React.memo(function (props) {
|
|
101
|
-
validateBoardOtherKitsProps(props);
|
|
102
|
-
return _jsx(Terminal, __assign({}, props));
|
|
103
|
-
});
|
|
104
|
-
var tapConnectInstance = null;
|
|
105
|
-
export var renderTapTerminal = 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(TapTerminal, __assign({}, props)));
|
|
111
|
-
unmount = function () {
|
|
112
|
-
root.unmount();
|
|
113
|
-
tapConnectInstance = null;
|
|
114
|
-
};
|
|
115
|
-
tapConnectInstance = { unmount: unmount };
|
|
116
|
-
return [2, tapConnectInstance];
|
|
117
|
-
});
|
|
118
|
-
}); };
|