@tap-payments/auth-jsconnect 2.0.2 → 2.0.5

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 (124) hide show
  1. package/build/@types/app.d.ts +5 -0
  2. package/build/@types/form.d.ts +4 -1
  3. package/build/api/auth.d.ts +20 -3
  4. package/build/api/axios.js +8 -9
  5. package/build/api/data.d.ts +1 -0
  6. package/build/api/data.js +9 -2
  7. package/build/api/entity.d.ts +13 -1
  8. package/build/api/entity.js +20 -2
  9. package/build/api/index.d.ts +7 -4
  10. package/build/api/lead.d.ts +3 -1
  11. package/build/api/lead.js +14 -2
  12. package/build/assets/locales/ar.json +4 -1
  13. package/build/assets/locales/en.json +4 -1
  14. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  15. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  16. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  17. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  18. package/build/components/FileInput/DragAndDrop.d.ts +7 -0
  19. package/build/components/FileInput/DragAndDrop.js +39 -0
  20. package/build/components/FileInput/UploadInput.d.ts +7 -0
  21. package/build/components/FileInput/UploadInput.js +38 -0
  22. package/build/components/FileInput/index.d.ts +3 -0
  23. package/build/components/FileInput/index.js +3 -0
  24. package/build/constants/api.d.ts +3 -1
  25. package/build/constants/api.js +7 -3
  26. package/build/constants/app.d.ts +5 -0
  27. package/build/constants/app.js +55 -9
  28. package/build/constants/assets.d.ts +1 -0
  29. package/build/constants/assets.js +1 -0
  30. package/build/constants/validation.d.ts +2 -0
  31. package/build/constants/validation.js +2 -0
  32. package/build/features/app/bank/bankStore.d.ts +1 -0
  33. package/build/features/app/bank/bankStore.js +59 -18
  34. package/build/features/app/business/businessStore.d.ts +3 -5
  35. package/build/features/app/business/businessStore.js +149 -50
  36. package/build/features/app/connect/connectStore.d.ts +5 -10
  37. package/build/features/app/connect/connectStore.js +135 -41
  38. package/build/features/app/individual/individualStore.d.ts +3 -2
  39. package/build/features/app/individual/individualStore.js +50 -37
  40. package/build/features/app/password/passwordStore.d.ts +32 -1
  41. package/build/features/app/password/passwordStore.js +197 -14
  42. package/build/features/app/tax/taxStore.js +19 -12
  43. package/build/features/bank/Bank.js +3 -4
  44. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  45. package/build/features/bank/screens/BankDetails/BankStatement.d.ts +3 -0
  46. package/build/features/bank/screens/BankDetails/BankStatement.js +38 -0
  47. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  48. package/build/features/bank/screens/BankDetails/validation.js +1 -0
  49. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  50. package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  51. package/build/features/bank/screens/ResetPasswordSuccess/index.d.ts +3 -0
  52. package/build/features/bank/screens/ResetPasswordSuccess/index.js +2 -0
  53. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +23 -15
  54. package/build/features/business/Business.js +3 -4
  55. package/build/features/business/screens/Activities/Activities.js +2 -1
  56. package/build/features/business/screens/Activities/LicenseName.d.ts +5 -0
  57. package/build/features/business/screens/Activities/LicenseName.js +30 -0
  58. package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
  59. package/build/features/business/screens/OTP/OTPInput.js +3 -9
  60. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  61. package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  62. package/build/features/business/screens/ResetPasswordSuccess/index.d.ts +3 -0
  63. package/build/features/business/screens/ResetPasswordSuccess/index.js +2 -0
  64. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +24 -17
  65. package/build/features/connect/Connect.js +1 -1
  66. package/build/features/connect/screens/Merchant/BrandList.js +1 -5
  67. package/build/features/connect/screens/Merchant/Merchant.js +10 -8
  68. package/build/features/connect/screens/Merchant/validation.js +4 -2
  69. package/build/features/connect/screens/Mobile/Mobile.js +2 -2
  70. package/build/features/connect/screens/Mobile/MobileNumber.js +1 -1
  71. package/build/features/connect/screens/NID/IDNumber.js +1 -1
  72. package/build/features/connect/screens/NID/NID.js +2 -2
  73. package/build/features/connect/screens/OTP/OTPInput.js +3 -13
  74. package/build/features/featuresScreens.js +20 -5
  75. package/build/features/individual/Individual.js +3 -4
  76. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +7 -1
  77. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
  78. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
  79. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
  80. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
  81. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  82. package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  83. package/build/features/individual/screens/ResetPasswordSuccess/index.d.ts +3 -0
  84. package/build/features/individual/screens/ResetPasswordSuccess/index.js +2 -0
  85. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +23 -15
  86. package/build/features/password/Password.js +11 -6
  87. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  88. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  89. package/build/features/password/screens/OTP/OTP.js +78 -0
  90. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  91. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  92. package/build/features/password/screens/OTP/index.d.ts +3 -0
  93. package/build/features/password/screens/OTP/index.js +2 -0
  94. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  95. package/build/features/password/screens/OTP/validation.js +4 -0
  96. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  97. package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  98. package/build/features/password/screens/ResetPasswordSuccess/index.d.ts +3 -0
  99. package/build/features/password/screens/ResetPasswordSuccess/index.js +2 -0
  100. package/build/features/password/screens/Success/Success.js +8 -2
  101. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +24 -16
  102. package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
  103. package/build/features/password/screens/Verify/OTPInput.js +1 -1
  104. package/build/features/shared/Button/Button.js +1 -1
  105. package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
  106. package/build/features/shared/Button/FlowsButtons.js +90 -6
  107. package/build/features/shared/Button/SuccessButton.js +31 -13
  108. package/build/features/shared/UploadFile/UploadFile.d.ts +21 -0
  109. package/build/features/shared/UploadFile/UploadFile.js +77 -0
  110. package/build/features/shared/UploadFile/index.d.ts +2 -0
  111. package/build/features/shared/UploadFile/index.js +2 -0
  112. package/build/features/tax/Tax.js +3 -4
  113. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  114. package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  115. package/build/features/tax/screens/ResetPasswordSuccess/index.d.ts +3 -0
  116. package/build/features/tax/screens/ResetPasswordSuccess/index.js +2 -0
  117. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +23 -15
  118. package/build/hooks/useAppTheme.js +3 -2
  119. package/build/index.css +4 -0
  120. package/build/theme/theme.d.ts +1 -1
  121. package/build/theme/theme.js +1 -2
  122. package/build/utils/string.d.ts +1 -0
  123. package/build/utils/string.js +6 -1
  124. package/package.json +2 -1
