@redneckz/wildless-cms-uni-blocks 0.14.136 → 0.14.138

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 (100) hide show
  1. package/bundle/bundle.umd.js +23 -16
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/Footer/cookieReplaceData.d.ts +1 -0
  4. package/bundle/utils/mapCookie.d.ts +1 -0
  5. package/dist/components/Footer/Footer.js +8 -2
  6. package/dist/components/Footer/Footer.js.map +1 -1
  7. package/dist/components/Footer/Footer.mobile.js +8 -2
  8. package/dist/components/Footer/Footer.mobile.js.map +1 -1
  9. package/dist/components/Footer/cookieReplaceData.d.ts +1 -0
  10. package/dist/components/Footer/cookieReplaceData.js +4 -0
  11. package/dist/components/Footer/cookieReplaceData.js.map +1 -0
  12. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -5
  13. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  14. package/dist/ui-kit/YandexMap/YandexMap.js +3 -4
  15. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  16. package/dist/utils/isUUID.js +1 -1
  17. package/dist/utils/isUUID.js.map +1 -1
  18. package/dist/utils/mapCookie.d.ts +1 -0
  19. package/dist/utils/mapCookie.js +11 -0
  20. package/dist/utils/mapCookie.js.map +1 -0
  21. package/lib/components/Footer/Footer.js +8 -2
  22. package/lib/components/Footer/Footer.js.map +1 -1
  23. package/lib/components/Footer/Footer.mobile.js +8 -2
  24. package/lib/components/Footer/Footer.mobile.js.map +1 -1
  25. package/lib/components/Footer/cookieReplaceData.d.ts +1 -0
  26. package/lib/components/Footer/cookieReplaceData.js +2 -0
  27. package/lib/components/Footer/cookieReplaceData.js.map +1 -0
  28. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -5
  29. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  30. package/lib/ui-kit/YandexMap/YandexMap.js +3 -4
  31. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  32. package/lib/utils/isUUID.js +1 -1
  33. package/lib/utils/isUUID.js.map +1 -1
  34. package/lib/utils/mapCookie.d.ts +1 -0
  35. package/lib/utils/mapCookie.js +8 -0
  36. package/lib/utils/mapCookie.js.map +1 -0
  37. package/mobile/bundle/bundle.umd.js +23 -16
  38. package/mobile/bundle/bundle.umd.min.js +1 -1
  39. package/mobile/bundle/components/Footer/cookieReplaceData.d.ts +1 -0
  40. package/mobile/bundle/utils/mapCookie.d.ts +1 -0
  41. package/mobile/dist/components/Footer/Footer.js +8 -2
  42. package/mobile/dist/components/Footer/Footer.js.map +1 -1
  43. package/mobile/dist/components/Footer/cookieReplaceData.d.ts +1 -0
  44. package/mobile/dist/components/Footer/cookieReplaceData.js +4 -0
  45. package/mobile/dist/components/Footer/cookieReplaceData.js.map +1 -0
  46. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -5
  47. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  48. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +3 -4
  49. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  50. package/mobile/dist/utils/isUUID.js +1 -1
  51. package/mobile/dist/utils/isUUID.js.map +1 -1
  52. package/mobile/dist/utils/mapCookie.d.ts +1 -0
  53. package/mobile/dist/utils/mapCookie.js +11 -0
  54. package/mobile/dist/utils/mapCookie.js.map +1 -0
  55. package/mobile/lib/components/Footer/Footer.js +8 -2
  56. package/mobile/lib/components/Footer/Footer.js.map +1 -1
  57. package/mobile/lib/components/Footer/cookieReplaceData.d.ts +1 -0
  58. package/mobile/lib/components/Footer/cookieReplaceData.js +2 -0
  59. package/mobile/lib/components/Footer/cookieReplaceData.js.map +1 -0
  60. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -5
  61. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  62. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +3 -4
  63. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  64. package/mobile/lib/utils/isUUID.js +1 -1
  65. package/mobile/lib/utils/isUUID.js.map +1 -1
  66. package/mobile/lib/utils/mapCookie.d.ts +1 -0
  67. package/mobile/lib/utils/mapCookie.js +8 -0
  68. package/mobile/lib/utils/mapCookie.js.map +1 -0
  69. package/mobile/src/components/Footer/Footer.tsx +9 -2
  70. package/mobile/src/components/Footer/cookieReplaceData.ts +1 -0
  71. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +8 -5
  72. package/mobile/src/components/VerticalLayout/VerticalLayout.example.json +10 -0
  73. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +3 -7
  74. package/mobile/src/utils/isUUID.ts +3 -1
  75. package/mobile/src/utils/mapCookie.ts +11 -0
  76. package/package.json +5 -2
  77. package/src/components/Footer/Footer.mobile.tsx +9 -2
  78. package/src/components/Footer/Footer.tsx +9 -2
  79. package/src/components/Footer/cookieReplaceData.ts +1 -0
  80. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +8 -5
  81. package/src/components/VerticalLayout/VerticalLayout.example.json +10 -0
  82. package/src/ui-kit/YandexMap/YandexMap.tsx +3 -7
  83. package/src/utils/isUUID.ts +3 -1
  84. package/src/utils/mapCookie.ts +11 -0
  85. package/bundle/utils/deleteAllCookie.d.ts +0 -1
  86. package/dist/utils/deleteAllCookie.d.ts +0 -1
  87. package/dist/utils/deleteAllCookie.js +0 -11
  88. package/dist/utils/deleteAllCookie.js.map +0 -1
  89. package/lib/utils/deleteAllCookie.d.ts +0 -1
  90. package/lib/utils/deleteAllCookie.js +0 -8
  91. package/lib/utils/deleteAllCookie.js.map +0 -1
  92. package/mobile/bundle/utils/deleteAllCookie.d.ts +0 -1
  93. package/mobile/dist/utils/deleteAllCookie.d.ts +0 -1
  94. package/mobile/dist/utils/deleteAllCookie.js +0 -11
  95. package/mobile/dist/utils/deleteAllCookie.js.map +0 -1
  96. package/mobile/lib/utils/deleteAllCookie.d.ts +0 -1
  97. package/mobile/lib/utils/deleteAllCookie.js +0 -8
  98. package/mobile/lib/utils/deleteAllCookie.js.map +0 -1
  99. package/mobile/src/utils/deleteAllCookie.ts +0 -8
  100. package/src/utils/deleteAllCookie.ts +0 -8
