@tap-payments/auth-jsconnect 2.1.30-test → 2.1.31-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.
Files changed (21) hide show
  1. package/build/@types/form.d.ts +8 -0
  2. package/build/api/individual.d.ts +1 -0
  3. package/build/features/app/individual/individualStore.d.ts +15 -1
  4. package/build/features/app/individual/individualStore.js +103 -14
  5. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -2
  6. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +7 -2
  7. package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -2
  8. package/build/features/business/screens/Customers/ExpectedSalesRange.js +7 -2
  9. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -2
  10. package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -2
  11. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +8 -17
  12. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.d.ts +3 -0
  13. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +67 -0
  14. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.d.ts +6 -0
  15. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +78 -0
  16. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +12 -0
  17. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +27 -0
  18. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -2
  19. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -2
  20. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -2
  21. package/package.json +129 -129
@@ -89,6 +89,14 @@ export declare type IndividualExtraFormValues = {
89
89
  isPEP: boolean | null;
90
90
  isInfluencer: boolean | null;
91
91
  };
92
+ export declare type IndividualAttachmentsFormValues = {
93
+ civilID?: string;
94
+ civilIDFile?: Array<File>;
95
+ signatureFileId?: string;
96
+ signatureFile?: Array<File>;
97
+ civilIDUploading?: boolean;
98
+ signatureFileUploading?: boolean;
99
+ };
92
100
  export declare type PasswordCreateFormValues = {
93
101
  password: string;
94
102
  confirmPassword: string;
@@ -79,6 +79,7 @@ export declare type UpdateIndividualBody = {
79
79
  };
80
80
  is_relative_PEP?: boolean | null;
81
81
  is_influencer?: boolean | null;
82
+ documents?: Array<string | undefined>;
82
83
  occupation?: {
83
84
  id?: string;
84
85
  };
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { CountryCode, FlowsTypes, IndividualAttachmentsFormValues, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  boardResponse: {
@@ -8,6 +8,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
8
8
  bank_account: any;
9
9
  entity: any;
10
10
  merchant: any;
11
+ merchant_id: any;
11
12
  name: any;
12
13
  contact: any;
13
14
  countries: CountryCode[];
@@ -40,6 +41,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
40
41
  bank_account: any;
41
42
  entity: any;
42
43
  merchant: any;
44
+ merchant_id: any;
43
45
  name: any;
44
46
  contact: any;
45
47
  countries: CountryCode[];
@@ -59,6 +61,17 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
59
61
  data: any;
60
62
  formData: IndividualExtraFormValues;
61
63
  }, IndividualExtraFormValues, {}>;
64
+ interface UploadFileParams {
65
+ file: File;
66
+ onProgress?: (value: number) => void;
67
+ title?: string;
68
+ }
69
+ export declare const uploadCivilIdFile: import("@reduxjs/toolkit").AsyncThunk<{
70
+ data: any;
71
+ }, UploadFileParams, {}>;
72
+ export declare const uploadSignatureFile: import("@reduxjs/toolkit").AsyncThunk<{
73
+ data: any;
74
+ }, UploadFileParams, {}>;
62
75
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
63
76
  response: any;
64
77
  formData: void;
@@ -70,6 +83,7 @@ export interface IndividualData {
70
83
  verify: ResponseData & VerifyData;
71
84
  otpData: OTPFormValues & ResponseData;
72
85
  individualData: IndividualExtraFormValues & ResponseData;
86
+ attachmentsData: IndividualAttachmentsFormValues & ResponseData;
73
87
  flowName: FlowsTypes;
74
88
  }
75
89
  export interface IndividualState extends SharedState<IndividualData> {
@@ -123,6 +123,7 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
123
123
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
124
124
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
125
125
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
126
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
126
127
  name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
127
128
  contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
128
129
  countries: countries,
@@ -260,6 +261,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
260
261
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
261
262
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
262
263
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
264
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
263
265
  name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
264
266
  contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
265
267
  countries: countries,
@@ -273,37 +275,92 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
273
275
  });
274
276
  }); });