@@ -27,6 +27,7 @@ import { bankSelector, createBankAccount } from '../../../app/bank/bankStore';
27
27
  import Form from '../../../../components/Form';
28
28
  import { handleCurrentActiveScreen } from '../../../../app/settings';
29
29
  import ConfirmPolicy from './ConfirmPolicy';
30
+ import BankStatement from './BankStatement';
30
31
  var FormStyled = styled(Form)(function () { return ({
31
32
  display: 'flex',
32
33
  flexDirection: 'column',
@@ -56,6 +57,6 @@ var BankDetails = function () {
56
57
  dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
57
58
  };
58
59
  var disabled = ibanChecking || !methods.formState.isValid;
59
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
60
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
60
61
  };
61
62
  export default BankDetails;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const BankStatement: () => JSX.Element;
3
+ export default BankStatement;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import { ScreenContainer } from '../../../../features/shared/Containers';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { useController, useFormContext } from 'react-hook-form';
7
+ import UploadFile from '../../../../features/shared/UploadFile';
8
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
9
+ import { bankSelector, uploadBankStatement } from '../../../../features/app/bank/bankStore';
10
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
11
+ var theme = _a.theme;
12
+ return ({
13
+ marginBlockStart: theme.spacing(3)
14
+ });
15
+ });
16
+ var BankStatement = function () {
17
+ var _a, _b;
18
+ var dispatch = useAppDispatch();
19
+ var data = useAppSelector(bankSelector).data;
20
+ var t = useTranslation().t;
21
+ var control = useFormContext().control;
22
+ var bankStatementControl = useController({ name: 'bankStatementId', control: control });
23
+ var error = (_a = bankStatementControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
24
+ var uploading = data.bankData.uploading;
25
+ var handleBankStatementChange = function (file) {
26
+ dispatch(uploadBankStatement(file));
27
+ };
28
+ var handleReset = function () {
29
+ bankStatementControl.field.onChange('');
30
+ };
31
+ React.useEffect(function () {
32
+ var _a, _b;
33
+ if ((_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.fileId)
34
+ bankStatementControl.field.onChange((_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.fileId);
35
+ }, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.fileId]);
36
+ return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_bank_statement'), dragTitle: t('drag_and_drop'), uploadTitle: t('title_upload_file'), onFileUploaded: handleBankStatementChange, loading: uploading, onReset: handleReset, error: error && t(error) }) }));
37
+ };
38
+ export default BankStatement;
@@ -3,15 +3,18 @@ export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").A
3
3
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
4
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
5
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
6
7
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
7
8
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
8
9
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
9
10
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
11
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
13
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
12
14
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
15
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
16
  bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
15
17
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
18
+ bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
19
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
17
20
  }>>>;
@@ -12,5 +12,6 @@ export var BankValidation = yup.object().shape({
12
12
  .string()
13
13
  .matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
14
14
  .required('beneficiary_name_required'),
15
+ bankStatementId: yup.string().optional(),
15
16
  confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
16
17
  });
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface ResetPasswordSuccessProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: ResetPasswordSuccessProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import SuccessScreen from '../../../shared/SuccessScreen';
5
+ var ResetPasswordSuccess = function (_a) {
6
+ var t = useTranslation().t;
7
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
8
+ };
9
+ export default React.memo(ResetPasswordSuccess);
@@ -0,0 +1,3 @@
1
+ import ResetPasswordSuccess, { ResetPasswordSuccessProps } from './ResetPasswordSuccess';
2
+ export type { ResetPasswordSuccessProps };
3
+ export default ResetPasswordSuccess;
@@ -0,0 +1,2 @@
1
+ import ResetPasswordSuccess from './ResetPasswordSuccess';
2
+ export default ResetPasswordSuccess;
@@ -10,18 +10,19 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import React, { memo, useEffect, useState } from 'react';
13
+ import { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES } from '../../../../constants';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { allAreTruthy, showLastFour } from '../../../../utils';
19
+ import { getResetFlowUrl, showLastFour } from '../../../../utils';
20
20
  import { bankSelector } from '../../../app/bank/bankStore';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
24
24
  import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
+ import { settingsSelector } from '../../../../app/settings';
25
26
  var TitleStyled = styled(Text)(function (_a) {
26
27
  var _b;
27
28
  var theme = _a.theme;
@@ -46,39 +47,45 @@ var SuccessWithFlowButtons = function () {
46
47
  var _a, _b, _c;
47
48
  var t = useTranslation().t;
48
49
  var isAr = useLanguage().isAr;
49
- var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
50
- var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
51
50
  var data = useAppSelector(bankSelector).data;
52
- var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
53
- var _g = useState([]), buttons = _g[0], setButtons = _g[1];
51
+ var _d = data.verify.responseBody || {}, flows = _d.flows, nameObj = _d.name, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, identification_id = _d.identification_id;
52
+ var _e = useState([]), buttons = _e[0], setButtons = _e[1];
54
53
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
55
54
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
56
55
  var bankName = (bank === null || bank === void 0 ? void 0 : bank.name) || t('bank');
57
56
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
58
57
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
58
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
59
+ var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
60
+ var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
61
+ var maskedId = !!identification_id ? " ".concat(t('masking_symbols')).concat(identification_id) : '';
62
+ var settings = useAppSelector(settingsSelector);
63
+ var _f = data.verify.responseBody || { contact: {}, id: '' }, contact = _f.contact, id = _f.id;
64
+ var email = (contact || { email: '' }).email;
65
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
60
66
  var reMapFlowData = function (flows) {
61
67
  if (flows === void 0) { flows = []; }
62
68
  var images = ICONS_NAMES;
63
- var mappedFlows = flows.map(function (_a) {
69
+ var mappedFlows = flows
70
+ .filter(function (item) { return item.name; })
71
+ .map(function (_a) {
64
72
  var name = _a.name, url = _a.url, status = _a.status;
65
73
  var type = status === 'initiated' ? 'pending' : 'completed';
66
74
  var title = t("".concat(name, "_flow_").concat(type), {
67
- individual_name: username.toLowerCase(),
75
+ individual_name: username.toLowerCase() + maskedId,
68
76
  business_type: brandName,
69
77
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
70
78
  bank_name: bankName,
71
79
  iban: t('masking_symbols') + iban,
72
80
  tax_id: t('masking_symbols') + showLastFour(taxID)
73
81
  });
74
- if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
75
- setIsAcceptance(true);
76
82
  var isCompleted = status === 'completed' && name !== 'password';
77
83
  var isIndividual = name === 'individual';
78
84
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
79
85
  var hoverSrc = "".concat(name, "_white_icon");
80
86
  return {
81
87
  name: name,
88
+ status: status,
82
89
  title: title,
83
90
  href: url,
84
91
  src: images[src],
@@ -88,14 +95,15 @@ var SuccessWithFlowButtons = function () {
88
95
  };
89
96
  });
90
97
  setButtons(mappedFlows);
91
- var isAllCompleted = allAreTruthy(flows, 'completed', 'status', 'password');
92
- if (isAllCompleted)
93
- setIsPayout(true);
94
98
  };
95
99
  useEffect(function () {
96
100
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
97
101
  reMapFlowData(flows);
98
102
  }, [flows, isAr]);
99
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, flowName: data.flowName }) })] }));
103
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
104
+ flowName: data.flowName,
105
+ email: email,
106
+ emailUrl: url
107
+ } }) })] }));
100
108
  };
