@tap-payments/auth-jsconnect 2.1.56-test → 2.1.59-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +34 -34
  2. package/build/@types/app.d.ts +1 -0
  3. package/build/app/settings.d.ts +0 -1
  4. package/build/app/settings.js +6 -16
  5. package/build/assets/locales/ar.json +3 -1
  6. package/build/assets/locales/en.json +3 -1
  7. package/build/constants/app.js +32 -2
  8. package/build/features/app/bank/bankStore.d.ts +5 -1
  9. package/build/features/app/bank/bankStore.js +62 -57
  10. package/build/features/app/brand/brandStore.d.ts +5 -1
  11. package/build/features/app/brand/brandStore.js +70 -65
  12. package/build/features/app/connectExpress/connectExpressStore.js +9 -3
  13. package/build/features/app/entity/entityStore.d.ts +5 -1
  14. package/build/features/app/entity/entityStore.js +75 -70
  15. package/build/features/app/individual/individualStore.d.ts +5 -1
  16. package/build/features/app/individual/individualStore.js +88 -83
  17. package/build/features/app/tax/taxStore.d.ts +5 -1
  18. package/build/features/app/tax/taxStore.js +51 -46
  19. package/build/features/auth/Auth.d.ts +3 -2
  20. package/build/features/auth/Auth.js +5 -13
  21. package/build/features/bank/Bank.d.ts +4 -2
  22. package/build/features/bank/Bank.js +35 -35
  23. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  24. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  25. package/build/features/bank/screens/PrepareDataLoading/index.d.ts +2 -0
  26. package/build/features/bank/screens/PrepareDataLoading/index.js +2 -0
  27. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  28. package/build/features/brand/Brand.d.ts +4 -2
  29. package/build/features/brand/Brand.js +35 -34
  30. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  31. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  32. package/build/features/brand/screens/PrepareDataLoading/index.d.ts +2 -0
  33. package/build/features/brand/screens/PrepareDataLoading/index.js +2 -0
  34. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  35. package/build/features/business/Business.d.ts +3 -2
  36. package/build/features/business/Business.js +5 -13
  37. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -98
  38. package/build/features/connect/Connect.d.ts +3 -2
  39. package/build/features/connect/Connect.js +5 -13
  40. package/build/features/connectExpress/ConnectExpress.d.ts +0 -1
  41. package/build/features/connectExpress/ConnectExpress.js +3 -6
  42. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +1 -1
  43. package/build/features/connectExpress/screens/Mobile/Mobile.js +6 -3
  44. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -9
  45. package/build/features/connectExpress/screens/NID/IDNumber.js +7 -2
  46. package/build/features/connectExpress/screens/NID/NID.js +6 -5
  47. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +3 -7
  48. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +8 -100
  49. package/build/features/entity/Entity.d.ts +4 -2
  50. package/build/features/entity/Entity.js +35 -36
  51. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  52. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  53. package/build/features/entity/screens/PrepareDataLoading/index.d.ts +2 -0
  54. package/build/features/entity/screens/PrepareDataLoading/index.js +2 -0
  55. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  56. package/build/features/featuresScreens.js +25 -0
  57. package/build/features/individual/Individual.d.ts +4 -2
  58. package/build/features/individual/Individual.js +35 -36
  59. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  60. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  61. package/build/features/individual/screens/PrepareDataLoading/index.d.ts +2 -0
  62. package/build/features/individual/screens/PrepareDataLoading/index.js +2 -0
  63. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  64. package/build/features/password/Password.d.ts +4 -2
  65. package/build/features/password/Password.js +5 -13
  66. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  67. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  68. package/build/features/shared/Button/FlowsButtons.js +6 -4
  69. package/build/features/shared/DataLoading/DataLoading.d.ts +5 -0
  70. package/build/features/shared/DataLoading/DataLoading.js +55 -0
  71. package/build/features/shared/DataLoading/index.d.ts +2 -0
  72. package/build/features/shared/DataLoading/index.js +2 -0
  73. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -1
  74. package/build/features/signIn/SignIn.d.ts +3 -2
  75. package/build/features/signIn/SignIn.js +4 -13
  76. package/build/features/tax/Tax.d.ts +4 -2
  77. package/build/features/tax/Tax.js +35 -37
  78. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  79. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  80. package/build/features/tax/screens/PrepareDataLoading/index.d.ts +2 -0
  81. package/build/features/tax/screens/PrepareDataLoading/index.js +2 -0
  82. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  83. package/build/hooks/index.d.ts +1 -0
  84. package/build/hooks/index.js +1 -0
  85. package/build/hooks/useAppConfig.d.ts +2 -2
  86. package/build/hooks/useAppConfig.js +5 -3
  87. package/build/hooks/useVerifyToken.d.ts +15 -0
  88. package/build/hooks/useVerifyToken.js +25 -0
  89. package/build/index.d.ts +11 -11
  90. package/build/index.js +12 -22
  91. package/package.json +1 -1
  92. package/build/features/connectExpress/screens/Brand/Brand.d.ts +0 -0
  93. package/build/features/connectExpress/screens/Brand/Brand.js +0 -1
  94. package/build/features/connectExpress/screens/Brand/BrandList.d.ts +0 -10
  95. package/build/features/connectExpress/screens/Brand/BrandList.js +0 -106
  96. package/build/features/connectExpress/screens/Brand/BrandName.d.ts +0 -8
  97. package/build/features/connectExpress/screens/Brand/BrandName.js +0 -142
  98. package/build/features/connectExpress/screens/Brand/SalesChannels.d.ts +0 -5
  99. package/build/features/connectExpress/screens/Brand/SalesChannels.js +0 -38
  100. package/build/features/connectExpress/screens/Brand/Segments.d.ts +0 -8
  101. package/build/features/connectExpress/screens/Brand/Segments.js +0 -74
  102. package/build/features/connectExpress/screens/Brand/TAC.d.ts +0 -6
  103. package/build/features/connectExpress/screens/Brand/TAC.js +0 -84
  104. package/build/features/connectExpress/screens/Brand/TeamSize.d.ts +0 -8
  105. package/build/features/connectExpress/screens/Brand/TeamSize.js +0 -74
  106. package/build/features/connectExpress/screens/Brand/index.d.ts +0 -0
  107. package/build/features/connectExpress/screens/Brand/index.js +0 -1
  108. package/build/features/connectExpress/screens/Brand/validation.d.ts +0 -38
  109. package/build/features/connectExpress/screens/Brand/validation.js +0 -134
