@tap-payments/auth-jsconnect 1.0.24 → 1.0.27

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.
@@ -1,6 +1,5 @@
1
1
  import { CountryCode } from './app';
2
2
  export declare type MobileFormValues = {
3
- businessCountry: CountryCode;
4
3
  mobile: string | null;
5
4
  countryCode: CountryCode;
6
5
  };
@@ -55,6 +55,7 @@ export declare type UpdateLeadBody = {
55
55
  cr_number?: string;
56
56
  is_acknowledged?: boolean;
57
57
  terms_conditions_accepted?: boolean;
58
+ email_url?: string;
58
59
  };
59
60
  declare const leadService: {
60
61
  updateLead: (data: UpdateLeadBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -208,6 +208,7 @@
208
208
  "fl_required": "رقم رخصة العمل الحر مطلوب",
209
209
  "fl_max_length": "طول رخصة العمل الحر يجب ان يكون{{length}}",
210
210
  "absher_button_label": "المتابعة عن طريق أبشر",
211
- "or": "أو",
211
+ "mobile_button_label": "المتابعة عن طريق رقم الجوال",
212
+ "or": " أو",
212
213
  "next": "التالي"
213
214
  }
@@ -222,6 +222,7 @@
222
222
  "fl_required": "Freelance number is required",
223
223
  "fl_max_length": "Freelance number length should be {{length}}",
224
224
  "absher_button_label": "Continue with Absher",
225
+ "mobile_button_label": "Continue with Mobile Number",
225
226
  "or": "Or",
226
227
  "next": "next"
227
228
  }
@@ -6,7 +6,7 @@ export interface FooterProps extends BoxProps {
6
6
  language?: string;
7
7
  }
