@tap-payments/auth-jsconnect 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/form.d.ts +3 -0
- package/build/@types/redux.d.ts +0 -1
- package/build/api/entity.d.ts +1 -0
- package/build/api/entity.js +8 -1
- package/build/api/index.d.ts +1 -0
- package/build/app/rootReducer.d.ts +1 -0
- package/build/app/rootReducer.js +3 -1
- package/build/app/store.d.ts +2 -0
- package/build/assets/locales/ar.json +2 -1
- package/build/assets/locales/en.json +2 -1
- package/build/components/FileInput/DragAndDrop.js +1 -1
- package/build/constants/app.d.ts +9 -0
- package/build/constants/app.js +34 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.d.ts +1 -0
- package/build/features/app/business/businessStore.d.ts +5 -3
- package/build/features/app/business/businessStore.js +34 -21
- package/build/features/app/connect/connectStore.d.ts +2 -1
- package/build/features/app/connect/connectStore.js +69 -38
- package/build/features/app/individual/individualStore.d.ts +1 -0
- package/build/features/app/individual/individualStore.js +1 -1
- package/build/features/app/password/passwordStore.d.ts +1 -0
- package/build/features/app/signIn/signInStore.d.ts +33 -0
- package/build/features/app/signIn/signInStore.js +389 -0
- package/build/features/app/tax/taxStore.d.ts +1 -0
- package/build/features/connect/screens/Merchant/validation.js +1 -1
- package/build/features/featuresScreens.d.ts +1 -0
- package/build/features/featuresScreens.js +22 -0
- package/build/features/shared/UploadFile/UploadFile.js +8 -7
- package/build/features/signIn/SignIn.d.ts +7 -0
- package/build/features/signIn/SignIn.js +49 -0
- package/build/features/signIn/index.d.ts +1 -0
- package/build/features/signIn/index.js +1 -0
- package/build/features/signIn/screens/Email/Email.d.ts +5 -0
- package/build/features/signIn/screens/Email/Email.js +95 -0
- package/build/features/signIn/screens/Email/EmailField.d.ts +5 -0
- package/build/features/signIn/screens/Email/EmailField.js +55 -0
- package/build/features/signIn/screens/Email/index.d.ts +3 -0
- package/build/features/signIn/screens/Email/index.js +2 -0
- package/build/features/signIn/screens/Email/validation.d.ts +8 -0
- package/build/features/signIn/screens/Email/validation.js +5 -0
- package/build/features/signIn/screens/Mobile/Mobile.d.ts +5 -0
- package/build/features/signIn/screens/Mobile/Mobile.js +106 -0
- package/build/features/signIn/screens/Mobile/MobileNumber.d.ts +11 -0
- package/build/features/signIn/screens/Mobile/MobileNumber.js +151 -0
- package/build/features/signIn/screens/Mobile/index.d.ts +3 -0
- package/build/features/signIn/screens/Mobile/index.js +2 -0
- package/build/features/signIn/screens/Mobile/validation.d.ts +8 -0
- package/build/features/signIn/screens/Mobile/validation.js +28 -0
- package/build/features/signIn/screens/OTP/OTP.d.ts +5 -0
- package/build/features/signIn/screens/OTP/OTP.js +80 -0
- package/build/features/signIn/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/signIn/screens/OTP/OTPInput.js +53 -0
- package/build/features/signIn/screens/OTP/index.d.ts +3 -0
- package/build/features/signIn/screens/OTP/index.js +2 -0
- package/build/features/signIn/screens/OTP/validation.d.ts +8 -0
- package/build/features/signIn/screens/OTP/validation.js +4 -0
- package/build/features/signIn/screens/Password/Password.d.ts +5 -0
- package/build/features/signIn/screens/Password/Password.js +54 -0
- package/build/features/signIn/screens/Password/PasswordInput.d.ts +5 -0
- package/build/features/signIn/screens/Password/PasswordInput.js +28 -0
- package/build/features/signIn/screens/Password/index.d.ts +3 -0
- package/build/features/signIn/screens/Password/index.js +2 -0
- package/build/features/signIn/screens/Password/validation.d.ts +8 -0
- package/build/features/signIn/screens/Password/validation.js +4 -0
- package/build/hooks/useAppDispatch.d.ts +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +5 -2
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +4 -0
- package/package.json +128 -128
package/build/@types/form.d.ts
CHANGED
package/build/@types/redux.d.ts
CHANGED
package/build/api/entity.d.ts
CHANGED
|
@@ -50,5 +50,6 @@ declare const entityService: {
|
|
|
50
50
|
retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
51
51
|
updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
|
52
52
|
uploadFileInfo: (data: UploadFileBody) => Promise<any>;
|
|
53
|
+
retrieveBusinessInfo: (entity_id: string) => Promise<any>;
|
|
53
54
|
};
|
|
54
55
|
export { entityService };
|
package/build/api/entity.js
CHANGED
|
@@ -41,12 +41,19 @@ var updateIndividualInfo = function (_a) {
|
|
|
41
41
|
data: data
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
+
var retrieveBusinessInfo = function (entity_id) {
|
|
45
|
+
return httpClient({
|
|
46
|
+
method: 'get',
|
|
47
|
+
url: "".concat(ENDPOINT_PATHS.ENTITY, "/").concat(entity_id, "/info")
|
|
48
|
+
});
|
|
49
|
+
};
|
|
44
50
|
var entityService = {
|
|
45
51
|
createEntityInfo: createEntityInfo,
|
|
46
52
|
updateEntityInfo: updateEntityInfo,
|
|
47
53
|
createBankAccount: createBankAccount,
|
|
48
54
|
retrieveEntityInfo: retrieveEntityInfo,
|
|
49
55
|
updateIndividualInfo: updateIndividualInfo,
|
|
50
|
-
uploadFileInfo: uploadFileInfo
|
|
56
|
+
uploadFileInfo: uploadFileInfo,
|
|
57
|
+
retrieveBusinessInfo: retrieveBusinessInfo
|
|
51
58
|
};
|
|
52
59
|
export { entityService };
|
package/build/api/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare const API: {
|
|
|
37
37
|
retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
38
38
|
updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
|
|
39
39
|
uploadFileInfo: (data: import("./entity").UploadFileBody) => Promise<any>;
|
|
40
|
+
retrieveBusinessInfo: (entity_id: string) => Promise<any>;
|
|
40
41
|
};
|
|
41
42
|
availabilityServices: {
|
|
42
43
|
checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -6,5 +6,6 @@ declare const rootReducer: {
|
|
|
6
6
|
tax: import("redux").Reducer<import("../features/app/tax/taxStore").TaxState, import("redux").AnyAction>;
|
|
7
7
|
individual: import("redux").Reducer<import("../features/app/individual/individualStore").IndividualState, import("redux").AnyAction>;
|
|
8
8
|
password: import("redux").Reducer<import("../features/app/password/passwordStore").PasswordState, import("redux").AnyAction>;
|
|
9
|
+
signIn: import("redux").Reducer<import("../features/app/signIn/signInStore").SignInState, import("redux").AnyAction>;
|
|
9
10
|
};
|
|
10
11
|
export default rootReducer;
|
package/build/app/rootReducer.js
CHANGED
|
@@ -5,6 +5,7 @@ import bank from '../features/app/bank/bankStore';
|
|
|
5
5
|
import tax from '../features/app/tax/taxStore';
|
|
6
6
|
import individual from '../features/app/individual/individualStore';
|
|
7
7
|
import password from '../features/app/password/passwordStore';
|
|
8
|
+
import signIn from '../features/app/signIn/signInStore';
|
|
8
9
|
var rootReducer = {
|
|
9
10
|
settings: settings,
|
|
10
11
|
connect: connect,
|
|
@@ -12,6 +13,7 @@ var rootReducer = {
|
|
|
12
13
|
bank: bank,
|
|
13
14
|
tax: tax,
|
|
14
15
|
individual: individual,
|
|
15
|
-
password: password
|
|
16
|
+
password: password,
|
|
17
|
+
signIn: signIn
|
|
16
18
|
};
|
|
17
19
|
export default rootReducer;
|
package/build/app/store.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
7
7
|
tax: import("../features/app/tax/taxStore").TaxState;
|
|
8
8
|
individual: import("../features/app/individual/individualStore").IndividualState;
|
|
9
9
|
password: import("../features/app/password/passwordStore").PasswordState;
|
|
10
|
+
signIn: import("../features/app/signIn/signInStore").SignInState;
|
|
10
11
|
}, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
|
|
11
12
|
settings: import("./settings").SettingsState;
|
|
12
13
|
connect: import("../features/app/connect/connectStore").ConnectState;
|
|
@@ -15,6 +16,7 @@ export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
|
|
|
15
16
|
tax: import("../features/app/tax/taxStore").TaxState;
|
|
16
17
|
individual: import("../features/app/individual/individualStore").IndividualState;
|
|
17
18
|
password: import("../features/app/password/passwordStore").PasswordState;
|
|
19
|
+
signIn: import("../features/app/signIn/signInStore").SignInState;
|
|
18
20
|
}, import("redux").AnyAction, undefined>]>>;
|
|
19
21
|
export declare type AppDispatch = typeof store.dispatch;
|
|
20
22
|
export declare type RootState = ReturnType<typeof store.getState>;
|
|
@@ -243,5 +243,6 @@
|
|
|
243
243
|
"bank": "bank",
|
|
244
244
|
"reset_password_success_title": "لقد ارسلنا رسالة بريدية إليك",
|
|
245
245
|
"reset_password_success_description": "تحقق من بريدك الإلكتروني لإعادة تعيين كلمة المرور الخاصة بك.",
|
|
246
|
-
"license_name_label": "اسم الرخصة"
|
|
246
|
+
"license_name_label": "اسم الرخصة",
|
|
247
|
+
"email_button_label": "تواصل مع البريد الإلكتروني"
|
|
247
248
|
}
|
|
@@ -263,5 +263,6 @@
|
|
|
263
263
|
"bank": "bank",
|
|
264
264
|
"reset_password_success_title": "We sent you an email",
|
|
265
265
|
"reset_password_success_description": "Check your email to reset your password.",
|
|
266
|
-
"license_name_label": "License Name"
|
|
266
|
+
"license_name_label": "License Name",
|
|
267
|
+
"email_button_label": "Continue with Email"
|
|
267
268
|
}
|
|
@@ -27,7 +27,7 @@ var DragAndDrop = function (_a) {
|
|
|
27
27
|
var _b = useDropzone({
|
|
28
28
|
maxFiles: 1,
|
|
29
29
|
noKeyboard: true,
|
|
30
|
-
noClick:
|
|
30
|
+
noClick: false,
|
|
31
31
|
multiple: false,
|
|
32
32
|
onDrop: function (files) {
|
|
33
33
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(files === null || files === void 0 ? void 0 : files[0]);
|
package/build/constants/app.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare const INDIVIDUAL_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
|
18
18
|
export declare const PASSWORD_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
19
19
|
export declare const BANK_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
20
20
|
export declare const TAX_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
21
|
+
export declare const SigIn_SCREENS_NAVIGATION: Array<ScreenStepNavigation>;
|
|
21
22
|
export declare const DefaultDeviceInfo: {
|
|
22
23
|
source: string;
|
|
23
24
|
device: {
|
|
@@ -79,6 +80,14 @@ export declare const CONNECT_STEP_NAMES: {
|
|
|
79
80
|
VERIFY_AUTH_PASSWORD: string;
|
|
80
81
|
CONNECT_SUCCESS: string;
|
|
81
82
|
};
|
|
83
|
+
export declare const SignIn_STEP_NAMES: {
|
|
84
|
+
CREATE_AUTH_MOBILE: string;
|
|
85
|
+
VERIFY_AUTH_MOBILE: string;
|
|
86
|
+
CREATE_AUTH_EMAIL: string;
|
|
87
|
+
VERIFY_AUTH_EMAIL: string;
|
|
88
|
+
VERIFY_AUTH_MOBILE_OTP: string;
|
|
89
|
+
VERIFY_AUTH_EMAIL_OTP: string;
|
|
90
|
+
};
|
|
82
91
|
export declare const BUSINESS_STEP_NAMES: {
|
|
83
92
|
BUSINESS_INFO: string;
|
|
84
93
|
PHONE_AUTH: string;
|
package/build/constants/app.js
CHANGED
|
@@ -253,6 +253,32 @@ export var TAX_SCREENS_NAVIGATION = [
|
|
|
253
253
|
order: 5
|
|
254
254
|
}
|
|
255
255
|
];
|
|
256
|
+
export var SigIn_SCREENS_NAVIGATION = [
|
|
257
|
+
{
|
|
258
|
+
name: 'SIGIN_MOBILE_STEP',
|
|
259
|
+
next: ['SIGIN_OTP_STEP', 'SIGIN_PASSWORD_STEP'],
|
|
260
|
+
prev: 'SIGIN_EMAIL_STEP',
|
|
261
|
+
order: 1
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: 'SIGIN_EMAIL_STEP',
|
|
265
|
+
next: ['SIGIN_OTP_STEP', 'SIGIN_PASSWORD_STEP'],
|
|
266
|
+
prev: 'SIGIN_MOBILE_STEP',
|
|
267
|
+
order: 1
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: 'SIGIN_PASSWORD_STEP',
|
|
271
|
+
next: 'SIGIN_OTP_STEP',
|
|
272
|
+
prev: ['SIGIN_MOBILE_STEP', 'SIGIN_EMAIL_STEP'],
|
|
273
|
+
order: 2
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: 'SIGIN_OTP_STEP',
|
|
277
|
+
next: '',
|
|
278
|
+
prev: ['SIGIN_MOBILE_STEP', 'SIGIN_EMAIL_STEP'],
|
|
279
|
+
order: 3
|
|
280
|
+
}
|
|
281
|
+
];
|
|
256
282
|
export var DefaultDeviceInfo = {
|
|
257
283
|
source: 'browser',
|
|
258
284
|
device: {
|
|
@@ -314,6 +340,14 @@ export var CONNECT_STEP_NAMES = {
|
|
|
314
340
|
VERIFY_AUTH_PASSWORD: 'connect_verify_auth_password',
|
|
315
341
|
CONNECT_SUCCESS: 'connect_completed'
|
|
316
342
|
};
|
|
343
|
+
export var SignIn_STEP_NAMES = {
|
|
344
|
+
CREATE_AUTH_MOBILE: 'signIn_create_auth_mobile',
|
|
345
|
+
VERIFY_AUTH_MOBILE: 'signIn_verify_auth_mobile',
|
|
346
|
+
CREATE_AUTH_EMAIL: 'signIn_create_auth_email',
|
|
347
|
+
VERIFY_AUTH_EMAIL: 'signIn_verify_auth_email',
|
|
348
|
+
VERIFY_AUTH_MOBILE_OTP: 'signIn_verify_auth_mobile_otp',
|
|
349
|
+
VERIFY_AUTH_EMAIL_OTP: 'signIn_verify_auth_email_otp'
|
|
350
|
+
};
|
|
317
351
|
export var BUSINESS_STEP_NAMES = {
|
|
318
352
|
BUSINESS_INFO: 'business_info',
|
|
319
353
|
PHONE_AUTH: 'business_phone_auth',
|
|
@@ -11,3 +11,4 @@ export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-z
|
|
|
11
11
|
export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
|
|
12
12
|
export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z\s])*$/g;
|
|
13
13
|
export var REGEX_BRAND_NAME = /(.*[a-zA-Z0-9]){3}/g;
|
|
14
|
+
export var EMAIL_MAX_LENGTH = 50;
|
|
@@ -41,6 +41,7 @@ export interface BankData {
|
|
|
41
41
|
flowName: FlowsTypes;
|
|
42
42
|
}
|
|
43
43
|
export interface BankState extends SharedState<BankData> {
|
|
44
|
+
customLoading?: boolean;
|
|
44
45
|
}
|
|
45
46
|
export declare const bankSlice: import("@reduxjs/toolkit").Slice<BankState, {
|
|
46
47
|
clearError: (state: BankState) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes } from '../../../@types';
|
|
2
|
+
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, SalesChannel } from '../../../@types';
|
|
3
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
4
|
data: any;
|
|
5
5
|
leadData: any;
|
|
@@ -14,6 +14,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
14
14
|
isNID: boolean;
|
|
15
15
|
otp: string;
|
|
16
16
|
};
|
|
17
|
+
entityInfo: any;
|
|
17
18
|
}, OTPFormValues, {}>;
|
|
18
19
|
export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
|
|
19
20
|
data: any;
|
|
@@ -41,8 +42,8 @@ export declare const createAccount: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
41
42
|
export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
42
43
|
data: any;
|
|
43
44
|
formData: {
|
|
44
|
-
activities:
|
|
45
|
-
salesChannels:
|
|
45
|
+
activities: Activity[] | undefined;
|
|
46
|
+
salesChannels: SalesChannel[];
|
|
46
47
|
operationStartDate: string;
|
|
47
48
|
};
|
|
48
49
|
}, ActivitiesFormValues, {}>;
|
|
@@ -79,6 +80,7 @@ export interface BusinessData {
|
|
|
79
80
|
flowName: FlowsTypes;
|
|
80
81
|
}
|
|
81
82
|
export interface BusinessState extends SharedState<BusinessData> {
|
|
83
|
+
customLoading?: boolean;
|
|
82
84
|
}
|
|
83
85
|
export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
|
|
84
86
|
clearError: (state: BusinessState) => void;
|
|
@@ -108,32 +108,33 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
108
108
|
});
|
|
109
109
|
}); });
|
|
110
110
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
-
var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
|
|
112
|
-
var _b, _c, _d, _e;
|
|
113
|
-
return __generator(this, function (
|
|
114
|
-
switch (
|
|
111
|
+
var _a, business, settings, isNID, responseBody, verifyResponse, stepName, entityID, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, entityInfo;
|
|
112
|
+
var _b, _c, _d, _e, _f, _g;
|
|
113
|
+
return __generator(this, function (_h) {
|
|
114
|
+
switch (_h.label) {
|
|
115
115
|
case 0:
|
|
116
116
|
_a = thunkApi.getState(), business = _a.business, settings = _a.settings;
|
|
117
117
|
isNID = business.data.otpData.isNID;
|
|
118
118
|
responseBody = (isNID ? business.data.nidData : business.data.verify).responseBody;
|
|
119
119
|
verifyResponse = business.data.verify.responseBody;
|
|
120
120
|
stepName = isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH;
|
|
121
|
+
entityID = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.id;
|
|
121
122
|
payload = {
|
|
122
123
|
data: params.otp,
|
|
123
|
-
service_name: (
|
|
124
|
+
service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
|
|
124
125
|
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
125
126
|
step_name: stepName,
|
|
126
127
|
encryption_contract: ['data']
|
|
127
128
|
};
|
|
128
129
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
129
130
|
case 1:
|
|
130
|
-
data = (
|
|
131
|
+
data = (_h.sent()).data;
|
|
131
132
|
if (!!data.errors) return [3, 11];
|
|
132
133
|
thunkApi.dispatch(updateStepName(stepName));
|
|
133
134
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
134
135
|
case 2:
|
|
135
|
-
|
|
136
|
-
(
|
|
136
|
+
_h.sent();
|
|
137
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
137
138
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
138
139
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
139
140
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
|
|
@@ -144,9 +145,9 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
144
145
|
return [3, 11];
|
|
145
146
|
case 3:
|
|
146
147
|
if (!hasBusinessCompleted) return [3, 5];
|
|
147
|
-
return [4, thunkApi.dispatch(retrieveEntityInfo((
|
|
148
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo((_g = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.entity) === null || _g === void 0 ? void 0 : _g.id))];
|
|
148
149
|
case 4:
|
|
149
|
-
|
|
150
|
+
_h.sent();
|
|
150
151
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
151
152
|
return [3, 11];
|
|
152
153
|
case 5:
|
|
@@ -159,6 +160,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
159
160
|
return [3, 11];
|
|
160
161
|
case 7:
|
|
161
162
|
if (!hasBusinessCRActivitiesCompleted) return [3, 8];
|
|
163
|
+
thunkApi.dispatch(retrieveChannels());
|
|
162
164
|
thunkApi.dispatch(retrieveDataList());
|
|
163
165
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
164
166
|
return [3, 11];
|
|
@@ -166,13 +168,16 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
166
168
|
if (!hasBusinessCRInfoCompleted) return [3, 10];
|
|
167
169
|
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
168
170
|
case 9:
|
|
169
|
-
|
|
171
|
+
_h.sent();
|
|
170
172
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
171
173
|
return [3, 11];
|
|
172
174
|
case 10:
|
|
173
175
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
174
|
-
|
|
175
|
-
case 11: return [
|
|
176
|
+
_h.label = 11;
|
|
177
|
+
case 11: return [4, API.entityService.retrieveBusinessInfo(entityID)];
|
|
178
|
+
case 12:
|
|
179
|
+
entityInfo = _h.sent();
|
|
180
|
+
return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), entityInfo: entityInfo }];
|
|
176
181
|
}
|
|
177
182
|
});
|
|
178
183
|
}); });
|
|
@@ -582,10 +587,10 @@ export var businessSlice = createSlice({
|
|
|
582
587
|
state.error = null;
|
|
583
588
|
})
|
|
584
589
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
585
|
-
var _a, _b, _c;
|
|
590
|
+
var _a, _b, _c, _d;
|
|
586
591
|
state.loading = false;
|
|
587
592
|
state.error = null;
|
|
588
|
-
var
|
|
593
|
+
var _e = action.payload, data = _e.data, formData = _e.formData, entityInfo = _e.entityInfo;
|
|
589
594
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
590
595
|
if (description) {
|
|
591
596
|
state.error = description;
|
|
@@ -593,21 +598,29 @@ export var businessSlice = createSlice({
|
|
|
593
598
|
}
|
|
594
599
|
state.data.otpData = formData;
|
|
595
600
|
state.data.otpData.responseBody = data;
|
|
596
|
-
var
|
|
597
|
-
var issuingDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
|
|
601
|
+
var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
|
|
602
|
+
var issuingDate = entityInfo ? entityInfo.business_operation_start_at : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
|
|
598
603
|
if (!!issuingDate) {
|
|
599
604
|
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
600
605
|
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
601
606
|
}
|
|
607
|
+
var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
|
|
608
|
+
var selectedChannels = (channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
|
|
609
|
+
return entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.channel_services.find(function (storedChannel) { return channel.name_en.toLowerCase() === storedChannel.toLowerCase(); });
|
|
610
|
+
})) || [channels === null || channels === void 0 ? void 0 : channels[0]];
|
|
611
|
+
if ((selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0)
|
|
612
|
+
state.data.activitiesData.salesChannels = selectedChannels;
|
|
602
613
|
var activities = entity_activities || [];
|
|
603
|
-
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities
|
|
604
|
-
|
|
605
|
-
|
|
614
|
+
var selectedActivity = (activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
615
|
+
return entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.activities.find(function (value) { var _a; return ((_a = activity.en) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === value.toLowerCase(); });
|
|
616
|
+
})) || [activities === null || activities === void 0 ? void 0 : activities[0]];
|
|
617
|
+
if ((selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0)
|
|
618
|
+
state.data.activitiesData.activities = selectedActivity;
|
|
606
619
|
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
|
|
607
620
|
if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
|
|
608
621
|
state.data.businessTypeData.selectedLicense = {
|
|
609
622
|
legal_name: entity === null || entity === void 0 ? void 0 : entity.legal_name,
|
|
610
|
-
license: { number: (
|
|
623
|
+
license: { number: (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number },
|
|
611
624
|
type: business_type
|
|
612
625
|
};
|
|
613
626
|
}
|
|
@@ -31,7 +31,6 @@ export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
31
31
|
}, {}>;
|
|
32
32
|
export declare const createLead: import("@reduxjs/toolkit").AsyncThunk<{
|
|
33
33
|
response: any;
|
|
34
|
-
brandResponse: any;
|
|
35
34
|
formData: {
|
|
36
35
|
individualId: string;
|
|
37
36
|
stepName: string;
|
|
@@ -40,6 +39,7 @@ export declare const createLead: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
40
39
|
individualId: string;
|
|
41
40
|
stepName: string;
|
|
42
41
|
}, {}>;
|
|
42
|
+
export declare const retrieveBrandList: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
|
|
43
43
|
export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
|
|
44
44
|
response: any;
|
|
45
45
|
formData: IndividualFormValues;
|
|
@@ -83,6 +83,7 @@ export interface ConnectData {
|
|
|
83
83
|
flowName: FlowsTypes;
|
|
84
84
|
}
|
|
85
85
|
export interface ConnectState extends SharedState<ConnectData> {
|
|
86
|
+
customLoading?: boolean;
|
|
86
87
|
}
|
|
87
88
|
export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectState, {
|
|
88
89
|
clearError: (state: ConnectState) => void;
|
|
@@ -207,24 +207,30 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
207
207
|
return [4, API.authService.verifyAuth(payload)];
|
|
208
208
|
case 1:
|
|
209
209
|
data = (_e.sent()).data;
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
210
|
+
if (!!data.errors) return [3, 4];
|
|
211
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
212
|
+
if (!(responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user)) return [3, 2];
|
|
213
|
+
params_1 = {
|
|
214
|
+
leadId: data === null || data === void 0 ? void 0 : data.lead_id,
|
|
215
|
+
stepName: 'CONNECT_INDIVIDUAL_STEP'
|
|
216
|
+
};
|
|
217
|
+
thunkApi.dispatch(retrieveLead(params_1));
|
|
218
|
+
return [3, 4];
|
|
219
|
+
case 2: return [4, thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id))];
|
|
220
|
+
case 3:
|
|
221
|
+
_e.sent();
|
|
222
|
+
if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
|
|
223
|
+
params_2 = {
|
|
224
|
+
individualId: data === null || data === void 0 ? void 0 : data.individual_id,
|
|
225
|
+
stepName: 'CONNECT_MERCHANT_INFO_STEP'
|
|
226
|
+
};
|
|
227
|
+
thunkApi.dispatch(createLead(params_2));
|
|
226
228
|
}
|
|
227
|
-
|
|
229
|
+
else {
|
|
230
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
|
|
231
|
+
}
|
|
232
|
+
_e.label = 4;
|
|
233
|
+
case 4: return [2, { response: data, formData: params }];
|
|
228
234
|
}
|
|
229
235
|
});
|
|
230
236
|
}); });
|
|
@@ -241,9 +247,9 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
|
|
|
241
247
|
});
|
|
242
248
|
}); });
|
|
243
249
|
export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
244
|
-
var settings, businessCountry, payload,
|
|
245
|
-
return __generator(this, function (
|
|
246
|
-
switch (
|
|
250
|
+
var settings, businessCountry, payload, data;
|
|
251
|
+
return __generator(this, function (_a) {
|
|
252
|
+
switch (_a.label) {
|
|
247
253
|
case 0:
|
|
248
254
|
settings = thunkApi.getState().settings;
|
|
249
255
|
businessCountry = settings.data.businessCountry;
|
|
@@ -251,19 +257,28 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
|
|
|
251
257
|
individual_id: params.individualId,
|
|
252
258
|
country_code: businessCountry.iso2
|
|
253
259
|
};
|
|
254
|
-
|
|
255
|
-
individual_id: params.individualId
|
|
256
|
-
};
|
|
257
|
-
return [4, Promise.all([
|
|
258
|
-
API.individualService.getBrandList(brandPayload),
|
|
259
|
-
API.leadService.createLead(payload)
|
|
260
|
-
])];
|
|
260
|
+
return [4, API.leadService.createLead(payload)];
|
|
261
261
|
case 1:
|
|
262
|
-
|
|
262
|
+
data = (_a.sent()).data;
|
|
263
263
|
if (!data.errors) {
|
|
264
264
|
thunkApi.dispatch(handleNextScreenStep(params.stepName));
|
|
265
265
|
}
|
|
266
|
-
return [2, { response: data,
|
|
266
|
+
return [2, { response: data, formData: params }];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}); });
|
|
270
|
+
export var retrieveBrandList = createAsyncThunk('retrieveBrandList', function (individualId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
271
|
+
var brandPayload, data;
|
|
272
|
+
return __generator(this, function (_a) {
|
|
273
|
+
switch (_a.label) {
|
|
274
|
+
case 0:
|
|
275
|
+
brandPayload = {
|
|
276
|
+
individual_id: individualId
|
|
277
|
+
};
|
|
278
|
+
return [4, API.individualService.getBrandList(brandPayload)];
|
|
279
|
+
case 1:
|
|
280
|
+
data = (_a.sent()).data;
|
|
281
|
+
return [2, data];
|
|
267
282
|
}
|
|
268
283
|
});
|
|
269
284
|
}); });
|
|
@@ -334,7 +349,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
334
349
|
payload = {
|
|
335
350
|
brand: brand,
|
|
336
351
|
id: (isExistingUser ? (_l = brandData.responseBody) === null || _l === void 0 ? void 0 : _l.lead_id : (_m = otpData.responseBody) === null || _m === void 0 ? void 0 : _m.lead_id) || '',
|
|
337
|
-
terms_conditions_accepted: params.termAndConditionChecked,
|
|
352
|
+
terms_conditions_accepted: isExistingUser && !isOther ? undefined : params.termAndConditionChecked,
|
|
338
353
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
339
354
|
encryption_contract: [
|
|
340
355
|
'brand.name.en',
|
|
@@ -590,6 +605,7 @@ export var connectSlice = createSlice({
|
|
|
590
605
|
}
|
|
591
606
|
state.data.otpData.responseBody = response;
|
|
592
607
|
state.data.otpData.otp = formData.otp;
|
|
608
|
+
state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), response);
|
|
593
609
|
})
|
|
594
610
|
.addCase(verifyAuth.pending, function (state) {
|
|
595
611
|
state.loading = true;
|
|
@@ -629,30 +645,45 @@ export var connectSlice = createSlice({
|
|
|
629
645
|
state.error = action.error.message;
|
|
630
646
|
})
|
|
631
647
|
.addCase(createLead.fulfilled, function (state, action) {
|
|
632
|
-
var _a
|
|
648
|
+
var _a;
|
|
633
649
|
state.loading = false;
|
|
634
650
|
state.error = null;
|
|
635
|
-
var
|
|
651
|
+
var response = action.payload.response;
|
|
636
652
|
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
637
|
-
var brandError = (((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
|
|
638
653
|
if (description) {
|
|
639
654
|
state.error = description;
|
|
640
655
|
return;
|
|
641
656
|
}
|
|
657
|
+
state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), response);
|
|
658
|
+
})
|
|
659
|
+
.addCase(createLead.pending, function (state) {
|
|
660
|
+
state.loading = true;
|
|
661
|
+
state.error = null;
|
|
662
|
+
})
|
|
663
|
+
.addCase(createLead.rejected, function (state, action) {
|
|
664
|
+
state.loading = false;
|
|
665
|
+
state.error = action.error.message;
|
|
666
|
+
})
|
|
667
|
+
.addCase(retrieveBrandList.fulfilled, function (state, action) {
|
|
668
|
+
var _a;
|
|
669
|
+
state.loading = false;
|
|
670
|
+
state.error = null;
|
|
671
|
+
var response = action.payload;
|
|
672
|
+
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
642
673
|
var brandList = undefined;
|
|
643
|
-
if (!
|
|
644
|
-
brandList = Array.isArray(
|
|
674
|
+
if (!description) {
|
|
675
|
+
brandList = Array.isArray(response === null || response === void 0 ? void 0 : response.brands) ? __spreadArray(__spreadArray([], response === null || response === void 0 ? void 0 : response.brands, true), [OTHER_BRAND], false) : [];
|
|
645
676
|
var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
|
|
646
677
|
if (!!brand)
|
|
647
678
|
state.data.brandData.selectedBrandItem = brand;
|
|
648
679
|
}
|
|
649
|
-
state.data.brandData.responseBody = __assign({ brands: brandList || [] }
|
|
680
|
+
state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), { brands: brandList || [] });
|
|
650
681
|
})
|
|
651
|
-
.addCase(
|
|
682
|
+
.addCase(retrieveBrandList.pending, function (state) {
|
|
652
683
|
state.loading = true;
|
|
653
684
|
state.error = null;
|
|
654
685
|
})
|
|
655
|
-
.addCase(
|
|
686
|
+
.addCase(retrieveBrandList.rejected, function (state, action) {
|
|
656
687
|
state.loading = false;
|
|
657
688
|
state.error = action.error.message;
|
|
658
689
|
})
|
|
@@ -48,6 +48,7 @@ export interface IndividualData {
|
|
|
48
48
|
flowName: FlowsTypes;
|
|
49
49
|
}
|
|
50
50
|
export interface IndividualState extends SharedState<IndividualData> {
|
|
51
|
+
customLoading?: boolean;
|
|
51
52
|
}
|
|
52
53
|
export declare const individualSlice: import("@reduxjs/toolkit").Slice<IndividualState, {
|
|
53
54
|
clearError: (state: IndividualState) => void;
|
|
@@ -386,7 +386,7 @@ export var individualSlice = createSlice({
|
|
|
386
386
|
var _a = action.payload, data = _a.data, countries = _a.countries, countryCode = _a.countryCode;
|
|
387
387
|
var info = (data || {}).info;
|
|
388
388
|
var _b = state.data.individualData.responseBody || {}, sourceIncomeList = _b.sourceIncomeList, monthlyIncomeList = _b.monthlyIncomeList, occupationList = _b.occupationList;
|
|
389
|
-
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b, _c
|
|
389
|
+
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b, _c; return ((_a = source === null || source === void 0 ? void 0 : source.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_c = (_b = info === null || info === void 0 ? void 0 : info.source_income) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase()); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
390
390
|
if (!!selectedSourceIncome)
|
|
391
391
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
392
392
|
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { var _a, _b; return ((_a = income === null || income === void 0 ? void 0 : income.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = info === null || info === void 0 ? void 0 : info.actual_income) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
@@ -62,6 +62,7 @@ export interface PasswordData {
|
|
|
62
62
|
flowName: FlowsTypes;
|
|
63
63
|
}
|
|
64
64
|
export interface PasswordState extends SharedState<PasswordData> {
|
|
65
|
+
customLoading?: boolean;
|
|
65
66
|
}
|
|
66
67
|
export declare const passwordSlice: import("@reduxjs/toolkit").Slice<PasswordState, {
|
|
67
68
|
clearError: (state: PasswordState) => void;
|