@tap-payments/auth-jsconnect 2.3.37-test → 2.3.40-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/@types/form.d.ts +3 -0
- package/build/api/address.d.ts +4 -0
- package/build/api/address.js +12 -0
- package/build/api/entity.d.ts +1 -0
- package/build/api/index.d.ts +3 -0
- package/build/api/index.js +3 -1
- package/build/app/settings.js +7 -3
- package/build/assets/locales/ar.json +1 -0
- package/build/assets/locales/en.json +1 -0
- package/build/constants/app.js +10 -4
- package/build/features/app/connect/connectStore.js +4 -3
- package/build/features/app/entity/entityStore.d.ts +7 -1
- package/build/features/app/entity/entityStore.js +57 -4
- package/build/features/brand/screens/BrandInfo/validation.js +5 -5
- package/build/features/connect/screens/Merchant/validation.js +5 -5
- package/build/features/entity/screens/EntityAddress/EntityAddress.d.ts +5 -0
- package/build/features/entity/screens/EntityAddress/EntityAddress.js +42 -0
- package/build/features/entity/screens/EntityAddress/index.d.ts +2 -0
- package/build/features/entity/screens/EntityAddress/index.js +2 -0
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +2 -2
- package/build/features/featuresScreens.js +5 -0
- package/build/features/shared/Address/Address.js +20 -13
- package/build/features/shared/Address/CountryList.js +3 -3
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
|
@@ -134,6 +134,9 @@ export declare type EntityCapitalFormValues = {
|
|
|
134
134
|
capitalShareCount: string;
|
|
135
135
|
capitalShareValue: string;
|
|
136
136
|
};
|
|
137
|
+
export declare type EntityAddressFormValues = {
|
|
138
|
+
billingAddress: Record<string, string>;
|
|
139
|
+
};
|
|
137
140
|
export declare type BusinessDataFormValues = {
|
|
138
141
|
brandName: string;
|
|
139
142
|
licenseNumber: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { httpClient } from './axios';
|
|
2
|
+
import { ENDPOINT_PATHS } from '../constants';
|
|
3
|
+
var retrieveAddressFormat = function (countryCode) {
|
|
4
|
+
return httpClient({
|
|
5
|
+
method: 'get',
|
|
6
|
+
url: "".concat(ENDPOINT_PATHS.ADDRESS_PATH, "/").concat(countryCode)
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
var addressService = {
|
|
10
|
+
retrieveAddressFormat: retrieveAddressFormat
|
|
11
|
+
};
|
|
12
|
+
export { addressService };
|
package/build/api/entity.d.ts
CHANGED
package/build/api/index.d.ts
CHANGED
|
@@ -141,6 +141,9 @@ declare const API: {
|
|
|
141
141
|
addFilesToExistingDocument: ({ id, ...data }: DocumentBody) => Promise<any>;
|
|
142
142
|
removeFilesFromDocument: ({ id, ...data }: DocumentBody) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
143
143
|
};
|
|
144
|
+
addressService: {
|
|
145
|
+
retrieveAddressFormat: (countryCode: string) => Promise<any>;
|
|
146
|
+
};
|
|
144
147
|
};
|
|
145
148
|
export type { ValidateOperatorBody, CreateAuthBody, ExpressCreateAccountBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, VerifyAuthExpressOTPBody, UpdateIndividualBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, BankDocumentInfo, GetUserListBody, GetIndividualListBody, RequestEmailBody, DocumentBody, UpdateEntityAOAFileBody };
|
|
146
149
|
export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
|
package/build/api/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { userService } from './user';
|
|
|
15
15
|
import { brandService } from './brand';
|
|
16
16
|
import { fileService } from './file';
|
|
17
17
|
import { documentService } from './document';
|
|
18
|
+
import { addressService } from './address';
|
|
18
19
|
var API = {
|
|
19
20
|
locationService: locationService,
|
|
20
21
|
operatorService: operatorService,
|
|
@@ -31,7 +32,8 @@ var API = {
|
|
|
31
32
|
userService: userService,
|
|
32
33
|
brandService: brandService,
|
|
33
34
|
fileService: fileService,
|
|
34
|
-
documentService: documentService
|
|
35
|
+
documentService: documentService,
|
|
36
|
+
addressService: addressService
|
|
35
37
|
};
|
|
36
38
|
export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
|
|
37
39
|
export default API;
|
package/build/app/settings.js
CHANGED
|
@@ -47,13 +47,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
var _a;
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
|
-
import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage } from '../utils';
|
|
50
|
+
import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerPrint, sortCountries, findCountryByIso2, getRequestHeaders, encryptString, dangerousMessage, isKW, isSA } from '../utils';
|
|
51
51
|
import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
|
|
52
52
|
import i18n from '../i18n';
|
|
53
53
|
import { updateLocale } from '../utils/locale';
|
|
54
54
|
import API, { setAxiosGlobalHeaders } from '../api';
|
|
55
55
|
export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var settings, _a, appConfig, language, _b, client, device, os, disableCountries, disableLocale, maturity, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, operatorStatus, isValidOperator, countries, businessCountry;
|
|
56
|
+
var settings, _a, appConfig, language, _b, client, device, os, disableCountries, disableLocale, maturity, _c, visitorId, _d, ip, latitude, longitude, locale, list, operatorData, deviceInfo, operatorStatus, isValidOperator, countries, countryCode, isKWOrSA, businessCountry;
|
|
57
57
|
return __generator(this, function (_e) {
|
|
58
58
|
switch (_e.label) {
|
|
59
59
|
case 0:
|
|
@@ -113,7 +113,11 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
113
113
|
operatorStatus = _e.sent();
|
|
114
114
|
isValidOperator = operatorStatus === 'valid';
|
|
115
115
|
countries = sortCountries(list);
|
|
116
|
-
|
|
116
|
+
countryCode = appConfig.businessCountryCode;
|
|
117
|
+
isKWOrSA = isKW(countryCode) || isSA(countryCode);
|
|
118
|
+
if (!isKWOrSA)
|
|
119
|
+
countryCode = 'SA';
|
|
120
|
+
businessCountry = findCountryByIso2(countries, countryCode);
|
|
117
121
|
if (!businessCountry)
|
|
118
122
|
throw new Error('Business country not found, you have to pass a valid business country code in the lib config');
|
|
119
123
|
return [2, { countries: countries, businessCountry: businessCountry, locale: locale, deviceInfo: deviceInfo, isValidOperator: isValidOperator }];
|
|
@@ -391,6 +391,7 @@
|
|
|
391
391
|
"try_again": "حاول مرة أخرى",
|
|
392
392
|
"file_delete_error": "حدث خطأ ما في حذف الملف. حاول مرة اخرى",
|
|
393
393
|
"file_download_error": "حدث خطأ ما في تحميل الملف. حاول مرة اخرى",
|
|
394
|
+
"is_required": " مطلوب",
|
|
394
395
|
"title_brand_logo": "لوجو العلامة التجارية",
|
|
395
396
|
"description_brand_logo": "JPG or PNG files up to 4mb."
|
|
396
397
|
}
|
|
@@ -421,6 +421,7 @@
|
|
|
421
421
|
"try_again": "Try again",
|
|
422
422
|
"file_delete_error": "Something went wrong with deleting file. Please try again",
|
|
423
423
|
"file_download_error": "Something went wrong with downloading file. Please try again",
|
|
424
|
+
"is_required": " is required",
|
|
424
425
|
"title_brand_logo": "Brand Logo",
|
|
425
426
|
"description_brand_logo": "JPG or PNG files up to 4mb."
|
|
426
427
|
}
|
package/build/constants/app.js
CHANGED
|
@@ -465,27 +465,33 @@ export var ENTITY_SCREENS_NAVIGATION = [
|
|
|
465
465
|
},
|
|
466
466
|
{
|
|
467
467
|
name: 'ENTITY_CAPITAL_STEP',
|
|
468
|
-
next: '
|
|
468
|
+
next: 'ENTITY_ADDRESS_STEP',
|
|
469
469
|
prev: 'ENTITY_NAME_STEP',
|
|
470
470
|
order: 3
|
|
471
471
|
},
|
|
472
|
+
{
|
|
473
|
+
name: 'ENTITY_ADDRESS_STEP',
|
|
474
|
+
next: 'ENTITY_DETAILS_SUCCESS_STEP',
|
|
475
|
+
prev: 'ENTITY_CAPITAL_STEP',
|
|
476
|
+
order: 4
|
|
477
|
+
},
|
|
472
478
|
{
|
|
473
479
|
name: 'ENTITY_DETAILS_SUCCESS_STEP',
|
|
474
480
|
next: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
475
481
|
prev: 'ENTITY_CAPITAL_STEP',
|
|
476
|
-
order:
|
|
482
|
+
order: 5
|
|
477
483
|
},
|
|
478
484
|
{
|
|
479
485
|
name: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
480
486
|
next: 'ENTITY_RESET_PASSWORD_SUCCESS',
|
|
481
487
|
prev: '',
|
|
482
|
-
order:
|
|
488
|
+
order: 6
|
|
483
489
|
},
|
|
484
490
|
{
|
|
485
491
|
name: 'ENTITY_RESET_PASSWORD_SUCCESS',
|
|
486
492
|
next: '',
|
|
487
493
|
prev: '',
|
|
488
|
-
order:
|
|
494
|
+
order: 7
|
|
489
495
|
}
|
|
490
496
|
];
|
|
491
497
|
export var BRAND_SCREENS_NAVIGATION = [
|
|
@@ -156,19 +156,20 @@ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (param
|
|
|
156
156
|
});
|
|
157
157
|
}); });
|
|
158
158
|
export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
-
var _a, settings, connect, _b, nid, dob,
|
|
159
|
+
var _a, settings, connect, _b, nid, dob, identification_id_type, requestBody, data;
|
|
160
160
|
return __generator(this, function (_c) {
|
|
161
161
|
switch (_c.label) {
|
|
162
162
|
case 0:
|
|
163
163
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
164
|
-
_b = connect.data.nidData, nid = _b.nid, dob = _b.dob
|
|
164
|
+
_b = connect.data.nidData, nid = _b.nid, dob = _b.dob;
|
|
165
|
+
identification_id_type = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
165
166
|
requestBody = {
|
|
166
167
|
country: settings.data.businessCountry.iso2,
|
|
167
168
|
scope: settings.data.appConfig.scope,
|
|
168
169
|
lang: settings.data.language,
|
|
169
170
|
user_credentail: {
|
|
170
171
|
identification_id: nid,
|
|
171
|
-
identification_id_type:
|
|
172
|
+
identification_id_type: identification_id_type,
|
|
172
173
|
date_of_birth: dob,
|
|
173
174
|
country_code: settings.data.businessCountry.iso2
|
|
174
175
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
2
|
+
import { ActionState, EntityAddressFormValues, EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
interface VerifyLeadTokenProps {
|
|
4
4
|
token: string;
|
|
5
5
|
isInternally?: boolean;
|
|
@@ -51,7 +51,12 @@ export declare const updateEntityName: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
51
51
|
export declare const updateEntityCapital: import("@reduxjs/toolkit").AsyncThunk<{
|
|
52
52
|
data: any;
|
|
53
53
|
formData: EntityCapitalFormValues;
|
|
54
|
+
addressFormat: any;
|
|
54
55
|
}, EntityCapitalFormValues, {}>;
|
|
56
|
+
export declare const updateEntityAddress: import("@reduxjs/toolkit").AsyncThunk<{
|
|
57
|
+
data: any;
|
|
58
|
+
formData: EntityAddressFormValues;
|
|
59
|
+
}, EntityAddressFormValues, {}>;
|
|
55
60
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
56
61
|
response: any;
|
|
57
62
|
formData: void;
|
|
@@ -64,6 +69,7 @@ export interface EntityData {
|
|
|
64
69
|
otpData: OTPFormValues & ResponseData;
|
|
65
70
|
entityNameData: EntityNameFormValues & ResponseData;
|
|
66
71
|
entityCapitalData: EntityCapitalFormValues & ResponseData;
|
|
72
|
+
entityAddressData: EntityAddressFormValues & ResponseData;
|
|
67
73
|
flowName: FlowsTypes;
|
|
68
74
|
}
|
|
69
75
|
export interface EntityState extends SharedState<EntityData> {
|
|
@@ -330,7 +330,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
330
330
|
});
|
|
331
331
|
}); });
|
|
332
332
|
export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
333
|
-
var _a, settings, entity, _b, id, data_status, isCapitalPaidNonEditable, isCapitalShareCountNonEditable, isCapitalShareValueNonEditable, isActivitiesNonEditable, hasCapitalShares, isCapitalNonEditable, activities, payload, data;
|
|
333
|
+
var _a, settings, entity, _b, id, data_status, isCapitalPaidNonEditable, isCapitalShareCountNonEditable, isCapitalShareValueNonEditable, isActivitiesNonEditable, hasCapitalShares, isCapitalNonEditable, activities, payload, data, list, workAddressFormat;
|
|
334
334
|
var _c, _d, _e, _f;
|
|
335
335
|
return __generator(this, function (_g) {
|
|
336
336
|
switch (_g.label) {
|
|
@@ -358,8 +358,34 @@ export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', f
|
|
|
358
358
|
return [4, API.entityService.updateEntity(payload)];
|
|
359
359
|
case 1:
|
|
360
360
|
data = _g.sent();
|
|
361
|
+
return [4, API.addressService.retrieveAddressFormat(settings.data.businessCountry.iso2)];
|
|
362
|
+
case 2:
|
|
363
|
+
list = (_g.sent()).list;
|
|
364
|
+
workAddressFormat = (list || []).find(function (address) { return address.type.code === 'work'; }).format;
|
|
361
365
|
thunkApi.dispatch(handleNextScreenStep());
|
|
362
366
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
367
|
+
return [2, { data: data, formData: params, addressFormat: workAddressFormat }];
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}); });
|
|
371
|
+
export var updateEntityAddress = createAsyncThunk('entityUpdateEntityAddress', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
372
|
+
var _a, settings, entity, _b, id, data_status, isAddressEditable, payload, data;
|
|
373
|
+
var _c, _d, _e;
|
|
374
|
+
return __generator(this, function (_f) {
|
|
375
|
+
switch (_f.label) {
|
|
376
|
+
case 0:
|
|
377
|
+
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
378
|
+
_b = ((_c = entity.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) || {}, id = _b.id, data_status = _b.data_status;
|
|
379
|
+
isAddressEditable = true;
|
|
380
|
+
payload = {
|
|
381
|
+
id: id,
|
|
382
|
+
billing_address: isAddressEditable ? params.billingAddress : undefined
|
|
383
|
+
};
|
|
384
|
+
return [4, API.entityService.updateEntity(payload)];
|
|
385
|
+
case 1:
|
|
386
|
+
data = _f.sent();
|
|
387
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
388
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, id);
|
|
363
389
|
return [2, { data: data, formData: params }];
|
|
364
390
|
}
|
|
365
391
|
});
|
|
@@ -423,6 +449,9 @@ var initialState = {
|
|
|
423
449
|
capitalPaid: '',
|
|
424
450
|
capitalShareCount: '',
|
|
425
451
|
capitalShareValue: ''
|
|
452
|
+
},
|
|
453
|
+
entityAddressData: {
|
|
454
|
+
billingAddress: {}
|
|
426
455
|
}
|
|
427
456
|
}
|
|
428
457
|
};
|
|
@@ -470,7 +499,7 @@ export var entitySlice = createSlice({
|
|
|
470
499
|
state.data.verify.token = token;
|
|
471
500
|
var _f = boardResponse || {}, entity = _f.entity, entityTypes = _f.entityTypes;
|
|
472
501
|
if (entity) {
|
|
473
|
-
var _g = entity || {}, license = _g.license, type = _g.type, capital = _g.capital, activities = _g.activities, legal_name = _g.legal_name;
|
|
502
|
+
var _g = entity || {}, license = _g.license, type = _g.type, capital = _g.capital, activities = _g.activities, legal_name = _g.legal_name, billing_address = _g.billing_address, country = _g.country;
|
|
474
503
|
var legalName = legal_name;
|
|
475
504
|
var licenseNumber = license === null || license === void 0 ? void 0 : license.number;
|
|
476
505
|
var unifiedNumber = (_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number;
|
|
@@ -509,6 +538,10 @@ export var entitySlice = createSlice({
|
|
|
509
538
|
state.data.entityCapitalData.capitalShareCount = shares === null || shares === void 0 ? void 0 : shares.count;
|
|
510
539
|
if (shares === null || shares === void 0 ? void 0 : shares.value)
|
|
511
540
|
state.data.entityCapitalData.capitalShareValue = shares === null || shares === void 0 ? void 0 : shares.value;
|
|
541
|
+
var billingAddress = { country: country };
|
|
542
|
+
if (billing_address)
|
|
543
|
+
billingAddress = __assign(__assign({}, billing_address), { country: (billing_address === null || billing_address === void 0 ? void 0 : billing_address.country) || country });
|
|
544
|
+
state.data.entityAddressData.billingAddress = billingAddress;
|
|
512
545
|
state.data.entityNameData.responseBody = __assign(__assign({}, state.data.entityNameData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id });
|
|
513
546
|
}
|
|
514
547
|
})
|
|
@@ -551,7 +584,7 @@ export var entitySlice = createSlice({
|
|
|
551
584
|
state.data.otpData.responseBody = data;
|
|
552
585
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
|
|
553
586
|
var _f = boardResponse || {}, entity = _f.entity, entityTypes = _f.entityTypes;
|
|
554
|
-
var _g = entity || {}, license = _g.license, type = _g.type, capital = _g.capital, activities = _g.activities, legal_name = _g.legal_name;
|
|
587
|
+
var _g = entity || {}, license = _g.license, type = _g.type, capital = _g.capital, activities = _g.activities, legal_name = _g.legal_name, billing_address = _g.billing_address, country = _g.country;
|
|
555
588
|
var legalName = legal_name;
|
|
556
589
|
var licenseNumber = license === null || license === void 0 ? void 0 : license.number;
|
|
557
590
|
var unifiedNumber = (_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number;
|
|
@@ -590,6 +623,10 @@ export var entitySlice = createSlice({
|
|
|
590
623
|
state.data.entityCapitalData.capitalShareCount = shares === null || shares === void 0 ? void 0 : shares.count;
|
|
591
624
|
if (shares === null || shares === void 0 ? void 0 : shares.value)
|
|
592
625
|
state.data.entityCapitalData.capitalShareValue = shares === null || shares === void 0 ? void 0 : shares.value;
|
|
626
|
+
var billingAddress = { country: country };
|
|
627
|
+
if (billing_address)
|
|
628
|
+
billingAddress = __assign(__assign({}, billing_address), { country: (billing_address === null || billing_address === void 0 ? void 0 : billing_address.country) || country });
|
|
629
|
+
state.data.entityAddressData.billingAddress = billingAddress;
|
|
593
630
|
state.data.entityNameData = __assign(__assign({}, state.data.entityNameData), { responseBody: __assign(__assign({}, state.data.entityNameData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id }) });
|
|
594
631
|
})
|
|
595
632
|
.addCase(verifyEntityLeadOTP.rejected, function (state, action) {
|
|
@@ -622,13 +659,29 @@ export var entitySlice = createSlice({
|
|
|
622
659
|
.addCase(updateEntityCapital.fulfilled, function (state, action) {
|
|
623
660
|
state.loading = false;
|
|
624
661
|
state.error = null;
|
|
625
|
-
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
662
|
+
var _a = action.payload, data = _a.data, formData = _a.formData, addressFormat = _a.addressFormat;
|
|
626
663
|
state.data.entityCapitalData = formData;
|
|
627
664
|
state.data.entityCapitalData.responseBody = __assign(__assign({}, state.data.entityCapitalData.responseBody), { data: data });
|
|
665
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { addressFormat: addressFormat });
|
|
628
666
|
})
|
|
629
667
|
.addCase(updateEntityCapital.rejected, function (state, action) {
|
|
630
668
|
state.loading = false;
|
|
631
669
|
state.error = action.error.message;
|
|
670
|
+
})
|
|
671
|
+
.addCase(updateEntityAddress.pending, function (state) {
|
|
672
|
+
state.loading = true;
|
|
673
|
+
state.error = null;
|
|
674
|
+
})
|
|
675
|
+
.addCase(updateEntityAddress.fulfilled, function (state, action) {
|
|
676
|
+
state.loading = false;
|
|
677
|
+
state.error = null;
|
|
678
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
679
|
+
state.data.entityAddressData = __assign(__assign({}, state.data.entityAddressData), formData);
|
|
680
|
+
state.data.entityAddressData.responseBody = __assign(__assign({}, state.data.entityAddressData.responseBody), { data: data });
|
|
681
|
+
})
|
|
682
|
+
.addCase(updateEntityAddress.rejected, function (state, action) {
|
|
683
|
+
state.loading = false;
|
|
684
|
+
state.error = action.error.message;
|
|
632
685
|
})
|
|
633
686
|
.addCase(retrieveBoardDetails.pending, function (state) {
|
|
634
687
|
state.error = null;
|
|
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
import { REGEX_WEBSITE,
|
|
10
|
+
import { REGEX_WEBSITE, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
|
|
11
11
|
import * as yup from 'yup';
|
|
12
12
|
var validationSalesChannels = function (channels) {
|
|
13
13
|
if (channels === void 0) { channels = []; }
|
|
@@ -42,16 +42,16 @@ var validationSalesChannels = function (channels) {
|
|
|
42
42
|
if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
|
|
43
43
|
return 'invalid_url';
|
|
44
44
|
}
|
|
45
|
-
if (key === 'linkedin' && value && !value.
|
|
45
|
+
if (key === 'linkedin' && value && !value.trim()) {
|
|
46
46
|
return 'invalid_linkedin_profile_url';
|
|
47
47
|
}
|
|
48
|
-
if (key === 'facebook' && value && !value.
|
|
48
|
+
if (key === 'facebook' && value && !value.trim()) {
|
|
49
49
|
return 'invalid_facebook_username';
|
|
50
50
|
}
|
|
51
|
-
if (key === 'instagram' && value && !value.
|
|
51
|
+
if (key === 'instagram' && value && !value.trim()) {
|
|
52
52
|
return 'invalid_instagram_username';
|
|
53
53
|
}
|
|
54
|
-
if (key === 'twitter' && value && !value.
|
|
54
|
+
if (key === 'twitter' && value && !value.trim()) {
|
|
55
55
|
return 'invalid_twitter_username';
|
|
56
56
|
}
|
|
57
57
|
if (key === 'physical_store' && value && value.length < 3) {
|
|
@@ -7,7 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
-
import { REGEX_WEBSITE,
|
|
10
|
+
import { REGEX_WEBSITE, DIGITS_ONLY, REGEX_ALPHANUMERIC } from '../../../../constants';
|
|
11
11
|
import * as yup from 'yup';
|
|
12
12
|
var validationSalesChannels = function (channels) {
|
|
13
13
|
if (channels === void 0) { channels = []; }
|
|
@@ -42,16 +42,16 @@ var validationSalesChannels = function (channels) {
|
|
|
42
42
|
if (key === 'website' && value && !value.match(REGEX_WEBSITE)) {
|
|
43
43
|
return 'invalid_url';
|
|
44
44
|
}
|
|
45
|
-
if (key === 'linkedin' && value && !value.
|
|
45
|
+
if (key === 'linkedin' && value && !value.trim()) {
|
|
46
46
|
return 'invalid_linkedin_profile_url';
|
|
47
47
|
}
|
|
48
|
-
if (key === 'facebook' && value && !value.
|
|
48
|
+
if (key === 'facebook' && value && !value.trim()) {
|
|
49
49
|
return 'invalid_facebook_username';
|
|
50
50
|
}
|
|
51
|
-
if (key === 'instagram' && value && !value.
|
|
51
|
+
if (key === 'instagram' && value && !value.trim()) {
|
|
52
52
|
return 'invalid_instagram_username';
|
|
53
53
|
}
|
|
54
|
-
if (key === 'twitter' && value && !value.
|
|
54
|
+
if (key === 'twitter' && value && !value.trim()) {
|
|
55
55
|
return 'invalid_twitter_username';
|
|
56
56
|
}
|
|
57
57
|
if (key === 'physical_store' && value && value.length < 3) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
15
|
+
import { entitySelector, updateEntityAddress } from '../../../app/entity/entityStore';
|
|
16
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
17
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
18
|
+
import Address from '../../../shared/Address';
|
|
19
|
+
var EntityAddress = function (_a) {
|
|
20
|
+
var settings = useAppSelector(settingsSelector).data;
|
|
21
|
+
var _b = useAppSelector(entitySelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
22
|
+
var t = useTranslation().t;
|
|
23
|
+
var dispatch = useAppDispatch();
|
|
24
|
+
var _c = data.verify.responseBody || {}, addressFormat = _c.addressFormat, entity = _c.entity;
|
|
25
|
+
var billingAddress = data.entityAddressData.billingAddress;
|
|
26
|
+
var isNonEditable = false;
|
|
27
|
+
var countries = settings.countries;
|
|
28
|
+
var onAddressChange = function (_a, isValid) {
|
|
29
|
+
var country = _a.country, address = __rest(_a, ["country"]);
|
|
30
|
+
if (isValid) {
|
|
31
|
+
var data_1 = {
|
|
32
|
+
billingAddress: address
|
|
33
|
+
};
|
|
34
|
+
dispatch(updateEntityAddress(data_1));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var onBack = function () {
|
|
38
|
+
dispatch(handlePrevScreenStep());
|
|
39
|
+
};
|
|
40
|
+
return (_jsx(ScreenContainer, { children: _jsx(Address, { defaultValues: billingAddress, countryList: countries, format: addressFormat || [], disableCountry: true, onAddressChange: onAddressChange, isEditable: !isNonEditable, showSubmitButton: true, loading: loading, error: t(error || ''), onBack: function () { return onBack(); } }) }));
|
|
41
|
+
};
|
|
42
|
+
export default EntityAddress;
|
|
@@ -33,7 +33,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
33
33
|
}); });
|
|
34
34
|
var EntityCapital = function (_a) {
|
|
35
35
|
var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
36
|
-
var _c = useAppSelector(entitySelector), data = _c.data, loading = _c.loading, error = _c.error
|
|
36
|
+
var _c = useAppSelector(entitySelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
37
37
|
var isAr = useLanguage().isAr;
|
|
38
38
|
var t = useTranslation().t;
|
|
39
39
|
var dispatch = useAppDispatch();
|
|
@@ -71,7 +71,7 @@ var EntityCapital = function (_a) {
|
|
|
71
71
|
var handleActivitiesOpenClose = function (flag) {
|
|
72
72
|
setAnchorEl(flag);
|
|
73
73
|
};
|
|
74
|
-
var disabled = !methods.formState.isValid || !!error
|
|
74
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
75
75
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivityList, { readOnly: readOnly['activities'] || noneEditable['activities'], onListOpen: function () { return handleActivitiesOpenClose(true); }, onListClose: function () { return handleActivitiesOpenClose(false); } }), _jsxs(Collapse, __assign({ in: !anchorEl }, { children: [_jsx(CapitalPaid, { readOnly: readOnly['capitalPaid'] || noneEditable['capital.paid'] }), _jsx(CapitalShareCount, { readOnly: readOnly['capitalShareCount'] || noneEditable['capital.shares.count'] }), _jsx(CapitalShareValue, { readOnly: readOnly['capitalShareValue'] || noneEditable['capital.shares.value'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
|
|
76
76
|
};
|
|
77
77
|
export default EntityCapital;
|
|
@@ -65,6 +65,7 @@ import SignInPasswordPage from './signIn/screens/Password';
|
|
|
65
65
|
import EntityVerifyPage from './entity/screens/Verify';
|
|
66
66
|
import EntityNamePage from './entity/screens/EntityName';
|
|
67
67
|
import EntityCapitalPage from './entity/screens/EntityCapital';
|
|
68
|
+
import EntityAddressPage from './entity/screens/EntityAddress';
|
|
68
69
|
import EntitySuccessPage from './entity/screens/Success';
|
|
69
70
|
import EntitySuccessWithFlowPage from './entity/screens/SuccessWithFlowButtons';
|
|
70
71
|
import EntityResetPasswordSuccessPage from './entity/screens/ResetPasswordSuccess';
|
|
@@ -344,6 +345,10 @@ export var entityFeatureScreens = [
|
|
|
344
345
|
name: 'ENTITY_CAPITAL_STEP',
|
|
345
346
|
element: EntityCapitalPage
|
|
346
347
|
},
|
|
348
|
+
{
|
|
349
|
+
name: 'ENTITY_ADDRESS_STEP',
|
|
350
|
+
element: EntityAddressPage
|
|
351
|
+
},
|
|
347
352
|
{
|
|
348
353
|
name: 'ENTITY_DETAILS_SUCCESS_STEP',
|
|
349
354
|
element: EntitySuccessPage
|
|
@@ -22,7 +22,7 @@ import InputText from './InputText';
|
|
|
22
22
|
import { Button } from '../Button';
|
|
23
23
|
export default function Address(_a) {
|
|
24
24
|
var format = _a.format, countryList = _a.countryList, onAddressChange = _a.onAddressChange, defaultValues = _a.defaultValues, disableCountry = _a.disableCountry, loading = _a.loading, error = _a.error, onBack = _a.onBack, showSubmitButton = _a.showSubmitButton, isEditable = _a.isEditable;
|
|
25
|
-
var _b = useForm({ defaultValues: defaultValues, mode: 'onChange' }), watch = _b.watch, control = _b.control, formState = _b.formState, getValues = _b.getValues;
|
|
25
|
+
var _b = useForm({ defaultValues: defaultValues, mode: 'onChange' }), watch = _b.watch, control = _b.control, formState = _b.formState, getValues = _b.getValues, handleSubmit = _b.handleSubmit;
|
|
26
26
|
var values = getValues();
|
|
27
27
|
var t = useTranslation().t;
|
|
28
28
|
var isAr = useLanguage().isAr;
|
|
@@ -32,42 +32,49 @@ export default function Address(_a) {
|
|
|
32
32
|
}, [values, formState.isValid]);
|
|
33
33
|
var countryIso2 = useMemo(function () {
|
|
34
34
|
var _a;
|
|
35
|
-
var index = countryList.findIndex(function (item) { return item.
|
|
35
|
+
var index = countryList.findIndex(function (item) { return item.iso2 === watch('country'); });
|
|
36
36
|
return (_a = countryList[index]) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
37
37
|
}, [watch('country')]);
|
|
38
|
-
|
|
38
|
+
var getName = function (item) {
|
|
39
|
+
return (isAr ? item.name.ar : item.name.en) || '';
|
|
40
|
+
};
|
|
41
|
+
var getRequiredValue = function (item) {
|
|
42
|
+
return "".concat(getName(item), " ").concat(t('is_required'));
|
|
43
|
+
};
|
|
44
|
+
var onSubmit = function (values) {
|
|
45
|
+
console.log(values);
|
|
46
|
+
onAddressChange(values, formState.isValid);
|
|
47
|
+
};
|
|
48
|
+
return (_jsxs(Box, __assign({ component: 'form', onSubmit: handleSubmit(onSubmit) }, { children: [format.map(function (item) {
|
|
39
49
|
var isCountry = item.code === 'country';
|
|
40
50
|
var isSelect = item.type === 'select';
|
|
41
51
|
if (isCountry) {
|
|
42
52
|
return (_jsx(Controller, { render: function (_a) {
|
|
43
53
|
var _b;
|
|
44
54
|
var field = _a.field, fieldState = _a.fieldState;
|
|
45
|
-
return (_jsx(CountryListComponent, { label:
|
|
55
|
+
return (_jsx(CountryListComponent, { label: getName(item), placeholder: getName(item), list: countryList, onSelect: function (value) {
|
|
46
56
|
console.log('value', value);
|
|
47
57
|
field.onChange(value);
|
|
48
58
|
}, value: field.value, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, disabled: isEditable ? !!disableCountry : false, isRequired: item.required }));
|
|
49
59
|
}, rules: {
|
|
50
|
-
required: item.required &&
|
|
60
|
+
required: item.required && getRequiredValue(item)
|
|
51
61
|
}, control: control, name: item.code }, item.code));
|
|
52
62
|
}
|
|
53
63
|
if (isSelect) {
|
|
54
64
|
return (_jsx(Controller, { render: function (_a) {
|
|
55
65
|
var _b;
|
|
56
66
|
var field = _a.field, fieldState = _a.fieldState;
|
|
57
|
-
return (_jsx(InputSelect, { label:
|
|
67
|
+
return (_jsx(InputSelect, { label: getName(item), placeholder: getName(item), countryIso2: countryIso2, fetchURL: item.retrieve_uri, onSelect: function (value) { return field.onChange(value); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, isRequired: item.required, value: field.value || '', disabled: isEditable ? !countryIso2 : false }));
|
|
58
68
|
}, rules: {
|
|
59
|
-
required: item.required &&
|
|
69
|
+
required: item.required && getRequiredValue(item)
|
|
60
70
|
}, control: control, name: item.code }, item.code));
|
|
61
71
|
}
|
|
62
72
|
return (_jsx(Controller, { render: function (_a) {
|
|
63
73
|
var _b;
|
|
64
74
|
var field = _a.field, fieldState = _a.fieldState;
|
|
65
|
-
return (_jsx(InputText, { label:
|
|
75
|
+
return (_jsx(InputText, { label: getName(item), placeholder: getName(item), onChange: function (value) { return field.onChange(value); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, isRequired: item.required, disabled: !isEditable, value: field.value || '' }));
|
|
66
76
|
}, rules: {
|
|
67
|
-
required: item.required &&
|
|
77
|
+
required: item.required && getRequiredValue(item)
|
|
68
78
|
}, control: control, name: item.code }, item.code));
|
|
69
|
-
}), _jsx(Collapse, __assign({ in: showSubmitButton }, { children: _jsx(Button, __assign({
|
|
70
|
-
e.preventDefault();
|
|
71
|
-
onAddressChange(values, formState.isValid);
|
|
72
|
-
}, onBackClicked: function () { return onBack === null || onBack === void 0 ? void 0 : onBack(); }, isAr: isAr, disabled: !formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })));
|
|
79
|
+
}), _jsx(Collapse, __assign({ in: showSubmitButton }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack === null || onBack === void 0 ? void 0 : onBack(); }, isAr: isAr, disabled: !formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })));
|
|
73
80
|
}
|
|
@@ -72,17 +72,17 @@ function CountryList(_a) {
|
|
|
72
72
|
};
|
|
73
73
|
var handleValueChange = function (value) {
|
|
74
74
|
setAnchorEl(null);
|
|
75
|
-
onSelect(value.
|
|
75
|
+
onSelect(value.iso2);
|
|
76
76
|
};
|
|
77
77
|
var nameValue = React.useMemo(function () {
|
|
78
|
-
var item = list.find(function (item) { return item.
|
|
78
|
+
var item = list.find(function (item) { return item.iso2 === value; });
|
|
79
79
|
if (!item)
|
|
80
80
|
return '';
|
|
81
81
|
return isAr ? item.name.arabic : item.name.english;
|
|
82
82
|
}, [isAr, list, value]);
|
|
83
83
|
return (_jsxs(Box, { children: [_jsx(LabelContainerStyled, { children: _jsxs(InputLabelStyled, { children: [t(label), " ", isRequired && _jsx(MandatoryStyled, { children: "*" })] }) }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: nameValue, placeholder: placeholder, onClick: handleListOpenClose, endAdornment: !disabled && _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchValuePath: ['name.english', 'name.arabic'], searchKeyPath: 'name.english', list: list, onSelectItem: handleValueChange, renderItem: function (item) {
|
|
84
84
|
var _a, _b;
|
|
85
|
-
var isChecked = item.
|
|
85
|
+
var isChecked = item.iso2 === value;
|
|
86
86
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: isChecked }, { children: isAr ? (_a = item.name) === null || _a === void 0 ? void 0 : _a.arabic : (_b = item.name) === null || _b === void 0 ? void 0 : _b.english })) })), isChecked && _jsx(CheckIconStyled, {})] }));
|
|
87
87
|
} }) })), _jsx(Collapse, __assign({ in: !!error && !anchorEl, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'hint' }, { children: t(error || '') })) }))] })] }));
|
|
88
88
|
}
|