@tap-payments/auth-jsconnect 2.8.14-test → 2.8.16-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/constants/app.d.ts +5 -0
- package/build/constants/app.js +23 -0
- package/build/features/app/brand/brandStore.d.ts +0 -2
- package/build/features/app/brand/brandStore.js +61 -53
- package/build/features/app/business/businessStore.d.ts +0 -5
- package/build/features/app/business/businessStore.js +63 -81
- package/build/features/app/entity/entityStore.d.ts +0 -2
- package/build/features/app/entity/entityStore.js +16 -23
- package/build/features/app/individual/individualStore.d.ts +0 -2
- package/build/features/app/individual/individualStore.js +7 -14
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +6 -3
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +6 -3
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +8 -4
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +8 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +5 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +8 -3
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +8 -1
- package/package.json +1 -1
package/build/constants/app.d.ts
CHANGED
package/build/constants/app.js
CHANGED
|
@@ -934,3 +934,26 @@ export var ADD_NEW_ENTITY = {
|
|
|
934
934
|
},
|
|
935
935
|
type: ''
|
|
936
936
|
};
|
|
937
|
+
export var COUNTRY_TO_CURRENCY = {
|
|
938
|
+
SA: 'SAR',
|
|
939
|
+
BH: 'BHD',
|
|
940
|
+
EG: 'EGP',
|
|
941
|
+
JO: 'JOD',
|
|
942
|
+
KW: 'KWD',
|
|
943
|
+
LB: 'LBP',
|
|
944
|
+
OM: 'OMR',
|
|
945
|
+
QA: 'QAR',
|
|
946
|
+
AE: 'AED',
|
|
947
|
+
US: 'USD',
|
|
948
|
+
GB: 'GBP',
|
|
949
|
+
IE: 'EUR',
|
|
950
|
+
FR: 'EUR',
|
|
951
|
+
NL: 'EUR',
|
|
952
|
+
DE: 'EUR',
|
|
953
|
+
ES: 'EUR',
|
|
954
|
+
IT: 'EUR',
|
|
955
|
+
PK: 'PKR',
|
|
956
|
+
IN: 'INR',
|
|
957
|
+
HK: 'HKD',
|
|
958
|
+
SG: 'SGD'
|
|
959
|
+
};
|
|
@@ -131,7 +131,6 @@ export declare const updateSegmentBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
131
131
|
data: any;
|
|
132
132
|
entityData: any;
|
|
133
133
|
formData: BrandSegmentFormValues;
|
|
134
|
-
currencyData: any;
|
|
135
134
|
}, AsyncThunkParams<BrandSegmentFormValues>, {
|
|
136
135
|
state?: unknown;
|
|
137
136
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -218,7 +217,6 @@ export interface BrandData {
|
|
|
218
217
|
brandSegmentData: BrandSegmentFormValues & ResponseData;
|
|
219
218
|
brandActivities: BrandActivitiesFormValues & ResponseData;
|
|
220
219
|
flowName: FlowsTypes;
|
|
221
|
-
currency: string;
|
|
222
220
|
}
|
|
223
221
|
export interface BrandState extends SharedState<BrandData> {
|
|
224
222
|
customLoading?: boolean;
|
|
@@ -66,10 +66,10 @@ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retr
|
|
|
66
66
|
export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function (_a, thunkApi) {
|
|
67
67
|
var token = _a.token, isInternally = _a.isInternally;
|
|
68
68
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
-
var payload, data, countryIso2, _b, config, brand_id, entity_id, publicKey, salesChannels, brandData;
|
|
70
|
-
var _c;
|
|
71
|
-
return __generator(this, function (
|
|
72
|
-
switch (
|
|
69
|
+
var payload, data, countryIso2, _b, config, brand_id, entity_id, board_id, publicKey, salesChannels, brandData, data_1;
|
|
70
|
+
var _c, _d;
|
|
71
|
+
return __generator(this, function (_e) {
|
|
72
|
+
switch (_e.label) {
|
|
73
73
|
case 0:
|
|
74
74
|
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
75
75
|
notification: {
|
|
@@ -78,31 +78,38 @@ export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function
|
|
|
78
78
|
}));
|
|
79
79
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
80
80
|
case 1:
|
|
81
|
-
data = (
|
|
81
|
+
data = (_e.sent()).data;
|
|
82
82
|
if (((_c = data === null || data === void 0 ? void 0 : data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
83
83
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
84
84
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
85
85
|
if (countryIso2)
|
|
86
86
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
87
|
-
_b = data || {}, config = _b.config, brand_id = _b.brand_id, entity_id = _b.entity_id;
|
|
87
|
+
_b = data || {}, config = _b.config, brand_id = _b.brand_id, entity_id = _b.entity_id, board_id = _b.id;
|
|
88
88
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
89
89
|
if (publicKey)
|
|
90
90
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
91
91
|
brandData = undefined;
|
|
92
92
|
if (isInternally)
|
|
93
93
|
data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
|
|
94
|
-
if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3,
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
return [4, API.brandService.retrieveBrand(brand_id)];
|
|
94
|
+
if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 7];
|
|
95
|
+
if (!!brand_id) return [3, 3];
|
|
96
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
98
97
|
case 2:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
data_1 = _e.sent();
|
|
99
|
+
brandData = data_1;
|
|
100
|
+
if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand) === null || _d === void 0 ? void 0 : _d.id))
|
|
101
|
+
throw new Error('brand_id_missing');
|
|
102
|
+
return [3, 5];
|
|
103
|
+
case 3: return [4, API.brandService.retrieveBrand(brand_id)];
|
|
104
|
+
case 4:
|
|
105
|
+
brandData = _e.sent();
|
|
106
|
+
_e.label = 5;
|
|
107
|
+
case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
108
|
+
case 6:
|
|
109
|
+
salesChannels = _e.sent();
|
|
103
110
|
thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
|
|
104
|
-
|
|
105
|
-
case
|
|
111
|
+
_e.label = 7;
|
|
112
|
+
case 7: return [2, {
|
|
106
113
|
data: data,
|
|
107
114
|
brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
|
|
108
115
|
salesChannels: salesChannels,
|
|
@@ -131,10 +138,10 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
|
|
|
131
138
|
});
|
|
132
139
|
}); });
|
|
133
140
|
export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
134
|
-
var _a, brand, settings, responseBody, payload, data, publicKey, _b, brand_id, entity_id, brandData, salesChannels;
|
|
135
|
-
var _c, _d, _e, _f, _g;
|
|
136
|
-
return __generator(this, function (
|
|
137
|
-
switch (
|
|
141
|
+
var _a, brand, settings, responseBody, payload, data, publicKey, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
|
|
142
|
+
var _c, _d, _e, _f, _g, _h;
|
|
143
|
+
return __generator(this, function (_j) {
|
|
144
|
+
switch (_j.label) {
|
|
138
145
|
case 0:
|
|
139
146
|
_a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
|
|
140
147
|
responseBody = brand.data.verify.responseBody;
|
|
@@ -147,22 +154,30 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
|
|
|
147
154
|
};
|
|
148
155
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
149
156
|
case 1:
|
|
150
|
-
data = (
|
|
157
|
+
data = (_j.sent()).data;
|
|
151
158
|
if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
152
159
|
throw new Error(data.errors[0].description);
|
|
153
160
|
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
154
161
|
if (publicKey)
|
|
155
162
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
156
|
-
_b = data || {}, brand_id = _b.brand_id, entity_id = _b.entity_id;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return [4, API.
|
|
163
|
+
_b = data || {}, brand_id = _b.brand_id, entity_id = _b.entity_id, boardId = _b.id;
|
|
164
|
+
brandData = undefined;
|
|
165
|
+
if (!!brand_id) return [3, 3];
|
|
166
|
+
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
160
167
|
case 2:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
data_2 = _j.sent();
|
|
169
|
+
brandData = data_2;
|
|
170
|
+
if (!((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _f === void 0 ? void 0 : _f.id))
|
|
171
|
+
throw new Error('brand_id_missing');
|
|
172
|
+
return [3, 5];
|
|
173
|
+
case 3: return [4, API.brandService.retrieveBrand(brand_id)];
|
|
174
|
+
case 4:
|
|
175
|
+
brandData = _j.sent();
|
|
176
|
+
_j.label = 5;
|
|
177
|
+
case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
178
|
+
case 6:
|
|
179
|
+
salesChannels = _j.sent();
|
|
180
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
166
181
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
167
182
|
return [2, {
|
|
168
183
|
data: data,
|
|
@@ -341,10 +356,10 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
|
|
|
341
356
|
export var updateSegmentBrand = createAsyncThunk('brandUpdateBrandSegment', function (_a, thunkApi) {
|
|
342
357
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
343
358
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
344
|
-
var _b, settings, brand, _c, brandRes, entityInfoId, _d, id, data_status, isSegmentLocationNonEditable, isSegmentProfitNonEditable, isSegmentTechNonEditable, isSegmentTeamsNonEditable, segmentLocation, segmentProfit, segmentTech, teamSize, segmentLocationId, segmentProfitId, segmentTechId, teamSizeId, hasSegment, requestBody, entityData,
|
|
345
|
-
var
|
|
346
|
-
return __generator(this, function (
|
|
347
|
-
switch (
|
|
359
|
+
var _b, settings, brand, _c, brandRes, entityInfoId, _d, id, data_status, isSegmentLocationNonEditable, isSegmentProfitNonEditable, isSegmentTechNonEditable, isSegmentTeamsNonEditable, segmentLocation, segmentProfit, segmentTech, teamSize, segmentLocationId, segmentProfitId, segmentTechId, teamSizeId, hasSegment, requestBody, entityData, brandData, entity, activityList;
|
|
360
|
+
var _e, _f;
|
|
361
|
+
return __generator(this, function (_g) {
|
|
362
|
+
switch (_g.label) {
|
|
348
363
|
case 0:
|
|
349
364
|
_b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
|
|
350
365
|
_c = brand.data.verify.responseBody || {}, brandRes = _c.brand, entityInfoId = _c.entityInfoId;
|
|
@@ -363,18 +378,15 @@ export var updateSegmentBrand = createAsyncThunk('brandUpdateBrandSegment', func
|
|
|
363
378
|
segment: { location_type: segmentLocationId, profit_type: segmentProfitId, tech_type: segmentTechId, team: teamSizeId }
|
|
364
379
|
}));
|
|
365
380
|
entityData = undefined;
|
|
366
|
-
return [4,
|
|
367
|
-
API.brandService.updateBrandInfo(requestBody),
|
|
368
|
-
API.countryService.getCurrency(settings.data.businessCountry.iso2)
|
|
369
|
-
])];
|
|
381
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
370
382
|
case 1:
|
|
371
|
-
|
|
383
|
+
brandData = (_g.sent()).brand;
|
|
372
384
|
if (!entityInfoId) return [3, 3];
|
|
373
385
|
return [4, API.entityService.retrieveEntity(entityInfoId)];
|
|
374
386
|
case 2:
|
|
375
|
-
entity = (
|
|
387
|
+
entity = (_g.sent()).entity;
|
|
376
388
|
entityData = entity;
|
|
377
|
-
|
|
389
|
+
_g.label = 3;
|
|
378
390
|
case 3:
|
|
379
391
|
if (entityData === null || entityData === void 0 ? void 0 : entityData.activities) {
|
|
380
392
|
entityData = __assign(__assign({}, entityData), { entity_activities: entityData.activities });
|
|
@@ -382,15 +394,15 @@ export var updateSegmentBrand = createAsyncThunk('brandUpdateBrandSegment', func
|
|
|
382
394
|
if (!!(entityData === null || entityData === void 0 ? void 0 : entityData.activities)) return [3, 5];
|
|
383
395
|
return [4, API.dataService.getActivities()];
|
|
384
396
|
case 4:
|
|
385
|
-
activityList = (
|
|
397
|
+
activityList = (_g.sent()).list;
|
|
386
398
|
entityData = __assign(__assign({}, entityData), { entity_activities: activityList });
|
|
387
|
-
|
|
399
|
+
_g.label = 5;
|
|
388
400
|
case 5: return [4, thunkApi.dispatch(retrieveDataList())];
|
|
389
401
|
case 6:
|
|
390
|
-
|
|
402
|
+
_g.sent();
|
|
391
403
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
392
|
-
(
|
|
393
|
-
return [2, { data: __assign({}, brandData), entityData: entityData, formData: originalFormData
|
|
404
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
405
|
+
return [2, { data: __assign({}, brandData), entityData: entityData, formData: originalFormData }];
|
|
394
406
|
}
|
|
395
407
|
});
|
|
396
408
|
});
|
|
@@ -562,7 +574,6 @@ var initialState = {
|
|
|
562
574
|
uploadingBrandLogo: false,
|
|
563
575
|
data: {
|
|
564
576
|
flowName: FlowsTypes.BRAND,
|
|
565
|
-
currency: '',
|
|
566
577
|
verify: {
|
|
567
578
|
token: ''
|
|
568
579
|
},
|
|
@@ -731,21 +742,18 @@ export var brandSlice = createSlice({
|
|
|
731
742
|
state.error = null;
|
|
732
743
|
})
|
|
733
744
|
.addCase(updateSegmentBrand.fulfilled, function (state, action) {
|
|
734
|
-
var _a;
|
|
735
745
|
state.loading = false;
|
|
736
746
|
state.error = null;
|
|
737
|
-
var
|
|
747
|
+
var _a = action.payload, data = _a.data, entityData = _a.entityData, formData = _a.formData;
|
|
738
748
|
var activities = data.activities, operations = data.operations, terms = data.terms;
|
|
739
749
|
var entity_activities = (entityData || {}).entity_activities;
|
|
740
750
|
var selectedActivity = entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
|
|
741
751
|
return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
|
|
742
752
|
});
|
|
743
753
|
state.data.brandSegmentData = formData;
|
|
744
|
-
if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
|
|
745
|
-
state.data.currency = currencyData.code.english;
|
|
746
754
|
state.data.brandActivities.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
|
|
747
|
-
var
|
|
748
|
-
var
|
|
755
|
+
var _b = operations || {}, customer_base = _b.customer_base, sales = _b.sales;
|
|
756
|
+
var _c = customer_base || {}, locations = _c.locations, customerBase = __rest(_c, ["locations"]);
|
|
749
757
|
if (locations && locations.length)
|
|
750
758
|
state.data.brandActivities.customerLocations = locations;
|
|
751
759
|
if (!!sales)
|
|
@@ -7,7 +7,6 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
7
7
|
token: string;
|
|
8
8
|
brandData: any;
|
|
9
9
|
boardId: any;
|
|
10
|
-
currencyData: any;
|
|
11
10
|
isRequireOTP?: undefined;
|
|
12
11
|
} | {
|
|
13
12
|
data: any;
|
|
@@ -17,7 +16,6 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
17
16
|
leadData?: undefined;
|
|
18
17
|
brandData?: undefined;
|
|
19
18
|
boardId?: undefined;
|
|
20
|
-
currencyData?: undefined;
|
|
21
19
|
}, string, {
|
|
22
20
|
state?: unknown;
|
|
23
21
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -49,7 +47,6 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
49
47
|
};
|
|
50
48
|
brand: any;
|
|
51
49
|
leadData: any;
|
|
52
|
-
currencyData: any;
|
|
53
50
|
}, OTPFormValues, {
|
|
54
51
|
state?: unknown;
|
|
55
52
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -180,7 +177,6 @@ export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk
|
|
|
180
177
|
activities: Activity[] | undefined;
|
|
181
178
|
operationStartDate: string;
|
|
182
179
|
};
|
|
183
|
-
currencyData: any;
|
|
184
180
|
}, ActivitiesFormValues, {
|
|
185
181
|
state?: unknown;
|
|
186
182
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -260,7 +256,6 @@ export interface BusinessData {
|
|
|
260
256
|
activitiesData: ActivitiesFormValues & ResponseData;
|
|
261
257
|
customersData: CustomersFormValues & ResponseData;
|
|
262
258
|
flowName: FlowsTypes;
|
|
263
|
-
currency: string;
|
|
264
259
|
}
|
|
265
260
|
export interface BusinessState extends SharedState<BusinessData> {
|
|
266
261
|
customLoading?: boolean;
|
|
@@ -62,7 +62,7 @@ import { BUSINESS_STEP_NAMES, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, OTHER_CR
|
|
|
62
62
|
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA } from '../../../utils';
|
|
63
63
|
import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
-
var settings, payload, data, publicKey, countryIso2, boardData, brandData,
|
|
65
|
+
var settings, payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
|
|
66
66
|
var _b, _c;
|
|
67
67
|
return __generator(this, function (_d) {
|
|
68
68
|
switch (_d.label) {
|
|
@@ -86,9 +86,9 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
86
86
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
87
87
|
if (countryIso2)
|
|
88
88
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
89
|
-
if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
89
|
+
if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 20];
|
|
90
90
|
boardData = undefined;
|
|
91
|
-
brandData = void 0,
|
|
91
|
+
brandData = void 0, isicActivityList = undefined;
|
|
92
92
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
93
93
|
case 2:
|
|
94
94
|
leadData = (_d.sent()).data;
|
|
@@ -101,7 +101,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
101
101
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && (isSA(countryIso2) || isOtherThanKWOrSA(countryIso2))) {
|
|
102
102
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
103
103
|
}
|
|
104
|
-
if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3,
|
|
104
|
+
if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 19];
|
|
105
105
|
_a = leadData || {}, steps = _a.steps, brand = _a.brand, board_id = _a.board_id, business_id = _a.business_id, entity = _a.entity;
|
|
106
106
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
107
107
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
@@ -119,64 +119,60 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
119
119
|
_d.label = 5;
|
|
120
120
|
case 5:
|
|
121
121
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
122
|
-
return [3,
|
|
122
|
+
return [3, 19];
|
|
123
123
|
case 6:
|
|
124
124
|
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 7];
|
|
125
125
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
126
|
-
return [3,
|
|
126
|
+
return [3, 19];
|
|
127
127
|
case 7:
|
|
128
128
|
if (!hasBusinessCustomersCompleted) return [3, 8];
|
|
129
129
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
|
|
130
|
-
return [3,
|
|
130
|
+
return [3, 19];
|
|
131
131
|
case 8:
|
|
132
|
-
if (!hasBusinessCRActivitiesCompleted) return [3,
|
|
133
|
-
return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
|
|
134
|
-
case 9:
|
|
135
|
-
currencyData = _d.sent();
|
|
132
|
+
if (!hasBusinessCRActivitiesCompleted) return [3, 12];
|
|
136
133
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
137
|
-
case
|
|
134
|
+
case 9:
|
|
138
135
|
list = (_d.sent()).list;
|
|
139
136
|
isicActivityList = list || [];
|
|
140
137
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
141
|
-
case
|
|
138
|
+
case 10:
|
|
142
139
|
_d.sent();
|
|
143
140
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
144
|
-
case
|
|
141
|
+
case 11:
|
|
145
142
|
brandData = _d.sent();
|
|
146
143
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
147
|
-
return [3,
|
|
148
|
-
case
|
|
149
|
-
if (!hasBusinessCRInfoCompleted) return [3,
|
|
144
|
+
return [3, 19];
|
|
145
|
+
case 12:
|
|
146
|
+
if (!hasBusinessCRInfoCompleted) return [3, 15];
|
|
150
147
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
151
|
-
case
|
|
148
|
+
case 13:
|
|
152
149
|
list = (_d.sent()).list;
|
|
153
150
|
isicActivityList = list || [];
|
|
154
151
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
155
|
-
case
|
|
152
|
+
case 14:
|
|
156
153
|
brandData = _d.sent();
|
|
157
154
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
158
|
-
return [3,
|
|
159
|
-
case
|
|
160
|
-
case
|
|
155
|
+
return [3, 19];
|
|
156
|
+
case 15: return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
157
|
+
case 16:
|
|
161
158
|
_d.sent();
|
|
162
|
-
if (!isSA(countryIso2)) return [3,
|
|
159
|
+
if (!isSA(countryIso2)) return [3, 18];
|
|
163
160
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
164
|
-
case
|
|
161
|
+
case 17:
|
|
165
162
|
_d.sent();
|
|
166
|
-
_d.label =
|
|
167
|
-
case
|
|
163
|
+
_d.label = 18;
|
|
164
|
+
case 18:
|
|
168
165
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
169
|
-
_d.label =
|
|
170
|
-
case
|
|
166
|
+
_d.label = 19;
|
|
167
|
+
case 19: return [2, {
|
|
171
168
|
data: data,
|
|
172
169
|
isicActivityList: isicActivityList,
|
|
173
170
|
leadData: __assign(__assign({}, leadData), { flows: (boardData === null || boardData === void 0 ? void 0 : boardData.info) || [] }),
|
|
174
171
|
token: token,
|
|
175
172
|
brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
|
|
176
|
-
boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
|
|
177
|
-
currencyData: currencyData
|
|
173
|
+
boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
|
|
178
174
|
}];
|
|
179
|
-
case
|
|
175
|
+
case 20: return [2, { data: data, isRequireOTP: true, token: token }];
|
|
180
176
|
}
|
|
181
177
|
});
|
|
182
178
|
}); });
|
|
@@ -198,7 +194,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
198
194
|
});
|
|
199
195
|
}); });
|
|
200
196
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
201
|
-
var _a, business, settings, isNID, responseBody, stepName, payload, data, publicKey, brandData, isicActivityList,
|
|
197
|
+
var _a, business, settings, isNID, responseBody, stepName, payload, data, publicKey, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
|
|
202
198
|
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
203
199
|
return __generator(this, function (_k) {
|
|
204
200
|
switch (_k.label) {
|
|
@@ -223,7 +219,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
223
219
|
if (publicKey) {
|
|
224
220
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
225
221
|
}
|
|
226
|
-
|
|
222
|
+
isicActivityList = undefined;
|
|
227
223
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
228
224
|
case 2:
|
|
229
225
|
leadData = (_k.sent()).data;
|
|
@@ -253,11 +249,11 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
253
249
|
case 6:
|
|
254
250
|
if (!isNID) return [3, 7];
|
|
255
251
|
thunkApi.dispatch(handleNextScreenStep());
|
|
256
|
-
return [3,
|
|
252
|
+
return [3, 22];
|
|
257
253
|
case 7:
|
|
258
254
|
if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 8];
|
|
259
255
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
|
|
260
|
-
return [3,
|
|
256
|
+
return [3, 22];
|
|
261
257
|
case 8:
|
|
262
258
|
if (!hasBusinessCompleted) return [3, 12];
|
|
263
259
|
if (!board_id) return [3, 11];
|
|
@@ -271,47 +267,44 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
271
267
|
_k.label = 11;
|
|
272
268
|
case 11:
|
|
273
269
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP')); });
|
|
274
|
-
return [3,
|
|
270
|
+
return [3, 22];
|
|
275
271
|
case 12:
|
|
276
272
|
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 13];
|
|
277
273
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP')); });
|
|
278
|
-
return [3,
|
|
274
|
+
return [3, 22];
|
|
279
275
|
case 13:
|
|
280
276
|
if (!hasBusinessCustomersCompleted) return [3, 14];
|
|
281
277
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP')); });
|
|
282
|
-
return [3,
|
|
278
|
+
return [3, 22];
|
|
283
279
|
case 14:
|
|
284
|
-
if (!hasBusinessCRActivitiesCompleted) return [3,
|
|
285
|
-
return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
|
|
286
|
-
case 15:
|
|
287
|
-
currencyData = _k.sent();
|
|
280
|
+
if (!hasBusinessCRActivitiesCompleted) return [3, 18];
|
|
288
281
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
289
|
-
case
|
|
282
|
+
case 15:
|
|
290
283
|
list = (_k.sent()).list;
|
|
291
284
|
isicActivityList = list || [];
|
|
292
285
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
293
|
-
case
|
|
286
|
+
case 16:
|
|
294
287
|
_k.sent();
|
|
295
288
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
296
|
-
case
|
|
289
|
+
case 17:
|
|
297
290
|
brandData = _k.sent();
|
|
298
291
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP')); });
|
|
299
|
-
return [3,
|
|
300
|
-
case
|
|
301
|
-
if (!hasBusinessCRInfoCompleted) return [3,
|
|
292
|
+
return [3, 22];
|
|
293
|
+
case 18:
|
|
294
|
+
if (!hasBusinessCRInfoCompleted) return [3, 21];
|
|
302
295
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
303
|
-
case
|
|
296
|
+
case 19:
|
|
304
297
|
list = (_k.sent()).list;
|
|
305
298
|
isicActivityList = list || [];
|
|
306
299
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
307
|
-
case
|
|
300
|
+
case 20:
|
|
308
301
|
brandData = _k.sent();
|
|
309
302
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP')); });
|
|
310
|
-
return [3,
|
|
311
|
-
case
|
|
303
|
+
return [3, 22];
|
|
304
|
+
case 21:
|
|
312
305
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP')); });
|
|
313
|
-
_k.label =
|
|
314
|
-
case
|
|
306
|
+
_k.label = 22;
|
|
307
|
+
case 22: return [2, { data: data, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
|
|
315
308
|
}
|
|
316
309
|
});
|
|
317
310
|
}); });
|
|
@@ -605,7 +598,7 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
605
598
|
});
|
|
606
599
|
}); });
|
|
607
600
|
export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
608
|
-
var _a, settings, business, _b, brand, entity_activities, entity, _c, brandActivities, brandId, activities, operationStartDate, stepName, id, removedActivities, payload, newBrandActivities, newEntityActivities, activityPayload, requestBody, data
|
|
601
|
+
var _a, settings, business, _b, brand, entity_activities, entity, _c, brandActivities, brandId, activities, operationStartDate, stepName, id, removedActivities, payload, newBrandActivities, newEntityActivities, activityPayload, requestBody, data;
|
|
609
602
|
var _d, _e;
|
|
610
603
|
return __generator(this, function (_f) {
|
|
611
604
|
switch (_f.label) {
|
|
@@ -655,13 +648,10 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
|
|
|
655
648
|
case 5:
|
|
656
649
|
data = _f.sent();
|
|
657
650
|
thunkApi.dispatch(retrieveDataList());
|
|
658
|
-
return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
|
|
659
|
-
case 6:
|
|
660
|
-
currencyData = _f.sent();
|
|
661
651
|
thunkApi.dispatch(updateStepName(stepName));
|
|
662
652
|
thunkApi.dispatch(handleNextScreenStep());
|
|
663
653
|
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
|
|
664
|
-
return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: __assign({}, params)
|
|
654
|
+
return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: __assign({}, params) }];
|
|
665
655
|
}
|
|
666
656
|
});
|
|
667
657
|
}); });
|
|
@@ -798,7 +788,6 @@ var initialState = {
|
|
|
798
788
|
uploadingArticle: false,
|
|
799
789
|
data: {
|
|
800
790
|
flowName: FlowsTypes.BUSINESS,
|
|
801
|
-
currency: '',
|
|
802
791
|
verify: {
|
|
803
792
|
token: ''
|
|
804
793
|
},
|
|
@@ -862,13 +851,13 @@ export var businessSlice = createSlice({
|
|
|
862
851
|
state.customLoading = true;
|
|
863
852
|
})
|
|
864
853
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
865
|
-
var _a, _b, _c, _d, _e
|
|
854
|
+
var _a, _b, _c, _d, _e;
|
|
866
855
|
state.error = null;
|
|
867
856
|
state.customLoading = false;
|
|
868
|
-
var
|
|
857
|
+
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;
|
|
869
858
|
var responseBody = state.data.verify.responseBody;
|
|
870
859
|
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 }));
|
|
871
|
-
var
|
|
860
|
+
var _g = leadData || {}, identification = _g.identification, date_of_birth = _g.date_of_birth;
|
|
872
861
|
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
873
862
|
state.data.nidData.nid = identification.id;
|
|
874
863
|
if (date_of_birth)
|
|
@@ -880,13 +869,13 @@ export var businessSlice = createSlice({
|
|
|
880
869
|
state.data.otpData.isNID = false;
|
|
881
870
|
if (isRequireOTP)
|
|
882
871
|
return;
|
|
883
|
-
var
|
|
872
|
+
var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_name = _h.business_name;
|
|
884
873
|
if (business_name === null || business_name === void 0 ? void 0 : business_name.en)
|
|
885
874
|
state.data.businessTypeData.entityLegalName = business_name === null || business_name === void 0 ? void 0 : business_name.en;
|
|
886
875
|
var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
|
|
887
876
|
if (issuingDate)
|
|
888
877
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
889
|
-
var
|
|
878
|
+
var _j = brandData || {}, terms = _j.terms, activities = _j.activities;
|
|
890
879
|
var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
|
|
891
880
|
return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
|
|
892
881
|
})) || [];
|
|
@@ -897,11 +886,9 @@ export var businessSlice = createSlice({
|
|
|
897
886
|
state.data.customersData.refundPolicy = element.agree;
|
|
898
887
|
}
|
|
899
888
|
});
|
|
900
|
-
if ((_c = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _c === void 0 ? void 0 : _c.english)
|
|
901
|
-
state.data.currency = currencyData.code.english;
|
|
902
889
|
state.data.activitiesData.activities = selectedActivity;
|
|
903
890
|
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
904
|
-
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((
|
|
891
|
+
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((_e = (_d = (_c = state.data.businessTypeData) === null || _c === void 0 ? void 0 : _c.responseBody) === null || _d === void 0 ? void 0 : _d.licenseList) === null || _e === void 0 ? void 0 : _e.length) && { licenseList: licenseList }));
|
|
905
892
|
})
|
|
906
893
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
907
894
|
state.error = action.error.message;
|
|
@@ -929,29 +916,27 @@ export var businessSlice = createSlice({
|
|
|
929
916
|
state.error = null;
|
|
930
917
|
})
|
|
931
918
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
932
|
-
var _a, _b, _c, _d, _e
|
|
919
|
+
var _a, _b, _c, _d, _e;
|
|
933
920
|
state.loading = false;
|
|
934
921
|
state.error = null;
|
|
935
|
-
var
|
|
922
|
+
var _f = action.payload, data = _f.data, formData = _f.formData, brand = _f.brand, leadData = _f.leadData, isicActivityList = _f.isicActivityList;
|
|
936
923
|
state.data.otpData = formData;
|
|
937
924
|
state.data.otpData.responseBody = data;
|
|
938
|
-
if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
|
|
939
|
-
state.data.currency = currencyData.code.english;
|
|
940
925
|
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) || [] });
|
|
941
|
-
var
|
|
926
|
+
var _g = leadData || {}, identification = _g.identification, date_of_birth = _g.date_of_birth;
|
|
942
927
|
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
943
928
|
state.data.nidData.nid = identification.id;
|
|
944
929
|
if (date_of_birth)
|
|
945
930
|
state.data.nidData.dob = dateFormat(date_of_birth);
|
|
946
931
|
if (identification === null || identification === void 0 ? void 0 : identification.type)
|
|
947
932
|
state.data.nidData.type = identification.type;
|
|
948
|
-
var
|
|
933
|
+
var _h = leadData || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_name = _h.business_name;
|
|
949
934
|
if (business_name === null || business_name === void 0 ? void 0 : business_name.en)
|
|
950
935
|
state.data.businessTypeData.entityLegalName = business_name === null || business_name === void 0 ? void 0 : business_name.en;
|
|
951
|
-
var issuingDate = ((
|
|
936
|
+
var issuingDate = ((_a = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
|
|
952
937
|
if (issuingDate)
|
|
953
938
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
954
|
-
var
|
|
939
|
+
var _j = brand || {}, terms = _j.terms, activities = _j.activities;
|
|
955
940
|
var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
|
|
956
941
|
return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
|
|
957
942
|
})) || [];
|
|
@@ -964,7 +949,7 @@ export var businessSlice = createSlice({
|
|
|
964
949
|
});
|
|
965
950
|
state.data.activitiesData.activities = selectedActivity;
|
|
966
951
|
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
967
|
-
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((
|
|
952
|
+
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((_e = (_d = (_c = state.data.businessTypeData) === null || _c === void 0 ? void 0 : _c.responseBody) === null || _d === void 0 ? void 0 : _d.licenseList) === null || _e === void 0 ? void 0 : _e.length) && { licenseList: licenseList }));
|
|
968
953
|
})
|
|
969
954
|
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
970
955
|
state.loading = false;
|
|
@@ -1185,13 +1170,10 @@ export var businessSlice = createSlice({
|
|
|
1185
1170
|
state.error = null;
|
|
1186
1171
|
})
|
|
1187
1172
|
.addCase(updateActivitiesInfo.fulfilled, function (state, action) {
|
|
1188
|
-
var _a;
|
|
1189
1173
|
state.loading = false;
|
|
1190
1174
|
state.error = null;
|
|
1191
|
-
var
|
|
1175
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
1192
1176
|
state.data.activitiesData = formData;
|
|
1193
|
-
if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
|
|
1194
|
-
state.data.currency = currencyData.code.english;
|
|
1195
1177
|
var terms = (data || {}).terms;
|
|
1196
1178
|
terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
|
|
1197
1179
|
if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
|
|
@@ -77,7 +77,6 @@ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk
|
|
|
77
77
|
export declare const updateEntityName: import("@reduxjs/toolkit").AsyncThunk<{
|
|
78
78
|
data: any;
|
|
79
79
|
formData: EntityNameFormValues;
|
|
80
|
-
currencyData: any;
|
|
81
80
|
}, AsyncThunkParams<EntityNameFormValues>, {
|
|
82
81
|
state?: unknown;
|
|
83
82
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -136,7 +135,6 @@ export interface EntityData {
|
|
|
136
135
|
entityNameData: EntityNameFormValues & ResponseData;
|
|
137
136
|
entityCapitalData: EntityCapitalFormValues & ResponseData;
|
|
138
137
|
flowName: FlowsTypes;
|
|
139
|
-
currency: string;
|
|
140
138
|
}
|
|
141
139
|
export interface EntityState extends SharedState<EntityData> {
|
|
142
140
|
customLoading?: boolean;
|
|
@@ -232,7 +232,7 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
232
232
|
export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (_a, thunkApi) {
|
|
233
233
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
234
234
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
235
|
-
var _b, settings, entity, _c, id, data_status, data_verification, documents, issuingDate, expiryDate, licenseType, licenseNumber, articleId, unifiedNumber, legalName, certificateId, entityType, issueDate, expDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isAOAFileNonEditable, isEntityTypeVerified, isLicenseNonEditable, isLicenseAvailable, payload, data,
|
|
235
|
+
var _b, settings, entity, _c, id, data_status, data_verification, documents, issuingDate, expiryDate, licenseType, licenseNumber, articleId, unifiedNumber, legalName, certificateId, entityType, issueDate, expDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isAOAFileNonEditable, isEntityTypeVerified, isLicenseNonEditable, isLicenseAvailable, payload, data, documentResponse, document, documentBody, documentBody, list;
|
|
236
236
|
var _d, _e, _f;
|
|
237
237
|
return __generator(this, function (_g) {
|
|
238
238
|
switch (_g.label) {
|
|
@@ -281,22 +281,19 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
281
281
|
return [4, API.entityService.updateEntity(payload)];
|
|
282
282
|
case 1:
|
|
283
283
|
data = _g.sent();
|
|
284
|
-
return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
|
|
285
|
-
case 2:
|
|
286
|
-
currencyData = _g.sent();
|
|
287
284
|
documentResponse = undefined;
|
|
288
285
|
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.CR);
|
|
289
|
-
if (!(!isDocumentsNonEditable && (certificateId || []).length > 0)) return [3,
|
|
290
|
-
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3,
|
|
286
|
+
if (!(!isDocumentsNonEditable && (certificateId || []).length > 0)) return [3, 7];
|
|
287
|
+
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
291
288
|
documentBody = {
|
|
292
289
|
id: document.id,
|
|
293
290
|
images: certificateId
|
|
294
291
|
};
|
|
295
292
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
296
|
-
case
|
|
293
|
+
case 2:
|
|
297
294
|
documentResponse = _g.sent();
|
|
298
|
-
return [3,
|
|
299
|
-
case
|
|
295
|
+
return [3, 5];
|
|
296
|
+
case 3:
|
|
300
297
|
documentBody = {
|
|
301
298
|
entity_id: id || '',
|
|
302
299
|
documents: [
|
|
@@ -307,21 +304,21 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
307
304
|
]
|
|
308
305
|
};
|
|
309
306
|
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
310
|
-
case
|
|
307
|
+
case 4:
|
|
311
308
|
documentResponse = _g.sent();
|
|
312
|
-
_g.label =
|
|
313
|
-
case
|
|
314
|
-
case
|
|
309
|
+
_g.label = 5;
|
|
310
|
+
case 5: return [4, API.entityService.retrieveEntity(id)];
|
|
311
|
+
case 6:
|
|
315
312
|
data = _g.sent();
|
|
316
313
|
data.documentData = documentResponse;
|
|
317
|
-
_g.label =
|
|
318
|
-
case
|
|
319
|
-
case
|
|
314
|
+
_g.label = 7;
|
|
315
|
+
case 7: return [4, API.dataService.getActivitiesIsIc()];
|
|
316
|
+
case 8:
|
|
320
317
|
list = (_g.sent()).list;
|
|
321
318
|
data.activityList = list;
|
|
322
319
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
323
320
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
324
|
-
return [2, { data: data, formData: originalFormData
|
|
321
|
+
return [2, { data: data, formData: originalFormData }];
|
|
325
322
|
}
|
|
326
323
|
});
|
|
327
324
|
});
|
|
@@ -439,7 +436,6 @@ var initialState = {
|
|
|
439
436
|
uploadingArticle: false,
|
|
440
437
|
data: {
|
|
441
438
|
flowName: FlowsTypes.ENTITY,
|
|
442
|
-
currency: '',
|
|
443
439
|
verify: {
|
|
444
440
|
token: ''
|
|
445
441
|
},
|
|
@@ -626,13 +622,10 @@ export var entitySlice = createSlice({
|
|
|
626
622
|
state.error = null;
|
|
627
623
|
})
|
|
628
624
|
.addCase(updateEntityName.fulfilled, function (state, action) {
|
|
629
|
-
var _a;
|
|
630
625
|
state.loading = false;
|
|
631
626
|
state.error = null;
|
|
632
|
-
var
|
|
633
|
-
var
|
|
634
|
-
if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
|
|
635
|
-
state.data.currency = currencyData.code.english;
|
|
627
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
628
|
+
var _b = data || {}, activityList = _b.activityList, rest = __rest(_b, ["activityList"]);
|
|
636
629
|
state.data.entityNameData = __assign(__assign({}, formData), { certificateId: undefined });
|
|
637
630
|
state.data.entityNameData.responseBody = __assign(__assign({}, state.data.entityNameData.responseBody), { rest: rest });
|
|
638
631
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: data === null || data === void 0 ? void 0 : data.entity, activityList: activityList });
|
|
@@ -219,7 +219,6 @@ export declare const updatePhoneInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
219
219
|
export declare const updateIndividualPersonalInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
220
220
|
data: any;
|
|
221
221
|
formData: IndividualPersonalInfoFormValues;
|
|
222
|
-
currencyData: any;
|
|
223
222
|
}, AsyncThunkParams<IndividualPersonalInfoFormValues>, {
|
|
224
223
|
state?: unknown;
|
|
225
224
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -302,7 +301,6 @@ export interface IndividualData {
|
|
|
302
301
|
individualPersonalData: IndividualPersonalInfoFormValues & ResponseData;
|
|
303
302
|
individualData: IndividualExtraFormValues & ResponseData;
|
|
304
303
|
flowName: FlowsTypes;
|
|
305
|
-
currency: string;
|
|
306
304
|
}
|
|
307
305
|
export interface IndividualState extends SharedState<IndividualData> {
|
|
308
306
|
customLoading?: boolean;
|
|
@@ -586,7 +586,7 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
|
|
|
586
586
|
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
|
|
587
587
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
588
588
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
589
|
-
var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data,
|
|
589
|
+
var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data, _e, isUser, isBuyer, isUserORBuyerType;
|
|
590
590
|
var _f, _g, _h, _j, _k;
|
|
591
591
|
return __generator(this, function (_l) {
|
|
592
592
|
switch (_l.label) {
|
|
@@ -670,20 +670,17 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
670
670
|
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
671
671
|
case 1:
|
|
672
672
|
data = _l.sent();
|
|
673
|
-
return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
|
|
674
|
-
case 2:
|
|
675
|
-
currencyData = _l.sent();
|
|
676
673
|
_e = getIndividualType(objects), isUser = _e.isUser, isBuyer = _e.isBuyer;
|
|
677
674
|
isUserORBuyerType = isUser || isBuyer;
|
|
678
|
-
if (!isUserORBuyerType) return [3,
|
|
675
|
+
if (!isUserORBuyerType) return [3, 3];
|
|
679
676
|
return [4, thunkApi.dispatch(retrieveDataList(code))];
|
|
680
|
-
case
|
|
677
|
+
case 2:
|
|
681
678
|
_l.sent();
|
|
682
|
-
_l.label =
|
|
683
|
-
case
|
|
679
|
+
_l.label = 3;
|
|
680
|
+
case 3:
|
|
684
681
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
685
682
|
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
|
|
686
|
-
return [2, { data: data, formData: originalFormData
|
|
683
|
+
return [2, { data: data, formData: originalFormData }];
|
|
687
684
|
}
|
|
688
685
|
});
|
|
689
686
|
});
|
|
@@ -898,7 +895,6 @@ var initialState = {
|
|
|
898
895
|
cityLoading: false,
|
|
899
896
|
data: {
|
|
900
897
|
flowName: FlowsTypes.INDIVIDUAL,
|
|
901
|
-
currency: '',
|
|
902
898
|
verify: {
|
|
903
899
|
token: ''
|
|
904
900
|
},
|
|
@@ -1286,14 +1282,11 @@ export var individualSlice = createSlice({
|
|
|
1286
1282
|
state.error = null;
|
|
1287
1283
|
})
|
|
1288
1284
|
.addCase(updateIndividualPersonalInfo.fulfilled, function (state, action) {
|
|
1289
|
-
var _a;
|
|
1290
1285
|
state.loading = false;
|
|
1291
1286
|
state.error = null;
|
|
1292
|
-
var
|
|
1287
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
1293
1288
|
state.data.individualPersonalData = formData;
|
|
1294
1289
|
state.data.individualPersonalData.responseBody = data;
|
|
1295
|
-
if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
|
|
1296
|
-
state.data.currency = currencyData.code.english;
|
|
1297
1290
|
})
|
|
1298
1291
|
.addCase(updateIndividualPersonalInfo.rejected, function (state, action) {
|
|
1299
1292
|
state.loading = false;
|
|
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { isExist } from '../../../../utils';
|
|
18
|
+
import { getCurrencyByCountryIso2, isExist } from '../../../../utils';
|
|
19
19
|
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
20
20
|
import { settingsSelector } from '../../../../app/settings';
|
|
21
21
|
import SimpleList from '../../../../components/SimpleList';
|
|
@@ -68,7 +68,7 @@ var ExpectedSalesRange = function (_a) {
|
|
|
68
68
|
var expectedSaleControl = useController({ name: 'expectedSale', control: control });
|
|
69
69
|
var _g = useAppSelector(brandSelector), data = _g.data, error = _g.error;
|
|
70
70
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
71
|
-
var brandActivities = data.brandActivities
|
|
71
|
+
var brandActivities = data.brandActivities;
|
|
72
72
|
var expectedSales = (brandActivities.responseBody || {}).expectedSales;
|
|
73
73
|
var expectedSalesRangeValue = expectedSaleControl.field.value;
|
|
74
74
|
var countryCode = settingsData.businessCountry;
|
|
@@ -95,6 +95,9 @@ var ExpectedSalesRange = function (_a) {
|
|
|
95
95
|
var handleCloseSubMenu = function () {
|
|
96
96
|
setSubIndex('');
|
|
97
97
|
};
|
|
98
|
+
var getCurrency = React.useMemo(function () {
|
|
99
|
+
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
100
|
+
}, [countryCode.iso2]);
|
|
98
101
|
React.useEffect(function () {
|
|
99
102
|
if ((expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.length) > 0) {
|
|
100
103
|
setExpectedSalesRangeList(expectedSales);
|
|
@@ -124,7 +127,7 @@ var ExpectedSalesRange = function (_a) {
|
|
|
124
127
|
setSubIndex(item.id);
|
|
125
128
|
}, [anchorEl, expectedSalesRangeValue]);
|
|
126
129
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('expected_sales_monthly', {
|
|
127
|
-
currency:
|
|
130
|
+
currency: getCurrency
|
|
128
131
|
}), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(InputStyled, { readOnly: readOnly, value: isAr ? (_b = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) !== null && _c !== void 0 ? _c : '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
|
|
129
132
|
var isOnlyOneItem = !item.sub || item.sub.length === 1;
|
|
130
133
|
if (isOnlyOneItem)
|
|
@@ -21,7 +21,7 @@ import SimpleList from '../../../../components/SimpleList';
|
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
23
23
|
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
24
|
-
import { isExist } from '../../../../utils';
|
|
24
|
+
import { getCurrencyByCountryIso2, isExist } from '../../../../utils';
|
|
25
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
26
|
import Search from '../../../shared/Search';
|
|
27
27
|
import InputSelect from '../../../shared/InputSelect';
|
|
@@ -65,7 +65,7 @@ var ExpectedSalesRange = function (_a) {
|
|
|
65
65
|
var expectedSaleControl = useController({ name: 'expectedSale', control: control });
|
|
66
66
|
var _e = useAppSelector(businessSelector), data = _e.data, error = _e.error;
|
|
67
67
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
68
|
-
var activitiesData = data.activitiesData
|
|
68
|
+
var activitiesData = data.activitiesData;
|
|
69
69
|
var expectedSales = (activitiesData.responseBody || {}).expectedSales;
|
|
70
70
|
var expectedSalesRangeValue = expectedSaleControl.field.value;
|
|
71
71
|
var countryCode = settingsData.businessCountry;
|
|
@@ -118,8 +118,11 @@ var ExpectedSalesRange = function (_a) {
|
|
|
118
118
|
if (item)
|
|
119
119
|
setSubIndex(item.id);
|
|
120
120
|
}, [anchorEl, expectedSalesRangeValue]);
|
|
121
|
+
var getCurrency = React.useMemo(function () {
|
|
122
|
+
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
123
|
+
}, [countryCode.iso2]);
|
|
121
124
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
|
|
122
|
-
currency:
|
|
125
|
+
currency: getCurrency
|
|
123
126
|
}) }), _jsx(InputStyled, { value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
|
|
124
127
|
var isOnlyOneItem = !item.sub || item.sub.length === 1;
|
|
125
128
|
if (isOnlyOneItem)
|
|
@@ -14,16 +14,17 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
-
import {
|
|
17
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
18
|
+
import { formatNumberAsCurrency, getCurrencyByCountryIso2, removeAllCharsFromNumber } from '../../../../utils';
|
|
18
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
20
|
import Input from '../../../shared/Input';
|
|
20
|
-
import { clearError
|
|
21
|
+
import { clearError } from '../../../app/entity/entityStore';
|
|
21
22
|
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
22
23
|
var CapitalPaid = function (_a) {
|
|
23
24
|
var _b;
|
|
24
25
|
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
25
26
|
var t = useTranslation().t;
|
|
26
|
-
var
|
|
27
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
27
28
|
var control = useFormContext().control;
|
|
28
29
|
var dispatch = useAppDispatch();
|
|
29
30
|
var handleChange = function (_a) {
|
|
@@ -33,11 +34,14 @@ var CapitalPaid = function (_a) {
|
|
|
33
34
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
34
35
|
capitalPaidControl.field.onChange(value);
|
|
35
36
|
};
|
|
37
|
+
var getCurrency = React.useMemo(function () {
|
|
38
|
+
return t(getCurrencyByCountryIso2(settingsData.businessCountry.iso2));
|
|
39
|
+
}, [settingsData.businessCountry.iso2]);
|
|
36
40
|
var capitalPaidControl = useController({ control: control, name: 'capitalPaid' });
|
|
37
41
|
var capitalPaidValue = capitalPaidControl.field.value;
|
|
38
42
|
var error = (_b = capitalPaidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
39
43
|
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('capital_paid_label', {
|
|
40
|
-
currency:
|
|
44
|
+
currency: getCurrency
|
|
41
45
|
}), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
|
|
42
46
|
};
|
|
43
47
|
export default React.memo(CapitalPaid);
|
|
@@ -13,17 +13,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
16
|
+
import { formatNumberAsCurrency, getCurrencyByCountryIso2, removeAllCharsFromNumber } from '../../../../utils';
|
|
17
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
18
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
19
20
|
import Input from '../../../shared/Input';
|
|
20
|
-
import { clearError
|
|
21
|
+
import { clearError } from '../../../app/entity/entityStore';
|
|
21
22
|
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
22
23
|
var CapitalShareValue = function (_a) {
|
|
23
24
|
var _b;
|
|
24
25
|
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
25
26
|
var t = useTranslation().t;
|
|
26
|
-
var
|
|
27
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
27
28
|
var control = useFormContext().control;
|
|
28
29
|
var dispatch = useAppDispatch();
|
|
29
30
|
var handleChange = function (_a) {
|
|
@@ -33,11 +34,14 @@ var CapitalShareValue = function (_a) {
|
|
|
33
34
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
34
35
|
capitalShareValueControl.field.onChange(value);
|
|
35
36
|
};
|
|
37
|
+
var getCurrency = React.useMemo(function () {
|
|
38
|
+
return t(getCurrencyByCountryIso2(settingsData.businessCountry.iso2));
|
|
39
|
+
}, [settingsData.businessCountry.iso2]);
|
|
36
40
|
var capitalShareValueControl = useController({ control: control, name: 'capitalShareValue' });
|
|
37
41
|
var capitalShareValueValue = capitalShareValueControl.field.value;
|
|
38
42
|
var error = (_b = capitalShareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
39
43
|
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('capital_share_value_label', {
|
|
40
|
-
currency:
|
|
44
|
+
currency: getCurrency
|
|
41
45
|
}), required: true, onChange: handleChange, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalShareValueValue, isVerified: isVerified }) }) })));
|
|
42
46
|
};
|
|
43
47
|
export default React.memo(CapitalShareValue);
|
|
@@ -16,7 +16,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
|
-
import { hasVerifiedValue } from '../../../../utils';
|
|
19
|
+
import { getCurrencyByCountryIso2, hasVerifiedValue } from '../../../../utils';
|
|
20
20
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
@@ -52,6 +52,9 @@ var MonthlyIncome = function (props) {
|
|
|
52
52
|
return false;
|
|
53
53
|
return hasVerifiedValue(user === null || user === void 0 ? void 0 : user.data_verification, "monthly_income.".concat(item.id));
|
|
54
54
|
};
|
|
55
|
+
var getCurrency = React.useMemo(function () {
|
|
56
|
+
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
57
|
+
}, [countryCode.iso2]);
|
|
55
58
|
React.useEffect(function () {
|
|
56
59
|
if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
|
|
57
60
|
setIncomeList(monthlyIncomeList);
|
|
@@ -81,7 +84,7 @@ var MonthlyIncome = function (props) {
|
|
|
81
84
|
var income = monthlyIncomeControl.field.value;
|
|
82
85
|
var error = (_a = monthlyIncomeControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
83
86
|
return (_jsx(Collapse, __assign({ in: props.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(InputSelect, { label: t('please_enter_actual_income', {
|
|
84
|
-
currency:
|
|
87
|
+
currency: getCurrency
|
|
85
88
|
}), required: true, readOnly: props.readOnly, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error), endAdornment: _jsx(EndAdornmentExpanded, { isVerified: isMonthlyIncomeVerified(income), anchorEl: anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
86
89
|
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIcon, { isVerified: isMonthlyIncomeVerified(item) })] }));
|
|
87
90
|
} }) }))] })) })));
|
|
@@ -14,8 +14,9 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
|
-
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
17
|
+
import { formatNumberAsCurrency, getCurrencyByCountryIso2, removeAllCharsFromNumber } from '../../../../utils';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
19
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
21
|
import Input from '../../../shared/Input';
|
|
21
22
|
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
@@ -24,10 +25,11 @@ var ShareValue = function (_a) {
|
|
|
24
25
|
var _b;
|
|
25
26
|
var show = _a.show, readOnly = _a.readOnly;
|
|
26
27
|
var t = useTranslation().t;
|
|
27
|
-
var
|
|
28
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
28
29
|
var control = useFormContext().control;
|
|
29
30
|
var bckError = useAppSelector(individualSelector).error;
|
|
30
31
|
var dispatch = useAppDispatch();
|
|
32
|
+
var countryCode = settingsData.businessCountry;
|
|
31
33
|
var handleChange = function (_a) {
|
|
32
34
|
var target = _a.target;
|
|
33
35
|
if (bckError)
|
|
@@ -35,11 +37,14 @@ var ShareValue = function (_a) {
|
|
|
35
37
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
36
38
|
shareValueControl.field.onChange(value);
|
|
37
39
|
};
|
|
40
|
+
var getCurrency = React.useMemo(function () {
|
|
41
|
+
return t(getCurrencyByCountryIso2(countryCode.iso2));
|
|
42
|
+
}, [countryCode.iso2]);
|
|
38
43
|
var shareValueControl = useController({ control: control, name: 'shareValue' });
|
|
39
44
|
var shareValue = shareValueControl.field.value;
|
|
40
45
|
var error = (_b = shareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
41
46
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('share_value_label', {
|
|
42
|
-
currency:
|
|
47
|
+
currency: getCurrency
|
|
43
48
|
}), onChange: handleChange, value: shareValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: shareValue, error: error }) }) })) })));
|
|
44
49
|
};
|
|
45
50
|
export default React.memo(ShareValue);
|
package/build/utils/string.d.ts
CHANGED
|
@@ -74,3 +74,4 @@ export declare const getFileType: (type: string) => "" | "image/jpeg" | "image/p
|
|
|
74
74
|
export declare const isStringHasOneAsterisk: (value: string) => boolean;
|
|
75
75
|
export declare const isOtherLicense: (item?: License) => boolean;
|
|
76
76
|
export declare const formatNumberAsCurrency: (number: string) => string;
|
|
77
|
+
export declare const getCurrencyByCountryIso2: (countryCode: string) => string;
|
package/build/utils/string.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlowsTypes } from '../@types';
|
|
2
2
|
import { concatenateObjectValues, encryptString } from '.';
|
|
3
3
|
import { removeAxiosGlobalHeaders } from '../api';
|
|
4
|
-
import { ENDPOINT_PATHS, ICONS_FULL_PATH } from '../constants';
|
|
4
|
+
import { COUNTRY_TO_CURRENCY, ENDPOINT_PATHS, ICONS_FULL_PATH } from '../constants';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
export var maskPhone = function (str) {
|
|
7
7
|
if (str === void 0) { str = ''; }
|
|
@@ -319,3 +319,10 @@ export var formatNumberAsCurrency = function (number) {
|
|
|
319
319
|
return '';
|
|
320
320
|
return parseInt(number).toLocaleString();
|
|
321
321
|
};
|
|
322
|
+
export var getCurrencyByCountryIso2 = function (countryCode) {
|
|
323
|
+
var _a;
|
|
324
|
+
if (!countryCode)
|
|
325
|
+
return '';
|
|
326
|
+
var currencyCode = (_a = COUNTRY_TO_CURRENCY[countryCode]) !== null && _a !== void 0 ? _a : '';
|
|
327
|
+
return currencyCode;
|
|
328
|
+
};
|