@tap-payments/auth-jsconnect 1.0.100-test → 1.1.2-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 (41) hide show
  1. package/build/@types/form.d.ts +2 -0
  2. package/build/api/entity.d.ts +7 -0
  3. package/build/api/entity.js +10 -1
  4. package/build/api/index.d.ts +1 -0
  5. package/build/api/lead.d.ts +1 -0
  6. package/build/assets/locales/ar.json +2 -1
  7. package/build/assets/locales/en.json +2 -1
  8. package/build/components/FileInput/DragAndDrop.d.ts +7 -0
  9. package/build/components/FileInput/DragAndDrop.js +39 -0
  10. package/build/components/FileInput/UploadInput.d.ts +7 -0
  11. package/build/components/FileInput/UploadInput.js +38 -0
  12. package/build/components/FileInput/index.d.ts +3 -0
  13. package/build/components/FileInput/index.js +3 -0
  14. package/build/constants/api.d.ts +1 -0
  15. package/build/constants/api.js +3 -1
  16. package/build/constants/assets.d.ts +1 -0
  17. package/build/constants/assets.js +1 -0
  18. package/build/constants/validation.d.ts +1 -0
  19. package/build/constants/validation.js +1 -0
  20. package/build/features/app/bank/bankStore.d.ts +1 -0
  21. package/build/features/app/bank/bankStore.js +36 -2
  22. package/build/features/app/connect/connectStore.js +18 -16
  23. package/build/features/app/password/passwordStore.d.ts +4 -1
  24. package/build/features/app/password/passwordStore.js +20 -17
  25. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  26. package/build/features/bank/screens/BankDetails/BankStatement.d.ts +3 -0
  27. package/build/features/bank/screens/BankDetails/BankStatement.js +38 -0
  28. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  29. package/build/features/bank/screens/BankDetails/validation.js +1 -0
  30. package/build/features/business/screens/Activities/Activities.js +2 -1
  31. package/build/features/business/screens/Activities/LicenseName.d.ts +5 -0
  32. package/build/features/business/screens/Activities/LicenseName.js +30 -0
  33. package/build/features/connect/screens/Merchant/BrandList.js +1 -5
  34. package/build/features/connect/screens/Merchant/Merchant.js +10 -8
  35. package/build/features/password/screens/Success/Success.js +2 -2
  36. package/build/features/shared/Button/Button.js +1 -1
  37. package/build/features/shared/UploadFile/UploadFile.d.ts +21 -0
  38. package/build/features/shared/UploadFile/UploadFile.js +77 -0
  39. package/build/features/shared/UploadFile/index.d.ts +2 -0
  40. package/build/features/shared/UploadFile/index.js +2 -0
  41. package/package.json +128 -127
@@ -49,6 +49,8 @@ export declare type BankFormValues = {
49
49
  iban: string;
50
50
  beneficiaryName: string;
51
51
  bankName: string;
52
+ bankStatementId?: string;
53
+ uploading?: boolean;
52
54
  confirmPolicy: boolean;
53
55
  };
