@pushwoosh/dumb-components 1.1.162 → 1.1.164

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 (94) hide show
  1. package/Modal/components/Modal/styles.js +3 -3
  2. package/NativeRichMediaPreview/NativeRichMediaPreview.d.ts +23 -4
  3. package/NativeRichMediaPreview/NativeRichMediaPreview.js +125 -63
  4. package/NativeRichMediaPreview/components/NativeRichMediaButtonList/NativeRichMediaButtonList.d.ts +3 -0
  5. package/NativeRichMediaPreview/components/NativeRichMediaButtonList/NativeRichMediaButtonList.js +24 -0
  6. package/NativeRichMediaPreview/components/NativeRichMediaButtonList/index.d.ts +1 -0
  7. package/NativeRichMediaPreview/components/NativeRichMediaButtonList/index.js +1 -0
  8. package/NativeRichMediaPreview/components/NativeRichMediaButtonList/types.d.ts +6 -0
  9. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/styles.js +4 -5
  10. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/NativeRichMediaRewardPanel.js +26 -26
  11. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/styles.d.ts +29 -2
  12. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/styles.js +19 -4
  13. package/NativeRichMediaPreview/components/NativeRichMediaText/index.d.ts +1 -0
  14. package/NativeRichMediaPreview/components/NativeRichMediaText/index.js +1 -0
  15. package/NativeRichMediaPreview/components/NativeRichMediaText/styles.d.ts +7 -0
  16. package/NativeRichMediaPreview/components/NativeRichMediaText/styles.js +19 -0
  17. package/NativeRichMediaPreview/components/NativeRichMediaTitle/index.d.ts +1 -0
  18. package/NativeRichMediaPreview/components/NativeRichMediaTitle/index.js +1 -0
  19. package/NativeRichMediaPreview/components/NativeRichMediaTitle/styles.d.ts +12 -0
  20. package/NativeRichMediaPreview/components/NativeRichMediaTitle/styles.js +22 -0
  21. package/NativeRichMediaPreview/helpers.d.ts +22 -6
  22. package/NativeRichMediaPreview/helpers.js +45 -6
  23. package/NativeRichMediaPreview/icons/MutedIcon.svg +1 -1
  24. package/NativeRichMediaPreview/icons/SoundIcon.svg +1 -1
  25. package/NativeRichMediaPreview/index.d.ts +1 -1
  26. package/NativeRichMediaPreview/parseNativeRichMediaConfig.d.ts +3 -1
  27. package/NativeRichMediaPreview/parseNativeRichMediaConfig.js +74 -18
  28. package/NativeRichMediaPreview/styles.d.ts +7 -7
  29. package/NativeRichMediaPreview/styles.js +25 -23
  30. package/NativeRichMediaPreview/types.d.ts +180 -176
  31. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/NativeRichMediaBannerView.js +31 -36
  32. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/styles.d.ts +3 -4
  33. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/styles.js +8 -11
  34. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/NativeRichMediaCarouselView.js +31 -30
  35. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/styles.d.ts +0 -2
  36. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/styles.js +4 -12
  37. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/types.d.ts +0 -1
  38. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/NativeRichMediaFullscreenView.js +26 -35
  39. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/NativeRichMediaInvalidView.js +5 -3
  40. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/styles.d.ts +9 -0
  41. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/styles.js +10 -1
  42. package/NativeRichMediaPreview/views/NativeRichMediaModalView/NativeRichMediaModalView.js +33 -38
  43. package/NativeRichMediaPreview/views/NativeRichMediaPipView/NativeRichMediaPipView.js +30 -35
  44. package/NativeRichMediaPreview/views/NativeRichMediaPipView/styles.d.ts +7 -6
  45. package/NativeRichMediaPreview/views/NativeRichMediaPipView/styles.js +15 -13
  46. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/NativeRichMediaScratchcardView.js +50 -52
  47. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/styles.d.ts +18 -5
  48. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/styles.js +15 -8
  49. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/NativeRichMediaSheetView.js +31 -37
  50. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/styles.js +1 -1
  51. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/NativeRichMediaSpinwheelView.js +45 -47
  52. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/styles.d.ts +11 -3
  53. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/styles.js +16 -10
  54. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/NativeRichMediaStoriesView.js +24 -33
  55. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/styles.d.ts +1 -7
  56. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/styles.js +7 -21
  57. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/types.d.ts +0 -1
  58. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/NativeRichMediaVideoView.js +22 -42
  59. package/NativeRichMediaPreview/views/shared/styles.d.ts +3 -3
  60. package/NativeRichMediaPreview/views/shared/styles.js +6 -5
  61. package/index.d.ts +1 -1
  62. package/package.json +1 -1
  63. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/NativeRichMediaCardButtons.d.ts +0 -3
  64. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/NativeRichMediaCardButtons.js +0 -29
  65. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/index.d.ts +0 -1
  66. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/index.js +0 -1
  67. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/types.d.ts +0 -5
  68. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/NativeRichMediaOverlayButtons.d.ts +0 -3
  69. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/NativeRichMediaOverlayButtons.js +0 -40
  70. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/index.d.ts +0 -1
  71. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/index.js +0 -1
  72. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/types.d.ts +0 -4
  73. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/types.js +0 -1
  74. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/NativeRichMediaPreviewCanvas.d.ts +0 -3
  75. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/NativeRichMediaPreviewCanvas.js +0 -10
  76. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/index.d.ts +0 -1
  77. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/index.js +0 -1
  78. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/styles.d.ts +0 -1
  79. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/styles.js +0 -6
  80. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/types.d.ts +0 -4
  81. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/types.js +0 -1
  82. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/NativeRichMediaPtLabel.d.ts +0 -3
  83. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/NativeRichMediaPtLabel.js +0 -27
  84. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/index.d.ts +0 -1
  85. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/index.js +0 -1
  86. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/styles.d.ts +0 -10
  87. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/styles.js +0 -30
  88. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/types.d.ts +0 -12
  89. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/types.js +0 -1
  90. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/styles.d.ts +0 -1
  91. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/styles.js +0 -1
  92. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/styles.d.ts +0 -1
  93. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/styles.js +0 -1
  94. /package/NativeRichMediaPreview/components/{NativeRichMediaCardButtons → NativeRichMediaButtonList}/types.js +0 -0