101
109
  export default memo(SuccessWithFlowButtons);
@@ -36,18 +36,17 @@ var Business = memo(function (props) {
36
36
  var verifyToken = function () {
37
37
  var token = getParameterByName('token');
38
38
  var lang = getParameterByName('lang');
39
+ if (lang)
40
+ dispatch(handleLanguage(lang));
39
41
  if (!token)
40
42
  throw new Error('Auth token is not found!');
41
- if (!lang)
42
- throw new Error('Language is not found!');
43
- dispatch(handleLanguage(lang));
44
43
  dispatch(verifyLeadToken(token));
45
44
  };
46
45
  useEffect(function () {
47
46
  if (!settingLoading)
48
47
  verifyToken();
49
48
  }, [settingLoading]);
50
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
49
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
51
50
  var Element = _a.element, name = _a.name;
52
51
  var isActive = activeScreen.name === name;
53
52
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -26,6 +26,7 @@ import Collapse from '../../../../components/Collapse';
26
26
  import OperationStartDate from './OperationStartDate';
27
27
  import { businessSelector, clearError, updateActivitiesInfo } from '../../../app/business/businessStore';
28
28
  import { ActivitiesValidationSchema } from './validation';
29
+ import LicenseName from './LicenseName';
29
30
  var FormStyled = styled(Form)(function () { return ({
30
31
  display: 'flex',
31
32
  flexDirection: 'column'
@@ -72,6 +73,6 @@ var Activities = function () {
72
73
  anchorEl ? setAnchorEl(false) : setAnchorEl(true);
73
74
  };
74
75
  var disabled = !methods.formState.isValid || !!error;
75
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
76
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(LicenseName, {}) })), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
76
77
  };
77
78
  export default Activities;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface LicenseNameProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: LicenseNameProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,30 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { ScreenContainer } from '../../../shared/Containers';
16
+ import Input from '../../../shared/Input';
17
+ import Collapse from '../../../../components/Collapse';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { businessSelector } from '../../../app/business/businessStore';
20
+ import CheckIcon from '../../../shared/CheckIcon';
21
+ var LicenseName = function (_a) {
22
+ var _b, _c, _d;
23
+ var t = useTranslation().t;
24
+ var isAr = useLanguage().isAr;
25
+ var data = useAppSelector(businessSelector).data;
26
+ var entity = (((_b = data.verify) === null || _b === void 0 ? void 0 : _b.responseBody) || {}).entity;
27
+ var name = isAr ? (_c = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _c === void 0 ? void 0 : _c.ar : (_d = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _d === void 0 ? void 0 : _d.en;
28
+ return (_jsx(Collapse, __assign({ in: !!name }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { label: t('license_name_label'), readOnly: true, value: name, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, endAdornment: _jsx(CheckIcon, {}) }) }) })));
29
+ };
30
+ export default React.memo(LicenseName);
@@ -44,7 +44,7 @@ var IDBOD = function (_a) {
44
44
  dispatch(clearError());
45
45
  }, [methods.formState.isValid]);