54
56
  export declare type TaxFormValues = {
@@ -37,11 +37,18 @@ export declare type EntityBankUpdateBody = {
37
37
  step_name: string;
38
38
  encryption_contract?: Array<string>;
39
39
  };
40
+ export declare type UploadFileBody = {
41
+ file_link_create: boolean;
42
+ file: File | null;
43
+ title: string | undefined;
44
+ purpose: string;
45
+ };
40
46
  declare const entityService: {
41
47
  createEntityInfo: ({ id, ...data }: EntityInfoBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
42
48
  updateEntityInfo: ({ id, ...data }: EntityInfoBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
43
49
  createBankAccount: (data: EntityBankUpdateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
44
50
  retrieveEntityInfo: (entity_id: string, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
45
51
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
52
+ uploadFileInfo: (data: UploadFileBody) => Promise<any>;
46
53
  };
47
54
  export { entityService };
@@ -25,6 +25,14 @@ var updateEntityInfo = function (_a, config) {
25
25
  var createBankAccount = function (data, config) {
26
26
  return instance.post("".concat(ENDPOINT_PATHS.BANK), data, config);
27
27
  };
28
+ var uploadFileInfo = function (data) {
29
+ return httpClient({
30
+ method: 'post',
31
+ url: "".concat(ENDPOINT_PATHS.FILES_PATH),
32
+ data: data,
33
+ headers: { 'Content-Type': 'multipart/form-data' }
34
+ });
35
+ };
28
36
  var updateIndividualInfo = function (_a) {
29
37
  var id = _a.id, data = __rest(_a, ["id"]);
30
38
  return httpClient({
@@ -38,6 +46,7 @@ var entityService = {
38
46
  updateEntityInfo: updateEntityInfo,
39
47
  createBankAccount: createBankAccount,
40
48
  retrieveEntityInfo: retrieveEntityInfo,
41
- updateIndividualInfo: updateIndividualInfo
49
+ updateIndividualInfo: updateIndividualInfo,
50
+ uploadFileInfo: uploadFileInfo
42
51
  };
43
52
  export { entityService };
@@ -36,6 +36,7 @@ declare const API: {
36
36
  createBankAccount: (data: EntityBankUpdateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
37
37
  retrieveEntityInfo: (entity_id: string, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
38
38
  updateIndividualInfo: ({ id, ...data }: EntityInfoBody) => Promise<any>;
39
+ uploadFileInfo: (data: import("./entity").UploadFileBody) => Promise<any>;
39
40
  };
40
41
  availabilityServices: {
41
42
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -27,6 +27,7 @@ declare type BrandContent = {
27
27
  about?: BrandTitle;
28
28
  };
29
29
  declare type BrandInfo = {
30
+ id?: string;
30
31
  name?: BrandTitle;
31
32
  sector?: Array<string>;
32
33
  website?: string;
@@ -242,5 +242,6 @@
242
242
  "password_success_title": "Your password is set",
243
243
  "bank": "bank",
244
244
  "reset_password_success_title": "لقد ارسلنا رسالة بريدية إليك",
245
- "reset_password_success_description": "تحقق من بريدك الإلكتروني لإعادة تعيين كلمة المرور الخاصة بك."
245
+ "reset_password_success_description": "تحقق من بريدك الإلكتروني لإعادة تعيين كلمة المرور الخاصة بك.",
246
+ "license_name_label": "اسم الرخصة"
246
247
  }
@@ -262,5 +262,6 @@
262
262
  "account_details": "Your account details",
263
263
  "bank": "bank",
264
264
  "reset_password_success_title": "We sent you an email",
265
- "reset_password_success_description": "Check your email to reset your password."
265
+ "reset_password_success_description": "Check your email to reset your password.",
266
+ "license_name_label": "License Name"
266
267
  }
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface DragAndDropProps {
3
+ title: string;
4
+ onSuccess?: (files: File) => void;
5
+ }
6
+ declare const DragAndDrop: ({ title, onSuccess }: DragAndDropProps) => JSX.Element;
7
+ export default DragAndDrop;
@@ -0,0 +1,39 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import Box from '@mui/material/Box';
14
+ import { alpha, styled } from '@mui/material/styles';
15
+ import Input from '../Input';
16
+ import Text from '../Text';
17
+ import { useDropzone } from 'react-dropzone';
18
+ var BoxStyled = styled(Box)(function (_a) {
19
+ var theme = _a.theme;
20
+ return (__assign(__assign({ direction: theme.direction }, theme.typography.subtitle2), { color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default, padding: theme.spacing(1.5, 2.5, 1.5), border: "1px dashed ".concat(alpha(theme.palette.divider, 0.8)), width: '50%', cursor: 'pointer' }));
21
+ });
22
+ var UploadInputStyled = styled(Input)(function () { return ({
23
+ display: 'none'
24
+ }); });
25
+ var DragAndDrop = function (_a) {
26
+ var title = _a.title, onSuccess = _a.onSuccess;
27
+ var _b = useDropzone({
28
+ maxFiles: 1,
29
+ noKeyboard: true,
30
+ noClick: true,
31
+ multiple: false,
32
+ accept: { 'image/jpeg': ['.jpeg'], 'image/png': ['.png'], 'image/jpg': ['.jpg'], 'application/pdf': ['.pdf'] },
33
+ onDrop: function (files) {
34
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(files === null || files === void 0 ? void 0 : files[0]);
35
+ }
36
+ }), getRootProps = _b.getRootProps, getInputProps = _b.getInputProps;
37
+ return (_jsxs(BoxStyled, __assign({}, getRootProps({ className: 'dropzone' }), { children: [_jsx(Text, __assign({ sx: { fontSize: '12px' } }, { children: title })), _jsx(UploadInputStyled, { inputProps: __assign({}, getInputProps()) })] })));
38
+ };
39
+ export default DragAndDrop;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface UploadInputProps {
3
+ title: string;
4
+ onChange: (file: File) => void;
5
+ }
6
+ declare const UploadInput: ({ title, onChange }: UploadInputProps) => JSX.Element;
7
+ export default UploadInput;
@@ -0,0 +1,38 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { styled } from '@mui/material/styles';
14
+ import React from 'react';
15
+ import Box from '@mui/material/Box';
16
+ import Input from '../../components/Input';
17
+ import Text from '../Text';
18
+ var UploadInputStyled = styled(Input)(function () { return ({
19
+ display: 'none'
20
+ }); });
21
+ var UploadBoxStyled = styled(Box)(function (_a) {
22
+ var theme = _a.theme;
23
+ return (__assign(__assign({}, theme.typography.caption), { background: theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, padding: theme.spacing(1.5, 2.5, 1.5), cursor: 'pointer', width: '50%' }));
24
+ });
25
+ var UploadInput = function (_a) {
26
+ var title = _a.title, onChange = _a.onChange;
27
+ var fileRef = React.useRef(null);
28
+ var openDeviceMedia = function () {
29
+ var _a;
30
+ (_a = fileRef.current) === null || _a === void 0 ? void 0 : _a.click();
31
+ };
32
+ var onFileChange = function (event) {
33
+ if (event.target.files)
34
+ onChange === null || onChange === void 0 ? void 0 : onChange(event.target.files[0]);
35
+ };
36
+ return (_jsxs(UploadBoxStyled, __assign({ onClick: openDeviceMedia }, { children: [_jsx(Text, __assign({ sx: { fontSize: '12px' } }, { children: title })), _jsx(UploadInputStyled, { onChange: onFileChange, id: 'upload-file-input', inputRef: fileRef, type: 'file', inputProps: { accept: '.png,.jpg,.pdf,.jpeg' } })] })));
37
+ };
38
+ export default UploadInput;
@@ -0,0 +1,3 @@
1
+ import UploadInput from './UploadInput';
2
+ import DragAndDrop from './DragAndDrop';
3
+ export { DragAndDrop, UploadInput };
@@ -0,0 +1,3 @@
1
+ import UploadInput from './UploadInput';
2
+ import DragAndDrop from './DragAndDrop';
3
+ export { DragAndDrop, UploadInput };
@@ -27,4 +27,5 @@ export declare const ENDPOINT_PATHS: {
27
27
  BRAND_LIST: string;
28
28
  OCCUPATION: string;
29
29
  INDIVIDUAL: string;
30
+ FILES_PATH: string;
30
31
  };
@@ -26,6 +26,7 @@ var MONTHLY_INCOME_PATH = '/v2/monthlyIncome';
26
26
  var OCCUPATION_PATH = '/v2/occupation';
27
27
  var BRAND_LIST_PATH = '/brand/list';
28
28
  var FIREBASE_URL = 'https://goconnect-195cd-default-rtdb.asia-southeast1.firebasedatabase.app/locale.json';
29
+ var FILES = '/files';
29
30
  export var ENDPOINT_PATHS = {
30
31
  SANDBOX_BASE_URL: SANDBOX_BASE_URL,
31
32
  PRODUCTION_BASE_URL: PRODUCTION_BASE_URL,
@@ -54,5 +55,6 @@ export var ENDPOINT_PATHS = {
54
55
  IBAN_BANK: IBAN_PATH,
55
56
  BRAND_LIST: BRAND_LIST_PATH,
56
57
  OCCUPATION: OCCUPATION_PATH,
57
- INDIVIDUAL: INDIVIDUAL_PATH
58
+ INDIVIDUAL: INDIVIDUAL_PATH,
59
+ FILES_PATH: FILES
58
60
  };
@@ -41,6 +41,7 @@ export declare const ICONS_NAMES: {
41
41
  MOBILE_ICON: string;
42
42
  SEARCH_ICON: string;
43
43
  SUCCESS_GIF: string;
44
+ DELETE_ICON: string;
44
45
  GMAIL_Filled_ICON: string;
45
46
  GMAIL_White_ICON: string;
46
47
  outlook_Filled_ICON: string;
@@ -41,6 +41,7 @@ export var ICONS_NAMES = {
41
41
  MOBILE_ICON: 'https://dash.b-cdn.net/icons/menu/mobile.svg',
42
42
  SEARCH_ICON: 'https://dash.b-cdn.net/icons/menu/search-icon.svg',
43
43
  SUCCESS_GIF: 'https://dash.b-cdn.net/icons/menu/success_icon.gif',
44
+ DELETE_ICON: 'https://dash.b-cdn.net/icons/menu/delete-icon.png',
44
45
  GMAIL_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-filled.svg',
45
46
  GMAIL_White_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-white.svg',
46
47
  outlook_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-filled.svg',
@@ -5,6 +5,7 @@ export declare const MAX_IBAN_VALUE = 34;
5
5
  export declare const FL_NUMBER_LENGTH = 8;
6
6
  export declare const CR_NUMBER_LENGTH = 10;
7
7
  export declare const SAUDI_NUMBER_LENGTH = 9;
8
+ export declare const MAX_FILE_SIZE = 1000000;
8
9
  export declare const REGEX_FULL_NAME: RegExp;
9
10
  export declare const REGEX_WEBSITE: RegExp;
10
11
  export declare const REGEX_BENEFICIARY_NAME: RegExp;
@@ -5,6 +5,7 @@ export var MAX_IBAN_VALUE = 34;
5
5
  export var FL_NUMBER_LENGTH = 8;
6
6
  export var CR_NUMBER_LENGTH = 10;
7
7
  export var SAUDI_NUMBER_LENGTH = 9;
8
+ export var MAX_FILE_SIZE = 1000000;
8
9
  export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
9
10
  export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
10
11
  export var REGEX_BENEFICIARY_NAME = /^([\u0600-\u065F\u066A-\u06EF\u06FA-\u06FFa-zA-Z\s])*$/g;
@@ -20,6 +20,7 @@ export declare const createBankAccount: import("@reduxjs/toolkit").AsyncThunk<{
20
20
  data: any;
21
21
  formData: BankFormValues;
22
22
  }, BankFormValues, {}>;
23
+ export declare const uploadBankStatement: import("@reduxjs/toolkit").AsyncThunk<any, File, {}>;
23
24
  export declare const checkIbanBank: import("@reduxjs/toolkit").AsyncThunk<{
24
25
  data: any;
25
26
  }, {
@@ -169,7 +169,8 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
169
169
  bank_account: {
170
170
  iban: iban,
171
171
  beneficiary_name: beneficiaryName,
172
- bank_name: bank_name
172
+ bank_name: bank_name,
173
+ bank_statement_file_id: params.bankStatementId
173
174
  },
174
175
  step_name: BANK_STEP_NAMES.BANK_INFO,
175
176
  encryption_contract: ['bank_account.iban', 'bank_account.beneficiary_name', 'bank_account.bank_name']
@@ -185,6 +186,24 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
185
186
  }
186
187
  });
187
188
  }); });
189
+ export var uploadBankStatement = createAsyncThunk('uploadBankStatement', function (file, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
190
+ var requestBody, data;
191
+ return __generator(this, function (_a) {
192
+ switch (_a.label) {
193
+ case 0:
194
+ requestBody = {
195
+ file_link_create: true,
196
+ title: file === null || file === void 0 ? void 0 : file.name,
197
+ purpose: 'identity_document',
198
+ file: file
199
+ };
200
+ return [4, API.entityService.uploadFileInfo(requestBody)];
201
+ case 1:
202
+ data = _a.sent();
203
+ return [2, data];
204
+ }
205
+ });
206
+ }); });
188
207
  export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
189
208
  var iban = _a.iban, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
190
209
  return __awaiter(void 0, void 0, void 0, function () {
@@ -252,7 +271,8 @@ var initialState = {
252
271
  iban: '',
253
272
  beneficiaryName: '',
254
273
  bankName: '',
255
- confirmPolicy: false
274
+ confirmPolicy: false,
275
+ uploading: false
256
276
  }
257
277
  }
258
278
  };
@@ -404,6 +424,20 @@ export var bankSlice = createSlice({
404
424
  if (action.error.message === 'Aborted')
405
425
  return;
406
426
  state.error = action.error.message;
427
+ })
428
+ .addCase(uploadBankStatement.pending, function (state) {
429
+ state.data.bankData.uploading = true;
430
+ state.error = null;
431
+ })
432
+ .addCase(uploadBankStatement.fulfilled, function (state, action) {
433
+ state.data.bankData.uploading = false;
434
+ state.error = null;
435
+ var id = action.payload.id;
436
+ state.data.bankData.responseBody = { fileId: id };
437
+ })
438
+ .addCase(uploadBankStatement.rejected, function (state, action) {
439
+ state.data.bankData.uploading = false;
440
+ state.error = action.error.message;
407
441
  });
408
442
  }
409
443
  });
@@ -309,10 +309,10 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
309
309
  });
310
310
  }); });