8
8
  declare const _default: React.MemoExoticComponent<{
9
- ({ followUsTitle, language, onSwitchLanguage, ...rest }: FooterProps): JSX.Element;
9
+ ({ language, onSwitchLanguage, ...rest }: FooterProps): JSX.Element;
10
10
  defaultProps: {
11
11
  followUsTitle: string;
12
12
  language: string;
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import * as React from 'react';
25
25
  import { styled } from '@mui/material/styles';
26
26
  import Text from '../Text';
@@ -31,7 +31,6 @@ import LinkedInIcon from '@mui/icons-material/LinkedIn';
31
31
  import TwitterIcon from '@mui/icons-material/Twitter';
32
32
  import YouTubeIcon from '@mui/icons-material/YouTube';
33
33
  import Box from '@mui/material/Box';
34
- import { SOCIAL_MEDIA_LINKS } from '../../constants/dummy';
35
34
  var FooterStyled = styled(Box)(function (_a) {
36
35
  var theme = _a.theme;
37
36
  return (__assign(__assign({ direction: 'ltr', display: 'flex', margin: theme.spacing(1.5), color: theme.palette.background.paper }, theme.typography.caption), { alignItems: 'center', justifyContent: 'center', position: 'relative', bottom: 0, marginBottom: theme.spacing(-3.75) }));
@@ -90,8 +89,8 @@ var YouTubeIconStyled = styled(YouTubeIcon)(function (_a) {
90
89
  });
91
90
  });
92
91
  var FooterComponent = function (_a) {
93
- var followUsTitle = _a.followUsTitle, language = _a.language, onSwitchLanguage = _a.onSwitchLanguage, rest = __rest(_a, ["followUsTitle", "language", "onSwitchLanguage"]);
94
- return (_jsxs(FooterStyled, __assign({}, rest, { children: [_jsx(FollowUsStyled, { children: followUsTitle }), _jsxs(IconsContainerStyled, { children: [_jsx(LinkStyled, __assign({ href: SOCIAL_MEDIA_LINKS.facebook, target: '_blank' }, { children: _jsx(FacebookIconStyled, { fontSize: 'small' }) })), _jsx(LinkStyled, __assign({ href: SOCIAL_MEDIA_LINKS.instagram, target: '_blank' }, { children: _jsx(InstagramIconStyled, { fontSize: 'small' }) })), _jsx(LinkStyled, __assign({ href: SOCIAL_MEDIA_LINKS.linkedin, target: '_blank' }, { children: _jsx(LinkedInIconStyled, { fontSize: 'small' }) })), _jsx(LinkStyled, __assign({ href: SOCIAL_MEDIA_LINKS.youtube, target: '_blank' }, { children: _jsx(YouTubeIconStyled, { fontSize: 'small' }) })), _jsx(LinkStyled, __assign({ href: SOCIAL_MEDIA_LINKS.twitter, target: '_blank' }, { children: _jsx(TwitterIconStyled, { fontSize: 'small' }) }))] }), _jsx(Text, { children: '|' }), _jsx(LanguageTextStyled, __assign({ onClick: onSwitchLanguage }, { children: language }))] })));
92
+ var language = _a.language, onSwitchLanguage = _a.onSwitchLanguage, rest = __rest(_a, ["language", "onSwitchLanguage"]);
93
+ return (_jsx(FooterStyled, __assign({}, rest, { children: _jsx(LanguageTextStyled, __assign({ onClick: onSwitchLanguage }, { children: language })) })));
95
94
  };
96
95
  FooterComponent.defaultProps = {
97
96
  followUsTitle: 'follow_us',
@@ -30,7 +30,7 @@ var OTPTimerStyled = styled(Box)(function (_a) {
30
30
  return ({
31
31
  display: 'flex',
32
32
  paddingInline: theme.spacing(2.5),
33
- justifyContent: 'end'
33
+ justifyContent: 'flex-end'
34
34
  });
35
35
  });
36
36
  var OTPTimerTextStyled = styled(Text)(function (_a) {
@@ -1,4 +1,5 @@
1
1
  import { ScreenStepNavigation } from '../@types';
2
+ export declare const CLIENT_ORIGIN: string;
2
3
  export declare const LOCAL_STORAGE_KEYS: {
3
4
  themeMode: string;
4
5
  languageMode: string;
@@ -1,3 +1,4 @@
1
+ export var CLIENT_ORIGIN = window.location.origin;
1
2
  export var LOCAL_STORAGE_KEYS = {
2
3
  themeMode: 'themeMode',
3
4
  languageMode: 'languageMode'
@@ -12,15 +13,15 @@ export var EXTERNAL_LINKS = {
12
13
  };
13
14
  export var CONNECT_SCREENS_NAVIGATION = [
14
15
  {
15
- name: 'CONNECT_MOBILE_STEP',
16
+ name: 'CONNECT_NID_STEP',
16
17
  next: 'CONNECT_OTP_STEP',
17
- prev: '',
18
+ prev: 'CONNECT_MOBILE_STEP',
18
19
  order: 1
19
20
  },
20
21
  {
21
- name: 'CONNECT_NID_STEP',
22
+ name: 'CONNECT_MOBILE_STEP',
22
23
  next: 'CONNECT_OTP_STEP',
23
- prev: 'CONNECT_MOBILE_STEP',
24
+ prev: 'CONNECT_NID_STEP',
24
25
  order: 1
25
26
  },
26
27
  {
@@ -53,6 +53,7 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
53
53
  }, void, {}>;
54
54
  export interface ConnectData {
55
55
  countries: Array<CountryCode>;
56
+ businessCountry: CountryCode;
56
57
  mobileData: MobileFormValues & ResponseData;
57
58
  nidData: NIDFormValues & ResponseData & {
58
59
  type: string;
@@ -47,12 +47,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
47
47
  };
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
- import moment from 'moment-hijri';
51
50
  import { handleNextScreenStep } from '../../../app/settings';
52
51
  import API from '../../../api';
53
52
  import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE } from '../../../constants';
54
- import { defaultCountry } from '../../../constants/dummy';
55
- import { convertNumbers2English, getIndividualName } from '../../../utils';
53
+ import { defaultCountry, CLIENT_ORIGIN } from '../../../constants';
54
+ import { getIndividualName } from '../../../utils';
56
55
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
57
56
  var settings, countriesBody, list, businessCountry;
58
57
  return __generator(this, function (_a) {
@@ -66,6 +65,7 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
66
65
  businessCountry = list.find(function (item) {
67
66
  return [item.iso2, item.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
68
67
  });
68
+ console.log('businessCountry', businessCountry);
69
69
  return [2, {
70
70
  businessCountry: businessCountry,
71
71
  countries: list || []
@@ -102,23 +102,19 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
102
102
  });
103
103
  }); });
104
104
  export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
105
- var _a, settings, connect, identification_id_type, birthDate, requestBody, data;
105
+ var _a, settings, connect, identification_id_type, requestBody, data;
106
106
  var _b, _c;
107
107
  return __generator(this, function (_d) {
108
108
  switch (_d.label) {
109
109
  case 0:
110
110
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
111
111
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
112
- birthDate = params.dob;
113
- if (identification_id_type === IDENTIFICATION_TYPE.NID) {
114
- birthDate = convertNumbers2English(moment(birthDate, 'YYYY-MM-DD').format('iYYYY/iMM/iDD')).split('/').join('-');
115
- }
116
112
  requestBody = {
117
113
  user_credentail: {
118
114
  identification_id: params.nid,
119
115
  identification_id_type: identification_id_type,
120
- date_of_birth: birthDate,
121
- country_code: connect.data.mobileData.businessCountry.iso2
116
+ date_of_birth: params.dob,
117
+ country_code: connect.data.businessCountry.iso2
122
118
  },
123
119
  device_info: settings.data.deviceInfo,
124
120
  sign_in: false,
@@ -236,7 +232,14 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
236
232
  : undefined
237
233
  },
238
234
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
239
- encryption_contract: ['name', 'contact.email', 'contact.phone.country_code', 'contact.phone.number']
235
+ encryption_contract: [
236
+ 'name.first',
237
+ 'name.middle',
238
+ 'name.last',
239
+ 'contact.email',
240
+ 'contact.phone.country_code',
241
+ 'contact.phone.number'
242
+ ]
240
243
  };
241
244
  return [4, API.leadService.updateLead(payload, { headers: headers })];
242
245
  case 1:
@@ -344,6 +347,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
344
347
  };
345
348
  payload = {
346
349
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
350
+ email_url: CLIENT_ORIGIN + '/auth/business?token=',
347
351
  encryption_contract: []
348
352
  };
349
353
  return [4, API.leadService.updateLead(payload, { headers: headers })];
@@ -360,10 +364,10 @@ var initialState = {
360
364
  loading: false,
361
365
  searchActive: false,
362
366
  data: {
367
+ businessCountry: defaultCountry,
363
368
  countries: [],
364
369
  mobileData: {
365
370
  countryCode: defaultCountry,
366
- businessCountry: defaultCountry,
367
371
  mobile: null
368
372
  },
369
373
  nidData: {
@@ -412,7 +416,8 @@ export var connectSlice = createSlice({
412
416
  state.error = null;
413
417
  var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
414
418
  state.data.countries = countries;
415
- state.data.mobileData.businessCountry = businessCountry || defaultCountry;
419
+ state.data.businessCountry = businessCountry || defaultCountry;
420
+ state.data.mobileData.countryCode = businessCountry || defaultCountry;
416
421
  })
417
422
  .addCase(getCountries.pending, function (state) {
418
423
  state.error = null;
@@ -14,7 +14,6 @@ import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { ScreenContainer } from '../../../shared/Containers';
16
16
  import Input from '../../../shared/Input';
17
- import { keepEmailCharacters } from '../../../../utils';
18
17
  import { useController, useFormContext } from 'react-hook-form';
19
18
  import ClearIcon from '../../../shared/ClearIcon';
20
19
  import CheckIcon from '../../../shared/CheckIcon';
@@ -35,8 +34,7 @@ var Email = function (_a) {
35
34
  dispatch(checkEmailAvailability(value));
36
35
  }, 500);
37
36
  var handleEmailChange = function (event) {
38
- var value = keepEmailCharacters(event.target.value);
39
- emailControl.field.onChange(value);
37
+ emailControl.field.onChange(event.target.value);
40
38
  };
41
39
  React.useEffect(function () {
42
40
  var isValid = emailValue && !error && emailValue.length > 3;
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { CountryCode } from '../../../../@types';
2
3
  interface BusinessCountryProps {
4
+ country: CountryCode;
3
5
  show: boolean;
4
6
  }
5
7
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BusinessCountryProps & React.RefAttributes<unknown>>>;
@@ -9,45 +9,16 @@ 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 } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
- import Box from '@mui/material/Box';
26
14
  import { styled } from '@mui/material/styles';
27
15
  import { useTranslation } from 'react-i18next';
28
- import { useController, useFormContext } from 'react-hook-form';
29
16
  import Text from '../../../../components/Text';
30
17
  import Collapse from '../../../../components/Collapse';
31
- import CheckIcon from '@mui/icons-material/Check';
32
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
33
19
  import Icon from '../../../../components/Icon';
34
20
  import Input from '../../../shared/Input';
35
21
  import { useLanguage } from '../../../../hooks';
36
- var CountryItemContainer = styled(Box)(function () { return ({
37
- display: 'flex'
38
- }); });
39
- var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
40
- var theme = _a.theme, isSelected = _a.isSelected;
41
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
42
- });
43
- var CheckIconStyled = styled(CheckIcon)(function (_a) {
44
- var theme = _a.theme;
45
- return ({
46
- color: theme.palette.success.main,
47
- display: 'flex',
48
- alignItems: 'flex-end'
49
- });
50
- });
51
22
  var CountrySpanStyled = styled(Text)(function () { return ({
52
23
  cursor: 'pointer'
53
24
  }); });
@@ -61,12 +32,9 @@ var CountryIconStyled = styled(Icon)(function (_a) {
61
32
  });
62
33
  var BusinessCountry = React.forwardRef(function (_a, ref) {
63
34
  var _b, _c;
64
- var rest = __rest(_a, []);
35
+ var country = _a.country, show = _a.show;
65
36
  var t = useTranslation().t;
66
37
  var isAr = useLanguage().isAr;
67
- var control = useFormContext().control;
68
- var businessCountryControl = useController({ control: control, name: 'businessCountry' });
69
- var businessCountry = businessCountryControl.field.value;
70
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsx(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: _jsx(Input, { sx: { cursor: 'auto' }, label: t('signup_select_country'), readOnly: true, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _c === void 0 ? void 0 : _c.english) || '' }) })) })));
38
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: _jsx(Input, { sx: { cursor: 'auto' }, label: t('signup_select_country'), readOnly: true, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (country === null || country === void 0 ? void 0 : country.logo) || '' }) }), placeholder: t('ide_mobile_placeholder'), value: (isAr ? (_b = country === null || country === void 0 ? void 0 : country.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = country === null || country === void 0 ? void 0 : country.name) === null || _c === void 0 ? void 0 : _c.english) || '' }) })) })));
71
39
  });
