@redneckz/wildless-cms-uni-blocks 0.14.869 → 0.14.870

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/bundle/bundle.umd.js +50 -53
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  4. package/bundle/components/OfficesAtmsMap/OfficesAtmsMapProps.d.ts +1 -0
  5. package/bundle/components/OfficesAtmsMap/filters.d.ts +23 -13
  6. package/dist/components/AdTile/AdTile.js.map +1 -1
  7. package/dist/components/OfficesAtmsMap/AtmsMap.js +3 -23
  8. package/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  9. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  10. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +3 -3
  11. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  12. package/dist/components/OfficesAtmsMap/OfficesAtmsMapProps.d.ts +1 -0
  13. package/dist/components/OfficesAtmsMap/filters.d.ts +23 -13
  14. package/dist/components/OfficesAtmsMap/filters.js +28 -12
  15. package/dist/components/OfficesAtmsMap/filters.js.map +1 -1
  16. package/dist/components/OfficesAtmsMap/renderButtonsGroup.js +1 -1
  17. package/dist/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -1
  18. package/dist/components/OfficesAtmsMap/renderDescriptionBlock.js +2 -1
  19. package/dist/components/OfficesAtmsMap/renderDescriptionBlock.js.map +1 -1
  20. package/dist/components/OfficesAtmsMap/renderHeading.js +1 -1
  21. package/dist/components/OfficesAtmsMap/renderHeading.js.map +1 -1
  22. package/dist/ui-kit/PriceList/PriceList.js +1 -1
  23. package/dist/ui-kit/PriceList/PriceList.js.map +1 -1
  24. package/dist/ui-kit/TopItem/TopItem.js.map +1 -1
  25. package/lib/common.css +1 -1
  26. package/lib/components/AdTile/AdTile.js.map +1 -1
  27. package/lib/components/OfficesAtmsMap/AtmsMap.js +3 -23
  28. package/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  29. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  30. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +3 -3
  31. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  32. package/lib/components/OfficesAtmsMap/OfficesAtmsMapProps.d.ts +1 -0
  33. package/lib/components/OfficesAtmsMap/filters.d.ts +23 -13
  34. package/lib/components/OfficesAtmsMap/filters.js +28 -12
  35. package/lib/components/OfficesAtmsMap/filters.js.map +1 -1
  36. package/lib/components/OfficesAtmsMap/renderButtonsGroup.js +1 -1
  37. package/lib/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -1
  38. package/lib/components/OfficesAtmsMap/renderDescriptionBlock.js +2 -1
  39. package/lib/components/OfficesAtmsMap/renderDescriptionBlock.js.map +1 -1
  40. package/lib/components/OfficesAtmsMap/renderHeading.js +1 -1
  41. package/lib/components/OfficesAtmsMap/renderHeading.js.map +1 -1
  42. package/lib/ui-kit/PriceList/PriceList.js +1 -1
  43. package/lib/ui-kit/PriceList/PriceList.js.map +1 -1
  44. package/lib/ui-kit/TopItem/TopItem.js.map +1 -1
  45. package/mobile/bundle/bundle.umd.js +48 -51
  46. package/mobile/bundle/bundle.umd.min.js +1 -1
  47. package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  48. package/mobile/bundle/components/OfficesAtmsMap/OfficesAtmsMapProps.d.ts +1 -0
  49. package/mobile/bundle/components/OfficesAtmsMap/filters.d.ts +23 -13
  50. package/mobile/dist/components/AdTile/AdTile.js.map +1 -1
  51. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js +3 -23
  52. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  53. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  54. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +3 -3
  55. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  56. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapProps.d.ts +1 -0
  57. package/mobile/dist/components/OfficesAtmsMap/filters.d.ts +23 -13
  58. package/mobile/dist/components/OfficesAtmsMap/filters.js +28 -12
  59. package/mobile/dist/components/OfficesAtmsMap/filters.js.map +1 -1
  60. package/mobile/dist/components/OfficesAtmsMap/renderButtonsGroup.js +1 -1
  61. package/mobile/dist/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -1
  62. package/mobile/dist/components/OfficesAtmsMap/renderDescriptionBlock.js +2 -1
  63. package/mobile/dist/components/OfficesAtmsMap/renderDescriptionBlock.js.map +1 -1
  64. package/mobile/dist/components/OfficesAtmsMap/renderHeading.js +1 -1
  65. package/mobile/dist/components/OfficesAtmsMap/renderHeading.js.map +1 -1
  66. package/mobile/dist/ui-kit/PriceList/PriceList.js +1 -1
  67. package/mobile/dist/ui-kit/PriceList/PriceList.js.map +1 -1
  68. package/mobile/dist/ui-kit/TopItem/TopItem.js.map +1 -1
  69. package/mobile/lib/common.css +1 -1
  70. package/mobile/lib/components/AdTile/AdTile.js.map +1 -1
  71. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js +3 -23
  72. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  73. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +0 -1
  74. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +3 -3
  75. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  76. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapProps.d.ts +1 -0
  77. package/mobile/lib/components/OfficesAtmsMap/filters.d.ts +23 -13
  78. package/mobile/lib/components/OfficesAtmsMap/filters.js +28 -12
  79. package/mobile/lib/components/OfficesAtmsMap/filters.js.map +1 -1
  80. package/mobile/lib/components/OfficesAtmsMap/renderButtonsGroup.js +1 -1
  81. package/mobile/lib/components/OfficesAtmsMap/renderButtonsGroup.js.map +1 -1
  82. package/mobile/lib/components/OfficesAtmsMap/renderDescriptionBlock.js +2 -1
  83. package/mobile/lib/components/OfficesAtmsMap/renderDescriptionBlock.js.map +1 -1
  84. package/mobile/lib/components/OfficesAtmsMap/renderHeading.js +1 -1
  85. package/mobile/lib/components/OfficesAtmsMap/renderHeading.js.map +1 -1
  86. package/mobile/lib/ui-kit/PriceList/PriceList.js +1 -1
  87. package/mobile/lib/ui-kit/PriceList/PriceList.js.map +1 -1
  88. package/mobile/lib/ui-kit/TopItem/TopItem.js.map +1 -1
  89. package/mobile/src/components/AdTile/AdTile.tsx +1 -1
  90. package/mobile/src/components/OfficesAtmsMap/AtmsMap.tsx +3 -31
  91. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +3 -3
  92. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapProps.tsx +1 -0
  93. package/mobile/src/components/OfficesAtmsMap/filters.ts +31 -13
  94. package/mobile/src/components/OfficesAtmsMap/renderButtonsGroup.tsx +1 -1
  95. package/mobile/src/components/OfficesAtmsMap/renderDescriptionBlock.tsx +15 -17
  96. package/mobile/src/components/OfficesAtmsMap/renderHeading.tsx +13 -12
  97. package/mobile/src/ui-kit/PriceList/PriceList.tsx +1 -1
  98. package/mobile/src/ui-kit/TopItem/TopItem.tsx +1 -1
  99. package/package.json +1 -1
  100. package/src/components/AdTile/AdTile.tsx +1 -1
  101. package/src/components/OfficesAtmsMap/AtmsMap.tsx +3 -31
  102. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +3 -3
  103. package/src/components/OfficesAtmsMap/OfficesAtmsMapProps.tsx +1 -0
  104. package/src/components/OfficesAtmsMap/filters.ts +31 -13
  105. package/src/components/OfficesAtmsMap/renderButtonsGroup.tsx +1 -1
  106. package/src/components/OfficesAtmsMap/renderDescriptionBlock.tsx +15 -17
  107. package/src/components/OfficesAtmsMap/renderHeading.tsx +13 -12
  108. package/src/ui-kit/PriceList/PriceList.tsx +1 -1
  109. package/src/ui-kit/TopItem/TopItem.tsx +1 -1