@@ -1,245 +1,249 @@
1
- /** Text fragment with an optional custom color. */
1
+ /** Text block. */
2
2
  export type NativeRichMediaText = {
3
3
  /** Text content. */
4
4
  text: string;
5
- /** CSS text color; falls back to the block's default. */
6
- color?: string;
5
+ /** Text color in HEX with opacity (example: #RRGGBBFF). */
6
+ color: string;
7
7
  };
8
- /** What happens when an interactive element is tapped. */
8
+ /** Border config. */
9
+ export type NativeRichMediaBorder = {
10
+ /** Border color in HEX with opacity (example: #RRGGBBFF). */
11
+ color: string;
12
+ /** Border radius in pt. */
13
+ radius: number;
14
+ };
15
+ /** Surface of a card: optional image over a background color. */
16
+ export type NativeRichMediaCover = {
17
+ /** Cover image URL. */
18
+ image?: string;
19
+ /** Background color in HEX with opacity (example: #RRGGBBFF). */
20
+ background: string;
21
+ };
22
+ /** Available actions. */
9
23
  export type NativeRichMediaAction = {
10
24
  type: 'close';
11
25
  } | {
12
26
  type: 'url';
13
27
  url: string;
14
28
  };
15
- /** Button rendered inside a rich media block. */
29
+ /** Button block. */
16
30
  export type NativeRichMediaButton = {
17
- /** Button caption. */
18
- text: string;
19
- /** CSS caption color. */
20
- textColor?: string;
21
- /** CSS background of the button. */
22
- background?: string;
23
- /** Corner radius in pt. */
24
- cornerRadius?: number;
31
+ /** Button text. */
32
+ text: NativeRichMediaText;
33
+ /** Button background color in HEX with opacity (example: #RRGGBBFF). */
34
+ background: string;
35
+ /** Border config. */
36
+ border: NativeRichMediaBorder;
25
37
  /** Tap action. */
26
- action?: NativeRichMediaAction;
38
+ action: NativeRichMediaAction;
27
39
  };
28
40
  /** Reward panel shown after winning a scratchcard or spinwheel. */