72
40
  export default React.memo(BusinessCountry);
@@ -21,7 +21,7 @@ import Collapse from '../../../../components/Collapse';
21
21
  import Form from '../../../../components/Form';
22
22
  import Button, { AbsherButton } from '../../../shared/Button';
23
23
  import { useAppDispatch } from '../../../../hooks';
24
- import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
24
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
25
25
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
26
26
  import { clearError, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
27
27
  import { useLanguage } from '../../../../hooks';
@@ -35,6 +35,15 @@ var FormStyled = styled(Form)(function () { return ({
35
35
  display: 'flex',
36
36
  flexDirection: 'column'
37
37
  }); });
38
+ var InputsContainerStyled = styled(Box)(function (_a) {
39
+ var _b;
40
+ var theme = _a.theme;
41
+ return (_b = {},
42
+ _b[theme.transitions.create(['padding-bottom'])] = {
43
+ duration: theme.transitions.duration.standard
44
+ },
45
+ _b);
46
+ });
38
47
  var TextStyled = styled(Text)(function (_a) {
39
48
  var theme = _a.theme;
40
49
  return ({
@@ -59,25 +68,15 @@ var OrBoxStyled = styled(Box)(function (_a) {
59
68
  marginInline: theme.spacing(2.5)
60
69
  });
61
70
  });
62
- var InputsContainerStyled = styled(Box)(function (_a) {
63
- var _b;
64
- var theme = _a.theme;
65
- return (_b = {},
66
- _b[theme.transitions.create(['padding-bottom'])] = {
67
- duration: theme.transitions.duration.standard
68
- },
69
- _b);
70
- });
71
71
  var ListType;
72
72
  (function (ListType) {
73
73
  ListType["BusinessList"] = "BusinessList";
74
74
  ListType["CountryCodeList"] = "CountryCodeList";
75
75
  })(ListType || (ListType = {}));
76
76
  var Mobile = function (_a) {
77
- var _b, _c;
78
- var _d = useSelector(connectSelector), data = _d.data, loading = _d.loading, error = _d.error;
79
- var _e = React.useState((_c = (_b = data.mobileData) === null || _b === void 0 ? void 0 : _b.countryCode) === null || _c === void 0 ? void 0 : _c.digits), mobileLength = _e[0], setMobileLength = _e[1];
80
- var _f = React.useState(), listType = _f[0], setListType = _f[1];
77
+ var _b = useSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
78
+ var _c = React.useState(data.mobileData.countryCode.digits), mobileLength = _c[0], setMobileLength = _c[1];
79
+ var _d = React.useState(), listType = _d[0], setListType = _d[1];
81
80
  var dispatch = useAppDispatch();
82
81
  var methods = useForm({
83
82
  resolver: yupResolver(PhoneValidationSchema(mobileLength)),
@@ -90,6 +89,14 @@ var Mobile = function (_a) {
90
89
  var handleMenuListClick = function (flag) {
91
90
  setListType(flag);
92
91
  };
92
+ React.useEffect(function () {
93
+ if (data.mobileData.countryCode.digits) {
94
+ setMobileLength(data.mobileData.countryCode.digits);
95
+ }
96
+ if (data.mobileData.countryCode) {
97
+ methods.setValue('countryCode', data.mobileData.countryCode);
98
+ }
99
+ }, [data.mobileData]);
93
100
  React.useEffect(function () {
94
101
  if (error)
95
102
  dispatch(clearError());
@@ -97,14 +104,14 @@ var Mobile = function (_a) {
97
104
  var onSubmit = function (formData) {
98
105
  dispatch(createMobileAuth(__assign(__assign({}, formData), { isResend: false })));
99
106
  };
100
- var onAbsherButtonClicked = function () {
101
- dispatch(handleCurrentActiveScreen('CONNECT_NID_STEP'));
107
+ var onBack = function () {
108
+ dispatch(handlePrevScreenStep());
102
109
  };
103
110
  var isBusinessListActive = listType === ListType.BusinessList;
104
111
  var isCountryListActive = listType === ListType.CountryCodeList;
105
112
  var listActive = isBusinessListActive || isCountryListActive;
106
113
  var isLoading = settingsStore.loading || loading;
107
114
  var disabled = !methods.formState.isValid || !!error;
108
- return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(BusinessCountry, { show: !isCountryListActive }), _jsx(MobileNumber, { show: !isBusinessListActive, setMobileLength: setMobileLength, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } })] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ isAr: isAr, disabled: disabled, disableBack: true, loading: isLoading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ isAr: isAr, onClick: onAbsherButtonClicked }, { children: t('absher_button_label') }))] }))] })) }))] }));
115
+ return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(BusinessCountry, { country: data.businessCountry, show: !isCountryListActive }), _jsx(MobileNumber, { show: !isBusinessListActive, setMobileLength: setMobileLength, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } })] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: isLoading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, isAr: isAr }, { children: t('absher_button_label') }))] }))] })) }))] }));
109
116
  };
