@tap-payments/auth-jsconnect 1.0.60 → 1.0.61

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 (33) hide show
  1. package/build/assets/locales/ar.json +2 -1
  2. package/build/assets/locales/en.json +2 -1
  3. package/build/constants/app.js +1 -1
  4. package/build/features/Landing/Landing.js +5 -8
  5. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +6 -20
  6. package/build/features/app/connect/connectStore.js +27 -19
  7. package/build/features/business/screens/BusinessType/LicenseNumber.js +1 -1
  8. package/build/features/business/screens/Success/Success.js +3 -2
  9. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +2 -1
  10. package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
  11. package/package.json +1 -1
  12. package/build/features/business/screens/BusinessType/CRNumber.d.ts +0 -7
  13. package/build/features/business/screens/BusinessType/CRNumber.js +0 -41
  14. package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +0 -11
  15. package/build/features/business/screens/BusinessType/CompanyLicense.js +0 -127
  16. package/build/features/business/screens/BusinessType/FLNumber.d.ts +0 -7
  17. package/build/features/business/screens/BusinessType/FLNumber.js +0 -41
  18. package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +0 -11
  19. package/build/features/business/screens/BusinessType/FreelanceLicense.js +0 -127
  20. package/build/features/business/screens/Confirm/Confirm.d.ts +0 -5
  21. package/build/features/business/screens/Confirm/Confirm.js +0 -56
  22. package/build/features/business/screens/Confirm/index.d.ts +0 -3
  23. package/build/features/business/screens/Confirm/index.js +0 -2
  24. package/build/features/connect/screens/Mobile/BusinessCountry.d.ts +0 -8
  25. package/build/features/connect/screens/Mobile/BusinessCountry.js +0 -40
  26. package/build/features/connect/screens/Password/Password.d.ts +0 -5
  27. package/build/features/connect/screens/Password/Password.js +0 -60
  28. package/build/features/connect/screens/Password/PasswordInput.d.ts +0 -5
  29. package/build/features/connect/screens/Password/PasswordInput.js +0 -39
  30. package/build/features/connect/screens/Password/index.d.ts +0 -3
  31. package/build/features/connect/screens/Password/index.js +0 -2
  32. package/build/features/connect/screens/Password/validation.d.ts +0 -8
  33. package/build/features/connect/screens/Password/validation.js +0 -4
@@ -231,5 +231,6 @@
231
231
  "tax_flow_pending": "Tax",
232
232
  "individual_flow_pending": "Individual",
233
233
  "bank_flow_pending": "Bank",
234
- "password_flow_pending": "Password"
234
+ "password_flow_pending": "Password",
235
+ "continue": "Continue"
235
236
  }
@@ -245,5 +245,6 @@
245
245
  "tax_flow_pending": "Tax",
246
246
  "individual_flow_pending": "Individual",
247
247
  "bank_flow_pending": "Bank",
248
- "password_flow_pending": "Password"
248
+ "password_flow_pending": "Password",
249
+ "continue": "Continue"
249
250
  }
@@ -95,7 +95,7 @@ export var BUSINESS_SCREENS_NAVIGATION = [
95
95
  },
96
96
  {
97
97
  name: 'BUSINESS_SUCCESS_STEP',
98
- next: '',
98
+ next: 'BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
99
99
  prev: 'BUSINESS_CUSTOMERS_STEP',
100
100
  order: 6
101
101
  },
@@ -13,15 +13,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React, { memo, useEffect } from 'react';
14
14
  import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig } from '../../hooks';
15
15
  import { settingsSelector } from '../../app/settings';
16
- import AnimationFlow from '../../components/AnimationFlow';
17
16
  import { store } from '../../app/store';
18
17
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
18
  import Collapse from '../../components/Collapse';
20
19
  import { getParameterByName, reactElement } from '../../utils';
21
- import { FeatureContainer } from '../shared/Containers';
22
20
  import { LANDING_SCREENS_NAVIGATION } from '../../constants';
23
21
  import { landingFeatureScreens } from '../featuresScreens';
24
- import CustomFooter from '../shared/Footer';
25
22
  import { verifyAuthToken } from '../app/landing/landingStore';
26
23
  var Landing = memo(function (props) {
27
24
  var open = React.useState(true)[0];
@@ -41,11 +38,11 @@ var Landing = memo(function (props) {
41
38
  if (!loading)
42
39
  verifyToken();
43
40
  }, [loading]);
44
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: landingFeatureScreens.map(function (_a, index) {
45
- var Element = _a.element, name = _a.name;
46
- var isActive = activeScreen.name === name;
47
- return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
48
- }) }) })) })));
41
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: landingFeatureScreens.map(function (_a, index) {
42
+ var Element = _a.element, name = _a.name;
43
+ var isActive = activeScreen.name === name;
44
+ return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
45
+ }) })));
49
46
  });