311
311
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
312
- var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
313
- var _c, _d, _e, _f, _g, _h, _j, _k, _l;
314
- return __generator(this, function (_m) {
315
- switch (_m.label) {
312
+ var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, isOther, brand, payload, data;
313
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
314
+ return __generator(this, function (_p) {
315
+ switch (_p.label) {
316
316
  case 0:
317
317
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
318
318
  instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.instagram) : '';
@@ -321,17 +321,19 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
321
321
  isAbsher = otpData.isAbsher;
322
322
  responseBody = (isAbsher ? nidData : mobileData).responseBody;
323
323
  isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
324
+ isOther = ((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) === 'other';
325
+ brand = __assign({ name: {
326
+ en: params.brandName,
327
+ ar: params.brandName,
328
+ zh: params.brandName
329
+ }, website: (_h = params.links) === null || _h === void 0 ? void 0 : _h.website, social: [twitter, instagram] }, (isExistingUser &&
330
+ !isOther && {
331
+ id: (_j = params.selectedBrandItem) === null || _j === void 0 ? void 0 : _j.id,
332
+ name: undefined
333
+ }));
324
334
  payload = {
325
- brand: {
326
- name: {
327
- en: params.brandName,
328
- ar: params.brandName,
329
- zh: params.brandName
330
- },
331
- website: (_g = params.links) === null || _g === void 0 ? void 0 : _g.website,
332
- social: [twitter, instagram]
333
- },
334
- id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
335
+ brand: brand,
336
+ id: (isExistingUser ? (_k = brandData.responseBody) === null || _k === void 0 ? void 0 : _k.lead_id : (_l = otpData.responseBody) === null || _l === void 0 ? void 0 : _l.lead_id) || '',
335
337
  terms_conditions_accepted: params.termAndConditionChecked,
336
338
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
337
339
  encryption_contract: [
@@ -345,10 +347,10 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
345
347
  };
346
348
  return [4, API.leadService.updateLead(payload)];
347
349
  case 1:
348
- data = (_m.sent()).data;
350
+ data = (_p.sent()).data;
349
351
  if (!data.errors) {
350
352
  thunkApi.dispatch(handleNextScreenStep());
351
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, params);
353
+ (_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, params);
352
354
  }
353
355
  return [2, { response: data, formData: params }];
354
356
  }
@@ -47,7 +47,10 @@ export declare const resetPassword: import("@reduxjs/toolkit").AsyncThunk<{
47
47
  otp: string;
48
48
  };
49
49
  }, OTPFormValues, {}>;
50
- export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
50
+ export declare const retrieveLeadPassword: import("@reduxjs/toolkit").AsyncThunk<{
51
+ lead: any;
52
+ entity: any;
53
+ }, void, {}>;
51
54
  declare type VerifyData = {
52
55
  token: string;
53
56
  operationType?: string;
@@ -277,23 +277,26 @@ export var resetPassword = createAsyncThunk('resetPassword', function (params, t
277
277
  }
278
278
  });
279
279
  }); });