275
277
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
276
- var _a, settings, individual, _b, id, type, requestBody, data;
277
- var _c, _d, _e, _f, _g, _h, _j, _k;
278
- return __generator(this, function (_l) {
279
- switch (_l.label) {
278
+ var _a, settings, individual, _b, id, type, _c, civilID, signatureFileId, documentBody, requestBody, data;
279
+ var _d, _e, _f, _g, _h, _j, _k, _l;
280
+ return __generator(this, function (_m) {
281
+ switch (_m.label) {
280
282
  case 0:
281
283
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
282
- _b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
284
+ _b = ((_e = (_d = individual.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id = _b.id, type = _b.type;
285
+ _c = individual.data.attachmentsData, civilID = _c.civilID, signatureFileId = _c.signatureFileId;
286
+ documentBody = [];
287
+ if (!!civilID)
288
+ documentBody.push(civilID);
289
+ if (!!signatureFileId)
290
+ documentBody.push(signatureFileId);
283
291
  requestBody = {
284
292
  id: id,
285
293
  type: type,
286
- occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
294
+ occupation: { id: (_f = params.occupation) === null || _f === void 0 ? void 0 : _f.id },
287
295
  employer_name: params.employerName,
288
- employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
289
- source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
290
- monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
296
+ employer_country: (_g = params.employerLocation) === null || _g === void 0 ? void 0 : _g.iso2,
297
+ source_income: [{ id: (_h = params.sourceIncome) === null || _h === void 0 ? void 0 : _h.id }],
298
+ monthly_income: { id: (_j = params.monthlyIncome) === null || _j === void 0 ? void 0 : _j.id },
291
299
  is_relative_PEP: params.isPEP,
292
300
  is_influencer: params.isInfluencer,
301
+ documents: documentBody,
293
302
  encryption_contract: ['employer_name', 'employer_country'],
294
303
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
295
304
  };
296
305
  return [4, API.individualService.updateIndividual(requestBody)];
297
306
  case 1:
298
- data = (_l.sent()).data;
299
- if (!(data === null || data === void 0 ? void 0 : data.errors)) {
300
- thunkApi.dispatch(handleNextScreenStep());
301
- (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
302
- }
307
+ data = (_m.sent()).data;
308
+ thunkApi.dispatch(handleNextScreenStep());
309
+ (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, requestBody);
303
310
  return [2, { data: data, formData: params }];
304
311
  }
305
312
  });
306
313
  }); });
314
+ export var uploadCivilIdFile = createAsyncThunk('uploadCivilIdFile', function (_a) {
315
+ var file = _a.file, onProgress = _a.onProgress, title = _a.title;
316
+ return __awaiter(void 0, void 0, void 0, function () {
317
+ var uploadPayload, onUploadProgress, data;
318
+ return __generator(this, function (_b) {
319
+ switch (_b.label) {
320
+ case 0:
321
+ uploadPayload = {
322
+ file_link_create: false,
323
+ title: title,
324
+ purpose: 'identity_document',
325
+ file: file
326
+ };
327
+ onUploadProgress = function (progressEvent) {
328
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
329
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
330
+ };
331
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
332
+ case 1:
333
+ data = _b.sent();
334
+ return [2, { data: data }];
335
+ }
336
+ });
337
+ });
338
+ });
339
+ export var uploadSignatureFile = createAsyncThunk('uploadSignatureFile', function (_a) {
340
+ var file = _a.file, onProgress = _a.onProgress;
341
+ return __awaiter(void 0, void 0, void 0, function () {
342
+ var uploadPayload, onUploadProgress, data;
343
+ return __generator(this, function (_b) {
344
+ switch (_b.label) {
345
+ case 0:
346
+ uploadPayload = {
347
+ file_link_create: false,
348
+ title: 'Merchant Signature',
349
+ purpose: 'customer_signature',
350
+ file: file
351
+ };
352
+ onUploadProgress = function (progressEvent) {
353
+ var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
354
+ onProgress === null || onProgress === void 0 ? void 0 : onProgress(Math.floor(progress));
355
+ };
356
+ return [4, API.entityService.uploadFileInfo(uploadPayload, { onUploadProgress: onUploadProgress })];
357
+ case 1:
358
+ data = _b.sent();
359
+ return [2, { data: data }];
360
+ }
361
+ });
362
+ });
363
+ });
307
364
  export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
308
365
  var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
309
366
  var _c, _d, _e, _f;
@@ -354,6 +411,10 @@ var initialState = {
354
411
  employerLocation: undefined,
355
412
  isPEP: null,
356
413
  isInfluencer: null
414
+ },
415
+ attachmentsData: {
416
+ civilIDUploading: false,
417
+ signatureFileUploading: false
357
418
  }
358
419
  }
359
420
  };
@@ -511,6 +572,34 @@ export var individualSlice = createSlice({
511
572
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
512
573
  state.error = action.error.message;
513
574
  state.loading = false;
575
+ })
576
+ .addCase(uploadCivilIdFile.pending, function (state) {
577
+ state.error = null;
578
+ state.data.attachmentsData.civilIDUploading = true;
579
+ })
580
+ .addCase(uploadCivilIdFile.fulfilled, function (state, action) {
581
+ state.error = null;
582
+ state.data.attachmentsData.civilIDUploading = false;
583
+ var data = action.payload.data;
584
+ state.data.attachmentsData.civilID = data === null || data === void 0 ? void 0 : data.id;
585
+ })
586
+ .addCase(uploadCivilIdFile.rejected, function (state) {
587
+ state.data.attachmentsData.civilIDUploading = false;
588
+ state.error = 'file_upload_error';
589
+ })
590
+ .addCase(uploadSignatureFile.pending, function (state) {
591
+ state.error = null;
592
+ state.data.attachmentsData.signatureFileUploading = true;
593
+ })
594
+ .addCase(uploadSignatureFile.fulfilled, function (state, action) {
595
+ state.error = null;
596
+ state.data.attachmentsData.signatureFileUploading = false;
597
+ var data = action.payload.data;
598
+ state.data.attachmentsData.signatureFileId = data === null || data === void 0 ? void 0 : data.id;
599
+ })
600
+ .addCase(uploadSignatureFile.rejected, function (state) {
601
+ state.data.attachmentsData.signatureFileUploading = false;
602
+ state.error = 'file_upload_error';
514
603
  })
515
604
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
516
605
  var _a;
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { Trans, useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { bankSelector } from '../../../../features/app/bank/bankStore';
6
+ import { maskEmail } from '../../../../utils';
7
+ import { useAppSelector } from '../../../../hooks';
5
8
  var ResetPasswordSuccess = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(bankSelector).data;
12
+ var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
13
+ var maskedEmail = maskEmail(email);
14
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
8
15
  };
9
16
  export default React.memo(ResetPasswordSuccess);
@@ -20,10 +20,11 @@ import SimpleList from '../../../../components/SimpleList';
20
20
  import Collapse from '../../../../components/Collapse';
21
21
  import ExpandIcon from '../../../../components/ExpandIcon';
22
22
  import { brandSelector, clearError } from '../../../app/brand/brandStore';
23
- import { isExist } from '../../../../utils';
23
+ import { findCurrencyByIso2, isExist } from '../../../../utils';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
25
25
  import { InputLabelStyled, CheckIconStyled, InputStyled, NameContainer } from './CustomerBase';
26
26
  import Search from '../../../../features/shared/Search';
27
+ import { settingsSelector } from '../../../../app/settings';
27
28
  var ListItem = styled(Box)(function (_a) {
28
29
  var theme = _a.theme;
29
30
  return ({
@@ -55,9 +56,11 @@ var ExpectedSalesRange = function (_a) {
55
56
  var dispatch = useAppDispatch();
56
57
  var expectedSaleControl = useController({ name: 'expectedSale', control: control });
57
58
  var _e = useAppSelector(brandSelector), data = _e.data, error = _e.error;
59
+ var settingsData = useAppSelector(settingsSelector).data;
58
60
  var brandActivities = data.brandActivities;
59
61
  var expectedSales = (brandActivities.responseBody || {}).expectedSales;
60
62
  var expectedSalesRangeValue = expectedSaleControl.field.value;
63
+ var countryCode = settingsData.businessCountry;
61
64
  var handleOpenMainMenu = function (event) {
62
65
  setAnchorEl(event.currentTarget);
63
66
  onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
@@ -109,7 +112,9 @@ var ExpectedSalesRange = function (_a) {
109
112
  if (item)
110
113
  setSubIndex(item.id);
111
114
  }, [anchorEl, expectedSalesRangeValue]);
112
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_yearly') }), _jsx(InputStyled, { readOnly: true, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
115
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
116
+ currency: findCurrencyByIso2(countryCode.iso2)
117
+ }) }), _jsx(InputStyled, { readOnly: true, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
113
118
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
114
119
  if (isOnlyOneItem)
115
120
  onSelectItem(item);
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { Trans, useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { useAppSelector } from '../../../../hooks';
6
+ import { maskEmail } from '../../../../utils';
7
+ import { brandSelector } from '../../../../features/app/brand/brandStore';
5
8
  var ResetPasswordSuccess = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(brandSelector).data;
12
+ var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
13
+ var maskedEmail = maskEmail(email);
14
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
8
15
  };
9
16
  export default React.memo(ResetPasswordSuccess);
@@ -20,10 +20,11 @@ import SimpleList from '../../../../components/SimpleList';
20
20
  import Collapse from '../../../../components/Collapse';
21
21
  import ExpandIcon from '../../../../components/ExpandIcon';
22
22
  import { businessSelector, clearError } from '../../../app/business/businessStore';
23
- import { isExist } from '../../../../utils';
23
+ import { findCurrencyByIso2, isExist } from '../../../../utils';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
25
25
  import { InputLabelStyled, CheckIconStyled, InputStyled, NameContainer } from './CustomerLocations';
26
26
  import Search from '../../../../features/shared/Search';
27
+ import { settingsSelector } from '../../../../app/settings';
27
28
  var ListItem = styled(Box)(function (_a) {
28
29
  var theme = _a.theme;
29
30
  return ({
@@ -55,9 +56,11 @@ var ExpectedSalesRange = function (_a) {
55
56
  var dispatch = useAppDispatch();
56
57
  var expectedSaleControl = useController({ name: 'expectedSale', control: control });
57
58
  var _e = useAppSelector(businessSelector), data = _e.data, error = _e.error;
59
+ var settingsData = useAppSelector(settingsSelector).data;
58
60
  var activitiesData = data.activitiesData;
59
61
  var expectedSales = (activitiesData.responseBody || {}).expectedSales;
60
62
  var expectedSalesRangeValue = expectedSaleControl.field.value;
63
+ var countryCode = settingsData.businessCountry;
61
64
  var handleOpenMainMenu = function (event) {
62
65
  setAnchorEl(event.currentTarget);
63
66
  onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
@@ -109,7 +112,9 @@ var ExpectedSalesRange = function (_a) {
109
112
  if (item)
110
113
  setSubIndex(item.id);
111
114
  }, [anchorEl, expectedSalesRangeValue]);
112
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_yearly') }), _jsx(InputStyled, { readOnly: true, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
115
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
116
+ currency: findCurrencyByIso2(countryCode.iso2)
117
+ }) }), _jsx(InputStyled, { readOnly: true, value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
113
118
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
114
119
  if (isOnlyOneItem)
115
120
  onSelectItem(item);
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { useTranslation, Trans } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { businessSelector } from '../../../app/business/businessStore';
6
+ import { useAppSelector } from '../../../../hooks';
7
+ import { maskEmail } from '../../../../utils';
5
8
  var ResetPasswordSuccess = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(businessSelector).data;
12
+ var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
13
+ var maskedEmail = maskEmail(email);
14
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
8
15
  };
9
16
  export default React.memo(ResetPasswordSuccess);
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { Trans, useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { maskEmail } from '../../../../utils';
6
+ import { entitySelector } from '../../../../features/app/entity/entityStore';
7
+ import { useAppSelector } from '../../../../hooks';
5
8
  var ResetPasswordSuccess = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(entitySelector).data;
12
+ var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
13
+ var maskedEmail = maskEmail(email);
14
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
8
15
  };
9
16
  export default React.memo(ResetPasswordSuccess);
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { yupResolver } from '@hookform/resolvers/yup';
@@ -42,6 +31,8 @@ import EmployerLocation from './EmployerLocation';
42
31
  import SourceOfIncome from './SourceOfIncome';
43
32
  import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
44
33
  import Occupation from './Occupation';
34
+ import CivilIDFile from './CivilIDFile';
35
+ import SignatureFile from './SignatureFile';
45
36
  var ListType;
46
37
  (function (ListType) {
47
38
  ListType["SourceOfIncomeList"] = "SourceOfIncomeList";
@@ -56,15 +47,15 @@ var AdditionalIndividualInfo = function (_a) {
56
47
  var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
57
48
  var settingsData = useAppSelector(settingsSelector).data;
58
49
  var countries = settingsData.countries;
59
- var _c = data.individualData, responseBody = _c.responseBody, defaultValues = __rest(_c, ["responseBody"]);
50
+ var user = (data.verify.responseBody || {}).user;
60
51
  var methods = useForm({
61
52
  resolver: yupResolver(IndividualInfoValidationSchema),
62
- defaultValues: defaultValues,
53
+ defaultValues: data.individualData,
63
54
  mode: 'onChange'
64
55
  });
65
- useSetFromDefaultValues(methods, defaultValues);
66
- var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
67
- var _e = React.useState(false), employerFieldsActive = _e[0], setEmployerFieldsActive = _e[1];
56
+ useSetFromDefaultValues(methods, data.individualData, true);
57
+ var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
58
+ var _d = React.useState(false), employerFieldsActive = _d[0], setEmployerFieldsActive = _d[1];
68
59
  React.useEffect(function () {
69
60
  var _a, _b;
70
61
  if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
@@ -88,7 +79,7 @@ var AdditionalIndividualInfo = function (_a) {
88
79
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive &&
89
80
  employerFieldsActive &&
90
81
  !isMonthlyIncomeListActive &&
91
- !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
82
+ !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: user === null || user === void 0 ? void 0 : user.is_authorized })] })), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
92
83
  };
93
84
  export default React.memo(AdditionalIndividualInfo);
94
85
  AdditionalIndividualInfo.defaultProps = {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const CivilIDFile: () => JSX.Element;
3
+ export default CivilIDFile;
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { ScreenContainer } from '../../../../features/shared/Containers';
4
+ import { styled } from '@mui/material/styles';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { useController, useFormContext } from 'react-hook-form';
7
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
+ import { individualSelector, uploadCivilIdFile } from '../../../../features/app/individual/individualStore';
9
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
10
+ import UploadFile from '../../../../features/shared/UploadFile';
11
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
12
+ var theme = _a.theme;
13
+ return ({
14
+ marginBlockStart: theme.spacing(3)
15
+ });
16
+ });
17
+ var CivilIDFile = function () {
18
+ var _a, _b;
19
+ var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
20
+ var t = useTranslation().t;
21
+ var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors;
22
+ var civilIDFileControl = useController({ name: 'civilIDFile', control: control });
23
+ var civilIDFileIdControl = useController({ name: 'civilIDFileId', control: control });
24
+ var _e = useAppSelector(individualSelector), data = _e.data, loading = _e.loading, sysError = _e.error;
25
+ var civilIDUploading = data.attachmentsData.civilIDUploading;
26
+ var dispatch = useAppDispatch();
27
+ var civilIDValue = civilIDFileControl.field.value;
28
+ var error = ((_a = civilIDFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = civilIDFileIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
29
+ var handleCivilIDChange = function (files) {
30
+ var _a;
31
+ var file = files === null || files === void 0 ? void 0 : files[0];
32
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
33
+ setError('civilIDFile', { message: 'file_not_supported_alert' });
34
+ }
35
+ else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
36
+ setError('civilIDFile', { message: 'file_size_alert' });
37
+ }
38
+ else {
39
+ civilIDFileControl.field.onChange(file);
40
+ dispatch(uploadCivilIdFile({
41
+ file: file,
42
+ onProgress: function (value) {
43
+ setProgress(value);
44
+ },
45
+ title: (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant_id
46
+ }));
47
+ }
48
+ };
49
+ var handleReset = function () {
50
+ civilIDFileControl.field.onChange(null);
51
+ civilIDFileIdControl.field.onChange('');
52
+ setProgress(0);
53
+ };
54
+ React.useEffect(function () {
55
+ if (sysError === 'file_upload_error') {
56
+ setError('civilIDFileId', { message: sysError });
57
+ civilIDFileControl.field.onChange(null);
58
+ setProgress(0);
59
+ }
60
+ }, [sysError]);
61
+ React.useEffect(function () {
62
+ if ((civilIDFileControl.formState.isValid || !!civilIDValue) && error != 'file_upload_error')
63
+ clearErrors();
64
+ }, [civilIDFileControl.formState.isValid, civilIDValue]);
65
+ return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isFileUploaded: !civilIDUploading && !!civilIDValue, isSubmitting: loading, isUploading: civilIDUploading, progress: progress, onReset: handleReset, error: error && t(error) }) }));
66
+ };
67
+ export default CivilIDFile;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface SignatureFileProps {
3
+ show: boolean;
4
+ }
5
+ declare const SignatureFile: ({ show }: SignatureFileProps) => JSX.Element;
6
+ export default SignatureFile;
@@ -0,0 +1,78 @@
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 React from 'react';
14
+ import { ScreenContainer } from '../../../../features/shared/Containers';
15
+ import { styled } from '@mui/material/styles';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { useController, useFormContext } from 'react-hook-form';
18
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
+ import { individualSelector, uploadSignatureFile } from '../../../../features/app/individual/individualStore';
20
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
21
+ import UploadFile from '../../../../features/shared/UploadFile';
22
+ import Collapse from '../../../../components/Collapse';
23
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
24
+ var theme = _a.theme;
25
+ return ({
26
+ marginBlockStart: theme.spacing(3)
27
+ });
28
+ });
29
+ var SignatureFile = function (_a) {
30
+ var _b, _c;
31
+ var show = _a.show;
32
+ var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
33
+ var t = useTranslation().t;
34
+ var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors;
35
+ var signatureFileControl = useController({ name: 'signatureFile', control: control });
36
+ var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
37
+ var _f = useAppSelector(individualSelector), data = _f.data, loading = _f.loading, sysError = _f.error;
38
+ var signatureFileUploading = data.attachmentsData.signatureFileUploading;
39
+ var dispatch = useAppDispatch();
40
+ var signatureValue = signatureFileControl.field.value;
41
+ var error = ((_b = signatureFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = signatureFileIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
42
+ var handleSignatureChange = function (files) {
43
+ var file = files === null || files === void 0 ? void 0 : files[0];
44
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
45
+ setError('signatureFile', { message: 'file_not_supported_alert' });
46
+ }
47
+ else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
48
+ setError('signatureFile', { message: 'file_size_alert' });
49
+ }
50
+ else {
51
+ signatureFileControl.field.onChange(file);
52
+ dispatch(uploadSignatureFile({
53
+ file: file,
54
+ onProgress: function (value) {
55
+ setProgress(value);
56
+ }
57
+ }));
58
+ }
59
+ };
60
+ var handleReset = function () {
61
+ signatureFileControl.field.onChange(null);
62
+ signatureFileIdControl.field.onChange('');
63
+ setProgress(0);
64
+ };
65
+ React.useEffect(function () {
66
+ if (sysError === 'file_upload_error') {
67
+ setError('signatureFileId', { message: sysError });
68
+ signatureFileControl.field.onChange(null);
69
+ setProgress(0);
70
+ }
71
+ }, [sysError]);
72
+ React.useEffect(function () {
73
+ if ((signatureFileControl.formState.isValid || !!signatureValue) && error != 'file_upload_error')
74
+ clearErrors();
75
+ }, [signatureFileControl.formState.isValid, signatureValue]);
76
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isFileUploaded: !signatureFileUploading && !!signatureValue, isSubmitting: loading, isUploading: signatureFileUploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
77
+ };
78
+ export default SignatureFile;
@@ -6,6 +6,10 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
6
6
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
7
7
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
8
8
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
9
+ civilIDFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
+ civilIDFile: any;
11
+ signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
+ signatureFile: any;
9
13
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
10
14
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
11
15
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<ObjectShape, {
@@ -13,6 +17,10 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
13
17
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
14
18
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
15
19
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
20
+ civilIDFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
+ civilIDFile: any;
22
+ signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
+ signatureFile: any;
16
24
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
17
25
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
18
26
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<ObjectShape, {
@@ -20,6 +28,10 @@ export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yu
20
28
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
21
29
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
22
30
  employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
31
+ civilIDFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
32
+ civilIDFile: any;
33
+ signatureFileId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
+ signatureFile: any;
23
35
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
24
36
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
25
37
  }>>>;
@@ -1,4 +1,5 @@
1
1
  import * as yup from 'yup';
2
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
2
3
  export var IndividualInfoValidationSchema = yup.object().shape({
3
4
  occupation: yup.object().required('alert_choose_occupation'),
4
5
  sourceIncome: yup.object().required('choose_any_source_of_income'),
@@ -19,6 +20,32 @@ export var IndividualInfoValidationSchema = yup.object().shape({
19
20
  return yup.object().optional();
20
21
  }
21
22
  }),
23
+ civilIDFileId: yup.string().optional(),
24
+ civilIDFile: yup
25
+ .mixed()
26
+ .test({
27
+ test: function (value) {
28
+ if (!!value)
29
+ return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
30
+ ? true
31
+ : this.createError({ message: 'alert_file_upload' });
32
+ return true;
33
+ }
34
+ })
35
+ .optional(),
36
+ signatureFileId: yup.string().optional(),
37
+ signatureFile: yup
38
+ .mixed()
39
+ .test({
40
+ test: function (value) {
41
+ if (!!value)
42
+ return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
43
+ ? true
44
+ : this.createError({ message: 'alert_file_upload' });
45
+ return true;
46
+ }
47
+ })
48
+ .optional(),
22
49
  isPEP: yup.boolean().required('please_choose_relative_pep'),
23
50
  isInfluencer: yup.boolean().required('please_choose_are_you_influncer')
24
51
  });
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { Trans, useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { maskEmail } from '../../../../utils';
6
+ import { individualSelector } from '../../../../features/app/individual/individualStore';
7
+ import { useAppSelector } from '../../../../hooks';
5
8
  var ResetPasswordSuccess = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(individualSelector).data;
12
+ var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
13
+ var maskedEmail = maskEmail(email);
14
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
8
15
  };