46
46
  var onSubmit = function (data) {
47
- dispatch(updateLeadIdentity(__assign(__assign({}, data), { isResend: false })));
47
+ dispatch(updateLeadIdentity(data));
48
48
  };
49
49
  var handleCollapseOpenClose = function (flag) {
50
50
  setCollapse(flag);
@@ -17,8 +17,8 @@ import Box from '@mui/material/Box/Box';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
- import { businessSelector, updateLeadIdentity } from '../../../app/business/businessStore';
21
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
20
+ import { resendOTPLeadIdentity } from '../../../app/business/businessStore';
21
+ import { useAppDispatch } from '../../../../hooks';
22
22
  var BoxStyled = styled(Box)(function (_a) {
23
23
  var theme = _a.theme;
24
24
  return ({
@@ -32,19 +32,13 @@ var OTPInput = function (_a) {
32
32
  var t = useTranslation().t;
33
33
  var dispatch = useAppDispatch();
34
34
  var otpControl = useController({ name: 'otp', control: control });
35
- var data = useAppSelector(businessSelector).data;
36
- var nidData = data.nidData;
37
35
  var handleOnOTPChange = function (otp) {
38
36
  otpControl.field.onChange(otp);
39
37
  };
40
38
  var handleOnResendOTP = function () {
41
39
  if (otpControl.field.value)
42
40
  setValue('otp', '', { shouldValidate: true });
43
- var params = {
44
- nid: nidData.nid,
45
- dob: nidData.dob
46
- };
47
- dispatch(updateLeadIdentity(__assign(__assign({}, params), { isResend: true })));
41
+ dispatch(resendOTPLeadIdentity());
48
42
  };
49
43
  var otpValue = otpControl.field.value;
50
44
  return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface ResetPasswordSuccessProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: ResetPasswordSuccessProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import SuccessScreen from '../../../shared/SuccessScreen';
5
+ var ResetPasswordSuccess = function (_a) {
6
+ var t = useTranslation().t;
7
+ return (_jsx(SuccessScreen, { title: t("reset_password_success_title"), description: t("reset_password_success_description"), showEmailProviders: true }));
8
+ };
9
+ export default React.memo(ResetPasswordSuccess);
@@ -0,0 +1,3 @@
1
+ import ResetPasswordSuccess, { ResetPasswordSuccessProps } from './ResetPasswordSuccess';
2
+ export type { ResetPasswordSuccessProps };
3
+ export default ResetPasswordSuccess;
@@ -0,0 +1,2 @@
1
+ import ResetPasswordSuccess from './ResetPasswordSuccess';
2
+ export default ResetPasswordSuccess;
@@ -10,18 +10,19 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import React, { memo, useEffect, useState } from 'react';
13
+ import { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES } from '../../../../constants';
18
- import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
17
+ import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
19
  import { businessSelector } from '../../../app/business/businessStore';
20
- import { allAreTruthy, showLastFour } from '../../../../utils';
20
+ import { getResetFlowUrl, showLastFour } from '../../../../utils';
21
21
  import Box from '@mui/material/Box';
22
22
  import Text from '../../../../components/Text';
23
23
  import Container from '../../../shared/Containers/ScreenContainer';
24
24
  import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
+ import { settingsSelector } from '../../../../app/settings';
25
26
  var TitleStyled = styled(Text)(function (_a) {
26
27
  var _b;
27
28
  var theme = _a.theme;
@@ -46,40 +47,45 @@ var SuccessWithFlowButtons = function () {
46
47
  var _a, _b, _c;
47
48
  var t = useTranslation().t;
48
49
  var isAr = useLanguage().isAr;
49
- var dispatch = useAppDispatch();
50
- var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
51
- var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
52
50
  var data = useAppSelector(businessSelector).data;
53
- var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
54
- var _g = useState([]), buttons = _g[0], setButtons = _g[1];
51
+ var _d = data.verify.responseBody || {}, flows = _d.flows, nameObj = _d.name, entity = _d.entity, brand = _d.brand, bank = _d.bank_account, merchant = _d.merchant, identification_id = _d.identification_id;
52
+ var _e = useState([]), buttons = _e[0], setButtons = _e[1];
55
53
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
56
54
  var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
57
55
  var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
58
56
  var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
59
57
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
60
58
  var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
59
+ var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
60
+ var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
61
+ var maskedId = !!identification_id ? " ".concat(t('masking_symbols')).concat(identification_id) : '';
62
+ var settings = useAppSelector(settingsSelector);
63
+ var _f = data.verify.responseBody || { contact: {}, id: '' }, contact = _f.contact, id = _f.id;
64
+ var email = (contact || { email: '' }).email;
65
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
61
66
  var reMapFlowData = function (flows) {
62
67
  if (flows === void 0) { flows = []; }
63
68
  var images = ICONS_NAMES;
64
- var mappedFlows = flows.map(function (_a) {
69
+ var mappedFlows = flows
70
+ .filter(function (item) { return item.name; })
71
+ .map(function (_a) {
65
72
  var name = _a.name, url = _a.url, status = _a.status;
66
73
  var type = status === 'initiated' ? 'pending' : 'completed';
67
74
  var title = t("".concat(name, "_flow_").concat(type), {
68
- individual_name: username.toLowerCase(),
75
+ individual_name: username.toLowerCase() + maskedId,
69
76
  business_type: brandName,
70
77
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
71
78
  bank_name: bankName,
72
79
  iban: t('masking_symbols') + iban,
73
80
  tax_id: t('masking_symbols') + showLastFour(taxID)
74
81
  });
75
- if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
76
- setIsAcceptance(true);
77
82
  var isCompleted = status === 'completed' && name !== 'password';
78
83
  var isIndividual = name === 'individual';
79
84
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
80
85
  var hoverSrc = "".concat(name, "_white_icon");
81
86
  return {
82
87
  name: name,
88
+ status: status,
83
89
  title: title,
84
90
  href: url,
85
91
  src: images[src],
@@ -89,14 +95,15 @@ var SuccessWithFlowButtons = function () {
89
95
  };
90
96
  });
91
97
  setButtons(mappedFlows);
92
- var isAllCompleted = allAreTruthy(flows, 'completed', 'status', 'password');
93
- if (isAllCompleted)
94
- setIsPayout(true);
95
98
  };
96
99
  useEffect(function () {
97
100
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
98
101
  reMapFlowData(flows);
99
102
  }, [flows, isAr]);
100
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, flowName: data.flowName }) })] }));
103
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
104
+ flowName: data.flowName,
105
+ email: email,
106
+ emailUrl: url
107
+ } }) })] }));
101
108
  };