280
- export var retrieveLead = createAsyncThunk('retrieveLeadPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
281
- var _a, password, settings, id, data;
282
- var _b, _c, _d, _e;
283
- return __generator(this, function (_f) {
284
- switch (_f.label) {
280
+ export var retrieveLeadPassword = createAsyncThunk('retrieveLeadPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
281
+ var _a, password, settings, id, data, entityData;
282
+ var _b, _c, _d, _e, _f;
283
+ return __generator(this, function (_g) {
284
+ switch (_g.label) {
285
285
  case 0:
286
286
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
287
287
  id = (password.data.verify.responseBody || { id: '' }).id;
288
288
  return [4, API.leadService.retrieveLead(id)];
289
289
  case 1:
290
- data = (_f.sent()).data;
291
- if (!(data === null || data === void 0 ? void 0 : data.errors)) {
290
+ data = (_g.sent()).data;
291
+ return [4, API.entityService.retrieveEntityInfo((_b = data === null || data === void 0 ? void 0 : data.entity) === null || _b === void 0 ? void 0 : _b.id)];
292
+ case 2:
293
+ entityData = (_g.sent()).data;
294
+ if (!(data === null || data === void 0 ? void 0 : data.errors) || !(entityData === null || entityData === void 0 ? void 0 : entityData.errors)) {
292
295
  thunkApi.dispatch(handleNextScreenStep());
293
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { id: id });
294
- (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, { data: data });
296
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { id: id });
297
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
295
298
  }
296
- return [2, data];
299
+ return [2, { lead: data, entity: entityData }];
297
300
  }
298
301
  });
299
302
  }); });
@@ -516,23 +519,23 @@ export var passwordSlice = createSlice({
516
519
  state.error = action.error.message;
517
520
  state.loading = false;
518
521
  })
