@tap-payments/auth-jsconnect 2.6.13-test → 2.6.16-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.
@@ -389,7 +389,7 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
389
389
  });
390
390
  }); });
391
391
  export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
392
- var _a, settings, business, identification_id_type, stepName, lead_id, requestBody, data, business_id, entity, countryIso2, screen;
392
+ var _a, settings, business, identification_id_type, stepName, lead_id, countryIso2, requestBody, data, business_id, entity, screen;
393
393
  var _b, _c;
394
394
  return __generator(this, function (_d) {
395
395
  switch (_d.label) {
@@ -398,11 +398,15 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
398
398
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
399
399
  stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
400
400
  lead_id = (business.data.verify.responseBody || {}).lead_id;
401
+ countryIso2 = settings.data.businessCountry.iso2;
402
+ if (isOtherThanKWOrSA(countryIso2)) {
403
+ identification_id_type = IDENTIFICATION_TYPE.NID;
404
+ }
401
405
  requestBody = {
402
406
  id: lead_id || '',
403
407
  identification: {
404
408
  id: params.nid,
405
- issued_country_code: settings.data.businessCountry.iso2,
409
+ issued_country_code: countryIso2,
406
410
  type: identification_id_type
407
411
  },
408
412
  date_of_birth: params.dob,
@@ -413,7 +417,6 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
413
417
  case 1:
414
418
  data = _d.sent();
415
419
  business_id = data.business_id, entity = data.entity;
416
- countryIso2 = settings.data.businessCountry.iso2;
417
420
  screen = 'BUSINESS_OTP_STEP';
418
421
  if (!isOtherThanKWOrSA(countryIso2)) return [3, 4];
419
422
  screen = 'BUSINESS_BUSINESS_TYPE_STEP';
@@ -134,12 +134,13 @@ export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectExpre
134
134
  stopLoader: (state: ConnectExpressState) => void;
135
135
  resetMobileScreen: (state: ConnectExpressState, action: ActionState<CountryCode>) => void;
136
136
  resetNIDScreen: (state: ConnectExpressState) => void;
137
+ setDefaultCountryCode: (state: ConnectExpressState, action: ActionState<CountryCode>) => void;
137
138
  resetCivilScreen: (state: ConnectExpressState) => void;
138
139
  resetOTPValue: (state: ConnectExpressState) => void;
139
140
  resetStore: (state: ConnectExpressState) => void;
140
141
  resetIndividualScreen: (state: ConnectExpressState) => void;
141
142
  }, "connectExpress/store">;
142
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setShowBoard: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
143
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setShowBoard: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setDefaultCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>;
143
144
  declare const _default: import("redux").Reducer<ConnectExpressState, import("redux").AnyAction>;
144
145
  export default _default;
145
146
  export declare const connectExpressSelector: (state: RootState) => ConnectExpressState;
@@ -549,6 +549,9 @@ export var createNIDAuthIdentityAsync = createAsyncThunk('connectExpress/createN
549
549
  dob = params.dob, nid = params.nid;
550
550
  nidType = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
551
551
  countryCode = settings.data.businessCountry.iso2;
552
+ if (isOtherThanKWOrSA(countryCode)) {
553
+ nidType = IDENTIFICATION_TYPE.NID;
554
+ }
552
555
  requestBody = {
553
556
  id: (_b = connectExpress.data.responseData) === null || _b === void 0 ? void 0 : _b.authData.lead_id,
554
557
  identification: {
@@ -590,6 +593,9 @@ export var resendNIDAuthIdentityOTP = createAsyncThunk('connectExpress/resendNID
590
593
  dob = params.dob, nid = params.nid;
591
594
  nidType = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
592
595
  countryCode = settings.data.businessCountry.iso2;
596
+ if (isOtherThanKWOrSA(countryCode)) {
597
+ nidType = IDENTIFICATION_TYPE.NID;
598
+ }
593
599
  requestBody = {
594
600
  id: (_b = connectExpress.data.responseData) === null || _b === void 0 ? void 0 : _b.authData.lead_id,
595
601
  identification: {
@@ -978,6 +984,10 @@ export var connectSlice = createSlice({
978
984
  resetNIDScreen: function (state) {
979
985
  state.data.nidData = __assign(__assign({}, state.data.nidData), initialState.data.nidData);
980
986
  },
987
+ setDefaultCountryCode: function (state, action) {
988
+ state.data.mobileData.countryCode = action.payload;
989
+ state.data.individualData.countryCode = action.payload;
990
+ },
981
991
  resetCivilScreen: function (state) {
982
992
  state.data.civilIdData = __assign(__assign({}, state.data.civilIdData), initialState.data.civilIdData);
983
993
  },
@@ -1405,6 +1415,6 @@ export var connectSlice = createSlice({
1405
1415
  });
1406
1416
  }
1407
1417
  });
1408
- export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setLeadId = _a.setLeadId, setShowBoard = _a.setShowBoard, resetIndividualScreen = _a.resetIndividualScreen;
1418
+ export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setLeadId = _a.setLeadId, setShowBoard = _a.setShowBoard, resetIndividualScreen = _a.resetIndividualScreen, setDefaultCountryCode = _a.setDefaultCountryCode;
1409
1419
  export default connectSlice.reducer;
1410
1420
  export var connectExpressSelector = function (state) { return state.connectExpress; };
@@ -2,16 +2,20 @@ 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 { useController, useFormContext } from 'react-hook-form';
5
+ import { settingsSelector } from '../../../../app/settings';
5
6
  import { ScreenContainer } from '../../../shared/Containers';
6
7
  import Input from '../../../shared/Input';
7
- import { removeAllCharsFromNumber } from '../../../../utils';
8
+ import { isOtherThanKWOrSA, removeAllCharsFromNumber } from '../../../../utils';
8
9
  import { ID_NUMBER_LENGTH } from '../../../../constants';
10
+ import { useAppSelector } from '../../../../hooks';
9
11
  import { EndAdornment } from '../../../shared/EndAdornment';
10
12
  var IDNumber = function (_a) {
11
13
  var _b;
12
14
  var t = useTranslation().t;
13
15
  var control = useFormContext().control;
14
16
  var nidControl = useController({ control: control, name: 'nid' });
17
+ var settingsData = useAppSelector(settingsSelector).data;
18
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
15
19
  var handleIdChange = function (_a) {
16
20
  var target = _a.target;
17
21
  var value = removeAllCharsFromNumber(target.value);
@@ -22,6 +26,6 @@ var IDNumber = function (_a) {
22
26
  };
23
27
  var nidValue = nidControl.field.value;
24
28
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
25
- return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('enter_national_id'), inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }) }) }));
29
+ return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('enter_national_id'), inputProps: isOtherCountry ? {} : { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: error && t(error, { number: '1' }) }) }));
26
30
  };