102
109
  export default memo(SuccessWithFlowButtons);
@@ -32,7 +32,7 @@ var Connect = memo(function (props) {
32
32
  useErrorListener(connectError || error);
33
33
  useStepStartedListener();
34
34
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
35
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
35
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
36
36
  var Element = _a.element, name = _a.name;
37
37
  var isActive = activeScreen.name === name;
38
38
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -51,10 +51,8 @@ var BrandList = function (_a) {
51
51
  var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
52
52
  var t = useTranslation().t;
53
53
  var isAr = useLanguage().isAr;
54
- var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
55
- var linksControl = useController({ control: control, name: 'links' });
54
+ var control = useFormContext().control;
56
55
  var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
57
- var links = linksControl.field.value;
58
56
  var selectedBrand = selectedBrandControl.field.value;
59
57
  var onOpenBrandList = function (event) {
60
58
  var _a;
@@ -79,8 +77,6 @@ var BrandList = function (_a) {
79
77
  var onSelectItem = function (brand) {
80
78
  selectedBrandControl.field.onChange(brand);
81
79
  onCloseBrandList();
82
- var website = brand.website;
83
- setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
84
80
  };
85
81
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('select_brand_label'), readOnly: true, onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', list: list, onSelectItem: onSelectItem, renderItem: function (item) {
86
82
  return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(selectedBrand) }, { children: isOtherLicense(item) ? t(getBrandName(item)) : getBrandName(item) })) }), getBrandId(item) === getBrandId(selectedBrand) && _jsx(CheckIcon, {})] }));