110
117
  export default React.memo(Mobile);
@@ -13,30 +13,58 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useSelector } from 'react-redux';
15
15
  import { useTranslation } from 'react-i18next';
16
- import { styled } from '@mui/material/styles';
17
- import IDNumber from './IDNumber';
18
- import DOB from './DOB';
16
+ import { alpha, styled } from '@mui/material/styles';
19
17
  import { useForm, FormProvider } from 'react-hook-form';
20
18
  import { yupResolver } from '@hookform/resolvers/yup';
21
19
  import { NIDValidationSchema } from './validation';
22
20
  import { useAppDispatch, useLanguage } from '../../../../hooks';
23
- import { handlePrevScreenStep } from '../../../../app/settings';
21
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
24
22
  import { clearError, connectSelector, createNIDAuth } from '../../../app/connect/connectStore';
25
23
  import Form from '../../../../components/Form';
26
- import Button from '../../../shared/Button';
24
+ import Button, { AbsherButton } from '../../../shared/Button';
27
25
  import { ScreenContainer } from '../../../shared/Containers';
28
26
  import Collapse from '../../../../components/Collapse';
29
27
  import Box from '@mui/material/Box';
28
+ import Divider from '@mui/material/Divider';
29
+ import Text from '../../../../components/Text';
30
+ import IDNumber from './IDNumber';
31
+ import DOB from './DOB';
32
+ import BusinessCountry from '../Mobile/BusinessCountry';
30
33
  var FormStyled = styled(Form)(function () { return ({
31
34
  display: 'flex',
32
35
  flexDirection: 'column'
33
36
  }); });
