@tap-payments/auth-jsconnect 1.0.86 → 1.0.89-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 +112 -0
- package/build/@types/app.d.ts +9 -7
- package/build/app/settings.js +1 -1
- package/build/components/AnimationFlow/BottomSheet.js +3 -1
- package/build/constants/api.js +1 -1
- package/build/constants/app.d.ts +1 -4
- package/build/constants/app.js +1 -4
- package/build/features/app/bank/bankStore.js +35 -25
- package/build/features/app/business/businessStore.js +13 -13
- package/build/features/app/connect/connectStore.js +9 -2
- package/build/features/app/individual/individualStore.d.ts +2 -1
- package/build/features/app/individual/individualStore.js +52 -43
- package/build/features/app/password/passwordStore.js +32 -22
- package/build/features/app/tax/taxStore.js +24 -14
- package/build/features/bank/Bank.js +5 -1
- package/build/features/business/Business.js +5 -1
- package/build/features/connect/Connect.js +1 -1
- package/build/features/individual/Individual.js +5 -1
- package/build/features/password/Password.js +5 -1
- package/build/features/shared/Background/Background.js +2 -2
- package/build/features/shared/Background/LogoBackground.d.ts +2 -2
- package/build/features/shared/Background/LogoBackground.js +10 -7
- package/build/features/shared/Containers/FeatureContainer.js +3 -0
- package/build/features/shared/Footer/Footer.js +1 -1
- package/build/features/tax/Tax.js +5 -1
- package/build/utils/locale.d.ts +1 -1
- package/build/utils/locale.js +4 -3
- package/build/utils/object.d.ts +1 -0
- package/build/utils/object.js +5 -0
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Auth-JsConnect
|
|
2
|
+
|
|
3
|
+
Handling user authentication and identification
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
This is a [React](https://reactjs.org/) module available through the
|
|
8
|
+
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
9
|
+
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
10
|
+
|
|
11
|
+
```console
|
|
12
|
+
npm install @tap-payments/auth-jsconnect
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---------------------------- OR -------------------------
|
|
16
|
+
|
|
17
|
+
```console
|
|
18
|
+
yarn add @tap-payments/auth-jsconnect
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- [Connect](#Connect)
|
|
24
|
+
- [Business](#Business)
|
|
25
|
+
- [Password](#Password)
|
|
26
|
+
- [Individual](#Individual)
|
|
27
|
+
- [Bank](#Bank)
|
|
28
|
+
- [Tax](#Tax)
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### ES6
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import { ConnectLib } from '@tap-payments/auth-jsconnect'
|
|
36
|
+
|
|
37
|
+
const App = () => {
|
|
38
|
+
return (
|
|
39
|
+
<ConnectLib
|
|
40
|
+
open={true}
|
|
41
|
+
merchantDomain={'https://www.example.com'}
|
|
42
|
+
publicKey={'pk_test_xxxxxx'}
|
|
43
|
+
appInfo={{
|
|
44
|
+
identifier: 'tap_connect_demo',
|
|
45
|
+
name: 'Tap Connect Demo',
|
|
46
|
+
version: 'V2.0.0'
|
|
47
|
+
}}
|
|
48
|
+
businessCountryCode='SA'
|
|
49
|
+
language='en'
|
|
50
|
+
onError={(error) => {
|
|
51
|
+
alert(JSON.stringify({ error }))
|
|
52
|
+
}}
|
|
53
|
+
onFlowCompleted={(data) => {
|
|
54
|
+
console.log(data)
|
|
55
|
+
}}
|
|
56
|
+
onReady={() => {
|
|
57
|
+
console.log('ready!')
|
|
58
|
+
}}
|
|
59
|
+
onStepCompleted={(name, data) => {
|
|
60
|
+
console.log(name, data)
|
|
61
|
+
}}
|
|
62
|
+
onStepError={(name, error) => {
|
|
63
|
+
console.log(name, error)
|
|
64
|
+
}}
|
|
65
|
+
onStepStarted={(name) => {
|
|
66
|
+
console.log(name)
|
|
67
|
+
}}
|
|
68
|
+
scope={[]}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Vanilla JS
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
coming soon
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Connect
|
|
83
|
+
|
|
84
|
+
## Business
|
|
85
|
+
|
|
86
|
+
## Password
|
|
87
|
+
|
|
88
|
+
## Individual
|
|
89
|
+
|
|
90
|
+
## Bank
|
|
91
|
+
|
|
92
|
+
## Tax
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Properties
|
|
97
|
+
|
|
98
|
+
| name | functionality |
|
|
99
|
+
| ------------------------------ | --------------------------- |
|
|
100
|
+
| open `required` | BadRequest |
|
|
101
|
+
| merchantDomain `required` | Unauthorized |
|
|
102
|
+
| publicKey `required` | PaymentRequired |
|
|
103
|
+
| appInfo `required` | Forbidden |
|
|
104
|
+
| businessCountryCode `required` | NotFound |
|
|
105
|
+
| language `required` | MethodNotAllowed |
|
|
106
|
+
| onError `required` | NotAcceptable |
|
|
107
|
+
| onFlowCompleted `required` | ProxyAuthenticationRequired |
|
|
108
|
+
| onReady `required` | RequestTimeout |
|
|
109
|
+
| onStepCompleted `required` | Conflict |
|
|
110
|
+
| onStepError `required` | Gone |
|
|
111
|
+
| onStepStarted `required` | LengthRequired |
|
|
112
|
+
| scope `required` | UnsupportedMediaType |
|
package/build/@types/app.d.ts
CHANGED
|
@@ -152,14 +152,16 @@ export interface DeviceInfo {
|
|
|
152
152
|
entry: Entry;
|
|
153
153
|
}
|
|
154
154
|
export interface LocalProps {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
[country: string]: {
|
|
156
|
+
ar: {
|
|
157
|
+
translation: {
|
|
158
|
+
[key: string]: string;
|
|
159
|
+
};
|
|
158
160
|
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
en: {
|
|
162
|
+
translation: {
|
|
163
|
+
[key: string]: string;
|
|
164
|
+
};
|
|
163
165
|
};
|
|
164
166
|
};
|
|
165
167
|
}
|
package/build/app/settings.js
CHANGED
|
@@ -251,7 +251,7 @@ export var settingsSlice = createSlice({
|
|
|
251
251
|
.addCase(getLocale.fulfilled, function (state, action) {
|
|
252
252
|
state.loading = false;
|
|
253
253
|
state.error = null;
|
|
254
|
-
updateLocale(action.payload);
|
|
254
|
+
updateLocale(action.payload, state.data.appConfig.businessCountryCode);
|
|
255
255
|
})
|
|
256
256
|
.addCase(getLocale.rejected, function (state, action) {
|
|
257
257
|
state.loading = false;
|
|
@@ -36,7 +36,9 @@ var BottomSheetStyled = styled(BottomSheet)(function (_a) {
|
|
|
36
36
|
backgroundColor: 'transparent'
|
|
37
37
|
},
|
|
38
38
|
'[data-rsbs-header]': {
|
|
39
|
-
paddingBottom: theme.spacing(
|
|
39
|
+
paddingBottom: theme.spacing(6),
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
width: '100vw'
|
|
40
42
|
},
|
|
41
43
|
'[data-rsbs-overlay]': {
|
|
42
44
|
backgroundColor: theme.palette.background.paper
|
package/build/constants/api.js
CHANGED
|
@@ -22,7 +22,7 @@ var SIGNUP_PATH = '/signup';
|
|
|
22
22
|
var SOURCE_INCOME_PATH = '/v2/sourceOfIncome';
|
|
23
23
|
var MONTHLY_INCOME_PATH = '/v2/monthlyIncome';
|
|
24
24
|
var BRAND_LIST_PATH = '/brand/list';
|
|
25
|
-
var FIREBASE_URL = 'https://goconnect-195cd-default-rtdb.asia-southeast1.firebasedatabase.app/
|
|
25
|
+
var FIREBASE_URL = 'https://goconnect-195cd-default-rtdb.asia-southeast1.firebasedatabase.app/locale.json';
|
|
26
26
|
export var ENDPOINT_PATHS = {
|
|
27
27
|
BASE_URL: API_BASE_URL,
|
|
28
28
|
BUSINESS_COUNTRIES: API_BUSINESS_COUNTRIES,
|
package/build/constants/app.d.ts
CHANGED
|
@@ -92,25 +92,22 @@ export declare const BUSINESS_STEP_NAMES: {
|
|
|
92
92
|
};
|
|
93
93
|
export declare const BANK_STEP_NAMES: {
|
|
94
94
|
PHONE_AUTH: string;
|
|
95
|
-
IDENTITY_AUTH: string;
|
|
96
95
|
BANK_INFO: string;
|
|
97
96
|
BANK_SUCCESS: string;
|
|
98
97
|
};
|
|
99
98
|
export declare const TAX_STEP_NAMES: {
|
|
100
99
|
PHONE_AUTH: string;
|
|
101
|
-
IDENTITY_AUTH: string;
|
|
102
100
|
TAX_INFO: string;
|
|
103
101
|
TAX_SUCCESS: string;
|
|
104
102
|
};
|
|
105
103
|
export declare const INDIVIDUAl_STEP_NAMES: {
|
|
106
104
|
PHONE_AUTH: string;
|
|
107
|
-
IDENTITY_AUTH: string;
|
|
108
105
|
INDIVIDUAl_INFO: string;
|
|
109
106
|
INDIVIDUAl_SUCCESS: string;
|
|
110
107
|
};
|
|
111
108
|
export declare const PASSWORD_STEP_NAMES: {
|
|
109
|
+
PASSWORD_INFO: string;
|
|
112
110
|
PHONE_AUTH: string;
|
|
113
|
-
IDENTITY_AUTH: string;
|
|
114
111
|
PASSWORD_CREATE: string;
|
|
115
112
|
PASSWORD_SUCCESS: string;
|
|
116
113
|
};
|
package/build/constants/app.js
CHANGED
|
@@ -291,25 +291,22 @@ export var BUSINESS_STEP_NAMES = {
|
|
|
291
291
|
};
|
|
292
292
|
export var BANK_STEP_NAMES = {
|
|
293
293
|
PHONE_AUTH: 'bank_phone_auth',
|
|
294
|
-
IDENTITY_AUTH: 'bank_identity_auth',
|
|
295
294
|
BANK_INFO: 'bank_info',
|
|
296
295
|
BANK_SUCCESS: 'bank_completed'
|
|
297
296
|
};
|
|
298
297
|
export var TAX_STEP_NAMES = {
|
|
299
298
|
PHONE_AUTH: 'tax_phone_auth',
|
|
300
|
-
IDENTITY_AUTH: 'tax_identity_auth',
|
|
301
299
|
TAX_INFO: 'tax_info',
|
|
302
300
|
TAX_SUCCESS: 'tax_completed'
|
|
303
301
|
};
|
|
304
302
|
export var INDIVIDUAl_STEP_NAMES = {
|
|
305
303
|
PHONE_AUTH: 'individual_phone_auth',
|
|
306
|
-
IDENTITY_AUTH: 'individual_identity_auth',
|
|
307
304
|
INDIVIDUAl_INFO: 'individual_info',
|
|
308
305
|
INDIVIDUAl_SUCCESS: 'individual_completed'
|
|
309
306
|
};
|
|
310
307
|
export var PASSWORD_STEP_NAMES = {
|
|
308
|
+
PASSWORD_INFO: 'password_info',
|
|
311
309
|
PHONE_AUTH: 'password_phone_auth',
|
|
312
|
-
IDENTITY_AUTH: 'password_identity_auth',
|
|
313
310
|
PASSWORD_CREATE: 'password_create',
|
|
314
311
|
PASSWORD_SUCCESS: 'password_completed'
|
|
315
312
|
};
|
|
@@ -48,13 +48,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
|
-
import { removeRequestHeaders } from '../../../utils';
|
|
51
|
+
import { hasKey, removeRequestHeaders } from '../../../utils';
|
|
52
52
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
53
|
import { BANK_STEP_NAMES } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, data, leadResponse;
|
|
56
|
-
return __generator(this, function (
|
|
57
|
-
switch (
|
|
55
|
+
var payload, data, leadResponse, _a, steps, entity, hasCompleted;
|
|
56
|
+
return __generator(this, function (_b) {
|
|
57
|
+
switch (_b.label) {
|
|
58
58
|
case 0:
|
|
59
59
|
payload = {
|
|
60
60
|
service_name: 'tap_email',
|
|
@@ -62,22 +62,31 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
|
|
|
62
62
|
};
|
|
63
63
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
64
64
|
case 1:
|
|
65
|
-
data = (
|
|
65
|
+
data = (_b.sent()).data;
|
|
66
66
|
leadResponse = undefined;
|
|
67
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
67
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
|
|
68
68
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
69
69
|
case 2:
|
|
70
|
-
leadResponse =
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
leadResponse = _b.sent();
|
|
71
|
+
_a = leadResponse.data, steps = _a.steps, entity = _a.entity;
|
|
72
|
+
hasCompleted = hasKey(steps, BANK_STEP_NAMES.BANK_SUCCESS);
|
|
73
|
+
if (!hasCompleted) return [3, 4];
|
|
74
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
|
|
75
|
+
case 3:
|
|
76
|
+
_b.sent();
|
|
77
|
+
thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
78
|
+
return [3, 5];
|
|
79
|
+
case 4:
|
|
80
|
+
if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
|
|
81
|
+
thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
|
|
73
82
|
}
|
|
74
|
-
|
|
75
|
-
case
|
|
83
|
+
_b.label = 5;
|
|
84
|
+
case 5: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
|
|
76
85
|
}
|
|
77
86
|
});
|
|
78
87
|
}); });
|
|
79
88
|
export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var _a, bank, settings, responseBody, payload, data, steps,
|
|
89
|
+
var _a, bank, settings, responseBody, payload, data, steps, hasCompleted;
|
|
81
90
|
var _b, _c, _d, _e;
|
|
82
91
|
return __generator(this, function (_f) {
|
|
83
92
|
switch (_f.label) {
|
|
@@ -97,8 +106,8 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
|
|
|
97
106
|
if (!!data.errors) return [3, 4];
|
|
98
107
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
99
108
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
100
|
-
|
|
101
|
-
if (!
|
|
109
|
+
hasCompleted = hasKey(steps, BANK_STEP_NAMES.BANK_SUCCESS);
|
|
110
|
+
if (!hasCompleted) return [3, 3];
|
|
102
111
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _e === void 0 ? void 0 : _e.id))];
|
|
103
112
|
case 2:
|
|
104
113
|
_f.sent();
|
|
@@ -175,9 +184,9 @@ export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
|
|
|
175
184
|
});
|
|
176
185
|
export var updateLeadSuccess = createAsyncThunk('updateLeadBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
177
186
|
var _a, settings, bank, id, payload, data;
|
|
178
|
-
var _b, _c, _d, _e, _f
|
|
179
|
-
return __generator(this, function (
|
|
180
|
-
switch (
|
|
187
|
+
var _b, _c, _d, _e, _f;
|
|
188
|
+
return __generator(this, function (_g) {
|
|
189
|
+
switch (_g.label) {
|
|
181
190
|
case 0:
|
|
182
191
|
_a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
|
|
183
192
|
id = (bank.data.verify.responseBody || {}).id;
|
|
@@ -185,17 +194,17 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadBankSuccess', functio
|
|
|
185
194
|
return [2];
|
|
186
195
|
payload = {
|
|
187
196
|
step_name: BANK_STEP_NAMES.BANK_SUCCESS,
|
|
188
|
-
id:
|
|
197
|
+
id: id,
|
|
189
198
|
encryption_contract: []
|
|
190
199
|
};
|
|
191
200
|
return [4, API.leadService.updateLead(payload)];
|
|
192
201
|
case 1:
|
|
193
|
-
data = (
|
|
194
|
-
return [4, thunkApi.dispatch(retrieveEntityInfo((
|
|
202
|
+
data = (_g.sent()).data;
|
|
203
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
|
|
195
204
|
case 2:
|
|
196
|
-
|
|
197
|
-
(
|
|
198
|
-
(
|
|
205
|
+
_g.sent();
|
|
206
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
207
|
+
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
199
208
|
thunkApi.dispatch(handleNextScreenStep());
|
|
200
209
|
return [2, { response: data, formData: params }];
|
|
201
210
|
}
|
|
@@ -249,7 +258,7 @@ export var bankSlice = createSlice({
|
|
|
249
258
|
state.error = description;
|
|
250
259
|
return;
|
|
251
260
|
}
|
|
252
|
-
state.data.verify.responseBody = __assign(__assign({}, data), leadData);
|
|
261
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
|
|
253
262
|
state.data.verify.token = token;
|
|
254
263
|
})
|
|
255
264
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
@@ -307,7 +316,8 @@ export var bankSlice = createSlice({
|
|
|
307
316
|
state.error = description;
|
|
308
317
|
return;
|
|
309
318
|
}
|
|
310
|
-
|
|
319
|
+
var flows = response.flows, steps = response.steps;
|
|
320
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
|
|
311
321
|
removeRequestHeaders();
|
|
312
322
|
})
|
|
313
323
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
@@ -60,7 +60,7 @@ import moment from 'moment';
|
|
|
60
60
|
import API from '../../../api';
|
|
61
61
|
import { BusinessType } from '../../../@types';
|
|
62
62
|
import { BUSINESS_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
63
|
-
import { convertNumbers2English, getFlowUrl, removeRequestHeaders } from '../../../utils';
|
|
63
|
+
import { convertNumbers2English, getFlowUrl, hasKey, removeRequestHeaders } from '../../../utils';
|
|
64
64
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
65
65
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var settings, countriesBody, businessCountry;
|
|
@@ -133,8 +133,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
133
133
|
case 2:
|
|
134
134
|
_f.sent();
|
|
135
135
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
136
|
-
steps =
|
|
137
|
-
hasBusinessCompleted =
|
|
136
|
+
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
137
|
+
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
138
138
|
if (!isNID) return [3, 3];
|
|
139
139
|
thunkApi.dispatch(handleNextScreenStep());
|
|
140
140
|
return [3, 6];
|
|
@@ -294,7 +294,8 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
|
|
|
294
294
|
activities: activities,
|
|
295
295
|
channel_services: channel,
|
|
296
296
|
business_operation_start_at: params.operationStartDate,
|
|
297
|
-
step_name: stepName
|
|
297
|
+
step_name: stepName,
|
|
298
|
+
encryption_contract: ['business_operation_start_at']
|
|
298
299
|
};
|
|
299
300
|
return [4, API.entityService.createEntityInfo(requestBody)];
|
|
300
301
|
case 1:
|
|
@@ -348,7 +349,8 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
348
349
|
yearly_sales_range: ((_d = params.expectedSale) === null || _d === void 0 ? void 0 : _d.id) || '',
|
|
349
350
|
agree_refund: params.refundPolicy,
|
|
350
351
|
agree_chargeback: params.transactionPolicy,
|
|
351
|
-
step_name: stepName
|
|
352
|
+
step_name: stepName,
|
|
353
|
+
encryption_contract: ['customers_base[0]', 'customers_served_monthly', 'yearly_sales_range']
|
|
352
354
|
};
|
|
353
355
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
354
356
|
case 1:
|
|
@@ -379,19 +381,19 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
379
381
|
flows: [
|
|
380
382
|
{
|
|
381
383
|
name: 'tax',
|
|
382
|
-
url: getFlowUrl('/tax')
|
|
384
|
+
url: getFlowUrl('/tax', settings.data.language)
|
|
383
385
|
},
|
|
384
386
|
{
|
|
385
387
|
name: 'bank',
|
|
386
|
-
url: getFlowUrl('/bank')
|
|
388
|
+
url: getFlowUrl('/bank', settings.data.language)
|
|
387
389
|
},
|
|
388
390
|
{
|
|
389
391
|
name: 'individual',
|
|
390
|
-
url: getFlowUrl('/individual')
|
|
392
|
+
url: getFlowUrl('/individual', settings.data.language)
|
|
391
393
|
},
|
|
392
394
|
{
|
|
393
395
|
name: 'password',
|
|
394
|
-
url: getFlowUrl('/password')
|
|
396
|
+
url: getFlowUrl('/password', settings.data.language)
|
|
395
397
|
}
|
|
396
398
|
],
|
|
397
399
|
encryption_contract: []
|
|
@@ -541,10 +543,8 @@ export var businessSlice = createSlice({
|
|
|
541
543
|
state.error = action.error.message;
|
|
542
544
|
})
|
|
543
545
|
.addCase(updateLeadIdentity.pending, function (state, action) {
|
|
544
|
-
var _a
|
|
545
|
-
if ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend)
|
|
546
|
-
state.customLoading = true;
|
|
547
|
-
if (!((_b = action.meta.arg) === null || _b === void 0 ? void 0 : _b.isResend))
|
|
546
|
+
var _a;
|
|
547
|
+
if (!((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend))
|
|
548
548
|
state.loading = true;
|
|
549
549
|
state.error = null;
|
|
550
550
|
})
|
|
@@ -290,7 +290,14 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
290
290
|
id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
|
|
291
291
|
terms_conditions_accepted: params.termAndConditionChecked,
|
|
292
292
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
293
|
-
encryption_contract: [
|
|
293
|
+
encryption_contract: [
|
|
294
|
+
'brand.name.en',
|
|
295
|
+
'brand.name.ar',
|
|
296
|
+
'brand.name.zh',
|
|
297
|
+
'brand.website',
|
|
298
|
+
'brand.social[0]',
|
|
299
|
+
'brand.social[1]'
|
|
300
|
+
]
|
|
294
301
|
};
|
|
295
302
|
return [4, API.leadService.updateLead(payload)];
|
|
296
303
|
case 1:
|
|
@@ -362,7 +369,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
362
369
|
flows: [
|
|
363
370
|
{
|
|
364
371
|
name: 'business',
|
|
365
|
-
url: getFlowUrl('/business')
|
|
372
|
+
url: getFlowUrl('/business', settings.data.language)
|
|
366
373
|
}
|
|
367
374
|
],
|
|
368
375
|
id: leadId,
|
|
@@ -12,7 +12,8 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
12
12
|
export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
13
13
|
sourceIncome: any;
|
|
14
14
|
monthlyIncome: any;
|
|
15
|
-
|
|
15
|
+
countryCode: string;
|
|
16
|
+
}, string, {}>;
|
|
16
17
|
export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
17
18
|
data: any;
|
|
18
19
|
}, string, {}>;
|
|
@@ -48,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
|
-
import { removeRequestHeaders } from '../../../utils';
|
|
51
|
+
import { hasKey, removeRequestHeaders } from '../../../utils';
|
|
52
52
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
53
|
import { defaultCountry, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
54
54
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -68,9 +68,10 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
|
|
|
68
68
|
});
|
|
69
69
|
}); });
|
|
70
70
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
-
var payload, data, leadResponse;
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
|
|
72
|
+
var _b, _c;
|
|
73
|
+
return __generator(this, function (_d) {
|
|
74
|
+
switch (_d.label) {
|
|
74
75
|
case 0:
|
|
75
76
|
payload = {
|
|
76
77
|
service_name: 'tap_email',
|
|
@@ -78,37 +79,45 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
|
|
|
78
79
|
};
|
|
79
80
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
80
81
|
case 1:
|
|
81
|
-
data = (
|
|
82
|
+
data = (_d.sent()).data;
|
|
82
83
|
leadResponse = undefined;
|
|
83
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
84
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 6];
|
|
84
85
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
85
86
|
case 2:
|
|
86
|
-
leadResponse =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
case 3:
|
|
87
|
+
leadResponse = _d.sent();
|
|
88
|
+
_a = leadResponse.data, steps = _a.steps, entity = _a.entity;
|
|
89
|
+
hasTaxCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
|
|
90
|
+
if (!hasTaxCompleted) return [3, 4];
|
|
91
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
|
|
92
|
+
case 3:
|
|
93
|
+
_d.sent();
|
|
94
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
95
|
+
return [3, 6];
|
|
96
|
+
case 4:
|
|
97
|
+
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3, 6];
|
|
98
|
+
return [4, thunkApi.dispatch(retrieveDataList((_c = (_b = leadResponse.data) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.country))];
|
|
99
|
+
case 5:
|
|
100
|
+
_d.sent();
|
|
101
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
102
|
+
_d.label = 6;
|
|
103
|
+
case 6: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
|
|
92
104
|
}
|
|
93
105
|
});
|
|
94
106
|
}); });
|
|
95
|
-
export var retrieveDataList = createAsyncThunk('retrieveDataList', function (
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return [4, Promise.all([
|
|
104
|
-
API.dataService.getSourceOfIncome(),
|
|
105
|
-
API.dataService.getMonthlyIncome(code)
|
|
106
|
-
])];
|
|
107
|
+
export var retrieveDataList = createAsyncThunk('retrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
108
|
+
var _a, sourceIncome, monthlyIncome;
|
|
109
|
+
return __generator(this, function (_b) {
|
|
110
|
+
switch (_b.label) {
|
|
111
|
+
case 0: return [4, Promise.all([
|
|
112
|
+
API.dataService.getSourceOfIncome(),
|
|
113
|
+
API.dataService.getMonthlyIncome(countryCode)
|
|
114
|
+
])];
|
|
107
115
|
case 1:
|
|
108
|
-
_a =
|
|
116
|
+
_a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
|
|
109
117
|
return [2, {
|
|
110
118
|
sourceIncome: sourceIncome,
|
|
111
|
-
monthlyIncome: monthlyIncome
|
|
119
|
+
monthlyIncome: monthlyIncome,
|
|
120
|
+
countryCode: countryCode
|
|
112
121
|
}];
|
|
113
122
|
}
|
|
114
123
|
});
|
|
@@ -126,9 +135,9 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo',
|
|
|
126
135
|
}); });
|
|
127
136
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
128
137
|
var _a, individual, settings, responseBody, payload, data, steps, hasIndividualCompleted;
|
|
129
|
-
var _b, _c, _d, _e;
|
|
130
|
-
return __generator(this, function (
|
|
131
|
-
switch (
|
|
138
|
+
var _b, _c, _d, _e, _f;
|
|
139
|
+
return __generator(this, function (_g) {
|
|
140
|
+
switch (_g.label) {
|
|
132
141
|
case 0:
|
|
133
142
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
134
143
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -141,22 +150,22 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
141
150
|
};
|
|
142
151
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
143
152
|
case 1:
|
|
144
|
-
data = (
|
|
153
|
+
data = (_g.sent()).data;
|
|
145
154
|
if (!!data.errors) return [3, 5];
|
|
146
155
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
147
156
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
148
|
-
hasIndividualCompleted =
|
|
157
|
+
hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
|
|
149
158
|
if (!hasIndividualCompleted) return [3, 3];
|
|
150
159
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _e === void 0 ? void 0 : _e.id))];
|
|
151
160
|
case 2:
|
|
152
|
-
|
|
161
|
+
_g.sent();
|
|
153
162
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
154
163
|
return [3, 5];
|
|
155
|
-
case 3: return [4, thunkApi.dispatch(retrieveDataList())];
|
|
164
|
+
case 3: return [4, thunkApi.dispatch(retrieveDataList((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _f === void 0 ? void 0 : _f.country))];
|
|
156
165
|
case 4:
|
|
157
|
-
|
|
166
|
+
_g.sent();
|
|
158
167
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
159
|
-
|
|
168
|
+
_g.label = 5;
|
|
160
169
|
case 5: return [2, { data: data, formData: __assign({}, params) }];
|
|
161
170
|
}
|
|
162
171
|
});
|
|
@@ -176,7 +185,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
176
185
|
actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
|
|
177
186
|
is_relative_PEP: params.isPEP,
|
|
178
187
|
is_influencer: params.isInfluencer,
|
|
179
|
-
encryption_contract: ['employer_name', 'employer_city', 'actual_income'],
|
|
188
|
+
encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'source_income[0]'],
|
|
180
189
|
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
|
|
181
190
|
};
|
|
182
191
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
@@ -287,7 +296,7 @@ export var individualSlice = createSlice({
|
|
|
287
296
|
state.error = description;
|
|
288
297
|
return;
|
|
289
298
|
}
|
|
290
|
-
state.data.verify.responseBody = __assign(__assign({}, data), leadData);
|
|
299
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
|
|
291
300
|
state.data.verify.token = token;
|
|
292
301
|
})
|
|
293
302
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
@@ -320,10 +329,9 @@ export var individualSlice = createSlice({
|
|
|
320
329
|
state.error = null;
|
|
321
330
|
})
|
|
322
331
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
323
|
-
var _a, _b;
|
|
324
332
|
state.loading = false;
|
|
325
333
|
state.error = null;
|
|
326
|
-
var
|
|
334
|
+
var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode;
|
|
327
335
|
var data = state.data.individualData.responseBody;
|
|
328
336
|
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
|
|
329
337
|
var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
|
|
@@ -332,9 +340,9 @@ export var individualSlice = createSlice({
|
|
|
332
340
|
var selectedMonthlyIncome = monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome[2];
|
|
333
341
|
if (!!selectedMonthlyIncome)
|
|
334
342
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
state.data.individualData.employerLocation =
|
|
343
|
+
if (!!countryCode) {
|
|
344
|
+
var employerLocation = state.data.countries.find(function (country) { return country.iso2 === countryCode; });
|
|
345
|
+
state.data.individualData.employerLocation = employerLocation;
|
|
338
346
|
}
|
|
339
347
|
})
|
|
340
348
|
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
@@ -392,7 +400,8 @@ export var individualSlice = createSlice({
|
|
|
392
400
|
state.error = description;
|
|
393
401
|
return;
|
|
394
402
|
}
|
|
395
|
-
|
|
403
|
+
var flows = response.flows, steps = response.steps;
|
|
404
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
|
|
396
405
|
removeRequestHeaders();
|
|
397
406
|
})
|
|
398
407
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
@@ -48,13 +48,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
|
-
import { removeRequestHeaders } from '../../../utils';
|
|
51
|
+
import { hasKey, removeRequestHeaders } from '../../../utils';
|
|
52
52
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
53
|
import { PASSWORD_STEP_NAMES } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, data, leadResponse;
|
|
56
|
-
return __generator(this, function (
|
|
57
|
-
switch (
|
|
55
|
+
var payload, data, leadResponse, _a, steps, entity, hasCompleted;
|
|
56
|
+
return __generator(this, function (_b) {
|
|
57
|
+
switch (_b.label) {
|
|
58
58
|
case 0:
|
|
59
59
|
payload = {
|
|
60
60
|
service_name: 'tap_email',
|
|
@@ -62,17 +62,26 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
|
|
|
62
62
|
};
|
|
63
63
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
64
64
|
case 1:
|
|
65
|
-
data = (
|
|
65
|
+
data = (_b.sent()).data;
|
|
66
66
|
leadResponse = undefined;
|
|
67
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
67
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
|
|
68
68
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
69
69
|
case 2:
|
|
70
|
-
leadResponse =
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
leadResponse = _b.sent();
|
|
71
|
+
_a = leadResponse.data, steps = _a.steps, entity = _a.entity;
|
|
72
|
+
hasCompleted = hasKey(steps, PASSWORD_STEP_NAMES.PASSWORD_SUCCESS);
|
|
73
|
+
if (!hasCompleted) return [3, 4];
|
|
74
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
|
|
75
|
+
case 3:
|
|
76
|
+
_b.sent();
|
|
77
|
+
thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
78
|
+
return [3, 5];
|
|
79
|
+
case 4:
|
|
80
|
+
if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
|
|
81
|
+
thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
|
|
73
82
|
}
|
|
74
|
-
|
|
75
|
-
case
|
|
83
|
+
_b.label = 5;
|
|
84
|
+
case 5: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
|
|
76
85
|
}
|
|
77
86
|
});
|
|
78
87
|
}); });
|
|
@@ -88,7 +97,7 @@ export var retrieveEntityInfo = createAsyncThunk('retrievePasswordEntityInfo', f
|
|
|
88
97
|
});
|
|
89
98
|
}); });
|
|
90
99
|
export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
91
|
-
var _a, password, settings, responseBody, payload, data, steps,
|
|
100
|
+
var _a, password, settings, responseBody, payload, data, steps, hasCompleted;
|
|
92
101
|
var _b, _c, _d, _e;
|
|
93
102
|
return __generator(this, function (_f) {
|
|
94
103
|
switch (_f.label) {
|
|
@@ -108,8 +117,8 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
|
|
|
108
117
|
if (!!data.errors) return [3, 4];
|
|
109
118
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
110
119
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
111
|
-
|
|
112
|
-
if (!
|
|
120
|
+
hasCompleted = hasKey(steps, PASSWORD_STEP_NAMES.PASSWORD_SUCCESS);
|
|
121
|
+
if (!hasCompleted) return [3, 3];
|
|
113
122
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _e === void 0 ? void 0 : _e.id))];
|
|
114
123
|
case 2:
|
|
115
124
|
_f.sent();
|
|
@@ -124,23 +133,23 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
|
|
|
124
133
|
}); });
|
|
125
134
|
export var createPassword = createAsyncThunk('createPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
135
|
var _a, settings, password, requestBody, data;
|
|
127
|
-
var _b, _c, _d;
|
|
128
|
-
return __generator(this, function (
|
|
129
|
-
switch (
|
|
136
|
+
var _b, _c, _d, _e;
|
|
137
|
+
return __generator(this, function (_f) {
|
|
138
|
+
switch (_f.label) {
|
|
130
139
|
case 0:
|
|
131
140
|
_a = thunkApi.getState(), settings = _a.settings, password = _a.password;
|
|
132
141
|
requestBody = {
|
|
133
142
|
step_name: PASSWORD_STEP_NAMES.PASSWORD_CREATE,
|
|
134
|
-
signup_token: (_b = password.data.
|
|
143
|
+
signup_token: ((_b = password.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.signup_token) || ((_c = password.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.signup_token),
|
|
135
144
|
password: params.password,
|
|
136
145
|
encryption_contract: ['password']
|
|
137
146
|
};
|
|
138
147
|
return [4, API.authService.createPassword(requestBody)];
|
|
139
148
|
case 1:
|
|
140
|
-
data = (
|
|
149
|
+
data = (_f.sent()).data;
|
|
141
150
|
if (!data.errors) {
|
|
142
151
|
thunkApi.dispatch(handleNextScreenStep());
|
|
143
|
-
(
|
|
152
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
|
|
144
153
|
}
|
|
145
154
|
return [2, { data: data, formData: params }];
|
|
146
155
|
}
|
|
@@ -216,7 +225,7 @@ export var passwordSlice = createSlice({
|
|
|
216
225
|
state.error = description;
|
|
217
226
|
return;
|
|
218
227
|
}
|
|
219
|
-
state.data.verify.responseBody = __assign(__assign({}, data), leadData);
|
|
228
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
|
|
220
229
|
state.data.verify.token = token;
|
|
221
230
|
})
|
|
222
231
|
.addCase(verifyLeadToken.pending, function (state, action) {
|
|
@@ -299,7 +308,8 @@ export var passwordSlice = createSlice({
|
|
|
299
308
|
state.error = description;
|
|
300
309
|
return;
|
|
301
310
|
}
|
|
302
|
-
|
|
311
|
+
var flows = response.flows, steps = response.steps;
|
|
312
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
|
|
303
313
|
removeRequestHeaders();
|
|
304
314
|
})
|
|
305
315
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
@@ -48,13 +48,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
|
-
import { removeRequestHeaders } from '../../../utils';
|
|
51
|
+
import { hasKey, removeRequestHeaders } from '../../../utils';
|
|
52
52
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
53
|
import { TAX_STEP_NAMES } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, data, leadResponse;
|
|
56
|
-
return __generator(this, function (
|
|
57
|
-
switch (
|
|
55
|
+
var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
|
|
56
|
+
return __generator(this, function (_b) {
|
|
57
|
+
switch (_b.label) {
|
|
58
58
|
case 0:
|
|
59
59
|
payload = {
|
|
60
60
|
service_name: 'tap_email',
|
|
@@ -62,17 +62,26 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
|
|
|
62
62
|
};
|
|
63
63
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
64
64
|
case 1:
|
|
65
|
-
data = (
|
|
65
|
+
data = (_b.sent()).data;
|
|
66
66
|
leadResponse = undefined;
|
|
67
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
67
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
|
|
68
68
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
69
69
|
case 2:
|
|
70
|
-
leadResponse =
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
leadResponse = _b.sent();
|
|
71
|
+
_a = leadResponse.data, steps = _a.steps, entity = _a.entity;
|
|
72
|
+
hasTaxCompleted = hasKey(steps, TAX_STEP_NAMES.TAX_SUCCESS);
|
|
73
|
+
if (!hasTaxCompleted) return [3, 4];
|
|
74
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
|
|
75
|
+
case 3:
|
|
76
|
+
_b.sent();
|
|
77
|
+
thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
78
|
+
return [3, 5];
|
|
79
|
+
case 4:
|
|
80
|
+
if (data.step_name === TAX_STEP_NAMES.TAX_INFO) {
|
|
81
|
+
thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
|
|
73
82
|
}
|
|
74
|
-
|
|
75
|
-
case
|
|
83
|
+
_b.label = 5;
|
|
84
|
+
case 5: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
|
|
76
85
|
}
|
|
77
86
|
});
|
|
78
87
|
}); });
|
|
@@ -108,7 +117,7 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
108
117
|
if (!!data.errors) return [3, 4];
|
|
109
118
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
110
119
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
111
|
-
hasTaxCompleted =
|
|
120
|
+
hasTaxCompleted = hasKey(steps, TAX_STEP_NAMES.TAX_SUCCESS);
|
|
112
121
|
if (!hasTaxCompleted) return [3, 3];
|
|
113
122
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _e === void 0 ? void 0 : _e.id))];
|
|
114
123
|
case 2:
|
|
@@ -214,7 +223,7 @@ export var taxSlice = createSlice({
|
|
|
214
223
|
state.error = description;
|
|
215
224
|
return;
|
|
216
225
|
}
|
|
217
|
-
state.data.verify.responseBody = __assign(__assign({}, data), leadData);
|
|
226
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
|
|
218
227
|
state.data.verify.token = token;
|
|
219
228
|
})
|
|
220
229
|
.addCase(verifyLeadToken.pending, function (state, action) {
|
|
@@ -297,7 +306,8 @@ export var taxSlice = createSlice({
|
|
|
297
306
|
state.error = description;
|
|
298
307
|
return;
|
|
299
308
|
}
|
|
300
|
-
|
|
309
|
+
var flows = response.flows, steps = response.steps;
|
|
310
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
|
|
301
311
|
removeRequestHeaders();
|
|
302
312
|
})
|
|
303
313
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { memo, useEffect } from 'react';
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig } from '../../hooks';
|
|
15
|
-
import { settingsSelector } from '../../app/settings';
|
|
15
|
+
import { handleLanguage, settingsSelector } from '../../app/settings';
|
|
16
16
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
17
17
|
import { store } from '../../app/store';
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -34,8 +34,12 @@ var Bank = memo(function (props) {
|
|
|
34
34
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
35
|
var verifyToken = function () {
|
|
36
36
|
var token = getParameterByName('token');
|
|
37
|
+
var lang = getParameterByName('lang');
|
|
37
38
|
if (!token)
|
|
38
39
|
throw new Error('Auth token is not found!');
|
|
40
|
+
if (!lang)
|
|
41
|
+
throw new Error('Language is not found!');
|
|
42
|
+
dispatch(handleLanguage(lang));
|
|
39
43
|
dispatch(verifyLeadToken(token));
|
|
40
44
|
};
|
|
41
45
|
useEffect(function () {
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { memo, useEffect } from 'react';
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
|
-
import { settingsSelector } from '../../app/settings';
|
|
15
|
+
import { handleLanguage, settingsSelector } from '../../app/settings';
|
|
16
16
|
import { FeatureContainer } from '../shared/Containers';
|
|
17
17
|
import { businessSelector, getCountries, verifyLeadToken } from '../app/business/businessStore';
|
|
18
18
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
@@ -34,8 +34,12 @@ var Business = memo(function (props) {
|
|
|
34
34
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
35
|
var verifyToken = function () {
|
|
36
36
|
var token = getParameterByName('token');
|
|
37
|
+
var lang = getParameterByName('lang');
|
|
37
38
|
if (!token)
|
|
38
39
|
throw new Error('Auth token is not found!');
|
|
40
|
+
if (!lang)
|
|
41
|
+
throw new Error('Language is not found!');
|
|
42
|
+
dispatch(handleLanguage(lang));
|
|
39
43
|
dispatch(verifyLeadToken(token));
|
|
40
44
|
};
|
|
41
45
|
useEffect(function () {
|
|
@@ -34,7 +34,7 @@ var Connect = memo(function (props) {
|
|
|
34
34
|
useEffect(function () {
|
|
35
35
|
dispatch(getCountries());
|
|
36
36
|
}, []);
|
|
37
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open,
|
|
37
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
|
|
38
38
|
var Element = _a.element, name = _a.name;
|
|
39
39
|
var isActive = activeScreen.name === name;
|
|
40
40
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { memo, useEffect } from 'react';
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
|
-
import { settingsSelector } from '../../app/settings';
|
|
15
|
+
import { handleLanguage, settingsSelector } from '../../app/settings';
|
|
16
16
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
17
17
|
import { store } from '../../app/store';
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -34,8 +34,12 @@ var Individual = memo(function (props) {
|
|
|
34
34
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
35
|
var verifyToken = function () {
|
|
36
36
|
var token = getParameterByName('token');
|
|
37
|
+
var lang = getParameterByName('lang');
|
|
37
38
|
if (!token)
|
|
38
39
|
throw new Error('Auth token is not found!');
|
|
40
|
+
if (!lang)
|
|
41
|
+
throw new Error('Language is not found!');
|
|
42
|
+
dispatch(handleLanguage(lang));
|
|
39
43
|
dispatch(verifyLeadToken(token));
|
|
40
44
|
};
|
|
41
45
|
useEffect(function () {
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { memo, useEffect } from 'react';
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
|
-
import { settingsSelector } from '../../app/settings';
|
|
15
|
+
import { handleLanguage, settingsSelector } from '../../app/settings';
|
|
16
16
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
17
17
|
import { store } from '../../app/store';
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -34,8 +34,12 @@ var Password = memo(function (props) {
|
|
|
34
34
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
35
|
var verifyToken = function () {
|
|
36
36
|
var token = getParameterByName('token');
|
|
37
|
+
var lang = getParameterByName('lang');
|
|
37
38
|
if (!token)
|
|
38
39
|
throw new Error('Auth token is not found!');
|
|
40
|
+
if (!lang)
|
|
41
|
+
throw new Error('Language is not found!');
|
|
42
|
+
dispatch(handleLanguage(lang));
|
|
39
43
|
dispatch(verifyLeadToken(token));
|
|
40
44
|
};
|
|
41
45
|
useEffect(function () {
|
|
@@ -14,7 +14,7 @@ import { memo } from 'react';
|
|
|
14
14
|
import { styled } from '@mui/material/styles';
|
|
15
15
|
import Box from '@mui/material/Box';
|
|
16
16
|
import LogoBackground from './LogoBackground';
|
|
17
|
-
var BackgroundStyled = styled(Box)(function (_a) {
|
|
17
|
+
var BackgroundStyled = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'isTapOrigin'; } })(function (_a) {
|
|
18
18
|
var isTapOrigin = _a.isTapOrigin;
|
|
19
19
|
return ({
|
|
20
20
|
width: '100%',
|
|
@@ -24,6 +24,6 @@ var BackgroundStyled = styled(Box)(function (_a) {
|
|
|
24
24
|
});
|
|
25
25
|
var Background = function (_a) {
|
|
26
26
|
var children = _a.children, isTapOrigin = _a.isTapOrigin, loading = _a.loading;
|
|
27
|
-
return (_jsxs(BackgroundStyled, __assign({ isTapOrigin: isTapOrigin }, { children: [_jsx(LogoBackground, {
|
|
27
|
+
return (_jsxs(BackgroundStyled, __assign({ isTapOrigin: isTapOrigin }, { children: [_jsx(LogoBackground, { hide: loading || !isTapOrigin }), children] })));
|
|
28
28
|
};
|
|
29
29
|
export default memo(Background);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare type LogoBackgroundProps = {
|
|
3
|
-
|
|
3
|
+
hide?: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({
|
|
5
|
+
declare const _default: React.MemoExoticComponent<({ hide }: LogoBackgroundProps) => JSX.Element>;
|
|
6
6
|
export default _default;
|
|
@@ -11,13 +11,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { memo } from 'react';
|
|
14
|
-
import { styled } from '@mui/material/styles';
|
|
14
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
15
15
|
import Collapse from '@mui/material/Collapse';
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import Icon from '../../../components/Icon';
|
|
18
18
|
import { ICONS_NAMES } from '../../../constants';
|
|
19
19
|
import { useLanguage } from '../../../hooks';
|
|
20
|
-
import Fade from '@mui/material/Fade';
|
|
21
20
|
var BoxStyled = styled(Box)(function (_a) {
|
|
22
21
|
var _b;
|
|
23
22
|
var theme = _a.theme;
|
|
@@ -26,10 +25,11 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
26
25
|
flexDirection: 'column',
|
|
27
26
|
justifyContent: 'center',
|
|
28
27
|
alignItems: 'center',
|
|
29
|
-
paddingTop: theme.spacing(5)
|
|
28
|
+
paddingTop: theme.spacing(5),
|
|
29
|
+
paddingBottom: theme.spacing(2)
|
|
30
30
|
},
|
|
31
31
|
_b[theme.breakpoints.down('sm')] = {
|
|
32
|
-
paddingTop: theme.spacing(11
|
|
32
|
+
paddingTop: theme.spacing(11)
|
|
33
33
|
},
|
|
34
34
|
_b);
|
|
35
35
|
});
|
|
@@ -44,7 +44,7 @@ var LogoIconBoxStyled = styled(Box)(function (_a) {
|
|
|
44
44
|
var _b;
|
|
45
45
|
var theme = _a.theme;
|
|
46
46
|
return (_b = {
|
|
47
|
-
paddingTop: theme.spacing(2.
|
|
47
|
+
paddingTop: theme.spacing(2.5),
|
|
48
48
|
width: '100%',
|
|
49
49
|
display: 'flex',
|
|
50
50
|
justifyContent: 'center'
|
|
@@ -63,8 +63,11 @@ var LogoIconStyled = styled(Icon)(function (_a) {
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
var LogoBackground = function (_a) {
|
|
66
|
-
var
|
|
66
|
+
var hide = _a.hide;
|
|
67
67
|
var isAr = useLanguage().isAr;
|
|
68
|
-
|
|
68
|
+
var theme = useTheme();
|
|
69
|
+
var style = getComputedStyle(document.body);
|
|
70
|
+
console.log(style.getPropertyValue('--rsbs-overlay-h'));
|
|
71
|
+
return (_jsx(Collapse, __assign({ in: !hide }, { children: _jsxs(BoxStyled, { children: [_jsx(LogoBadgeStyled, { src: ICONS_NAMES.TAP_LOGO_EN_ICON }), _jsx(LogoIconBoxStyled, { children: _jsx(LogoIconStyled, { src: isAr ? ICONS_NAMES.TAP_LOGO_TEXT_AR : ICONS_NAMES.TAP_LOGO_TEXT_EN, alt: 'tap logo' }) })] }) })));
|
|
69
72
|
};
|
|
70
73
|
export default memo(LogoBackground);
|
|
@@ -25,6 +25,9 @@ var Container = styled(Box)(function (_a) {
|
|
|
25
25
|
easing: theme.transitions.easing.easeInOut,
|
|
26
26
|
property: 'all'
|
|
27
27
|
},
|
|
28
|
+
_b[theme.breakpoints.down('sm')] = {
|
|
29
|
+
paddingTop: theme.spacing(5)
|
|
30
|
+
},
|
|
28
31
|
_b);
|
|
29
32
|
});
|
|
30
33
|
var FeatureContainer = React.forwardRef(function (props, ref) {
|
|
@@ -9,7 +9,7 @@ export default function CustomFooter() {
|
|
|
9
9
|
var isEn = useLanguage().isEn;
|
|
10
10
|
var t = useTranslation().t;
|
|
11
11
|
var dispatch = useAppDispatch();
|
|
12
|
-
var
|
|
12
|
+
var data = useAppSelector(connectSelector).data;
|
|
13
13
|
var handleChangeLanguage = function () {
|
|
14
14
|
var language = isEn ? LanguageMode.AR : LanguageMode.EN;
|
|
15
15
|
dispatch(handleLanguage(language));
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { memo, useEffect } from 'react';
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
|
-
import { settingsSelector } from '../../app/settings';
|
|
15
|
+
import { handleLanguage, settingsSelector } from '../../app/settings';
|
|
16
16
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
17
17
|
import { store } from '../../app/store';
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -34,8 +34,12 @@ var Tax = memo(function (props) {
|
|
|
34
34
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
35
|
var verifyToken = function () {
|
|
36
36
|
var token = getParameterByName('token');
|
|
37
|
+
var lang = getParameterByName('lang');
|
|
37
38
|
if (!token)
|
|
38
39
|
throw new Error('Auth token is not found!');
|
|
40
|
+
if (!lang)
|
|
41
|
+
throw new Error('Language is not found!');
|
|
42
|
+
dispatch(handleLanguage(lang));
|
|
39
43
|
dispatch(verifyLeadToken(token));
|
|
40
44
|
};
|
|
41
45
|
useEffect(function () {
|
package/build/utils/locale.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { LocalProps } from '../@types';
|
|
2
|
-
export declare const updateLocale: (locale: LocalProps) => void;
|
|
2
|
+
export declare const updateLocale: (locale: LocalProps, country: string) => void;
|
package/build/utils/locale.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { initReactI18next } from 'react-i18next';
|
|
2
2
|
import i18n from '../i18n';
|
|
3
|
-
export var updateLocale = function (locale) {
|
|
3
|
+
export var updateLocale = function (locale, country) {
|
|
4
|
+
var data = locale[country] || locale['default'];
|
|
4
5
|
if (i18n.isInitialized) {
|
|
5
6
|
i18n.removeResourceBundle('*', 'translation');
|
|
6
|
-
i18n.addResourceBundle('en', 'translation',
|
|
7
|
-
i18n.addResourceBundle('ar', 'translation',
|
|
7
|
+
i18n.addResourceBundle('en', 'translation', data.en.translation);
|
|
8
|
+
i18n.addResourceBundle('ar', 'translation', data.ar.translation);
|
|
8
9
|
}
|
|
9
10
|
else {
|
|
10
11
|
i18n.use(initReactI18next).init({
|
package/build/utils/object.d.ts
CHANGED
package/build/utils/object.js
CHANGED
|
@@ -16,3 +16,8 @@ export var decodeObjectBase64 = function (str) {
|
|
|
16
16
|
throw new Error('Invalid base64 string or invalid json format. try to check [decodeObjectBase64]');
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
+
export var hasKey = function (obj, key) {
|
|
20
|
+
if (!obj)
|
|
21
|
+
return false;
|
|
22
|
+
return Object.keys(obj).includes(key);
|
|
23
|
+
};
|
package/build/utils/string.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const getIndividualName: (name: string) => {
|
|
|
10
10
|
export declare const convertNumbers2English: (str: string) => string;
|
|
11
11
|
export declare const getParameterByName: (name: string) => string | null;
|
|
12
12
|
export declare const getClientEmailUrl: () => string;
|
|
13
|
-
export declare const getFlowUrl: (path: string) => string;
|
|
13
|
+
export declare const getFlowUrl: (path: string, lang: string) => string;
|
|
14
14
|
export declare const capitalizeTheFirstLetterOfEachWord: (words: string) => string;
|
|
15
15
|
export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
|
|
16
16
|
al: string;
|
package/build/utils/string.js
CHANGED
|
@@ -56,9 +56,9 @@ export var getClientEmailUrl = function () {
|
|
|
56
56
|
var origin = window.location.origin;
|
|
57
57
|
return origin + '/?token=';
|
|
58
58
|
};
|
|
59
|
-
export var getFlowUrl = function (path) {
|
|
59
|
+
export var getFlowUrl = function (path, lang) {
|
|
60
60
|
var origin = window.location.origin;
|
|
61
|
-
return origin + path +
|
|
61
|
+
return origin + path + "?lang=".concat(lang, "&token=");
|
|
62
62
|
};
|
|
63
63
|
export var capitalizeTheFirstLetterOfEachWord = function (words) {
|
|
64
64
|
var separateWord = words.toLowerCase().split(' ');
|