@tap-payments/auth-jsconnect 2.1.43-test → 2.1.44-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.
@@ -831,16 +831,16 @@ export var connectSlice = createSlice({
831
831
  });
832
832
  state.data.brandData.termAndConditionChecked = !!termAndCondition;
833
833
  }
834
- var firstBrand = (_b = (_a = state.data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.brand_list[0];
834
+ var selectedBrand = ((_b = (_a = state.data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.brand_list[0]) || leadResponse.brand;
835
835
  state.data.brandData.segment = rest.segments_list.find(function (_a) {
836
836
  var _b;
837
837
  var id = _a.id;
838
- return ((_b = firstBrand === null || firstBrand === void 0 ? void 0 : firstBrand.segment) === null || _b === void 0 ? void 0 : _b.type) === id;
838
+ return ((_b = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _b === void 0 ? void 0 : _b.type) === id;
839
839
  });
840
840
  state.data.brandData.teamSize = rest.team_size_list.find(function (_a) {
841
841
  var _b;
842
842
  var id = _a.id;
843
- return ((_b = firstBrand === null || firstBrand === void 0 ? void 0 : firstBrand.segment) === null || _b === void 0 ? void 0 : _b.team) === id;
843
+ return ((_b = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _b === void 0 ? void 0 : _b.team) === id;
844
844
  });
845
845
  state.data.individualData = formData;
846
846
  state.data.individualData.responseBody = rest;
@@ -33,16 +33,16 @@ var ListType;
33
33
  (function (ListType) {
34
34
  ListType["SegmentsList"] = "SegmentsList";
35
35
  ListType["TeamSizeList"] = "TeamSizeList";
36
+ ListType["BrandList"] = "BrandList";
36
37
  })(ListType || (ListType = {}));
37
38
  var Merchant = function (_a) {
38
39
  var _b;
39
40
  var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
40
- var _d = React.useState(false), isBrandListOpen = _d[0], setIsBrandListOpen = _d[1];
41
- var _e = React.useState(false), isRequiredNewBrand = _e[0], setIsRequiredNewBrand = _e[1];
42
- var _f = useAppSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error;
43
- var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels, segment = _g.segment, teamSize = _g.teamSize;
41
+ var _d = React.useState(false), isRequiredNewBrand = _d[0], setIsRequiredNewBrand = _d[1];
42
+ var _e = useAppSelector(connectSelector), data = _e.data, loading = _e.loading, error = _e.error;
43
+ var _f = data.brandData, brandName = _f.brandName, selectedBrandItem = _f.selectedBrandItem, termAndConditionChecked = _f.termAndConditionChecked, responseBody = _f.responseBody, salesChannels = _f.salesChannels, segment = _f.segment, teamSize = _f.teamSize;
44
44
  var brandList = (responseBody || {}).brand_list;
45
- var _h = React.useState(), listActive = _h[0], setListActive = _h[1];
45
+ var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
46
46
  var methods = useForm({
47
47
  resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
48
48
  defaultValues: {
@@ -81,7 +81,7 @@ var Merchant = function (_a) {
81
81
  if (termAndConditionChecked === true)
82
82
  methods.setValue('termAndConditionChecked', termAndConditionChecked);
83
83
  }, [termAndConditionChecked]);
84
- var brandErrChecks = !!Object.entries(methods.formState.errors).length || !methods.formState.isValid || !!error;
84
+ var brandErrChecks = !!Object.entries(methods.formState.errors).length || !!error;
85
85
  var disabled = brandErrChecks || brandNameChecking || ((_b = data.brandData.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) === '5';
86
86
  var hasBrandList = (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0;
87
87
  var isOtherBrand = (brandListItem === null || brandListItem === void 0 ? void 0 : brandListItem.id) === 'other' && hasBrandList;
@@ -94,6 +94,7 @@ var Merchant = function (_a) {
94
94
  };
95
95
  var isSegmentsListActive = listActive === ListType.SegmentsList;
96
96
  var isTeamSizeListActive = listActive === ListType.TeamSizeList;
97
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Segments, { show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen }), _jsx(Collapse, __assign({ in: !isBrandListOpen, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
97
+ var isBrandListActive = listActive === ListType.BrandList;
98
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand) && !isTeamSizeListActive && !isSegmentsListActive, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Segments, { show: !isTeamSizeListActive && !isBrandListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentsListActive && !isBrandListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !listActive }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
98
99
  };
99
100
  export default React.memo(Merchant);
@@ -20,7 +20,7 @@ import { useTranslation } from 'react-i18next';
20
20
  import { useController, useFormContext } from 'react-hook-form';
21
21
  import SimpleList from '../../../../components/SimpleList';
22
22
  import ExpandIcon from '../../../../components/ExpandIcon';
23
- import Container from '@mui/material/Container';
23
+ import Box from '@mui/material/Box';
24
24
  import { styled } from '@mui/material/styles';
25
25
  import Text from '../../../../components/Text';
26
26
  import CheckIcon from '@mui/icons-material/Check';
@@ -66,9 +66,9 @@ var Segments = function (_a) {
66
66
  onCloseList();
67
67
  segmentControl.field.onChange(segment);
68
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.en', 'name.ar'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
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
70
  var _a, _b;
71
- return (_jsxs(_Fragment, { children: [_jsx(Container, { 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, {})] }));
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
72
  } }) }))] })) })));
73
73
  };
74
74
  export default Segments;
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { connectSelector } from '../../../app/connect/connectStore';
14
+ import Box from '@mui/material/Box';
14
15
  import Collapse from '../../../../components/Collapse';
15
16
  import { ScreenContainer } from '../../../../features/shared/Containers';
16
17
  import Input from '../../../../features/shared/Input';
@@ -20,7 +21,6 @@ import { useTranslation } from 'react-i18next';
20
21
  import { useController, useFormContext } from 'react-hook-form';
21
22
  import SimpleList from '../../../../components/SimpleList';
22
23
  import ExpandIcon from '../../../../components/ExpandIcon';
23
- import Container from '@mui/material/Container';
24
24
  import { styled } from '@mui/material/styles';
25
25
  import Text from '../../../../components/Text';
26
26
  import CheckIcon from '@mui/icons-material/Check';
@@ -68,7 +68,7 @@ var TeamSize = function (_a) {
68
68
  };
69
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
70
  var _a, _b;
71
- return (_jsxs(_Fragment, { children: [_jsx(Container, { 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, {})] }));
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
72
  } }) }))] })) })));
73
73
  };
74
74
  export default TeamSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.43-test",
3
+ "version": "2.1.44-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",