@redneckz/wildless-cms-uni-blocks 0.14.973 → 0.14.974
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.
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +25 -11
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/GalleryLayout/utils.d.ts +2 -2
- package/bundle/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/bundle/model/HeadlineType.d.ts +14 -1
- package/dist/components/GalleryLayout/utils.d.ts +2 -2
- package/dist/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/dist/components/ProductBlock/ProductBlock.js +16 -1
- package/dist/components/ProductBlock/ProductBlock.js.map +1 -1
- package/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/dist/model/HeadlineType.d.ts +14 -1
- package/lib/components/GalleryLayout/utils.d.ts +2 -2
- package/lib/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/lib/components/ProductBlock/ProductBlock.fixture.d.ts +1 -0
- package/lib/components/ProductBlock/ProductBlock.js +16 -1
- package/lib/components/ProductBlock/ProductBlock.js.map +1 -1
- package/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/lib/model/HeadlineType.d.ts +14 -1
- package/mobile/bundle/bundle.umd.js +25 -11
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/GalleryLayout/utils.d.ts +2 -2
- package/mobile/bundle/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/mobile/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/mobile/bundle/model/HeadlineType.d.ts +14 -1
- package/mobile/dist/components/GalleryLayout/utils.d.ts +2 -2
- package/mobile/dist/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/mobile/dist/components/ProductBlock/ProductBlock.js +16 -1
- package/mobile/dist/components/ProductBlock/ProductBlock.js.map +1 -1
- package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/mobile/dist/model/HeadlineType.d.ts +14 -1
- package/mobile/lib/components/GalleryLayout/utils.d.ts +2 -2
- package/mobile/lib/components/ProductBlock/ProductBlock.d.ts +4 -0
- package/mobile/lib/components/ProductBlock/ProductBlock.js +16 -1
- package/mobile/lib/components/ProductBlock/ProductBlock.js.map +1 -1
- package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
- package/mobile/lib/model/HeadlineType.d.ts +14 -1
- package/mobile/src/components/ProductBlock/ProductBlock.tsx +57 -14
- package/mobile/src/components/ProductBlock/ProductBlockContent.ts +6 -2
- package/mobile/src/model/HeadlineType.ts +20 -1
- package/package.json +1 -1
- package/src/components/ProductBlock/ProductBlock.fixture.tsx +22 -0
- package/src/components/ProductBlock/ProductBlock.tsx +57 -14
- package/src/components/ProductBlock/ProductBlockContent.ts +6 -2
- package/src/icons/IconName.ts +4 -4
- package/src/model/HeadlineType.ts +20 -1
|
@@ -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 & {
|
|
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 & {
|
|
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;
|
|
@@ -11,7 +11,7 @@ export declare const modifyBlock: (block: BlockDef, i: number) => {
|
|
|
11
11
|
} & import("../../ui-kit/Tags/TagsContent").TagsContent & import("../../ui-kit/LinkButton/ButtonsSectionContent").ButtonsSectionContent & import("../../ui-kit/Img/ImgProps").ImageContent & import("../../ui-kit/BaseProductTile/BaseProductTileContent").PriceListProps & {
|
|
12
12
|
imageOptions?: import("../../ui-kit/BaseProductTile/BaseProductTileContent").TileImageOptions | undefined;
|
|
13
13
|
isFullWidthTitle?: boolean | undefined;
|
|
14
|
-
} &
|
|
14
|
+
} & {
|
|
15
15
|
backwardButton?: boolean | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
link?: LinkProps | undefined;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import type { JSONRefObject } from '../../data/JSONRefObject';
|
|
1
2
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
2
3
|
import { type ProductBlockContent } from './ProductBlockContent';
|
|
3
4
|
export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
|
|
5
|
+
dynamicDescriptionSource?: JSONRefObject & {
|
|
6
|
+
list?: Record<string, string>[];
|
|
7
|
+
};
|
|
4
8
|
}
|
|
5
9
|
export declare const ProductBlock: import("../../UniBlock/UniBlock").UniBlockComponent<ProductBlockProps>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type AdditionalDescriptionProps } from '../../model/HeadlineType';
|
|
1
|
+
import { type AdditionalDescriptionProps, type DynamicDescriptionProps } 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 & {
|
|
7
|
+
export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicDescriptionProps & {
|
|
8
8
|
/** @title Отображать кнопку возврата */
|
|
9
9
|
backwardButton?: boolean;
|
|
10
10
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type JSONRefObject } from '../data/JSONRefObject';
|
|
1
2
|
import { type TextAlign } from '../ui-kit/Text/TextProps';
|
|
2
3
|
/**
|
|
3
4
|
* TODO: Hellfire refactoring is needed here
|
|
@@ -35,7 +36,19 @@ export declare type AdditionalDescriptionProps = {
|
|
|
35
36
|
/** @title Дополнительное описание */
|
|
36
37
|
additionalDescription?: string;
|
|
37
38
|
};
|
|
38
|
-
export declare type
|
|
39
|
+
export declare type DynamicDescriptionProps = {
|
|
40
|
+
/** @title Динамическое описание по значению utm-метки */
|
|
41
|
+
dynamicUtmDescription?: DynamicDescription;
|
|
42
|
+
/** @title Справочник значений */
|
|
43
|
+
dynamicDescriptionSource?: JSONRefObject;
|
|
44
|
+
};
|
|
45
|
+
export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicDescriptionProps;
|
|
39
46
|
export declare type HeadlineProps = HeadlineCommonProps & {
|
|
40
47
|
headlineVersion?: HeadlineVersion;
|
|
41
48
|
};
|
|
49
|
+
export declare type DynamicDescription = {
|
|
50
|
+
/** @title utm-метка */
|
|
51
|
+
utm?: string;
|
|
52
|
+
/** @title Заменяемый текст */
|
|
53
|
+
value?: string;
|
|
54
|
+
};
|
|
@@ -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 & {
|
|
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 & {
|
|
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;
|
|
@@ -11,7 +11,7 @@ export declare const modifyBlock: (block: BlockDef, i: number) => {
|
|
|
11
11
|
} & import("../../ui-kit/Tags/TagsContent").TagsContent & import("../../ui-kit/LinkButton/ButtonsSectionContent").ButtonsSectionContent & import("../../ui-kit/Img/ImgProps").ImageContent & import("../../ui-kit/BaseProductTile/BaseProductTileContent").PriceListProps & {
|
|
12
12
|
imageOptions?: import("../../ui-kit/BaseProductTile/BaseProductTileContent").TileImageOptions | undefined;
|
|
13
13
|
isFullWidthTitle?: boolean | undefined;
|
|
14
|
-
} &
|
|
14
|
+
} & {
|
|
15
15
|
backwardButton?: boolean | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
link?: LinkProps | undefined;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import type { JSONRefObject } from '../../data/JSONRefObject';
|
|
1
2
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
2
3
|
import { type ProductBlockContent } from './ProductBlockContent';
|
|
3
4
|
export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
|
|
5
|
+
dynamicDescriptionSource?: JSONRefObject & {
|
|
6
|
+
list?: Record<string, string>[];
|
|
7
|
+
};
|
|
4
8
|
}
|
|
5
9
|
export declare const ProductBlock: import("../../UniBlock/UniBlock").UniBlockComponent<ProductBlockProps>;
|
|
@@ -4,6 +4,21 @@ const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
|
|
|
4
4
|
const BaseProductTile_1 = require("../../ui-kit/BaseProductTile/BaseProductTile");
|
|
5
5
|
const BlockWrapper_1 = require("../../ui-kit/BlockWrapper");
|
|
6
6
|
const UniBlock_1 = require("../../UniBlock/UniBlock");
|
|
7
|
+
const getSessionQuery_1 = require("../../utils/getSessionQuery");
|
|
7
8
|
const style_1 = require("../../utils/style");
|
|
8
|
-
exports.ProductBlock = (0, UniBlock_1.UniBlock)(({ className, padding, defaultPadding,
|
|
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 }) }));
|
|
12
|
+
});
|
|
13
|
+
const getFormatDescription = (dynamicUtmDescription = {}, valuesList = [], description = '') => {
|
|
14
|
+
const { utm, value } = dynamicUtmDescription;
|
|
15
|
+
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;
|
|
19
|
+
};
|
|
20
|
+
const getUtmValue = (utm, queryString) => {
|
|
21
|
+
const params = new URLSearchParams(queryString);
|
|
22
|
+
return params.get(utm);
|
|
23
|
+
};
|
|
9
24
|
//# sourceMappingURL=ProductBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductBlock.js","sourceRoot":"","sources":["../../../src/components/ProductBlock/ProductBlock.tsx"],"names":[],"mappings":";;;
|
|
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,IAAI,OAAO,EACzC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAC,aAAa,KACnB,IAAI,GACR,GACW,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAC3B,wBAA4C,EAAE,EAC9C,aAAuC,EAAE,EACzC,WAAW,GAAG,EAAE,EAChB,EAAE;IACF,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC;IAC7C,MAAM,YAAY,GAAG,IAAA,kCAAgB,GAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,IAAI,YAAY,EAAE,YAAY,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,QAAQ,CAAC,EAAE,KAAK,CAAC;IAE7E,OAAO,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;AACvF,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,WAAmB,EAAE,EAAE;IACvD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type AdditionalDescriptionProps } from '../../model/HeadlineType';
|
|
1
|
+
import { type AdditionalDescriptionProps, type DynamicDescriptionProps } 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 & {
|
|
7
|
+
export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicDescriptionProps & {
|
|
8
8
|
/** @title Отображать кнопку возврата */
|
|
9
9
|
backwardButton?: boolean;
|
|
10
10
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type JSONRefObject } from '../data/JSONRefObject';
|
|
1
2
|
import { type TextAlign } from '../ui-kit/Text/TextProps';
|
|
2
3
|
/**
|
|
3
4
|
* TODO: Hellfire refactoring is needed here
|
|
@@ -35,7 +36,19 @@ export declare type AdditionalDescriptionProps = {
|
|
|
35
36
|
/** @title Дополнительное описание */
|
|
36
37
|
additionalDescription?: string;
|
|
37
38
|
};
|
|
38
|
-
export declare type
|
|
39
|
+
export declare type DynamicDescriptionProps = {
|
|
40
|
+
/** @title Динамическое описание по значению utm-метки */
|
|
41
|
+
dynamicUtmDescription?: DynamicDescription;
|
|
42
|
+
/** @title Справочник значений */
|
|
43
|
+
dynamicDescriptionSource?: JSONRefObject;
|
|
44
|
+
};
|
|
45
|
+
export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicDescriptionProps;
|
|
39
46
|
export declare type HeadlineProps = HeadlineCommonProps & {
|
|
40
47
|
headlineVersion?: HeadlineVersion;
|
|
41
48
|
};
|
|
49
|
+
export declare type DynamicDescription = {
|
|
50
|
+
/** @title utm-метка */
|
|
51
|
+
utm?: string;
|
|
52
|
+
/** @title Заменяемый текст */
|
|
53
|
+
value?: string;
|
|
54
|
+
};
|
|
@@ -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 & {
|
|
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 & {
|
|
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;
|
|
@@ -11,7 +11,7 @@ export declare const modifyBlock: (block: BlockDef, i: number) => {
|
|
|
11
11
|
} & import("../../ui-kit/Tags/TagsContent").TagsContent & import("../../ui-kit/LinkButton/ButtonsSectionContent").ButtonsSectionContent & import("../../ui-kit/Img/ImgProps").ImageContent & import("../../ui-kit/BaseProductTile/BaseProductTileContent").PriceListProps & {
|
|
12
12
|
imageOptions?: import("../../ui-kit/BaseProductTile/BaseProductTileContent").TileImageOptions | undefined;
|
|
13
13
|
isFullWidthTitle?: boolean | undefined;
|
|
14
|
-
} &
|
|
14
|
+
} & {
|
|
15
15
|
backwardButton?: boolean | undefined;
|
|
16
16
|
} & {
|
|
17
17
|
link?: LinkProps | undefined;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import type { JSONRefObject } from '../../data/JSONRefObject';
|
|
1
2
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
2
3
|
import { type ProductBlockContent } from './ProductBlockContent';
|
|
3
4
|
export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
|
|
5
|
+
dynamicDescriptionSource?: JSONRefObject & {
|
|
6
|
+
list?: Record<string, string>[];
|
|
7
|
+
};
|
|
4
8
|
}
|
|
5
9
|
export declare const ProductBlock: import("../../UniBlock/UniBlock").UniBlockComponent<ProductBlockProps>;
|
|
@@ -2,6 +2,21 @@ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
|
|
|
2
2
|
import { BaseProductTile } from '../../ui-kit/BaseProductTile/BaseProductTile.js';
|
|
3
3
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper.js';
|
|
4
4
|
import { UniBlock } from '../../UniBlock/UniBlock.js';
|
|
5
|
+
import { saveSessionQuery } from '../../utils/getSessionQuery.js';
|
|
5
6
|
import { style } from '../../utils/style.js';
|
|
6
|
-
export const ProductBlock = UniBlock(({ className, padding, defaultPadding,
|
|
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 }) }));
|
|
10
|
+
});
|
|
11
|
+
const getFormatDescription = (dynamicUtmDescription = {}, valuesList = [], description = '') => {
|
|
12
|
+
const { utm, value } = dynamicUtmDescription;
|
|
13
|
+
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;
|
|
17
|
+
};
|
|
18
|
+
const getUtmValue = (utm, queryString) => {
|
|
19
|
+
const params = new URLSearchParams(queryString);
|
|
20
|
+
return params.get(utm);
|
|
21
|
+
};
|
|
7
22
|
//# sourceMappingURL=ProductBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductBlock.js","sourceRoot":"","sources":["../../../src/components/ProductBlock/ProductBlock.tsx"],"names":[],"mappings":";
|
|
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,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAC,aAAa,KACnB,IAAI,GACR,GACW,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAC3B,wBAA4C,EAAE,EAC9C,aAAuC,EAAE,EACzC,WAAW,GAAG,EAAE,EAChB,EAAE;IACF,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC;IAC7C,MAAM,YAAY,GAAG,gBAAgB,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,IAAI,YAAY,EAAE,YAAY,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,QAAQ,CAAC,EAAE,KAAK,CAAC;IAE7E,OAAO,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;AACvF,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,WAAmB,EAAE,EAAE;IACvD,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type AdditionalDescriptionProps } from '../../model/HeadlineType';
|
|
1
|
+
import { type AdditionalDescriptionProps, type DynamicDescriptionProps } 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 & {
|
|
7
|
+
export declare type ProductBlockContent = UniBlockContent & BaseProductTileContent & AdditionalDescriptionProps & DynamicDescriptionProps & {
|
|
8
8
|
/** @title Отображать кнопку возврата */
|
|
9
9
|
backwardButton?: boolean;
|
|
10
10
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type JSONRefObject } from '../data/JSONRefObject';
|
|
1
2
|
import { type TextAlign } from '../ui-kit/Text/TextProps';
|
|
2
3
|
/**
|
|
3
4
|
* TODO: Hellfire refactoring is needed here
|
|
@@ -35,7 +36,19 @@ export declare type AdditionalDescriptionProps = {
|
|
|
35
36
|
/** @title Дополнительное описание */
|
|
36
37
|
additionalDescription?: string;
|
|
37
38
|
};
|
|
38
|
-
export declare type
|
|
39
|
+
export declare type DynamicDescriptionProps = {
|
|
40
|
+
/** @title Динамическое описание по значению utm-метки */
|
|
41
|
+
dynamicUtmDescription?: DynamicDescription;
|
|
42
|
+
/** @title Справочник значений */
|
|
43
|
+
dynamicDescriptionSource?: JSONRefObject;
|
|
44
|
+
};
|
|
45
|
+
export declare type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps & AdditionalDescriptionProps & DynamicDescriptionProps;
|
|
39
46
|
export declare type HeadlineProps = HeadlineCommonProps & {
|
|
40
47
|
headlineVersion?: HeadlineVersion;
|
|
41
48
|
};
|
|
49
|
+
export declare type DynamicDescription = {
|
|
50
|
+
/** @title utm-метка */
|
|
51
|
+
utm?: string;
|
|
52
|
+
/** @title Заменяемый текст */
|
|
53
|
+
value?: string;
|
|
54
|
+
};
|
|
@@ -1,25 +1,68 @@
|
|
|
1
|
+
import type { JSONRefObject } from '../../data/JSONRefObject';
|
|
2
|
+
import { type DynamicDescription } from '../../model/HeadlineType';
|
|
1
3
|
import { BaseProductTile } from '../../ui-kit/BaseProductTile/BaseProductTile';
|
|
2
4
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
3
5
|
import { UniBlock } from '../../UniBlock/UniBlock';
|
|
4
6
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
7
|
+
import { saveSessionQuery } from '../../utils/getSessionQuery';
|
|
5
8
|
import { style } from '../../utils/style';
|
|
6
9
|
import { type ProductBlockContent } from './ProductBlockContent';
|
|
7
10
|
|
|
8
|
-
export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
|
|
11
|
+
export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
|
|
12
|
+
dynamicDescriptionSource?: JSONRefObject & {
|
|
13
|
+
list?: Record<string, string>[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
9
16
|
|
|
10
17
|
export const ProductBlock = UniBlock<ProductBlockProps>(
|
|
11
|
-
({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
({
|
|
19
|
+
className,
|
|
20
|
+
padding,
|
|
21
|
+
defaultPadding,
|
|
22
|
+
dynamicUtmDescription,
|
|
23
|
+
dynamicDescriptionSource,
|
|
24
|
+
description,
|
|
25
|
+
...rest
|
|
26
|
+
}) => {
|
|
27
|
+
const formatDescription = getFormatDescription(
|
|
28
|
+
dynamicUtmDescription,
|
|
29
|
+
dynamicDescriptionSource?.list,
|
|
30
|
+
description,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<BlockWrapper
|
|
35
|
+
className={style('overflow-hidden flex flex-col gap-3xl box-border', className)}
|
|
36
|
+
padding="p-0"
|
|
21
37
|
{...rest}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
>
|
|
39
|
+
<BaseProductTile
|
|
40
|
+
defaultPadding={defaultPadding || 'p-6xl'}
|
|
41
|
+
padding={padding}
|
|
42
|
+
description={formatDescription}
|
|
43
|
+
className="grow h-full"
|
|
44
|
+
{...rest}
|
|
45
|
+
/>
|
|
46
|
+
</BlockWrapper>
|
|
47
|
+
);
|
|
48
|
+
},
|
|
25
49
|
);
|
|
50
|
+
|
|
51
|
+
const getFormatDescription = (
|
|
52
|
+
dynamicUtmDescription: DynamicDescription = {},
|
|
53
|
+
valuesList: Record<string, string>[] = [],
|
|
54
|
+
description = '',
|
|
55
|
+
) => {
|
|
56
|
+
const { utm, value } = dynamicUtmDescription;
|
|
57
|
+
const sessionQuery = saveSessionQuery();
|
|
58
|
+
const utmValue = getUtmValue(utm ?? 'utm_source', sessionQuery);
|
|
59
|
+
const dynamicValue = valuesList.find((item) => item?.id === utmValue)?.value;
|
|
60
|
+
|
|
61
|
+
return dynamicValue ? description.replace(String(value), dynamicValue) : description;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getUtmValue = (utm: string, queryString: string) => {
|
|
65
|
+
const params = new URLSearchParams(queryString);
|
|
66
|
+
|
|
67
|
+
return params.get(utm);
|
|
68
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type AdditionalDescriptionProps,
|
|
3
|
+
type DynamicDescriptionProps,
|
|
4
|
+
} from '../../model/HeadlineType';
|
|
2
5
|
import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BaseProductTileContent';
|
|
3
6
|
import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
4
7
|
|
|
@@ -7,7 +10,8 @@ import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
|
7
10
|
*/
|
|
8
11
|
export type ProductBlockContent = UniBlockContent &
|
|
9
12
|
BaseProductTileContent &
|
|
10
|
-
AdditionalDescriptionProps &
|
|
13
|
+
AdditionalDescriptionProps &
|
|
14
|
+
DynamicDescriptionProps & {
|
|
11
15
|
/** @title Отображать кнопку возврата */
|
|
12
16
|
backwardButton?: boolean;
|
|
13
17
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type JSONRefObject } from '../data/JSONRefObject';
|
|
1
2
|
import { type TextAlign } from '../ui-kit/Text/TextProps';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -45,8 +46,26 @@ export type AdditionalDescriptionProps = {
|
|
|
45
46
|
additionalDescription?: string;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
export type
|
|
49
|
+
export type DynamicDescriptionProps = {
|
|
50
|
+
/** @title Динамическое описание по значению utm-метки */
|
|
51
|
+
dynamicUtmDescription?: DynamicDescription;
|
|
52
|
+
/** @title Справочник значений */
|
|
53
|
+
dynamicDescriptionSource?: JSONRefObject;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type HeadlineCommonProps = TitleProps &
|
|
57
|
+
DescriptionProps &
|
|
58
|
+
AlignProps &
|
|
59
|
+
AdditionalDescriptionProps &
|
|
60
|
+
DynamicDescriptionProps;
|
|
49
61
|
|
|
50
62
|
export type HeadlineProps = HeadlineCommonProps & {
|
|
51
63
|
headlineVersion?: HeadlineVersion;
|
|
52
64
|
};
|
|
65
|
+
|
|
66
|
+
export type DynamicDescription = {
|
|
67
|
+
/** @title utm-метка */
|
|
68
|
+
utm?: string;
|
|
69
|
+
/** @title Заменяемый текст */
|
|
70
|
+
value?: string;
|
|
71
|
+
};
|
package/package.json
CHANGED
|
@@ -264,6 +264,28 @@ export default {
|
|
|
264
264
|
/>
|
|
265
265
|
</div>
|
|
266
266
|
),
|
|
267
|
+
'secondary with benefits and utm': (
|
|
268
|
+
<div className="container grid grid-cols-12">
|
|
269
|
+
<ProductBlock
|
|
270
|
+
className="col-span-12"
|
|
271
|
+
title="Потребительский кредит наличными"
|
|
272
|
+
headlineVersion="L"
|
|
273
|
+
description="Для всех зарплатных клиентов вашей компании действует специальная программа:"
|
|
274
|
+
benefits={benefits}
|
|
275
|
+
benefitsVersion="white"
|
|
276
|
+
buttons={buttonsSecond}
|
|
277
|
+
image={image}
|
|
278
|
+
version="secondary"
|
|
279
|
+
dynamicUtmDescription={{
|
|
280
|
+
utm: 'utm_source',
|
|
281
|
+
value: 'вашей компании',
|
|
282
|
+
}}
|
|
283
|
+
dynamicDescriptionSource={{
|
|
284
|
+
$ref: '/wcms-resources/referal-programm.json',
|
|
285
|
+
}}
|
|
286
|
+
/>
|
|
287
|
+
</div>
|
|
288
|
+
),
|
|
267
289
|
'secondary with list': (
|
|
268
290
|
<div className="container grid grid-cols-12">
|
|
269
291
|
<ProductBlock className="col-span-12" {...PRODUCT_BLOCK} image={image} version="secondary" />
|
|
@@ -1,25 +1,68 @@
|
|
|
1
|
+
import type { JSONRefObject } from '../../data/JSONRefObject';
|
|
2
|
+
import { type DynamicDescription } from '../../model/HeadlineType';
|
|
1
3
|
import { BaseProductTile } from '../../ui-kit/BaseProductTile/BaseProductTile';
|
|
2
4
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
3
5
|
import { UniBlock } from '../../UniBlock/UniBlock';
|
|
4
6
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
7
|
+
import { saveSessionQuery } from '../../utils/getSessionQuery';
|
|
5
8
|
import { style } from '../../utils/style';
|
|
6
9
|
import { type ProductBlockContent } from './ProductBlockContent';
|
|
7
10
|
|
|
8
|
-
export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
|
|
11
|
+
export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
|
|
12
|
+
dynamicDescriptionSource?: JSONRefObject & {
|
|
13
|
+
list?: Record<string, string>[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
9
16
|
|
|
10
17
|
export const ProductBlock = UniBlock<ProductBlockProps>(
|
|
11
|
-
({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
({
|
|
19
|
+
className,
|
|
20
|
+
padding,
|
|
21
|
+
defaultPadding,
|
|
22
|
+
dynamicUtmDescription,
|
|
23
|
+
dynamicDescriptionSource,
|
|
24
|
+
description,
|
|
25
|
+
...rest
|
|
26
|
+
}) => {
|
|
27
|
+
const formatDescription = getFormatDescription(
|
|
28
|
+
dynamicUtmDescription,
|
|
29
|
+
dynamicDescriptionSource?.list,
|
|
30
|
+
description,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<BlockWrapper
|
|
35
|
+
className={style('overflow-hidden flex flex-col gap-3xl box-border', className)}
|
|
36
|
+
padding="p-0"
|
|
21
37
|
{...rest}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
>
|
|
39
|
+
<BaseProductTile
|
|
40
|
+
defaultPadding={defaultPadding || 'p-6xl'}
|
|
41
|
+
padding={padding}
|
|
42
|
+
description={formatDescription}
|
|
43
|
+
className="grow h-full"
|
|
44
|
+
{...rest}
|
|
45
|
+
/>
|
|
46
|
+
</BlockWrapper>
|
|
47
|
+
);
|
|
48
|
+
},
|
|
25
49
|
);
|
|
50
|
+
|
|
51
|
+
const getFormatDescription = (
|
|
52
|
+
dynamicUtmDescription: DynamicDescription = {},
|
|
53
|
+
valuesList: Record<string, string>[] = [],
|
|
54
|
+
description = '',
|
|
55
|
+
) => {
|
|
56
|
+
const { utm, value } = dynamicUtmDescription;
|
|
57
|
+
const sessionQuery = saveSessionQuery();
|
|
58
|
+
const utmValue = getUtmValue(utm ?? 'utm_source', sessionQuery);
|
|
59
|
+
const dynamicValue = valuesList.find((item) => item?.id === utmValue)?.value;
|
|
60
|
+
|
|
61
|
+
return dynamicValue ? description.replace(String(value), dynamicValue) : description;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getUtmValue = (utm: string, queryString: string) => {
|
|
65
|
+
const params = new URLSearchParams(queryString);
|
|
66
|
+
|
|
67
|
+
return params.get(utm);
|
|
68
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type AdditionalDescriptionProps,
|
|
3
|
+
type DynamicDescriptionProps,
|
|
4
|
+
} from '../../model/HeadlineType';
|
|
2
5
|
import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BaseProductTileContent';
|
|
3
6
|
import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
4
7
|
|
|
@@ -7,7 +10,8 @@ import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
|
7
10
|
*/
|
|
8
11
|
export type ProductBlockContent = UniBlockContent &
|
|
9
12
|
BaseProductTileContent &
|
|
10
|
-
AdditionalDescriptionProps &
|
|
13
|
+
AdditionalDescriptionProps &
|
|
14
|
+
DynamicDescriptionProps & {
|
|
11
15
|
/** @title Отображать кнопку возврата */
|
|
12
16
|
backwardButton?: boolean;
|
|
13
17
|
};
|