@redneckz/wildless-cms-uni-blocks 0.14.975 → 0.14.976

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 (45) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +16 -11
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/GalleryLayout/utils.d.ts +1 -1
  5. package/bundle/components/ProductBlock/ProductBlock.d.ts +1 -1
  6. package/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  7. package/bundle/model/HeadlineType.d.ts +15 -8
  8. package/dist/components/GalleryLayout/utils.d.ts +1 -1
  9. package/dist/components/ProductBlock/ProductBlock.d.ts +1 -1
  10. package/dist/components/ProductBlock/ProductBlock.js +15 -10
  11. package/dist/components/ProductBlock/ProductBlock.js.map +1 -1
  12. package/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  13. package/dist/model/HeadlineType.d.ts +15 -8
  14. package/lib/components/GalleryLayout/utils.d.ts +1 -1
  15. package/lib/components/ProductBlock/ProductBlock.d.ts +1 -1
  16. package/lib/components/ProductBlock/ProductBlock.js +15 -10
  17. package/lib/components/ProductBlock/ProductBlock.js.map +1 -1
  18. package/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  19. package/lib/model/HeadlineType.d.ts +15 -8
  20. package/mobile/bundle/bundle.umd.js +16 -11
  21. package/mobile/bundle/bundle.umd.min.js +1 -1
  22. package/mobile/bundle/components/GalleryLayout/utils.d.ts +1 -1
  23. package/mobile/bundle/components/ProductBlock/ProductBlock.d.ts +1 -1
  24. package/mobile/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  25. package/mobile/bundle/model/HeadlineType.d.ts +15 -8
  26. package/mobile/dist/components/GalleryLayout/utils.d.ts +1 -1
  27. package/mobile/dist/components/ProductBlock/ProductBlock.d.ts +1 -1
  28. package/mobile/dist/components/ProductBlock/ProductBlock.js +15 -10
  29. package/mobile/dist/components/ProductBlock/ProductBlock.js.map +1 -1
  30. package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  31. package/mobile/dist/model/HeadlineType.d.ts +15 -8
  32. package/mobile/lib/components/GalleryLayout/utils.d.ts +1 -1
  33. package/mobile/lib/components/ProductBlock/ProductBlock.d.ts +1 -1
  34. package/mobile/lib/components/ProductBlock/ProductBlock.js +15 -10
  35. package/mobile/lib/components/ProductBlock/ProductBlock.js.map +1 -1
  36. package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  37. package/mobile/lib/model/HeadlineType.d.ts +15 -8
  38. package/mobile/src/components/ProductBlock/ProductBlock.tsx +26 -17
  39. package/mobile/src/components/ProductBlock/ProductBlockContent.ts +2 -5
  40. package/mobile/src/model/HeadlineType.ts +16 -8
  41. package/package.json +1 -1
  42. package/src/components/ProductBlock/ProductBlock.fixture.tsx +16 -7
  43. package/src/components/ProductBlock/ProductBlock.tsx +26 -17
  44. package/src/components/ProductBlock/ProductBlockContent.ts +2 -5
  45. package/src/model/HeadlineType.ts +16 -8
@@ -2,7 +2,7 @@ import { type BlockDef } from '../../model/ContentPageDef';
2
2
  import { type LinkProps } from '../../model/LinkProps';
3
3
  export declare const getChildStyle: (index: number) => "lg:col-span-1 lg:row-span-1" | "lg:col-span-2 lg:row-span-2";