50
47
  export function LandingLib(props) {
51
48
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Landing, __assign({}, props)) })));
@@ -4,32 +4,18 @@ import Box from '@mui/material/Box/Box';
4
4
  import { styled } from '@mui/material/styles';
5
5
  import { settingsSelector } from '../../../../app/settings';
6
6
  import { landingSelector } from '../../../app/landing/landingStore';
7
- import BouncingDotsLoader from '../../../shared/BouncingDotsLoader';
8
7
  import { useAppSelector } from '../../../../hooks';
9
- import Text from '../../../../components/Text';
8
+ import Loader from '../../../../components/AnimationFlow/Loader';
9
+ import Error from '../../../../components/AnimationFlow/Error';
10
10
  import { getParameterByName } from '../../../../utils';
11
- var TextStyledWithThreeDots = styled(Text)(function (_a) {
12
- var theme = _a.theme;
13
- return ({
14
- fontWeight: theme.typography.fontWeightBold,
15
- fontSize: theme.spacing(3),
16
- color: theme.palette.text.primary,
17
- marginBottom: '5px'
18
- });
19
- });
20
11
  var ScreenContainerStyled = styled(Box)(function (_a) {
21
12
  var theme = _a.theme;
22
13
  return ({
23
14
  display: 'flex',
24
- height: theme.spacing(23),
25
15
  justifyContent: 'center',
26
- alignItems: 'center'
27
- });
28
- });
29
- var ContainerStyled = styled(Box)(function (_a) {
30
- var theme = _a.theme;
31
- return ({
32
- display: 'flex'
16
+ alignItems: 'center',
17
+ width: '100vw',
18
+ height: '100vh'
33
19
  });
34
20
  });
35
21
  var VerifyAndRedirect = function (_a) {
@@ -50,6 +36,6 @@ var VerifyAndRedirect = function (_a) {
50
36
  }, 300);
51
37
  }
52
38
  }, [data.verify.responseBody]);
53
- return (_jsxs(ScreenContainerStyled, { children: [isLoading && (_jsxs(ContainerStyled, { children: [_jsx(TextStyledWithThreeDots, { children: "Verifying" }), _jsx(BouncingDotsLoader, {})] })), errorMessage && _jsx(TextStyledWithThreeDots, { children: errorMessage }), !isLoading && !errorMessage && _jsx(TextStyledWithThreeDots, { children: "Verified" })] }));
39
+ return (_jsxs(ScreenContainerStyled, { children: [isLoading && _jsx(Loader, {}), errorMessage && _jsx(Error, { error: errorMessage }), !isLoading && !errorMessage && _jsx(Error, { error: 'verified' })] }));
54
40
  };
55
41
  export default React.memo(VerifyAndRedirect);
@@ -259,14 +259,18 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
259
259
  });
260
260
  }); });
261
261
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
262
- var _a, settings, connect, instagram, twitter, payload, data;
263
- var _b, _c, _d, _e, _f, _g, _h, _j;
264
- return __generator(this, function (_k) {
265
- switch (_k.label) {
262
+ var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
263
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
264
+ return __generator(this, function (_m) {
265
+ switch (_m.label) {
266
266
  case 0:
267
267
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
268
- instagram = !!((_b = params.links) === null || _b === void 0 ? void 0 : _b.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_c = params.links) === null || _c === void 0 ? void 0 : _c.twitter) : '';
269
- twitter = !!((_d = params.links) === null || _d === void 0 ? void 0 : _d.twitter) ? "".concat(TWITTER_URL, "/").concat((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) : '';
268
+ 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.twitter) : '';
269
+ twitter = !!((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) ? "".concat(TWITTER_URL, "/").concat((_f = params.links) === null || _f === void 0 ? void 0 : _f.twitter) : '';
270
+ _b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData, otpData = _b.otpData, brandData = _b.brandData;
271
+ isAbsher = otpData.isAbsher;
272
+ responseBody = (isAbsher ? nidData : mobileData).responseBody;
273
+ isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
270
274
  payload = {
271
275
  brand: {
272
276
  name: {
@@ -274,20 +278,20 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
274
278
  ar: params.brandName,
275
279
  zh: params.brandName
276
280
  },
277
- website: (_f = params.links) === null || _f === void 0 ? void 0 : _f.website,
281
+ website: (_g = params.links) === null || _g === void 0 ? void 0 : _g.website,
278
282
  social: [twitter, instagram]
279
283
  },
280
- id: ((_g = connect.data.otpData.responseBody) === null || _g === void 0 ? void 0 : _g.lead_id) || '',
284
+ 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) || '',
281
285
  terms_conditions_accepted: params.termAndConditionChecked,
282
286
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
283
287
  encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'social[0]', 'social[1]']
284
288
  };
285
289
  return [4, API.leadService.updateLead(payload)];
286
290
  case 1:
287
- data = (_k.sent()).data;
291
+ data = (_m.sent()).data;
288
292
  if (!data.errors) {
289
293
  thunkApi.dispatch(handleNextScreenStep());
290
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, params);
294
+ (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, params);
291
295
  }
292
296
  return [2, { response: data, formData: params }];
293
297
  }
@@ -336,23 +340,27 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
336
340
  });
