@gravity-ui/page-constructor 1.19.0 → 1.20.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +79 -6
  3. package/build/cjs/blocks/Banner/schema.d.ts +234 -0
  4. package/build/cjs/blocks/CardLayout/schema.d.ts +6 -0
  5. package/build/cjs/blocks/ContentLayout/schema.d.ts +3 -0
  6. package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +81 -0
  7. package/build/cjs/blocks/Header/schema.d.ts +3 -0
  8. package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
  9. package/build/cjs/blocks/Icons/schema.d.ts +6 -0
  10. package/build/cjs/blocks/LinkTable/schema.d.ts +3 -0
  11. package/build/cjs/blocks/Map/schema.d.ts +129 -34
  12. package/build/cjs/blocks/Media/schema.d.ts +162 -0
  13. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
  14. package/build/cjs/blocks/Questions/schema.d.ts +3 -0
  15. package/build/cjs/blocks/Share/Share.js +5 -1
  16. package/build/cjs/blocks/Simple/schema.d.ts +3 -0
  17. package/build/cjs/blocks/Slider/schema.d.ts +3 -0
  18. package/build/cjs/blocks/Table/schema.d.ts +3 -0
  19. package/build/cjs/blocks/Tabs/schema.d.ts +81 -0
  20. package/build/cjs/components/BackLink/BackLink.js +5 -1
  21. package/build/cjs/components/Button/Button.js +6 -2
  22. package/build/cjs/components/CardBase/CardBase.d.ts +2 -1
  23. package/build/cjs/components/CardBase/CardBase.js +5 -1
  24. package/build/cjs/components/Link/Link.js +5 -1
  25. package/build/cjs/components/Media/Media.js +3 -2
  26. package/build/cjs/components/Media/Video/Video.js +3 -2
  27. package/build/cjs/components/ReactPlayer/ReactPlayer.js +16 -3
  28. package/build/cjs/components/YandexForm/YandexForm.d.ts +2 -1
  29. package/build/cjs/components/YandexForm/YandexForm.js +14 -2
  30. package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
  31. package/build/cjs/containers/PageConstructor/Provider.js +3 -1
  32. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -4
  33. package/build/cjs/context/analyticsContext/analyticsContext.d.ts +7 -0
  34. package/build/cjs/context/analyticsContext/analyticsContext.js +6 -0
  35. package/build/cjs/context/analyticsContext/index.d.ts +1 -0
  36. package/build/cjs/context/analyticsContext/index.js +4 -0
  37. package/build/cjs/context/blockIdContext/blockIdContext.d.ts +3 -0
  38. package/build/cjs/context/blockIdContext/blockIdContext.js +6 -0
  39. package/build/cjs/context/blockIdContext/index.d.ts +1 -0
  40. package/build/cjs/context/blockIdContext/index.js +4 -0
  41. package/build/cjs/context/metrikaContext/metrikaContext.d.ts +6 -0
  42. package/build/cjs/hooks/index.d.ts +1 -0
  43. package/build/cjs/hooks/index.js +1 -0
  44. package/build/cjs/hooks/useAnalytics.d.ts +2 -0
  45. package/build/cjs/hooks/useAnalytics.js +35 -0
  46. package/build/cjs/hooks/useMetrika.d.ts +6 -0
  47. package/build/cjs/hooks/useMetrika.js +8 -0
  48. package/build/cjs/models/common.d.ts +45 -0
  49. package/build/cjs/models/common.js +22 -1
  50. package/build/cjs/models/constructor-items/common.d.ts +5 -5
  51. package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -2
  52. package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +5 -1
  53. package/build/cjs/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -2
  54. package/build/cjs/schema/validators/common.d.ts +309 -43
  55. package/build/cjs/schema/validators/common.js +39 -18
  56. package/build/cjs/schema/validators/event.d.ts +37 -0
  57. package/build/cjs/schema/validators/event.js +38 -0
  58. package/build/cjs/sub-blocks/HubspotForm/index.js +15 -2
  59. package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +13 -0
  60. package/build/cjs/sub-blocks/Quote/Quote.js +4 -1
  61. package/build/cjs/utils/analytics.d.ts +2 -0
  62. package/build/cjs/utils/analytics.js +17 -0
  63. package/build/cjs/utils/index.d.ts +1 -0
  64. package/build/cjs/utils/index.js +1 -0
  65. package/build/esm/blocks/Banner/schema.d.ts +234 -0
  66. package/build/esm/blocks/CardLayout/schema.d.ts +6 -0
  67. package/build/esm/blocks/ContentLayout/schema.d.ts +3 -0
  68. package/build/esm/blocks/ExtendedFeatures/schema.d.ts +81 -0
  69. package/build/esm/blocks/Header/schema.d.ts +3 -0
  70. package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
  71. package/build/esm/blocks/Icons/schema.d.ts +6 -0
  72. package/build/esm/blocks/LinkTable/schema.d.ts +3 -0
  73. package/build/esm/blocks/Map/schema.d.ts +129 -34
  74. package/build/esm/blocks/Media/schema.d.ts +162 -0
  75. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
  76. package/build/esm/blocks/Questions/schema.d.ts +3 -0
  77. package/build/esm/blocks/Share/Share.js +6 -2
  78. package/build/esm/blocks/Simple/schema.d.ts +3 -0
  79. package/build/esm/blocks/Slider/schema.d.ts +3 -0
  80. package/build/esm/blocks/Table/schema.d.ts +3 -0
  81. package/build/esm/blocks/Tabs/schema.d.ts +81 -0
  82. package/build/esm/components/BackLink/BackLink.js +5 -1
  83. package/build/esm/components/Button/Button.js +6 -2
  84. package/build/esm/components/CardBase/CardBase.d.ts +2 -1
  85. package/build/esm/components/CardBase/CardBase.js +5 -1
  86. package/build/esm/components/Link/Link.js +5 -1
  87. package/build/esm/components/Media/Media.js +3 -2
  88. package/build/esm/components/Media/Video/Video.js +3 -2
  89. package/build/esm/components/ReactPlayer/ReactPlayer.js +17 -4
  90. package/build/esm/components/YandexForm/YandexForm.d.ts +2 -1
  91. package/build/esm/components/YandexForm/YandexForm.js +14 -2
  92. package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
  93. package/build/esm/containers/PageConstructor/Provider.js +3 -1
  94. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +7 -4
  95. package/build/esm/context/analyticsContext/analyticsContext.d.ts +7 -0
  96. package/build/esm/context/analyticsContext/analyticsContext.js +2 -0
  97. package/build/esm/context/analyticsContext/index.d.ts +1 -0
  98. package/build/esm/context/analyticsContext/index.js +1 -0
  99. package/build/esm/context/blockIdContext/blockIdContext.d.ts +3 -0
  100. package/build/esm/context/blockIdContext/blockIdContext.js +2 -0
  101. package/build/esm/context/blockIdContext/index.d.ts +1 -0
  102. package/build/esm/context/blockIdContext/index.js +1 -0
  103. package/build/esm/context/metrikaContext/metrikaContext.d.ts +6 -0
  104. package/build/esm/hooks/index.d.ts +1 -0
  105. package/build/esm/hooks/index.js +1 -0
  106. package/build/esm/hooks/useAnalytics.d.ts +2 -0
  107. package/build/esm/hooks/useAnalytics.js +31 -0
  108. package/build/esm/hooks/useMetrika.d.ts +6 -0
  109. package/build/esm/hooks/useMetrika.js +8 -0
  110. package/build/esm/models/common.d.ts +45 -0
  111. package/build/esm/models/common.js +21 -0
  112. package/build/esm/models/constructor-items/common.d.ts +5 -5
  113. package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -2
  114. package/build/esm/navigation/components/NavigationItem/NavigationItem.js +5 -1
  115. package/build/esm/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.js +4 -2
  116. package/build/esm/schema/validators/common.d.ts +309 -43
  117. package/build/esm/schema/validators/common.js +39 -18
  118. package/build/esm/schema/validators/event.d.ts +37 -0
  119. package/build/esm/schema/validators/event.js +35 -0
  120. package/build/esm/sub-blocks/HubspotForm/index.js +16 -3
  121. package/build/esm/sub-blocks/LayoutItem/utils.d.ts +13 -0
  122. package/build/esm/sub-blocks/Quote/Quote.js +6 -3
  123. package/build/esm/utils/analytics.d.ts +2 -0
  124. package/build/esm/utils/analytics.js +13 -0
  125. package/build/esm/utils/index.d.ts +1 -0
  126. package/build/esm/utils/index.js +1 -0
  127. package/package.json +1 -1
  128. package/server/models/common.d.ts +45 -0
  129. package/server/models/common.js +22 -1
  130. package/server/models/constructor-items/common.d.ts +5 -5
  131. package/server/models/constructor-items/sub-blocks.d.ts +2 -2
  132. package/server/utils/analytics.d.ts +2 -0
  133. package/server/utils/analytics.js +17 -0
  134. package/server/utils/index.d.ts +1 -0
  135. package/server/utils/index.js +1 -0