4
4
  export declare const modifyBlock: (block: BlockDef, i: number) => {
5
- content: import("../../UniBlock/UniBlockProps").UniBlockContent & import("../../model/HeadlineType").TitleProps & import("../../model/HeadlineType").DescriptionProps & import("../../model/HeadlineType").AlignProps & import("../../model/HeadlineType").AdditionalDescriptionProps & import("../../model/HeadlineType").DynamicDescriptionProps & {
5
+ content: import("../../UniBlock/UniBlockProps").UniBlockContent & import("../../model/HeadlineType").TitleProps & import("../../model/HeadlineType").DescriptionProps & import("../../model/HeadlineType").AlignProps & import("../../model/HeadlineType").AdditionalDescriptionProps & import("../../model/HeadlineType").DynamicTextProps & {
6
6
  headlineVersion?: import("../../model/HeadlineType").HeadlineVersion | undefined;
7
7
  } & import("../../ui-kit/BenefitsList/BenefitsListContent").BenefitsListContent & import("../../model/Bullets").BulletsProps & {
8
8
  __html?: string | undefined;
@@ -2,7 +2,7 @@ import type { JSONRefObject } from '../../data/JSONRefObject';
2
2
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
3
3
  import { type ProductBlockContent } from './ProductBlockContent';
4
4
  export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
5
- dynamicDescriptionSource?: JSONRefObject & {
5
+ dynamicTextSource?: JSONRefObject & {
6
6
  list?: Record<string, string>[];
7
7
  };
8
8
  }
@@ -1,10 +1,10 @@
1
- import { type AdditionalDescriptionProps, type DynamicDescriptionProps } from '../../model/HeadlineType';
1
+ import { type AdditionalDescriptionProps, type DynamicTextProps } from '../../model/HeadlineType';
2
2
  import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BaseProductTileContent';
3
3
  import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
4
4
  /**
5
5
  * @title Продуктовый блок
6
6
  */
7
- export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicDescriptionProps & {
7
+ export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicTextProps & {
8
8
  /** @title Отображать кнопку возврата */
9
9
  backwardButton?: boolean;
10
10
  };
@@ -36,19 +36,26 @@ export declare type AdditionalDescriptionProps = {
36
36
  /** @title Дополнительное описание */
37
37
  additionalDescription?: string;
38
38
  };
39
- export declare type DynamicDescriptionProps = {
40
- /** @title Динамическое описание по значению utm-метки */
41
- dynamicUtmDescription?: DynamicDescription;
39
+ export declare type DynamicTextProps = {
40
+ /** @title Динамическое описание по значению query-параметра */
41
+ dynamicQueryParamText?: DynamicText;
42
42
  /** @title Справочник значений */
43
- dynamicDescriptionSource?: JSONRefObject;
43
+ dynamicTextSource?: JSONRefObject;
44
44
  };
45
- export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicDescriptionProps;
45
+ export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicTextProps;
46
46
  export declare type HeadlineProps = HeadlineCommonProps & {
47
47
  headlineVersion?: HeadlineVersion;
48
48
  };
49
- export declare type DynamicDescription = {
50
- /** @title utm-метка */
51
- utm?: string;
49
+ export declare type DynamicText = {
50
+ /** @title query-параметр */
51
+ queryParam?: string;
52
52
  /** @title Заменяемый текст */
53
53
  value?: string;
54
+ /** @title Тип текста, где будет произведена замена */
55
+ textType?: TextType;
54
56
  };
57
+ /**
58
+ * @title Тип текста
59
+ * @enumNames ["Описание", "Заголовок"]
60
+ */
61
+ export declare type TextType = 'description' | 'title';
@@ -2,7 +2,7 @@ import { type BlockDef } from '../../model/ContentPageDef';
2
2
  import { type LinkProps } from '../../model/LinkProps';
3
3
  export declare const getChildStyle: (index: number) => "lg:col-span-1 lg:row-span-1" | "lg:col-span-2 lg:row-span-2";
4
4
  export declare const modifyBlock: (block: BlockDef, i: number) => {
5
- content: import("../../UniBlock/UniBlockProps").UniBlockContent & import("../../model/HeadlineType").TitleProps & import("../../model/HeadlineType").DescriptionProps & import("../../model/HeadlineType").AlignProps & import("../../model/HeadlineType").AdditionalDescriptionProps & import("../../model/HeadlineType").DynamicDescriptionProps & {
5
+ content: import("../../UniBlock/UniBlockProps").UniBlockContent & import("../../model/HeadlineType").TitleProps & import("../../model/HeadlineType").DescriptionProps & import("../../model/HeadlineType").AlignProps & import("../../model/HeadlineType").AdditionalDescriptionProps & import("../../model/HeadlineType").DynamicTextProps & {
6
6
  headlineVersion?: import("../../model/HeadlineType").HeadlineVersion | undefined;
7
7
  } & import("../../ui-kit/BenefitsList/BenefitsListContent").BenefitsListContent & import("../../model/Bullets").BulletsProps & {
8
8
  __html?: string | undefined;
@@ -2,7 +2,7 @@ import type { JSONRefObject } from '../../data/JSONRefObject';
2
2
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
3
3
  import { type ProductBlockContent } from './ProductBlockContent';
4
4
  export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
5
- dynamicDescriptionSource?: JSONRefObject & {
5
+ dynamicTextSource?: JSONRefObject & {
6
6
  list?: Record<string, string>[];
7
7
  };
8
8
  }
@@ -6,19 +6,24 @@ const BlockWrapper_1 = require("../../ui-kit/BlockWrapper");
6
6
  const UniBlock_1 = require("../../UniBlock/UniBlock");
7
7
  const getSessionQuery_1 = require("../../utils/getSessionQuery");
8
8
  const style_1 = require("../../utils/style");
9
- exports.ProductBlock = (0, UniBlock_1.UniBlock)(({ className, padding, defaultPadding, dynamicUtmDescription, dynamicDescriptionSource, description, ...rest }) => {
10
- const formatDescription = getFormatDescription(dynamicUtmDescription, dynamicDescriptionSource?.list, description);
11
- return ((0, jsx_runtime_1.jsx)(BlockWrapper_1.BlockWrapper, { className: (0, style_1.style)('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: (0, jsx_runtime_1.jsx)(BaseProductTile_1.BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, description: formatDescription, className: "grow h-full", ...rest }) }));
9
+ exports.ProductBlock = (0, UniBlock_1.UniBlock)(({ className, padding, defaultPadding, dynamicQueryParamText = {}, dynamicTextSource, description, title, ...rest }) => {
10
+ const { textType } = dynamicQueryParamText;
11
+ const formatText = getFormatDescription(dynamicQueryParamText, dynamicTextSource?.list, textType === 'title' ? title : description);
12
+ const textProps = {
13
+ title: textType === 'title' ? formatText : title,
14
+ description: textType === 'description' ? formatText : description,
15
+ };
16
+ return ((0, jsx_runtime_1.jsx)(BlockWrapper_1.BlockWrapper, { className: (0, style_1.style)('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: (0, jsx_runtime_1.jsx)(BaseProductTile_1.BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, className: "grow h-full", ...textProps, ...rest }) }));
12
17
  });
13
- const getFormatDescription = (dynamicUtmDescription = {}, valuesList = [], description = '') => {
14
- const { utm, value } = dynamicUtmDescription;
18
+ const getFormatDescription = (dynamicQueryParamText = {}, valuesList = [], text = '') => {
19
+ const { queryParam, value } = dynamicQueryParamText;
15
20
  const sessionQuery = (0, getSessionQuery_1.saveSessionQuery)();
16
- const utmValue = getUtmValue(utm ?? 'utm_source', sessionQuery);
17
- const dynamicValue = valuesList.find((item) => item?.id === utmValue)?.value;
18
- return dynamicValue ? description.replace(String(value), dynamicValue) : description;
21
+ const utmValue = getQueryParamValue(queryParam ?? 'utm_source', sessionQuery);
22
+ const dynamicValue = valuesList.find((item) => item?.id?.toLowerCase() === utmValue?.toLowerCase())?.value;
23
+ return dynamicValue ? text?.replace(String(value), dynamicValue) : text;
19
24
  };
20
- const getUtmValue = (utm, queryString) => {
25
+ const getQueryParamValue = (queryParam, queryString) => {
21
26
  const params = new URLSearchParams(queryString);
22
- return params.get(utm);
27
+ return params.get(queryParam);
23
28
  };
24
29
  //# sourceMappingURL=ProductBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductBlock.js","sourceRoot":"","sources":["../../../src/components/ProductBlock/ProductBlock.tsx"],"names":[],"mappings":";;;AAEA,kFAA+E;AAC/E,4DAAyD;AACzD,sDAAmD;AAEnD,iEAA+D;AAC/D,6CAA0C;AAS7B,QAAA,YAAY,GAAG,IAAA,mBAAQ,EAClC,CAAC,EACC,SAAS,EACT,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,iBAAiB,GAAG,oBAAoB,CAC5C,qBAAqB,EACrB,wBAAwB,EAAE,IAAI,EAC9B,WAAW,CACZ,CAAC;IAEF,OAAO,CACL,uBAAC,2BAAY,IACX,SAAS,EAAE,IAAA,aAAK,EAAC,kDAAkD,EAAE,SAAS,CAAC,EAC/E,OAAO,EAAC,KAAK,KACT,IAAI,YAER,uBAAC,iCAAe,IACd,cAAc,EAAE,cAAc,IAA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YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAE,WAAmB,EAAE,EAAE;IACrE,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
- import { type AdditionalDescriptionProps, type DynamicDescriptionProps } from '../../model/HeadlineType';
1
+ import { type AdditionalDescriptionProps, type DynamicTextProps } from '../../model/HeadlineType';
2
2
  import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BaseProductTileContent';
3
3
  import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
4
4
  /**
5
5
  * @title Продуктовый блок
6
6
  */
7
- export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicDescriptionProps & {
7
+ export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicTextProps & {
8
8
  /** @title Отображать кнопку возврата */
9
9
  backwardButton?: boolean;
10
10
  };
@@ -36,19 +36,26 @@ export declare type AdditionalDescriptionProps = {
36
36
  /** @title Дополнительное описание */
37
37
  additionalDescription?: string;
38
38
  };
39
- export declare type DynamicDescriptionProps = {
40
- /** @title Динамическое описание по значению utm-метки */
41
- dynamicUtmDescription?: DynamicDescription;
39
+ export declare type DynamicTextProps = {
40
+ /** @title Динамическое описание по значению query-параметра */
41
+ dynamicQueryParamText?: DynamicText;
42
42
  /** @title Справочник значений */
43
- dynamicDescriptionSource?: JSONRefObject;
43
+ dynamicTextSource?: JSONRefObject;
44
44
  };
45
- export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicDescriptionProps;
45
+ export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicTextProps;
46
46
  export declare type HeadlineProps = HeadlineCommonProps & {
47
47
  headlineVersion?: HeadlineVersion;
48
48
  };
49
- export declare type DynamicDescription = {
50
- /** @title utm-метка */
51
- utm?: string;
49
+ export declare type DynamicText = {
50
+ /** @title query-параметр */
51
+ queryParam?: string;
52
52
  /** @title Заменяемый текст */
53
53
  value?: string;
54
+ /** @title Тип текста, где будет произведена замена */
55
+ textType?: TextType;
54
56
  };
57
+ /**
58
+ * @title Тип текста
59
+ * @enumNames ["Описание", "Заголовок"]
60
+ */
61
+ export declare type TextType = 'description' | 'title';
@@ -2,7 +2,7 @@ import { type BlockDef } from '../../model/ContentPageDef';
2
2
  import { type LinkProps } from '../../model/LinkProps';
3
3
  export declare const getChildStyle: (index: number) => "lg:col-span-1 lg:row-span-1" | "lg:col-span-2 lg:row-span-2";
4
4
  export declare const modifyBlock: (block: BlockDef, i: number) => {
5
- content: import("../../UniBlock/UniBlockProps").UniBlockContent & import("../../model/HeadlineType").TitleProps & import("../../model/HeadlineType").DescriptionProps & import("../../model/HeadlineType").AlignProps & import("../../model/HeadlineType").AdditionalDescriptionProps & import("../../model/HeadlineType").DynamicDescriptionProps & {
5
+ content: import("../../UniBlock/UniBlockProps").UniBlockContent & import("../../model/HeadlineType").TitleProps & import("../../model/HeadlineType").DescriptionProps & import("../../model/HeadlineType").AlignProps & import("../../model/HeadlineType").AdditionalDescriptionProps & import("../../model/HeadlineType").DynamicTextProps & {
6
6
  headlineVersion?: import("../../model/HeadlineType").HeadlineVersion | undefined;
7
7
  } & import("../../ui-kit/BenefitsList/BenefitsListContent").BenefitsListContent & import("../../model/Bullets").BulletsProps & {
8
8
  __html?: string | undefined;
@@ -2,7 +2,7 @@ import type { JSONRefObject } from '../../data/JSONRefObject';
2
2
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
3
3
  import { type ProductBlockContent } from './ProductBlockContent';
4
4
  export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
5
- dynamicDescriptionSource?: JSONRefObject & {
5
+ dynamicTextSource?: JSONRefObject & {
6
6
  list?: Record<string, string>[];
7
7
  };
8
8
  }
@@ -4,19 +4,24 @@ import { BlockWrapper } from '../../ui-kit/BlockWrapper.js';
4
4
  import { UniBlock } from '../../UniBlock/UniBlock.js';
5
5
  import { saveSessionQuery } from '../../utils/getSessionQuery.js';
6
6
  import { style } from '../../utils/style.js';
7
- export const ProductBlock = UniBlock(({ className, padding, defaultPadding, dynamicUtmDescription, dynamicDescriptionSource, description, ...rest }) => {
8
- const formatDescription = getFormatDescription(dynamicUtmDescription, dynamicDescriptionSource?.list, description);
9
- return (_jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: _jsx(BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, description: formatDescription, className: "grow h-full", ...rest }) }));
7
+ export const ProductBlock = UniBlock(({ className, padding, defaultPadding, dynamicQueryParamText = {}, dynamicTextSource, description, title, ...rest }) => {
8
+ const { textType } = dynamicQueryParamText;
9
+ const formatText = getFormatDescription(dynamicQueryParamText, dynamicTextSource?.list, textType === 'title' ? title : description);
10
+ const textProps = {
11
+ title: textType === 'title' ? formatText : title,
12
+ description: textType === 'description' ? formatText : description,
13
+ };
14
+ return (_jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: _jsx(BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, className: "grow h-full", ...textProps, ...rest }) }));
10
15
  });
11
- const getFormatDescription = (dynamicUtmDescription = {}, valuesList = [], description = '') => {
12
- const { utm, value } = dynamicUtmDescription;
16
+ const getFormatDescription = (dynamicQueryParamText = {}, valuesList = [], text = '') => {
17
+ const { queryParam, value } = dynamicQueryParamText;
13
18
  const sessionQuery = saveSessionQuery();
14
- const utmValue = getUtmValue(utm ?? 'utm_source', sessionQuery);
15
- const dynamicValue = valuesList.find((item) => item?.id === utmValue)?.value;
16
- return dynamicValue ? description.replace(String(value), dynamicValue) : description;
19
+ const utmValue = getQueryParamValue(queryParam ?? 'utm_source', sessionQuery);
20
+ const dynamicValue = valuesList.find((item) => item?.id?.toLowerCase() === utmValue?.toLowerCase())?.value;
21
+ return dynamicValue ? text?.replace(String(value), dynamicValue) : text;
17
22
  };
18
- const getUtmValue = (utm, queryString) => {
23
+ const getQueryParamValue = (queryParam, queryString) => {
19
24
  const params = new URLSearchParams(queryString);
20
- return params.get(utm);
25
+ return params.get(queryParam);
21
26
  };
22
27
  //# sourceMappingURL=ProductBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductBlock.js","sourceRoot":"","sources":["../../../src/components/ProductBlock/ProductBlock.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAS1C,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAClC,CAAC,EACC,SAAS,EACT,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,GAAG,IAAI,EACR,EAAE,EAAE;IACH,MAAM,iBAAiB,GAAG,oBAAoB,CAC5C,qBAAqB,EACrB,wBAAwB,EAAE,IAAI,EAC9B,WAAW,CACZ,CAAC;IAEF,OAAO,CACL,KAAC,YAAY,IACX,SAAS,EAAE,KAAK,CAAC,kDAAkD,EAAE,SAAS,CAAC,EAC/E,OAAO,EAAC,KAAK,KACT,IAAI,YAER,KAAC,eAAe,IACd,cAAc,EAAE,cAAc,IAAI,OAAO,EACzC,OAAO,EAAE,OAAO,EAChB,WA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,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,WAAW,EAAE,CAC9D,EAAE,KAAK,CAAC;IAET,OAAO,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAE,WAAmB,EAAE,EAAE;IACrE,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
- import { type AdditionalDescriptionProps, type DynamicDescriptionProps } from '../../model/HeadlineType';
1
+ import { type AdditionalDescriptionProps, type DynamicTextProps } from '../../model/HeadlineType';
2
2
  import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BaseProductTileContent';
3
3
  import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
4
4
  /**
5
5
  * @title Продуктовый блок
6
6
  */
7
- export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicDescriptionProps & {
7
+ export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicTextProps & {
8
8
  /** @title Отображать кнопку возврата */
9
9
  backwardButton?: boolean;
10
10
  };
@@ -36,19 +36,26 @@ export declare type AdditionalDescriptionProps = {
36
36
  /** @title Дополнительное описание */
37
37
  additionalDescription?: string;
38
38
  };
39
- export declare type DynamicDescriptionProps = {
40
- /** @title Динамическое описание по значению utm-метки */
41
- dynamicUtmDescription?: DynamicDescription;
39
+ export declare type DynamicTextProps = {
40
+ /** @title Динамическое описание по значению query-параметра */
41
+ dynamicQueryParamText?: DynamicText;
42
42
  /** @title Справочник значений */
43
- dynamicDescriptionSource?: JSONRefObject;
43
+ dynamicTextSource?: JSONRefObject;
44
44
  };
45
- export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicDescriptionProps;
45
+ export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicTextProps;
46
46
  export declare type HeadlineProps = HeadlineCommonProps & {
47
47
  headlineVersion?: HeadlineVersion;
48
48
  };
49
- export declare type DynamicDescription = {
50
- /** @title utm-метка */
51
- utm?: string;
49
+ export declare type DynamicText = {
50
+ /** @title query-параметр */
51
+ queryParam?: string;
52
52
  /** @title Заменяемый текст */
53
53
  value?: string;
54
+ /** @title Тип текста, где будет произведена замена */
55
+ textType?: TextType;
54
56
  };
57
+ /**
58
+ * @title Тип текста
59
+ * @enumNames ["Описание", "Заголовок"]
60
+ */
61
+ export declare type TextType = 'description' | 'title';
@@ -994,20 +994,25 @@
994
994
  return result;
995
995
  }
996
996
 
997
- const ProductBlock = UniBlock(({ className, padding, defaultPadding, dynamicUtmDescription, dynamicDescriptionSource, description, ...rest }) => {
998
- const formatDescription = getFormatDescription(dynamicUtmDescription, dynamicDescriptionSource?.list, description);
999
- return (jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: jsx(BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, description: formatDescription, className: "grow h-full", ...rest }) }));
997
+ const ProductBlock = UniBlock(({ className, padding, defaultPadding, dynamicQueryParamText = {}, dynamicTextSource, description, title, ...rest }) => {
998
+ const { textType } = dynamicQueryParamText;
999
+ const formatText = getFormatDescription(dynamicQueryParamText, dynamicTextSource?.list, textType === 'title' ? title : description);
1000
+ const textProps = {
1001
+ title: textType === 'title' ? formatText : title,
1002
+ description: textType === 'description' ? formatText : description,
1003
+ };
1004
+ return (jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: jsx(BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, className: "grow h-full", ...textProps, ...rest }) }));
1000
1005
  });
1001
- const getFormatDescription = (dynamicUtmDescription = {}, valuesList = [], description = '') => {
1002
- const { utm, value } = dynamicUtmDescription;
1006
+ const getFormatDescription = (dynamicQueryParamText = {}, valuesList = [], text = '') => {
1007
+ const { queryParam, value } = dynamicQueryParamText;
1003
1008
  const sessionQuery = saveSessionQuery();
1004
- const utmValue = getUtmValue(utm ?? 'utm_source', sessionQuery);
1005
- const dynamicValue = valuesList.find((item) => item?.id === utmValue)?.value;
1006
- return dynamicValue ? description.replace(String(value), dynamicValue) : description;
1009
+ const utmValue = getQueryParamValue(queryParam ?? 'utm_source', sessionQuery);
1010
+ const dynamicValue = valuesList.find((item) => item?.id?.toLowerCase() === utmValue?.toLowerCase())?.value;
1011
+ return dynamicValue ? text?.replace(String(value), dynamicValue) : text;
1007
1012
  };
1008
- const getUtmValue = (utm, queryString) => {
1013
+ const getQueryParamValue = (queryParam, queryString) => {
1009
1014
  const params = new URLSearchParams(queryString);
1010
- return params.get(utm);
1015
+ return params.get(queryParam);
1011
1016
  };
1012
1017
 
1013
1018
  const AdTile = JSX((props) => {
@@ -12851,7 +12856,7 @@
12851
12856
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
12852
12857
  });
12853
12858
 
12854
- const packageVersion = "0.14.974";
12859
+ const packageVersion = "0.14.975";
12855
12860
 
12856
12861
  exports.Blocks = Blocks;
12857
12862
  exports.ContentPage = ContentPage;