337
341
  });
338
342
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
339
- var _a, settings, connect, payload, data;
340
- var _b, _c, _d, _e, _f;
341
- return __generator(this, function (_g) {
342
- switch (_g.label) {
343
+ var _a, settings, connect, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
344
+ var _c, _d, _e, _f, _g, _h;
345
+ return __generator(this, function (_j) {
346
+ switch (_j.label) {
343
347
  case 0:
344
348
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
349
+ _b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData, otpData = _b.otpData, brandData = _b.brandData;
350
+ isAbsher = otpData.isAbsher;
351
+ responseBody = (isAbsher ? nidData : mobileData).responseBody;
352
+ isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
345
353
  payload = {
346
354
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
347
355
  email_url: getClientEmailUrl(),
348
- id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
356
+ id: (isExistingUser ? (_c = brandData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id : (_d = otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
349
357
  encryption_contract: []
350
358
  };
351
359
  return [4, API.leadService.updateLead(payload)];
352
360
  case 1:
353
- data = (_g.sent()).data;
354
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
355
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
361
+ data = (_j.sent()).data;
362
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
363
+ (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
356
364
  return [2, { response: data, formData: params }];
357
365
  }
358
366
  });
@@ -608,7 +616,7 @@ export var connectSlice = createSlice({
608
616
  .addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
609
617
  var _a;
610
618
  state.error = null;
611
- state.data.brandData.responseBody = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response;
619
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response);
612
620
  })
613
621
  .addCase(checkBrandNameAvailability.pending, function (state) {
614
622
  state.error = null;
@@ -41,6 +41,6 @@ var LicenseNumber = function (_a) {
41
41
  var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
42
42
  var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
43
43
  var label = isCR ? 'cr_number' : 'fl_number';
44
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '0123456789' : '12345678', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
44
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '01f3c5x78n' : '1a3c5b78', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
45
45
  };
46
46
  export default React.memo(LicenseNumber);
@@ -4,6 +4,7 @@ import { useAppDispatch } from '../../../../hooks';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import SuccessScreen from '../../../shared/SuccessScreen';
6
6
  import { updateLeadSuccess } from '../../../app/business/businessStore';
7
+ import { handleNextScreenStep } from '../../../../app/settings';
7
8
  var Success = function (_a) {
8
9
  var t = useTranslation().t;
9
10
  var dispatch = useAppDispatch();
@@ -11,8 +12,8 @@ var Success = function (_a) {
11
12
  dispatch(updateLeadSuccess());
12
13
  }, []);
13
14
  var onSuccess = function () {
14
- window.open('mailto:');
15
+ dispatch(handleNextScreenStep());
15
16
  };
16
- return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
17
+ return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess, successTitle: 'continue' });
17
18
  };
18
19
  export default React.memo(Success);
@@ -3,6 +3,7 @@ export interface ThankYouProps {
3
3
  title?: string;
4
4
  onSuccess?: () => void;
5
5
  showEmailProviders?: boolean;
6
+ successTitle?: string;
6
7
  }
7
- declare const _default: React.MemoExoticComponent<({ title, showEmailProviders, onSuccess }: ThankYouProps) => JSX.Element>;
8
+ declare const _default: React.MemoExoticComponent<({ title, showEmailProviders, onSuccess, successTitle }: ThankYouProps) => JSX.Element>;
8
9
  export default _default;
@@ -64,9 +64,9 @@ var IconStyled = styled(Icon)(function (_a) {
64
64
  _b);
65
65
  });
66
66
  var ThankYou = function (_a) {
67
- var title = _a.title, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess;
67
+ var title = _a.title, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle;
68
68
  var t = useTranslation().t;
69
69
  var isAr = useLanguage().isAr;
70
- return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('open_gmail'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('open_outlook'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('open_apple'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t('open_mail_box') })) }))] }));
70
+ return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(IconStyled, { src: ICONS_NAMES.EMAIL_ICON, alt: 'loading...' }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('open_gmail'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('open_outlook'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('open_apple'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t(successTitle || 'open_mail_box') })) }))] }));
71
71
  };