@@ -22,29 +22,36 @@ export declare const Map: {
22
22
  type: string;
23
23
  items: {
24
24
  type: {
25
+ type: string;
26
+ additionalProperties: boolean;
25
27
  required: never[];
26
- coordinate: {
27
- type: string;
28
- items: {
29
- type: string;
30
- };
31
- };
32
- address: {
33
- type: string;
34
- };
35
- label: {
36
- required: never[];
37
- iconCaption: {
38
- type: string;
39
- };
40
- iconContent: {
28
+ properties: {
29
+ coordinate: {
41
30
  type: string;
31
+ items: {
32
+ type: string;
33
+ };
42
34
  };
43
- iconColor: {
35
+ address: {
44
36
  type: string;
45
37
  };
46
- preset: {
38
+ label: {
47
39
  type: string;
40
+ required: never[];
41
+ properties: {
42
+ iconCaption: {
43
+ type: string;
44
+ };
45
+ iconContent: {
46
+ type: string;
47
+ };
48
+ iconColor: {
49
+ type: string;
50
+ };
51
+ preset: {
52
+ type: string;
53
+ };
54
+ };
48
55
  };
49
56
  };
50
57
  };
@@ -81,29 +88,36 @@ export declare const MapBlock: {
81
88
  type: string;
82
89
  items: {
83
90
  type: {
91
+ type: string;
92
+ additionalProperties: boolean;
84
93
  required: never[];
85
- coordinate: {
86
- type: string;
87
- items: {
88
- type: string;
89
- };
90
- };
91
- address: {
92
- type: string;
93
- };
94
- label: {
95
- required: never[];
96
- iconCaption: {
97
- type: string;
98
- };
99
- iconContent: {
94
+ properties: {
95
+ coordinate: {
100
96
  type: string;
97
+ items: {
98
+ type: string;
99
+ };
101
100
  };
102
- iconColor: {
101
+ address: {
103
102
  type: string;
104
103
  };
105
- preset: {
104
+ label: {
106
105
  type: string;
106
+ required: never[];
107
+ properties: {
108
+ iconCaption: {
109
+ type: string;
110
+ };
111
+ iconContent: {
112
+ type: string;
113
+ };
114
+ iconColor: {
115
+ type: string;
116
+ };
117
+ preset: {
118
+ type: string;
119
+ };
120
+ };
107
121
  };
108
122
  };
109
123
  };
@@ -264,6 +278,84 @@ export declare const MapBlock: {
264
278
  };
265
279
  };
266
280
  };
281
+ analyticsEvents: {
282
+ anyOf: ({
283
+ type: string;
284
+ additionalProperties: {
285
+ type: string;
286
+ };
287
+ required: string[];
288
+ properties: {
289
+ name: {
290
+ type: string;
291
+ };
292
+ type: {
293
+ type: string;
294
+ };
295
+ counters: {
296
+ type: string;
297
+ additionalProperties: boolean;
298
+ required: never[];
299
+ properties: {
300
+ include: {
301
+ type: string;
302
+ items: {
303
+ type: string;
304
+ };
305
+ };
306
+ exclude: {
307
+ type: string;
308
+ items: {
309
+ type: string;
310
+ };
311
+ };
312
+ };
313
+ };
314
+ context: {
315
+ type: string;
316
+ };
317
+ };
318
+ } | {
319
+ type: string;
320
+ items: {
321
+ type: string;
322
+ additionalProperties: {
323
+ type: string;
324
+ };
325
+ required: string[];
326
+ properties: {
327
+ name: {
328
+ type: string;
329
+ };
330
+ type: {
331
+ type: string;
332
+ };
333
+ counters: {
334
+ type: string;
335
+ additionalProperties: boolean;
336
+ required: never[];
337
+ properties: {
338
+ include: {
339
+ type: string;
340
+ items: {
341
+ type: string;
342
+ };
343
+ };
344
+ exclude: {
345
+ type: string;
346
+ items: {
347
+ type: string;
348
+ };
349
+ };
350
+ };
351
+ };
352
+ context: {
353
+ type: string;
354
+ };
355
+ };
356
+ };
357
+ })[];
358
+ };
267
359
  target: {
268
360
  type: string;
269
361
  enum: string[];
@@ -363,6 +455,9 @@ export declare const MapBlock: {
363
455
  resetPaddings: {
364
456
  type: string;
365
457
  };
458
+ context: {
459
+ type: string;
460
+ };
366
461
  type: {};
367
462
  when: {};
368
463
  };
@@ -287,6 +287,84 @@ export declare const MediaBlockBaseProps: {
287
287
  };
288
288
  };
289
289
  };
290
+ analyticsEvents: {
291
+ anyOf: ({
292
+ type: string;
293
+ additionalProperties: {
294
+ type: string;
295
+ };
296
+ required: string[];
297
+ properties: {
298
+ name: {
299
+ type: string;
300
+ };
301
+ type: {
302
+ type: string;
303
+ };
304
+ counters: {
305
+ type: string;
306
+ additionalProperties: boolean;
307
+ required: never[];
308
+ properties: {
309
+ include: {
310
+ type: string;
311
+ items: {
312
+ type: string;
313
+ };
314
+ };
315
+ exclude: {
316
+ type: string;
317
+ items: {
318
+ type: string;
319
+ };
320
+ };
321
+ };
322
+ };
323
+ context: {
324
+ type: string;
325
+ };
326
+ };
327
+ } | {
328
+ type: string;
329
+ items: {
330
+ type: string;
331
+ additionalProperties: {
332
+ type: string;
333
+ };
334
+ required: string[];
335
+ properties: {
336
+ name: {
337
+ type: string;
338
+ };
339
+ type: {
340
+ type: string;
341
+ };
342
+ counters: {
343
+ type: string;
344
+ additionalProperties: boolean;
345
+ required: never[];
346
+ properties: {
347
+ include: {
348
+ type: string;
349
+ items: {
350
+ type: string;
351
+ };
352
+ };
353
+ exclude: {
354
+ type: string;
355
+ items: {
356
+ type: string;
357
+ };
358
+ };
359
+ };
360
+ };
361
+ context: {
362
+ type: string;
363
+ };
364
+ };
365
+ };
366
+ })[];
367
+ };
290
368
  target: {
291
369
  type: string;
292
370
  enum: string[];
@@ -386,6 +464,9 @@ export declare const MediaBlockBaseProps: {
386
464
  resetPaddings: {
387
465
  type: string;
388
466
  };
467
+ context: {
468
+ type: string;
469
+ };
389
470
  type: {};
390
471
  when: {};
391
472
  };
@@ -682,6 +763,84 @@ export declare const MediaBlock: {
682
763
  };
683
764
  };
684
765
  };
766
+ analyticsEvents: {
767
+ anyOf: ({
768
+ type: string;
769
+ additionalProperties: {
770
+ type: string;
771
+ };
772
+ required: string[];
773
+ properties: {
774
+ name: {
775
+ type: string;
776
+ };
777
+ type: {
778
+ type: string;
779
+ };
780
+ counters: {
781
+ type: string;
782
+ additionalProperties: boolean;
783
+ required: never[];
784
+ properties: {
785
+ include: {
786
+ type: string;
787
+ items: {
788
+ type: string;
789
+ };
790
+ };
791
+ exclude: {
792
+ type: string;
793
+ items: {
794
+ type: string;
795
+ };
796
+ };
797
+ };
798
+ };
799
+ context: {
800
+ type: string;
801
+ };
802
+ };
803
+ } | {
804
+ type: string;
805
+ items: {
806
+ type: string;
807
+ additionalProperties: {
808
+ type: string;
809
+ };
810
+ required: string[];
811
+ properties: {
812
+ name: {
813
+ type: string;
814
+ };
815
+ type: {
816
+ type: string;
817
+ };
818
+ counters: {
819
+ type: string;
820
+ additionalProperties: boolean;
821
+ required: never[];
822
+ properties: {
823
+ include: {
824
+ type: string;
825
+ items: {
826
+ type: string;
827
+ };
828
+ };
829
+ exclude: {
830
+ type: string;
831
+ items: {
832
+ type: string;
833
+ };
834
+ };
835
+ };
836
+ };
837
+ context: {
838
+ type: string;
839
+ };
840
+ };
841
+ };
842
+ })[];
843
+ };
685
844
  target: {
686
845
  type: string;
687
846
  enum: string[];
@@ -781,6 +940,9 @@ export declare const MediaBlock: {
781
940
  resetPaddings: {
782
941
  type: string;
783
942
  };
943
+ context: {
944
+ type: string;
945
+ };
784
946
  type: {};
785
947
  when: {};
786
948
  };
@@ -222,6 +222,9 @@ export declare const PromoFeaturesBlock: {
222
222
  resetPaddings: {
223
223
  type: string;
224
224
  };
225
+ context: {
226
+ type: string;
227
+ };
225
228
  type: {};
226
229
  when: {};
227
230
  };
@@ -91,6 +91,9 @@ export declare const QuestionsBlock: {
91
91
  resetPaddings: {
92
92
  type: string;
93
93
  };
94
+ context: {
95
+ type: string;
96
+ };
94
97
  type: {};
95
98
  when: {};
96
99
  };
@@ -4,8 +4,10 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const uikit_1 = require("@gravity-ui/uikit");
6
6
  const utils_1 = require("../../utils");
7
+ const models_1 = require("../../models");
7
8
  const locationContext_1 = require("../../context/locationContext");
8
9
  const i18n_1 = tslib_1.__importDefault(require("./i18n"));
10
+ const hooks_1 = require("../../hooks");
9
11
  const Facebook_1 = require("../../icons/Facebook");
10
12
  const Twitter_1 = require("../../icons/Twitter");
11
13
  const Linkedin_1 = require("../../icons/Linkedin");
@@ -21,13 +23,15 @@ const icons = {
21
23
  const b = (0, utils_1.block)('share-block');
22
24
  const Share = ({ items, title }) => {
23
25
  const { pathname, hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
26
+ const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.ShareButton);
27
+ const handleButtonClick = (0, react_1.useCallback)(() => handleAnalytics(), [handleAnalytics]);
24
28
  return (react_1.default.createElement("div", { className: b() },
25
29
  react_1.default.createElement("h5", { className: b('title') }, title || (0, i18n_1.default)('constructor-share')),
26
30
  react_1.default.createElement("div", { className: b('items') }, items.map((type) => {
27
31
  const url = (0, utils_1.getAbsolutePath)(hostname, pathname);
28
32
  const socialUrl = (0, utils_1.getShareLink)(url, type);
29
33
  const icon = icons[type];
30
- return (react_1.default.createElement(uikit_1.Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }) }, icon && react_1.default.createElement(uikit_1.Icon, { data: icon, size: 24, className: b('icon', { type }) })));
34
+ return (react_1.default.createElement(uikit_1.Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }), onClick: handleButtonClick }, icon && react_1.default.createElement(uikit_1.Icon, { data: icon, size: 24, className: b('icon', { type }) })));
31
35
  }))));
32
36
  };
33
37
  exports.default = Share;
@@ -33,6 +33,9 @@ export declare const SimpleBlock: {
33
33
  resetPaddings: {
34
34
  type: string;
35
35
  };
36
+ context: {
37
+ type: string;
38
+ };
36
39
  type: {};
37
40
  when: {};
38
41
  title: {
@@ -211,6 +211,9 @@ export declare const SliderBlock: {
211
211
  resetPaddings: {
212
212
  type: string;
213
213
  };
214
+ context: {
215
+ type: string;
216
+ };
214
217
  type: {};
215
218
  when: {};
216
219
  };
@@ -64,6 +64,9 @@ export declare const TableBlock: {
64
64
  resetPaddings: {
65
65
  type: string;
66
66
  };
67
+ context: {
68
+ type: string;
69
+ };
67
70
  type: {};
68
71
  when: {};
69
72
  };
@@ -177,6 +177,84 @@ export declare const tabsItem: {
177
177
  type: string;
178
178
  enum: string[];
179
179
  };
180
+ analyticsEvents: {
181
+ anyOf: ({
182
+ type: string;
183
+ additionalProperties: {
184
+ type: string;
185
+ };
186
+ required: string[];
187
+ properties: {
188
+ name: {
189
+ type: string;
190
+ };
191
+ type: {
192
+ type: string;
193
+ };
194
+ counters: {
195
+ type: string;
196
+ additionalProperties: boolean;
197
+ required: never[];
198
+ properties: {
199
+ include: {
200
+ type: string;
201
+ items: {
202
+ type: string;
203
+ };
204
+ };
205
+ exclude: {
206
+ type: string;
207
+ items: {
208
+ type: string;
209
+ };
210
+ };
211
+ };
212
+ };
213
+ context: {
214
+ type: string;
215
+ };
216
+ };
217
+ } | {
218
+ type: string;
219
+ items: {
220
+ type: string;
221
+ additionalProperties: {
222
+ type: string;
223
+ };
224
+ required: string[];
225
+ properties: {
226
+ name: {
227
+ type: string;
228
+ };
229
+ type: {
230
+ type: string;
231
+ };
232
+ counters: {
233
+ type: string;
234
+ additionalProperties: boolean;
235
+ required: never[];
236
+ properties: {
237
+ include: {
238
+ type: string;
239
+ items: {
240
+ type: string;
241
+ };
242
+ };
243
+ exclude: {
244
+ type: string;
245
+ items: {
246
+ type: string;
247
+ };
248
+ };
249
+ };
250
+ };
251
+ context: {
252
+ type: string;
253
+ };
254
+ };
255
+ };
256
+ })[];
257
+ };
180
258
  type: {};
181
259
  when: {};
182
260
  };
@@ -341,6 +419,9 @@ export declare const TabsBlock: {
341
419
  resetPaddings: {
342
420
  type: string;
343
421
  };
422
+ context: {
423
+ type: string;
424
+ };
344
425
  type: {};
345
426
  when: {};
346
427
  };
@@ -5,10 +5,14 @@ const react_1 = tslib_1.__importStar(require("react"));
5
5
  const uikit_1 = require("@gravity-ui/uikit");
6
6
  const icons_1 = require("../../icons");
7
7
  const locationContext_1 = require("../../context/locationContext");
8
+ const hooks_1 = require("../../hooks");
9
+ const models_1 = require("../../models");
8
10
  function BackLink(props) {
9
11
  const { history } = (0, react_1.useContext)(locationContext_1.LocationContext);
10
12
  const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, } = props;
13
+ const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.ShareButton, url);
11
14
  const backActionHandler = (0, react_1.useCallback)(async () => {
15
+ handleAnalytics();
12
16
  if (!history) {
13
17
  return;
14
18
  }
@@ -21,7 +25,7 @@ function BackLink(props) {
21
25
  else {
22
26
  history.push({ pathname: url });
23
27
  }
24
- }, [history, onClick, url]);
28
+ }, [handleAnalytics, history, onClick, url]);
25
29
  return (react_1.default.createElement(uikit_1.Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined },
26
30
  react_1.default.createElement(uikit_1.Icon, { data: icons_1.ArrowSidebar, size: 24 }),
27
31
  react_1.default.createElement("span", null, title)));
@@ -4,22 +4,26 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const uikit_1 = require("@gravity-ui/uikit");
6
6
  const utils_1 = require("../../utils");
7
+ const models_1 = require("../../models");
7
8
  const utils_2 = require("./utils");
8
9
  const localeContext_1 = require("../../context/localeContext/localeContext");
9
10
  const useMetrika_1 = require("../../hooks/useMetrika");
11
+ const hooks_1 = require("../../hooks");
10
12
  const icons_1 = require("../../icons");
11
13
  const b = (0, utils_1.block)('button-block');
12
14
  const Button = (props) => {
13
15
  const handleMetrika = (0, useMetrika_1.useMetrika)();
14
16
  const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
15
- const { className, metrikaGoals, pixelEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "size", "theme", "url", "img", "onClick", "text"]);
17
+ const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
16
18
  const defaultImgPosition = 'left';
19
+ const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.Button, url);
17
20
  const onClick = (0, react_1.useCallback)(() => {
18
21
  handleMetrika({ metrikaGoals, pixelEvents });
22
+ handleAnalytics(analyticsEvents);
19
23
  if (onClickOrigin) {
20
24
  onClickOrigin();
21
25
  }
22
- }, [handleMetrika, metrikaGoals, pixelEvents, onClickOrigin]);
26
+ }, [handleMetrika, metrikaGoals, pixelEvents, handleAnalytics, analyticsEvents, onClickOrigin]);
23
27
  const buttonImg = img instanceof Object
