@tap-payments/auth-jsconnect 1.0.86 → 1.0.89
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 +216 -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 +9 -9
- package/build/features/app/connect/connectStore.js +8 -1
- 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/connect/Connect.js +1 -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/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/package.json +126 -126
package/README.md
CHANGED
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
## ErrorObject
|
|
75
|
+
|
|
76
|
+
- `statusCode`: the status code of the error. `required`
|
|
77
|
+
- `message`: the error message. `required`
|
|
78
|
+
- `description`: the error description. `optional`
|
|
79
|
+
- `help`: the error url that can help the client to fix the api issue e.g
|
|
80
|
+
(<https://your-domain.example/integration/fixes/auth-api>) `optional`
|
|
81
|
+
- `invalidParams`: the errors of request in case you need to validate the
|
|
82
|
+
request data. `optional`
|
|
83
|
+
|
|
84
|
+
- `message`: the error message. `required`
|
|
85
|
+
- `param`: the error parameter name e.g (email, password, name, etc). `optional`
|
|
86
|
+
- `location`: the location of parameter key. `required`
|
|
87
|
+
|
|
88
|
+
- `errorKey`: the error key and the main purpose we can use it for localization part
|
|
89
|
+
and in this case we will have a generic errors we can catch any error message
|
|
90
|
+
by key `for example:` we can store local.en.json and local.en.json includes
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{ "bad_request": "invalid user request data" }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
and local.ar.json includes
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{ "bad_request": "بايانات غير صحيحة" }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
and the both files located in the
|
|
103
|
+
frontend so by using the response `errorKey` we can localize the error message
|
|
104
|
+
easily. `optional`
|
|
105
|
+
|
|
106
|
+
## HttpError
|
|
107
|
+
|
|
108
|
+
### Initializer
|
|
109
|
+
|
|
110
|
+
it's a middleware should be used in the top of your app or at lest before your
|
|
111
|
+
routes that include `HttpError`
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
// in the beginning of your app (important)
|
|
115
|
+
app.use(HttpError.initializer)
|
|
116
|
+
// OR
|
|
117
|
+
app.use((req, res, next) => {
|
|
118
|
+
HttpError.initializer(req, res, next)
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Handler
|
|
123
|
+
|
|
124
|
+
it's a middleware and it will handle all the errors returned by
|
|
125
|
+
`HttpError` functions and it will send it back to the client but if the error
|
|
126
|
+
not belong ot the lib it will pass it using next fun
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
// in the end of your app (important)
|
|
130
|
+
app.use(HttpError.handler)
|
|
131
|
+
// OR
|
|
132
|
+
app.use((err, req, res, next) => {
|
|
133
|
+
HttpError.handler(err, req, res, next)
|
|
134
|
+
})
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### customError
|
|
138
|
+
|
|
139
|
+
it's a helper function can help you to create your custom error.
|
|
140
|
+
|
|
141
|
+
### HttpError.{{ any function from the next list }}
|
|
142
|
+
|
|
143
|
+
- they are helper functions allow you to send sepecific error to the client
|
|
144
|
+
|
|
145
|
+
- `attrs` error object to customize your error response `optional`
|
|
146
|
+
- `message`: the error message. `required`
|
|
147
|
+
- `errorKey`: the error key. `optional`
|
|
148
|
+
- `help`: the error help location/url. `optional`
|
|
149
|
+
- `description`: the error description `optional`
|
|
150
|
+
- `invalidParams`: the request parameters errors `optional`
|
|
151
|
+
|
|
152
|
+
| status code | function name |
|
|
153
|
+
| ----------- | ----------------------------- |
|
|
154
|
+
| 400 | BadRequest |
|
|
155
|
+
| 401 | Unauthorized |
|
|
156
|
+
| 402 | PaymentRequired |
|
|
157
|
+
| 403 | Forbidden |
|
|
158
|
+
| 404 | NotFound |
|
|
159
|
+
| 405 | MethodNotAllowed |
|
|
160
|
+
| 406 | NotAcceptable |
|
|
161
|
+
| 407 | ProxyAuthenticationRequired |
|
|
162
|
+
| 408 | RequestTimeout |
|
|
163
|
+
| 409 | Conflict |
|
|
164
|
+
| 410 | Gone |
|
|
165
|
+
| 411 | LengthRequired |
|
|
166
|
+
| 412 | PreconditionFailed |
|
|
167
|
+
| 413 | PayloadTooLarge |
|
|
168
|
+
| 414 | URITooLong |
|
|
169
|
+
| 415 | UnsupportedMediaType |
|
|
170
|
+
| 416 | RangeNotSatisfiable |
|
|
171
|
+
| 417 | ExpectationFailed |
|
|
172
|
+
| 418 | ImATeapot |
|
|
173
|
+
| 421 | MisdirectedRequest |
|
|
174
|
+
| 422 | UnprocessableEntity |
|
|
175
|
+
| 423 | Locked |
|
|
176
|
+
| 424 | FailedDependency |
|
|
177
|
+
| 425 | TooEarly |
|
|
178
|
+
| 426 | UpgradeRequired |
|
|
179
|
+
| 428 | PreconditionRequired |
|
|
180
|
+
| 429 | TooManyRequests |
|
|
181
|
+
| 431 | RequestHeaderFieldsTooLarge |
|
|
182
|
+
| 451 | UnavailableForLegalReasons |
|
|
183
|
+
| 500 | InternalServerError |
|
|
184
|
+
| 501 | NotImplemented |
|
|
185
|
+
| 502 | BadGateway |
|
|
186
|
+
| 503 | ServiceUnavailable |
|
|
187
|
+
| 504 | GatewayTimeout |
|
|
188
|
+
| 505 | HTTPVersionNotSupported |
|
|
189
|
+
| 506 | VariantAlsoNegotiates |
|
|
190
|
+
| 507 | InsufficientStorage |
|
|
191
|
+
| 508 | LoopDetected |
|
|
192
|
+
| 509 | BandwidthLimitExceeded |
|
|
193
|
+
| 510 | NotExtended |
|
|
194
|
+
| 511 | NetworkAuthenticationRequired |
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## RequestValidator
|
|
199
|
+
|
|
200
|
+
it's a middleware should be used after validating the request
|
|
201
|
+
body/parameter/query using `express-validator` library
|
|
202
|
+
|
|
203
|
+
```js
|
|
204
|
+
import { body } from 'express-validator'
|
|
205
|
+
import { RequestValidator } from 'http-error-handling'
|
|
206
|
+
import express, { NextFunction, Request, Response } from 'express'
|
|
207
|
+
let app = express()
|
|
208
|
+
//sample API
|
|
209
|
+
app.get('/validate', body('email').isEmail(), RequestValidator, (req: Request, res: Response, next: NextFunction) => {
|
|
210
|
+
return res.send(req.body)
|
|
211
|
+
})
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
[MIT](LICENSE)
|
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:
|
|
@@ -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:
|
|
@@ -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, {}>;
|