@tap-payments/auth-jsconnect 2.4.11 → 2.4.12
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/app.d.ts +2 -1
- package/build/@types/form.d.ts +2 -0
- package/build/api/account.d.ts +1 -0
- package/build/api/entity.d.ts +14 -0
- package/build/api/entity.js +9 -1
- package/build/api/index.d.ts +3 -2
- package/build/app/settings.js +5 -5
- package/build/constants/app.d.ts +14 -0
- package/build/constants/app.js +14 -0
- package/build/constants/validation.d.ts +3 -0
- package/build/constants/validation.js +3 -0
- package/build/features/app/connectExpress/connectExpressStore.d.ts +19 -2
- package/build/features/app/connectExpress/connectExpressStore.js +60 -8
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +22 -5
- package/build/features/connectExpress/screens/AuthenticationList/EntityLegalName.d.ts +2 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityLegalName.js +48 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.d.ts +3 -3
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +49 -10
- package/build/features/connectExpress/screens/AuthenticationList/LicenseNumber.d.ts +3 -0
- package/build/features/connectExpress/screens/AuthenticationList/LicenseNumber.js +36 -0
- package/build/features/connectExpress/screens/AuthenticationList/MerchantList.js +26 -7
- package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +14 -1
- package/build/features/connectExpress/screens/AuthenticationList/validation.js +32 -7
- package/build/features/shared/Button/Button.js +8 -4
- package/build/utils/validation.d.ts +2 -0
- package/build/utils/validation.js +6 -0
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ export interface EntityLicense extends License {
|
|
|
117
117
|
id: string;
|
|
118
118
|
}
|
|
119
119
|
export interface EntityLicenseAuth extends EntityLicense {
|
|
120
|
-
|
|
120
|
+
business_id: string;
|
|
121
121
|
country: string;
|
|
122
122
|
}
|
|
123
123
|
export interface Activity {
|
|
@@ -295,6 +295,7 @@ export type BrandInfo = {
|
|
|
295
295
|
};
|
|
296
296
|
};
|
|
297
297
|
id: string;
|
|
298
|
+
business_id: string;
|
|
298
299
|
name: {
|
|
299
300
|
ar: string;
|
|
300
301
|
en: string;
|
package/build/@types/form.d.ts
CHANGED
package/build/api/account.d.ts
CHANGED
package/build/api/entity.d.ts
CHANGED
|
@@ -116,9 +116,22 @@ export type RemoveEntityActivity = {
|
|
|
116
116
|
};
|
|
117
117
|
export type MerchantListBody = {
|
|
118
118
|
business_entity_id: string;
|
|
119
|
+
brand_id: string;
|
|
119
120
|
create_if_not_present: boolean;
|
|
120
121
|
platforms?: Array<string>;
|
|
121
122
|
};
|
|
123
|
+
export type CreateEntityBody = {
|
|
124
|
+
business_id: string;
|
|
125
|
+
entity: {
|
|
126
|
+
legal_name: {
|
|
127
|
+
en: string;
|
|
128
|
+
ar: string;
|
|
129
|
+
};
|
|
130
|
+
license_number: string;
|
|
131
|
+
country: string;
|
|
132
|
+
is_licensed?: boolean;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
122
135
|
declare const entityService: {
|
|
123
136
|
createEntityInfo: ({ id, ...data }: EntityInfoBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
124
137
|
updateEntityInfo: ({ id, ...data }: EntityInfoBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -137,5 +150,6 @@ declare const entityService: {
|
|
|
137
150
|
getEntityListUsingIndividualId: (individualId: string) => Promise<any>;
|
|
138
151
|
getMerchantListUsingEntityId: (data: MerchantListBody) => Promise<any>;
|
|
139
152
|
getTerminalListUsingMerchantId: (merchantId: string) => Promise<any>;
|
|
153
|
+
createEntity: (data: CreateEntityBody) => Promise<any>;
|
|
140
154
|
};
|
|
141
155
|
export { entityService };
|
package/build/api/entity.js
CHANGED
|
@@ -122,6 +122,13 @@ var getTerminalListUsingMerchantId = function (merchantId) {
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
|
+
var createEntity = function (data) {
|
|
126
|
+
return httpClient({
|
|
127
|
+
method: 'post',
|
|
128
|
+
url: "".concat(ENDPOINT_PATHS.ENTITY),
|
|
129
|
+
data: data
|
|
130
|
+
});
|
|
131
|
+
};
|
|
125
132
|
var entityService = {
|
|
126
133
|
createEntityInfo: createEntityInfo,
|
|
127
134
|
updateEntityInfo: updateEntityInfo,
|
|
@@ -139,6 +146,7 @@ var entityService = {
|
|
|
139
146
|
removeEntityActivities: removeEntityActivities,
|
|
140
147
|
getEntityListUsingIndividualId: getEntityListUsingIndividualId,
|
|
141
148
|
getMerchantListUsingEntityId: getMerchantListUsingEntityId,
|
|
142
|
-
getTerminalListUsingMerchantId: getTerminalListUsingMerchantId
|
|
149
|
+
getTerminalListUsingMerchantId: getTerminalListUsingMerchantId,
|
|
150
|
+
createEntity: createEntity
|
|
143
151
|
};
|
|
144
152
|
export { entityService };
|
package/build/api/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ValidateOperatorBody, UpdateOperatorBody } from './operator';
|
|
|
3
3
|
import { CreateAuthBody, VerifyAuthBody, CreatePasswordBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, VerifyAuthExpressOTPBody } from './auth';
|
|
4
4
|
import { UpdateLeadBody, LeadVerifyBody, CreateLeadBody, LeadOTPVerifyBody, LeadIdentityUpdateBody, ExpressLeadVerifyBody } from './lead';
|
|
5
5
|
import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
|
|
6
|
-
import { EntityInfoBody, EntityBankUpdateBody, BankDocumentInfo, UpdateEntityBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, UpdateEntityAOAFileBody, RemoveEntityActivity, MerchantListBody } from './entity';
|
|
6
|
+
import { EntityInfoBody, EntityBankUpdateBody, BankDocumentInfo, UpdateEntityBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, UpdateEntityAOAFileBody, RemoveEntityActivity, MerchantListBody, CreateEntityBody } from './entity';
|
|
7
7
|
import { CreateAccountBody, ExpressCreateAccountBody } from './account';
|
|
8
8
|
import { DataElementBody } from './data';
|
|
9
9
|
import { BrandListBody, UpdateBrandBody, UpdateIndividualBody, GetIndividualListBody, UpdateIndividualWithTypeBody, UpdateMultipleIndividualBody } from './individual';
|
|
@@ -74,6 +74,7 @@ declare const API: {
|
|
|
74
74
|
getEntityListUsingIndividualId: (individualId: string) => Promise<any>;
|
|
75
75
|
getMerchantListUsingEntityId: (data: MerchantListBody) => Promise<any>;
|
|
76
76
|
getTerminalListUsingMerchantId: (merchantId: string) => Promise<any>;
|
|
77
|
+
createEntity: (data: CreateEntityBody) => Promise<any>;
|
|
77
78
|
};
|
|
78
79
|
availabilityServices: {
|
|
79
80
|
checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -173,6 +174,6 @@ declare const API: {
|
|
|
173
174
|
getInitialData: (body: InitBody) => Promise<any>;
|
|
174
175
|
};
|
|
175
176
|
};
|
|
176
|
-
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, InitBody, RemoveBrandActivity, RemoveEntityActivity, UpdateIndividualWithTypeBody, UpdateMultipleIndividualBody, ExpressLeadVerifyBody, UpdateOperatorBody, MerchantListBody };
|
|
177
|
+
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, InitBody, RemoveBrandActivity, RemoveEntityActivity, UpdateIndividualWithTypeBody, UpdateMultipleIndividualBody, ExpressLeadVerifyBody, UpdateOperatorBody, MerchantListBody, CreateEntityBody };
|
|
177
178
|
export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
|
|
178
179
|
export default API;
|
package/build/app/settings.js
CHANGED
|
@@ -53,7 +53,7 @@ import i18n from '../i18n';
|
|
|
53
53
|
import { updateLocale } from '../utils/locale';
|
|
54
54
|
import API, { getAxiosHeaders, 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, disableLocale, maturity, disableCountries, configToken, onVerifyConfigTokenSuccess, _c, visitorId, locale, configInfo, matureData, lang, initPayload, _d, country_list, ip_info, merchant, operator, config, list, _e, ip, latitude, longitude, country_code, domain, language_1, country, scope, public_key,
|
|
56
|
+
var settings, _a, appConfig, language, _b, client, device, os, disableLocale, maturity, disableCountries, configToken, onVerifyConfigTokenSuccess, _c, visitorId, locale, configInfo, matureData, lang, initPayload, _d, country_list, ip_info, merchant, operator, config, list, _e, ip, latitude, longitude, country_code, domain, language_1, country, scope, public_key, mature, board_maturity, post, platform_redirect_url, data, lead_id, platforms, deviceInfo, isValidOperator, countries, countryCode, businessCountry, ipCountry;
|
|
57
57
|
return __generator(this, function (_f) {
|
|
58
58
|
switch (_f.label) {
|
|
59
59
|
case 0:
|
|
@@ -81,10 +81,10 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
81
81
|
list = (country_list || { list: [] }).list;
|
|
82
82
|
_e = ip_info || {}, ip = _e.ip, latitude = _e.latitude, longitude = _e.longitude, country_code = _e.country_code;
|
|
83
83
|
if (config) {
|
|
84
|
-
domain = config.domain, language_1 = config.language, country = config.country, scope = config.scope, public_key = config.public_key,
|
|
84
|
+
domain = config.domain, language_1 = config.language, country = config.country, scope = config.scope, public_key = config.public_key, mature = config.maturity, board_maturity = config.board_maturity, post = config.post, platform_redirect_url = config.platform_redirect_url, data = config.data, lead_id = config.lead_id, platforms = config.platforms;
|
|
85
85
|
configInfo = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, configInfo), (domain && { merchantDomain: domain })), (language_1 && { language: language_1 })), (country && { businessCountryCode: country })), (scope && { scope: scope })), (public_key && { publicKey: public_key })), ((post === null || post === void 0 ? void 0 : post.url) && { postURL: post === null || post === void 0 ? void 0 : post.url })), (platform_redirect_url && { redirectUrl: platform_redirect_url })), (data && { data: data })), (lead_id && { leadId: lead_id })), (platforms && { platforms: platforms }));
|
|
86
|
-
if (typeof
|
|
87
|
-
matureData =
|
|
86
|
+
if (typeof mature === 'boolean')
|
|
87
|
+
matureData = mature ? 'full' : 'express';
|
|
88
88
|
thunkApi.dispatch(handleSetAppConfig(configInfo));
|
|
89
89
|
thunkApi.dispatch(handleLanguage(language_1 || lang));
|
|
90
90
|
if (public_key) {
|
|
@@ -96,7 +96,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
96
96
|
if (typeof board_maturity === 'boolean')
|
|
97
97
|
thunkApi.dispatch(handelBoardMaturity(board_maturity));
|
|
98
98
|
onVerifyConfigTokenSuccess === null || onVerifyConfigTokenSuccess === void 0 ? void 0 : onVerifyConfigTokenSuccess(config);
|
|
99
|
-
if (matureData === 'express' &&
|
|
99
|
+
if (matureData === 'express' && maturity !== matureData && typeof configInfo.onMaturityChanged === 'function') {
|
|
100
100
|
configInfo.onMaturityChanged(matureData);
|
|
101
101
|
}
|
|
102
102
|
}
|
package/build/constants/app.d.ts
CHANGED
|
@@ -244,3 +244,17 @@ export type FileInfo = {
|
|
|
244
244
|
error: string;
|
|
245
245
|
deleteStatus: DeleteFileStatus;
|
|
246
246
|
};
|
|
247
|
+
export declare const ADD_ENTITY = "add_entity";
|
|
248
|
+
export declare const ADD_NEW_ENTITY: {
|
|
249
|
+
id: string;
|
|
250
|
+
business_id: string;
|
|
251
|
+
country: string;
|
|
252
|
+
legal_name: {
|
|
253
|
+
ar: string;
|
|
254
|
+
en: string;
|
|
255
|
+
};
|
|
256
|
+
license: {
|
|
257
|
+
number: string;
|
|
258
|
+
};
|
|
259
|
+
type: string;
|
|
260
|
+
};
|
package/build/constants/app.js
CHANGED
|
@@ -805,3 +805,17 @@ export var DeleteFileStatus;
|
|
|
805
805
|
DeleteFileStatus["ERROR"] = "error";
|
|
806
806
|
DeleteFileStatus["SUCCESS"] = "success";
|
|
807
807
|
})(DeleteFileStatus || (DeleteFileStatus = {}));
|
|
808
|
+
export var ADD_ENTITY = 'add_entity';
|
|
809
|
+
export var ADD_NEW_ENTITY = {
|
|
810
|
+
id: ADD_ENTITY,
|
|
811
|
+
business_id: '',
|
|
812
|
+
country: '',
|
|
813
|
+
legal_name: {
|
|
814
|
+
ar: ADD_ENTITY,
|
|
815
|
+
en: ADD_ENTITY
|
|
816
|
+
},
|
|
817
|
+
license: {
|
|
818
|
+
number: ''
|
|
819
|
+
},
|
|
820
|
+
type: ''
|
|
821
|
+
};
|
|
@@ -5,6 +5,8 @@ export declare const VAT_ID_LENGTH = 15;
|
|
|
5
5
|
export declare const MAX_IBAN_VALUE = 34;
|
|
6
6
|
export declare const FL_NUMBER_MAX_LENGTH = 20;
|
|
7
7
|
export declare const CR_NUMBER_MAX_LENGTH = 20;
|
|
8
|
+
export declare const LICENSE_NUMBER_MAX_LENGTH = 20;
|
|
9
|
+
export declare const LICENSE_NUMBER_MIN_LENGTH = 5;
|
|
8
10
|
export declare const FL_NUMBER_ENTITY_LENGTH = 50;
|
|
9
11
|
export declare const FL_MIN_LICENSE_LENGTH = 5;
|
|
10
12
|
export declare const CR_MIN_LICENSE_LENGTH = 5;
|
|
@@ -21,6 +23,7 @@ export declare const REGEX_BENEFICIARY_NAME: RegExp;
|
|
|
21
23
|
export declare const REGEX_ALPHANUMERIC: RegExp;
|
|
22
24
|
export declare const REGEX_BRAND_NAME: RegExp;
|
|
23
25
|
export declare const EMAIL_MAX_LENGTH = 50;
|
|
26
|
+
export declare const REGEX_LEGAL_NAME: RegExp;
|
|
24
27
|
export declare const LINKEDIN_URL: RegExp;
|
|
25
28
|
export declare const SOCIAL_USERNAME: RegExp;
|
|
26
29
|
export declare const DIGITS_ONLY: RegExp;
|
|
@@ -5,6 +5,8 @@ export var VAT_ID_LENGTH = 15;
|
|
|
5
5
|
export var MAX_IBAN_VALUE = 34;
|
|
6
6
|
export var FL_NUMBER_MAX_LENGTH = 20;
|
|
7
7
|
export var CR_NUMBER_MAX_LENGTH = 20;
|
|
8
|
+
export var LICENSE_NUMBER_MAX_LENGTH = 20;
|
|
9
|
+
export var LICENSE_NUMBER_MIN_LENGTH = 5;
|
|
8
10
|
export var FL_NUMBER_ENTITY_LENGTH = 50;
|
|
9
11
|
export var FL_MIN_LICENSE_LENGTH = 5;
|
|
10
12
|
export var CR_MIN_LICENSE_LENGTH = 5;
|
|
@@ -21,6 +23,7 @@ export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa
|
|
|
21
23
|
export var REGEX_ALPHANUMERIC = /^[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/? ]*$/g;
|
|
22
24
|
export var REGEX_BRAND_NAME = /^(([a-zA-Z0-9])+\s)*[a-zA-Z0-9]+$/;
|
|
23
25
|
export var EMAIL_MAX_LENGTH = 50;
|
|
26
|
+
export var REGEX_LEGAL_NAME = /^([a-zA-Z0-9\s!@#$%^&*()_+-=,.<>?/|\\:;"'~`[\]{}]*)$/;
|
|
24
27
|
export var LINKEDIN_URL = /[a-zA-Z0-9-\/:._]+$/;
|
|
25
28
|
export var SOCIAL_USERNAME = /^[A-Za-z-0-9\d._]{3,}$/;
|
|
26
29
|
export var DIGITS_ONLY = /^\d+$/;
|
|
@@ -69,7 +69,10 @@ export declare const retrieveAuthenticationListAsync: import("@reduxjs/toolkit")
|
|
|
69
69
|
fulfilledMeta?: unknown;
|
|
70
70
|
rejectedMeta?: unknown;
|
|
71
71
|
}>;
|
|
72
|
-
export declare const getMerchantListAsync: import("@reduxjs/toolkit").AsyncThunk<any,
|
|
72
|
+
export declare const getMerchantListAsync: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
73
|
+
entityId: string;
|
|
74
|
+
brandId: string;
|
|
75
|
+
}, {
|
|
73
76
|
state?: unknown;
|
|
74
77
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
75
78
|
extra?: unknown;
|
|
@@ -287,6 +290,19 @@ export declare const createAccountAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
287
290
|
fulfilledMeta?: unknown;
|
|
288
291
|
rejectedMeta?: unknown;
|
|
289
292
|
}>;
|
|
293
|
+
export declare const createEntity: import("@reduxjs/toolkit").AsyncThunk<{
|
|
294
|
+
data: any;
|
|
295
|
+
formData: AuthenticationListFormValues;
|
|
296
|
+
}, AuthenticationListFormValues, {
|
|
297
|
+
state?: unknown;
|
|
298
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
299
|
+
extra?: unknown;
|
|
300
|
+
rejectValue?: unknown;
|
|
301
|
+
serializedErrorType?: unknown;
|
|
302
|
+
pendingMeta?: unknown;
|
|
303
|
+
fulfilledMeta?: unknown;
|
|
304
|
+
rejectedMeta?: unknown;
|
|
305
|
+
}>;
|
|
290
306
|
interface verifyPACIAsyncParams {
|
|
291
307
|
onSuccess: () => void;
|
|
292
308
|
}
|
|
@@ -372,11 +388,12 @@ export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectExpre
|
|
|
372
388
|
resetNIDScreen: (state: ConnectExpressState) => void;
|
|
373
389
|
setDefaultCountryCode: (state: ConnectExpressState, action: ActionState<CountryCode>) => void;
|
|
374
390
|
resetCivilScreen: (state: ConnectExpressState) => void;
|
|
391
|
+
resetAuthenticationScreen: (state: ConnectExpressState) => void;
|
|
375
392
|
resetOTPValue: (state: ConnectExpressState) => void;
|
|
376
393
|
resetStore: (state: ConnectExpressState) => void;
|
|
377
394
|
resetIndividualScreen: (state: ConnectExpressState) => void;
|
|
378
395
|
}, "connectExpress/store">;
|
|
379
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/clearError">, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/stopLoader">, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "connectExpress/store/setIsLeadIdPassed">, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, "connectExpress/store/resetMobileScreen">, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetOTPValue">, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetNIDScreen">, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetCivilScreen">, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetStore">, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "connectExpress/store/setError">, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "connectExpress/store/setLeadId">, setShowBoard: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "connectExpress/store/setShowBoard">, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetIndividualScreen">, setDefaultCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, "connectExpress/store/setDefaultCountryCode">, storeIsStartFromBusinessCountry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "connectExpress/store/storeIsStartFromBusinessCountry">;
|
|
396
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/clearError">, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/stopLoader">, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "connectExpress/store/setIsLeadIdPassed">, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, "connectExpress/store/resetMobileScreen">, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetOTPValue">, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetNIDScreen">, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetCivilScreen">, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetStore">, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "connectExpress/store/setError">, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "connectExpress/store/setLeadId">, setShowBoard: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "connectExpress/store/setShowBoard">, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetIndividualScreen">, setDefaultCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, "connectExpress/store/setDefaultCountryCode">, storeIsStartFromBusinessCountry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "connectExpress/store/storeIsStartFromBusinessCountry">, resetAuthenticationScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"connectExpress/store/resetAuthenticationScreen">;
|
|
380
397
|
declare const _default: import("redux").Reducer<ConnectExpressState, import("redux").AnyAction>;
|
|
381
398
|
export default _default;
|
|
382
399
|
export declare const connectExpressSelector: (state: RootState) => ConnectExpressState;
|
|
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
59
59
|
import { handleNextScreenStep, handleCurrentActiveScreen, handleOpen, handleSetCountryByIso2, onCloseComplete, storeAuthId } from '../../../app/settings';
|
|
60
60
|
import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@types';
|
|
61
61
|
import API from '../../../api';
|
|
62
|
-
import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
|
|
62
|
+
import { ADD_NEW_ENTITY, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
64
|
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA } from '../../../utils';
|
|
65
65
|
export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -213,14 +213,15 @@ export var retrieveAuthenticationListAsync = createAsyncThunk('connectExpress/re
|
|
|
213
213
|
});
|
|
214
214
|
});
|
|
215
215
|
});
|
|
216
|
-
export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantListAsync', function (
|
|
216
|
+
export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantListAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
217
|
var settings, payload, merchants;
|
|
218
218
|
return __generator(this, function (_a) {
|
|
219
219
|
switch (_a.label) {
|
|
220
220
|
case 0:
|
|
221
221
|
settings = thunkApi.getState().settings;
|
|
222
222
|
payload = {
|
|
223
|
-
business_entity_id: entityId,
|
|
223
|
+
business_entity_id: params.entityId,
|
|
224
|
+
brand_id: params.brandId,
|
|
224
225
|
create_if_not_present: true,
|
|
225
226
|
platforms: settings.data.appConfig.platforms
|
|
226
227
|
};
|
|
@@ -859,7 +860,8 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
|
|
|
859
860
|
_c = settings.data.appConfig, postURL = _c.postURL, scope = _c.scope;
|
|
860
861
|
body = {
|
|
861
862
|
lead_id: responseData === null || responseData === void 0 ? void 0 : responseData.leadData.id,
|
|
862
|
-
post_url: scope === SCOPE_AUTH ? '' : postURL || ''
|
|
863
|
+
post_url: scope === SCOPE_AUTH ? '' : postURL || '',
|
|
864
|
+
platforms: settings.data.appConfig.platforms
|
|
863
865
|
};
|
|
864
866
|
return [4, API.accountService.expressCreateAccount(body)];
|
|
865
867
|
case 1:
|
|
@@ -883,6 +885,33 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
|
|
|
883
885
|
}
|
|
884
886
|
});
|
|
885
887
|
}); });
|
|
888
|
+
export var createEntity = createAsyncThunk('connectExpress/createEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
889
|
+
var settings, brandInfo, legalName, licenseNumber, body, data;
|
|
890
|
+
var _a;
|
|
891
|
+
return __generator(this, function (_b) {
|
|
892
|
+
switch (_b.label) {
|
|
893
|
+
case 0:
|
|
894
|
+
settings = thunkApi.getState().settings;
|
|
895
|
+
brandInfo = params.brandInfo, legalName = params.legalName, licenseNumber = params.licenseNumber;
|
|
896
|
+
body = {
|
|
897
|
+
business_id: (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) || '',
|
|
898
|
+
entity: {
|
|
899
|
+
legal_name: {
|
|
900
|
+
en: legalName || '',
|
|
901
|
+
ar: legalName || ''
|
|
902
|
+
},
|
|
903
|
+
license_number: licenseNumber || '',
|
|
904
|
+
country: (_a = settings.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2,
|
|
905
|
+
is_licensed: undefined
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
return [4, API.entityService.createEntity(body)];
|
|
909
|
+
case 1:
|
|
910
|
+
data = _b.sent();
|
|
911
|
+
return [2, { data: data, formData: params }];
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
}); });
|
|
886
915
|
export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLeadIndividualAsync', function (_a, thunkApi) {
|
|
887
916
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
888
917
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -1104,6 +1133,9 @@ export var connectSlice = createSlice({
|
|
|
1104
1133
|
resetCivilScreen: function (state) {
|
|
1105
1134
|
state.data.civilIdData = __assign(__assign({}, state.data.civilIdData), initialState.data.civilIdData);
|
|
1106
1135
|
},
|
|
1136
|
+
resetAuthenticationScreen: function (state) {
|
|
1137
|
+
state.data.authenticationData = __assign(__assign({}, state.data.authenticationData), initialState.data.authenticationData);
|
|
1138
|
+
},
|
|
1107
1139
|
resetOTPValue: function (state) {
|
|
1108
1140
|
state.data.otpData.otp = '';
|
|
1109
1141
|
},
|
|
@@ -1403,11 +1435,10 @@ export var connectSlice = createSlice({
|
|
|
1403
1435
|
state.error = null;
|
|
1404
1436
|
state.loading = false;
|
|
1405
1437
|
var _a = action.payload, brandList = _a.brandList, entityList = _a.entityList;
|
|
1438
|
+
var eList = __spreadArray(__spreadArray([], entityList, true), [ADD_NEW_ENTITY], false);
|
|
1406
1439
|
if (brandList === null || brandList === void 0 ? void 0 : brandList.length)
|
|
1407
1440
|
state.data.authenticationData.brandInfo = brandList[0];
|
|
1408
|
-
|
|
1409
|
-
state.data.authenticationData.entityInfo = entityList[0];
|
|
1410
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { authenticationData: { brandList: brandList, entityList: entityList } });
|
|
1441
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authenticationData: { brandList: brandList, entityList: eList } });
|
|
1411
1442
|
})
|
|
1412
1443
|
.addCase(retrieveAuthenticationListAsync.pending, function (state) {
|
|
1413
1444
|
state.loading = true;
|
|
@@ -1542,9 +1573,30 @@ export var connectSlice = createSlice({
|
|
|
1542
1573
|
.addCase(updateBusinessCountryAsync.fulfilled, function (state) {
|
|
1543
1574
|
state.loading = false;
|
|
1544
1575
|
state.error = null;
|
|
1576
|
+
})
|
|
1577
|
+
.addCase(createEntity.pending, function (state) {
|
|
1578
|
+
state.loading = true;
|
|
1579
|
+
state.error = null;
|
|
1580
|
+
})
|
|
1581
|
+
.addCase(createEntity.rejected, function (state, action) {
|
|
1582
|
+
state.loading = false;
|
|
1583
|
+
state.error = action.error.message;
|
|
1584
|
+
})
|
|
1585
|
+
.addCase(createEntity.fulfilled, function (state, action) {
|
|
1586
|
+
state.loading = false;
|
|
1587
|
+
state.error = null;
|
|
1588
|
+
var data = action.payload.data;
|
|
1589
|
+
var authenticationData = (state.data.responseData || {}).authenticationData;
|
|
1590
|
+
var entityList = (authenticationData || {}).entityList;
|
|
1591
|
+
if (data === null || data === void 0 ? void 0 : data.entity) {
|
|
1592
|
+
var entity = __assign(__assign({}, data.entity), { business_id: data === null || data === void 0 ? void 0 : data.business_id });
|
|
1593
|
+
var list = __spreadArray([entity], entityList, true);
|
|
1594
|
+
state.data.authenticationData.entityInfo = list[0];
|
|
1595
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { entityData: data, authenticationData: __assign(__assign({}, authenticationData), { entityList: list }) });
|
|
1596
|
+
}
|
|
1545
1597
|
});
|
|
1546
1598
|
}
|
|
1547
1599
|
});
|
|
1548
|
-
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setLeadId = _a.setLeadId, setShowBoard = _a.setShowBoard, resetIndividualScreen = _a.resetIndividualScreen, setDefaultCountryCode = _a.setDefaultCountryCode, storeIsStartFromBusinessCountry = _a.storeIsStartFromBusinessCountry;
|
|
1600
|
+
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setLeadId = _a.setLeadId, setShowBoard = _a.setShowBoard, resetIndividualScreen = _a.resetIndividualScreen, setDefaultCountryCode = _a.setDefaultCountryCode, storeIsStartFromBusinessCountry = _a.storeIsStartFromBusinessCountry, resetAuthenticationScreen = _a.resetAuthenticationScreen;
|
|
1549
1601
|
export default connectSlice.reducer;
|
|
1550
1602
|
export var connectExpressSelector = function (state) { return state.connectExpress; };
|
|
@@ -22,12 +22,14 @@ import { AuthForType } from '../../../../@types';
|
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
24
|
import Button from '../../../shared/Button';
|
|
25
|
-
import { clearError, connectExpressSelector, updateOperatorInfoAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
25
|
+
import { clearError, connectExpressSelector, createEntity, resetAuthenticationScreen, updateOperatorInfoAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
26
26
|
import { useLanguage } from '../../../../hooks';
|
|
27
|
-
import { AuthenticationListValidationSchema } from './validation';
|
|
27
|
+
import { AddEntityValidationSchema, AuthenticationListValidationSchema } from './validation';
|
|
28
28
|
import BrandList from './BrandList';
|
|
29
29
|
import EntityList from './EntityList';
|
|
30
30
|
import MerchantList from './MerchantList';
|
|
31
|
+
import LicenseNumber from './LicenseNumber';
|
|
32
|
+
import EntityLegalName from './EntityLegalName';
|
|
31
33
|
var ListType;
|
|
32
34
|
(function (ListType) {
|
|
33
35
|
ListType["BrandList"] = "BrandList";
|
|
@@ -40,7 +42,8 @@ var AuthenticationList = function (_a) {
|
|
|
40
42
|
var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error, merchantLoading = _c.merchantLoading, terminalLoading = _c.terminalLoading;
|
|
41
43
|
var _d = data.authenticationData, brandInfo = _d.brandInfo, entityInfo = _d.entityInfo, merchantInfo = _d.merchantInfo;
|
|
42
44
|
var _e = React.useState(), listActive = _e[0], setListActive = _e[1];
|
|
43
|
-
var _f = ((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}, brandList = _f.brandList,
|
|
45
|
+
var _f = ((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}, brandList = _f.brandList, merchantList = _f.merchantList;
|
|
46
|
+
var _g = React.useState(false), isAddEntity = _g[0], setIsAddEntity = _g[1];
|
|
44
47
|
var otpData = data.otpData;
|
|
45
48
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
46
49
|
React.useEffect(function () {
|
|
@@ -51,7 +54,7 @@ var AuthenticationList = function (_a) {
|
|
|
51
54
|
});
|
|
52
55
|
}, []);
|
|
53
56
|
var methods = useForm({
|
|
54
|
-
resolver: yupResolver(AuthenticationListValidationSchema
|
|
57
|
+
resolver: yupResolver(isAddEntity ? AddEntityValidationSchema : AuthenticationListValidationSchema),
|
|
55
58
|
defaultValues: {
|
|
56
59
|
brandInfo: brandInfo,
|
|
57
60
|
entityInfo: entityInfo,
|
|
@@ -63,12 +66,25 @@ var AuthenticationList = function (_a) {
|
|
|
63
66
|
var isAr = useLanguage().isAr;
|
|
64
67
|
var dispatch = useAppDispatch();
|
|
65
68
|
var onSubmit = function (formData) {
|
|
69
|
+
if (isAddEntity) {
|
|
70
|
+
var data_1 = { licenseNumber: formData.licenseNumber, legalName: formData.legalName, brandInfo: formData.brandInfo };
|
|
71
|
+
dispatch(createEntity(deepCopy(data_1)));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
66
74
|
dispatch(updateOperatorInfoAsync(deepCopy(formData)));
|
|
67
75
|
};
|
|
68
76
|
var onBack = function () {
|
|
69
77
|
var _a;
|
|
78
|
+
if (isAddEntity) {
|
|
79
|
+
setIsAddEntity(false);
|
|
80
|
+
methods.setValue('licenseNumber', '');
|
|
81
|
+
methods.setValue('legalName', '');
|
|
82
|
+
methods.setValue('entityInfo', undefined, { shouldValidate: true });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
70
85
|
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
71
86
|
var screen = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
87
|
+
dispatch(resetAuthenticationScreen());
|
|
72
88
|
dispatch(handlePrevScreenStep(screen));
|
|
73
89
|
};
|
|
74
90
|
React.useEffect(function () {
|
|
@@ -88,6 +104,7 @@ var AuthenticationList = function (_a) {
|
|
|
88
104
|
var isBrandList = listActive === ListType.BrandList;
|
|
89
105
|
var isEntityList = listActive === ListType.EntityList;
|
|
90
106
|
var isMerchantList = listActive === ListType.MerchantList;
|
|
91
|
-
|
|
107
|
+
var showLoader = !(merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) ? merchantLoading : merchantList.length === 1 && merchantLoading;
|
|
108
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isAddEntity && !isEntityList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { countryList: settingsData.countries || [], show: !isBrandList && !isMerchantList, handleAddEntity: function (flag) { return setIsAddEntity(flag); }, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: isAddEntity && !isBrandList && !isEntityList }, { children: [_jsx(EntityLegalName, {}), _jsx(LicenseNumber, {})] })), _jsx(Collapse, __assign({ in: !isAddEntity }, { children: _jsx(MerchantList, { show: !isBrandList && !isEntityList, onListOpen: function () { return handleMenuClick(ListType.MerchantList); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading || showLoader }, { children: isAddEntity ? t('create_new_entity') : t('next') })) }))] })) })) }));
|
|
92
109
|
};
|
|
93
110
|
export default React.memo(AuthenticationList);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
18
|
+
import Input from '../../../shared/Input';
|
|
19
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
20
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
21
|
+
var theme = _a.theme;
|
|
22
|
+
return ({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
direction: theme.direction,
|
|
26
|
+
fontFamily: theme.typography.fontFamily,
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
paddingBlockEnd: theme.spacing(2.5)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var EntityLegalName = function () {
|
|
32
|
+
var _a;
|
|
33
|
+
var t = useTranslation().t;
|
|
34
|
+
var control = useFormContext().control;
|
|
35
|
+
var entityNameControl = useController({ control: control, name: 'legalName' });
|
|
36
|
+
var entityNameValue = entityNameControl.field.value;
|
|
37
|
+
var error = (_a = entityNameControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
38
|
+
var handleChange = function (_a) {
|
|
39
|
+
var target = _a.target;
|
|
40
|
+
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
41
|
+
entityNameControl.field.onChange(value);
|
|
42
|
+
};
|
|
43
|
+
var clearEntityLegalName = function () {
|
|
44
|
+
entityNameControl.field.onChange('');
|
|
45
|
+
};
|
|
46
|
+
return (_jsx(BoxStyled, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_name_label'), onChange: handleChange, required: true, value: entityNameValue || '', endAdornment: _jsx(EndAdornment, { value: entityNameValue, error: error, onClear: clearEntityLegalName }), placeholder: t('license_name_hint'), warningType: 'alert', warningMessage: error && t(error) }) })));
|
|
47
|
+
};
|
|
48
|
+
export default EntityLegalName;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CountryCode
|
|
2
|
+
import { CountryCode } from '../../../../@types';
|
|
3
3
|
interface EntityListProps {
|
|
4
4
|
show: boolean;
|
|
5
|
-
list: Array<EntityLicenseAuth>;
|
|
6
5
|
countryList: Array<CountryCode>;
|
|
7
6
|
onListOpen?: () => void;
|
|
8
7
|
onListClose?: () => void;
|
|
8
|
+
handleAddEntity?: (flag: boolean) => void;
|
|
9
9
|
}
|
|
10
|
-
declare const _default: React.MemoExoticComponent<({ show,
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ show, countryList, handleAddEntity, ...rest }: EntityListProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
export default _default;
|
|
@@ -20,13 +20,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
23
32
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
33
|
import * as React from 'react';
|
|
25
34
|
import { useTranslation } from 'react-i18next';
|
|
26
35
|
import { useFormContext, useController } from 'react-hook-form';
|
|
27
36
|
import Box from '@mui/material/Box';
|
|
28
37
|
import { styled } from '@mui/material/styles';
|
|
29
|
-
import { useLanguage } from '../../../../hooks';
|
|
38
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
30
39
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
31
40
|
import InputSelect from '../../../shared/InputSelect';
|
|
32
41
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
@@ -35,6 +44,8 @@ import Text from '../../../../components/Text';
|
|
|
35
44
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
36
45
|
import Collapse from '../../../../components/Collapse';
|
|
37
46
|
import Icon from '../../../../components/Icon';
|
|
47
|
+
import { connectExpressSelector } from '../../../../features/app/connectExpress/connectExpressStore';
|
|
48
|
+
import { ADD_ENTITY } from '../../../../constants';
|
|
38
49
|
var EntityContainer = styled(Box)(function () { return ({
|
|
39
50
|
display: 'flex',
|
|
40
51
|
alignItems: 'center'
|
|
@@ -51,13 +62,34 @@ var EntityNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
51
62
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
52
63
|
});
|
|
53
64
|
var EntityList = function (_a) {
|
|
54
|
-
var
|
|
55
|
-
var
|
|
65
|
+
var _b, _c;
|
|
66
|
+
var show = _a.show, countryList = _a.countryList, handleAddEntity = _a.handleAddEntity, rest = __rest(_a, ["show", "countryList", "handleAddEntity"]);
|
|
67
|
+
var _d = React.useState([]), list = _d[0], setList = _d[1];
|
|
68
|
+
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
56
69
|
var t = useTranslation().t;
|
|
57
70
|
var isAr = useLanguage().isAr;
|
|
58
|
-
var
|
|
71
|
+
var _f = useFormContext(), control = _f.control, watch = _f.watch, setValue = _f.setValue, getValues = _f.getValues;
|
|
72
|
+
var data = useAppSelector(connectExpressSelector).data;
|
|
73
|
+
var brandInfo = watch('brandInfo');
|
|
74
|
+
var entityList = ((_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) === null || _c === void 0 ? void 0 : _c.entityList) || [];
|
|
59
75
|
var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
|
|
60
|
-
|
|
76
|
+
React.useEffect(function () {
|
|
77
|
+
if (entityList.length > 0) {
|
|
78
|
+
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; });
|
|
79
|
+
var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false) || [];
|
|
80
|
+
setList(list_1);
|
|
81
|
+
if (filteredEntityList.length) {
|
|
82
|
+
setValue('entityInfo', filteredEntityList[0], { shouldValidate: true });
|
|
83
|
+
setValue('licenseNumber', '');
|
|
84
|
+
setValue('legalName', '');
|
|
85
|
+
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setValue('merchantInfo', undefined);
|
|
89
|
+
setValue('entityInfo', undefined);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, [entityList, brandInfo]);
|
|
61
93
|
var onOpenEntityList = function (event) {
|
|
62
94
|
var _a;
|
|
63
95
|
setAnchorEl(event.currentTarget);
|
|
@@ -72,7 +104,7 @@ var EntityList = function (_a) {
|
|
|
72
104
|
var _a, _b;
|
|
73
105
|
if (!entity)
|
|
74
106
|
return '';
|
|
75
|
-
return (isAr ? (_a = entity.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = entity.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
107
|
+
return (isAr ? t((_a = entity.legal_name) === null || _a === void 0 ? void 0 : _a.ar) : t((_b = entity.legal_name) === null || _b === void 0 ? void 0 : _b.en)) || '';
|
|
76
108
|
};
|
|
77
109
|
var getEntityId = function (entity) {
|
|
78
110
|
if (!entity)
|
|
@@ -85,12 +117,19 @@ var EntityList = function (_a) {
|
|
|
85
117
|
return '';
|
|
86
118
|
return ((_a = countryList.find(function (country) { return country.iso2.toLocaleLowerCase() === entity.country.toLocaleLowerCase(); })) === null || _a === void 0 ? void 0 : _a.logo) || '';
|
|
87
119
|
};
|
|
88
|
-
var onSelectItem = function (
|
|
89
|
-
selectedEntityControl.field.onChange(
|
|
120
|
+
var onSelectItem = function (entity) {
|
|
121
|
+
selectedEntityControl.field.onChange(entity);
|
|
122
|
+
if (entity.id === ADD_ENTITY) {
|
|
123
|
+
setValue('merchantInfo', undefined);
|
|
124
|
+
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(true);
|
|
125
|
+
}
|
|
126
|
+
else
|
|
127
|
+
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
|
|
90
128
|
onCloseEntityList();
|
|
91
129
|
};
|
|
92
|
-
|
|
93
|
-
|
|
130
|
+
var selectedEntity = selectedEntityControl.field.value;
|
|
131
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_entity_label'), onClick: !!anchorEl ? onCloseEntityList : onOpenEntityList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('select_entity_placeholder'), value: getLegalName(getValues('entityInfo')) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (entity) {
|
|
132
|
+
return (_jsxs(_Fragment, { children: [_jsxs(EntityContainer, { children: [(entity === null || entity === void 0 ? void 0 : entity.country) && _jsx(EntityCountryFlag, { src: getCountryFlag(entity) }), _jsx(EntityNameText, __assign({ isSelected: getEntityId(entity) === getEntityId(selectedEntity) }, { children: t(getLegalName(entity)) }))] }), getEntityId(entity) === getEntityId(selectedEntity) && _jsx(CheckIcon, {})] }));
|
|
94
133
|
} }) }))] })) })));
|
|
95
134
|
};
|
|
96
135
|
export default React.memo(EntityList);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
5
|
+
import { KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH, LICENSE_NUMBER_MAX_LENGTH, LICENSE_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
6
|
+
import { removeAllOtherThanCharsNumberSlashAndHyphen, isSA } from '../../../../utils';
|
|
7
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
8
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
9
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
10
|
+
import Input from '../../../shared/Input';
|
|
11
|
+
import { useAppSelector } from '../../../../hooks';
|
|
12
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
13
|
+
var LicenseNumber = function () {
|
|
14
|
+
var _a;
|
|
15
|
+
var t = useTranslation().t;
|
|
16
|
+
var control = useFormContext().control;
|
|
17
|
+
var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
|
|
18
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
19
|
+
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
20
|
+
var handleFLNumberChange = function (_a) {
|
|
21
|
+
var target = _a.target;
|
|
22
|
+
var value = removeAllOtherThanCharsNumberSlashAndHyphen(target.value);
|
|
23
|
+
licenseNumberControl.field.onChange(value);
|
|
24
|
+
};
|
|
25
|
+
var clearLicenseNumber = function () {
|
|
26
|
+
licenseNumberControl.field.onChange('');
|
|
27
|
+
};
|
|
28
|
+
var licenseNumberValue = licenseNumberControl.field.value;
|
|
29
|
+
var error = (_a = licenseNumberControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
30
|
+
var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : LICENSE_NUMBER_MAX_LENGTH;
|
|
31
|
+
var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : LICENSE_NUMBER_MIN_LENGTH;
|
|
32
|
+
var label = 'license_number';
|
|
33
|
+
var showCheckIcon = (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength;
|
|
34
|
+
return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t(label), required: true, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue || '', endAdornment: showCheckIcon ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: t('license_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }));
|
|
35
|
+
};
|
|
36
|
+
export default React.memo(LicenseNumber);
|
|
@@ -34,6 +34,8 @@ import InputSelect from '../../../shared/InputSelect';
|
|
|
34
34
|
import { getMerchantListAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
35
35
|
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
36
36
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
|
+
import { ADD_ENTITY } from '../../../../constants';
|
|
38
|
+
import { isNetworkError } from '../../../../utils';
|
|
37
39
|
var MerchantContainer = styled(Box)(function () { return ({
|
|
38
40
|
display: 'flex'
|
|
39
41
|
}); });
|
|
@@ -45,14 +47,16 @@ var MerchantList = React.forwardRef(function (_a, ref) {
|
|
|
45
47
|
var _b, _c;
|
|
46
48
|
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
47
49
|
var _d = React.useState([]), list = _d[0], setList = _d[1];
|
|
48
|
-
var _e = React.useState(
|
|
50
|
+
var _e = React.useState(0), count = _e[0], setCount = _e[1];
|
|
51
|
+
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
49
52
|
var t = useTranslation().t;
|
|
50
53
|
var dispatch = useAppDispatch();
|
|
51
|
-
var
|
|
52
|
-
var
|
|
54
|
+
var _g = useFormContext(), control = _g.control, watch = _g.watch, setValue = _g.setValue, getValues = _g.getValues;
|
|
55
|
+
var _h = useAppSelector(connectExpressSelector), data = _h.data, merchantLoading = _h.merchantLoading, bckError = _h.error;
|
|
53
56
|
var merchantList = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}).merchantList;
|
|
54
57
|
var merchantInfoControl = useController({ control: control, name: 'merchantInfo' });
|
|
55
58
|
var entityInfo = watch('entityInfo');
|
|
59
|
+
var brandInfo = getValues('brandInfo');
|
|
56
60
|
var merchantValue = merchantInfoControl.field.value;
|
|
57
61
|
var error = (_c = merchantInfoControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
58
62
|
React.useEffect(function () {
|
|
@@ -61,23 +65,38 @@ var MerchantList = React.forwardRef(function (_a, ref) {
|
|
|
61
65
|
setList(list_1);
|
|
62
66
|
}
|
|
63
67
|
}, [merchantList]);
|
|
68
|
+
React.useEffect(function () {
|
|
69
|
+
if (!bckError)
|
|
70
|
+
return;
|
|
71
|
+
if (!isNetworkError(bckError) || count > 2)
|
|
72
|
+
return;
|
|
73
|
+
if ((brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id) && (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id)) {
|
|
74
|
+
setCount(count + 1);
|
|
75
|
+
dispatch(getMerchantListAsync({ entityId: entityInfo.id, brandId: brandInfo.id }));
|
|
76
|
+
}
|
|
77
|
+
}, [bckError]);
|
|
64
78
|
React.useEffect(function () {
|
|
65
79
|
var _a;
|
|
66
80
|
if (!entityInfo)
|
|
67
81
|
return;
|
|
68
82
|
if (merchantLoading)
|
|
69
83
|
return;
|
|
84
|
+
var brandInfoId = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id;
|
|
70
85
|
var entityId = (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 0 ? (_a = merchantList[0]) === null || _a === void 0 ? void 0 : _a.business_entity_id : '';
|
|
71
86
|
var id = (entityInfo || {}).id;
|
|
72
|
-
if (!id)
|
|
87
|
+
if (!id || id === ADD_ENTITY)
|
|
73
88
|
return;
|
|
74
89
|
if (entityId && id && entityId !== id) {
|
|
75
90
|
setValue('merchantInfo', undefined);
|
|
76
|
-
dispatch(getMerchantListAsync(id));
|
|
91
|
+
dispatch(getMerchantListAsync({ entityId: id, brandId: brandInfoId }));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (entityId && id && entityId === id && (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length)) {
|
|
95
|
+
setValue('merchantInfo', merchantList[0], { shouldValidate: true });
|
|
77
96
|
return;
|
|
78
97
|
}
|
|
79
98
|
if (!(merchantList === null || merchantList === void 0 ? void 0 : merchantList.length)) {
|
|
80
|
-
dispatch(getMerchantListAsync(id));
|
|
99
|
+
dispatch(getMerchantListAsync({ entityId: id, brandId: brandInfoId }));
|
|
81
100
|
}
|
|
82
101
|
}, [entityInfo, merchantList]);
|
|
83
102
|
var onOpenMerchantSelect = function (event) {
|
|
@@ -100,7 +119,7 @@ var MerchantList = React.forwardRef(function (_a, ref) {
|
|
|
100
119
|
return '';
|
|
101
120
|
return merchant.display_name;
|
|
102
121
|
};
|
|
103
|
-
return (_jsx(Collapse, __assign({ in: show && (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 1 }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_merchant_label'), readOnly: readOnly, placeholder: t('select_merchant_placeholder'), value: getName(
|
|
122
|
+
return (_jsx(Collapse, __assign({ in: show && (merchantList === null || merchantList === void 0 ? void 0 : merchantList.length) > 1 }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_merchant_label'), readOnly: readOnly, placeholder: t('select_merchant_placeholder'), value: getName(getValues('merchantInfo')) || '', warningMessage: error && t(error), onClick: merchantLoading ? undefined : !!anchorEl ? function () { return onCloseMerchantSelect(); } : onOpenMerchantSelect, endAdornment: merchantLoading ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : (_jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified })) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { list: list || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
104
123
|
return (_jsxs(_Fragment, { children: [_jsx(MerchantContainer, { children: _jsx(MerchantNameText, __assign({ isSelected: item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) }, { children: getName(item) })) }), item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
105
124
|
} }) }))] })) })));
|
|
106
125
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare const AuthenticationListValidationSchema:
|
|
2
|
+
export declare const AuthenticationListValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
3
|
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
4
4
|
entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
5
5
|
merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
@@ -12,3 +12,16 @@ export declare const AuthenticationListValidationSchema: () => yup.ObjectSchema<
|
|
|
12
12
|
entityInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
13
13
|
merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
14
14
|
}>>>;
|
|
15
|
+
export declare const AddEntityValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
|
+
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
17
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
18
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
20
|
+
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
21
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
22
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
|
+
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
25
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
26
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
27
|
+
}>>>;
|
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { LICENSE_NUMBER_MIN_LENGTH, REGEX_LEGAL_NAME } from '../../../../constants';
|
|
3
|
+
export var AuthenticationListValidationSchema = yup.object().shape({
|
|
4
|
+
brandInfo: yup.object().required('auth_brand_required'),
|
|
5
|
+
entityInfo: yup.object().required('auth_entity_required'),
|
|
6
|
+
merchantInfo: yup.object().required('auth_merchant_required')
|
|
7
|
+
});
|
|
8
|
+
export var AddEntityValidationSchema = yup.object().shape({
|
|
9
|
+
brandInfo: yup.object().required('auth_brand_required'),
|
|
10
|
+
licenseNumber: yup
|
|
11
|
+
.string()
|
|
12
|
+
.test({
|
|
13
|
+
test: function (value) {
|
|
14
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
15
|
+
if (length === 0)
|
|
16
|
+
return true;
|
|
17
|
+
return length >= LICENSE_NUMBER_MIN_LENGTH ? true : this.createError({ message: 'enter_license_number' });
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
.required(''),
|
|
21
|
+
legalName: yup
|
|
22
|
+
.string()
|
|
23
|
+
.required('')
|
|
24
|
+
.test({
|
|
25
|
+
test: function (value) {
|
|
26
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
27
|
+
if (length === 0)
|
|
28
|
+
return true;
|
|
29
|
+
return (value === null || value === void 0 ? void 0 : value.match(REGEX_LEGAL_NAME)) && length >= 3 ? true : this.createError({ message: 'enter_valid_legal_name' });
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.required('')
|
|
33
|
+
});
|
|
@@ -94,10 +94,14 @@ export default function CustomButton(_a) {
|
|
|
94
94
|
setBtnLoading(false);
|
|
95
95
|
}, [loading, error]);
|
|
96
96
|
React.useEffect(function () {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
if (loading)
|
|
98
|
+
return;
|
|
99
|
+
var timeout = setTimeout(function () {
|
|
100
|
+
setBtnLoading(false);
|
|
101
|
+
}, 1000);
|
|
102
|
+
return function () {
|
|
103
|
+
clearTimeout(timeout);
|
|
104
|
+
};
|
|
101
105
|
}, [loading]);
|
|
102
106
|
React.useEffect(function () {
|
|
103
107
|
setBtnLoading(false);
|
|
@@ -6,6 +6,8 @@ export declare const removeAllOtherThanAlphabetAndSpace: (str: string) => string
|
|
|
6
6
|
export declare const removeAllNumberFromChars: (str: string) => string;
|
|
7
7
|
export declare const keepEmailCharacters: (str: string) => string;
|
|
8
8
|
export declare const removeAllOtherThanCharsAndNumber: (str: string) => string;
|
|
9
|
+
export declare const removeAllOtherThanCharsNumberSlashAndHyphen: (str: string) => string;
|
|
10
|
+
export declare const removeAllOtherThanCharsNumbersAtAndDot: (str: string) => string;
|
|
9
11
|
export declare const removeAllOtherThanCharsNumbersAndSpace: (str: string) => string;
|
|
10
12
|
export declare function PasswordMatchLength(password: string): boolean;
|
|
11
13
|
export declare function isPasswordHasUpperLetter(password: string): boolean;
|
|
@@ -22,6 +22,12 @@ export var keepEmailCharacters = function (str) {
|
|
|
22
22
|
export var removeAllOtherThanCharsAndNumber = function (str) {
|
|
23
23
|
return str.replace(/[^A-Za-z0-9]/g, '');
|
|
24
24
|
};
|
|
25
|
+
export var removeAllOtherThanCharsNumberSlashAndHyphen = function (str) {
|
|
26
|
+
return str.replace(/[^A-Za-z0-9/-]/g, '');
|
|
27
|
+
};
|
|
28
|
+
export var removeAllOtherThanCharsNumbersAtAndDot = function (str) {
|
|
29
|
+
return str.replace(/[^A-Za-z0-9@.]/g, '');
|
|
30
|
+
};
|
|
25
31
|
export var removeAllOtherThanCharsNumbersAndSpace = function (str) {
|
|
26
32
|
return str.replace(/[^A-Za-z0-9 ]/g, '');
|
|
27
33
|
};
|