@tap-payments/auth-jsconnect 2.3.23-test → 2.3.26-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.
@@ -48,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
51
+ import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
@@ -204,7 +204,7 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
204
204
  is_acknowledged: confirmPolicy,
205
205
  document: !documentId && hasDocument
206
206
  ? {
207
- type: 'bank_statement',
207
+ type: DocumentPurpose.BANK_STATEMENT,
208
208
  files: bankStatementId || []
209
209
  }
210
210
  : undefined
@@ -490,6 +490,7 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
490
490
  entity_id: entityId || '',
491
491
  documents: [
492
492
  {
493
+ type: DocumentPurpose.CR,
493
494
  images: params.certificateId
494
495
  }
495
496
  ]
@@ -313,6 +313,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
313
313
  entity_id: id || '',
314
314
  documents: [
315
315
  {
316
+ type: DocumentPurpose.CR,
316
317
  images: params.certificateId
317
318
  }
318
319
  ]
@@ -718,9 +718,9 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
718
718
  case 5:
719
719
  documentsList = [];
720
720
  if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
721
- documentsList.push({ type: 'Civil ID File', images: civilID });
721
+ documentsList.push({ type: DocumentPurpose.IDENTITY_DOCUMENT, images: civilID });
722
722
  if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
723
- documentsList.push({ type: 'Signature File', images: signatureFileId });
723
+ documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
724
724
  if (!(documentsList.length > 0)) return [3, 7];
725
725
  documentBody = {
726
726
  individual_type_id: id || '',
@@ -206,6 +206,7 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
206
206
  entity_id: entityId || '',
207
207
  documents: [
208
208
  {
209
+ type: DocumentPurpose.TAX_DOCUMENT,
209
210
  images: params.documentId
210
211
  }
211
212
  ]
@@ -14,11 +14,12 @@ import * as React from 'react';
14
14
  import { yupResolver } from '@hookform/resolvers/yup';
15
15
  import { useForm, FormProvider } from 'react-hook-form';
16
16
  import { useTranslation } from 'react-i18next';
17
- import { handleCurrentActiveScreen } from '../../../../app/settings';
17
+ import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
18
18
  import Box from '@mui/material/Box';
19
19
  import { alpha, styled } from '@mui/material/styles';
20
20
  import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage } from '../../../../hooks';
21
21
  import { IndividualType } from '../../../../@types';
22
+ import { isSA } from '../../../../utils';
22
23
  import Form from '../../../../components/Form';
23
24
  import Collapse from '../../../../components/Collapse';
24
25
  import Text from '../../../../components/Text';
@@ -54,6 +55,7 @@ var AdditionalIndividualInfo = function (_a) {
54
55
  var isAr = useLanguage().isAr;
55
56
  var dispatch = useAppDispatch();
56
57
  var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
58
+ var settingsData = useAppSelector(settingsSelector).data;
57
59
  var verify = data.verify;
58
60
  var user = (verify.responseBody || {}).user;
59
61
  var isAuthorizedUser = user === null || user === void 0 ? void 0 : user.is_authorized;
@@ -79,6 +81,7 @@ var AdditionalIndividualInfo = function (_a) {
79
81
  });
80
82
  useSetFromDefaultValues(methods, data.individualData, true);
81
83
  var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
84
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
82
85
  var onSubmit = function (data) {
83
86
  dispatch(updateIndividualInfo(data));
84
87
  };
@@ -113,7 +116,7 @@ var AdditionalIndividualInfo = function (_a) {
113
116
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
114
117
  var isOccupationListActive = listActive === ListType.OccupationList;
115
118
  var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
116
- return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _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: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares }), _jsx(ShareValue, { show: !listActive && showShares }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: (user === null || user === void 0 ? void 0 : user.is_authorized) && showSignatureFile })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
119
+ return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _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: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares }), _jsx(ShareValue, { show: !listActive && showShares }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: !isSACountry }), _jsx(SignatureFile, { show: (user === null || user === void 0 ? void 0 : user.is_authorized) && showSignatureFile })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
117
120
  };
118
121
  export default React.memo(AdditionalIndividualInfo);
119
122
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,3 +1,6 @@
1
1
  /// <reference types="react" />
2
- declare const CivilIDFile: () => JSX.Element;
2
+ interface CivilIDFileProps {
3
+ show: boolean;
4
+ }
5
+ declare const CivilIDFile: ({ show }: CivilIDFileProps) => JSX.Element;
3
6
  export default CivilIDFile;
@@ -1,3 +1,14 @@
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
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
13
  import React from 'react';
3
14
  import { ScreenContainer } from '../../../../features/shared/Containers';
@@ -7,6 +18,7 @@ import { useController, useFormContext } from 'react-hook-form';
7
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
19
  import { DocumentPurpose } from '../../../../@types';
9
20
  import { FileType } from '../../../../constants';
21
+ import Collapse from '../../../../components/Collapse';
10
22
  import { getFileDetailsFromDocument } from '../../../../utils';
11
23
  import { civilIDUploadingStatus, clearError, individualSelector } from '../../../app/individual/individualStore';
12
24
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
@@ -16,14 +28,15 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
16
28
  marginBlockStart: theme.spacing(3)
17
29
  });
18
30
  });
19
- var CivilIDFile = function () {
20
- var _a;
31
+ var CivilIDFile = function (_a) {
32
+ var _b;
33
+ var show = _a.show;
21
34
  var t = useTranslation().t;
22
35
  var dispatch = useAppDispatch();
23
36
  var control = useFormContext().control;
24
37
  var civilIDFileIdControl = useController({ name: 'civilID', control: control });
25
- var _b = useAppSelector(individualSelector), loading = _b.loading, data = _b.data, error = _b.error;
26
- var documents = (((_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}).documents;
38
+ var _c = useAppSelector(individualSelector), loading = _c.loading, data = _c.data, error = _c.error;
39
+ var documents = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.user) || {}).documents;
27
40
  var handleCivilIDChange = function (ids) {
28
41
  if (error)
29
42
  dispatch(clearError());
@@ -35,6 +48,6 @@ var CivilIDFile = function () {
35
48
  civilIDFileIdControl.field.onChange(ids);
36
49
  };
37
50
  var defaultFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [documents]);
38
- return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, 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, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }));
51
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, 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, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); }, fileType: FileType.IMAGES }) }) })));
39
52
  };
40
53
  export default CivilIDFile;
@@ -29,6 +29,7 @@ export var maskEmail = function (str) {
29
29
  return '';
30
30
  };
31
31
  export var shortenBrand = function (str) {
32
+ str = str === null || str === void 0 ? void 0 : str.trim();
32
33
  if (str) {
33
34
  var name_2 = str.split(' ');
34
35
  if (name_2.length > 1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.23-test",
3
+ "version": "2.3.26-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",