@@ -3,44 +3,31 @@ import { useLocation } from '../../hooks/useLocation';
3
3
  import { type ComponentType } from '../../model/ComponentType';
4
4
  import { type AtmsDef } from './OfficesAtmsMapContent';
5
5
  import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
6
- import { type Atm } from './OfficesAtmsMapProps';
7
6
  import { getAtmPoint, renderAtmCard } from './renderAtmCard';
8
7
  import { useAtms } from './useAtms';
9
8
 
10
9
  const INITIAL_FILTRATION_STATE = {
11
- terminalTypeAtms: true,
12
10
  terminalTypeTerm: false,
11
+ terminalTypeAtms: false,
13
12
  workAllTime: false,
14
13
  billAcceptorEnable: false,
15
14
  locationDisabledPeople: false,
16
15
  designDisabledPeople: false,
17
16
  };
18
17
 
19
- const FILTRATION_PREDICATES = {
20
- terminalTypeAtms: (item: Atm) => item.terminalType?.toLowerCase() === 'банкомат',
21
- terminalTypeTerm: (item: Atm) => item.terminalType?.toLowerCase() === 'терминал',
22
- workAllTime: (item: Atm) => item.workTime?.toLowerCase() === 'круглосуточно',
23
- billAcceptorEnable: (item: Atm) => Boolean(item.billAcceptorEnable),
24
- locationDisabledPeople: (item: Atm) => Boolean(item.locationDisabledPeople),
25
- designDisabledPeople: (item: Atm) => Boolean(item.designDisabledPeople),
26
- };
27
-
28
18
  export interface AtmsMapProps extends ComponentType {
29
19
  descriptionData?: AtmsDef;
30
20
  }
