@tap-payments/connect 2.6.78-test → 2.6.80-test
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 +32 -33
- package/build/@types/index.d.ts +2 -3
- package/build/constants/index.d.ts +1 -1
- package/build/constants/index.js +1 -1
- package/build/features/Connect/ConnectBoard.d.ts +4 -1
- package/build/features/Connect/ConnectBoard.js +4 -4
- package/build/features/Connect/ConnectBrand.d.ts +12 -0
- package/build/features/Connect/ConnectBrand.js +114 -0
- package/build/features/Connect/index.d.ts +3 -2
- package/build/features/Connect/index.js +2 -1
- package/build/index.d.ts +3 -3
- package/build/index.js +4 -3
- package/build/utils/validation.d.ts +5 -1
- package/build/utils/validation.js +49 -1
- package/package.json +1 -1
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.b-cdn.net/connect/build-2.6.
|
|
88
|
+
<script src="https://tap-sdks.b-cdn.net/connect/build-2.6.79-test/main.js"></script>
|
|
89
89
|
</head>
|
|
90
90
|
<body>
|
|
91
91
|
<div id="root"></div>
|
|
@@ -137,35 +137,34 @@ const ConnectComponent = () => {
|
|
|
137
137
|
|
|
138
138
|
## Properties
|
|
139
139
|
|
|
140
|
-
| name | type | description
|
|
141
|
-
| ---------------------------------- | ----------------------------- |
|
|
142
|
-
| publicKey `required` | `string` | Public key of the merchant account provided by Tap Payments
|
|
143
|
-
| domain `required` | `string` | Domain of the merchant
|
|
144
|
-
| language `required` | `Languages` | language flag to control the language of the connect element and only accept [ar,en]
|
|
145
|
-
| country `required` | `string` | Country ISO2 of the merchant
|
|
146
|
-
| scope `required` | `string` | the scope of the merchant available values [merchant, auth]
|
|
147
|
-
| data `optional` | `Array<string>` | Merchant data array `ex: [operator]`
|
|
148
|
-
| lead `optional` | `string` | Lead Id can be passed in case of you already created a lead using our API
|
|
149
|
-
| mode `required` | `string` | Decide to show connect as a `popup` or `page` to our connect domain. Default value is `popup`
|
|
150
|
-
| mature `required` | `boolean` | Decide the mode of connect `normal` or `express`
|
|
151
|
-
| board `optional` | `string` | Show/Hide board screens
|
|
152
|
-
| open `required` | `boolean` | Open/Close the connect library
|
|
153
|
-
| hideOverlay `optional` | `boolean` | Used to disable the **auth** background color and it can be used only for auth kit
|
|
154
|
-
| hideLoaderOverlay `optional` | `boolean` | Used to disable the **auth** loader background color and it can be used only for auth kit
|
|
155
|
-
| openAnimationDirection `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when open popup for auth kit
|
|
156
|
-
| closeAnimationDirection `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when close popup for auth kit
|
|
157
|
-
| hideMerchantLogo `optional` | `boolean` | Used to hide the **auth** merchant logo and it can be used only for auth kit
|
|
158
|
-
| loaderColor `optional` | `string` | Used to change loader color and it can be used only for board kit
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
| onBoardCompleted `optional` | `function` | Callback function to called when you complete all flows |
|
|
140
|
+
| name | type | description |
|
|
141
|
+
| ---------------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
142
|
+
| publicKey `required` | `string` | Public key of the merchant account provided by Tap Payments |
|
|
143
|
+
| domain `required` | `string` | Domain of the merchant |
|
|
144
|
+
| language `required` | `Languages` | language flag to control the language of the connect element and only accept [ar,en] |
|
|
145
|
+
| country `required` | `string` | Country ISO2 of the merchant |
|
|
146
|
+
| scope `required` | `string` | the scope of the merchant available values [merchant, auth] |
|
|
147
|
+
| data `optional` | `Array<string>` | Merchant data array `ex: [operator]` |
|
|
148
|
+
| lead `optional` | `string` | Lead Id can be passed in case of you already created a lead using our API |
|
|
149
|
+
| mode `required` | `string` | Decide to show connect as a `popup` or `page` or `content` to our connect domain. Default value is `popup`. `content` mode only used for board kit |
|
|
150
|
+
| mature `required` | `boolean` | Decide the mode of connect `normal` or `express` |
|
|
151
|
+
| board `optional` | `string` | Show/Hide board screens |
|
|
152
|
+
| open `required` | `boolean` | Open/Close the connect library |
|
|
153
|
+
| hideOverlay `optional` | `boolean` | Used to disable the **auth** background color and it can be used only for auth kit |
|
|
154
|
+
| hideLoaderOverlay `optional` | `boolean` | Used to disable the **auth** loader background color and it can be used only for auth kit |
|
|
155
|
+
| openAnimationDirection `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when open popup for auth kit |
|
|
156
|
+
| closeAnimationDirection `optional` | `left or right or up or down` | Used to handle **auth** slide animation direction when close popup for auth kit |
|
|
157
|
+
| hideMerchantLogo `optional` | `boolean` | Used to hide the **auth** merchant logo and it can be used only for auth kit |
|
|
158
|
+
| loaderColor `optional` | `string` | Used to change loader color and it can be used only for board kit |
|
|
159
|
+
| boardMaturity `optional` | `boolean` | Decide the board maturity |
|
|
160
|
+
| postURL `optional` | `string` | The POST Method URL used to push te data from our server to the merchant server and |
|
|
161
|
+
| | | it's required only if `mature` is `false` |
|
|
162
|
+
| redirectUrl `optional` | `string` | This redirect url after verify authentication go to merchant website |
|
|
163
|
+
| | | It is `required` if scope is `auth` and mode is `page` |
|
|
164
|
+
| onReady `optional` | `function` | Callback function to handle the ready state of the `TapConnect` |
|
|
165
|
+
| onCreated `optional` | `function` | Callback function to called the the account created successfully |
|
|
166
|
+
| | | it calls only if `mature` is `false` |
|
|
167
|
+
| onSuccess `optional` | `function` | Callback function to handle the success response, it will run after the user finish the flow |
|
|
168
|
+
| onError `optional` | `function` | Callback function to handle the error response, it will run if the user face any error |
|
|
169
|
+
| onClose `optional` | `function` | Callback function to called when `TapConnect` get close |
|
|
170
|
+
| onBoardCompleted `optional` | `function` | Callback function to called when you complete all flows |
|
package/build/@types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface ConnectProps {
|
|
|
8
8
|
scope: string;
|
|
9
9
|
lead?: string;
|
|
10
10
|
mature: boolean;
|
|
11
|
-
mode?: 'popup' | 'page';
|
|
11
|
+
mode?: 'popup' | 'page' | 'content';
|
|
12
12
|
board?: boolean;
|
|
13
13
|
boardMaturity?: boolean;
|
|
14
14
|
hideOverlay?: boolean;
|
|
@@ -16,7 +16,6 @@ export interface ConnectProps {
|
|
|
16
16
|
hideMerchantLogo?: boolean;
|
|
17
17
|
openAnimationDirection?: 'left' | 'right' | 'up' | 'down';
|
|
18
18
|
closeAnimationDirection?: 'left' | 'right' | 'up' | 'down';
|
|
19
|
-
showAsContent?: boolean;
|
|
20
19
|
loaderColor?: string;
|
|
21
20
|
boardId?: string;
|
|
22
21
|
open: boolean;
|
|
@@ -32,7 +31,7 @@ export interface ConnectProps {
|
|
|
32
31
|
}
|
|
33
32
|
export interface OriginalConnectProps {
|
|
34
33
|
publicKey: string;
|
|
35
|
-
mode?: 'popup' | 'page';
|
|
34
|
+
mode?: 'popup' | 'page' | 'content';
|
|
36
35
|
open: boolean;
|
|
37
36
|
merchantDomain: string;
|
|
38
37
|
language: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.6.
|
|
1
|
+
export declare const CDN_LIBRARY_BASE_URL = "https://auth-jsconnect.b-cdn.net/build-2.6.80-test/";
|
|
2
2
|
export declare const Maturity: {
|
|
3
3
|
readonly FULL: "full";
|
|
4
4
|
readonly EXPRESS: "express";
|
package/build/constants/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ConnectProps as ConnectAttrs } from '../../@types';
|
|
3
|
-
export type
|
|
3
|
+
export type BoardProps = Pick<ConnectAttrs, 'open' | 'mode' | 'scope' | 'domain' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor' | 'boardId'>;
|
|
4
|
+
export type TapBoardProps = BoardProps & {
|
|
5
|
+
onBoardButtonClick: (data: Record<string, string>) => void;
|
|
6
|
+
};
|
|
4
7
|
export declare const TapBoard: React.MemoExoticComponent<(props: TapBoardProps & {
|
|
5
8
|
id?: string;
|
|
6
9
|
}) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -67,8 +67,8 @@ var Board = function (props) {
|
|
|
67
67
|
var renderBoardLib = window['TapAuth'].renderBoardLib;
|
|
68
68
|
var unmount = renderBoardLib({
|
|
69
69
|
open: props.open,
|
|
70
|
-
mode:
|
|
71
|
-
scope:
|
|
70
|
+
mode: props.mode,
|
|
71
|
+
scope: props.scope,
|
|
72
72
|
merchantDomain: props.domain,
|
|
73
73
|
publicKey: props.publicKey,
|
|
74
74
|
postURL: props.postURL,
|
|
@@ -81,9 +81,9 @@ var Board = function (props) {
|
|
|
81
81
|
onError: props.onError,
|
|
82
82
|
onReady: props.onReady,
|
|
83
83
|
onClose: props.onClose,
|
|
84
|
-
showAsContent: props.showAsContent,
|
|
85
84
|
loaderColor: props.loaderColor,
|
|
86
|
-
boardId: props.boardId
|
|
85
|
+
boardId: props.boardId,
|
|
86
|
+
onBoardButtonClick: props.onBoardButtonClick
|
|
87
87
|
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-board-lib-id').unmount;
|
|
88
88
|
return function () {
|
|
89
89
|
unmount();
|
|
@@ -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' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'loaderColor'>;
|
|
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
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export declare const renderTapBrand: (props: TapBrandProps, elementId: string) => Promise<any>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
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
|
+
verifyToken: props.verifyToken,
|
|
86
|
+
onBoardButtonClick: props.onBoardButtonClick
|
|
87
|
+
}, (_a = props.id) !== null && _a !== void 0 ? _a : 'tap-connect-brand-lib-id').unmount;
|
|
88
|
+
return function () {
|
|
89
|
+
unmount();
|
|
90
|
+
};
|
|
91
|
+
}, [status]);
|
|
92
|
+
if (status !== 'ready')
|
|
93
|
+
return null;
|
|
94
|
+
return _jsx("div", { id: 'tap-connect-brand-lib-id' });
|
|
95
|
+
};
|
|
96
|
+
export var TapBrand = React.memo(function (props) {
|
|
97
|
+
validateBoardOtherKitsProps(props);
|
|
98
|
+
return _jsx(Brand, __assign({}, props));
|
|
99
|
+
});
|
|
100
|
+
var tapConnectInstance = null;
|
|
101
|
+
export var renderTapBrand = function (props, elementId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
+
var el, root, unmount;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
el = findOrCreateElementAndInject(elementId);
|
|
105
|
+
root = createRoot(el);
|
|
106
|
+
root.render(_jsx(TapBrand, __assign({}, props)));
|
|
107
|
+
unmount = function () {
|
|
108
|
+
root.unmount();
|
|
109
|
+
tapConnectInstance = null;
|
|
110
|
+
};
|
|
111
|
+
tapConnectInstance = { unmount: unmount };
|
|
112
|
+
return [2, tapConnectInstance];
|
|
113
|
+
});
|
|
114
|
+
}); };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TapConnect, ConnectProps as TapConnectProps, renderTapConnect } from './Connect';
|
|
2
2
|
import { ConnectAuthProps, TapConnectAuth, renderTapConnectAuth } from './ConnectAuth';
|
|
3
3
|
import { TapBoardProps, TapBoard, renderTapBoard } from './ConnectBoard';
|
|
4
|
-
|
|
5
|
-
export {
|
|
4
|
+
import { TapBrandProps, TapBrand, renderTapBrand } from './ConnectBrand';
|
|
5
|
+
export type { TapConnectProps, ConnectAuthProps, TapBoardProps, TapBrandProps };
|
|
6
|
+
export { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TapConnect, renderTapConnect } from './Connect';
|
|
2
2
|
import { TapConnectAuth, renderTapConnectAuth } from './ConnectAuth';
|
|
3
3
|
import { TapBoard, renderTapBoard } from './ConnectBoard';
|
|
4
|
-
|
|
4
|
+
import { TapBrand, renderTapBrand } from './ConnectBrand';
|
|
5
|
+
export { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand };
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TapConnect, TapConnectProps, renderTapConnect, ConnectAuthProps, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoardProps, TapBoard } from './features/Connect';
|
|
1
|
+
import { TapConnect, TapConnectProps, renderTapConnect, ConnectAuthProps, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoardProps, TapBoard, TapBrand, TapBrandProps, renderTapBrand } from './features/Connect';
|
|
2
2
|
import { Language } from './constants';
|
|
3
|
-
export type { TapConnectProps, ConnectAuthProps, TapBoardProps };
|
|
4
|
-
export { Language, TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard };
|
|
3
|
+
export type { TapConnectProps, ConnectAuthProps, TapBoardProps, TapBrandProps };
|
|
4
|
+
export { Language, TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand };
|
package/build/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoard } from './features/Connect';
|
|
1
|
+
import { TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, renderTapBoard, TapBoard, TapBrand, renderTapBrand } from './features/Connect';
|
|
2
2
|
import { Language } from './constants';
|
|
3
|
-
export { Language, TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard };
|
|
3
|
+
export { Language, TapConnect, renderTapConnect, TapConnectAuth, renderTapConnectAuth, TapBoard, renderTapBoard, TapBrand, renderTapBrand };
|
|
4
4
|
window['TapPayments'] = {
|
|
5
5
|
renderTapConnect: renderTapConnect,
|
|
6
6
|
Language: Language,
|
|
7
7
|
renderTapConnectAuth: renderTapConnectAuth,
|
|
8
|
-
renderTapBoard: renderTapBoard
|
|
8
|
+
renderTapBoard: renderTapBoard,
|
|
9
|
+
renderTapBrand: renderTapBrand
|
|
9
10
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ConnectProps } from '../@types';
|
|
2
2
|
export declare const validateConnectProps: (props: ConnectProps) => void;
|
|
3
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' | 'publicKey' | 'postURL' | 'country' | 'language' | 'onSuccess' | 'onError' | 'onReady' | 'onClose' | 'boardId'>) => 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;
|
|
@@ -105,7 +105,7 @@ export var validateConnectAuthProps = function (props) {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
export var validateBoardProps = function (props) {
|
|
108
|
-
var publicKey = props.publicKey, country = props.country, 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;
|
|
108
|
+
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;
|
|
109
109
|
if (!publicKey) {
|
|
110
110
|
throw new Error('publicKey is required');
|
|
111
111
|
}
|
|
@@ -115,6 +115,9 @@ export var validateBoardProps = function (props) {
|
|
|
115
115
|
if (!language) {
|
|
116
116
|
throw new Error('language is required');
|
|
117
117
|
}
|
|
118
|
+
if (!scope) {
|
|
119
|
+
throw new Error('scope is required');
|
|
120
|
+
}
|
|
118
121
|
if (![Language.AR, Language.EN].includes(language)) {
|
|
119
122
|
throw new Error('you can only use AR or EN for language');
|
|
120
123
|
}
|
|
@@ -143,3 +146,48 @@ export var validateBoardProps = function (props) {
|
|
|
143
146
|
throw new Error('onSuccess must be a function');
|
|
144
147
|
}
|
|
145
148
|
};
|
|
149
|
+
export var validateBoardOtherKitsProps = function (props) {
|
|
150
|
+
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;
|
|
151
|
+
if (!publicKey) {
|
|
152
|
+
throw new Error('publicKey is required');
|
|
153
|
+
}
|
|
154
|
+
if (typeof country !== 'string') {
|
|
155
|
+
throw new Error('country should be from type string');
|
|
156
|
+
}
|
|
157
|
+
if (!language) {
|
|
158
|
+
throw new Error('language is required');
|
|
159
|
+
}
|
|
160
|
+
if (!scope) {
|
|
161
|
+
throw new Error('scope is required');
|
|
162
|
+
}
|
|
163
|
+
if (![Language.AR, Language.EN].includes(language)) {
|
|
164
|
+
throw new Error('you can only use AR or EN for language');
|
|
165
|
+
}
|
|
166
|
+
if (!domain) {
|
|
167
|
+
throw new Error('domain is required');
|
|
168
|
+
}
|
|
169
|
+
if (!verifyToken) {
|
|
170
|
+
throw new Error('token is required');
|
|
171
|
+
}
|
|
172
|
+
if (typeof open !== 'boolean') {
|
|
173
|
+
throw new Error('open is required, and must be a boolean');
|
|
174
|
+
}
|
|
175
|
+
if (typeof postURL !== 'undefined' && typeof postURL !== 'string') {
|
|
176
|
+
throw new Error('postURL must be a string');
|
|
177
|
+
}
|
|
178
|
+
if (typeof onClose !== 'undefined' && typeof onClose !== 'function') {
|
|
179
|
+
throw new Error('onClose must be a function');
|
|
180
|
+
}
|
|
181
|
+
if (typeof onError !== 'undefined' && typeof onError !== 'function') {
|
|
182
|
+
throw new Error('onError must be a function');
|
|
183
|
+
}
|
|
184
|
+
if (typeof onReady !== 'undefined' && typeof onReady !== 'function') {
|
|
185
|
+
throw new Error('onReady must be a function');
|
|
186
|
+
}
|
|
187
|
+
if (typeof onSuccess !== 'undefined' && typeof onSuccess !== 'function') {
|
|
188
|
+
throw new Error('onSuccess must be a function');
|
|
189
|
+
}
|
|
190
|
+
if (typeof onBoardButtonClick !== 'undefined' && typeof onBoardButtonClick !== 'function') {
|
|
191
|
+
throw new Error('onBoardButtonClick must be a function');
|
|
192
|
+
}
|
|
193
|
+
};
|