72
72
  export default React.memo(ThankYou);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- interface CRNumberProps {
3
- show: boolean;
4
- readOnly: boolean;
5
- }
6
- declare const _default: React.MemoExoticComponent<({ show, readOnly }: CRNumberProps) => JSX.Element>;
7
- export default _default;
@@ -1,41 +0,0 @@
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 { useController, useFormContext } from 'react-hook-form';
16
- import { CR_NUMBER_LENGTH } from '../../../../constants';
17
- import { removeAllCharsFromNumber } from '../../../../utils';
18
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
- import ClearIcon from '../../../shared/ClearIcon';
20
- import CheckIcon from '../../../shared/CheckIcon';
21
- import Input from '../../../shared/Input';
22
- import Collapse from '../../../../components/Collapse';
23
- var CRNumber = function (_a) {
24
- var _b;
25
- var show = _a.show, readOnly = _a.readOnly;
26
- var t = useTranslation().t;
27
- var control = useFormContext().control;
28
- var crNumberControl = useController({ control: control, name: 'crNumber' });
29
- var handleFLNumberChange = function (_a) {
30
- var target = _a.target;
31
- var value = removeAllCharsFromNumber(target.value);
32
- crNumberControl.field.onChange(value);
33
- };
34
- var clearCRNumber = function () {
35
- crNumberControl.field.onChange('');
36
- };
37
- var crNumberValue = crNumberControl.field.value;
38
- var error = (_b = crNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
39
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t('enter_commercial_register_no'), onChange: handleFLNumberChange, inputProps: { maxLength: CR_NUMBER_LENGTH }, value: crNumberValue, endAdornment: (crNumberValue === null || crNumberValue === void 0 ? void 0 : crNumberValue.length) === CR_NUMBER_LENGTH ? (_jsx(CheckIcon, {})) : (crNumberValue && _jsx(ClearIcon, { onClick: clearCRNumber })), placeholder: '0123456789', warningType: 'alert', warningMessage: error && t(error, { length: CR_NUMBER_LENGTH }) }) }) })));
40
- };
41
- export default React.memo(CRNumber);
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import { License } from '../../../../@types';
3
- interface CompanyLicenseProps {
4
- show: boolean;
5
- list: Array<License>;
6
- onSelectLicense?: (number: string) => void;
7
- onListOpen?: () => void;
8
- onListClose?: () => void;
9
- }
10
- declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: CompanyLicenseProps) => JSX.Element>;
11
- export default _default;
@@ -1,127 +0,0 @@
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
- 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
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
- if (ar || !(i in from)) {
26
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
- ar[i] = from[i];
28
- }
29
- }
30
- return to.concat(ar || Array.prototype.slice.call(from));
31
- };
32
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
33
- import * as React from 'react';
34
- import { useTranslation } from 'react-i18next';
35
- import { useFormContext } from 'react-hook-form';
36
- import Box from '@mui/material/Box';
37
- import { styled } from '@mui/material/styles';
38
- import { useLanguage } from '../../../../hooks';
39
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
40
- import Input from '../../../shared/Input';
41
- import CheckIcon from '../../../shared/CheckIcon';
42
- import SimpleList from '../../../../components/SimpleList';
43
- import Text from '../../../../components/Text';
44
- import ExpandIcon from '../../../../components/ExpandIcon';
45
- import Collapse from '../../../../components/Collapse';
46
- import { OTHER_LICENSE } from '../../../../constants';
47
- import CRNumber from './CRNumber';
48
- var InputStyled = styled(Input)(function (_a) {
49
- var theme = _a.theme;
50
- return ({
51
- marginBottom: theme.spacing(2.5),
52
- '& .MuiInputBase-input': {
53
- cursor: 'pointer'
54
- }
55
- });
56
- });
57
- var LicenseContainer = styled(Box)(function () { return ({
58
- display: 'flex'
59
- }); });
60
- var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
61
- var theme = _a.theme, isSelected = _a.isSelected;
62
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
63
- });
64
- var CompanyLicense = function (_a) {
65
- var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
66
- var _b = React.useState(list), licenseList = _b[0], setLicenseList = _b[1];
67
- var _c = React.useState(), selectedLicense = _c[0], setSelectedLicense = _c[1];
68
- var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
69
- var t = useTranslation().t;
70
- var isAr = useLanguage().isAr;
71
- var setValue = useFormContext().setValue;
72
- var onOpenLicenseList = function (event) {
73
- var _a;
74
- setAnchorEl(event.currentTarget);
75
- (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
76
- };
77
- var onCloseLicenseList = function () {
78
- var _a;
79
- setAnchorEl(null);
80
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
81
- };
82
- React.useEffect(function () {
83
- var array = list;
84
- if ((array === null || array === void 0 ? void 0 : array.length) > 0) {
85
- var hasOther = array === null || array === void 0 ? void 0 : array.find(function (item) { return isOtherLicense(item); });
86
- var first = array[0];
87
- if (first) {
88
- setSelectedLicense(first);
89
- setValue('crNumber', getLicenseNumber(first), { shouldValidate: true });
90
- if (!hasOther)
91
- array = __spreadArray(__spreadArray([], array, true), [OTHER_LICENSE], false);
92
- setLicenseList(array);
93
- }
94
- }
95
- }, [show, list]);
96
- var getLicenseNumber = function (item) {
97
- var _a;
98
- return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
99
- };
100
- var getLicenseName = function (item) {
101
- var _a, _b;
102
- return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
103
- };
104
- var isOtherLicense = function (item) {
105
- var _a;
106
- return ((_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.en) === 'other';
107
- };
108
- var onSelectItem = function (license) {
109
- setSelectedLicense(license);
110
- onCloseLicenseList();
111
- if (isOtherLicense(license))
112
- setValue('crNumber', '');
113
- else
114
- setValue('crNumber', getLicenseNumber(license), { shouldValidate: true });
115
- };
116
- var hasList = (licenseList === null || licenseList === void 0 ? void 0 : licenseList.length) > 0;
117
- var showCRNumber = !anchorEl;
118
- var crReadonly = !isOtherLicense(selectedLicense);
119
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_commercial_register_no'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
120
- return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selectedLicense) }, { children: isOtherLicense(item)
121
- ? t(getLicenseNumber(item))
122
- : isAr
123
- ? getLicenseName(item)
124
- : getLicenseNumber(item) + '-' + getLicenseName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selectedLicense) && _jsx(CheckIcon, {})] }));
125
- } }) }))] })), _jsx(CRNumber, { show: showCRNumber, readOnly: crReadonly })] }) })));
126
- };
127
- export default React.memo(CompanyLicense);
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- interface FLNumberProps {
3
- show: boolean;
4
- readOnly: boolean;
5
- }
6
- declare const _default: React.MemoExoticComponent<({ show, readOnly }: FLNumberProps) => JSX.Element>;
7
- export default _default;
@@ -1,41 +0,0 @@
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 { useController, useFormContext } from 'react-hook-form';
16
- import { FL_NUMBER_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
18
- import CheckIcon from '../../../shared/CheckIcon';
19
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
20
- import ClearIcon from '../../../shared/ClearIcon';
21
- import Input from '../../../shared/Input';
22
- import Collapse from '../../../../components/Collapse';
23
- var FLNumber = function (_a) {
24
- var _b;
25
- var show = _a.show, readOnly = _a.readOnly;
26
- var t = useTranslation().t;
27
- var control = useFormContext().control;
28
- var flNumberControl = useController({ control: control, name: 'flNumber' });
29
- var handleFLNumberChange = function (_a) {
30
- var target = _a.target;
31
- var value = removeAllOtherThanCharsAndNumber(target.value);
32
- flNumberControl.field.onChange(value);
33
- };
34
- var clearFLNumber = function () {
35
- flNumberControl.field.onChange('');
36
- };
37
- var flNumberValue = flNumberControl.field.value;
38
- var error = (_b = flNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
39
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t('enter_license_no'), onChange: handleFLNumberChange, inputProps: { maxLength: FL_NUMBER_LENGTH }, value: flNumberValue, endAdornment: (flNumberValue === null || flNumberValue === void 0 ? void 0 : flNumberValue.length) === FL_NUMBER_LENGTH ? (_jsx(CheckIcon, {})) : (flNumberValue && _jsx(ClearIcon, { onClick: clearFLNumber })), placeholder: '12345678', warningType: 'alert', warningMessage: error && t(error, { length: FL_NUMBER_LENGTH }) }) }) })));
40
- };
41
- export default React.memo(FLNumber);
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import { License } from '../../../../@types';
3
- interface FreelanceLicenseProps {
4
- show: boolean;
5
- list: Array<License>;
6
- onSelectLicense?: (number: string) => void;
7
- onListOpen?: () => void;
8
- onListClose?: () => void;
9
- }
10
- declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: FreelanceLicenseProps) => JSX.Element>;
11
- export default _default;
@@ -1,127 +0,0 @@
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
- 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
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
- if (ar || !(i in from)) {
26
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
- ar[i] = from[i];
28
- }
29
- }
30
- return to.concat(ar || Array.prototype.slice.call(from));
31
- };
32
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
33
- import * as React from 'react';
34
- import { useTranslation } from 'react-i18next';
35
- import { useFormContext } from 'react-hook-form';
36
- import Box from '@mui/material/Box';
37
- import { styled } from '@mui/material/styles';
38
- import Text from '../../../../components/Text';
39
- import Collapse from '../../../../components/Collapse';
40
- import { useLanguage } from '../../../../hooks';
41
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
42
- import CheckIcon from '../../../shared/CheckIcon';
43
- import ExpandIcon from '../../../../components/ExpandIcon';
44
- import Input from '../../../shared/Input';
45
- import { OTHER_LICENSE } from '../../../../constants';
46
- import SimpleList from '../../../../components/SimpleList';
47
- import FLNumber from './FLNumber';
48
- var InputStyled = styled(Input)(function (_a) {
49
- var theme = _a.theme;
50
- return ({
51
- marginBottom: theme.spacing(2.5),
52
- '& .MuiInputBase-input': {
53
- cursor: 'pointer'
54
- }
55
- });
56
- });
57
- var LicenseContainer = styled(Box)(function () { return ({
58
- display: 'flex'
59
- }); });
60
- var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
61
- var theme = _a.theme, isSelected = _a.isSelected;
62
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
63
- });
64
- var FreelanceLicense = function (_a) {
65
- var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
66
- var _b = React.useState(list), licenseList = _b[0], setLicenseList = _b[1];
67
- var _c = React.useState(), selectedLicense = _c[0], setSelectedLicense = _c[1];
68
- var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
69
- var t = useTranslation().t;
70
- var isAr = useLanguage().isAr;
71
- var setValue = useFormContext().setValue;
72
- var onOpenLicenseList = function (event) {
73
- var _a;
74
- setAnchorEl(event.currentTarget);
75
- (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
76
- };
77
- var onCloseLicenseList = function () {
78
- var _a;
79
- setAnchorEl(null);
80
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
81
- };
82
- React.useEffect(function () {
83
- var array = list;
84
- if ((array === null || array === void 0 ? void 0 : array.length) > 0) {
85
- var hasOther = array === null || array === void 0 ? void 0 : array.find(function (item) { return isOtherLicense(item); });
86
- var first = array[0];
87
- if (!!first) {
88
- setSelectedLicense(first);
89
- setValue('flNumber', getLicenseNumber(first), { shouldValidate: true });
90
- if (!hasOther)
91
- array = __spreadArray(__spreadArray([], array, true), [OTHER_LICENSE], false);
92
- setLicenseList(array);
93
- }
94
- }
95
- }, [show, list]);
96
- var getLicenseNumber = function (item) {
97
- var _a;
98
- return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
99
- };
100
- var isOtherLicense = function (item) {
101
- var _a;
102
- return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) === 'other';
103
- };
104
- var getLicenseName = function (item) {
105
- var _a, _b;
106
- return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
107
- };
108
- var onSelectItem = function (license) {
109
- setSelectedLicense(license);
110
- onCloseLicenseList();
111
- if (isOtherLicense(license))
112
- setValue('flNumber', '');
113
- else
114
- setValue('flNumber', getLicenseNumber(license), { shouldValidate: true });
115
- };
116
- var hasList = (licenseList === null || licenseList === void 0 ? void 0 : licenseList.length) > 0;
117
- var showFLNumber = !anchorEl;
118
- var flReadonly = !isOtherLicense(selectedLicense);
119
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_freelance_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_fl'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
120
- return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selectedLicense) }, { children: isOtherLicense(item)
121
- ? t(getLicenseNumber(item))
122
- : isAr
123
- ? getLicenseName(item)
124
- : getLicenseNumber(item) + '-' + getLicenseName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selectedLicense) && _jsx(CheckIcon, {})] }));
125
- } }) }))] })), _jsx(FLNumber, { show: showFLNumber, readOnly: flReadonly })] }) })));
126
- };
127
- export default React.memo(FreelanceLicense);
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export interface ConfirmProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<() => JSX.Element>;
5
- export default _default;
@@ -1,56 +0,0 @@
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 * as React from 'react';
14
- import { useSelector } from 'react-redux';
15
- import { styled } from '@mui/material/styles';
16
- import { useAppDispatch, useLanguage } from '../../../../hooks';
17
- import { useTranslation } from 'react-i18next';
18
- import { handlePrevScreenStep } from '../../../../app/settings';
19
- import { FormProvider, useForm } from 'react-hook-form';
20
- import Form from '../../../../components/Form';
21
- import Input from '../../../shared/Input';
22
- import Button from '../../../shared/Button';
23
- import { ScreenContainer } from '../../../shared/Containers';
24
- import { businessSelector, createAccount } from '../../../app/business/businessStore';
25
- import { BusinessType as BusinessTypeEnum } from '../../../../@types';
26
- var InputStyled = styled(Input)(function (_a) {
27
- var theme = _a.theme;
28
- return ({
29
- marginBlockEnd: theme.spacing(3)
30
- });
31
- });
32
- var FormStyled = styled(Form)(function () { return ({
33
- display: 'flex',
34
- flexDirection: 'column'
35
- }); });
36
- var Confirm = function () {
37
- var dispatch = useAppDispatch();
38
- var t = useTranslation().t;
39
- var isAr = useLanguage().isAr;
40
- var _a = useSelector(businessSelector), data = _a.data, loading = _a.loading, error = _a.error;
41
- var _b = data.businessInfo, licenseNumber = _b.licenseNumber, brandName = _b.brandName, legalName = _b.legalName;
42
- var isCR = data.businessTypeData.businessType === BusinessTypeEnum.CR;
43
- var onSubmit = function () {
44
- dispatch(createAccount());
45
- };
46
- var methods = useForm({
47
- defaultValues: data.businessInfo,
48
- mode: 'onChange'
49
- });
50
- var onBack = function () {
51
- dispatch(handlePrevScreenStep());
52
- };
53
- var disabled = !methods.formState.isValid || !!error;
54
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputStyled, { label: t(isCR ? 'signup_business_cr_info_title' : 'signup_business_fl_info_title'), value: licenseNumber, disabled: true }), _jsx(InputStyled, { label: t('signup_brand_name_label'), placeholder: t('signup_brand_name_label'), value: brandName, disabled: true }), _jsx(InputStyled, { sx: { marginBlockEnd: 0 }, label: t('signup_legal_name_label'), placeholder: t('signup_legal_name_label'), value: legalName, disabled: true }), _jsx(Button, __assign({ disabled: disabled, loading: loading, error: t(error || ''), onBackClicked: function () { return onBack(); }, isAr: isAr }, { children: t('confirm') }))] })) })) }));
55
- };
56
- export default React.memo(Confirm);
@@ -1,3 +0,0 @@
1
- import Confirm, { ConfirmProps } from './Confirm';
2
- export type { ConfirmProps };
3
- export default Confirm;
@@ -1,2 +0,0 @@
1
- import Confirm from './Confirm';
2
- export default Confirm;
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import { CountryCode } from '../../../../@types';
3
- interface BusinessCountryProps {
4
- country: CountryCode;
5
- show: boolean;
6
- }
7
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BusinessCountryProps & React.RefAttributes<unknown>>>;
8
- export default _default;
@@ -1,40 +0,0 @@
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 { styled } from '@mui/material/styles';
15
- import { useTranslation } from 'react-i18next';
16
- import Text from '../../../../components/Text';
17
- import Collapse from '../../../../components/Collapse';
18
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
- import Icon from '../../../../components/Icon';
20
- import Input from '../../../shared/Input';
21
- import { useLanguage } from '../../../../hooks';
22
- var CountrySpanStyled = styled(Text)(function () { return ({
23
- cursor: 'pointer'
24
- }); });
25
- var CountryIconStyled = styled(Icon)(function (_a) {
26
- var theme = _a.theme;
27
- return ({
28
- width: theme.spacing(2.75),
29
- height: theme.spacing(2),
30
- verticalAlign: 'middle'
31
- });
32
- });
33
- var BusinessCountry = React.forwardRef(function (_a, ref) {
34
- var _b, _c;
35
- var country = _a.country, show = _a.show;
36
- var t = useTranslation().t;
37
- var isAr = useLanguage().isAr;
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, disabled: 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) || '' }) })) })));
39
- });
40
- export default React.memo(BusinessCountry);
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export interface PasswordProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<({}: PasswordProps) => JSX.Element>;
5
- export default _default;
@@ -1,60 +0,0 @@
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 * as React from 'react';
14
- import { useSelector } from 'react-redux';
15
- import { useAppDispatch } from '../../../../hooks';
16
- import { useForm, FormProvider } from 'react-hook-form';
17
- import { useTranslation } from 'react-i18next';
18
- import { yupResolver } from '@hookform/resolvers/yup';
19
- import { styled } from '@mui/material/styles';
20
- import { handlePrevScreenStep } from '../../../../app/settings';
21
- import { clearError, connectSelector } from '../../../app/connect/connectStore';
22
- import Form from '../../../../components/Form';
23
- import Button from '../../../shared/Button';
24
- import { ScreenContainer } from '../../../shared/Containers';
25
- import { useLanguage } from '../../../../hooks';
26
- import { PasswordValidationSchema } from './validation';
27
- import PasswordInput from './PasswordInput';
28
- var FormStyled = styled(Form)(function () { return ({
29
- display: 'flex',
30
- flexDirection: 'column',
31
- justifyContent: 'space-between',
32
- height: '100%'
33
- }); });
34
- var Password = function (_a) {
35
- var dispatch = useAppDispatch();
36
- var _b = useSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
37
- var methods = useForm({
38
- resolver: yupResolver(PasswordValidationSchema),
39
- defaultValues: {
40
- password: ''
41
- },
42
- mode: 'onChange'
43
- });
44
- var t = useTranslation().t;
45
- var isAr = useLanguage().isAr;
46
- var isAbsher = data.otpData.isAbsher;
47
- React.useEffect(function () {
48
- if (error)
49
- dispatch(clearError());
50
- }, [methods.formState.isValid]);
51
- var onSubmit = function (formData) {
52
- console.log(formData);
53
- };
54
- var onBack = function () {
55
- dispatch(handlePrevScreenStep(isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
56
- };
57
- var disabled = !methods.formState.isValid || !!error;
58
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(PasswordInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
59
- };
60
- export default React.memo(Password);
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- interface PasswordInputProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<({}: PasswordInputProps) => JSX.Element>;
5
- export default _default;
@@ -1,39 +0,0 @@
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 { useController, useFormContext } from 'react-hook-form';
16
- import PasswordIcon from '../../../shared/PasswordIcon';
17
- import { ScreenContainer } from '../../../shared/Containers';
18
- import Input from '../../../shared/Input';
19
- var PasswordInput = function (_a) {
20
- var _b;
21
- var t = useTranslation().t;
22
- var control = useFormContext().control;
23
- var _c = React.useState(false), showPassword = _c[0], setShowPassword = _c[1];
24
- var passwordControl = useController({ control: control, name: 'password' });
25
- var handlePasswordChange = function (_a) {
26
- var target = _a.target;
27
- passwordControl.field.onChange(target.value);
28
- };
29
- var handleShowPassword = function () {
30
- setShowPassword(true);
31
- };
32
- var handleHidePassword = function () {
33
- setShowPassword(false);
34
- };
35
- var passwordValue = passwordControl.field.value;
36
- var error = (_b = passwordControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
37
- return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 5 } }, { children: _jsx(Input, { label: t('tap_js_password_description'), inputProps: { autoComplete: 'off' }, onChange: handlePasswordChange, value: passwordValue, endAdornment: _jsx(PasswordIcon, { show: showPassword, onShow: handleShowPassword, onHide: handleHidePassword }), placeholder: t('tap_js_password_placeholder'), type: showPassword ? 'text' : 'password', warningType: 'alert', warningMessage: error && t(error, { length: 8 }) }) })));
38
- };
39
- export default React.memo(PasswordInput);
@@ -1,3 +0,0 @@
1
- import Password, { PasswordProps } from './Password';
2
- export type { PasswordProps };
3
- export default Password;
@@ -1,2 +0,0 @@
1
- import Password from './Password';
2
- export default Password;
@@ -1,8 +0,0 @@
1
- import * as yup from 'yup';
2
- export declare const PasswordValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- password: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
- password: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
- password: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
- }>>>;
@@ -1,4 +0,0 @@
1
- import * as yup from 'yup';
2
- export var PasswordValidationSchema = yup.object().shape({
3
- password: yup.string().min(8, 'enter_valid_password').required('password_required')
4
- });