@@ -1,4 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
3
  import { useSWRResource } from '../../hooks/useSWRResource';
3
4
  import { type LinkProps } from '../../model/LinkProps';
4
5
  import { projectSettings } from '../../ProjectSettings';
@@ -7,9 +8,10 @@ import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
8
  import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
8
9
  import { Text } from '../../ui-kit/Text/Text';
9
10
  import { appendSlash } from '../../utils/appendSlash';
10
- import { deleteAllCookies } from '../../utils/deleteAllCookie';
11
+ import { mapCookie } from '../../utils/mapCookie';
11
12
  import { RollupItem } from '../RollupItem/RollupItem';
12
13
  import { Contacts } from './Contacts';
14
+ import { COOKIE_REPLACE } from './cookieReplaceData';
13
15
  import { findIconByHref } from './findIconByHref';
14
16
  import { type FooterDataProps } from './FooterDataProps';
15
17
  import { type FooterProps } from './FooterProps';
@@ -31,6 +33,11 @@ export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
31
33
  documents,
32
34
  } = useSWRResource<FooterDataProps>(projectSettings.FOOTER || 'footer', { fallback });
33
35
 
36
+ const handleOnClick = useCallback(() => {
37
+ const [name, oldValue, newValue] = COOKIE_REPLACE;
38
+ mapCookie(name, (value) => value?.replace(oldValue, newValue));
39
+ }, []);
40
+
34
41
  return (
35
42
  <BlockWrapper tag="footer" className={className} defaultPadding="p-4xl pb-24" {...rest}>
36
43
  <div className="mb-lg pb-xs border-b border-main-divider">
@@ -62,7 +69,7 @@ export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
62
69
  text="Вернуться на прежнюю версию сайта"
63
70
  className="text-l font-light max-w-[292px]"
64
71
  href="https://old.rshb.ru"
65
- onClick={deleteAllCookies}
72
+ onClick={handleOnClick}
66
73
  />
67
74
  </div>
68
75
  <HorizontalNavigation
@@ -1,4 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
2
3
  import { useSWRResource } from '../../hooks/useSWRResource';
3
4
  import { projectSettings } from '../../ProjectSettings';
4
5
  import { useSitemap } from '../../services/sitemap/useSitemap';
@@ -7,9 +8,10 @@ import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
7
8
  import { Logo } from '../../ui-kit/Logo/Logo';
8
9
  import { SearchBar } from '../../ui-kit/SearchBar/SearchBar';
9
10
  import { Sitemap } from '../../ui-kit/Sitemap/Sitemap';
10
- import { deleteAllCookies } from '../../utils/deleteAllCookie';
11
+ import { mapCookie } from '../../utils/mapCookie';
11
12
  import { style } from '../../utils/style';
12
13
  import { Contacts } from './Contacts';
14
+ import { COOKIE_REPLACE } from './cookieReplaceData';
13
15
  import { type FooterDataProps } from './FooterDataProps';
14
16
  import { type FooterProps } from './FooterProps';
15
17
  import { HorizontalNavigation } from './HorizontalNavigation';
@@ -25,6 +27,11 @@ export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
25
27
  fallback: rest.options?.page?.fallback,
26
28
  });