37
+ var TextStyled = styled(Text)(function (_a) {
38
+ var theme = _a.theme;
39
+ return ({
40
+ color: alpha(theme.palette.primary.dark, 0.4)
41
+ });
42
+ });
43
+ var DividerStyled = styled(Divider)(function (_a) {
44
+ var theme = _a.theme;
45
+ return ({
46
+ width: '45%',
47
+ borderColor: alpha(theme.palette.primary.dark, 0.4),
48
+ marginBlockEnd: theme.spacing(0.62)
49
+ });
50
+ });
51
+ var OrBoxStyled = styled(Box)(function (_a) {
52
+ var theme = _a.theme;
53
+ return ({
54
+ display: 'flex',
55
+ justifyContent: 'space-between',
56
+ marginBlockEnd: theme.spacing(1.62),
57
+ marginBlockStart: theme.spacing(-1.25),
58
+ marginInline: theme.spacing(2.5)
59
+ });
60
+ });
34
61
  var NID = function (_a) {
35
62
  var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
36
63
  var isAr = useLanguage().isAr;
37
64
  var dispatch = useAppDispatch();
38
65
  var t = useTranslation().t;
39
66
  var _c = useSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
67
+ var settingsStore = useSelector(settingsSelector);
40
68
  var methods = useForm({
41
69
  resolver: yupResolver(NIDValidationSchema),
42
70
  defaultValues: data.nidData,
@@ -51,14 +79,15 @@ var NID = function (_a) {
51
79
  var handleCollapseOpenClose = function (flag) {
52
80
  setCollapse(flag);
53
81
  };
54
- var onBack = function () {
55
- dispatch(handlePrevScreenStep());
56
- };
57
82
  var handleClearError = function () {
58
83
  if (error)
59
84
  dispatch(clearError());
60
85
  };
86
+ var onBack = function () {
87
+ dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
88
+ };
61
89
  var disabled = !methods.formState.isValid || !!error;
62
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Box, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }) }))] })) })) }));
90
+ var isLoading = settingsStore.loading || loading;
91
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BusinessCountry, { show: !collapse, country: data.businessCountry }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: isLoading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ onClick: function () { return onBack(); }, disabled: loading, hideIcon: true, isAr: isAr }, { children: t('mobile_button_label') }))] }))] })) })) }));
63
92
  };
