@gravity-ui/page-constructor 1.15.0-alpha.2 → 1.15.0-alpha.21
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/README.md +110 -5
- package/build/cjs/blocks/Banner/schema.d.ts +27 -0
- package/build/cjs/blocks/Banner/schema.js +3 -1
- package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
- package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/cjs/blocks/Header/schema.d.ts +159 -0
- package/build/cjs/blocks/Header/schema.js +4 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +81 -0
- package/build/cjs/blocks/Icons/schema.d.ts +6 -0
- package/build/cjs/blocks/Info/schema.d.ts +3 -0
- package/build/cjs/blocks/Info/schema.js +2 -0
- package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
- package/build/cjs/blocks/Media/schema.d.ts +9 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/cjs/blocks/Preview/schema.d.ts +3 -0
- package/build/cjs/blocks/Preview/schema.js +3 -1
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Questions/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/schema.d.ts +3 -0
- package/build/cjs/blocks/Security/schema.js +3 -1
- package/build/cjs/blocks/Share/Share.js +12 -1
- package/build/cjs/blocks/Simple/schema.d.ts +3 -0
- package/build/cjs/blocks/Slider/schema.d.ts +3 -0
- package/build/cjs/blocks/Table/schema.d.ts +3 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +3 -0
- package/build/cjs/components/BackLink/BackLink.d.ts +1 -0
- package/build/cjs/components/BackLink/BackLink.js +12 -2
- package/build/cjs/components/Button/Button.d.ts +1 -0
- package/build/cjs/components/Button/Button.js +15 -2
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.js +11 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -11
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.css +30 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.d.ts +12 -0
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.js +28 -0
- package/build/cjs/components/Link/Link.js +11 -2
- package/build/cjs/components/Media/Video/Video.js +1 -1
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +21 -25
- package/build/cjs/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/cjs/components/YandexForm/YandexForm.js +11 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +5 -4
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +4 -2
- package/build/cjs/context/analyticsContext/analyticsContext.d.ts +2 -1
- package/build/cjs/context/blockPositionContext/blockPositionContext.d.ts +3 -0
- package/build/cjs/context/blockPositionContext/blockPositionContext.js +6 -0
- package/build/cjs/context/blockPositionContext/index.d.ts +1 -0
- package/build/cjs/context/blockPositionContext/index.js +4 -0
- package/build/cjs/hooks/useAnalytics.d.ts +1 -1
- package/build/cjs/hooks/useAnalytics.js +13 -7
- package/build/cjs/models/common.d.ts +7 -4
- package/build/cjs/models/common.js +7 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +10 -0
- package/build/cjs/models/constructor-items/common.d.ts +9 -4
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/cjs/schema/validators/common.d.ts +15 -0
- package/build/cjs/schema/validators/common.js +2 -0
- package/build/cjs/schema/validators/event.d.ts +3 -0
- package/build/cjs/schema/validators/event.js +3 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/cjs/sub-blocks/HubspotForm/index.js +10 -2
- package/build/cjs/sub-blocks/Quote/Quote.js +12 -1
- package/build/cjs/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/Quote/schema.js +3 -1
- package/build/cjs/utils/blocks.d.ts +7 -0
- package/build/cjs/utils/blocks.js +5 -1
- package/build/esm/blocks/Banner/schema.d.ts +27 -0
- package/build/esm/blocks/Banner/schema.js +3 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
- package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +3 -0
- package/build/esm/blocks/Header/schema.d.ts +159 -0
- package/build/esm/blocks/Header/schema.js +4 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +81 -0
- package/build/esm/blocks/Icons/schema.d.ts +6 -0
- package/build/esm/blocks/Info/schema.d.ts +3 -0
- package/build/esm/blocks/Info/schema.js +2 -0
- package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
- package/build/esm/blocks/Media/schema.d.ts +9 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +2 -1
- package/build/esm/blocks/Preview/schema.d.ts +3 -0
- package/build/esm/blocks/Preview/schema.js +3 -1
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Questions/schema.d.ts +3 -0
- package/build/esm/blocks/Security/schema.d.ts +3 -0
- package/build/esm/blocks/Security/schema.js +3 -1
- package/build/esm/blocks/Share/Share.js +13 -2
- package/build/esm/blocks/Simple/schema.d.ts +3 -0
- package/build/esm/blocks/Slider/schema.d.ts +3 -0
- package/build/esm/blocks/Table/schema.d.ts +3 -0
- package/build/esm/blocks/Tabs/schema.d.ts +3 -0
- package/build/esm/components/BackLink/BackLink.d.ts +1 -0
- package/build/esm/components/BackLink/BackLink.js +12 -2
- package/build/esm/components/Button/Button.d.ts +1 -0
- package/build/esm/components/Button/Button.js +16 -3
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.js +12 -3
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.css +0 -30
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +3 -11
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.css +30 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.d.ts +13 -0
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbsItem.js +25 -0
- package/build/esm/components/Link/Link.js +12 -3
- package/build/esm/components/Media/Video/Video.js +1 -1
- package/build/esm/components/ReactPlayer/ReactPlayer.js +22 -26
- package/build/esm/components/YandexForm/YandexForm.d.ts +1 -0
- package/build/esm/components/YandexForm/YandexForm.js +12 -4
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +6 -5
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +4 -2
- package/build/esm/context/analyticsContext/analyticsContext.d.ts +2 -1
- package/build/esm/context/blockPositionContext/blockPositionContext.d.ts +3 -0
- package/build/esm/context/blockPositionContext/blockPositionContext.js +2 -0
- package/build/esm/context/blockPositionContext/index.d.ts +1 -0
- package/build/esm/context/blockPositionContext/index.js +1 -0
- package/build/esm/hooks/useAnalytics.d.ts +1 -1
- package/build/esm/hooks/useAnalytics.js +13 -7
- package/build/esm/models/common.d.ts +7 -4
- package/build/esm/models/common.js +6 -0
- package/build/esm/models/constructor-items/blocks.d.ts +10 -0
- package/build/esm/models/constructor-items/common.d.ts +9 -4
- package/build/esm/models/constructor-items/sub-blocks.d.ts +4 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +3 -2
- package/build/esm/schema/validators/common.d.ts +15 -0
- package/build/esm/schema/validators/common.js +2 -0
- package/build/esm/schema/validators/event.d.ts +3 -0
- package/build/esm/schema/validators/event.js +3 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +3 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -0
- package/build/esm/sub-blocks/HubspotForm/index.js +10 -2
- package/build/esm/sub-blocks/Quote/Quote.js +14 -3
- package/build/esm/sub-blocks/Quote/schema.d.ts +3 -0
- package/build/esm/sub-blocks/Quote/schema.js +3 -1
- package/build/esm/utils/blocks.d.ts +7 -0
- package/build/esm/utils/blocks.js +3 -0
- package/package.json +1 -1
- package/server/models/common.d.ts +7 -4
- package/server/models/common.js +7 -1
- package/server/models/constructor-items/blocks.d.ts +10 -0
- package/server/models/constructor-items/common.d.ts +9 -4
- package/server/models/constructor-items/sub-blocks.d.ts +4 -1
- package/server/utils/blocks.d.ts +7 -0
- package/server/utils/blocks.js +5 -1
|
@@ -274,6 +274,84 @@ export declare const HeaderProperties: {
|
|
|
274
274
|
type: string;
|
|
275
275
|
contentType: string;
|
|
276
276
|
};
|
|
277
|
+
analyticsEvents: {
|
|
278
|
+
anyOf: ({
|
|
279
|
+
type: string;
|
|
280
|
+
additionalProperties: {
|
|
281
|
+
type: string;
|
|
282
|
+
};
|
|
283
|
+
required: string[];
|
|
284
|
+
properties: {
|
|
285
|
+
name: {
|
|
286
|
+
type: string;
|
|
287
|
+
};
|
|
288
|
+
type: {
|
|
289
|
+
type: string;
|
|
290
|
+
};
|
|
291
|
+
counters: {
|
|
292
|
+
type: string;
|
|
293
|
+
additionalProperties: boolean;
|
|
294
|
+
required: never[];
|
|
295
|
+
properties: {
|
|
296
|
+
include: {
|
|
297
|
+
type: string;
|
|
298
|
+
items: {
|
|
299
|
+
type: string;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
exclude: {
|
|
303
|
+
type: string;
|
|
304
|
+
items: {
|
|
305
|
+
type: string;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
context: {
|
|
311
|
+
type: string;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
} | {
|
|
315
|
+
type: string;
|
|
316
|
+
items: {
|
|
317
|
+
type: string;
|
|
318
|
+
additionalProperties: {
|
|
319
|
+
type: string;
|
|
320
|
+
};
|
|
321
|
+
required: string[];
|
|
322
|
+
properties: {
|
|
323
|
+
name: {
|
|
324
|
+
type: string;
|
|
325
|
+
};
|
|
326
|
+
type: {
|
|
327
|
+
type: string;
|
|
328
|
+
};
|
|
329
|
+
counters: {
|
|
330
|
+
type: string;
|
|
331
|
+
additionalProperties: boolean;
|
|
332
|
+
required: never[];
|
|
333
|
+
properties: {
|
|
334
|
+
include: {
|
|
335
|
+
type: string;
|
|
336
|
+
items: {
|
|
337
|
+
type: string;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
exclude: {
|
|
341
|
+
type: string;
|
|
342
|
+
items: {
|
|
343
|
+
type: string;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
context: {
|
|
349
|
+
type: string;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
})[];
|
|
354
|
+
};
|
|
277
355
|
};
|
|
278
356
|
};
|
|
279
357
|
imageSize: {
|
|
@@ -607,6 +685,84 @@ export declare const HeaderBlock: {
|
|
|
607
685
|
type: string;
|
|
608
686
|
contentType: string;
|
|
609
687
|
};
|
|
688
|
+
analyticsEvents: {
|
|
689
|
+
anyOf: ({
|
|
690
|
+
type: string;
|
|
691
|
+
additionalProperties: {
|
|
692
|
+
type: string;
|
|
693
|
+
};
|
|
694
|
+
required: string[];
|
|
695
|
+
properties: {
|
|
696
|
+
name: {
|
|
697
|
+
type: string;
|
|
698
|
+
};
|
|
699
|
+
type: {
|
|
700
|
+
type: string;
|
|
701
|
+
};
|
|
702
|
+
counters: {
|
|
703
|
+
type: string;
|
|
704
|
+
additionalProperties: boolean;
|
|
705
|
+
required: never[];
|
|
706
|
+
properties: {
|
|
707
|
+
include: {
|
|
708
|
+
type: string;
|
|
709
|
+
items: {
|
|
710
|
+
type: string;
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
exclude: {
|
|
714
|
+
type: string;
|
|
715
|
+
items: {
|
|
716
|
+
type: string;
|
|
717
|
+
};
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
};
|
|
721
|
+
context: {
|
|
722
|
+
type: string;
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
} | {
|
|
726
|
+
type: string;
|
|
727
|
+
items: {
|
|
728
|
+
type: string;
|
|
729
|
+
additionalProperties: {
|
|
730
|
+
type: string;
|
|
731
|
+
};
|
|
732
|
+
required: string[];
|
|
733
|
+
properties: {
|
|
734
|
+
name: {
|
|
735
|
+
type: string;
|
|
736
|
+
};
|
|
737
|
+
type: {
|
|
738
|
+
type: string;
|
|
739
|
+
};
|
|
740
|
+
counters: {
|
|
741
|
+
type: string;
|
|
742
|
+
additionalProperties: boolean;
|
|
743
|
+
required: never[];
|
|
744
|
+
properties: {
|
|
745
|
+
include: {
|
|
746
|
+
type: string;
|
|
747
|
+
items: {
|
|
748
|
+
type: string;
|
|
749
|
+
};
|
|
750
|
+
};
|
|
751
|
+
exclude: {
|
|
752
|
+
type: string;
|
|
753
|
+
items: {
|
|
754
|
+
type: string;
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
};
|
|
759
|
+
context: {
|
|
760
|
+
type: string;
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
})[];
|
|
765
|
+
};
|
|
610
766
|
};
|
|
611
767
|
};
|
|
612
768
|
imageSize: {
|
|
@@ -821,6 +977,9 @@ export declare const HeaderBlock: {
|
|
|
821
977
|
resetPaddings: {
|
|
822
978
|
type: string;
|
|
823
979
|
};
|
|
980
|
+
context: {
|
|
981
|
+
type: string;
|
|
982
|
+
};
|
|
824
983
|
type: {};
|
|
825
984
|
when: {};
|
|
826
985
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VideoProps, withTheme, BlockBaseProps, ButtonBlock, MediaProps, } from '../../schema/validators/common';
|
|
2
2
|
import { filteredArray } from '../../schema/validators/utils';
|
|
3
3
|
import { ImageProps } from '../../components/Image/schema';
|
|
4
|
+
import { AnalyticsEventSchema } from '../../schema/validators/event';
|
|
4
5
|
export const HeaderBackgroundProps = {
|
|
5
6
|
type: 'object',
|
|
6
7
|
additionalProperties: false,
|
|
@@ -42,6 +43,9 @@ export const HeaderProperties = {
|
|
|
42
43
|
type: 'string',
|
|
43
44
|
contentType: 'text',
|
|
44
45
|
},
|
|
46
|
+
analyticsEvents: {
|
|
47
|
+
anyOf: [AnalyticsEventSchema, { type: 'array', items: AnalyticsEventSchema }],
|
|
48
|
+
},
|
|
45
49
|
},
|
|
46
50
|
},
|
|
47
51
|
imageSize: {
|
|
@@ -144,6 +144,84 @@ export declare const HeaderSliderBlock: {
|
|
|
144
144
|
type: string;
|
|
145
145
|
contentType: string;
|
|
146
146
|
};
|
|
147
|
+
analyticsEvents: {
|
|
148
|
+
anyOf: ({
|
|
149
|
+
type: string;
|
|
150
|
+
additionalProperties: {
|
|
151
|
+
type: string;
|
|
152
|
+
};
|
|
153
|
+
required: string[];
|
|
154
|
+
properties: {
|
|
155
|
+
name: {
|
|
156
|
+
type: string;
|
|
157
|
+
};
|
|
158
|
+
type: {
|
|
159
|
+
type: string;
|
|
160
|
+
};
|
|
161
|
+
counters: {
|
|
162
|
+
type: string;
|
|
163
|
+
additionalProperties: boolean;
|
|
164
|
+
required: never[];
|
|
165
|
+
properties: {
|
|
166
|
+
include: {
|
|
167
|
+
type: string;
|
|
168
|
+
items: {
|
|
169
|
+
type: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
exclude: {
|
|
173
|
+
type: string;
|
|
174
|
+
items: {
|
|
175
|
+
type: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
context: {
|
|
181
|
+
type: string;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
} | {
|
|
185
|
+
type: string;
|
|
186
|
+
items: {
|
|
187
|
+
type: string;
|
|
188
|
+
additionalProperties: {
|
|
189
|
+
type: string;
|
|
190
|
+
};
|
|
191
|
+
required: string[];
|
|
192
|
+
properties: {
|
|
193
|
+
name: {
|
|
194
|
+
type: string;
|
|
195
|
+
};
|
|
196
|
+
type: {
|
|
197
|
+
type: string;
|
|
198
|
+
};
|
|
199
|
+
counters: {
|
|
200
|
+
type: string;
|
|
201
|
+
additionalProperties: boolean;
|
|
202
|
+
required: never[];
|
|
203
|
+
properties: {
|
|
204
|
+
include: {
|
|
205
|
+
type: string;
|
|
206
|
+
items: {
|
|
207
|
+
type: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
exclude: {
|
|
211
|
+
type: string;
|
|
212
|
+
items: {
|
|
213
|
+
type: string;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
context: {
|
|
219
|
+
type: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
})[];
|
|
224
|
+
};
|
|
147
225
|
};
|
|
148
226
|
};
|
|
149
227
|
imageSize: {
|
|
@@ -433,6 +511,9 @@ export declare const HeaderSliderBlock: {
|
|
|
433
511
|
resetPaddings: {
|
|
434
512
|
type: string;
|
|
435
513
|
};
|
|
514
|
+
context: {
|
|
515
|
+
type: string;
|
|
516
|
+
};
|
|
436
517
|
type: {};
|
|
437
518
|
when: {};
|
|
438
519
|
};
|
|
@@ -54,6 +54,9 @@ export declare const IconsProps: {
|
|
|
54
54
|
resetPaddings: {
|
|
55
55
|
type: string;
|
|
56
56
|
};
|
|
57
|
+
context: {
|
|
58
|
+
type: string;
|
|
59
|
+
};
|
|
57
60
|
type: {};
|
|
58
61
|
when: {};
|
|
59
62
|
};
|
|
@@ -115,6 +118,9 @@ export declare const IconsBlock: {
|
|
|
115
118
|
resetPaddings: {
|
|
116
119
|
type: string;
|
|
117
120
|
};
|
|
121
|
+
context: {
|
|
122
|
+
type: string;
|
|
123
|
+
};
|
|
118
124
|
type: {};
|
|
119
125
|
when: {};
|
|
120
126
|
};
|
|
@@ -18,6 +18,8 @@ export const InfoBlock = {
|
|
|
18
18
|
}), sectionsTitle: {
|
|
19
19
|
type: 'string',
|
|
20
20
|
contentType: 'text',
|
|
21
|
+
}, context: {
|
|
22
|
+
type: 'string',
|
|
21
23
|
}, buttons: filteredArray(ButtonBlock), theme: ThemeProps, links: filteredArray(LinkProps), leftContent: ContentProps, rightContent: ContentProps }),
|
|
22
24
|
},
|
|
23
25
|
};
|
|
@@ -459,6 +459,9 @@ export declare const MediaBlock: {
|
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
461
|
};
|
|
462
|
+
context: {
|
|
463
|
+
type: string;
|
|
464
|
+
};
|
|
462
465
|
};
|
|
463
466
|
} | {
|
|
464
467
|
type: string;
|
|
@@ -494,6 +497,9 @@ export declare const MediaBlock: {
|
|
|
494
497
|
};
|
|
495
498
|
};
|
|
496
499
|
};
|
|
500
|
+
context: {
|
|
501
|
+
type: string;
|
|
502
|
+
};
|
|
497
503
|
};
|
|
498
504
|
};
|
|
499
505
|
})[];
|
|
@@ -597,6 +603,9 @@ export declare const MediaBlock: {
|
|
|
597
603
|
resetPaddings: {
|
|
598
604
|
type: string;
|
|
599
605
|
};
|
|
606
|
+
context: {
|
|
607
|
+
type: string;
|
|
608
|
+
};
|
|
600
609
|
type: {};
|
|
601
610
|
when: {};
|
|
602
611
|
};
|
|
@@ -9,6 +9,7 @@ interface MediaContentProps extends Refable<HTMLDivElement> {
|
|
|
9
9
|
switching: boolean;
|
|
10
10
|
isActiveBlock: (id: number, isMediaBlock?: boolean) => boolean;
|
|
11
11
|
showMediaContent: (id: number) => void;
|
|
12
|
+
context?: string;
|
|
12
13
|
}
|
|
13
|
-
declare const MediaContent: React.ForwardRefExoticComponent<Pick<MediaContentProps, "title" | "items" | "description" | "ratioMediaContent" | "switching" | "isActiveBlock" | "showMediaContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const MediaContent: React.ForwardRefExoticComponent<Pick<MediaContentProps, "title" | "context" | "items" | "description" | "ratioMediaContent" | "switching" | "isActiveBlock" | "showMediaContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
15
|
export default MediaContent;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
1
|
+
import React, { useContext, useCallback, useMemo } from 'react';
|
|
2
2
|
import { Icon, Button } from '@gravity-ui/uikit';
|
|
3
3
|
import { block, getAbsolutePath, getShareLink } from '../../utils';
|
|
4
|
+
import { PredefinedEventTypes } from '../../models';
|
|
4
5
|
import { LocationContext } from '../../context/locationContext';
|
|
6
|
+
import { BlockPositionContext } from '../../context/blockPositionContext';
|
|
5
7
|
import i18n from './i18n';
|
|
8
|
+
import { useAnalytics } from '../../hooks';
|
|
6
9
|
import { Facebook } from '../../icons/Facebook';
|
|
7
10
|
import { Twitter } from '../../icons/Twitter';
|
|
8
11
|
import { Linkedin } from '../../icons/Linkedin';
|
|
@@ -19,13 +22,21 @@ const icons = {
|
|
|
19
22
|
const b = block('share-block');
|
|
20
23
|
const Share = ({ items, title }) => {
|
|
21
24
|
const { pathname, hostname } = useContext(LocationContext);
|
|
25
|
+
const context = useContext(BlockPositionContext);
|
|
26
|
+
const defaultEvent = useMemo(() => ({
|
|
27
|
+
name: 'share-button-click',
|
|
28
|
+
type: PredefinedEventTypes.Default,
|
|
29
|
+
context,
|
|
30
|
+
}), [context]);
|
|
31
|
+
const handleAnalytics = useAnalytics(defaultEvent);
|
|
32
|
+
const handleButtonClick = useCallback(() => handleAnalytics(), [handleAnalytics]);
|
|
22
33
|
return (React.createElement("div", { className: b() },
|
|
23
34
|
React.createElement("h5", { className: b('title') }, title || i18n('constructor-share')),
|
|
24
35
|
React.createElement("div", { className: b('items') }, items.map((type) => {
|
|
25
36
|
const url = getAbsolutePath(hostname, pathname);
|
|
26
37
|
const socialUrl = getShareLink(url, type);
|
|
27
38
|
const icon = icons[type];
|
|
28
|
-
return (React.createElement(Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }) }, icon && React.createElement(Icon, { data: icon, size: 24, className: b('icon', { type }) })));
|
|
39
|
+
return (React.createElement(Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }), onClick: handleButtonClick }, icon && React.createElement(Icon, { data: icon, size: 24, className: b('icon', { type }) })));
|
|
29
40
|
}))));
|
|
30
41
|
};
|
|
31
42
|
export default Share;
|
|
@@ -2,10 +2,20 @@ import React, { useCallback, useContext } from 'react';
|
|
|
2
2
|
import { Button, Icon } from '@gravity-ui/uikit';
|
|
3
3
|
import { ArrowSidebar } from '../../icons';
|
|
4
4
|
import { LocationContext } from '../../context/locationContext';
|
|
5
|
+
import { useAnalytics } from '../../hooks';
|
|
6
|
+
import { PredefinedEventTypes } from '../../models';
|
|
7
|
+
const COMPONENT_NAME = 'backlink';
|
|
5
8
|
export default function BackLink(props) {
|
|
6
9
|
const { history } = useContext(LocationContext);
|
|
7
|
-
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, } = props;
|
|
10
|
+
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, context = COMPONENT_NAME, } = props;
|
|
11
|
+
const handleAnalytics = useAnalytics({
|
|
12
|
+
name: 'back-link-click',
|
|
13
|
+
type: PredefinedEventTypes.Default,
|
|
14
|
+
context: context,
|
|
15
|
+
target: url,
|
|
16
|
+
});
|
|
8
17
|
const backActionHandler = useCallback(async () => {
|
|
18
|
+
handleAnalytics();
|
|
9
19
|
if (!history) {
|
|
10
20
|
return;
|
|
11
21
|
}
|
|
@@ -18,7 +28,7 @@ export default function BackLink(props) {
|
|
|
18
28
|
else {
|
|
19
29
|
history.push({ pathname: url });
|
|
20
30
|
}
|
|
21
|
-
}, [history, onClick, url]);
|
|
31
|
+
}, [handleAnalytics, history, onClick, url]);
|
|
22
32
|
return (React.createElement(Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined },
|
|
23
33
|
React.createElement(Icon, { data: ArrowSidebar, size: 24 }),
|
|
24
34
|
React.createElement("span", null, title)));
|
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import React, { useCallback, useContext } from 'react';
|
|
2
|
+
import React, { useCallback, useContext, useMemo } from 'react';
|
|
3
3
|
import { Platform, Button as CommonButton, Icon, StoreBadge } from '@gravity-ui/uikit';
|
|
4
4
|
import { block, setUrlTld } from '../../utils';
|
|
5
|
+
import { PredefinedEventTypes } from '../../models';
|
|
5
6
|
import { toCommonSize, toCommonView } from './utils';
|
|
6
7
|
import { LocaleContext } from '../../context/localeContext/localeContext';
|
|
7
8
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
8
9
|
import { useAnalytics } from '../../hooks';
|
|
9
10
|
import { Github } from '../../icons';
|
|
11
|
+
import { BlockPositionContext } from '../../context/blockPositionContext';
|
|
10
12
|
import './Button.css';
|
|
13
|
+
const COMPONENT_NAME = 'button';
|
|
11
14
|
const b = block('button-block');
|
|
12
15
|
const Button = (props) => {
|
|
13
16
|
const handleMetrika = useMetrika();
|
|
14
|
-
const handleAnalytics = useAnalytics();
|
|
15
17
|
const { lang, tld } = useContext(LocaleContext);
|
|
16
18
|
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
19
|
+
const context = useContext(BlockPositionContext);
|
|
17
20
|
const defaultImgPosition = 'left';
|
|
21
|
+
const defaultEvent = useMemo(() => ({
|
|
22
|
+
name: 'button-click',
|
|
23
|
+
type: PredefinedEventTypes.Default,
|
|
24
|
+
context: context || COMPONENT_NAME,
|
|
25
|
+
target: url,
|
|
26
|
+
}), [context, url]);
|
|
27
|
+
const handleAnalytics = useAnalytics(defaultEvent);
|
|
28
|
+
const blockPosition = useContext(BlockPositionContext);
|
|
29
|
+
// eslint-disable-next-line no-console
|
|
30
|
+
console.log({ blockPosition }, props);
|
|
18
31
|
const onClick = useCallback(() => {
|
|
19
32
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
20
|
-
handleAnalytics
|
|
33
|
+
handleAnalytics(analyticsEvents);
|
|
21
34
|
if (onClickOrigin) {
|
|
22
35
|
onClickOrigin();
|
|
23
36
|
}
|
|
@@ -12,6 +12,7 @@ export interface CardBaseProps extends CardBaseParams {
|
|
|
12
12
|
metrikaGoals?: MetrikaGoal;
|
|
13
13
|
pixelEvents?: ButtonPixel;
|
|
14
14
|
analyticsEvents?: AnalyticsEvent | AnalyticsEvent[];
|
|
15
|
+
context?: string;
|
|
15
16
|
}
|
|
16
17
|
export interface CardHeaderBaseProps {
|
|
17
18
|
className?: string;
|