31
21
 
32
22
  export const AtmsMap = JSX<AtmsMapProps>(({ descriptionData, className }) => {
33
23
  const currentLocation = useLocation();
34
-
35
24
  const regionCode = currentLocation?.code ?? '000';
36
-
37
- const { data: officesData, isLoad } = useAtms(regionCode);
25
+ const { data, isLoad } = useAtms(regionCode);
38
26
 
39
27
  return (
40
28
  <OfficesAtmsMapLayout
41
29
  className={className}
42
- filterItems={filterItems}
43
- data={officesData}
30
+ data={data}
44
31
  isLoad={isLoad}
45
32
  initFilterState={INITIAL_FILTRATION_STATE}
46
33
  renderCard={renderAtmCard}
@@ -50,18 +37,3 @@ export const AtmsMap = JSX<AtmsMapProps>(({ descriptionData, className }) => {
50
37
  />
51
38
  );
52
39
  });
53
-
54
- const filterItems = (data: Atm[], filtrationState: Record<string, boolean>) => {
55
- const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
56
- const filtersOR = truthyFilters.filter((_) => _.startsWith('terminalType'));
57
- const filtersAND = truthyFilters.filter((_) => !filtersOR.includes(_));
58
-
59
- return data.filter((item) => {
60
- const resultAND = filtersAND.every((_) => FILTRATION_PREDICATES[_](item));
61
- const resultOR = filtersOR.length
62
- ? filtersOR.some((_) => FILTRATION_PREDICATES[_](item))
63
- : true;
64
-
65
- return resultAND && resultOR;
66
- });
67
- };
@@ -27,7 +27,6 @@ export interface OfficesAtmsMapLayoutProps<T> extends ComponentType, TitleProps
27
27
  remoteWorkplaces?: T[];
28
28
  renderCard?: (item: T, index: number) => VNode;
29
29
  renderRemoteWorkplaceCard?: (item: T, index: number) => VNode;
30
- filterItems?: (data: T[], filtrationState: InitFilterState) => T[];
31
30
  getBalloon?: (item: T) => BalloonContent;
32
31
  getBalloonRemoteWorkplaces?: (item: T) => BalloonContent;
33
32
  initFilterState?: InitFilterState;
@@ -46,12 +45,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
46
45
  renderCard = defaultEmptyFunction,
47
46
  renderRemoteWorkplaceCard = defaultEmptyFunction,
48
47
  getBalloon = defaultEmptyFunction,
48
+ initFilterState = INITIAL_FILTRATION_STATE,
49
49
  getBalloonRemoteWorkplaces = defaultEmptyFunction,
50
50
  descriptionData,
51
51
  title,
52
52
  }) => {
53
53
  const onlyOffice = title?.includes('Офис');
54
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE);
54
+ const [filtrationState, { field, reset }] = useForm(initFilterState);
55
55
 
56
56
  const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
57
57
  data,
@@ -66,7 +66,7 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
66
66
  return (
67
67
  <div className={style('space-y-1', className)}>
68
68
  <div className="bg-white">
69
- <div className="p-3xl pb-0">
69
+ <div className="p-3xl pb-0 grid gap-xl">
70
70
  {renderHeading(title, lengthItems)}
71
71
  {descriptionData ? renderDescriptionBlock(descriptionData) : null}
72
72
  {onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton)}
@@ -112,4 +112,5 @@ export interface Atm {
112
112
  gpsLongitude?: number;
113
113
  locationDisabledPeople?: boolean;
114
114
  designDisabledPeople?: boolean;
115
+ terminalTypeAtms?: boolean;
115
116
  }