27
31
  export default React.memo(IDNumber);
@@ -9,31 +9,21 @@ 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 { useTranslation } from 'react-i18next';
26
15
  import { useForm, FormProvider } from 'react-hook-form';
27
16
  import { styled } from '@mui/material/styles';
28
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
+ import { settingsSelector } from '../../../../app/settings';
29
19
  import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
30
20
  import Form from '../../../../components/Form';
31
21
  import Button from '../../../shared/Button';
32
22
  import { ScreenContainer } from '../../../shared/Containers';
33
23
  import { businessSelector, clearError, updateLeadIdentity } from '../../../app/business/businessStore';
34
24
  import Collapse from '../../../../components/Collapse';
35
- import { deepCopy } from '../../../../utils';
36
- import { NIDValidationSchema } from './validation';
25
+ import { deepCopy, isOtherThanKWOrSA } from '../../../../utils';
26
+ import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
37
27
  import ID from './ID';
38
28
  import DOB from './DOB';
39
29
  var FormStyled = styled(Form)(function () { return ({
@@ -46,13 +36,14 @@ var IDBOD = function (_a) {
46
36
  var dispatch = useAppDispatch();
47
37
  var t = useTranslation().t;
48
38
  var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
49
- var _d = data.nidData, responseBody = _d.responseBody, defaultValues = __rest(_d, ["responseBody"]);
39
+ var settingsData = useAppSelector(settingsSelector).data;
40
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
50
41
  var methods = useForm({
51
- resolver: yupResolver(NIDValidationSchema),
52
- defaultValues: defaultValues,
42
+ resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
43
+ defaultValues: data.nidData,
53
44
  mode: 'onChange'
54
45
  });
55
- useSetFromDefaultValues(methods, defaultValues);
46
+ useSetFromDefaultValues(methods, data.nidData);
56
47
  React.useEffect(function () {
57
48
  if (error)
58
49
  dispatch(clearError());
@@ -9,3 +9,13 @@ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/objec
9
9
  dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
10
  nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>>;
12
+ export declare const NIDOtherCountryValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
20
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ }>>>;
@@ -7,3 +7,7 @@ export var NIDValidationSchema = yup.object().shape({
7
7
  .min(10, 'signup_invalid_national_id')
8
8
  .required('signup_invalid_national_id')
9
9
  });
10
+ export var NIDOtherCountryValidationSchema = yup.object().shape({
11
+ dob: yup.string().min(5).required('enter_valid_birth_date'),
12
+ nid: yup.string().min(3, 'signup_invalid_national_id').required('signup_invalid_national_id')
13
+ });
@@ -46,7 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  }
47
47
  };
48
48
  import { jsx as _jsx } from "react/jsx-runtime";
49
- import React, { memo } from 'react';
49
+ import React, { memo, useState } from 'react';
50
50
  import { createRoot } from 'react-dom/client';
51
51
  import { FeatureContainer } from '../shared/Containers';
52
52
  import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
@@ -63,22 +63,18 @@ import Background from '../shared/Background';
63
63
  var Connect = memo(function (props) {
64
64
  var theme = useAppTheme().theme;
65
65
  var dispatch = useAppDispatch();
66
- var leadId = props.leadId, configToken = props.configToken;
67
- var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
68
- var _b = useAppSelector(connectSelector), connectError = _b.error, loading = _b.loading, customLoading = _b.customLoading;
66
+ var configToken = props.configToken;
67
+ var _a = useState(props.leadId), leadId = _a[0], setLeadId = _a[1];
68
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
69
+ var _c = useAppSelector(connectSelector), connectError = _c.error, loading = _c.loading, customLoading = _c.customLoading;
69
70
  var onVerifyConfigTokenSuccess = function (data) { return __awaiter(void 0, void 0, void 0, function () {
70
71
  var id;
71
72
  return __generator(this, function (_a) {
72
- switch (_a.label) {
73
- case 0:
74
- id = (data === null || data === void 0 ? void 0 : data.lead_id) || leadId;
75
- if (!id) return [3, 2];
76
- return [4, dispatch(retrieveLead(id))];
77
- case 1:
78
- _a.sent();
79
- _a.label = 2;
80
- case 2: return [2];
73
+ id = (data === null || data === void 0 ? void 0 : data.lead_id) || leadId;
74
+ if (id) {
75
+ setLeadId(id);
81
76
  }
77
+ return [2];
82
78
  });
83
79
  }); };
84
80
  useAppConfig(__assign(__assign(__assign({ navigation: CONNECT_SCREENS_NAVIGATION, maturity: 'full' }, props), { configToken: configToken }), (configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
@@ -97,11 +93,11 @@ var Connect = memo(function (props) {
97
93
  if (!settingLoading) {
98
94
  if (isOtherThanKWOrSA((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) || isKW((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2))
99
95
  dispatch(handleCurrentActiveScreen('CONNECT_MOBILE_STEP'));
100
- if (leadId && !configToken) {
96
+ if (leadId) {
101
97
  dispatch(retrieveLead(leadId));
102
98
  }
103
99
  }
104
- }, [settingLoading]);
100
+ }, [settingLoading, leadId]);
105
101
  React.useEffect(function () {
106
102
  var _a, _b, _c;
107
103
  if (!!((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
@@ -64,7 +64,7 @@ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepSta
64
64
  import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
65
65
  import AnimationFlow from '../../components/AnimationFlow';
66
66
  import { store } from '../../app/store';
67
- import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard } from '../app/connectExpress/connectExpressStore';
67
+ import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard, setDefaultCountryCode } from '../app/connectExpress/connectExpressStore';
68
68
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
69
69
  import Collapse from '../../components/Collapse';
70
70
  import { isKW, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA } from '../../utils';
@@ -103,6 +103,12 @@ var ConnectExpress = memo(function (_a) {
103
103
  title: 'Connect Express'
104
104
  });
105
105
  }, []);
106
+ React.useEffect(function () {
107
+ var _a;
108
+ if (!!((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
109
+ dispatch(setDefaultCountryCode(data.businessCountry));
110
+ }
111
+ }, [data.businessCountry]);
106
112
  React.useEffect(function () {
107
113
  if (data.isValidOperator && props.open && !settingLoading) {
108
114
  if (configToken) {
@@ -14,12 +14,14 @@ import * as React from 'react';
14
14
  import Box from '@mui/material/Box';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { useController, useFormContext } from 'react-hook-form';
17
+ import { useAppSelector } from '../../../../hooks';
18
+ import { settingsSelector } from '../../../../app/settings';
17
19
  import { styled, alpha } from '@mui/material/styles';
18
20
  import Text from '../../../../components/Text';
19
21
  import Input from '../../../shared/Input';
20
22
  import Collapse from '../../../../components/Collapse';
21
23
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
22
- import { removeAllCharsFromNumber } from '../../../../utils';
24
+ import { isOtherThanKWOrSA, removeAllCharsFromNumber } from '../../../../utils';
23
25
  import { ID_NUMBER_LENGTH } from '../../../../constants';
24
26
  import { EndAdornment } from '../../../shared/EndAdornment';
25
27
  var LabelContainerStyled = styled(Box)(function (_a) {
@@ -39,7 +41,9 @@ var IDNumber = React.forwardRef(function (_a, ref) {
39
41
  var show = _a.show;
40
42
  var t = useTranslation().t;
41
43
  var control = useFormContext().control;
44
+ var settingsData = useAppSelector(settingsSelector).data;
42
45
  var nidControl = useController({ control: control, name: 'nid' });
46
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
43
47
  var handleIdChange = function (_a) {
44
48
  var target = _a.target;
45
49
  var value = removeAllCharsFromNumber(target.value);
@@ -50,6 +54,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
50
54
  };
51
55
  var nidValue = nidControl.field.value;
52
56
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
53
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
57
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: isOtherCountry ? {} : { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
54
58
  });
55
59
  export default React.memo(IDNumber);
@@ -15,9 +15,9 @@ import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { useForm, FormProvider } from 'react-hook-form';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
- import { NIDValidationSchema } from './validation';
18
+ import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
19
19
  import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
20
- import { handlePrevScreenStep } from '../../../../app/settings';
20
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { clearError, connectExpressSelector, createNIDAuthIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button from '../../../shared/Button';
@@ -25,7 +25,7 @@ import { ScreenContainer } from '../../../shared/Containers';
25
25
  import Collapse from '../../../../components/Collapse';
26
26
  import IDNumber from './IDNumber';
27
27
  import DOB from './DOB';
28
- import { deepCopy } from '../../../../utils';
28
+ import { deepCopy, isOtherThanKWOrSA } from '../../../../utils';
29
29
  var FormStyled = styled(Form)(function () { return ({
30
30
  display: 'flex',
31
31
  flexDirection: 'column'
@@ -35,9 +35,11 @@ var NID = function (_a) {
35
35
  var isAr = useLanguage().isAr;
36
36
  var dispatch = useAppDispatch();
37
37
  var t = useTranslation().t;
38
+ var settingsData = useAppSelector(settingsSelector).data;
38
39
  var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
40
+ var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
39
41
  var methods = useForm({
40
- resolver: yupResolver(NIDValidationSchema),
42
+ resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
41
43
  defaultValues: data.nidData,
42
44
  mode: 'onChange'
43
45
  });
@@ -9,3 +9,13 @@ export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/objec
9
9
  dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
10
  nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>>;
12
+ export declare const NIDOtherCountryValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
+ dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
20
+ nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ }>>>;
@@ -7,3 +7,7 @@ export var NIDValidationSchema = yup.object().shape({
7
7
  .min(10, 'signup_invalid_national_id')
8
8
  .required('signup_invalid_national_id')
9
9
  });
10
+ export var NIDOtherCountryValidationSchema = yup.object().shape({
11
+ dob: yup.string().min(5).required('enter_valid_birth_date'),
12
+ nid: yup.string().min(3, 'signup_invalid_national_id').required('signup_invalid_national_id')
13
+ });
@@ -26,7 +26,7 @@ var MailBoxStyled = styled(Box)(function () { return ({
26
26
  }); });
27
27
  var TitleStyled = styled(Text)(function (_a) {
28
28
  var theme = _a.theme;
29
- return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), lineHeight: 1.75, padding: '0px 20px' }));
29
+ return (__assign(__assign({}, theme.typography.body1), { textAlign: 'center', fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), lineHeight: 1.75, padding: '0px 20px' }));
30
30
  });
31
31
  var DescriptionStyled = styled(Text)(function (_a) {
32
32
  var theme = _a.theme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.13-test",
3
+ "version": "2.6.16-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",