@gravity-ui/page-constructor 4.9.1-alpha.0 → 4.11.0
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/build/cjs/blocks/CardLayout/CardLayout.d.ts +2 -2
- package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
- package/build/cjs/blocks/ContentLayout/schema.d.ts +38 -0
- package/build/cjs/components/Image/schema.d.ts +19 -0
- package/build/cjs/components/Image/schema.js +12 -1
- package/build/cjs/constructor-items.d.ts +2 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -2
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
- package/build/cjs/models/constructor-items/common.d.ts +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/cjs/models/constructor.d.ts +6 -1
- package/build/cjs/schema/constants.d.ts +181 -78
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +100 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +10 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +3 -3
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +81 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +10 -0
- package/build/cjs/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/cjs/sub-blocks/MediaCard/MediaCard.js +2 -2
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +81 -78
- package/build/cjs/sub-blocks/MediaCard/schema.js +11 -1
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
- package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +7 -4
- package/build/cjs/sub-blocks/PriceDetailed/schema.js +11 -1
- package/build/cjs/text-transform/common.d.ts +2 -3
- package/build/cjs/text-transform/common.js +2 -7
- package/build/cjs/text-transform/transformers.d.ts +0 -2
- package/build/cjs/text-transform/transformers.js +8 -6
- package/build/esm/blocks/CardLayout/CardLayout.d.ts +2 -2
- package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
- package/build/esm/blocks/ContentLayout/schema.d.ts +38 -0
- package/build/esm/components/Image/schema.d.ts +19 -0
- package/build/esm/components/Image/schema.js +12 -1
- package/build/esm/constructor-items.d.ts +2 -2
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.css +38 -0
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +1 -0
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +4 -2
- package/build/esm/models/constructor-items/blocks.d.ts +1 -0
- package/build/esm/models/constructor-items/common.d.ts +1 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -4
- package/build/esm/models/constructor.d.ts +6 -1
- package/build/esm/schema/constants.d.ts +181 -78
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +100 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +10 -0
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +3 -3
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +81 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +10 -0
- package/build/esm/sub-blocks/MediaCard/MediaCard.d.ts +1 -1
- package/build/esm/sub-blocks/MediaCard/MediaCard.js +2 -2
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +81 -78
- package/build/esm/sub-blocks/MediaCard/schema.js +11 -1
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +2 -2
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +2 -2
- package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +8 -4
- package/build/esm/sub-blocks/PriceDetailed/schema.js +11 -1
- package/build/esm/text-transform/common.d.ts +2 -3
- package/build/esm/text-transform/common.js +2 -6
- package/build/esm/text-transform/transformers.d.ts +0 -2
- package/build/esm/text-transform/transformers.js +8 -6
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -0
- package/server/models/constructor-items/common.d.ts +1 -1
- package/server/models/constructor-items/sub-blocks.d.ts +4 -4
- package/server/models/constructor.d.ts +6 -1
- package/server/text-transform/common.d.ts +2 -3
- package/server/text-transform/common.js +2 -9
- package/server/text-transform/transformers.d.ts +0 -2
- package/server/text-transform/transformers.js +8 -6
- package/styles/mixins.scss +1 -0
- package/styles/storybook/common.scss +2 -0
- package/widget/index.js +1 -1
|
@@ -318,6 +318,87 @@ export declare const LayoutItem: {
|
|
|
318
318
|
fullscreen: {
|
|
319
319
|
type: string;
|
|
320
320
|
};
|
|
321
|
+
analyticsEvents: {
|
|
322
|
+
oneOf: ({
|
|
323
|
+
optionName: string;
|
|
324
|
+
type: string;
|
|
325
|
+
additionalProperties: {
|
|
326
|
+
type: string;
|
|
327
|
+
};
|
|
328
|
+
required: string[];
|
|
329
|
+
properties: {
|
|
330
|
+
name: {
|
|
331
|
+
type: string;
|
|
332
|
+
};
|
|
333
|
+
type: {
|
|
334
|
+
type: string;
|
|
335
|
+
};
|
|
336
|
+
counters: {
|
|
337
|
+
type: string;
|
|
338
|
+
additionalProperties: boolean;
|
|
339
|
+
required: never[];
|
|
340
|
+
properties: {
|
|
341
|
+
include: {
|
|
342
|
+
type: string;
|
|
343
|
+
items: {
|
|
344
|
+
type: string;
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
exclude: {
|
|
348
|
+
type: string;
|
|
349
|
+
items: {
|
|
350
|
+
type: string;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
context: {
|
|
356
|
+
type: string;
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
items?: undefined;
|
|
360
|
+
} | {
|
|
361
|
+
type: string;
|
|
362
|
+
items: {
|
|
363
|
+
type: string;
|
|
364
|
+
additionalProperties: {
|
|
365
|
+
type: string;
|
|
366
|
+
};
|
|
367
|
+
required: string[];
|
|
368
|
+
properties: {
|
|
369
|
+
name: {
|
|
370
|
+
type: string;
|
|
371
|
+
};
|
|
372
|
+
type: {
|
|
373
|
+
type: string;
|
|
374
|
+
};
|
|
375
|
+
counters: {
|
|
376
|
+
type: string;
|
|
377
|
+
additionalProperties: boolean;
|
|
378
|
+
required: never[];
|
|
379
|
+
properties: {
|
|
380
|
+
include: {
|
|
381
|
+
type: string;
|
|
382
|
+
items: {
|
|
383
|
+
type: string;
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
exclude: {
|
|
387
|
+
type: string;
|
|
388
|
+
items: {
|
|
389
|
+
type: string;
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
context: {
|
|
395
|
+
type: string;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
optionName: string;
|
|
400
|
+
})[];
|
|
401
|
+
};
|
|
321
402
|
type: {};
|
|
322
403
|
when: {
|
|
323
404
|
type: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { omit } from 'lodash';
|
|
2
2
|
import metaInfo from '../../components/MetaInfo/schema';
|
|
3
3
|
import { BaseProps, MediaProps } from '../../schema/validators/common';
|
|
4
|
+
import { AnalyticsEventSchema } from '../../schema/validators/event';
|
|
4
5
|
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
5
6
|
export const LayoutItem = {
|
|
6
7
|
type: 'object',
|
|
@@ -10,5 +11,14 @@ export const LayoutItem = {
|
|
|
10
11
|
type: 'boolean',
|
|
11
12
|
}, fullscreen: {
|
|
12
13
|
type: 'boolean',
|
|
14
|
+
}, analyticsEvents: {
|
|
15
|
+
oneOf: [
|
|
16
|
+
Object.assign(Object.assign({}, AnalyticsEventSchema), { optionName: 'single' }),
|
|
17
|
+
{
|
|
18
|
+
type: 'array',
|
|
19
|
+
items: AnalyticsEventSchema,
|
|
20
|
+
optionName: 'list',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
13
23
|
} }),
|
|
14
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { MediaCardProps } from '../../models';
|
|
2
2
|
import './MediaCard.css';
|
|
3
|
-
declare const MediaCard: ({ border, ...mediaProps }: MediaCardProps) => JSX.Element;
|
|
3
|
+
declare const MediaCard: ({ border, analyticsEvents, ...mediaProps }: MediaCardProps) => JSX.Element;
|
|
4
4
|
export default MediaCard;
|
|
@@ -5,8 +5,8 @@ import { block } from '../../utils';
|
|
|
5
5
|
import './MediaCard.css';
|
|
6
6
|
const b = block('MediaCard');
|
|
7
7
|
const MediaCard = (_a) => {
|
|
8
|
-
var { border } = _a, mediaProps = __rest(_a, ["border"]);
|
|
9
|
-
return (React.createElement(CardBase, { className: b(), bodyClassName: b('body'), border: border },
|
|
8
|
+
var { border, analyticsEvents } = _a, mediaProps = __rest(_a, ["border", "analyticsEvents"]);
|
|
9
|
+
return (React.createElement(CardBase, { className: b(), bodyClassName: b('body'), border: border, analyticsEvents: analyticsEvents },
|
|
10
10
|
React.createElement(CardBase.Content, null,
|
|
11
11
|
React.createElement(Media, Object.assign({}, mediaProps)))));
|
|
12
12
|
};
|
|
@@ -3,6 +3,87 @@ export declare const MediaCardBlock: {
|
|
|
3
3
|
additionalProperties: boolean;
|
|
4
4
|
required: never[];
|
|
5
5
|
properties: {
|
|
6
|
+
analyticsEvents: {
|
|
7
|
+
oneOf: ({
|
|
8
|
+
optionName: string;
|
|
9
|
+
type: string;
|
|
10
|
+
additionalProperties: {
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
required: string[];
|
|
14
|
+
properties: {
|
|
15
|
+
name: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
type: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
counters: {
|
|
22
|
+
type: string;
|
|
23
|
+
additionalProperties: boolean;
|
|
24
|
+
required: never[];
|
|
25
|
+
properties: {
|
|
26
|
+
include: {
|
|
27
|
+
type: string;
|
|
28
|
+
items: {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exclude: {
|
|
33
|
+
type: string;
|
|
34
|
+
items: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
context: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
items?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
type: string;
|
|
47
|
+
items: {
|
|
48
|
+
type: string;
|
|
49
|
+
additionalProperties: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
required: string[];
|
|
53
|
+
properties: {
|
|
54
|
+
name: {
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
type: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
60
|
+
counters: {
|
|
61
|
+
type: string;
|
|
62
|
+
additionalProperties: boolean;
|
|
63
|
+
required: never[];
|
|
64
|
+
properties: {
|
|
65
|
+
include: {
|
|
66
|
+
type: string;
|
|
67
|
+
items: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exclude: {
|
|
72
|
+
type: string;
|
|
73
|
+
items: {
|
|
74
|
+
type: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
context: {
|
|
80
|
+
type: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
optionName: string;
|
|
85
|
+
})[];
|
|
86
|
+
};
|
|
6
87
|
animated: {
|
|
7
88
|
type: string;
|
|
8
89
|
};
|
|
@@ -147,84 +228,6 @@ export declare const MediaCardBlock: {
|
|
|
147
228
|
fullscreen: {
|
|
148
229
|
type: string;
|
|
149
230
|
};
|
|
150
|
-
analyticsEvents: {
|
|
151
|
-
anyOf: ({
|
|
152
|
-
type: string;
|
|
153
|
-
additionalProperties: {
|
|
154
|
-
type: string;
|
|
155
|
-
};
|
|
156
|
-
required: string[];
|
|
157
|
-
properties: {
|
|
158
|
-
name: {
|
|
159
|
-
type: string;
|
|
160
|
-
};
|
|
161
|
-
type: {
|
|
162
|
-
type: string;
|
|
163
|
-
};
|
|
164
|
-
counters: {
|
|
165
|
-
type: string;
|
|
166
|
-
additionalProperties: boolean;
|
|
167
|
-
required: never[];
|
|
168
|
-
properties: {
|
|
169
|
-
include: {
|
|
170
|
-
type: string;
|
|
171
|
-
items: {
|
|
172
|
-
type: string;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
exclude: {
|
|
176
|
-
type: string;
|
|
177
|
-
items: {
|
|
178
|
-
type: string;
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
context: {
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
} | {
|
|
188
|
-
type: string;
|
|
189
|
-
items: {
|
|
190
|
-
type: string;
|
|
191
|
-
additionalProperties: {
|
|
192
|
-
type: string;
|
|
193
|
-
};
|
|
194
|
-
required: string[];
|
|
195
|
-
properties: {
|
|
196
|
-
name: {
|
|
197
|
-
type: string;
|
|
198
|
-
};
|
|
199
|
-
type: {
|
|
200
|
-
type: string;
|
|
201
|
-
};
|
|
202
|
-
counters: {
|
|
203
|
-
type: string;
|
|
204
|
-
additionalProperties: boolean;
|
|
205
|
-
required: never[];
|
|
206
|
-
properties: {
|
|
207
|
-
include: {
|
|
208
|
-
type: string;
|
|
209
|
-
items: {
|
|
210
|
-
type: string;
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
exclude: {
|
|
214
|
-
type: string;
|
|
215
|
-
items: {
|
|
216
|
-
type: string;
|
|
217
|
-
};
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
context: {
|
|
222
|
-
type: string;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
})[];
|
|
227
|
-
};
|
|
228
231
|
border: {
|
|
229
232
|
type: string;
|
|
230
233
|
enum: string[];
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { AnimatableProps, BaseProps, CardBase, MediaProps } from '../../schema/validators/common';
|
|
2
|
+
import { AnalyticsEventSchema } from '../../schema/validators/event';
|
|
2
3
|
export const MediaCardBlock = {
|
|
3
4
|
'media-card': {
|
|
4
5
|
additionalProperties: false,
|
|
5
6
|
required: [],
|
|
6
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), MediaProps), AnimatableProps),
|
|
7
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), MediaProps), AnimatableProps), { analyticsEvents: {
|
|
8
|
+
oneOf: [
|
|
9
|
+
Object.assign(Object.assign({}, AnalyticsEventSchema), { optionName: 'single' }),
|
|
10
|
+
{
|
|
11
|
+
type: 'array',
|
|
12
|
+
items: AnalyticsEventSchema,
|
|
13
|
+
optionName: 'list',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
} }),
|
|
7
17
|
},
|
|
8
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CardBorder, PriceDescriptionProps, PriceDetailsListProps, PriceDetailsSettingsProps, PriceItemProps } from '../../../models';
|
|
2
|
+
import { AnalyticsEventsBase, CardBorder, PriceDescriptionProps, PriceDetailsListProps, PriceDetailsSettingsProps, PriceItemProps } from '../../../models';
|
|
3
3
|
import './CombinedPriceDetailed.css';
|
|
4
|
-
interface CombinedPriceDetailedProps {
|
|
4
|
+
interface CombinedPriceDetailedProps extends AnalyticsEventsBase {
|
|
5
5
|
items: PriceItemProps[];
|
|
6
6
|
numberGroupItems: number;
|
|
7
7
|
useMixedView?: boolean;
|
|
@@ -12,7 +12,7 @@ const CombinedPricesGroupSize = {
|
|
|
12
12
|
[GridColumnSize.Lg]: 3,
|
|
13
13
|
};
|
|
14
14
|
const CombinedPriceDetailed = (props) => {
|
|
15
|
-
const { items, numberGroupItems, border, useMixedView, getDescriptionComponent, getDetailsComponent, } = props;
|
|
15
|
+
const { items, numberGroupItems, border, useMixedView, getDescriptionComponent, getDetailsComponent, analyticsEvents, } = props;
|
|
16
16
|
const [groupItemsSize, setGroupItemsSize] = useState(numberGroupItems);
|
|
17
17
|
const updateGroupItemsSize = useCallback((windowWidth) => {
|
|
18
18
|
if (windowWidth >= BREAKPOINTS.lg) {
|
|
@@ -49,7 +49,7 @@ const CombinedPriceDetailed = (props) => {
|
|
|
49
49
|
React.createElement("div", { className: b('description', { delimiter: useMixedView }) }, detailsComponents)));
|
|
50
50
|
};
|
|
51
51
|
const chunkedItems = _.chunk(items, groupItemsSize);
|
|
52
|
-
return (React.createElement(CardBase, { className: b(), border: border },
|
|
52
|
+
return (React.createElement(CardBase, { className: b(), border: border, analyticsEvents: analyticsEvents },
|
|
53
53
|
React.createElement(CardBase.Content, null,
|
|
54
54
|
React.createElement(Grid, null, chunkedItems.map((chunk, id) => {
|
|
55
55
|
return (React.createElement(Row, { key: id, className: b('row') }, getPrice(chunk)));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import React, { Fragment } from 'react';
|
|
2
3
|
import { CardBase } from '../../../components';
|
|
3
4
|
import { block } from '../../../utils';
|
|
@@ -5,9 +6,12 @@ import './SeparatePriceDetailed.css';
|
|
|
5
6
|
const b = block('separate-price-detailed-block');
|
|
6
7
|
const SeparatePriceDetailed = (props) => {
|
|
7
8
|
const { items, border, getDescriptionComponent, getDetailsComponent } = props;
|
|
8
|
-
return (React.createElement(Fragment, null, items.map((
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
return (React.createElement(Fragment, null, items.map((_a, id) => {
|
|
10
|
+
var { analyticsEvents } = _a, item = __rest(_a, ["analyticsEvents"]);
|
|
11
|
+
return (React.createElement(CardBase, { key: id, className: b(), border: border, analyticsEvents: analyticsEvents },
|
|
12
|
+
React.createElement(CardBase.Content, null,
|
|
13
|
+
getDescriptionComponent(item),
|
|
14
|
+
getDetailsComponent(item.items))));
|
|
15
|
+
})));
|
|
12
16
|
};
|
|
13
17
|
export default SeparatePriceDetailed;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AnimatableProps, BaseProps, textSize } from '../../schema/validators/common';
|
|
2
|
+
import { AnalyticsEventSchema } from '../../schema/validators/event';
|
|
2
3
|
import { filteredArray } from '../../schema/validators/utils';
|
|
3
4
|
const PriceDetailedDetailsType = ['marked-list', 'settings'];
|
|
4
5
|
const PriceDetailedDescriptionColor = ['cornflower', 'black'];
|
|
@@ -134,7 +135,16 @@ const PriceItem = {
|
|
|
134
135
|
type: 'object',
|
|
135
136
|
additionalProperties: false,
|
|
136
137
|
required: ['title', 'description'],
|
|
137
|
-
properties: Object.assign(Object.assign({}, PriceDetailsProps), PriceDescriptionProps),
|
|
138
|
+
properties: Object.assign(Object.assign(Object.assign({}, PriceDetailsProps), PriceDescriptionProps), { analyticsEvents: {
|
|
139
|
+
oneOf: [
|
|
140
|
+
Object.assign(Object.assign({}, AnalyticsEventSchema), { optionName: 'single' }),
|
|
141
|
+
{
|
|
142
|
+
type: 'array',
|
|
143
|
+
items: AnalyticsEventSchema,
|
|
144
|
+
optionName: 'list',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
} }),
|
|
138
148
|
};
|
|
139
149
|
export const PriceDetailedBlock = {
|
|
140
150
|
'price-detailed': {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
|
|
2
1
|
import { Lang } from '../utils/configure';
|
|
3
2
|
export type ComplexItem = {
|
|
4
3
|
[key: string]: string;
|
|
5
4
|
};
|
|
6
5
|
export type Item = string | null | ComplexItem;
|
|
7
6
|
export type Transformer = (text: string) => string;
|
|
8
|
-
export type TransformerRaw = (lang: Lang, content: string
|
|
7
|
+
export type TransformerRaw = (lang: Lang, content: string) => string;
|
|
9
8
|
export type Parser<T = any> = (transformer: Transformer, block: T) => T;
|
|
10
9
|
export declare const createItemsParser: (fields: string[]) => (transformer: Transformer, items: Item[]) => (string | {
|
|
11
10
|
[x: string]: string;
|
|
12
11
|
} | null)[];
|
|
13
|
-
export declare function yfmTransformer(lang: Lang, content: string
|
|
12
|
+
export declare function yfmTransformer(lang: Lang, content: string): string;
|
|
14
13
|
export declare function typografTransformer(lang: Lang, content: string): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import defaultPlugins from '@doc-tools/transform/lib/plugins';
|
|
2
1
|
import { fullTransform, typografToHTML } from './utils';
|
|
3
2
|
export const createItemsParser = (fields) => (transformer, items) => items.map((item) => {
|
|
4
3
|
if (!item) {
|
|
@@ -17,11 +16,8 @@ export const createItemsParser = (fields) => (transformer, items) => items.map((
|
|
|
17
16
|
}, {}));
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
export function yfmTransformer(lang, content
|
|
21
|
-
const { html } = fullTransform(content, {
|
|
22
|
-
lang,
|
|
23
|
-
plugins: [...defaultPlugins, ...additionalPlugins],
|
|
24
|
-
});
|
|
19
|
+
export function yfmTransformer(lang, content) {
|
|
20
|
+
const { html } = fullTransform(content, { lang });
|
|
25
21
|
return html;
|
|
26
22
|
}
|
|
27
23
|
export function typografTransformer(lang, content) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
|
|
2
1
|
import { ConstructorBlock } from '../models/constructor';
|
|
3
2
|
import { Lang } from '../utils/configure';
|
|
4
3
|
export type ContentVariables = Record<string, string>;
|
|
@@ -10,7 +9,6 @@ export type ContentTransformerProps = {
|
|
|
10
9
|
lang: Lang;
|
|
11
10
|
customConfig?: {};
|
|
12
11
|
vars?: ContentVariables;
|
|
13
|
-
additionalPlugins?: MarkdownItPluginCb[];
|
|
14
12
|
};
|
|
15
13
|
};
|
|
16
14
|
export declare const contentTransformer: ({ content, options }: ContentTransformerProps) => {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
/* eslint-disable no-param-reassign */
|
|
2
|
+
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
1
3
|
import _ from 'lodash';
|
|
2
4
|
import { config } from './config';
|
|
3
5
|
import { filterContent } from './filter';
|
|
4
|
-
function transformBlocks(blocks, lang, customConfig = {}
|
|
6
|
+
function transformBlocks(blocks, lang, customConfig = {}) {
|
|
5
7
|
const fullConfig = Object.assign(Object.assign({}, config), customConfig);
|
|
6
8
|
const clonedBlocks = _.cloneDeep(blocks);
|
|
7
|
-
return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block
|
|
9
|
+
return clonedBlocks.map((block) => transformBlock(lang, fullConfig, block));
|
|
8
10
|
}
|
|
9
|
-
function transformBlock(lang, blocksConfig, block
|
|
11
|
+
function transformBlock(lang, blocksConfig, block) {
|
|
10
12
|
const blockConfig = blocksConfig[block.type];
|
|
11
13
|
if (block) {
|
|
12
14
|
if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
|
|
@@ -17,7 +19,7 @@ function transformBlock(lang, blocksConfig, block, additionalPlugins) {
|
|
|
17
19
|
const configs = Array.isArray(blockConfig) ? blockConfig : [blockConfig];
|
|
18
20
|
configs.forEach((transformConfig) => {
|
|
19
21
|
const { fields, transformer: transformerRaw, parser } = transformConfig;
|
|
20
|
-
const transformer =
|
|
22
|
+
const transformer = transformerRaw.bind(null, lang);
|
|
21
23
|
if (fields) {
|
|
22
24
|
fields.forEach((field) => {
|
|
23
25
|
if (block[field]) {
|
|
@@ -41,9 +43,9 @@ function transformBlock(lang, blocksConfig, block, additionalPlugins) {
|
|
|
41
43
|
return block;
|
|
42
44
|
}
|
|
43
45
|
export const contentTransformer = ({ content, options }) => {
|
|
44
|
-
const { lang, customConfig = {}, vars
|
|
46
|
+
const { lang, customConfig = {}, vars } = options;
|
|
45
47
|
const { blocks = [] } = (vars ? filterContent(content, vars) : content);
|
|
46
|
-
const transformedBlocks = transformBlocks(blocks, lang, customConfig
|
|
48
|
+
const transformedBlocks = transformBlocks(blocks, lang, customConfig);
|
|
47
49
|
return {
|
|
48
50
|
blocks: transformedBlocks,
|
|
49
51
|
};
|
package/package.json
CHANGED
|
@@ -287,7 +287,7 @@ export interface PriceDetailsListProps {
|
|
|
287
287
|
export interface PriceDetailsProps {
|
|
288
288
|
items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];
|
|
289
289
|
}
|
|
290
|
-
export interface PriceItemProps extends PriceDetailsProps, PriceDescriptionProps {
|
|
290
|
+
export interface PriceItemProps extends PriceDetailsProps, PriceDescriptionProps, AnalyticsEventsBase {
|
|
291
291
|
}
|
|
292
292
|
export interface PriceFoldableDetailsProps {
|
|
293
293
|
title: string;
|
|
@@ -71,13 +71,13 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
71
71
|
buttonText?: string;
|
|
72
72
|
theme?: TextTheme;
|
|
73
73
|
}
|
|
74
|
-
export interface BackgroundCardProps extends CardBaseProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
74
|
+
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
75
75
|
url?: string;
|
|
76
76
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
77
77
|
paddingBottom?: 's' | 'm' | 'l' | 'xl';
|
|
78
78
|
backgroundColor?: string;
|
|
79
79
|
}
|
|
80
|
-
export interface BasicCardProps extends CardBaseProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
80
|
+
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
81
81
|
url: string;
|
|
82
82
|
icon?: ImageProps;
|
|
83
83
|
target?: string;
|
|
@@ -92,9 +92,9 @@ export interface BannerCardProps {
|
|
|
92
92
|
theme?: TextTheme;
|
|
93
93
|
button: Pick<ButtonProps, 'text' | 'url' | 'target'>;
|
|
94
94
|
}
|
|
95
|
-
export interface MediaCardProps extends MediaProps, CardBaseProps {
|
|
95
|
+
export interface MediaCardProps extends MediaProps, AnalyticsEventsBase, CardBaseProps {
|
|
96
96
|
}
|
|
97
|
-
export interface LayoutItemProps extends ClassNameProps {
|
|
97
|
+
export interface LayoutItemProps extends ClassNameProps, AnalyticsEventsBase {
|
|
98
98
|
content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
|
|
99
99
|
media: MediaProps;
|
|
100
100
|
metaInfo?: string[];
|
|
@@ -6,7 +6,12 @@ export interface PageData {
|
|
|
6
6
|
export interface Menu {
|
|
7
7
|
title: string;
|
|
8
8
|
}
|
|
9
|
-
export type ConstructorBlock = ConstructorItem | CustomBlock
|
|
9
|
+
export type ConstructorBlock = (ConstructorItem | CustomBlock) & {
|
|
10
|
+
indent?: {
|
|
11
|
+
top?: string;
|
|
12
|
+
bottom?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
10
15
|
export interface PageContent extends Animatable {
|
|
11
16
|
blocks: ConstructorBlock[];
|
|
12
17
|
menu?: Menu;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
|
|
2
1
|
import { Lang } from '../utils/configure';
|
|
3
2
|
export type ComplexItem = {
|
|
4
3
|
[key: string]: string;
|
|
5
4
|
};
|
|
6
5
|
export type Item = string | null | ComplexItem;
|
|
7
6
|
export type Transformer = (text: string) => string;
|
|
8
|
-
export type TransformerRaw = (lang: Lang, content: string
|
|
7
|
+
export type TransformerRaw = (lang: Lang, content: string) => string;
|
|
9
8
|
export type Parser<T = any> = (transformer: Transformer, block: T) => T;
|
|
10
9
|
export declare const createItemsParser: (fields: string[]) => (transformer: Transformer, items: Item[]) => (string | {
|
|
11
10
|
[x: string]: string;
|
|
12
11
|
} | null)[];
|
|
13
|
-
export declare function yfmTransformer(lang: Lang, content: string
|
|
12
|
+
export declare function yfmTransformer(lang: Lang, content: string): string;
|
|
14
13
|
export declare function typografTransformer(lang: Lang, content: string): string;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.typografTransformer = exports.yfmTransformer = exports.createItemsParser = void 0;
|
|
7
|
-
const plugins_1 = __importDefault(require("@doc-tools/transform/lib/plugins"));
|
|
8
4
|
const utils_1 = require("./utils");
|
|
9
5
|
const createItemsParser = (fields) => (transformer, items) => items.map((item) => {
|
|
10
6
|
if (!item) {
|
|
@@ -24,11 +20,8 @@ const createItemsParser = (fields) => (transformer, items) => items.map((item) =
|
|
|
24
20
|
}
|
|
25
21
|
});
|
|
26
22
|
exports.createItemsParser = createItemsParser;
|
|
27
|
-
function yfmTransformer(lang, content
|
|
28
|
-
const { html } = (0, utils_1.fullTransform)(content, {
|
|
29
|
-
lang,
|
|
30
|
-
plugins: [...plugins_1.default, ...additionalPlugins],
|
|
31
|
-
});
|
|
23
|
+
function yfmTransformer(lang, content) {
|
|
24
|
+
const { html } = (0, utils_1.fullTransform)(content, { lang });
|
|
32
25
|
return html;
|
|
33
26
|
}
|
|
34
27
|
exports.yfmTransformer = yfmTransformer;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MarkdownItPluginCb } from '@doc-tools/transform/lib/plugins/typings';
|
|
2
1
|
import { ConstructorBlock } from '../models/constructor';
|
|
3
2
|
import { Lang } from '../utils/configure';
|
|
4
3
|
export type ContentVariables = Record<string, string>;
|
|
@@ -10,7 +9,6 @@ export type ContentTransformerProps = {
|
|
|
10
9
|
lang: Lang;
|
|
11
10
|
customConfig?: {};
|
|
12
11
|
vars?: ContentVariables;
|
|
13
|
-
additionalPlugins?: MarkdownItPluginCb[];
|
|
14
12
|
};
|
|
15
13
|
};
|
|
16
14
|
export declare const contentTransformer: ({ content, options }: ContentTransformerProps) => {
|