@@ -18,6 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
19
  import { handlePrevScreenStep } from '../../../../app/settings';
20
20
  import Form from '../../../../components/Form';
21
+ import { INSTAGRAM_URL, TWITTER_URL } from '../../../../constants';
21
22
  import { ScreenContainer } from '../../../shared/Containers';
22
23
  import Button from '../../../shared/Button';
23
24
  import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
@@ -50,6 +51,7 @@ var Merchant = function (_a) {
50
51
  var t = useTranslation().t;
51
52
  var isAr = useLanguage().isAr;
52
53
  var dispatch = useAppDispatch();
54
+ var formDataSelectedBrand = methods.getValues('selectedBrandItem');
53
55
  var onSubmit = function (formData) {
54
56
  dispatch(updateLeadBrand(formData));
55
57
  };
@@ -69,11 +71,11 @@ var Merchant = function (_a) {
69
71
  methods.setError('brandName', { message: 'Profile Name already exists' });
70
72
  }, [responseBody]);
71
73
  React.useEffect(function () {
72
- var _a, _b;
74
+ var _a, _b, _c, _d;
73
75
  if (isNewUser === true) {
74
76
  setUserType(ValidationOptions.NEW_USER);
75
77
  }
76
- if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && methods.getValues('selectedBrandItem').id === 'other') {
78
+ if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && (formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) === 'other') {
77
79
  setUserType(ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND);
78
80
  methods.clearErrors();
79
81
  setTimeout(function () {
@@ -82,17 +84,17 @@ var Merchant = function (_a) {
82
84
  methods.setValue('links', sites);
83
85
  }, 100);
84
86
  }
85
- if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && methods.getValues('selectedBrandItem').id !== 'other') {
87
+ if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && (formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) !== 'other') {
86
88
  setUserType(ValidationOptions.EXISTING_USER_WITH_EXIST_BRAND);
87
89
  methods.clearErrors();
88
- var twitter = ((_a = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) || '';
89
- var instagram = ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _b === void 0 ? void 0 : _b.find(function (item) { return item.includes('instagram.com'); })) || '';
90
- var sites_1 = __assign(__assign({}, links), { website: selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.website, twitter: twitter, instagram: instagram });
90
+ var twitter = ((_b = (_a = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) === null || _b === void 0 ? void 0 : _b.replaceAll("".concat(TWITTER_URL, "/"), '')) || '';
91
+ var instagram = ((_d = (_c = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.social) === null || _c === void 0 ? void 0 : _c.find(function (item) { return item.includes('instagram.com'); })) === null || _d === void 0 ? void 0 : _d.replaceAll("".concat(INSTAGRAM_URL, "/"), '')) || '';
92
+ var sites_1 = __assign(__assign({}, links), { website: formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.website, twitter: twitter, instagram: instagram });
91
93
  setTimeout(function () { return methods.setValue('links', sites_1, { shouldValidate: true }); }, 100);
92
94
  }
93
- }, [methods.getValues('selectedBrandItem'), isNewUser]);
95
+ }, [formDataSelectedBrand, isNewUser]);
94
96
  React.useEffect(function () {
95
- if (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id)
97
+ if (!(formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) && (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id))
96
98
  methods.setValue('selectedBrandItem', selectedBrandItem, { shouldValidate: true });
97
99
  }, [selectedBrandItem]);