519
- .addCase(retrieveLead.fulfilled, function (state, action) {
520
- var _a;
522
+ .addCase(retrieveLeadPassword.fulfilled, function (state, action) {
523
+ var _a, _b;
521
524
  state.loading = false;
522
525
  state.error = null;
523
- var data = action.payload;
524
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
526
+ var _c = action.payload, lead = _c.lead, entity = _c.entity;
527
+ var description = (((_a = lead === null || lead === void 0 ? void 0 : lead.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = entity === null || entity === void 0 ? void 0 : entity.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
525
528
  if (description) {
526
529
  state.error = description;
527
530
  return;
528
531
  }
529
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
532
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), lead), entity);
530
533
  })
531
- .addCase(retrieveLead.pending, function (state) {
534
+ .addCase(retrieveLeadPassword.pending, function (state) {
532
535
  state.loading = true;
533
536
  state.error = null;
534
537
  })
535
- .addCase(retrieveLead.rejected, function (state, action) {
538
+ .addCase(retrieveLeadPassword.rejected, function (state, action) {
536
539
  state.loading = false;
537
540
  state.error = action.error.message;
538
541
  });
@@ -27,6 +27,7 @@ import { bankSelector, createBankAccount } from '../../../app/bank/bankStore';
27
27
  import Form from '../../../../components/Form';
28
28
  import { handleCurrentActiveScreen } from '../../../../app/settings';
29
29
  import ConfirmPolicy from './ConfirmPolicy';
30
+ import BankStatement from './BankStatement';
30
31
  var FormStyled = styled(Form)(function () { return ({
31
32
  display: 'flex',
32
33
  flexDirection: 'column',
@@ -56,6 +57,6 @@ var BankDetails = function () {
56
57
  dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
57
58
  };
58
59
  var disabled = ibanChecking || !methods.formState.isValid;
59
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
60
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
60
61
  };
61
62
  export default BankDetails;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const BankStatement: () => JSX.Element;
3
+ export default BankStatement;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import { ScreenContainer } from '../../../../features/shared/Containers';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { useController, useFormContext } from 'react-hook-form';
7
+ import UploadFile from '../../../../features/shared/UploadFile';
8
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
9
+ import { bankSelector, uploadBankStatement } from '../../../../features/app/bank/bankStore';
10
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
11
+ var theme = _a.theme;
12
+ return ({
13
+ marginBlockStart: theme.spacing(3)
14
+ });
15
+ });
16
+ var BankStatement = function () {
17
+ var _a, _b;
18
+ var dispatch = useAppDispatch();
19
+ var data = useAppSelector(bankSelector).data;
20
+ var t = useTranslation().t;
21
+ var control = useFormContext().control;
22
+ var bankStatementControl = useController({ name: 'bankStatementId', control: control });
23
+ var error = (_a = bankStatementControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
24
+ var uploading = data.bankData.uploading;
25
+ var handleBankStatementChange = function (file) {
26
+ dispatch(uploadBankStatement(file));
27
+ };
28
+ var handleReset = function () {
29
+ bankStatementControl.field.onChange('');
30
+ };
31
+ React.useEffect(function () {
32
+ var _a, _b;
33
+ if ((_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.fileId)
34
+ bankStatementControl.field.onChange((_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.fileId);
35
+ }, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.fileId]);
36
+ return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), dragTitle: t('drag_and_drop'), uploadTitle: t('title_upload_file'), onFileUploaded: handleBankStatementChange, loading: uploading, onReset: handleReset, error: error && t(error) }) }));
37
+ };
38
+ export default BankStatement;
@@ -3,15 +3,18 @@ export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").A
3
3
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
4
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
5
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
6
7
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
7
8
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
8
9
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
9
10
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
11
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
13
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
12
14
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
15
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
16
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
15
17
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
19
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
17
20
  }>>>;
@@ -12,5 +12,6 @@ export var BankValidation = yup.object().shape({
12
12
  .string()
13
13
  .matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
14
14
  .required('beneficiary_name_required'),
15
+ bankStatementId: yup.string().optional(),
15
16
  confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
16
17
  });
@@ -26,6 +26,7 @@ import Collapse from '../../../../components/Collapse';
26
26
  import OperationStartDate from './OperationStartDate';
27
27
  import { businessSelector, clearError, updateActivitiesInfo } from '../../../app/business/businessStore';
28
28
  import { ActivitiesValidationSchema } from './validation';
29
+ import LicenseName from './LicenseName';
29
30
  var FormStyled = styled(Form)(function () { return ({
30
31
  display: 'flex',
31
32
  flexDirection: 'column'
@@ -72,6 +73,6 @@ var Activities = function () {
72
73
  anchorEl ? setAnchorEl(false) : setAnchorEl(true);
73
74
  };
74
75
  var disabled = !methods.formState.isValid || !!error;
75
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
76
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
76
77
  };
77
78
  export default Activities;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface LicenseNameProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: LicenseNameProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,30 @@
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 * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { ScreenContainer } from '../../../shared/Containers';
16
+ import Input from '../../../shared/Input';
17
+ import Collapse from '../../../../components/Collapse';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { businessSelector } from '../../../app/business/businessStore';
20
+ import CheckIcon from '../../../shared/CheckIcon';
21
+ var LicenseName = function (_a) {
22
+ var _b, _c, _d;
23
+ var t = useTranslation().t;
24
+ var isAr = useLanguage().isAr;
25
+ var data = useAppSelector(businessSelector).data;
26
+ var entity = (((_b = data.verify) === null || _b === void 0 ? void 0 : _b.responseBody) || {}).entity;
27
+ var name = isAr ? (_c = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _c === void 0 ? void 0 : _c.ar : (_d = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _d === void 0 ? void 0 : _d.en;
28
+ return (_jsx(Collapse, __assign({ in: !!name }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { label: t('license_name_label'), readOnly: true, value: name, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, endAdornment: _jsx(CheckIcon, {}) }) }) })));
29
+ };
30
+ export default React.memo(LicenseName);
@@ -51,10 +51,8 @@ var BrandList = function (_a) {
51
51
  var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
52
52
  var t = useTranslation().t;
53
53
  var isAr = useLanguage().isAr;
54
- var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
55
- var linksControl = useController({ control: control, name: 'links' });
54
+ var control = useFormContext().control;
56
55
  var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
57
- var links = linksControl.field.value;
58
56
  var selectedBrand = selectedBrandControl.field.value;
59
57
  var onOpenBrandList = function (event) {
60
58
  var _a;
@@ -79,8 +77,6 @@ var BrandList = function (_a) {
79
77
  var onSelectItem = function (brand) {
80
78
  selectedBrandControl.field.onChange(brand);
81
79
  onCloseBrandList();
82
- var website = brand.website;
83
- setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
84
80
  };
85
81
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('select_brand_label'), readOnly: true, onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', list: list, onSelectItem: onSelectItem, renderItem: function (item) {
86
82
  return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(selectedBrand) }, { children: isOtherLicense(item) ? t(getBrandName(item)) : getBrandName(item) })) }), getBrandId(item) === getBrandId(selectedBrand) && _jsx(CheckIcon, {})] }));