27
29
 
30
+ const handleOnClick = useCallback(() => {
31
+ const [name, oldValue, newValue] = COOKIE_REPLACE;
32
+ mapCookie(name, (value) => value?.replace(oldValue, newValue));
33
+ }, []);
34
+
28
35
  return (
29
36
  <BlockWrapper tag="footer" className={className} {...rest}>
30
37
  <div className="flex items-stretch gap-3xl pb-3xl ">
@@ -42,7 +49,7 @@ export const Footer = JSX<FooterProps>(({ className, ...rest }) => {
42
49
  version="link"
43
50
  href="https://old.rshb.ru"
44
51
  className="!text-left text-s font-light"
45
- onClick={deleteAllCookies}
52
+ onClick={handleOnClick}
46
53
  >
47
54
  Вернуться на прежнюю версию сайта
48
55
  </LinkButton>
@@ -0,0 +1 @@
1
+ export const COOKIE_REPLACE = ['split_version', 'New', 'Old'];
@@ -1,4 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { useMemo } from '@redneckz/uni-jsx/lib/hooks';
2
3
  import { useForm } from '../../hooks/useForm';
3
4
  import { type VNode } from '../../model/VNode';
4
5
  import { ClientOnly } from '../../ui-kit/ClientOnly';
@@ -39,13 +40,15 @@ export const OfficesAtmsMapLayout = JSX<OfficesAtmsMapLayoutProps<Branch | Atm>>
39
40
  }) => {
40
41
  const [filtrationState, { field, reset }] = useForm(initFilterState);
41
42
 
42
- const filteredItems = filterItems(data, filtrationState);
43
+ const [filteredItems, points, lengthItems] = useMemo(() => {
44
+ const _filteredItems = filterItems(data, filtrationState);
43
45
 
44
- const points = filteredItems
45
- .map((_) => [_.gpsLatitude, _.gpsLongitude].filter(Boolean) as number[])
46
- .filter((_) => _ && _.length === 2);
46
+ const _points = _filteredItems
47
+ .map((_) => [_.gpsLatitude, _.gpsLongitude].filter(Boolean) as number[])
48
+ .filter((_) => _ && _.length === 2);
47
49
 
48
- const lengthItems = filteredItems.length;
50
+ return [_filteredItems, _points, _filteredItems.length];
51
+ }, [data, filtrationState]);
49
52
 
50
53
  return (
51
54
  <div className={style('space-y-1', className)}>
@@ -9,6 +9,16 @@
9
9
  "style": ["col-span-12"],
10
10
  "type": "VerticalLayout",
11
11
  "blocks": [
12
+ {
13
+ "content": {
14
+ "title": "Заголовок",
15
+ "description": "Описание",
16
+ "align": "text-center",
17
+ "headlineVersion": "M"
18
+ },
19
+ "style": ["col-span-12"],
20
+ "type": "Headline"
21
+ },
12
22
  {
13
23
  "content": {
14
24
  "isBlur": false,
@@ -40,8 +40,6 @@ export const YandexMap = JSX<YandexMapProps>(({ points, className = '', zoom = 5
40
40
 
41
41
  const [isFullScreen, setIsFullScreen] = useState();
42
42
 
43
- const pointsCenter = points ? getCenterPoint(points) : DEFAULT_CENTER_COORDS;
44
-
45
43
  useEffect(() => {
46
44
  if (!map?.current) {
47
45
  yandexMaps?.ready(() => {
@@ -51,7 +49,7 @@ export const YandexMap = JSX<YandexMapProps>(({ points, className = '', zoom = 5
51
49
  }
52
50
 
53
51
  map.current = new yandexMaps.Map('map', {
54
- center: pointsCenter,
52
+ center: points ? getCenterPoint(points) : DEFAULT_CENTER_COORDS,
55
53
  zoom,
56
54
  controls: [],
57
55
  suppressMapOpenBlock: true,
@@ -59,16 +57,14 @@ export const YandexMap = JSX<YandexMapProps>(({ points, className = '', zoom = 5
59
57
 
60
58
  renderClusterer(yandexMaps, map.current, points);
61
59
  });
62
- }
63
-
64
- if (map.current && yandexMaps) {
60
+ } else if (yandexMaps) {
65
61
  renderClusterer(yandexMaps, map.current, points);
66
62
 
67
63
  if (!points?.length) {
68
64
  map.current.setCenter(DEFAULT_CENTER_COORDS);
69
65
  }
70
66
  }
71
- }, [yandexMaps, map, points, pointsCenter, zoom]);
67
+ }, [yandexMaps, map, points, zoom]);
72
68
 
73
69
  if (!yandexMaps) {
74
70
  return null;
@@ -1,3 +1,5 @@
1
1
  export const isUUID = (src: string) => {
2
- return /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/.test(src);
2
+ return /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}(\/revs\/[0-9]{1,20})?$/.test(
3
+ src,
4
+ );
3
5
  };
@@ -0,0 +1,11 @@
1
+ export const mapCookie = (
2
+ name: string,
3
+ mapper: (value: string | undefined) => string | undefined,
4
+ ) => {
5
+ const cookies = globalThis.document?.cookie.split(';') ?? [];
6
+ const [, value] = cookies.map((_) => _.split('=')).find(([key]) => key.trim() === name) || [];
7
+
8
+ if (mapper(value)) {
9
+ globalThis.document.cookie = `${name}=${mapper(value)}`;
10
+ }
11
+ };
@@ -1 +0,0 @@
1
- export declare const deleteAllCookies: () => void;
@@ -1 +0,0 @@
1
- export declare const deleteAllCookies: () => void;
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.deleteAllCookies = void 0;
3
- const deleteAllCookies = () => {
4
- const cookies = globalThis.document?.cookie.split(';') ?? [];
5
- for (const cookie of cookies) {
6
- const [name] = cookie.split('=');
7
- globalThis.document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
8
- }
9
- };
10
- exports.deleteAllCookies = deleteAllCookies;
11
- //# sourceMappingURL=deleteAllCookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteAllCookie.js","sourceRoot":"","sources":["../../src/utils/deleteAllCookie.ts"],"names":[],"mappings":";;AAAO,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAE7D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,gDAAgD,CAAC;KACtF;AACH,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B"}
@@ -1 +0,0 @@
1
- export declare const deleteAllCookies: () => void;
@@ -1,8 +0,0 @@
1
- export const deleteAllCookies = () => {
2
- const cookies = globalThis.document?.cookie.split(';') ?? [];
3
- for (const cookie of cookies) {
4
- const [name] = cookie.split('=');
5
- globalThis.document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
6
- }
7
- };
8
- //# sourceMappingURL=deleteAllCookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteAllCookie.js","sourceRoot":"","sources":["../../src/utils/deleteAllCookie.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAE7D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,gDAAgD,CAAC;KACtF;AACH,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare const deleteAllCookies: () => void;
@@ -1 +0,0 @@
1
- export declare const deleteAllCookies: () => void;
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.deleteAllCookies = void 0;
3
- const deleteAllCookies = () => {
4
- const cookies = globalThis.document?.cookie.split(';') ?? [];
5
- for (const cookie of cookies) {
6
- const [name] = cookie.split('=');
7
- globalThis.document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
8
- }
9
- };
10
- exports.deleteAllCookies = deleteAllCookies;
11
- //# sourceMappingURL=deleteAllCookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteAllCookie.js","sourceRoot":"","sources":["../../src/utils/deleteAllCookie.ts"],"names":[],"mappings":";;AAAO,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAE7D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,gDAAgD,CAAC;KACtF;AACH,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B"}
@@ -1 +0,0 @@
1
- export declare const deleteAllCookies: () => void;
@@ -1,8 +0,0 @@
1
- export const deleteAllCookies = () => {
2
- const cookies = globalThis.document?.cookie.split(';') ?? [];
3
- for (const cookie of cookies) {
4
- const [name] = cookie.split('=');
5
- globalThis.document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
6
- }
7
- };
8
- //# sourceMappingURL=deleteAllCookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deleteAllCookie.js","sourceRoot":"","sources":["../../src/utils/deleteAllCookie.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;IAE7D,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,IAAI,gDAAgD,CAAC;KACtF;AACH,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- export const deleteAllCookies = () => {
2
- const cookies = globalThis.document?.cookie.split(';') ?? [];
3
-
4
- for (const cookie of cookies) {
5
- const [name] = cookie.split('=');
6
- globalThis.document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
7
- }
8
- };
@@ -1,8 +0,0 @@
1
- export const deleteAllCookies = () => {
2
- const cookies = globalThis.document?.cookie.split(';') ?? [];
3
-
4
- for (const cookie of cookies) {
5
- const [name] = cookie.split('=');
6
- globalThis.document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
7
- }
8
- };