@tap-payments/auth-jsconnect 1.0.59 → 1.0.62
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/redux.d.ts +1 -0
- package/build/app/settings.js +1 -1
- package/build/assets/locales/ar.json +13 -4
- package/build/assets/locales/en.json +13 -4
- package/build/constants/app.js +13 -7
- package/build/constants/assets.d.ts +5 -0
- package/build/constants/assets.js +7 -2
- package/build/features/Landing/Landing.js +5 -8
- package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +6 -20
- package/build/features/app/bank/bankStore.js +4 -0
- package/build/features/app/business/businessStore.d.ts +1 -1
- package/build/features/app/business/businessStore.js +60 -53
- package/build/features/app/connect/connectStore.js +37 -21
- package/build/features/app/individual/individualStore.js +4 -0
- package/build/features/app/password/passwordStore.js +6 -0
- package/build/features/app/tax/taxStore.js +6 -0
- package/build/features/business/Business.js +3 -2
- package/build/features/business/screens/Activities/Activities.js +4 -0
- package/build/features/business/screens/Activities/ActivitiesList.js +5 -6
- package/build/features/business/screens/Activities/SalesChannels.js +4 -5
- package/build/features/business/screens/BusinessType/BusinessType.js +1 -6
- package/build/features/business/screens/BusinessType/LicenseList.js +17 -12
- package/build/features/business/screens/BusinessType/LicenseNumber.js +3 -3
- package/build/features/business/screens/Customers/Customers.js +0 -1
- package/build/features/business/screens/Success/Success.js +3 -2
- package/build/features/business/screens/{Confirm/Confirm.d.ts → SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts} +1 -3
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +79 -0
- package/build/features/business/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/business/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/business/screens/Verify/Verify.js +1 -1
- package/build/features/featuresScreens.js +3 -1
- package/build/features/password/screens/CreatePassword/CreatePassword.js +0 -1
- package/build/features/shared/Button/AbsherButton.js +1 -0
- package/build/features/shared/Button/Button.js +1 -1
- package/build/features/shared/Button/EmailProvidersButtons.js +5 -2
- package/build/features/shared/Button/FlowsButtons.d.ts +12 -0
- package/build/features/shared/Button/FlowsButtons.js +62 -0
- package/build/features/shared/Button/MobileButton.js +1 -0
- package/build/features/shared/Button/index.d.ts +2 -1
- package/build/features/shared/Button/index.js +2 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +2 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/package.json +1 -1
- package/build/features/business/screens/BusinessType/CRNumber.d.ts +0 -7
- package/build/features/business/screens/BusinessType/CRNumber.js +0 -41
- package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +0 -11
- package/build/features/business/screens/BusinessType/CompanyLicense.js +0 -127
- package/build/features/business/screens/BusinessType/FLNumber.d.ts +0 -7
- package/build/features/business/screens/BusinessType/FLNumber.js +0 -41
- package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +0 -11
- package/build/features/business/screens/BusinessType/FreelanceLicense.js +0 -127
- package/build/features/business/screens/Confirm/Confirm.js +0 -56
- package/build/features/business/screens/Confirm/index.d.ts +0 -3
- package/build/features/business/screens/Confirm/index.js +0 -2
- package/build/features/connect/screens/Mobile/BusinessCountry.d.ts +0 -8
- package/build/features/connect/screens/Mobile/BusinessCountry.js +0 -40
- package/build/features/connect/screens/Password/Password.d.ts +0 -5
- package/build/features/connect/screens/Password/Password.js +0 -60
- package/build/features/connect/screens/Password/PasswordInput.d.ts +0 -5
- package/build/features/connect/screens/Password/PasswordInput.js +0 -39
- package/build/features/connect/screens/Password/index.d.ts +0 -3
- package/build/features/connect/screens/Password/index.js +0 -2
- package/build/features/connect/screens/Password/validation.d.ts +0 -8
- package/build/features/connect/screens/Password/validation.js +0 -4
|
@@ -259,14 +259,18 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
259
259
|
});
|
|
260
260
|
}); });
|
|
261
261
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
262
|
-
var _a, settings, connect, instagram, twitter, payload, data;
|
|
263
|
-
var
|
|
264
|
-
return __generator(this, function (
|
|
265
|
-
switch (
|
|
262
|
+
var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
|
|
263
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
264
|
+
return __generator(this, function (_m) {
|
|
265
|
+
switch (_m.label) {
|
|
266
266
|
case 0:
|
|
267
267
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
268
|
-
instagram = !!((
|
|
269
|
-
twitter = !!((
|
|
268
|
+
instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.twitter) : '';
|
|
269
|
+
twitter = !!((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) ? "".concat(TWITTER_URL, "/").concat((_f = params.links) === null || _f === void 0 ? void 0 : _f.twitter) : '';
|
|
270
|
+
_b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData, otpData = _b.otpData, brandData = _b.brandData;
|
|
271
|
+
isAbsher = otpData.isAbsher;
|
|
272
|
+
responseBody = (isAbsher ? nidData : mobileData).responseBody;
|
|
273
|
+
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
|
|
270
274
|
payload = {
|
|
271
275
|
brand: {
|
|
272
276
|
name: {
|
|
@@ -274,20 +278,20 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
274
278
|
ar: params.brandName,
|
|
275
279
|
zh: params.brandName
|
|
276
280
|
},
|
|
277
|
-
website: (
|
|
281
|
+
website: (_g = params.links) === null || _g === void 0 ? void 0 : _g.website,
|
|
278
282
|
social: [twitter, instagram]
|
|
279
283
|
},
|
|
280
|
-
id: ((
|
|
284
|
+
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) || '',
|
|
281
285
|
terms_conditions_accepted: params.termAndConditionChecked,
|
|
282
286
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
283
287
|
encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'social[0]', 'social[1]']
|
|
284
288
|
};
|
|
285
289
|
return [4, API.leadService.updateLead(payload)];
|
|
286
290
|
case 1:
|
|
287
|
-
data = (
|
|
291
|
+
data = (_m.sent()).data;
|
|
288
292
|
if (!data.errors) {
|
|
289
293
|
thunkApi.dispatch(handleNextScreenStep());
|
|
290
|
-
(
|
|
294
|
+
(_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, params);
|
|
291
295
|
}
|
|
292
296
|
return [2, { response: data, formData: params }];
|
|
293
297
|
}
|
|
@@ -336,23 +340,27 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
|
|
|
336
340
|
});
|
|
337
341
|
});
|
|
338
342
|
export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
339
|
-
var _a, settings, connect, payload, data;
|
|
340
|
-
var
|
|
341
|
-
return __generator(this, function (
|
|
342
|
-
switch (
|
|
343
|
+
var _a, settings, connect, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
|
|
344
|
+
var _c, _d, _e, _f, _g, _h;
|
|
345
|
+
return __generator(this, function (_j) {
|
|
346
|
+
switch (_j.label) {
|
|
343
347
|
case 0:
|
|
344
348
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
349
|
+
_b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData, otpData = _b.otpData, brandData = _b.brandData;
|
|
350
|
+
isAbsher = otpData.isAbsher;
|
|
351
|
+
responseBody = (isAbsher ? nidData : mobileData).responseBody;
|
|
352
|
+
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
|
|
345
353
|
payload = {
|
|
346
354
|
step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
|
|
347
355
|
email_url: getClientEmailUrl(),
|
|
348
|
-
id: ((
|
|
356
|
+
id: (isExistingUser ? (_c = brandData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id : (_d = otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
|
|
349
357
|
encryption_contract: []
|
|
350
358
|
};
|
|
351
359
|
return [4, API.leadService.updateLead(payload)];
|
|
352
360
|
case 1:
|
|
353
|
-
data = (
|
|
354
|
-
(
|
|
355
|
-
(
|
|
361
|
+
data = (_j.sent()).data;
|
|
362
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
363
|
+
(_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
|
|
356
364
|
return [2, { response: data, formData: params }];
|
|
357
365
|
}
|
|
358
366
|
});
|
|
@@ -360,6 +368,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
360
368
|
var initialState = {
|
|
361
369
|
error: null,
|
|
362
370
|
loading: false,
|
|
371
|
+
customLoading: false,
|
|
363
372
|
data: {
|
|
364
373
|
businessCountry: defaultCountry,
|
|
365
374
|
countries: [],
|
|
@@ -424,6 +433,7 @@ export var connectSlice = createSlice({
|
|
|
424
433
|
builder
|
|
425
434
|
.addCase(getCountries.fulfilled, function (state, action) {
|
|
426
435
|
state.error = null;
|
|
436
|
+
state.customLoading = false;
|
|
427
437
|
var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
|
|
428
438
|
state.data.countries = countries;
|
|
429
439
|
state.data.businessCountry = businessCountry || defaultCountry;
|
|
@@ -431,13 +441,16 @@ export var connectSlice = createSlice({
|
|
|
431
441
|
})
|
|
432
442
|
.addCase(getCountries.pending, function (state) {
|
|
433
443
|
state.error = null;
|
|
444
|
+
state.customLoading = true;
|
|
434
445
|
})
|
|
435
446
|
.addCase(getCountries.rejected, function (state, action) {
|
|
436
447
|
state.error = action.error.message;
|
|
448
|
+
state.customLoading = false;
|
|
437
449
|
})
|
|
438
450
|
.addCase(createMobileAuth.fulfilled, function (state, action) {
|
|
439
451
|
var _a;
|
|
440
452
|
state.loading = false;
|
|
453
|
+
state.customLoading = false;
|
|
441
454
|
state.error = null;
|
|
442
455
|
var _b = action.payload, formData = _b.formData, response = _b.response;
|
|
443
456
|
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -450,12 +463,15 @@ export var connectSlice = createSlice({
|
|
|
450
463
|
state.data.otpData.isAbsher = false;
|
|
451
464
|
})
|
|
452
465
|
.addCase(createMobileAuth.pending, function (state, action) {
|
|
453
|
-
|
|
454
|
-
|
|
466
|
+
if (action.meta.arg.isResend)
|
|
467
|
+
state.customLoading = true;
|
|
468
|
+
if (!action.meta.arg.isResend)
|
|
469
|
+
state.loading = true;
|
|
455
470
|
state.error = null;
|
|
456
471
|
})
|
|
457
472
|
.addCase(createMobileAuth.rejected, function (state, action) {
|
|
458
473
|
state.loading = false;
|
|
474
|
+
state.customLoading = false;
|
|
459
475
|
state.error = action.error.message;
|
|
460
476
|
})
|
|
461
477
|
.addCase(createNIDAuth.fulfilled, function (state, action) {
|
|
@@ -608,7 +624,7 @@ export var connectSlice = createSlice({
|
|
|
608
624
|
.addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
|
|
609
625
|
var _a;
|
|
610
626
|
state.error = null;
|
|
611
|
-
state.data.brandData.responseBody = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response;
|
|
627
|
+
state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response);
|
|
612
628
|
})
|
|
613
629
|
.addCase(checkBrandNameAvailability.pending, function (state) {
|
|
614
630
|
state.error = null;
|
|
@@ -164,6 +164,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
164
164
|
var initialState = {
|
|
165
165
|
error: null,
|
|
166
166
|
loading: false,
|
|
167
|
+
customLoading: false,
|
|
167
168
|
data: {
|
|
168
169
|
verify: {
|
|
169
170
|
token: ''
|
|
@@ -199,10 +200,12 @@ export var individualSlice = createSlice({
|
|
|
199
200
|
builder
|
|
200
201
|
.addCase(verifyLeadToken.pending, function (state) {
|
|
201
202
|
state.error = null;
|
|
203
|
+
state.customLoading = true;
|
|
202
204
|
})
|
|
203
205
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
204
206
|
var _a;
|
|
205
207
|
state.error = null;
|
|
208
|
+
state.customLoading = false;
|
|
206
209
|
var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
|
|
207
210
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
208
211
|
if (description) {
|
|
@@ -214,6 +217,7 @@ export var individualSlice = createSlice({
|
|
|
214
217
|
})
|
|
215
218
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
216
219
|
state.error = action.error.message;
|
|
220
|
+
state.customLoading = false;
|
|
217
221
|
})
|
|
218
222
|
.addCase(verifyLeadOTP.pending, function (state) {
|
|
219
223
|
state.loading = true;
|
|
@@ -158,6 +158,7 @@ export var passwordSlice = createSlice({
|
|
|
158
158
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
159
159
|
var _a;
|
|
160
160
|
state.error = null;
|
|
161
|
+
state.customLoading = false;
|
|
161
162
|
var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
|
|
162
163
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
163
164
|
if (description) {
|
|
@@ -166,9 +167,14 @@ export var passwordSlice = createSlice({
|
|
|
166
167
|
}
|
|
167
168
|
state.data.verify.responseBody = __assign(__assign({}, data), leadData);
|
|
168
169
|
state.data.verify.token = token;
|
|
170
|
+
})
|
|
171
|
+
.addCase(verifyLeadToken.pending, function (state, action) {
|
|
172
|
+
state.customLoading = true;
|
|
173
|
+
state.error = null;
|
|
169
174
|
})
|
|
170
175
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
171
176
|
state.error = action.error.message;
|
|
177
|
+
state.customLoading = false;
|
|
172
178
|
})
|
|
173
179
|
.addCase(verifyPasswordLeadOTP.pending, function (state) {
|
|
174
180
|
state.loading = true;
|
|
@@ -190,6 +190,7 @@ export var taxSlice = createSlice({
|
|
|
190
190
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
191
191
|
var _a;
|
|
192
192
|
state.error = null;
|
|
193
|
+
state.customLoading = false;
|
|
193
194
|
var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
|
|
194
195
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
195
196
|
if (description) {
|
|
@@ -198,9 +199,14 @@ export var taxSlice = createSlice({
|
|
|
198
199
|
}
|
|
199
200
|
state.data.verify.responseBody = __assign(__assign({}, data), leadData);
|
|
200
201
|
state.data.verify.token = token;
|
|
202
|
+
})
|
|
203
|
+
.addCase(verifyLeadToken.pending, function (state, action) {
|
|
204
|
+
state.error = null;
|
|
205
|
+
state.customLoading = true;
|
|
201
206
|
})
|
|
202
207
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
203
208
|
state.error = action.error.message;
|
|
209
|
+
state.customLoading = false;
|
|
204
210
|
})
|
|
205
211
|
.addCase(verifyTaxLeadOTP.pending, function (state) {
|
|
206
212
|
state.loading = true;
|
|
@@ -14,7 +14,7 @@ import React, { memo, useEffect } from 'react';
|
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
15
|
import { settingsSelector } from '../../app/settings';
|
|
16
16
|
import { FeatureContainer } from '../shared/Containers';
|
|
17
|
-
import { getCountries, verifyLeadToken } from '../app/business/businessStore';
|
|
17
|
+
import { businessSelector, getCountries, verifyLeadToken } from '../app/business/businessStore';
|
|
18
18
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
19
19
|
import { store } from '../../app/store';
|
|
20
20
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -28,6 +28,7 @@ var Business = memo(function (props) {
|
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
|
+
var customLoading = useAppSelector(businessSelector).customLoading;
|
|
31
32
|
var loading = useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props)).loading;
|
|
32
33
|
useErrorListener();
|
|
33
34
|
var activeScreen = data.activeScreen;
|
|
@@ -44,7 +45,7 @@ var Business = memo(function (props) {
|
|
|
44
45
|
useEffect(function () {
|
|
45
46
|
dispatch(getCountries());
|
|
46
47
|
}, []);
|
|
47
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
|
|
48
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
|
|
48
49
|
var Element = _a.element, name = _a.name;
|
|
49
50
|
var isActive = activeScreen.name === name;
|
|
50
51
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -61,6 +61,10 @@ var Activities = function () {
|
|
|
61
61
|
var activities = activitiesData.activities;
|
|
62
62
|
methods.setValue('activities', activities);
|
|
63
63
|
}, [activitiesData === null || activitiesData === void 0 ? void 0 : activitiesData.activities]);
|
|
64
|
+
React.useEffect(function () {
|
|
65
|
+
if (activitiesData.operationStartDate)
|
|
66
|
+
methods.setValue('operationStartDate', activitiesData.operationStartDate, { shouldValidate: true });
|
|
67
|
+
}, [activitiesData.operationStartDate]);
|
|
64
68
|
React.useEffect(function () {
|
|
65
69
|
if (error)
|
|
66
70
|
dispatch(clearError());
|
|
@@ -83,19 +83,18 @@ var ActivitiesList = function (_a) {
|
|
|
83
83
|
var t = useTranslation().t;
|
|
84
84
|
var isAr = useLanguage().isAr;
|
|
85
85
|
var control = useFormContext().control;
|
|
86
|
+
var data = useSelector(businessSelector).data;
|
|
86
87
|
var activitiesControl = useController({ name: 'activities', control: control });
|
|
87
88
|
var controlValue = activitiesControl.field.value;
|
|
88
|
-
var data = useSelector(businessSelector).data;
|
|
89
89
|
var businessTypeData = data.businessTypeData;
|
|
90
|
-
var
|
|
90
|
+
var activities = (businessTypeData.responseBody || {}).activities;
|
|
91
91
|
var businessType = (_b = businessTypeData.selectedLicense) === null || _b === void 0 ? void 0 : _b.type;
|
|
92
92
|
var isCR = businessType === BusinessType.CR;
|
|
93
93
|
React.useEffect(function () {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
setActivitiesMenuList(response === null || response === void 0 ? void 0 : response.activities);
|
|
94
|
+
if ((activities === null || activities === void 0 ? void 0 : activities.length) > 0) {
|
|
95
|
+
setActivitiesMenuList(activities);
|
|
97
96
|
}
|
|
98
|
-
}, []);
|
|
97
|
+
}, [activities]);
|
|
99
98
|
var onOpenList = function (event) {
|
|
100
99
|
var _a;
|
|
101
100
|
setAnchorEl(event.currentTarget);
|
|
@@ -84,13 +84,12 @@ var SalesChannels = function () {
|
|
|
84
84
|
var channelsChecked = channelsControl.field.value;
|
|
85
85
|
var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
86
86
|
var data = useSelector(businessSelector).data;
|
|
87
|
-
var
|
|
87
|
+
var channelList = (data.businessTypeData.responseBody || {}).channelList;
|
|
88
88
|
React.useEffect(function () {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
setChannelsMenuList(response === null || response === void 0 ? void 0 : response.channelList);
|
|
89
|
+
if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
|
|
90
|
+
setChannelsMenuList(channelList);
|
|
92
91
|
}
|
|
93
|
-
}, [
|
|
92
|
+
}, [channelList]);
|
|
94
93
|
var handleSalesChannelChange = function (event, checked) {
|
|
95
94
|
var selected = channelsMenuList.find(function (channel) { return channel.id.toString() === event.target.id; });
|
|
96
95
|
var isExists = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (selected === null || selected === void 0 ? void 0 : selected.id); });
|
|
@@ -21,13 +21,12 @@ import Form from '../../../../components/Form';
|
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import { useLanguage } from '../../../../hooks';
|
|
23
23
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
24
|
-
import { businessSelector, clearError,
|
|
24
|
+
import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
25
25
|
import Button from '../../../shared/Button';
|
|
26
26
|
import { LicenseValidationSchema } from './validation';
|
|
27
27
|
import LicenseList from './LicenseList';
|
|
28
28
|
var BusinessType = function (_a) {
|
|
29
29
|
var _b = useSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
30
|
-
var businessTypeData = data.businessTypeData;
|
|
31
30
|
var t = useTranslation().t;
|
|
32
31
|
var isAr = useLanguage().isAr;
|
|
33
32
|
var dispatch = useAppDispatch();
|
|
@@ -37,10 +36,6 @@ var BusinessType = function (_a) {
|
|
|
37
36
|
defaultValues: data.businessTypeData,
|
|
38
37
|
mode: 'onChange'
|
|
39
38
|
});
|
|
40
|
-
React.useEffect(function () {
|
|
41
|
-
if (!(businessTypeData === null || businessTypeData === void 0 ? void 0 : businessTypeData.responseBody))
|
|
42
|
-
dispatch(retrieveEntityList());
|
|
43
|
-
}, []);
|
|
44
39
|
React.useEffect(function () {
|
|
45
40
|
if (error)
|
|
46
41
|
dispatch(clearError());
|
|
@@ -52,7 +52,7 @@ var LicenseContainer = styled(Box)(function () { return ({
|
|
|
52
52
|
}); });
|
|
53
53
|
var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
54
54
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
55
|
-
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
55
|
+
return (__assign(__assign({ display: 'flex', color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
56
56
|
});
|
|
57
57
|
var LicenseList = function (_a) {
|
|
58
58
|
var rest = __rest(_a, []);
|
|
@@ -64,7 +64,7 @@ var LicenseList = function (_a) {
|
|
|
64
64
|
var dispatch = useAppDispatch();
|
|
65
65
|
var _d = useFormContext(), setValue = _d.setValue, control = _d.control;
|
|
66
66
|
var selectedLicenseControl = useController({ control: control, name: 'selectedLicense' });
|
|
67
|
-
var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense;
|
|
67
|
+
var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber;
|
|
68
68
|
var licenseList = (responseBody || { licenseList: [] }).licenseList;
|
|
69
69
|
var onOpenLicenseList = function (event) {
|
|
70
70
|
var _a;
|
|
@@ -77,12 +77,14 @@ var LicenseList = function (_a) {
|
|
|
77
77
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
78
78
|
};
|
|
79
79
|
React.useEffect(function () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
if (licenseList.length > 0)
|
|
81
|
+
setValue('licenseList', licenseList);
|
|
82
|
+
}, [licenseList]);
|
|
83
|
+
React.useEffect(function () {
|
|
84
|
+
if (licenseList.length > 0) {
|
|
83
85
|
if (!!selectedLicense) {
|
|
84
86
|
setValue('selectedLicense', selectedLicense, { shouldValidate: true });
|
|
85
|
-
setValue('licenseNumber',
|
|
87
|
+
setValue('licenseNumber', licenseNumber, { shouldValidate: true });
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
}, [licenseList, selectedLicense]);
|
|
@@ -93,7 +95,7 @@ var LicenseList = function (_a) {
|
|
|
93
95
|
var getLicenseName = function (item) {
|
|
94
96
|
var _a, _b;
|
|
95
97
|
if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.FL && !isOtherLicense(item))
|
|
96
|
-
return 'future_work';
|
|
98
|
+
return t('future_work');
|
|
97
99
|
return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
98
100
|
};
|
|
99
101
|
var isOtherLicense = function (item) {
|
|
@@ -110,15 +112,18 @@ var LicenseList = function (_a) {
|
|
|
110
112
|
setValue('licenseNumber', getLicenseNumber(license), { shouldValidate: true });
|
|
111
113
|
onCloseLicenseList();
|
|
112
114
|
};
|
|
115
|
+
var getLicenseFullName = function (item) {
|
|
116
|
+
if (isAr)
|
|
117
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { children: getLicenseName(item) }), _jsx("span", { children: ' - ' }), _jsx("span", { children: getLicenseNumber(item) })] }));
|
|
118
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { children: getLicenseNumber(item) }), _jsx("span", { children: ' - ' }), _jsx("span", { children: getLicenseName(item) })] }));
|
|
119
|
+
};
|
|
113
120
|
var showLicenseNumber = !anchorEl;
|
|
114
121
|
var selected = selectedLicenseControl.field.value;
|
|
115
122
|
var licenseReadonly = !isOtherLicense(selected);
|
|
116
123
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
117
|
-
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) :
|
|
118
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ?
|
|
119
|
-
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item)
|
|
120
|
-
? t(getLicenseName(item))
|
|
121
|
-
: getLicenseNumber(item) + ' - ' + getLicenseName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
124
|
+
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
125
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? getLicenseName(selected) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
126
|
+
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
122
127
|
} }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
|
|
123
128
|
};
|
|
124
129
|
export default React.memo(LicenseList);
|
|
@@ -14,7 +14,7 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH } from '../../../../constants';
|
|
17
|
-
import {
|
|
17
|
+
import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
18
18
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
19
19
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
20
20
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
@@ -31,7 +31,7 @@ var LicenseNumber = function (_a) {
|
|
|
31
31
|
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
32
32
|
var handleFLNumberChange = function (_a) {
|
|
33
33
|
var target = _a.target;
|
|
34
|
-
var value =
|
|
34
|
+
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
35
35
|
licenseNumberControl.field.onChange(value);
|
|
36
36
|
};
|
|
37
37
|
var clearLicenseNumber = function () {
|
|
@@ -41,6 +41,6 @@ var LicenseNumber = function (_a) {
|
|
|
41
41
|
var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
42
42
|
var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
|
|
43
43
|
var label = isCR ? 'cr_number' : 'fl_number';
|
|
44
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '
|
|
44
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '01f3c5x78n' : '1a3c5b78', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
|
|
45
45
|
};
|
|
46
46
|
export default React.memo(LicenseNumber);
|
|
@@ -4,6 +4,7 @@ import { useAppDispatch } from '../../../../hooks';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
6
6
|
import { updateLeadSuccess } from '../../../app/business/businessStore';
|
|
7
|
+
import { handleNextScreenStep } from '../../../../app/settings';
|
|
7
8
|
var Success = function (_a) {
|
|
8
9
|
var t = useTranslation().t;
|
|
9
10
|
var dispatch = useAppDispatch();
|
|
@@ -11,8 +12,8 @@ var Success = function (_a) {
|
|
|
11
12
|
dispatch(updateLeadSuccess());
|
|
12
13
|
}, []);
|
|
13
14
|
var onSuccess = function () {
|
|
14
|
-
|
|
15
|
+
dispatch(handleNextScreenStep());
|
|
15
16
|
};
|
|
16
|
-
return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
|
|
17
|
+
return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess, successTitle: 'continue' });
|
|
17
18
|
};
|
|
18
19
|
export default React.memo(Success);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { memo } from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import Container from '../../../shared/Containers/ScreenContainer';
|
|
19
|
+
import { FlowsButtons } from '../../../shared/Button';
|
|
20
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
21
|
+
var TextContainerStyled = styled(Box)(function (_a) {
|
|
22
|
+
var _b;
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return (_b = {
|
|
25
|
+
background: theme.palette.common.white,
|
|
26
|
+
border: '1px solid',
|
|
27
|
+
width: '100%',
|
|
28
|
+
borderColor: theme.palette.divider,
|
|
29
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25)
|
|
30
|
+
},
|
|
31
|
+
_b[theme.breakpoints.up('sm')] = {
|
|
32
|
+
marginBottom: theme.spacing(7.5)
|
|
33
|
+
},
|
|
34
|
+
_b);
|
|
35
|
+
});
|
|
36
|
+
var TitleStyled = styled(Text)(function (_a) {
|
|
37
|
+
var theme = _a.theme;
|
|
38
|
+
return (__assign({ fontWeight: theme.typography.fontWeightRegular, color: theme.palette.text.primary, marginBlock: theme.spacing(1.75), lineHeight: 1.75, padding: '0px 20px' }, theme.typography.subtitle2));
|
|
39
|
+
});
|
|
40
|
+
var ContainerStyled = styled(Container)(function (_a) {
|
|
41
|
+
var theme = _a.theme;
|
|
42
|
+
return ({
|
|
43
|
+
justifyContent: 'space-between',
|
|
44
|
+
minHeight: theme.spacing(30),
|
|
45
|
+
alignItems: 'center'
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return ({
|
|
51
|
+
width: '100%'
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
var SuccessWithFlowButtons = function () {
|
|
55
|
+
var t = useTranslation().t;
|
|
56
|
+
return (_jsxs(ContainerStyled, { children: [_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [t('ide_successfully_verified_message'), " "] }) }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: [
|
|
57
|
+
{
|
|
58
|
+
title: t('tax_flow_pending'),
|
|
59
|
+
href: '#',
|
|
60
|
+
src: ICONS_NAMES.TAX_ICON
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: t('individual_flow_pending'),
|
|
64
|
+
href: '#',
|
|
65
|
+
src: ICONS_NAMES.INDIVIDUAL_ICON
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: t('bank_flow_pending'),
|
|
69
|
+
href: '#',
|
|
70
|
+
src: ICONS_NAMES.BANK_ICON
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: t('password_flow_pending'),
|
|
74
|
+
href: '#',
|
|
75
|
+
src: ICONS_NAMES.PASSWORD_ICON
|
|
76
|
+
}
|
|
77
|
+
] }) })] }));
|
|
78
|
+
};
|
|
79
|
+
export default memo(SuccessWithFlowButtons);
|
|
@@ -59,7 +59,7 @@ var VerifyNumber = function (_a) {
|
|
|
59
59
|
var t = useTranslation().t;
|
|
60
60
|
var isAr = useLanguage().isAr;
|
|
61
61
|
React.useEffect(function () {
|
|
62
|
-
if (error)
|
|
62
|
+
if (error && methods.formState.isValid)
|
|
63
63
|
dispatch(clearError());
|
|
64
64
|
return function () {
|
|
65
65
|
dispatch(resetOTPScreen());
|
|
@@ -11,6 +11,7 @@ import BusinessOTPPage from './business/screens/OTP';
|
|
|
11
11
|
import BusinessTypePage from './business/screens/BusinessType';
|
|
12
12
|
import ActivitiesPage from './business/screens/Activities';
|
|
13
13
|
import SuccessPage from './business/screens/Success';
|
|
14
|
+
import SuccessWithFlowButtonsPage from './business/screens/SuccessWithFlowButtons';
|
|
14
15
|
import PasswordVerifyPage from './password/screens/Verify';
|
|
15
16
|
import CreatePasswordPage from './password/screens/CreatePassword';
|
|
16
17
|
import SuccessPasswordPage from './password/screens/Success';
|
|
@@ -75,7 +76,8 @@ export var businessFeatureScreens = [
|
|
|
75
76
|
name: 'BUSINESS_CUSTOMERS_STEP',
|
|
76
77
|
element: CustomersPage
|
|
77
78
|
},
|
|
78
|
-
{ name: 'BUSINESS_SUCCESS_STEP', element: SuccessPage }
|
|
79
|
+
{ name: 'BUSINESS_SUCCESS_STEP', element: SuccessPage },
|
|
80
|
+
{ name: 'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP', element: SuccessWithFlowButtonsPage }
|
|
79
81
|
];
|
|
80
82
|
export var passwordFeatureScreens = [
|
|
81
83
|
{
|
|
@@ -43,7 +43,6 @@ var CreatePassword = function (_a) {
|
|
|
43
43
|
var isAr = useLanguage().isAr;
|
|
44
44
|
var dispatch = useAppDispatch();
|
|
45
45
|
var onSubmit = function (data) {
|
|
46
|
-
console.log('data', data);
|
|
47
46
|
dispatch(handleNextScreenStep());
|
|
48
47
|
};
|
|
49
48
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(Password, {}) }), _jsx(Button, __assign({ disableBack: true, isAr: isAr, disabled: !methods.formState.isValid, loading: false }, { children: t('next') }))] })) })) }));
|
|
@@ -44,6 +44,7 @@ var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return
|
|
|
44
44
|
var theme = _a.theme, hideIcon = _a.hideIcon;
|
|
45
45
|
return ({
|
|
46
46
|
paddingInlineStart: theme.spacing(0.75),
|
|
47
|
+
textTransform: 'none',
|
|
47
48
|
backgroundColor: theme.palette.common.white,
|
|
48
49
|
border: "1px solid ".concat(hideIcon ? theme.palette.primary.main : theme.palette.primary.light),
|
|
49
50
|
color: hideIcon ? theme.palette.primary.main : theme.palette.primary.light,
|
|
@@ -63,7 +63,7 @@ var ButtonStyled = styled(Button, {
|
|
|
63
63
|
shouldForwardProp: function (prop) { return prop !== 'isBack' && prop !== 'isLoading'; }
|
|
64
64
|
})(function (_a) {
|
|
65
65
|
var theme = _a.theme, isBack = _a.isBack, isLoading = _a.isLoading;
|
|
66
|
-
return (__assign({ paddingInlineStart: theme.spacing(2.5), marginInlineStart: isBack ? theme.spacing(-5) : theme.spacing(0), paddingLeft: isLoading ? 8 : 'auto', paddingRight: isLoading ? 8 : 'auto', transition: theme.transitions.create(['width', 'padding'], {
|
|
66
|
+
return (__assign({ paddingInlineStart: theme.spacing(2.5), marginInlineStart: isBack ? theme.spacing(-5) : theme.spacing(0), paddingLeft: isLoading ? 8 : 'auto', paddingRight: isLoading ? 8 : 'auto', textTransform: 'none', transition: theme.transitions.create(['width', 'padding'], {
|
|
67
67
|
easing: theme.transitions.easing.easeInOut,
|
|
68
68
|
duration: theme.transitions.duration.complex * 2
|
|
69
69
|
}) }, (isLoading && {
|