@@ -18,6 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import { handlePrevScreenStep } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
+ import { INSTAGRAM_URL, TWITTER_URL } from '../../../../constants';
21
22
  import { ScreenContainer } from '../../../shared/Containers';
22
23
  import Button from '../../../shared/Button';
23
24
  import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
@@ -50,6 +51,7 @@ var Merchant = function (_a) {
50
51
  var t = useTranslation().t;
51
52
  var isAr = useLanguage().isAr;
52
53
  var dispatch = useAppDispatch();
54
+ var formDataSelectedBrand = methods.getValues('selectedBrandItem');
53
55
  var onSubmit = function (formData) {
54
56
  dispatch(updateLeadBrand(formData));
55
57
  };
@@ -69,11 +71,11 @@ var Merchant = function (_a) {
69
71
  methods.setError('brandName', { message: 'Profile Name already exists' });
70
72
  }, [responseBody]);
71
73
  React.useEffect(function () {
72
- var _a, _b;
74
+ var _a, _b, _c, _d;
73
75
  if (isNewUser === true) {
74
76
  setUserType(ValidationOptions.NEW_USER);
75
77
  }
76
- if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && methods.getValues('selectedBrandItem').id === 'other') {
78
+ if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && (formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) === 'other') {
77
79
  setUserType(ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND);
78
80
  methods.clearErrors();
79
81
  setTimeout(function () {
@@ -82,17 +84,17 @@ var Merchant = function (_a) {
82
84
  methods.setValue('links', sites);
83
85
  }, 100);
84
86
  }
85
- if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && methods.getValues('selectedBrandItem').id !== 'other') {
87
+ if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && (formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) !== 'other') {
86
88
  setUserType(ValidationOptions.EXISTING_USER_WITH_EXIST_BRAND);
87
89
  methods.clearErrors();
88
- var twitter = ((_a = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) || '';
89
- var instagram = ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _b === void 0 ? void 0 : _b.find(function (item) { return item.includes('instagram.com'); })) || '';
90
- var sites_1 = __assign(__assign({}, links), { website: selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.website, twitter: twitter, instagram: instagram });
90
+ var twitter = ((_b = (_a = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) === null || _b === void 0 ? void 0 : _b.replaceAll("".concat(TWITTER_URL, "/"), '')) || '';
91
+ var instagram = ((_d = (_c = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.social) === null || _c === void 0 ? void 0 : _c.find(function (item) { return item.includes('instagram.com'); })) === null || _d === void 0 ? void 0 : _d.replaceAll("".concat(INSTAGRAM_URL, "/"), '')) || '';
92
+ var sites_1 = __assign(__assign({}, links), { website: formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.website, twitter: twitter, instagram: instagram });
91
93
  setTimeout(function () { return methods.setValue('links', sites_1, { shouldValidate: true }); }, 100);
92
94
  }
93
- }, [methods.getValues('selectedBrandItem'), isNewUser]);
95
+ }, [formDataSelectedBrand, isNewUser]);
94
96
  React.useEffect(function () {
95
- if (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id)
97
+ if (!(formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) && (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id))
96
98
  methods.setValue('selectedBrandItem', selectedBrandItem, { shouldValidate: true });
97
99
  }, [selectedBrandItem]);
98
100
  var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
5
- import { updateLeadSuccess, passwordSelector, retrieveLead } from '../../../app/password/passwordStore';
5
+ import { updateLeadSuccess, passwordSelector, retrieveLeadPassword } from '../../../app/password/passwordStore';
6
6
  import SuccessScreen from '../../../shared/SuccessScreen';
7
7
  import { PASSWORD_OPERATION_TYPE } from '../../../../constants';
8
8
  var Success = function (_a) {
@@ -12,7 +12,7 @@ var Success = function (_a) {
12
12
  var operationType = data.verify.operationType;
13
13
  var onSuccess = function () {
14
14
  if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
15
- dispatch(retrieveLead());
15
+ dispatch(retrieveLeadPassword());
16
16
  return;
17
17
  }
18
18
  dispatch(updateLeadSuccess());
@@ -37,7 +37,7 @@ var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop
37
37
  width: theme.spacing(3),
38
38
  height: theme.spacing(3),
39
39
  transform: isAr ? 'scaleX(-1)' : 'scaleX(1)',
40
- marginInlineEnd: theme.spacing(0.5)
40
+ marginInlineEnd: theme.spacing(-0.375)
41
41
  });
42
42
  });
43
43
  var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare const InputContainerStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