9
16
  export default React.memo(ResetPasswordSuccess);
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { Trans, useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { useAppSelector } from '../../../../hooks';
6
+ import { maskEmail } from '../../../../utils';
7
+ import { passwordSelector } from '../../../app/password/passwordStore';
5
8
  var ResetPasswordSuccess = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(passwordSelector).data;
12
+ var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
13
+ var maskedEmail = maskEmail(email);
14
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
8
15
  };
9
16
  export default React.memo(ResetPasswordSuccess);
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
- import { useTranslation } from 'react-i18next';
3
+ import { Trans, useTranslation } from 'react-i18next';
4
4
  import SuccessScreen from '../../../shared/SuccessScreen';
5
+ import { useAppSelector } from '../../../../hooks';
6
+ import { maskEmail } from '../../../../utils';
7
+ import { taxSelector } from '../../../../features/app/tax/taxStore';
5
8
  var ResetPasswordSuccess = function (_a) {
9
+ var _b, _c;
6
10
  var t = useTranslation().t;
7
- return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
11
+ var data = useAppSelector(taxSelector).data;
12
+ var email = ((_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.primary_contact).email;
13
+ var maskedEmail = maskEmail(email);
14
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: _jsx(Trans, { i18nKey: 'reset_password_success_description_dev', values: { email: maskedEmail } }), showEmailProviders: true }));
8
15
  };