98
100
  var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
@@ -1,4 +1,4 @@
1
- import { REGEX_WEBSITE } from '../../../../constants';
1
+ import { REGEX_WEBSITE, REGEX_BRAND_NAME } from '../../../../constants';
2
2
  import * as yup from 'yup';
3
3
  export var ValidationOptions;
4
4
  (function (ValidationOptions) {
@@ -17,7 +17,9 @@ export var MerchantValidationSchema = function (userType) {
17
17
  var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
18
18
  if (length === 0)
19
19
  return true;
20
- return length < 3 ? this.createError({ message: 'enter_brand_name_english_chars_numbers_space' }) : true;
20
+ return !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME))
21
+ ? this.createError({ message: 'enter_brand_name_english_chars_numbers_space' })
22
+ : true;
21
23
  }
22
24
  })
23
25
  .required(''),
@@ -96,7 +96,7 @@ var Mobile = function (_a) {
96
96
  dispatch(clearError());
97
97
  }, [methods.formState.isValid]);
98
98
  var onSubmit = function (formData) {
99
- dispatch(createMobileAuth(__assign(__assign({}, formData), { isResend: false })));
99
+ dispatch(createMobileAuth(formData));
100
100
  };
101
101
  var onBack = function () {
102
102
  dispatch(handlePrevScreenStep());
@@ -107,6 +107,6 @@ var Mobile = function (_a) {
107
107
  var disabled = !methods.formState.isValid || !!error;
108
108
  var title = t('join_our_community');
109
109
  var subTitle = t('ide_terms_and_conditions_description');
110
- return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.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 || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] })) }))] }));
110
+ return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.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 || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] }))] })) }))] }));
111
111
  };
112
112
  export default React.memo(Mobile);