64
93
  export default React.memo(NID);
@@ -44,7 +44,6 @@ var OTPInput = function (_a) {
44
44
  if (otpControl.field.value)
45
45
  setValue('otp', '', { shouldValidate: true });
46
46
  var params = {
47
- businessCountry: mobileData.businessCountry,
48
47
  countryCode: mobileData.countryCode,
49
48
  mobile: mobileData.mobile
50
49
  };
@@ -23,14 +23,14 @@ import BankSuccessPage from './bank/screens/Success';
23
23
  import TaxDetailsPage from './tax/screens/TaxDetails';
24
24
  import TaxSuccessPage from './tax/screens/Success';
25
25
  export var connectFeatureScreens = [
26
- {
27
- name: 'CONNECT_MOBILE_STEP',
28
- element: MobileScreen
29
- },
30
26
  {
31
27
  name: 'CONNECT_NID_STEP',
32
28
  element: NIDScreen
33
29
  },
30
+ {
31
+ name: 'CONNECT_MOBILE_STEP',
32
+ element: MobileScreen
33
+ },
34
34
  {
35
35
  name: 'CONNECT_OTP_STEP',
36
36
  element: ConnectOTPScreen
@@ -3,6 +3,7 @@ import { ButtonProps } from '../../../components/Button';
3
3
  interface AbsherButtonProps extends ButtonProps {
4
4
  isAr: boolean;
5
5
  loading?: boolean;
6
+ hideIcon?: boolean;
6
7
  }
7
- export default function AbsherButton({ children, isAr, disabled, ...props }: AbsherButtonProps): JSX.Element;
8
+ export default function AbsherButton({ children, isAr, hideIcon, disabled, ...props }: AbsherButtonProps): JSX.Element;
8
9
  export {};
@@ -65,6 +65,6 @@ var ButtonStyled = styled(Button)(function (_a) {
65
65
  });
66
66
  });
67
67
  export default function AbsherButton(_a) {
68
- var children = _a.children, isAr = _a.isAr, disabled = _a.disabled, props = __rest(_a, ["children", "isAr", "disabled"]);
69
- return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ disabled: disabled, startIcon: _jsx(IconStyled, { src: ICONS_NAMES.ABSHER_LOGO }) }, props, { children: children })) }));
68
+ var children = _a.children, isAr = _a.isAr, hideIcon = _a.hideIcon, disabled = _a.disabled, props = __rest(_a, ["children", "isAr", "hideIcon", "disabled"]);
69
+ return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { src: ICONS_NAMES.ABSHER_LOGO }) }, props, { children: children })) }));
70
70
  }