9
16
  export default React.memo(ResetPasswordSuccess);
package/package.json CHANGED
@@ -1,129 +1,129 @@
1
- {
2
- "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.30-test",
4
- "description": "connect library, auth",
5
- "private": false,
6
- "main": "build/index.js",
7
- "module": "build/index.js",
8
- "types": "build/index.d.ts",
9
- "files": [
10
- "build",
11
- "README.md"
12
- ],
13
- "scripts": {
14
- "husky:setup": "npx husky install",
15
- "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
- "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
- "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
18
- "lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
19
- "start": "cross-env NODE_ENV=development webpack serve",
20
- "build": "rm -rf build && cross-env NODE_ENV=production webpack",
21
- "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
- "tsc:alias": "tsc-alias -p tsconfig.json",
23
- "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public"
25
- },
26
- "keywords": [],
27
- "author": {
28
- "name": "Ahmed Elsharkawy",
29
- "email": "a.elsharkawy@tap.company"
30
- },
31
- "license": "ISC",
32
- "devDependencies": {
33
- "@babel/core": "^7.18.6",
34
- "@babel/preset-env": "^7.18.6",
35
- "@babel/preset-react": "^7.18.6",
36
- "@babel/preset-typescript": "^7.18.6",
37
- "@types/lodash-es": "^4.17.6",
38
- "@types/react": "^18.0.15",
39
- "@types/react-calendar": "~3.5.1",
40
- "@types/react-dom": "^18.0.6",
41
- "@typescript-eslint/eslint-plugin": "^5.30.5",
42
- "@typescript-eslint/parser": "^5.30.5",
43
- "babel-loader": "^8.2.5",
44
- "copyfiles": "^2.4.1",
45
- "cross-env": "^7.0.3",
46
- "css-loader": "^6.7.1",
47
- "css-minimizer-webpack-plugin": "^4.0.0",
48
- "eslint": "^8.19.0",
49
- "eslint-config-airbnb": "^19.0.4",
50
- "eslint-config-prettier": "^8.5.0",
51
- "eslint-plugin-import": "^2.26.0",
52
- "eslint-plugin-jsx-a11y": "^6.6.0",
53
- "eslint-plugin-node": "^11.1.0",
54
- "eslint-plugin-prettier": "^4.2.1",
55
- "eslint-plugin-react": "^7.30.1",
56
- "eslint-plugin-react-hooks": "^4.6.0",
57
- "file-loader": "^6.2.0",
58
- "fork-ts-checker-webpack-plugin": "^7.2.12",
59
- "html-loader": "^3.1.2",
60
- "html-webpack-plugin": "^5.5.0",
61
- "husky": "^8.0.1",
62
- "lint-staged": "^13.0.3",
63
- "mini-css-extract-plugin": "^2.6.1",
64
- "prettier": "^2.7.1",
65
- "sass": "^1.53.0",
66
- "sass-loader": "^13.0.2",
67
- "style-loader": "^3.3.1",
68
- "terser-webpack-plugin": "^5.3.3",
69
- "tsc-alias": "^1.6.11",
70
- "typescript": "^4.7.4",
71
- "webpack": "^5.73.0",
72
- "webpack-cli": "^4.10.0",
73
- "webpack-dev-server": "^4.9.3",
74
- "webpack-merge": "^5.8.0"
75
- },
76
- "dependencies": {
77
- "@emotion/react": "^11.9.3",
78
- "@emotion/styled": "^11.9.3",
79
- "@fingerprintjs/fingerprintjs": "~3.3.4",
80
- "@hookform/resolvers": "^2.9.6",
81
- "@mui/icons-material": "^5.8.4",
82
- "@mui/material": "^5.8.7",
83
- "@reduxjs/toolkit": "^1.8.3",
84
- "axios": "^0.27.2",
85
- "device-detector-js": "^3.0.3",
86
- "i18next": "^21.8.14",
87
- "i18next-browser-languagedetector": "^6.1.4",
88
- "i18next-http-backend": "^1.4.1",
89
- "jsencrypt": "^2.3.1",
90
- "lodash-es": "^4.17.21",
91
- "lottie-web": "^5.9.6",
92
- "moment": "^2.29.4",
93
- "react": "^18.2.0",
94
- "react-calendar": "~3.7.0",
95
- "react-device-detect": "^2.2.2",
96
- "react-dom": "^18.2.0",
97
- "react-dropzone": "^14.2.2",
98
- "react-hook-form": "^7.33.1",
99
- "react-i18next": "^11.18.1",
100
- "react-multi-date-picker": "^3.3.4",
101
- "react-otp-input": "^2.4.0",
102
- "react-redux": "^8.0.2",
103
- "react-spring-bottom-sheet": "^3.4.1",
104
- "yup": "^0.32.11"
105
- },
106
- "peerDependencies": {
107
- "react": "^18.2.0",
108
- "react-dom": "^18.2.0"
109
- },
110
- "lint-staged": {
111
- "src/**/*.{ts,tsx,json,js,jsx}": [
112
- "yarn run prettier:fix",
113
- "yarn run lint",
114
- "git add ."
115
- ]
116
- },
117
- "browserslist": {
118
- "production": [
119
- ">0.2%",
120
- "not dead",
121
- "not op_mini all"
122
- ],
123
- "development": [
124
- "last 1 chrome version",
125
- "last 1 firefox version",
126
- "last 1 safari version"
127
- ]
128
- }
129
- }
1
+ {
2
+ "name": "@tap-payments/auth-jsconnect",
3
+ "version": "2.1.31-test",
4
+ "description": "connect library, auth",
5
+ "private": false,
6
+ "main": "build/index.js",
7
+ "module": "build/index.js",
8
+ "types": "build/index.d.ts",
9
+ "files": [
10
+ "build",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "husky:setup": "npx husky install",
15
+ "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
+ "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
+ "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
18
+ "lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
19
+ "start": "cross-env NODE_ENV=development webpack serve",
20
+ "build": "rm -rf build && cross-env NODE_ENV=production webpack",
21
+ "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
+ "tsc:alias": "tsc-alias -p tsconfig.json",
23
+ "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
+ "push": "npm publish --access public"
25
+ },
26
+ "keywords": [],
27
+ "author": {
28
+ "name": "Ahmed Elsharkawy",
29
+ "email": "a.elsharkawy@tap.company"
30
+ },
31
+ "license": "ISC",
32
+ "devDependencies": {
33
+ "@babel/core": "^7.18.6",
34
+ "@babel/preset-env": "^7.18.6",
35
+ "@babel/preset-react": "^7.18.6",
36
+ "@babel/preset-typescript": "^7.18.6",
37
+ "@types/lodash-es": "^4.17.6",
38
+ "@types/react": "^18.0.15",
39
+ "@types/react-calendar": "~3.5.1",
40
+ "@types/react-dom": "^18.0.6",
41
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
42
+ "@typescript-eslint/parser": "^5.30.5",
43
+ "babel-loader": "^8.2.5",
44
+ "copyfiles": "^2.4.1",
45
+ "cross-env": "^7.0.3",
46
+ "css-loader": "^6.7.1",
47
+ "css-minimizer-webpack-plugin": "^4.0.0",
48
+ "eslint": "^8.19.0",
49
+ "eslint-config-airbnb": "^19.0.4",
50
+ "eslint-config-prettier": "^8.5.0",
51
+ "eslint-plugin-import": "^2.26.0",
52
+ "eslint-plugin-jsx-a11y": "^6.6.0",
53
+ "eslint-plugin-node": "^11.1.0",
54
+ "eslint-plugin-prettier": "^4.2.1",
55
+ "eslint-plugin-react": "^7.30.1",
56
+ "eslint-plugin-react-hooks": "^4.6.0",
57
+ "file-loader": "^6.2.0",
58
+ "fork-ts-checker-webpack-plugin": "^7.2.12",
59
+ "html-loader": "^3.1.2",
60
+ "html-webpack-plugin": "^5.5.0",
61
+ "husky": "^8.0.1",
62
+ "lint-staged": "^13.0.3",
63
+ "mini-css-extract-plugin": "^2.6.1",
64
+ "prettier": "^2.7.1",
65
+ "sass": "^1.53.0",
66
+ "sass-loader": "^13.0.2",
67
+ "style-loader": "^3.3.1",
68
+ "terser-webpack-plugin": "^5.3.3",
69
+ "tsc-alias": "^1.6.11",
70
+ "typescript": "^4.7.4",
71
+ "webpack": "^5.73.0",
72
+ "webpack-cli": "^4.10.0",
73
+ "webpack-dev-server": "^4.9.3",
74
+ "webpack-merge": "^5.8.0"
75
+ },
76
+ "dependencies": {
77
+ "@emotion/react": "^11.9.3",
78
+ "@emotion/styled": "^11.9.3",
79
+ "@fingerprintjs/fingerprintjs": "~3.3.4",
80
+ "@hookform/resolvers": "^2.9.6",
81
+ "@mui/icons-material": "^5.8.4",
82
+ "@mui/material": "^5.8.7",
83
+ "@reduxjs/toolkit": "^1.8.3",
84
+ "axios": "^0.27.2",
85
+ "device-detector-js": "^3.0.3",
86
+ "i18next": "^21.8.14",
87
+ "i18next-browser-languagedetector": "^6.1.4",
88
+ "i18next-http-backend": "^1.4.1",
89
+ "jsencrypt": "^2.3.1",
90
+ "lodash-es": "^4.17.21",
91
+ "lottie-web": "^5.9.6",
92
+ "moment": "^2.29.4",
93
+ "react": "^18.2.0",
94
+ "react-calendar": "~3.7.0",
95
+ "react-device-detect": "^2.2.2",
96
+ "react-dom": "^18.2.0",
97
+ "react-dropzone": "^14.2.2",
98
+ "react-hook-form": "^7.33.1",
99
+ "react-i18next": "^11.18.1",
100
+ "react-multi-date-picker": "^3.3.4",
101
+ "react-otp-input": "^2.4.0",
102
+ "react-redux": "^8.0.2",
103
+ "react-spring-bottom-sheet": "^3.4.1",
104
+ "yup": "^0.32.11"
105
+ },
106
+ "peerDependencies": {
107
+ "react": "^18.2.0",
108
+ "react-dom": "^18.2.0"
109
+ },
110
+ "lint-staged": {
111
+ "src/**/*.{ts,tsx,json,js,jsx}": [
112
+ "yarn run prettier:fix",
113
+ "yarn run lint",
114
+ "git add ."
115
+ ]
116
+ },
117
+ "browserslist": {
118
+ "production": [
119
+ ">0.2%",
120
+ "not dead",
121
+ "not op_mini all"
122
+ ],
123
+ "development": [
124
+ "last 1 chrome version",
125
+ "last 1 firefox version",
126
+ "last 1 safari version"
127
+ ]
128
+ }
129
+ }