29
41
  export type NativeRichMediaReward = {
30
- /** Panel heading. */
42
+ /** Title; a valid reward has a title or a code. */
31
43
  title?: NativeRichMediaText;
32
- /** Panel body text. */
44
+ /** Message. */
33
45
  message?: NativeRichMediaText;
34
46
  /** Promo code displayed with a copy control. */
35
47
  code?: string;
36
- /** Caption of the confirmation button. */
37
- button?: string;
38
- /** Confirmation button action. */
39
- action?: NativeRichMediaAction;
48
+ /** Confirmation button, including its own tap action. */
49
+ button?: NativeRichMediaButton;
40
50
  };
41
- /** Content of a `modal` rich media. */
42
- export type NativeRichMediaModalBlock = {
43
- /** CSS background of the modal card. */
44
- background?: string;
45
- /** Heading. */
46
- title?: NativeRichMediaText;
47
- /** Body text. */
48
- message?: NativeRichMediaText;
49
- /** Cover image URL. */
50
- image?: string;
51
+ /** Content of a `banner` rich media. */
52
+ export type NativeRichMediaBannerBlock = {
51
53
  /** Show a close (✕) chip. */
52
- showClose?: boolean;
53
- /** Dim the screen behind the card (default `true`). */
54
- dimBackground?: boolean;
55
- /** Action buttons under the message. */
56
- buttons?: NativeRichMediaButton[];
57
- };
58
- /** Content of a `sheet` rich media; same shape as {@link NativeRichMediaModalBlock}, docked to the bottom. */
59
- export type NativeRichMediaSheetBlock = NativeRichMediaModalBlock;
60
- /** Single card of a `carousel` rich media. */
61
- export type NativeRichMediaCarouselItem = {
62
- /** Card image URL. */
54
+ showClose: boolean;
55
+ /** Screen edge the banner is docked to (default `bottom`). */
56
+ position: 'top' | 'bottom';
57
+ /** Banner background color in HEX with opacity (example: #RRGGBBFF). */
58
+ background: string;
59
+ /** Leading image URL. */
63
60
  image?: string;
64
- /** Card heading. */
65
- title?: string;
66
- /** Card secondary text. */
67
- subtitle?: string;
68
- /** URL opened when the card is tapped. */
69
- url?: string;
61
+ /** Title. */
62
+ title?: NativeRichMediaText;
63
+ /** Message. */
64
+ message?: NativeRichMediaText;
65
+ /** Tap action. */
66
+ action: NativeRichMediaAction;
67
+ /** Auto-dismiss timeout in seconds; omit to keep the banner until closed. */
68
+ autoDismiss?: number;
70
69
  };
71
70
  /** Content of a `carousel` rich media. */
72
71
  export type NativeRichMediaCarouselBlock = {
73
- /** Carousel cards. */
74
- items: NativeRichMediaCarouselItem[];
75
72
  /** Show a close (✕) chip. */
76
- showClose?: boolean;
73
+ showClose: boolean;
74
+ /** Carousel cards. */
75
+ items: Array<{
76
+ /** Title. */
77
+ title?: NativeRichMediaText;
78
+ /** Message. */
79
+ message?: NativeRichMediaText;
80
+ /** Card image URL. */
81
+ image?: string;
82
+ /** Tap action of the card. */
83
+ action?: NativeRichMediaAction;
84
+ }>;
77
85
  };
78
- /** Single slide of a `stories` rich media. */
79
- export type NativeRichMediaStoryItem = {
80
- /** Slide image URL. */
86
+ /** Content of a `modal` rich media. */
87
+ export type NativeRichMediaModalBlock = {
88
+ /** Show a close (✕) chip. */
89
+ showClose: boolean;
90
+ /** Dim the screen behind the card. */
91
+ dimBackground: boolean;
92
+ /** Card background color in HEX with opacity (example: #RRGGBBFF). */
93
+ background: string;
94
+ /** Cover image URL. */
81
95
  image?: string;
82
- /** Slide heading. */
83
- title?: string;
84
- /** Slide secondary text. */
85
- subtitle?: string;
86
- /** Caption of the slide's action button. */
87
- button?: string;
88
- /** URL opened by the action button. */
89
- url?: string;
90
- /** Slide duration in seconds. */
91
- duration?: number;
96
+ /** Title. */
97
+ title?: NativeRichMediaText;
98
+ /** Message. */
99
+ message?: NativeRichMediaText;
100
+ /** Action buttons under the message. */
101
+ buttons: Array<NativeRichMediaButton>;
92
102
  };
93
- /** Content of a `stories` rich media. */
94
- export type NativeRichMediaStoriesBlock = {
95
- /** Story slides. */
96
- items: NativeRichMediaStoryItem[];
97
- /** Restart from the first slide after the last one. */
98
- loop?: boolean;
103
+ /** Content of a `sheet` rich media. */
104
+ export type NativeRichMediaSheetBlock = {
99
105
  /** Show a close (✕) chip. */
100
- showClose?: boolean;
101
- };
102
- /** Content of a `banner` rich media. */
103
- export type NativeRichMediaBannerBlock = {
104
- /** Screen edge the banner is docked to (default `bottom`). */
105
- position?: 'top' | 'bottom';
106
- /** Leading image URL. */
106
+ showClose: boolean;
107
+ /** Dim the screen behind the card. */
108
+ dimBackground: boolean;
109
+ /** Sheet background color in HEX with opacity (example: #RRGGBBFF). */
110
+ background: string;
111
+ /** Cover image URL. */
107
112
  image?: string;
108
- /** Heading. */
113
+ /** Title. */
109
114
  title?: NativeRichMediaText;
110
- /** Body text. */
115
+ /** Message. */
111
116
  message?: NativeRichMediaText;
112
- /** CSS background of the banner. */
113
- background?: string;
114
- /** Tap action. */
115
- action?: NativeRichMediaAction;
116
- /** Auto-dismiss timeout in seconds. */
117
- autoDismiss?: number;
117
+ /** Action buttons under the message. */
118
+ buttons: Array<NativeRichMediaButton>;
119
+ };
120
+ /** Content of a `stories` rich media. */
121
+ export type NativeRichMediaStoriesBlock = {
118
122
  /** Show a close (✕) chip. */
119
- showClose?: boolean;
123
+ showClose: boolean;
124
+ /** Restart from the first slide after the last one. */
125
+ loop: boolean;
126
+ /** Story slides. */
127
+ items: Array<{
128
+ /** Title. */
129
+ title?: NativeRichMediaText;
130
+ /** Message. */
131
+ message?: NativeRichMediaText;
132
+ /** Slide image URL. */
133
+ image?: string;
134
+ /** Action buttons at the bottom. */
135
+ buttons: Array<NativeRichMediaButton>;
136
+ /** Slide duration in seconds (SDK: default 5, max 30). */
137
+ duration: number;
138
+ }>;
120
139
  };
121
140
  /** Content of a `fullscreen` rich media. */
122
141
  export type NativeRichMediaFullscreenBlock = {
123
- /** Cover image URL. */
124
- image?: string;
125
- /** Heading. */
142
+ /** Show a close (✕) chip. */
143
+ showClose: boolean;
144
+ /** Surface of the screen. */
145
+ cover: NativeRichMediaCover;
146
+ /** Title. */
126
147
  title?: NativeRichMediaText;
127
- /** Body text. */
148
+ /** Message. */
128
149
  message?: NativeRichMediaText;
129
150
  /** Action buttons at the bottom. */
130
- buttons?: NativeRichMediaButton[];
131
- /** Show a close (✕) chip. */
132
- showClose?: boolean;
151
+ buttons: Array<NativeRichMediaButton>;
133
152
  };
134
153
  /** Content of a `video` rich media. */
135
154
  export type NativeRichMediaVideoBlock = {
155
+ /** Title. */
156
+ title?: NativeRichMediaText;
157
+ /** Message. */
158
+ message?: NativeRichMediaText;
159
+ /** Show a close (✕) chip. */
160
+ showClose: boolean;
161
+ /** Loop playback. */
162
+ loop: boolean;
163
+ /** Start playback muted. */
164
+ muted: boolean;
136
165
  /** Video URL. */
137
- url?: string;
166
+ url: string;
138
167
  /** Poster image URL shown before playback. */
139
168
  poster?: string;
140
169
  /** Image URL shown when the video cannot be played. */
141
170
  fallback?: string;
142
- /** Heading over the video. */
143
- title?: NativeRichMediaText;
144
- /** Body text over the video. */
145
- message?: NativeRichMediaText;
146
- /** Caption of the action button. */
147
- button?: string;
148
- /** Action button action. */
149
- action?: NativeRichMediaAction;
150
- /** Loop playback. */
151
- loop?: boolean;
152
- /** Start playback muted. */
153
- muted?: boolean;
154
- /** Show a close (✕) chip. */
155
- showClose?: boolean;
171
+ /** Action buttons at the bottom. */
172
+ buttons: Array<NativeRichMediaButton>;
156
173
  };
157
174
  /** Content of a `pip` (picture-in-picture) rich media. */
158
175
  export type NativeRichMediaPipBlock = {
176
+ /** Show a close (✕) chip. */
177
+ showClose: boolean;
178
+ /** Screen corner the pip window is docked to. */
179
+ position: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
180
+ /** Loop playback. */
181
+ loop: boolean;
182
+ /** Start playback muted. */
183
+ muted: boolean;
159
184
  /** Video URL. */
160
- url?: string;
185
+ url: string;
161
186
  /** Poster image URL shown before playback. */
162
187
  poster?: string;
163
188
  /** Image URL shown when the video cannot be played. */
164
189
  fallback?: string;
165
- /** Screen corner the pip window is docked to (default `bottom-right`). */
166
- position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
167
- /** Pip window width in pt. */
168
- width?: number;
190
+ /** Pip window width as a percent of the box width, clamped between 15 and 70 (values ≤ 1 are treated as a fraction). */
191
+ width: number;
169
192
  /** Width-to-height ratio of the pip window. */
170
- aspectRatio?: number;
171
- /** Corner radius in pt. */
172
- cornerRadius?: number;
173
- /** Loop playback. */
174
- loop?: boolean;
175
- /** Start playback muted. */
176
- muted?: boolean;
177
- /** Caption of the action button. */
178
- button?: string;
179
- /** Action button action. */
193
+ aspectRatio: number;
194
+ /** Border radius in pt. */
195
+ borderRadius?: number;
196
+ /** Tap action of the pip window itself. */
180
197
  action?: NativeRichMediaAction;
181
- /** Show a close (✕) chip. */
182
- showClose?: boolean;
183
- };
184
- /** Scratch layer of a {@link NativeRichMediaScratchcardBlock}. */
185
- export type NativeRichMediaScratchcardCover = {
186
- /** Cover image URL. */
187
- image?: string;
188
- /** CSS cover color used when there is no image. */
189
- color?: string;
190
198
  };
191
199
  /** Content of a `scratchcard` rich media. */
192
200
  export type NativeRichMediaScratchcardBlock = {
193
- /** CSS background: a color or gradient stops. */
194
- background?: string | string[];
195
- /** Heading. */
201
+ /** Show a close (✕) chip. */
202
+ showClose: boolean;
203
+ /** Color or gradient stops in HEX with opacity (example: #RRGGBBFF). */
204
+ background: string | string[];
205
+ /** Scratched-area fraction (0–1) that reveals the reward. */
206
+ revealThreshold: number;
207
+ /** Scratch layer hiding the reward. */
208
+ cover: NativeRichMediaCover;
209
+ /** Instant-reveal button, including its own tap action. */
210
+ revealButton?: Omit<NativeRichMediaButton, 'action'>;
211
+ /** Title. */
196
212
  title?: NativeRichMediaText;
197
- /** Body text. */
213
+ /** Message. */
198
214
  message?: NativeRichMediaText;
199
- /** Scratch layer hiding the reward. */
200
- cover?: NativeRichMediaScratchcardCover;
201
- /** Scratched-area fraction (0–1) that reveals the reward. */
202
- revealThreshold?: number;
203
- /** Caption of the instant-reveal button. */
204
- revealButton?: string;
205
215
  /** Reward revealed under the cover. */
206
- reward?: NativeRichMediaReward;
207
- /** Show a close (✕) chip. */
208
- showClose?: boolean;
209
- };
210
- /** Single sector of a {@link NativeRichMediaSpinwheelBlock}. */
211
- export type NativeRichMediaSpinwheelSegment = {
212
- /** Sector caption. */
213
- text: string;
214
- /** CSS sector fill color. */
215
- color?: string;
216
- /** CSS caption color. */
217
- textColor?: string;
218
- /** Relative sector size; defaults to an even split. */
219
- weight?: number;
220
- /** Reward granted when the wheel stops on this sector. */
221
- reward?: NativeRichMediaReward;
216
+ reward: NativeRichMediaReward;
222
217
  };
223
218
  /** Content of a `spinwheel` rich media. */
224
219
  export type NativeRichMediaSpinwheelBlock = {
225
- /** CSS background: a color or gradient stops. */
226
- background?: string | string[];
227
- /** Heading. */
220
+ /** Title. */
228
221
  title?: NativeRichMediaText;
229
- /** Body text. */
222
+ /** Message. */
230
223
  message?: NativeRichMediaText;
231
- /** Index of the winning segment; omit for a losing spin. */
232
- winIndex?: number;
233
- /** Caption of the spin button. */
234
- spinButton?: string;
235
- /** Wheel sectors. */
236
- segments: NativeRichMediaSpinwheelSegment[];
224
+ /** Show a close (✕) chip. */
225
+ showClose: boolean;
226
+ /** Color or gradient stops in HEX with opacity (example: #RRGGBBFF). */
227
+ background: string | string[];
228
+ /** Index of the winning segment. */
229
+ winIndex: number;
230
+ /** Spin button, including its own tap action. */
231
+ spinButton: Omit<NativeRichMediaButton, 'action'>;
237
232
  /** Reward shown after a winning spin. */
238
- reward?: NativeRichMediaReward;
233
+ reward: NativeRichMediaReward;
239
234
  /** Heading shown after a losing spin. */
240
235
  loseTitle?: NativeRichMediaText;
241
- /** Show a close (✕) chip. */
242
- showClose?: boolean;
236
+ /** Wheel sectors. */
237
+ segments: Array<{
238
+ /** Message. */
239
+ message: NativeRichMediaText;
240
+ /** Color in HEX with opacity (example: #RRGGBBFF). */
241
+ color?: string;
242
+ /** Relative sector size. */
243
+ weight: number;
244
+ /** Reward granted when the wheel stops on this sector. */
245
+ reward?: NativeRichMediaReward;
246
+ }>;
243
247
  };
244
248
  /** Native rich media config: a display type and the matching content block. */
245
249
  export type NativeRichMediaConfig = {
@@ -281,12 +285,12 @@ export declare const NATIVE_RICH_MEDIA_DISPLAY_TYPES: NativeRichMediaDisplayType
281
285
  export type NativeRichMediaPreviewProps = {
282
286
  /** Rich media config, as an object or a JSON string. */
283
287
  content: string | NativeRichMediaConfig;
284
- /** Accessible name of the preview (rendered as the `title` attribute). */
285
- name?: string;
286
- /** Preview width; number is treated as px (default `304`). */
287
- width?: string | number;
288
- /** Preview height; number is treated as px (default `659`). */
289
- height?: string | number;
288
+ /** Preview box width; number is treated as px. */
289
+ width: string | number;
290
+ /** Preview box height; number is treated as px. */
291
+ height: string | number;
292
+ /** Index of the slide shown for `carousel`/`stories` (clamped to the items range, default `0`); ignored by other display types. */
293
+ activeIndex?: number;
290
294
  /** Show a spinner instead of the content. */
291
295
  isLoading?: boolean;
292
296
  /** Render the container chrome — white backdrop and border (default `true`). Set `false` for a transparent preview over the consumer's own background. */
@@ -1,46 +1,41 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Card, CloseGlyph, TextContainer } from './styles';
2
+ import { Vertical } from '@pushwoosh/kit-helpers';
3
+ import { Card, CloseGlyph } from './styles';
3
4
  import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
4
- import { NativeRichMediaPtLabel } from '../../components/NativeRichMediaPtLabel';
5
- import { PT } from '../../helpers';
6
- import { TemplateLayer } from '../../styles';
5
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
6
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
7
+ import { EDGE_INSET, asTextValue } from '../../helpers';
7
8
  export function NativeRichMediaBannerView(props) {
8
9
  const {
9
10
  block
10
11
  } = props;
11
12
  const isTop = block.position === 'top';
12
- return _jsx(TemplateLayer, {
13
- children: _jsxs(Card, {
14
- "$top": isTop ? PT.SAFE_TOP + 10 : undefined,
15
- "$bottom": isTop ? undefined : PT.SAFE_BOTTOM + 10,
16
- "$background": block.background || '#1F1F1F',
17
- children: [block.image && _jsx(NativeRichMediaCoverImg, {
18
- url: block.image,
19
- width: 52,
20
- height: 52,
21
- borderRadius: 12,
22
- flex: "none"
23
- }), _jsxs(TextContainer, {
24
- children: [block.title && _jsx(NativeRichMediaPtLabel, {
25
- value: block.title,
26
- size: 16,
27
- weight: 600,
28
- fallbackColor: "#FFFFFF",
29
- align: "left",
30
- truncate: true
31
- }), block.message && _jsx(NativeRichMediaPtLabel, {
32
- value: block.message,
33
- size: 13,
34
- weight: 400,
35
- fallbackColor: "rgba(255,255,255,0.7)",
36
- align: "left",
37
- lineHeight: 1.3,
38
- clamp2: true,
39
- marginTop: block.title ? 2 : undefined
40
- })]
41
- }), block.showClose !== false && _jsx(CloseGlyph, {
42
- children: "\u2715"
13
+ const title = asTextValue(block.title);
14
+ const message = asTextValue(block.message);
15
+ return _jsxs(Card, {
16
+ "$marginTop": isTop ? EDGE_INSET : undefined,
17
+ "$marginBottom": isTop ? undefined : EDGE_INSET,
18
+ "$background": block.background,
19
+ children: [block.image && _jsx(NativeRichMediaCoverImg, {
20
+ url: block.image,
21
+ width: 52,
22
+ height: 52,
23
+ borderRadius: 12,
24
+ flex: "none"
25
+ }), _jsxs(Vertical, {
26
+ "$gap": 4,
27
+ children: [title.text && _jsx(NativeRichMediaTitle, {
28
+ "$color": title.color,
29
+ "$size": "h4",
30
+ "$truncate": true,
31
+ children: title.text
32
+ }), message.text && _jsx(NativeRichMediaText, {
33
+ "$color": message.color,
34
+ "$clamp": 2,
35
+ children: message.text
43
36
  })]
44
- })
37
+ }), block.showClose && _jsx(CloseGlyph, {
38
+ children: "\u2715"
39
+ })]
45
40
  });
46
41
  }
@@ -1,7 +1,6 @@
1
1
  export declare const Card: import("styled-components").StyledComponent<"div", any, {
2
- $background: string;
3
- $top?: number;
4
- $bottom?: number;
2
+ $background?: string;
3
+ $marginTop?: number;
4
+ $marginBottom?: number;
5
5
  }, never>;
6
- export declare const TextContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
7
6
  export declare const CloseGlyph: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,19 +1,16 @@
1
1
  import styled from 'styled-components';
2
+ import { FontSize, FontWeight } from '@pushwoosh/kit-constants';
2
3
  export const Card = styled.div.withConfig({
3
4
  displayName: "Card",
4
5
  componentId: "sc-1fs78cm-0"
5
- })(["position:absolute;left:12px;right:12px;border-radius:18px;box-shadow:0 16px 28px rgba(0,0,0,0.28);padding:12px 14px;display:flex;align-items:center;gap:12px;background:", ";", " ", ""], ({
6
+ })(["margin:0 12px;border-radius:18px;box-shadow:0 16px 28px rgba(0,0,0,0.28);padding:12px 14px;display:flex;align-items:center;gap:12px;background:", ";", " ", ""], ({
6
7
  $background
7
8
  }) => $background, ({
8
- $top
9
- }) => $top !== undefined ? `top: ${$top}px;` : '', ({
10
- $bottom
11
- }) => $bottom !== undefined ? `bottom: ${$bottom}px;` : '');
12
- export const TextContainer = styled.div.withConfig({
13
- displayName: "TextContainer",
14
- componentId: "sc-1fs78cm-1"
15
- })(["flex:1;min-width:0;"]);
9
+ $marginTop
10
+ }) => $marginTop !== undefined ? `margin-top: ${$marginTop}px;` : '', ({
11
+ $marginBottom
12
+ }) => $marginBottom !== undefined ? `margin-bottom: ${$marginBottom}px;` : '');
16
13
  export const CloseGlyph = styled.div.withConfig({
17
14
  displayName: "CloseGlyph",
18
- componentId: "sc-1fs78cm-2"
19
- })(["flex:none;width:24px;height:24px;display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,0.6);font-size:13px;font-weight:700;"]);
15
+ componentId: "sc-1fs78cm-1"
16
+ })(["flex:none;width:24px;height:24px;display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,0.6);font-size:", ";font-weight:", ";user-select:none;cursor:pointer;"], FontSize.SMALL, FontWeight.BOLD);
@@ -1,43 +1,44 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Card, Dot, Dots, GradientOverlay, SubtitleText, TextBlock, TitleText } from './styles';
2
+ import { Card, Dot, Dots, GradientOverlay, TextBlock } from './styles';
3
3
  import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseChip';
4
4
  import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
5
- import { asText } from '../../helpers';
6
- import { TemplateLayer } from '../../styles';
5
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
6
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
7
+ import { asTextValue, clampIndex } from '../../helpers';
7
8
  export function NativeRichMediaCarouselView(props) {
8
9
  const {
9
10
  block,
10
- activeIndex,
11
- onNavigate
11
+ activeIndex
12
12
  } = props;
13
13
  const items = block.items;
14
- const idx = Math.max(0, Math.min(activeIndex, items.length - 1));
14
+ const idx = clampIndex(activeIndex, items.length);
15
15
  const item = items[idx] || {};
16
- return _jsx(TemplateLayer, {
17
- children: _jsxs(Card, {
18
- children: [_jsx(NativeRichMediaCoverImg, {
19
- url: item.image,
20
- position: "absolute",
21
- inset: true
22
- }), (item.title || item.subtitle) && _jsxs(_Fragment, {
23
- children: [_jsx(GradientOverlay, {}), _jsxs(TextBlock, {
24
- children: [item.title && _jsx(TitleText, {
25
- children: asText(item.title)
26
- }), item.subtitle && _jsx(SubtitleText, {
27
- children: asText(item.subtitle)
28
- })]
16
+ const title = asTextValue(item.title);
17
+ const message = asTextValue(item.message);
18
+ return _jsxs(Card, {
19
+ children: [_jsx(NativeRichMediaCoverImg, {
20
+ url: item.image,
21
+ position: "absolute",
22
+ inset: true
23
+ }), (title.text || message.text) && _jsxs(_Fragment, {
24
+ children: [_jsx(GradientOverlay, {}), _jsxs(TextBlock, {
25
+ children: [title.text && _jsx(NativeRichMediaTitle, {
26
+ "$color": title.color,
27
+ children: title.text
28
+ }), message.text && _jsx(NativeRichMediaText, {
29
+ "$color": message.color,
30
+ children: message.text
29
31
  })]
30
- }), items.length > 1 && _jsx(Dots, {
31
- children: items.map((_, i) => _jsx(Dot
32
- // eslint-disable-next-line react/no-array-index-key
33
- , {
34
- "$active": i === idx,
35
- onClick: () => onNavigate(i)
36
- }, `carousel-dot-${i}`))
37
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
38
- top: 12,
39
- right: 12
40
32
  })]
41
- })
33
+ }), items.length > 1 && _jsx(Dots, {
34
+ children: items.map((_, i) => _jsx(Dot
35
+ // eslint-disable-next-line react/no-array-index-key
36
+ , {
37
+ "$active": i === idx
38
+ }, `carousel-dot-${i}`))
39
+ }), block.showClose && _jsx(NativeRichMediaCloseChip, {
40
+ top: 12,
41
+ right: 12
42
+ })]
42
43
  });
43
44
  }
@@ -1,8 +1,6 @@
1
1
  export declare const Card: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const GradientOverlay: import("styled-components").StyledComponent<"div", any, {}, never>;
3
3
  export declare const TextBlock: import("styled-components").StyledComponent<"div", any, {}, never>;
4
- export declare const TitleText: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export declare const SubtitleText: import("styled-components").StyledComponent<"div", any, {}, never>;
6
4
  export declare const Dots: import("styled-components").StyledComponent<"div", any, {}, never>;
7
5
  export declare const Dot: import("styled-components").StyledComponent<"div", any, {
8
6
  $active?: boolean;