3
+ children?: React.ReactNode;
4
+ component?: React.ElementType<any> | undefined;
5
+ ref?: React.Ref<unknown> | undefined;
6
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
7
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
8
+ ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
9
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "ref" | "children" | "component" | "sx"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
10
+ interface UploadFileProps {
11
+ label: string;
12
+ required?: boolean;
13
+ dragTitle: string;
14
+ uploadTitle: string;
15
+ error?: string;
16
+ loading?: boolean;
17
+ onFileUploaded: (file: File) => void;
18
+ onReset: () => void;
19
+ }
20
+ declare const UploadFile: ({ label, required, dragTitle, uploadTitle, loading, error, onFileUploaded, onReset }: UploadFileProps) => JSX.Element;
21
+ export default UploadFile;
@@ -0,0 +1,77 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { styled } from '@mui/material/styles';
15
+ import { ScreenContainer } from '../../shared/Containers';
16
+ import Box from '@mui/material/Box';
17
+ import { InputLabelStyled } from '../../shared/Input/Input';
18
+ import Mandatory from '../../shared/Mandatory';
19
+ import { DragAndDrop, UploadInput } from '../../../components/FileInput';
20
+ import Collapse from '../../../components/Collapse';
21
+ import Warning from '../../../components/Warning';
22
+ import Icon from '../../../components/Icon';
23
+ import { ICONS_NAMES } from '../../../constants';
24
+ import { useTranslation } from 'react-i18next';
25
+ import Loader from '../../../components/Loader';
26
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
27
+ var theme = _a.theme;
28
+ return ({
29
+ marginBlockStart: theme.spacing(0)
30
+ });
31
+ });
32
+ var LabelContainerStyled = styled(Box)(function (_a) {
33
+ var theme = _a.theme;
34
+ return ({
35
+ display: 'flex',
36
+ justifyContent: 'flex-start',
37
+ padding: theme.spacing(0, 2.5, 1.25, 2.5)
38
+ });
39
+ });
40
+ var BoxStyled = styled(Box)(function (_a) {
41
+ var theme = _a.theme;
42
+ return (__assign(__assign({ direction: theme.direction }, theme.typography.subtitle2), { color: theme.palette.primary.main, fontWeight: theme.typography.fontWeightBold, background: theme.palette.background.default, padding: theme.spacing(1.5, 2.5, 1.5), width: '85%' }));
43
+ });
44
+ var UploadBoxStyled = styled(Box)(function (_a) {
45
+ var theme = _a.theme;
46
+ return (__assign(__assign({}, theme.typography.caption), { background: theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, padding: theme.spacing(0.75, 1.75, 0), cursor: 'pointer', width: '15%', display: 'flex', justifyContent: 'center' }));
47
+ });
48
+ var IconStyled = styled(Icon)(function (_a) {
49
+ var theme = _a.theme;
50
+ return ({
51
+ marginBlockStart: theme.spacing(0),
52
+ width: theme.spacing(3.5),
53
+ height: theme.spacing(3.5)
54
+ });
55
+ });
56
+ export var InputContainerStyled = styled(Box)(function (_a) {
57
+ var theme = _a.theme;
58
+ return ({
59
+ display: 'flex',
60
+ width: '100%'
61
+ });
62
+ });
63
+ var UploadFile = function (_a) {
64
+ var label = _a.label, required = _a.required, dragTitle = _a.dragTitle, uploadTitle = _a.uploadTitle, loading = _a.loading, error = _a.error, onFileUploaded = _a.onFileUploaded, onReset = _a.onReset;
65
+ var _b = React.useState(''), fileName = _b[0], setFileName = _b[1];
66
+ var t = useTranslation().t;
67
+ var handleFileChange = function (file) {
68
+ setFileName(file === null || file === void 0 ? void 0 : file.name);
69
+ onFileUploaded === null || onFileUploaded === void 0 ? void 0 : onFileUploaded(file);
70
+ };
71
+ var handleReset = function () {
72
+ setFileName('');
73
+ onReset === null || onReset === void 0 ? void 0 : onReset();
74
+ };
75
+ return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: label }), required && _jsx(Mandatory, {})] }), _jsx(Collapse, __assign({ in: !fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(DragAndDrop, { title: dragTitle, onSuccess: handleFileChange }), _jsx(UploadInput, { title: uploadTitle, onChange: handleFileChange })] }) })), _jsx(Collapse, __assign({ in: !!fileName }, { children: _jsxs(InputContainerStyled, { children: [_jsx(BoxStyled, { children: loading ? t('loading_bank_statement') : fileName }), _jsxs(UploadBoxStyled, __assign({ onClick: handleReset }, { children: [_jsx(Collapse, __assign({ in: !loading }, { children: _jsx(IconStyled, { src: ICONS_NAMES.DELETE_ICON }) })), _jsx(Collapse, __assign({ in: loading }, { children: _jsx(Loader, { innerColor: 'white', outerColor: 'white', toggleAnimation: true, style: { width: 30, height: 30 }, svgStyle: { width: 30, height: 30 } }) }))] }))] }) })), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: error })) }))] }));
76
+ };
77
+ export default UploadFile;
@@ -0,0 +1,2 @@
1
+ import UploadFile from './UploadFile';
2
+ export default UploadFile;
@@ -0,0 +1,2 @@
1
+ import UploadFile from './UploadFile';
2
+ export default UploadFile;
package/package.json CHANGED
@@ -1,127 +1,128 @@
1
- {
2
- "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.100-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/moment-hijri": "^2.1.0",
39
- "@types/react": "^18.0.15",
40
- "@types/react-calendar": "~3.5.1",
41
- "@types/react-dom": "^18.0.6",
42
- "@typescript-eslint/eslint-plugin": "^5.30.5",
43
- "@typescript-eslint/parser": "^5.30.5",
44
- "babel-loader": "^8.2.5",
45
- "copyfiles": "^2.4.1",
46
- "cross-env": "^7.0.3",
47
- "css-loader": "^6.7.1",
48
- "css-minimizer-webpack-plugin": "^4.0.0",
49
- "eslint": "^8.19.0",
50
- "eslint-config-airbnb": "^19.0.4",
51
- "eslint-config-prettier": "^8.5.0",
52
- "eslint-plugin-import": "^2.26.0",
53
- "eslint-plugin-jsx-a11y": "^6.6.0",
54
- "eslint-plugin-node": "^11.1.0",
55
- "eslint-plugin-prettier": "^4.2.1",
56
- "eslint-plugin-react": "^7.30.1",
57
- "eslint-plugin-react-hooks": "^4.6.0",
58
- "file-loader": "^6.2.0",
59
- "fork-ts-checker-webpack-plugin": "^7.2.12",
60
- "html-loader": "^3.1.2",
61
- "html-webpack-plugin": "^5.5.0",
62
- "husky": "^8.0.1",
63
- "lint-staged": "^13.0.3",
64
- "mini-css-extract-plugin": "^2.6.1",
65
- "prettier": "^2.7.1",
66
- "sass": "^1.53.0",
67
- "sass-loader": "^13.0.2",
68
- "style-loader": "^3.3.1",
69
- "terser-webpack-plugin": "^5.3.3",
70
- "tsc-alias": "^1.6.11",
71
- "typescript": "^4.7.4",
72
- "webpack": "^5.73.0",
73
- "webpack-cli": "^4.10.0",
74
- "webpack-dev-server": "^4.9.3",
75
- "webpack-merge": "^5.8.0"
76
- },
77
- "dependencies": {
78
- "@emotion/react": "^11.9.3",
79
- "@emotion/styled": "^11.9.3",
80
- "@fingerprintjs/fingerprintjs": "~3.3.4",
81
- "@hookform/resolvers": "^2.9.6",
82
- "@mui/icons-material": "^5.8.4",
83
- "@mui/material": "^5.8.7",
84
- "@reduxjs/toolkit": "^1.8.3",
85
- "axios": "^0.27.2",
86
- "device-detector-js": "^3.0.3",
87
- "i18next": "^21.8.14",
88
- "i18next-browser-languagedetector": "^6.1.4",
89
- "i18next-http-backend": "^1.4.1",
90
- "jsencrypt": "^3.2.1",
91
- "lodash-es": "^4.17.21",
92
- "moment-hijri": "~2.1.2",
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-hook-form": "^7.33.1",
98
- "react-i18next": "^11.18.1",
99
- "react-otp-input": "^2.4.0",
100
- "react-redux": "^8.0.2",
101
- "react-spring-bottom-sheet": "^3.4.1",
102
- "yup": "^0.32.11"
103
- },
104
- "peerDependencies": {
105
- "react": "^18.2.0",
106
- "react-dom": "^18.2.0"
107
- },
108
- "lint-staged": {
109
- "src/**/*.{ts,tsx,json,js,jsx}": [
110
- "yarn run prettier:fix",
111
- "yarn run lint",
112
- "git add ."
113
- ]
114
- },
115
- "browserslist": {
116
- "production": [
117
- ">0.2%",
118
- "not dead",
119
- "not op_mini all"
120
- ],
121
- "development": [
122
- "last 1 chrome version",
123
- "last 1 firefox version",
124
- "last 1 safari version"
125
- ]
126
- }
127
- }
1
+ {
2
+ "name": "@tap-payments/auth-jsconnect",
3
+ "version": "1.1.2-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/moment-hijri": "^2.1.0",
39
+ "@types/react": "^18.0.15",
40
+ "@types/react-calendar": "~3.5.1",
41
+ "@types/react-dom": "^18.0.6",
42
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
43
+ "@typescript-eslint/parser": "^5.30.5",
44
+ "babel-loader": "^8.2.5",
45
+ "copyfiles": "^2.4.1",
46
+ "cross-env": "^7.0.3",
47
+ "css-loader": "^6.7.1",
48
+ "css-minimizer-webpack-plugin": "^4.0.0",
49
+ "eslint": "^8.19.0",
50
+ "eslint-config-airbnb": "^19.0.4",
51
+ "eslint-config-prettier": "^8.5.0",
52
+ "eslint-plugin-import": "^2.26.0",
53
+ "eslint-plugin-jsx-a11y": "^6.6.0",
54
+ "eslint-plugin-node": "^11.1.0",
55
+ "eslint-plugin-prettier": "^4.2.1",
56
+ "eslint-plugin-react": "^7.30.1",
57
+ "eslint-plugin-react-hooks": "^4.6.0",
58
+ "file-loader": "^6.2.0",
59
+ "fork-ts-checker-webpack-plugin": "^7.2.12",
60
+ "html-loader": "^3.1.2",
61
+ "html-webpack-plugin": "^5.5.0",
62
+ "husky": "^8.0.1",
63
+ "lint-staged": "^13.0.3",
64
+ "mini-css-extract-plugin": "^2.6.1",
65
+ "prettier": "^2.7.1",
66
+ "sass": "^1.53.0",
67
+ "sass-loader": "^13.0.2",
68
+ "style-loader": "^3.3.1",
69
+ "terser-webpack-plugin": "^5.3.3",
70
+ "tsc-alias": "^1.6.11",
71
+ "typescript": "^4.7.4",
72
+ "webpack": "^5.73.0",
73
+ "webpack-cli": "^4.10.0",
74
+ "webpack-dev-server": "^4.9.3",
75
+ "webpack-merge": "^5.8.0"
76
+ },
77
+ "dependencies": {
78
+ "@emotion/react": "^11.9.3",
79
+ "@emotion/styled": "^11.9.3",
80
+ "@fingerprintjs/fingerprintjs": "~3.3.4",
81
+ "@hookform/resolvers": "^2.9.6",
82
+ "@mui/icons-material": "^5.8.4",
83
+ "@mui/material": "^5.8.7",
84
+ "@reduxjs/toolkit": "^1.8.3",
85
+ "axios": "^0.27.2",
86
+ "device-detector-js": "^3.0.3",
87
+ "i18next": "^21.8.14",
88
+ "i18next-browser-languagedetector": "^6.1.4",
89
+ "i18next-http-backend": "^1.4.1",
90
+ "jsencrypt": "^3.2.1",
91
+ "lodash-es": "^4.17.21",
92
+ "moment-hijri": "~2.1.2",
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-otp-input": "^2.4.0",
101
+ "react-redux": "^8.0.2",
102
+ "react-spring-bottom-sheet": "^3.4.1",
103
+ "yup": "^0.32.11"
104
+ },
105
+ "peerDependencies": {
106
+ "react": "^18.2.0",
107
+ "react-dom": "^18.2.0"
108
+ },
109
+ "lint-staged": {
110
+ "src/**/*.{ts,tsx,json,js,jsx}": [
111
+ "yarn run prettier:fix",
112
+ "yarn run lint",
113
+ "git add ."
114
+ ]
115
+ },
116
+ "browserslist": {
117
+ "production": [
118
+ ">0.2%",
119
+ "not dead",
120
+ "not op_mini all"
121
+ ],
122
+ "development": [
123
+ "last 1 chrome version",
124
+ "last 1 firefox version",
125
+ "last 1 safari version"
126
+ ]
127
+ }
128
+ }