@@ -1,4 +1,11 @@
1
- import type { Branch, RemoteWorkplace } from './OfficesAtmsMapProps';
1
+ import { type Atm, type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
2
+
3
+ const ATMS_INITIAL_FILTRATION_STATE = {
4
+ billAcceptorEnable: false,
5
+ workAllTime: false,
6
+ terminalTypeTerm: false,
7
+ terminalTypeAtms: false,
8
+ };
2
9
 
3
10
  export const INITIAL_FILTRATION_STATE = {
4
11
  workingSaturday: false,
@@ -11,29 +18,40 @@ export const INITIAL_FILTRATION_STATE = {
11
18
  bullionOperations: false,
12
19
  preciousMetalsOperations: false,
13
20
  transferringDataToBiometricSystem: false,
21
+ ...ATMS_INITIAL_FILTRATION_STATE,
14
22
  };
15
23
 
16
24
  export const FILTRATION_LABELS = {
17
- safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
18
- workingSaturday: 'Открыты по субботам',
19
- terminalTypeAtms: 'Банкоматы',
20
- terminalTypeTerm: 'Терминалы',
21
- workAllTime: 'Круглосуточно',
22
25
  billAcceptorEnable: 'Прием наличных',
23
- premiumService: 'Премиальное обслуживание',
24
- privateBanking: 'Услуга Private banking',
25
- sellingCoins: 'Продажа монет из драгоценных металлов',
26
- buyingCoins: 'Покупка монет из драгоценных металлов',
27
26
  bullionOperations: 'Операции со слитками',
28
- preciousMetalsOperations: 'Операции с драгоценными металлами',
29
- transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
30
- locationDisabledPeople: 'Для маломобильных',
27
+ buyingCoins: 'Покупка монет из драгоценных металлов',
31
28
  designDisabledPeople: 'Для слабовидящих',
29
+ locationDisabledPeople: 'Для маломобильных',
30
+ preciousMetalsOperations: 'Операции с драгоценными металлами',
31
+ premiumService: 'Премиальное обслуживание',
32
+ privateBanking: 'Услуга Private banking',
32
33
  remoteWorkplace: 'Удаленное рабочее место',
34
+ terminalTypeAtms: 'Банкоматы',
35
+ terminalTypeTerm: 'Терминалы',
36
+ transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
37
+ sellingCoins: 'Продажа монет из драгоценных металлов',
38
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
33
39
  serviceDisabledPeople: 'Для маломобильных граждан',
40
+ workAllTime: 'Круглосуточно',
41
+ workingSaturday: 'Открыты по субботам',
42
+ };
43
+
44
+ const FILTRATION_PREDICATES_ATMS = {
45
+ terminalTypeTerm: (item: Atm) => item.terminalType?.toLowerCase() === 'терминал',
46
+ terminalTypeAtms: (item: Atm) => item.terminalType?.toLowerCase() === 'банкомат',
47
+ workAllTime: (item: Atm) => item.workTime?.toLowerCase() === 'круглосуточно',
48
+ billAcceptorEnable: (item: Atm) => Boolean(item.billAcceptorEnable),
49
+ locationDisabledPeople: (item: Atm) => Boolean(item.locationDisabledPeople),
50
+ designDisabledPeople: (item: Atm) => Boolean(item.designDisabledPeople),
34
51
  };
35
52
 
36
53
  export const FILTRATION_PREDICATES = {
54
+ ...FILTRATION_PREDICATES_ATMS,
37
55
  workingSaturday: (item: Branch | RemoteWorkplace) =>
38
56
  Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
39
57
  premiumService: (item: Branch | RemoteWorkplace) =>
@@ -29,7 +29,7 @@ export const renderButtonsGroup = (
29
29
  );
30
30
 
31
31
  return (
32
- <div className="flex gap-lg flex-col sm:flex-row pb-lg">
32
+ <div className="flex gap-lg flex-col sm:flex-row">
33
33
  <Button data-id="all" onClick={(e) => handleClick(e, 'all', data)} version={allButtonVersion}>
34
34
  Для физических лиц
35
35
  </Button>
@@ -1,29 +1,27 @@
1
1
  import { Img } from '../../ui-kit/Img/Img';
2
2
  import { RichText } from '../../ui-kit/RichText/RichText';
3
3
  import { Text } from '../../ui-kit/Text/Text';
4
- import { type AtmsDef } from './OfficesAtmsMapContent';
4
+ import { type AtmsDef, type ItemList } from './OfficesAtmsMapContent';
5
5
 
6
6
  export const renderDescriptionBlock = ({ __html, list, richVersion }: AtmsDef) =>
7
7
  __html || list?.length ? (
8
- <div className="mb-2xl border-b sm:border border-main-divider sm:rounded-md">
9
- {__html ? (
10
- <div className="mb-2xl">
11
- <RichText __html={__html} richVersion={richVersion} />
12
- </div>
13
- ) : null}
8
+ <div className="border-b sm:border border-main-divider rounded-md space-y-2xl">
9
+ {__html ? <RichText __html={__html} richVersion={richVersion} /> : null}
14
10
  {list?.length ? (
15
11
  <div className="flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl">
16
- {list.map((item, i) => (
17
- <div key={String(i)} className="flex gap-xs items-center">
18
- {item?.image ? <Img image={item.image} /> : null}
19
- {item?.text ? (
20
- <Text size="text-m" font="font-light">
21
- {item.text}
22
- </Text>
23
- ) : null}
24
- </div>
25
- ))}
12
+ {list.map(renderItem)}
26
13
  </div>
27
14
  ) : null}
28
15
  </div>
29
16
  ) : null;
17
+
18
+ const renderItem = (item: ItemList, i: number) => (
19
+ <div key={String(i)} className="flex gap-xs items-center">
20
+ <Img image={item.image} />
21
+ {item?.text ? (
22
+ <Text size="text-m" font="font-light">
23
+ {item.text}
24
+ </Text>
25
+ ) : null}
26
+ </div>
27
+ );
@@ -1,15 +1,16 @@
1
1
  import { Heading } from '../../ui-kit/Heading/Heading';
2
2
  import { Text } from '../../ui-kit/Text/Text';
3
3
 
4
- export const renderHeading = (title?: string, lengthItems?: number) => (
5
- <div className="flex flex-col sm:flex-row gap-xs mb-2xl">
6
- <Heading headingType="h3">
7
- <span suppressHydrationWarning={true}>{title}</span>
8
- {lengthItems ? (
9
- <Text size="text-h2" color="text-secondary-text">
10
- <span suppressHydrationWarning={true}>{` (${lengthItems})`}</span>
11
- </Text>
12
- ) : null}
13
- </Heading>
14
- </div>
15
- );
4
+ export const renderHeading = (title?: string, lengthItems?: number) =>
5
+ title ? (
6
+ <div className="flex flex-row gap-xs">
7
+ <Heading headingType="h3">
8
+ <span suppressHydrationWarning>{title}</span>
9
+ {lengthItems ? (
10
+ <Text size="text-h2" color="text-secondary-text">
11
+ <span suppressHydrationWarning>{` (${lengthItems})`}</span>
12
+ </Text>
13
+ ) : null}
14
+ </Heading>
15
+ </div>
16
+ ) : null;
@@ -18,7 +18,7 @@ export const PriceList = JSX<PriceListProps>(({ priceList }) =>
18
18
  const renderPriceListItem = ({ label, amount, unit }: PriceItem, i: number) => (
19
19
  <div
20
20
  key={String(i)}
21
- className="basis-full flex flex-col-reverse sm:flex-row sm:justify-between sm:bg-main-divider sm:py-m sm:px-lg sm:rounded-md items-baseline whitespace-pre"
21
+ className="basis-full flex flex-col-reverse sm:flex-row sm:justify-between sm:bg-main-divider sm:py-m sm:px-lg rounded-md items-baseline whitespace-pre"
22
22
  role="listitem"
23
23
  >
24
24
  <Text font="font-light" size="text-l" color="text-secondary-text">
@@ -31,7 +31,7 @@ export const TopItem = JSX<TopItemProps>(
31
31
  // eslint-disable-next-line react/jsx-props-no-spreading
32
32
  {...getAspectsAttributes(data)}
33
33
  >
34
- <span suppressHydrationWarning={true} className={getTextStyle(active, flat)}>
34
+ <span suppressHydrationWarning className={getTextStyle(active, flat)}>
35
35
  {text || children}
36
36
  </span>
37
37
  </a>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.869",
3
+ "version": "0.14.870",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -20,7 +20,7 @@ export const AdTile = JSX<AdTileProps>((props) => {
20
20
  const content = items?.[tileIndex];
21
21
 
22
22
  return content ? (
23
- <ProductBlock suppressHydrationWarning={true} {...content} {...props} />
23
+ <ProductBlock suppressHydrationWarning {...content} {...props} />
24
24
  ) : (
25
25
  <BlockWrapper {...props}>
26
26
  <Shimmer />
@@ -3,44 +3,31 @@ import { useLocation } from '../../hooks/useLocation';
3
3
  import { type ComponentType } from '../../model/ComponentType';
4
4
  import { type AtmsDef } from './OfficesAtmsMapContent';
5
5
  import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
6
- import { type Atm } from './OfficesAtmsMapProps';
7
6
  import { getAtmPoint, renderAtmCard } from './renderAtmCard';
8
7
  import { useAtms } from './useAtms';
9
8
 
10
9
  const INITIAL_FILTRATION_STATE = {
11
- terminalTypeAtms: true,
12
10
  terminalTypeTerm: false,
11
+ terminalTypeAtms: false,
13
12
  workAllTime: false,
14
13
  billAcceptorEnable: false,
15
14
  locationDisabledPeople: false,
16
15
  designDisabledPeople: false,
17
16
  };
18
17
 
19
- const FILTRATION_PREDICATES = {
20
- terminalTypeAtms: (item: Atm) => item.terminalType?.toLowerCase() === 'банкомат',
21
- terminalTypeTerm: (item: Atm) => item.terminalType?.toLowerCase() === 'терминал',
22
- workAllTime: (item: Atm) => item.workTime?.toLowerCase() === 'круглосуточно',
23
- billAcceptorEnable: (item: Atm) => Boolean(item.billAcceptorEnable),
24
- locationDisabledPeople: (item: Atm) => Boolean(item.locationDisabledPeople),
25
- designDisabledPeople: (item: Atm) => Boolean(item.designDisabledPeople),
26
- };
27
-
28
18
  export interface AtmsMapProps extends ComponentType {
29
19
  descriptionData?: AtmsDef;
30
20
  }
31
21
 
32
22
  export const AtmsMap = JSX<AtmsMapProps>(({ descriptionData, className }) => {
33
23
  const currentLocation = useLocation();
34
-
35
24
  const regionCode = currentLocation?.code ?? '000';
36
-
37
- const { data: officesData, isLoad } = useAtms(regionCode);
25
+ const { data, isLoad } = useAtms(regionCode);
38
26
 
39
27
  return (
40
28
  <OfficesAtmsMapLayout
41
29
  className={className}
42
- filterItems={filterItems}
43
- data={officesData}
30
+ data={data}
44
31
  isLoad={isLoad}
45
32
  initFilterState={INITIAL_FILTRATION_STATE}
46
33
  renderCard={renderAtmCard}
@@ -50,18 +37,3 @@ export const AtmsMap = JSX<AtmsMapProps>(({ descriptionData, className }) => {
50
37
  />
51
38
  );
52
39
  });
53
-
54
- const filterItems = (data: Atm[], filtrationState: Record<string, boolean>) => {
55
- const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
56
- const filtersOR = truthyFilters.filter((_) => _.startsWith('terminalType'));
57
- const filtersAND = truthyFilters.filter((_) => !filtersOR.includes(_));
58
-
59
- return data.filter((item) => {
60
- const resultAND = filtersAND.every((_) => FILTRATION_PREDICATES[_](item));
61
- const resultOR = filtersOR.length
62
- ? filtersOR.some((_) => FILTRATION_PREDICATES[_](item))
63
- : true;
64
-
65
- return resultAND && resultOR;
66
- });
67
- };
@@ -27,7 +27,6 @@ export interface OfficesAtmsMapLayoutProps<T> extends ComponentType, TitleProps
27
27
  remoteWorkplaces?: T[];
28
28
  renderCard?: (item: T, index: number) => VNode;
29
29
  renderRemoteWorkplaceCard?: (item: T, index: number) => VNode;
30
- filterItems?: (data: T[], filtrationState: InitFilterState) => T[];
31
30
  getBalloon?: (item: T) => BalloonContent;
32
31
  getBalloonRemoteWorkplaces?: (item: T) => BalloonContent;
33
32
  initFilterState?: InitFilterState;
@@ -46,12 +45,13 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
46
45
  renderCard = defaultEmptyFunction,
47
46
  renderRemoteWorkplaceCard = defaultEmptyFunction,
48
47
  getBalloon = defaultEmptyFunction,
48
+ initFilterState = INITIAL_FILTRATION_STATE,
49
49
  getBalloonRemoteWorkplaces = defaultEmptyFunction,
50
50
  descriptionData,
51
51
  title,
52
52
  }) => {
53
53
  const onlyOffice = title?.includes('Офис');
54
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE);
54
+ const [filtrationState, { field, reset }] = useForm(initFilterState);
55
55
 
56
56
  const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
57
57
  data,
@@ -66,7 +66,7 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm |
66
66
  return (
67
67
  <div className={style('space-y-1', className)}>
68
68
  <div className="bg-white">
69
- <div className="p-3xl pb-0">
69
+ <div className="p-3xl pb-0 grid gap-xl">
70
70
  {renderHeading(title, lengthItems)}
71
71
  {descriptionData ? renderDescriptionBlock(descriptionData) : null}
72
72
  {onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton)}
@@ -112,4 +112,5 @@ export interface Atm {
112
112
  gpsLongitude?: number;
113
113
  locationDisabledPeople?: boolean;
114
114
  designDisabledPeople?: boolean;
115
+ terminalTypeAtms?: boolean;
115
116
  }
@@ -1,4 +1,11 @@
1
- import type { Branch, RemoteWorkplace } from './OfficesAtmsMapProps';
1
+ import { type Atm, type Branch, type RemoteWorkplace } from './OfficesAtmsMapProps';
2
+
3
+ const ATMS_INITIAL_FILTRATION_STATE = {
4
+ billAcceptorEnable: false,
5
+ workAllTime: false,
6
+ terminalTypeTerm: false,
7
+ terminalTypeAtms: false,
8
+ };
2
9
 
3
10
  export const INITIAL_FILTRATION_STATE = {
4
11
  workingSaturday: false,
@@ -11,29 +18,40 @@ export const INITIAL_FILTRATION_STATE = {
11
18
  bullionOperations: false,
12
19
  preciousMetalsOperations: false,
13
20
  transferringDataToBiometricSystem: false,
21
+ ...ATMS_INITIAL_FILTRATION_STATE,
14
22
  };
15
23
 
16
24
  export const FILTRATION_LABELS = {
17
- safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
18
- workingSaturday: 'Открыты по субботам',
19
- terminalTypeAtms: 'Банкоматы',
20
- terminalTypeTerm: 'Терминалы',
21
- workAllTime: 'Круглосуточно',
22
25
  billAcceptorEnable: 'Прием наличных',
23
- premiumService: 'Премиальное обслуживание',
24
- privateBanking: 'Услуга Private banking',
25
- sellingCoins: 'Продажа монет из драгоценных металлов',
26
- buyingCoins: 'Покупка монет из драгоценных металлов',
27
26
  bullionOperations: 'Операции со слитками',
28
- preciousMetalsOperations: 'Операции с драгоценными металлами',
29
- transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
30
- locationDisabledPeople: 'Для маломобильных',
27
+ buyingCoins: 'Покупка монет из драгоценных металлов',
31
28
  designDisabledPeople: 'Для слабовидящих',
29
+ locationDisabledPeople: 'Для маломобильных',
30
+ preciousMetalsOperations: 'Операции с драгоценными металлами',
31
+ premiumService: 'Премиальное обслуживание',
32
+ privateBanking: 'Услуга Private banking',
32
33
  remoteWorkplace: 'Удаленное рабочее место',
34
+ terminalTypeAtms: 'Банкоматы',
35
+ terminalTypeTerm: 'Терминалы',
36
+ transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
37
+ sellingCoins: 'Продажа монет из драгоценных металлов',
38
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
33
39
  serviceDisabledPeople: 'Для маломобильных граждан',
40
+ workAllTime: 'Круглосуточно',
41
+ workingSaturday: 'Открыты по субботам',
42
+ };
43
+
44
+ const FILTRATION_PREDICATES_ATMS = {
45
+ terminalTypeTerm: (item: Atm) => item.terminalType?.toLowerCase() === 'терминал',
46
+ terminalTypeAtms: (item: Atm) => item.terminalType?.toLowerCase() === 'банкомат',
47
+ workAllTime: (item: Atm) => item.workTime?.toLowerCase() === 'круглосуточно',
48
+ billAcceptorEnable: (item: Atm) => Boolean(item.billAcceptorEnable),
49
+ locationDisabledPeople: (item: Atm) => Boolean(item.locationDisabledPeople),
50
+ designDisabledPeople: (item: Atm) => Boolean(item.designDisabledPeople),
34
51
  };
35
52
 
36
53
  export const FILTRATION_PREDICATES = {
54
+ ...FILTRATION_PREDICATES_ATMS,
37
55
  workingSaturday: (item: Branch | RemoteWorkplace) =>
38
56
  Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
39
57
  premiumService: (item: Branch | RemoteWorkplace) =>
@@ -29,7 +29,7 @@ export const renderButtonsGroup = (
29
29
  );
30
30
 
31
31
  return (
32
- <div className="flex gap-lg flex-col sm:flex-row pb-lg">
32
+ <div className="flex gap-lg flex-col sm:flex-row">
33
33
  <Button data-id="all" onClick={(e) => handleClick(e, 'all', data)} version={allButtonVersion}>
34
34
  Для физических лиц
35
35
  </Button>
@@ -1,29 +1,27 @@
1
1
  import { Img } from '../../ui-kit/Img/Img';
2
2
  import { RichText } from '../../ui-kit/RichText/RichText';
3
3
  import { Text } from '../../ui-kit/Text/Text';
4
- import { type AtmsDef } from './OfficesAtmsMapContent';
4
+ import { type AtmsDef, type ItemList } from './OfficesAtmsMapContent';
5
5
 
6
6
  export const renderDescriptionBlock = ({ __html, list, richVersion }: AtmsDef) =>
7
7
  __html || list?.length ? (
8
- <div className="mb-2xl border-b sm:border border-main-divider sm:rounded-md">
9
- {__html ? (
10
- <div className="mb-2xl">
11
- <RichText __html={__html} richVersion={richVersion} />
12
- </div>
13
- ) : null}
8
+ <div className="border-b sm:border border-main-divider rounded-md space-y-2xl">
9
+ {__html ? <RichText __html={__html} richVersion={richVersion} /> : null}
14
10
  {list?.length ? (
15
11
  <div className="flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl">
16
- {list.map((item, i) => (
17
- <div key={String(i)} className="flex gap-xs items-center">
18
- {item?.image ? <Img image={item.image} /> : null}
19
- {item?.text ? (
20
- <Text size="text-m" font="font-light">
21
- {item.text}
22
- </Text>
23
- ) : null}
24
- </div>
25
- ))}
12
+ {list.map(renderItem)}
26
13
  </div>
27
14
  ) : null}
28
15
  </div>
29
16
  ) : null;
17
+
18
+ const renderItem = (item: ItemList, i: number) => (
19
+ <div key={String(i)} className="flex gap-xs items-center">
20
+ <Img image={item.image} />
21
+ {item?.text ? (
22
+ <Text size="text-m" font="font-light">
23
+ {item.text}
24
+ </Text>
25
+ ) : null}
26
+ </div>
27
+ );
@@ -1,15 +1,16 @@
1
1
  import { Heading } from '../../ui-kit/Heading/Heading';
2
2
  import { Text } from '../../ui-kit/Text/Text';
3
3
 
4
- export const renderHeading = (title?: string, lengthItems?: number) => (
5
- <div className="flex flex-col sm:flex-row gap-xs mb-2xl">
6
- <Heading headingType="h3">
7
- <span suppressHydrationWarning={true}>{title}</span>
8
- {lengthItems ? (
9
- <Text size="text-h2" color="text-secondary-text">
10
- <span suppressHydrationWarning={true}>{` (${lengthItems})`}</span>
11
- </Text>
12
- ) : null}
13
- </Heading>
14
- </div>
15
- );
4
+ export const renderHeading = (title?: string, lengthItems?: number) =>
5
+ title ? (
6
+ <div className="flex flex-row gap-xs">
7
+ <Heading headingType="h3">
8
+ <span suppressHydrationWarning>{title}</span>
9
+ {lengthItems ? (
10
+ <Text size="text-h2" color="text-secondary-text">
11
+ <span suppressHydrationWarning>{` (${lengthItems})`}</span>
12
+ </Text>
13
+ ) : null}
14
+ </Heading>
15
+ </div>
16
+ ) : null;
@@ -18,7 +18,7 @@ export const PriceList = JSX<PriceListProps>(({ priceList }) =>
18
18
  const renderPriceListItem = ({ label, amount, unit }: PriceItem, i: number) => (
19
19
  <div
20
20
  key={String(i)}
21
- className="basis-full flex flex-col-reverse sm:flex-row sm:justify-between sm:bg-main-divider sm:py-m sm:px-lg sm:rounded-md items-baseline whitespace-pre"
21
+ className="basis-full flex flex-col-reverse sm:flex-row sm:justify-between sm:bg-main-divider sm:py-m sm:px-lg rounded-md items-baseline whitespace-pre"
22
22
  role="listitem"
23
23
  >
24
24
  <Text font="font-light" size="text-l" color="text-secondary-text">
@@ -31,7 +31,7 @@ export const TopItem = JSX<TopItemProps>(
31
31
  // eslint-disable-next-line react/jsx-props-no-spreading
32
32
  {...getAspectsAttributes(data)}
33
33
  >
34
- <span suppressHydrationWarning={true} className={getTextStyle(active, flat)}>
34
+ <span suppressHydrationWarning className={getTextStyle(active, flat)}>
35
35
  {text || children}
36
36
  </span>
37
37
  </a>