@redneckz/wildless-cms-uni-blocks 0.14.982 → 0.14.984
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 +21 -18
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/RichTextBlock/RichTextBlock.d.ts +5 -1
- package/bundle/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/bundle/utils/getFormatDynamicText.d.ts +2 -0
- package/bundle/utils/getQueryParamValue.d.ts +1 -0
- package/dist/components/ProductBlock/ProductBlock.js +2 -13
- package/dist/components/ProductBlock/ProductBlock.js.map +1 -1
- package/dist/components/RichTextBlock/RichTextBlock.d.ts +5 -1
- package/dist/components/RichTextBlock/RichTextBlock.js +6 -4
- package/dist/components/RichTextBlock/RichTextBlock.js.map +1 -1
- package/dist/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/dist/retail/components/Fields/RegionRetailField.js +2 -2
- package/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/dist/utils/getFormatDynamicText.d.ts +2 -0
- package/dist/utils/getFormatDynamicText.js +13 -0
- package/dist/utils/getFormatDynamicText.js.map +1 -0
- package/dist/utils/getQueryParamValue.d.ts +1 -0
- package/dist/utils/getQueryParamValue.js +8 -0
- package/dist/utils/getQueryParamValue.js.map +1 -0
- package/lib/components/ProductBlock/ProductBlock.js +2 -13
- package/lib/components/ProductBlock/ProductBlock.js.map +1 -1
- package/lib/components/RichTextBlock/RichTextBlock.d.ts +5 -1
- package/lib/components/RichTextBlock/RichTextBlock.fixture.d.ts +1 -0
- package/lib/components/RichTextBlock/RichTextBlock.js +6 -4
- package/lib/components/RichTextBlock/RichTextBlock.js.map +1 -1
- package/lib/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/lib/retail/components/Fields/RegionRetailField.js +2 -2
- package/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/lib/utils/getFormatDynamicText.d.ts +2 -0
- package/lib/utils/getFormatDynamicText.js +10 -0
- package/lib/utils/getFormatDynamicText.js.map +1 -0
- package/lib/utils/getQueryParamValue.d.ts +1 -0
- package/lib/utils/getQueryParamValue.js +5 -0
- package/lib/utils/getQueryParamValue.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +21 -18
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/RichTextBlock/RichTextBlock.d.ts +5 -1
- package/mobile/bundle/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/mobile/bundle/utils/getFormatDynamicText.d.ts +2 -0
- package/mobile/bundle/utils/getQueryParamValue.d.ts +1 -0
- package/mobile/dist/components/ProductBlock/ProductBlock.js +2 -13
- package/mobile/dist/components/ProductBlock/ProductBlock.js.map +1 -1
- package/mobile/dist/components/RichTextBlock/RichTextBlock.d.ts +5 -1
- package/mobile/dist/components/RichTextBlock/RichTextBlock.js +6 -4
- package/mobile/dist/components/RichTextBlock/RichTextBlock.js.map +1 -1
- package/mobile/dist/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/mobile/dist/retail/components/Fields/RegionRetailField.js +2 -2
- package/mobile/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/mobile/dist/utils/getFormatDynamicText.d.ts +2 -0
- package/mobile/dist/utils/getFormatDynamicText.js +13 -0
- package/mobile/dist/utils/getFormatDynamicText.js.map +1 -0
- package/mobile/dist/utils/getQueryParamValue.d.ts +1 -0
- package/mobile/dist/utils/getQueryParamValue.js +8 -0
- package/mobile/dist/utils/getQueryParamValue.js.map +1 -0
- package/mobile/lib/components/ProductBlock/ProductBlock.js +2 -13
- package/mobile/lib/components/ProductBlock/ProductBlock.js.map +1 -1
- package/mobile/lib/components/RichTextBlock/RichTextBlock.d.ts +5 -1
- package/mobile/lib/components/RichTextBlock/RichTextBlock.js +6 -4
- package/mobile/lib/components/RichTextBlock/RichTextBlock.js.map +1 -1
- package/mobile/lib/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/mobile/lib/retail/components/Fields/RegionRetailField.js +2 -2
- package/mobile/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
- package/mobile/lib/utils/getFormatDynamicText.d.ts +2 -0
- package/mobile/lib/utils/getFormatDynamicText.js +10 -0
- package/mobile/lib/utils/getFormatDynamicText.js.map +1 -0
- package/mobile/lib/utils/getQueryParamValue.d.ts +1 -0
- package/mobile/lib/utils/getQueryParamValue.js +5 -0
- package/mobile/lib/utils/getQueryParamValue.js.map +1 -0
- package/mobile/src/components/ProductBlock/ProductBlock.tsx +2 -24
- package/mobile/src/components/RichTextBlock/RichTextBlock.tsx +19 -5
- package/mobile/src/components/RichTextBlock/RichTextBlockContent.ts +2 -1
- package/mobile/src/retail/components/Fields/RegionRetailField.tsx +2 -4
- package/mobile/src/utils/getFormatDynamicText.ts +18 -0
- package/mobile/src/utils/getQueryParamValue.ts +5 -0
- package/package.json +1 -1
- package/src/components/ProductBlock/ProductBlock.tsx +2 -24
- package/src/components/RichTextBlock/RichTextBlock.fixture.tsx +18 -1
- package/src/components/RichTextBlock/RichTextBlock.tsx +19 -5
- package/src/components/RichTextBlock/RichTextBlockContent.ts +2 -1
- package/src/retail/components/Fields/RegionRetailField.tsx +2 -4
- package/src/utils/getFormatDynamicText.ts +18 -0
- package/src/utils/getQueryParamValue.ts +5 -0
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { JSONRefObject } from '../../data/JSONRefObject';
|
|
2
2
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
3
3
|
import { RichText } from '../../ui-kit/RichText/RichText';
|
|
4
|
+
import { UniBlock } from '../../UniBlock/UniBlock';
|
|
4
5
|
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
6
|
+
import { getFormatDynamicText } from '../../utils/getFormatDynamicText';
|
|
5
7
|
import { type RichTextBlockContent } from './RichTextBlockContent';
|
|
6
8
|
|
|
7
|
-
interface RichTextBlockProps extends RichTextBlockContent, UniBlockProps {
|
|
9
|
+
interface RichTextBlockProps extends RichTextBlockContent, UniBlockProps {
|
|
10
|
+
dynamicTextSource?: JSONRefObject & {
|
|
11
|
+
list?: Record<string, string>[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
8
14
|
|
|
9
|
-
export const RichTextBlock =
|
|
10
|
-
const {
|
|
15
|
+
export const RichTextBlock = UniBlock<RichTextBlockProps>((props) => {
|
|
16
|
+
const {
|
|
17
|
+
__html,
|
|
18
|
+
dynamicQueryParamText = {},
|
|
19
|
+
dynamicTextSource,
|
|
20
|
+
richVersion = '',
|
|
21
|
+
...rest
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
const formatText = getFormatDynamicText(dynamicQueryParamText, dynamicTextSource?.list, __html);
|
|
11
25
|
|
|
12
26
|
return (
|
|
13
27
|
<BlockWrapper defaultPadding="p-0" {...rest}>
|
|
14
|
-
<RichText __html={
|
|
28
|
+
<RichText __html={formatText} richVersion={richVersion} />
|
|
15
29
|
</BlockWrapper>
|
|
16
30
|
);
|
|
17
31
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type DynamicTextProps } from '../../model/HeadlineType';
|
|
1
2
|
import { type RichTextProps } from '../../ui-kit/RichText/RichTextProps';
|
|
2
3
|
import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @title Форматированный текст
|
|
6
7
|
*/
|
|
7
|
-
export type RichTextBlockContent = UniBlockContent & RichTextProps;
|
|
8
|
+
export type RichTextBlockContent = UniBlockContent & RichTextProps & DynamicTextProps;
|
|
@@ -60,13 +60,11 @@ export const RegionRetailField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
|
60
60
|
handleChangeOffice?.(DEFAULT_BIBLIOLOBUS_VALUES.office);
|
|
61
61
|
handleChangeRegionHasDelivery?.(checkRegionDeliveryStatus(DEFAULT_BIBLIOLOBUS_VALUES.region));
|
|
62
62
|
handleChangeMethodObtain?.('office');
|
|
63
|
-
}
|
|
64
|
-
if (isSalaryCard) {
|
|
63
|
+
} else if (isSalaryCard) {
|
|
65
64
|
handleChangeRegion?.(DEFAULT_SALARY_CARD_VALUES.region);
|
|
66
65
|
handleChangeOffice?.(DEFAULT_SALARY_CARD_VALUES.office);
|
|
67
66
|
handleChangeMethodObtain?.('office');
|
|
68
|
-
}
|
|
69
|
-
if (regionRetail) {
|
|
67
|
+
} else if (regionRetail) {
|
|
70
68
|
const regionHasDelivery = checkRegionDeliveryStatus(regionRetail);
|
|
71
69
|
handleChangeRegionHasDelivery?.(regionHasDelivery);
|
|
72
70
|
handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DynamicText } from '../model/HeadlineType';
|
|
2
|
+
import { getQueryParamValue } from './getQueryParamValue';
|
|
3
|
+
import { saveSessionQuery } from './getSessionQuery';
|
|
4
|
+
|
|
5
|
+
export const getFormatDynamicText = (
|
|
6
|
+
dynamicQueryParamText: DynamicText = {},
|
|
7
|
+
valuesList: Record<string, string>[] = [],
|
|
8
|
+
text = '',
|
|
9
|
+
) => {
|
|
10
|
+
const { queryParam, value } = dynamicQueryParamText;
|
|
11
|
+
const sessionQuery = saveSessionQuery();
|
|
12
|
+
const utmValue = getQueryParamValue(queryParam ?? 'utm_source', sessionQuery);
|
|
13
|
+
const dynamicValue = valuesList.find(
|
|
14
|
+
(item) => item?.id?.toLowerCase() === utmValue?.toLowerCase(),
|
|
15
|
+
)?.value;
|
|
16
|
+
|
|
17
|
+
return dynamicValue ? text?.replace(String(value), dynamicValue) : text;
|
|
18
|
+
};
|