@@ -1,106 +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
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
- import { connectSelector } from '../../../app/connect/connectStore';
25
- import * as React from 'react';
26
- import { useTranslation } from 'react-i18next';
27
- import { useFormContext, useController } from 'react-hook-form';
28
- import Box from '@mui/material/Box';
29
- import { styled } from '@mui/material/styles';
30
- import { useAppSelector, useLanguage } from '../../../../hooks';
31
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
32
- import Input from '../../../shared/Input';
33
- import CheckIcon from '../../../shared/CheckIcon';
34
- import SimpleList from '../../../../components/SimpleList';
35
- import Text from '../../../../components/Text';
36
- import ExpandIcon from '../../../../components/ExpandIcon';
37
- import Collapse from '../../../../components/Collapse';
38
- import { mapSalesChannel } from '../../../../utils';
39
- var InputStyled = styled(Input)(function () { return ({
40
- '& .MuiInputBase-input': {
41
- cursor: 'pointer'
42
- }
43
- }); });
44
- var BrandContainer = styled(Box)(function () { return ({
45
- display: 'flex'
46
- }); });
47
- var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
48
- var theme = _a.theme, isSelected = _a.isSelected;
49
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
50
- });
51
- var BrandList = function (_a) {
52
- var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
53
- var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
54
- var t = useTranslation().t;
55
- var isAr = useLanguage().isAr;
56
- var data = useAppSelector(connectSelector).data;
57
- var _c = data.individualData.responseBody || {}, segments_list = _c.segments_list, team_size_list = _c.team_size_list;
58
- var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
59
- var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
60
- var selectedBrand = selectedBrandControl.field.value;
61
- var onOpenBrandList = function (event) {
62
- var _a;
63
- setAnchorEl(event.currentTarget);
64
- (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
65
- };
66
- var onCloseBrandList = function () {
67
- var _a;
68
- setAnchorEl(null);
69
- (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
70
- };
71
- var getBrandName = function (_a) {
72
- var name = _a.name;
73
- return (isAr ? name === null || name === void 0 ? void 0 : name.ar : name === null || name === void 0 ? void 0 : name.en) || '';
74
- };
75
- var getBrandId = function (item) {
76
- return item.id || '';
77
- };
78
- var isOtherBrand = function (item) {
79
- return getBrandId(item) === 'other';
80
- };
81
- var onSelectItem = function (brand) {
82
- selectedBrandControl.field.onChange(brand);
83
- if (!isOtherBrand(brand)) {
84
- setValue('salesChannels', mapSalesChannel(brand.channel_services || []), { shouldValidate: true });
85
- }
86
- if (isOtherBrand(brand)) {
87
- setValue('salesChannels', [], { shouldValidate: true });
88
- setValue('brandName', '');
89
- }
90
- setValue('segment', segments_list.find(function (_a) {
91
- var _b;
92
- var id = _a.id;
93
- return ((_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.type) === id;
94
- }), { shouldValidate: true });
95
- setValue('teamSize', team_size_list.find(function (_a) {
96
- var _b;
97
- var id = _a.id;
98
- return ((_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.team) === id;
99
- }), { shouldValidate: true });
100
- onCloseBrandList();
101
- };
102
- 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) {
103
- return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(selectedBrand) }, { children: isOtherBrand(item) ? t(getBrandName(item)) : getBrandName(item) })) }), getBrandId(item) === getBrandId(selectedBrand) && _jsx(CheckIcon, {})] }));
104
- } }) }))] }) })));
105
- };
106
- export default React.memo(BrandList);
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- interface BrandNameProps {
3
- show: boolean;
4
- fetchingBrandName: (flag: boolean) => void;
5
- brandNameChecking: boolean;
6
- }
7
- declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName }: BrandNameProps) => JSX.Element>;
8
- export default _default;
@@ -1,142 +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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
49
- import * as React from 'react';
50
- import { useTranslation } from 'react-i18next';
51
- import { useController, useFormContext } from 'react-hook-form';
52
- import Box from '@mui/material/Box';
53
- import axios from 'axios';
54
- import { styled, alpha } from '@mui/material/styles';
55
- import InfoIcon from '@mui/icons-material/Info';
56
- import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
57
- import { ScreenContainer } from '../../../shared/Containers';
58
- import CircularProgress from '@mui/material/CircularProgress';
59
- import Text from '../../../../components/Text';
60
- import Input from '../../../shared/Input';
61
- import ClearIcon from '../../../shared/ClearIcon';
62
- import Tooltip from '../../../../components/Tooltip';
63
- import Collapse from '../../../../components/Collapse';
64
- import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
65
- import CheckIcon from '../../../shared/CheckIcon';
66
- import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
67
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
68
- import { debounce } from 'lodash-es';
69
- var LabelContainerStyled = styled(Box)(function (_a) {
70
- var theme = _a.theme;
71
- return ({
72
- display: 'flex',
73
- justifyContent: 'space-between',
74
- padding: theme.spacing(0, 2.5, 1, 2.5)
75
- });
76
- });
77
- var InputLabelStyled = styled(Text)(function (_a) {
78
- var theme = _a.theme;
79
- return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
80
- });
81
- var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
82
- var theme = _a.theme;
83
- return ({
84
- width: theme.spacing(2.75),
85
- height: theme.spacing(2.125),
86
- cursor: 'pointer',
87
- color: alpha(theme.palette.text.primary, 0.4)
88
- });
89
- });
90
- var InfoIconStyled = styled(InfoIcon)(function (_a) {
91
- var theme = _a.theme;
92
- return ({
93
- width: theme.spacing(2.75),
94
- height: theme.spacing(2.125),
95
- cursor: 'pointer',
96
- color: alpha(theme.palette.text.primary, 0.4)
97
- });
98
- });
99
- var cancelToken = null;
100
- var BrandName = function (_a) {
101
- var _b;
102
- var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName;
103
- var dispatch = useAppDispatch();
104
- var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
105
- var t = useTranslation().t;
106
- var data = useAppSelector(connectSelector).data;
107
- var control = useFormContext().control;
108
- var brandControl = useController({ control: control, name: 'brandName' });
109
- var brandNameValue = brandControl.field.value;
110
- var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
111
- var checkBrand = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
112
- var onSuccess;
113
- return __generator(this, function (_a) {
114
- if (cancelToken) {
115
- cancelToken.cancel('Aborted');
116
- }
117
- cancelToken = axios.CancelToken.source();
118
- onSuccess = function () { return fetchingBrandName(false); };
119
- dispatch(checkBrandNameAvailability({ name: value, cancelToken: cancelToken.token, onSuccess: onSuccess }));
120
- return [2];
121
- });
122
- }); }, 500);
123
- var handleBrandNameChange = function (_a) {
124
- var target = _a.target;
125
- var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
126
- brandControl.field.onChange(value);
127
- };
128
- React.useEffect(function () {
129
- var _a, _b, _c;
130
- var isValid = brandNameValue && !error && brandNameValue.length > 2;
131
- var brand = (_c = (_b = (_a = data.otpData.responseBody) === null || _a === void 0 ? void 0 : _a.brand) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.en;
132
- if (isValid && (brandNameValue === null || brandNameValue === void 0 ? void 0 : brandNameValue.toLowerCase()) != brand) {
133
- fetchingBrandName(true);
134
- checkBrand(brandNameValue);
135
- }
136
- }, [brandNameValue, error]);
137
- var clearBrandName = function () {
138
- brandControl.field.onChange('');
139
- };
140
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
141
- };
142
- export default React.memo(BrandName);
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- interface SalesChannelsProps {
3
- }
4
- declare const SalesChannels: ({}: SalesChannelsProps) => JSX.Element;
5
- export default SalesChannels;
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import * as React from 'react';
3
- import { useController, useFormContext } from 'react-hook-form';
4
- import { useAppSelector, useAppDispatch } from '../../../../hooks';
5
- import { connectSelector, clearError } from '../../../app/connect/connectStore';
6
- import { mapSalesChannel } from '../../../../utils';
7
- import SalesChannel from '../../../shared/SalesChannels';
8
- var SalesChannels = function (_a) {
9
- var _b;
10
- var _c = useFormContext(), control = _c.control, setValue = _c.setValue, getValues = _c.getValues;
11
- var dispatch = useAppDispatch();
12
- var _d = useController({ control: control, name: 'salesChannels' }), fieldState = _d.fieldState, field = _d.field;
13
- var _e = useAppSelector(connectSelector), data = _e.data, error = _e.error;
14
- var _f = data.brandData, selectedBrandItem = _f.selectedBrandItem, responseBody = _f.responseBody, defaultSalesChannels = _f.salesChannels;
15
- var channelList = (responseBody || {}).channel_list;
16
- var selectedBrandControl = getValues('selectedBrandItem');
17
- React.useEffect(function () {
18
- if (selectedBrandItem.id) {
19
- setValue('selectedBrandItem', selectedBrandItem);
20
- var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
21
- field.onChange(sales);
22
- }
23
- }, [selectedBrandItem]);
24
- React.useEffect(function () {
25
- if (defaultSalesChannels.length > 0) {
26
- var sales = mapSalesChannel(defaultSalesChannels);
27
- field.onChange(sales);
28
- }
29
- }, [defaultSalesChannels]);
30
- var selectedSalesChannels = React.useMemo(function () { return mapSalesChannel(field.value); }, [(field.value || []).length]);
31
- var onChange = function (channels) {
32
- if (error)
33
- dispatch(clearError());
34
- field.onChange(channels);
35
- };
36
- return (_jsx(SalesChannel, { error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, selectFirstIconListener: selectedBrandControl === null || selectedBrandControl === void 0 ? void 0 : selectedBrandControl.id, onChange: onChange, defaultValue: selectedSalesChannels }));
37
- };
38
- export default SalesChannels;
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- interface SegmentsProps {
3
- show: boolean;
4
- onListOpen?: () => void;
5
- onListClose?: () => void;
6
- }
7
- declare const Segments: ({ show, onListOpen, onListClose }: SegmentsProps) => JSX.Element;
8
- export default Segments;
@@ -1,74 +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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { connectSelector } from '../../../app/connect/connectStore';
14
- import Collapse from '../../../../components/Collapse';
15
- import { ScreenContainer } from '../../../../features/shared/Containers';
16
- import Input from '../../../../features/shared/Input';
17
- import { useAppSelector, useLanguage } from '../../../../hooks';
18
- import React from 'react';
19
- import { useTranslation } from 'react-i18next';
20
- import { useController, useFormContext } from 'react-hook-form';
21
- import SimpleList from '../../../../components/SimpleList';
22
- import ExpandIcon from '../../../../components/ExpandIcon';
23
- import Box from '@mui/material/Box';
24
- import { styled } from '@mui/material/styles';
25
- import Text from '../../../../components/Text';
26
- import CheckIcon from '@mui/icons-material/Check';
27
- var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
28
- var theme = _a.theme, isSelected = _a.isSelected;
29
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
30
- });
31
- var CheckIconStyled = styled(CheckIcon)(function (_a) {
32
- var theme = _a.theme;
33
- return ({
34
- color: theme.palette.success.main,
35
- display: 'flex',
36
- alignItems: 'flex-end'
37
- });
38
- });
39
- var Segments = function (_a) {
40
- var _b, _c, _d, _e;
41
- var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
42
- var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
43
- var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
44
- var t = useTranslation().t;
45
- var isAr = useLanguage().isAr;
46
- var data = useAppSelector(connectSelector).data;
47
- var control = useFormContext().control;
48
- var segmentsList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segments_list) || [];
49
- var segmentControl = useController({ control: control, name: 'segment' });
50
- var segment = segmentControl.field.value;
51
- var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
52
- React.useEffect(function () {
53
- if ((segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.length) > 0) {
54
- setSegmentList(segmentsList);
55
- }
56
- }, [segmentsList]);
57
- var onOpenList = function (event) {
58
- setAnchorEl(event.currentTarget);
59
- onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
60
- };
61
- var onCloseList = function () {
62
- setAnchorEl(null);
63
- onListClose === null || onListClose === void 0 ? void 0 : onListClose();
64
- };
65
- var onSelectItem = function (segment) {
66
- onCloseList();
67
- segmentControl.field.onChange(segment);
68
- };
69
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('segment_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
70
- var _a, _b;
71
- return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIconStyled, {})] }));
72
- } }) }))] })) })));
73
- };
74
- export default Segments;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- interface TACProps {
3
- show: boolean;
4
- }
5
- declare const _default: React.MemoExoticComponent<({ show }: TACProps) => JSX.Element>;
6
- export default _default;
@@ -1,84 +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 { useTranslation } from 'react-i18next';
15
- import { useController, useFormContext } from 'react-hook-form';
16
- import Box from '@mui/material/Box';
17
- import { styled, alpha } from '@mui/material/styles';
18
- import Link from '@mui/material/Link';
19
- import CheckBox from '../../../../components/CheckBox';
20
- import { ScreenContainer } from '../../../shared/Containers';
21
- import Text from '../../../../components/Text';
22
- import Warning from '../../../../components/Warning';
23
- import { useLanguage } from '../../../../hooks';
24
- import Collapse from '../../../../components/Collapse';
25
- import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
26
- import { settingsSelector } from '../../../../app/settings';
27
- import { useAppSelector } from '../../../../hooks';
28
- var TACContainerStyled = styled(Box)(function (_a) {
29
- var theme = _a.theme;
30
- return ({
31
- display: 'flex',
32
- flexDirection: 'row',
33
- alignItems: 'center',
34
- paddingInlineStart: theme.spacing(2.5)
35
- });
36
- });
37
- var TextStyled = styled(Text)(function (_a) {
38
- var theme = _a.theme;
39
- return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
40
- });
41
- var LinkStyled = styled(Link)(function (_a) {
42
- var theme = _a.theme;
43
- return ({
44
- color: theme.palette.primary.main,
45
- fontWeight: theme.typography.fontWeightMedium,
46
- letterSpacing: theme.spacing(0)
47
- });
48
- });
49
- var CheckboxStyled = styled(CheckBox)(function (_a) {
50
- var theme = _a.theme;
51
- return ({
52
- margin: theme.spacing(0),
53
- padding: theme.spacing(0),
54
- marginInlineEnd: theme.spacing(1.5),
55
- color: theme.palette.primary.main,
56
- '& .MuiSvgIcon-root': {
57
- fontSize: theme.spacing(3.75)
58
- },
59
- '&.Mui-checked': {
60
- color: theme.palette.text.primary,
61
- borderRadius: theme.spacing(2.5)
62
- }
63
- });
64
- });
65
- var CollapseStyled = styled(Collapse)(function () { return ({
66
- width: '100%'
67
- }); });
68
- var TAC = function (_a) {
69
- var _b;
70
- var show = _a.show;
71
- var t = useTranslation().t;
72
- var isAr = useLanguage().isAr;
73
- var control = useFormContext().control;
74
- var settingsData = useAppSelector(settingsSelector).data;
75
- var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
76
- var tacChecked = tacControl.field.value;
77
- var warningMessage = (_b = tacControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
78
- var countryCode = settingsData.businessCountry.iso2.toLowerCase();
79
- var handleTACCheckedChange = function (event, checked) {
80
- tacControl.field.onChange(checked);
81
- };
82
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }) })));
83
- };
84
- export default React.memo(TAC);
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- interface TeamSizeProps {
3
- show: boolean;
4
- onListOpen?: () => void;
5
- onListClose?: () => void;
6
- }
7
- declare const TeamSize: ({ show, onListOpen, onListClose }: TeamSizeProps) => JSX.Element;
8
- export default TeamSize;
@@ -1,74 +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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { connectSelector } from '../../../app/connect/connectStore';
14
- import Box from '@mui/material/Box';
15
- import Collapse from '../../../../components/Collapse';
16
- import { ScreenContainer } from '../../../../features/shared/Containers';
17
- import Input from '../../../../features/shared/Input';
18
- import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import React from 'react';
20
- import { useTranslation } from 'react-i18next';
21
- import { useController, useFormContext } from 'react-hook-form';
22
- import SimpleList from '../../../../components/SimpleList';
23
- import ExpandIcon from '../../../../components/ExpandIcon';
24
- import { styled } from '@mui/material/styles';
25
- import Text from '../../../../components/Text';
26
- import CheckIcon from '@mui/icons-material/Check';
27
- var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
28
- var theme = _a.theme, isSelected = _a.isSelected;
29
- return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
30
- });
31
- var CheckIconStyled = styled(CheckIcon)(function (_a) {
32
- var theme = _a.theme;
33
- return ({
34
- color: theme.palette.success.main,
35
- display: 'flex',
36
- alignItems: 'flex-end'
37
- });
38
- });
39
- var TeamSize = function (_a) {
40
- var _b, _c, _d, _e;
41
- var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
42
- var _f = React.useState([]), teamSizeList = _f[0], setTeamSizeList = _f[1];
43
- var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
44
- var t = useTranslation().t;
45
- var isAr = useLanguage().isAr;
46
- var data = useAppSelector(connectSelector).data;
47
- var control = useFormContext().control;
48
- var teamSizesList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.team_size_list) || [];
49
- var teamSizeControl = useController({ control: control, name: 'teamSize' });
50
- var teamSize = teamSizeControl.field.value;
51
- var error = (_c = teamSizeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
52
- React.useEffect(function () {
53
- if ((teamSizesList === null || teamSizesList === void 0 ? void 0 : teamSizesList.length) > 0) {
54
- setTeamSizeList(teamSizesList);
55
- }
56
- }, [teamSizesList]);
57
- var onOpenList = function (event) {
58
- setAnchorEl(event.currentTarget);
59
- onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
60
- };
61
- var onCloseList = function () {
62
- setAnchorEl(null);
63
- onListClose === null || onListClose === void 0 ? void 0 : onListClose();
64
- };
65
- var onSelectItem = function (teamSize) {
66
- onCloseList();
67
- teamSizeControl.field.onChange(teamSize);
68
- };
69
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(Input, { required: true, label: t('team_size_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_team_size'), value: (isAr ? (_d = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en', 'name.ar'], list: teamSizeList, onSelectItem: onSelectItem, renderItem: function (item) {
70
- var _a, _b;
71
- return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(CheckIconStyled, {})] }));
72
- } }) }))] })) })));
73
- };
74
- export default TeamSize;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,38 +0,0 @@
1
- import * as yup from 'yup';
2
- export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
6
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
7
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
8
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
9
- }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
10
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
- }>>[] | undefined>;
12
- segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
13
- teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
14
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
- salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
18
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
19
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
20
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
- }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
22
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
23
- }>>[] | undefined>;
24
- segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
25
- teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
26
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
27
- salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
28
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
29
- }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
30
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
31
- }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
32
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
33
- }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
34
- id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
35
- }>>[] | undefined>;
36
- segment: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
37
- teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
38
- }>>>;