24
28
  ? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
25
29
  : { url: img, position: defaultImgPosition };
@@ -1,6 +1,7 @@
1
1
  import React, { ReactElement, HTMLAttributeAnchorTarget } from 'react';
2
2
  import { ButtonPixel, CardBaseProps as CardBaseParams, ImageProps, MetrikaGoal, WithChildren } from '../../models';
3
- export interface CardBaseProps extends CardBaseParams {
3
+ import { AnalyticsEventsBase } from '../../models/common';
4
+ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
4
5
  className?: string;
5
6
  bodyClassName?: string;
6
7
  contentClassName?: string;
@@ -7,13 +7,16 @@ const utils_1 = require("../../utils");
7
7
  const BackgroundImage_1 = tslib_1.__importDefault(require("../BackgroundImage/BackgroundImage"));
8
8
  const RouterLink_1 = tslib_1.__importDefault(require("../RouterLink/RouterLink"));
9
9
  const useMetrika_1 = require("../../hooks/useMetrika");
10
+ const common_1 = require("../../models/common");
11
+ const hooks_1 = require("../../hooks");
10
12
  const b = (0, utils_1.block)('card-base-block');
11
13
  const Header = () => null;
12
14
  const Content = () => null;
13
15
  const Footer = () => null;
14
16
  const Layout = (props) => {
15
- const { className, bodyClassName, metrikaGoals, pixelEvents, contentClassName, children, url, target, border = 'shadow', } = props;
17
+ const { className, bodyClassName, metrikaGoals, pixelEvents, analyticsEvents, contentClassName, children, url, target, border = 'shadow', } = props;
16
18
  const handleMetrika = (0, useMetrika_1.useMetrika)();
19
+ const handleAnalytics = (0, hooks_1.useAnalytics)(common_1.DefaultEventNames.CardBase, url);
17
20
  let header, content, footer, image, headerClass, footerClass;
18
21
  function handleChild(child) {
19
22
  switch (child.type) {
@@ -46,6 +49,7 @@ const Layout = (props) => {
46
49
  const fullClassName = b({ border }, className);
47
50
  const onClick = () => {
48
51
  handleMetrika({ metrikaGoals, pixelEvents });
52
+ handleAnalytics(analyticsEvents);
49
53
  };
50
54
  return url ? (react_1.default.createElement(RouterLink_1.default, { href: url },
51
55
  react_1.default.createElement("a", { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: fullClassName, draggable: false, onDragStart: (e) => e.preventDefault(), onClick: onClick }, cardContent))) : (react_1.default.createElement("div", { className: fullClassName }, cardContent));