@tap-payments/auth-jsconnect 2.8.95-development → 2.8.97-development
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/components/ArabicDatePicker/ArabicDatePicker.d.ts +1 -1
- package/build/components/ArabicDatePicker/ArabicDatePicker.js +2 -2
- package/build/components/DatePicker/DatePicker.d.ts +1 -1
- package/build/components/DatePicker/DatePicker.js +2 -2
- package/build/constants/app.js +2 -1
- package/build/features/app/business/businessStore.d.ts +4 -0
- package/build/features/app/business/businessStore.js +53 -35
- package/build/features/business/screens/DOB/DOBForm.js +6 -3
- package/build/features/entity/screens/EntityName/ExpiryDate.js +9 -2
- package/build/features/entity/screens/EntityName/IssuingDate.js +10 -1
- package/build/features/shared/Calender/Calender.d.ts +2 -1
- package/build/features/shared/Calender/Calender.js +3 -3
- package/package.json +1 -1
|
@@ -12,5 +12,5 @@ export interface DatePickerProps extends CalendarProps {
|
|
|
12
12
|
isDob?: boolean;
|
|
13
13
|
isVerified?: boolean;
|
|
14
14
|
}
|
|
15
|
-
declare const _default: React.MemoExoticComponent<({ open, disabled, dir, readOnly, onDateChange, onClick, onDatePicked, value, isDob, isVerified, ...rest }: DatePickerProps) => JSX.Element>;
|
|
15
|
+
declare const _default: React.MemoExoticComponent<({ open, disabled, dir, readOnly, onDateChange, onClick, onDatePicked, value, isDob, isVerified, minDate, maxDate, ...rest }: DatePickerProps) => JSX.Element>;
|
|
16
16
|
export default _default;
|
|
@@ -71,7 +71,7 @@ var ArrowIcon = styled(Text, { shouldForwardProp: function (prop) { return prop
|
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
var DatePicker = function (_a) {
|
|
74
|
-
var _b = _a.open, open = _b === void 0 ? false : _b, disabled = _a.disabled, dir = _a.dir, readOnly = _a.readOnly, onDateChange = _a.onDateChange, onClick = _a.onClick, onDatePicked = _a.onDatePicked, value = _a.value, isDob = _a.isDob, isVerified = _a.isVerified, rest = __rest(_a, ["open", "disabled", "dir", "readOnly", "onDateChange", "onClick", "onDatePicked", "value", "isDob", "isVerified"]);
|
|
74
|
+
var _b = _a.open, open = _b === void 0 ? false : _b, disabled = _a.disabled, dir = _a.dir, readOnly = _a.readOnly, onDateChange = _a.onDateChange, onClick = _a.onClick, onDatePicked = _a.onDatePicked, value = _a.value, isDob = _a.isDob, isVerified = _a.isVerified, minDate = _a.minDate, maxDate = _a.maxDate, rest = __rest(_a, ["open", "disabled", "dir", "readOnly", "onDateChange", "onClick", "onDatePicked", "value", "isDob", "isVerified", "minDate", "maxDate"]);
|
|
75
75
|
var _c = React.useState(), date = _c[0], setDate = _c[1];
|
|
76
76
|
var _d = React.useState(null), anchor = _d[0], setAnchor = _d[1];
|
|
77
77
|
var _e = React.useState(open), openCalender = _e[0], setOpenCalender = _e[1];
|
|
@@ -111,6 +111,6 @@ var DatePicker = function (_a) {
|
|
|
111
111
|
return (_jsxs(Container, __assign({ openCalender: openCalender, disabled: disabled, id: 'arabic-container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children: getEndAdornment() })), value: date ? formateDate(date) : '', placeholder: DATE_FORMAT, onClick: function (e) {
|
|
112
112
|
if (!disabled)
|
|
113
113
|
toggleCalender(e);
|
|
114
|
-
}, startAdornment: calenderIcon, disabled: disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: openCalender }, { children: [_jsx(Calendar, __assign({ calendar: arabic, locale: dir === 'rtl' ? arabic_ar : arabic_en, maxDate:
|
|
114
|
+
}, startAdornment: calenderIcon, disabled: disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: openCalender }, { children: [_jsx(Calendar, __assign({ calendar: arabic, locale: dir === 'rtl' ? arabic_ar : arabic_en, maxDate: maxDate || defaultMax, minDate: minDate || defaultMin, format: DATE_FORMAT, onChange: handleOnDateChange, value: date || (isDob ? new Date(getEighteenYearsAgo()) : undefined), className: 'custom-container' }, rest)), _jsx(Divider, {})] }))] })));
|
|
115
115
|
};
|
|
116
116
|
export default memo(DatePicker);
|
|
@@ -13,5 +13,5 @@ export interface DatePickerProps extends CalendarProps {
|
|
|
13
13
|
isDob?: boolean;
|
|
14
14
|
isVerified?: boolean;
|
|
15
15
|
}
|
|
16
|
-
declare const _default: React.MemoExoticComponent<({ onDateChange, disabled, readOnly, onClick, onDatePicked, dir, defaultValue, isDob, isVerified, open, ...rest }: DatePickerProps) => JSX.Element>;
|
|
16
|
+
declare const _default: React.MemoExoticComponent<({ onDateChange, disabled, readOnly, onClick, onDatePicked, dir, defaultValue, isDob, isVerified, open, minDate, maxDate, ...rest }: DatePickerProps) => JSX.Element>;
|
|
17
17
|
export default _default;
|
|
@@ -67,7 +67,7 @@ var ArrowIcon = styled(Text, { shouldForwardProp: function (prop) { return prop
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
var DatePicker = function (_a) {
|
|
70
|
-
var onDateChange = _a.onDateChange, disabled = _a.disabled, readOnly = _a.readOnly, onClick = _a.onClick, onDatePicked = _a.onDatePicked, dir = _a.dir, defaultValue = _a.defaultValue, isDob = _a.isDob, isVerified = _a.isVerified, open = _a.open, rest = __rest(_a, ["onDateChange", "disabled", "readOnly", "onClick", "onDatePicked", "dir", "defaultValue", "isDob", "isVerified", "open"]);
|
|
70
|
+
var onDateChange = _a.onDateChange, disabled = _a.disabled, readOnly = _a.readOnly, onClick = _a.onClick, onDatePicked = _a.onDatePicked, dir = _a.dir, defaultValue = _a.defaultValue, isDob = _a.isDob, isVerified = _a.isVerified, open = _a.open, minDate = _a.minDate, maxDate = _a.maxDate, rest = __rest(_a, ["onDateChange", "disabled", "readOnly", "onClick", "onDatePicked", "dir", "defaultValue", "isDob", "isVerified", "open", "minDate", "maxDate"]);
|
|
71
71
|
var _b = useState(), date = _b[0], setDate = _b[1];
|
|
72
72
|
var _c = React.useState(null), anchor = _c[0], setAnchor = _c[1];
|
|
73
73
|
var _d = React.useState(open), openCalender = _d[0], setOpenCalender = _d[1];
|
|
@@ -106,6 +106,6 @@ var DatePicker = function (_a) {
|
|
|
106
106
|
return (_jsxs(Container, __assign({ disabled: disabled, id: 'container-calendar' }, { children: [_jsx(InputFieldStyled, { endAdornment: _jsx(ArrowIcon, __assign({ disabled: disabled }, { children: getEndAdornment() })), value: date ? convertToEnglishDateFormat(date) : '', placeholder: 'YYYY-MM-DD', onClick: function (e) {
|
|
107
107
|
if (!disabled)
|
|
108
108
|
toggleCalender(e);
|
|
109
|
-
}, startAdornment: calenderIcon, disabled: disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: openCalender }, { children: [_jsx(Calendar, __assign({}, rest, { value: date || (isDob ? new Date(getEighteenYearsAgo()) : undefined), calendarType: 'Hebrew', onChange: handleOnDateChange, locale: rest.locale, maxDate:
|
|
109
|
+
}, startAdornment: calenderIcon, disabled: disabled, readOnly: readOnly, dir: dir }), _jsxs(Collapse, __assign({ in: openCalender }, { children: [_jsx(Calendar, __assign({}, rest, { value: date || (isDob ? new Date(getEighteenYearsAgo()) : undefined), calendarType: 'Hebrew', onChange: handleOnDateChange, locale: rest.locale, maxDate: maxDate || defaultMax, minDate: minDate || defaultMin })), _jsx(Divider, {})] }))] })));
|
|
110
110
|
};
|
|
111
111
|
export default memo(DatePicker);
|
package/build/constants/app.js
CHANGED
|
@@ -395,7 +395,8 @@ export var BUSINESS_SCREENS_NAVIGATION = [
|
|
|
395
395
|
'BUSINESS_ACTIVITIES_STEP',
|
|
396
396
|
'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
397
397
|
'BUSINESS_CIVIL_ID_STEP',
|
|
398
|
-
'BUSINESS_VERIFY_BRAND_INFO'
|
|
398
|
+
'BUSINESS_VERIFY_BRAND_INFO',
|
|
399
|
+
'BUSINESS_DOB_STEP'
|
|
399
400
|
],
|
|
400
401
|
prev: '',
|
|
401
402
|
order: 1
|
|
@@ -2,6 +2,7 @@ import { RootState } from '../../../app/store';
|
|
|
2
2
|
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, CivilFormValues, ActionState, AsyncThunkParams, DOBFormValues } from '../../../@types';
|
|
3
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
4
|
data: any;
|
|
5
|
+
verifyNextStepName: any;
|
|
5
6
|
isicActivityList: any;
|
|
6
7
|
leadData: any;
|
|
7
8
|
token: string;
|
|
@@ -12,6 +13,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
12
13
|
data: any;
|
|
13
14
|
isRequireOTP: boolean;
|
|
14
15
|
token: string;
|
|
16
|
+
verifyNextStepName: any;
|
|
15
17
|
isicActivityList?: undefined;
|
|
16
18
|
leadData?: undefined;
|
|
17
19
|
brandData?: undefined;
|
|
@@ -19,9 +21,11 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
19
21
|
}, string, {}>;
|
|
20
22
|
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
21
23
|
data: any;
|
|
24
|
+
verifyNextStepName: any;
|
|
22
25
|
}, void, {}>;
|
|
23
26
|
export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
24
27
|
data: any;
|
|
28
|
+
verifyNextStepName: any;
|
|
25
29
|
isicActivityList: any;
|
|
26
30
|
formData: {
|
|
27
31
|
isNID: boolean;
|
|
@@ -100,6 +100,9 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
100
100
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && (isSA(countryIso2) || isOtherThanKWOrSA(countryIso2))) {
|
|
101
101
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
102
102
|
}
|
|
103
|
+
if (data.step_name === COLLECT_DOB_INFO_NAFATH) {
|
|
104
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_DOB_STEP'));
|
|
105
|
+
}
|
|
103
106
|
if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 19];
|
|
104
107
|
_a = leadData || {}, steps = _a.steps, brand = _a.brand, board_id = _a.board_id, business_id = _a.business_id, entity = _a.entity;
|
|
105
108
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
@@ -165,13 +168,14 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
165
168
|
_d.label = 19;
|
|
166
169
|
case 19: return [2, {
|
|
167
170
|
data: data,
|
|
171
|
+
verifyNextStepName: data.step_name,
|
|
168
172
|
isicActivityList: isicActivityList,
|
|
169
173
|
leadData: __assign(__assign({}, leadData), { flows: (boardData === null || boardData === void 0 ? void 0 : boardData.info) || [] }),
|
|
170
174
|
token: token,
|
|
171
175
|
brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
|
|
172
176
|
boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
|
|
173
177
|
}];
|
|
174
|
-
case 20: return [2, { data: data, isRequireOTP: true, token: token }];
|
|
178
|
+
case 20: return [2, { data: data, isRequireOTP: true, token: token, verifyNextStepName: data.step_name }];
|
|
175
179
|
}
|
|
176
180
|
});
|
|
177
181
|
}); });
|
|
@@ -188,7 +192,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
188
192
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
189
193
|
case 1:
|
|
190
194
|
data = (_a.sent()).data;
|
|
191
|
-
return [2, { data: data }];
|
|
195
|
+
return [2, { data: data, verifyNextStepName: data.step_name }];
|
|
192
196
|
}
|
|
193
197
|
});
|
|
194
198
|
}); });
|
|
@@ -248,11 +252,11 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
248
252
|
case 6:
|
|
249
253
|
if (!isNID) return [3, 7];
|
|
250
254
|
thunkApi.dispatch(handleNextScreenStep());
|
|
251
|
-
return [3,
|
|
255
|
+
return [3, 23];
|
|
252
256
|
case 7:
|
|
253
257
|
if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 8];
|
|
254
258
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
|
|
255
|
-
return [3,
|
|
259
|
+
return [3, 23];
|
|
256
260
|
case 8:
|
|
257
261
|
if (!hasBusinessCompleted) return [3, 12];
|
|
258
262
|
if (!board_id) return [3, 11];
|
|
@@ -266,44 +270,48 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
266
270
|
_k.label = 11;
|
|
267
271
|
case 11:
|
|
268
272
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP')); });
|
|
269
|
-
return [3,
|
|
273
|
+
return [3, 23];
|
|
270
274
|
case 12:
|
|
271
275
|
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 13];
|
|
272
276
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP')); });
|
|
273
|
-
return [3,
|
|
277
|
+
return [3, 23];
|
|
274
278
|
case 13:
|
|
275
|
-
if (!
|
|
276
|
-
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('
|
|
277
|
-
return [3,
|
|
279
|
+
if (!(data.step_name === COLLECT_DOB_INFO_NAFATH)) return [3, 14];
|
|
280
|
+
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_DOB_STEP')); });
|
|
281
|
+
return [3, 23];
|
|
278
282
|
case 14:
|
|
279
|
-
if (!
|
|
280
|
-
return
|
|
283
|
+
if (!hasBusinessCustomersCompleted) return [3, 15];
|
|
284
|
+
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP')); });
|
|
285
|
+
return [3, 23];
|
|
281
286
|
case 15:
|
|
287
|
+
if (!hasBusinessCRActivitiesCompleted) return [3, 19];
|
|
288
|
+
return [4, API.dataService.getActivitiesIsIc()];
|
|
289
|
+
case 16:
|
|
282
290
|
list = (_k.sent()).list;
|
|
283
291
|
isicActivityList = list || [];
|
|
284
292
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
285
|
-
case
|
|
293
|
+
case 17:
|
|
286
294
|
_k.sent();
|
|
287
295
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
288
|
-
case
|
|
296
|
+
case 18:
|
|
289
297
|
brandData = _k.sent();
|
|
290
298
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP')); });
|
|
291
|
-
return [3,
|
|
292
|
-
case 18:
|
|
293
|
-
if (!hasBusinessCRInfoCompleted) return [3, 21];
|
|
294
|
-
return [4, API.dataService.getActivitiesIsIc()];
|
|
299
|
+
return [3, 23];
|
|
295
300
|
case 19:
|
|
301
|
+
if (!hasBusinessCRInfoCompleted) return [3, 22];
|
|
302
|
+
return [4, API.dataService.getActivitiesIsIc()];
|
|
303
|
+
case 20:
|
|
296
304
|
list = (_k.sent()).list;
|
|
297
305
|
isicActivityList = list || [];
|
|
298
306
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
299
|
-
case
|
|
307
|
+
case 21:
|
|
300
308
|
brandData = _k.sent();
|
|
301
309
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP')); });
|
|
302
|
-
return [3,
|
|
303
|
-
case
|
|
310
|
+
return [3, 23];
|
|
311
|
+
case 22:
|
|
304
312
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP')); });
|
|
305
|
-
_k.label =
|
|
306
|
-
case
|
|
313
|
+
_k.label = 23;
|
|
314
|
+
case 23: return [2, { data: data, verifyNextStepName: data.step_name, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
|
|
307
315
|
}
|
|
308
316
|
});
|
|
309
317
|
}); });
|
|
@@ -476,14 +484,14 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
476
484
|
});
|
|
477
485
|
}); });
|
|
478
486
|
export var updateLeadDOB = createAsyncThunk('business/updateLeadDOB', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
479
|
-
var _a, settings, business, stepName, lead_id, requestBody, data;
|
|
480
|
-
var
|
|
481
|
-
return __generator(this, function (
|
|
482
|
-
switch (
|
|
487
|
+
var _a, settings, business, stepName, _b, lead_id, verifyNextStepName, requestBody, data;
|
|
488
|
+
var _c, _d, _e, _f;
|
|
489
|
+
return __generator(this, function (_g) {
|
|
490
|
+
switch (_g.label) {
|
|
483
491
|
case 0:
|
|
484
492
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
485
493
|
stepName = BUSINESS_STEP_NAMES.BUSINESS_DOB_INFO;
|
|
486
|
-
|
|
494
|
+
_b = business.data.verify.responseBody || {}, lead_id = _b.lead_id, verifyNextStepName = _b.verifyNextStepName;
|
|
487
495
|
requestBody = {
|
|
488
496
|
id: lead_id || '',
|
|
489
497
|
date_of_birth: params.dob,
|
|
@@ -492,9 +500,19 @@ export var updateLeadDOB = createAsyncThunk('business/updateLeadDOB', function (
|
|
|
492
500
|
};
|
|
493
501
|
return [4, API.leadService.updateLead(requestBody)];
|
|
494
502
|
case 1:
|
|
495
|
-
data =
|
|
503
|
+
data = _g.sent();
|
|
504
|
+
if (!(verifyNextStepName === COLLECT_DOB_INFO_NAFATH)) return [3, 4];
|
|
505
|
+
return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: data.business_id, entityId: (_c = data.entity) === null || _c === void 0 ? void 0 : _c.id }))];
|
|
506
|
+
case 2:
|
|
507
|
+
_g.sent();
|
|
508
|
+
if (!isSA((_d = settings.data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2)) return [3, 4];
|
|
509
|
+
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
510
|
+
case 3:
|
|
511
|
+
_g.sent();
|
|
512
|
+
_g.label = 4;
|
|
513
|
+
case 4:
|
|
496
514
|
thunkApi.dispatch(handleNextScreenStep());
|
|
497
|
-
(
|
|
515
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
498
516
|
return [2, { data: data, formData: params }];
|
|
499
517
|
}
|
|
500
518
|
});
|
|
@@ -919,9 +937,9 @@ export var businessSlice = createSlice({
|
|
|
919
937
|
var _a, _b, _c, _d, _e;
|
|
920
938
|
state.error = null;
|
|
921
939
|
state.customLoading = false;
|
|
922
|
-
var _f = action.payload, data = _f.data, boardId = _f.boardId, brandData = _f.brandData, leadData = _f.leadData, token = _f.token, isRequireOTP = _f.isRequireOTP, isicActivityList = _f.isicActivityList;
|
|
940
|
+
var _f = action.payload, data = _f.data, boardId = _f.boardId, brandData = _f.brandData, leadData = _f.leadData, token = _f.token, isRequireOTP = _f.isRequireOTP, isicActivityList = _f.isicActivityList, verifyNextStepName = _f.verifyNextStepName;
|
|
923
941
|
var responseBody = state.data.verify.responseBody;
|
|
924
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id }), (brandData && { brand: brandData }));
|
|
942
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id, verifyNextStepName: verifyNextStepName }), (brandData && { brand: brandData }));
|
|
925
943
|
var _g = leadData || {}, identification = _g.identification, date_of_birth = _g.date_of_birth;
|
|
926
944
|
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
927
945
|
state.data.nidData.nid = identification.id;
|
|
@@ -965,13 +983,13 @@ export var businessSlice = createSlice({
|
|
|
965
983
|
.addCase(resendOTP.fulfilled, function (state, action) {
|
|
966
984
|
var _a;
|
|
967
985
|
state.error = null;
|
|
968
|
-
var
|
|
986
|
+
var _b = action.payload, data = _b.data, verifyNextStepName = _b.verifyNextStepName;
|
|
969
987
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
970
988
|
if (description) {
|
|
971
989
|
state.error = description;
|
|
972
990
|
return;
|
|
973
991
|
}
|
|
974
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
|
|
992
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { verifyNextStepName: verifyNextStepName });
|
|
975
993
|
})
|
|
976
994
|
.addCase(resendOTP.rejected, function (state, action) {
|
|
977
995
|
state.error = action.error.message;
|
|
@@ -984,10 +1002,10 @@ export var businessSlice = createSlice({
|
|
|
984
1002
|
var _a, _b, _c, _d, _e;
|
|
985
1003
|
state.loading = false;
|
|
986
1004
|
state.error = null;
|
|
987
|
-
var _f = action.payload, data = _f.data, formData = _f.formData, brand = _f.brand, leadData = _f.leadData, isicActivityList = _f.isicActivityList;
|
|
1005
|
+
var _f = action.payload, data = _f.data, formData = _f.formData, brand = _f.brand, leadData = _f.leadData, isicActivityList = _f.isicActivityList, verifyNextStepName = _f.verifyNextStepName;
|
|
988
1006
|
state.data.otpData = formData;
|
|
989
1007
|
state.data.otpData.responseBody = data;
|
|
990
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, leadData), state.data.verify.responseBody), (brand && { brand: brand })), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
|
|
1008
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { verifyNextStepName: verifyNextStepName }), (brand && { brand: brand })), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
|
|
991
1009
|
var _g = leadData || {}, identification = _g.identification, date_of_birth = _g.date_of_birth;
|
|
992
1010
|
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
993
1011
|
state.data.nidData.nid = identification.id;
|
|
@@ -22,6 +22,7 @@ import Button from '../../../shared/Button';
|
|
|
22
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
23
|
import { businessSelector, clearError, updateLeadDOB } from '../../../app/business/businessStore';
|
|
24
24
|
import Collapse from '../../../../components/Collapse';
|
|
25
|
+
import { COLLECT_DOB_INFO_NAFATH } from '../../../../constants';
|
|
25
26
|
import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
26
27
|
import { DOBValidationSchema } from './validation';
|
|
27
28
|
import DOB from './DOB';
|
|
@@ -30,11 +31,12 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
30
31
|
flexDirection: 'column'
|
|
31
32
|
}); });
|
|
32
33
|
var DOBForm = function (_a) {
|
|
33
|
-
var _b
|
|
34
|
+
var _b;
|
|
35
|
+
var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
|
|
34
36
|
var isAr = useLanguage().isAr;
|
|
35
37
|
var dispatch = useAppDispatch();
|
|
36
38
|
var t = useTranslation().t;
|
|
37
|
-
var
|
|
39
|
+
var _d = useAppSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
38
40
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
39
41
|
var methods = useForm({
|
|
40
42
|
resolver: yupResolver(DOBValidationSchema),
|
|
@@ -64,6 +66,7 @@ var DOBForm = function (_a) {
|
|
|
64
66
|
dispatch(handlePrevScreenStep());
|
|
65
67
|
};
|
|
66
68
|
var disabled = !methods.formState.isValid;
|
|
67
|
-
|
|
69
|
+
var disableBack = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verifyNextStepName) === COLLECT_DOB_INFO_NAFATH;
|
|
70
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ sx: { mt: 10 }, loading: loading, disableBack: disableBack, onBackClicked: onBack, isAr: isAr, disabled: disabled, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
68
71
|
};
|
|
69
72
|
export default React.memo(DOBForm);
|
|
@@ -29,15 +29,22 @@ var ExpiryDate = function (_a) {
|
|
|
29
29
|
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
30
30
|
var t = useTranslation().t;
|
|
31
31
|
var dispatch = useAppDispatch();
|
|
32
|
-
var
|
|
32
|
+
var _c = useFormContext(), control = _c.control, watch = _c.watch, setValue = _c.setValue;
|
|
33
33
|
var error = useAppSelector(entitySelector).error;
|
|
34
34
|
var oDateControl = useController({ control: control, name: 'expiryDate' });
|
|
35
|
+
var issueDateValue = watch('issuingDate');
|
|
35
36
|
var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
37
|
+
var getMinDate = function () {
|
|
38
|
+
if (!issueDateValue)
|
|
39
|
+
return;
|
|
40
|
+
var issueDate = new Date(issueDateValue);
|
|
41
|
+
return new Date(issueDate.setDate(issueDate.getDate() + 1));
|
|
42
|
+
};
|
|
36
43
|
var handleExpiryDateChange = function (data) {
|
|
37
44
|
if (error)
|
|
38
45
|
dispatch(clearError());
|
|
39
46
|
oDateControl.field.onChange(data);
|
|
40
47
|
};
|
|
41
|
-
return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })));
|
|
48
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: !issueDateValue ? true : readOnly, minDate: getMinDate(), maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })));
|
|
42
49
|
};
|
|
43
50
|
export default ExpiryDate;
|
|
@@ -28,14 +28,23 @@ var IssuingDate = function (_a) {
|
|
|
28
28
|
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
29
29
|
var t = useTranslation().t;
|
|
30
30
|
var dispatch = useAppDispatch();
|
|
31
|
-
var
|
|
31
|
+
var _c = useFormContext(), control = _c.control, getValues = _c.getValues, setValue = _c.setValue;
|
|
32
32
|
var error = useAppSelector(entitySelector).error;
|
|
33
33
|
var oDateControl = useController({ control: control, name: 'issuingDate' });
|
|
34
34
|
var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
35
|
+
var isValidDate = function (date) { return date instanceof Date && !isNaN(date.getTime()); };
|
|
35
36
|
var handleIssuingDateChange = function (data) {
|
|
36
37
|
if (error)
|
|
37
38
|
dispatch(clearError());
|
|
38
39
|
oDateControl.field.onChange(data);
|
|
40
|
+
var expiryDateValue = getValues('expiryDate');
|
|
41
|
+
if (!expiryDateValue)
|
|
42
|
+
return;
|
|
43
|
+
var issueDate = new Date(data);
|
|
44
|
+
var expiryDate = new Date(expiryDateValue);
|
|
45
|
+
if (isValidDate(issueDate) && isValidDate(expiryDate) && expiryDate <= issueDate) {
|
|
46
|
+
setValue('expiryDate', '', { shouldValidate: true });
|
|
47
|
+
}
|
|
39
48
|
};
|
|
40
49
|
return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('issue_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })));
|
|
41
50
|
};
|
|
@@ -8,6 +8,7 @@ interface CustomCalenderProps extends CalendarProps {
|
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
isVerified?: boolean;
|
|
10
10
|
maxDate?: Date;
|
|
11
|
+
minDate?: Date;
|
|
11
12
|
}
|
|
12
|
-
declare const CustomCalender: ({ onDateClicked, onDateChange, defaultValue, isDob, disabled, isVerified, maxDate }: CustomCalenderProps) => JSX.Element;
|
|
13
|
+
declare const CustomCalender: ({ onDateClicked, onDateChange, defaultValue, isDob, disabled, isVerified, maxDate, minDate }: CustomCalenderProps) => JSX.Element;
|
|
13
14
|
export default CustomCalender;
|
|
@@ -29,7 +29,7 @@ var SwitchBoxStyled = styled(Box)(function (_a) {
|
|
|
29
29
|
} }));
|
|
30
30
|
});
|
|
31
31
|
var CustomCalender = function (_a) {
|
|
32
|
-
var onDateClicked = _a.onDateClicked, onDateChange = _a.onDateChange, defaultValue = _a.defaultValue, isDob = _a.isDob, disabled = _a.disabled, isVerified = _a.isVerified, maxDate = _a.maxDate;
|
|
32
|
+
var onDateClicked = _a.onDateClicked, onDateChange = _a.onDateChange, defaultValue = _a.defaultValue, isDob = _a.isDob, disabled = _a.disabled, isVerified = _a.isVerified, maxDate = _a.maxDate, minDate = _a.minDate;
|
|
33
33
|
var t = useTranslation().t;
|
|
34
34
|
var theme = useTheme();
|
|
35
35
|
var data = useAppSelector(settingsSelector).data;
|
|
@@ -39,13 +39,13 @@ var CustomCalender = function (_a) {
|
|
|
39
39
|
var onSwitchCalender = function () {
|
|
40
40
|
dispatch(handleSwitchCalender(!isHijriCalender));
|
|
41
41
|
};
|
|
42
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !isHijriCalender }, { children: _jsx(DatePicker, { open: open, defaultValue: defaultValue, readOnly: true, disabled: disabled, isVerified: isVerified, dir: 'ltr', locale: 'en', isDob: isDob, maxDate: maxDate, onDateChange: onDateChange, onClick: function () {
|
|
42
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !isHijriCalender }, { children: _jsx(DatePicker, { open: open, defaultValue: defaultValue, readOnly: true, disabled: disabled, isVerified: isVerified, dir: 'ltr', locale: 'en', isDob: isDob, maxDate: maxDate, minDate: minDate, onDateChange: onDateChange, onClick: function () {
|
|
43
43
|
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
|
|
44
44
|
setOpen(true);
|
|
45
45
|
}, onDatePicked: function () {
|
|
46
46
|
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false);
|
|
47
47
|
setOpen(false);
|
|
48
|
-
} }) })), _jsx(Collapse, __assign({ in: isHijriCalender }, { children: _jsx(ArabicDatePicker, { open: open, readOnly: true, disabled: disabled, isVerified: isVerified, dir: theme.direction, isDob: isDob, maxDate: maxDate, onClick: function () {
|
|
48
|
+
} }) })), _jsx(Collapse, __assign({ in: isHijriCalender }, { children: _jsx(ArabicDatePicker, { open: open, readOnly: true, disabled: disabled, isVerified: isVerified, dir: theme.direction, isDob: isDob, maxDate: maxDate, minDate: minDate, onClick: function () {
|
|
49
49
|
onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
|
|
50
50
|
setOpen(true);
|
|
51
51
|
}, onDatePicked: function () {
|