@@ -67,6 +67,7 @@ var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return
67
67
  var BackButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
68
68
  var theme = _a.theme, isAr = _a.isAr;
69
69
  return ({
70
+ minWidth: theme.spacing(5),
70
71
  paddingInlineStart: theme.spacing(2.5),
71
72
  width: '10%',
72
73
  zIndex: 1,
@@ -12,5 +12,5 @@ export default function CustomFooter() {
12
12
  var language = isEn ? LanguageMode.AR : LanguageMode.EN;
13
13
  dispatch(handleLanguage(language));
14
14
  };
15
- return _jsx(Footer, { onSwitchLanguage: handleChangeLanguage, followUsTitle: t('follow_us'), language: t('language') });
15
+ return _jsx(Footer, { onSwitchLanguage: handleChangeLanguage, language: t('language') });
16
16
  }
@@ -50,7 +50,7 @@ export var useAppConfig = function (_a) {
50
50
  };
51
51
  useEffect(function () {
52
52
  if (data.appConfig.language)
53
- handleLanguage(data.appConfig.language);
53
+ dispatch(handleLanguage(data.appConfig.language));
54
54
  }, [data.appConfig.language]);
55
55
  useEffect(function () {
56
56
  if (device.os.name && browser.name && publicKey) {
package/package.json CHANGED
@@ -1,126 +1,126 @@
1
- {
2
- "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.24",
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": "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": "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-dom": "^18.2.0",
96
- "react-hook-form": "^7.33.1",
97
- "react-i18next": "^11.18.1",
98
- "react-otp-input": "^2.4.0",
99
- "react-redux": "^8.0.2",
100
- "react-spring-bottom-sheet": "^3.4.1",
101
- "yup": "^0.32.11"
102
- },
103
- "peerDependencies": {
104
- "react": "^18.2.0",
105
- "react-dom": "^18.2.0"
106
- },
107
- "lint-staged": {
108
- "src/**/*.{ts,tsx,json,js,jsx}": [
109
- "yarn run prettier:fix",
110
- "yarn run lint",
111
- "git add ."
112
- ]
113
- },
114
- "browserslist": {
115
- "production": [
116
- ">0.2%",
117
- "not dead",
118
- "not op_mini all"
119
- ],
120
- "development": [
121
- "last 1 chrome version",
122
- "last 1 firefox version",
123
- "last 1 safari version"
124
- ]
125
- }
126
- }
1
+ {
2
+ "name": "@tap-payments/auth-jsconnect",
3
+ "version": "1.0.27",
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": "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": "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-dom": "^18.2.0",
96
+ "react-hook-form": "^7.33.1",
97
+ "react-i18next": "^11.18.1",
98
+ "react-otp-input": "^2.4.0",
99
+ "react-redux": "^8.0.2",
100
+ "react-spring-bottom-sheet": "^3.4.1",
101
+ "yup": "^0.32.11"
102
+ },
103
+ "peerDependencies": {
104
+ "react": "^18.2.0",
105
+ "react-dom": "^18.2.0"
106
+ },
107
+ "lint-staged": {
108
+ "src/**/*.{ts,tsx,json,js,jsx}": [
109
+ "yarn run prettier:fix",
110
+ "yarn run lint",
111
+ "git add ."
112
+ ]
113
+ },
114
+ "browserslist": {
115
+ "production": [
116
+ ">0.2%",
117
+ "not dead",
118
+ "not op_mini all"
119
+ ],
120
+ "development": [
121
+ "last 1 chrome version",
122
+ "last 1 firefox version",
123
+ "last 1 safari version"
124
+ ]
125
+ }
126
+ }