@pushwoosh/dumb-components 1.1.161 → 1.1.162

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 (212) hide show
  1. package/NativeRichMediaPreview/NativeRichMediaPreview.d.ts +11 -0
  2. package/NativeRichMediaPreview/NativeRichMediaPreview.js +151 -0
  3. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/NativeRichMediaCardButtons.d.ts +3 -0
  4. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/NativeRichMediaCardButtons.js +29 -0
  5. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/index.d.ts +1 -0
  6. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/index.js +1 -0
  7. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/types.d.ts +5 -0
  8. package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/types.js +1 -0
  9. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/NativeRichMediaCloseChip.d.ts +3 -0
  10. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/NativeRichMediaCloseChip.js +15 -0
  11. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/index.d.ts +2 -0
  12. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/index.js +2 -0
  13. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/styles.d.ts +7 -0
  14. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/styles.js +19 -0
  15. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/types.d.ts +5 -0
  16. package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/types.js +1 -0
  17. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/NativeRichMediaCoverImg.d.ts +3 -0
  18. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/NativeRichMediaCoverImg.js +27 -0
  19. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/index.d.ts +1 -0
  20. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/index.js +1 -0
  21. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/styles.d.ts +11 -0
  22. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/styles.js +23 -0
  23. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/types.d.ts +11 -0
  24. package/NativeRichMediaPreview/components/NativeRichMediaCoverImg/types.js +1 -0
  25. package/NativeRichMediaPreview/components/NativeRichMediaDim/index.d.ts +1 -0
  26. package/NativeRichMediaPreview/components/NativeRichMediaDim/index.js +1 -0
  27. package/NativeRichMediaPreview/components/NativeRichMediaDim/styles.d.ts +1 -0
  28. package/NativeRichMediaPreview/components/NativeRichMediaDim/styles.js +5 -0
  29. package/NativeRichMediaPreview/components/NativeRichMediaExpandChip/NativeRichMediaExpandChip.d.ts +3 -0
  30. package/NativeRichMediaPreview/components/NativeRichMediaExpandChip/NativeRichMediaExpandChip.js +15 -0
  31. package/NativeRichMediaPreview/components/NativeRichMediaExpandChip/index.d.ts +1 -0
  32. package/NativeRichMediaPreview/components/NativeRichMediaExpandChip/index.js +1 -0
  33. package/NativeRichMediaPreview/components/NativeRichMediaExpandChip/types.d.ts +4 -0
  34. package/NativeRichMediaPreview/components/NativeRichMediaExpandChip/types.js +1 -0
  35. package/NativeRichMediaPreview/components/NativeRichMediaMuteChip/NativeRichMediaMuteChip.d.ts +3 -0
  36. package/NativeRichMediaPreview/components/NativeRichMediaMuteChip/NativeRichMediaMuteChip.js +21 -0
  37. package/NativeRichMediaPreview/components/NativeRichMediaMuteChip/index.d.ts +1 -0
  38. package/NativeRichMediaPreview/components/NativeRichMediaMuteChip/index.js +1 -0
  39. package/NativeRichMediaPreview/components/NativeRichMediaMuteChip/types.d.ts +8 -0
  40. package/NativeRichMediaPreview/components/NativeRichMediaMuteChip/types.js +1 -0
  41. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/NativeRichMediaOverlayButtons.d.ts +3 -0
  42. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/NativeRichMediaOverlayButtons.js +40 -0
  43. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/index.d.ts +1 -0
  44. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/index.js +1 -0
  45. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/types.d.ts +4 -0
  46. package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/types.js +1 -0
  47. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/NativeRichMediaPreviewCanvas.d.ts +3 -0
  48. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/NativeRichMediaPreviewCanvas.js +10 -0
  49. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/index.d.ts +1 -0
  50. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/index.js +1 -0
  51. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/styles.d.ts +1 -0
  52. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/styles.js +6 -0
  53. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/types.d.ts +4 -0
  54. package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/types.js +1 -0
  55. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/NativeRichMediaPtLabel.d.ts +3 -0
  56. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/NativeRichMediaPtLabel.js +27 -0
  57. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/index.d.ts +1 -0
  58. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/index.js +1 -0
  59. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/styles.d.ts +10 -0
  60. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/styles.js +30 -0
  61. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/types.d.ts +12 -0
  62. package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/types.js +1 -0
  63. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/NativeRichMediaRewardPanel.d.ts +3 -0
  64. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/NativeRichMediaRewardPanel.js +56 -0
  65. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/index.d.ts +1 -0
  66. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/index.js +1 -0
  67. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/styles.d.ts +8 -0
  68. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/styles.js +17 -0
  69. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/types.d.ts +5 -0
  70. package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/types.js +1 -0
  71. package/NativeRichMediaPreview/helpers.d.ts +17 -0
  72. package/NativeRichMediaPreview/helpers.js +81 -0
  73. package/NativeRichMediaPreview/icons/CopyIcon.svg +4 -0
  74. package/NativeRichMediaPreview/icons/ExpandIcon.svg +3 -0
  75. package/NativeRichMediaPreview/icons/MutedIcon.svg +4 -0
  76. package/NativeRichMediaPreview/icons/ScribbleIcon.svg +3 -0
  77. package/NativeRichMediaPreview/icons/SoundIcon.svg +4 -0
  78. package/NativeRichMediaPreview/icons/index.d.ts +5 -0
  79. package/NativeRichMediaPreview/icons/index.js +5 -0
  80. package/NativeRichMediaPreview/index.d.ts +4 -0
  81. package/NativeRichMediaPreview/index.js +3 -0
  82. package/NativeRichMediaPreview/parseNativeRichMediaConfig.d.ts +6 -0
  83. package/NativeRichMediaPreview/parseNativeRichMediaConfig.js +40 -0
  84. package/NativeRichMediaPreview/polyglot/index.d.ts +2 -0
  85. package/NativeRichMediaPreview/polyglot/index.js +34 -0
  86. package/NativeRichMediaPreview/polyglot/messages_ar.d.ts +3 -0
  87. package/NativeRichMediaPreview/polyglot/messages_ar.js +4 -0
  88. package/NativeRichMediaPreview/polyglot/messages_bn.d.ts +3 -0
  89. package/NativeRichMediaPreview/polyglot/messages_bn.js +4 -0
  90. package/NativeRichMediaPreview/polyglot/messages_de.d.ts +3 -0
  91. package/NativeRichMediaPreview/polyglot/messages_de.js +4 -0
  92. package/NativeRichMediaPreview/polyglot/messages_en.d.ts +3 -0
  93. package/NativeRichMediaPreview/polyglot/messages_en.js +4 -0
  94. package/NativeRichMediaPreview/polyglot/messages_es.d.ts +3 -0
  95. package/NativeRichMediaPreview/polyglot/messages_es.js +4 -0
  96. package/NativeRichMediaPreview/polyglot/messages_fr.d.ts +3 -0
  97. package/NativeRichMediaPreview/polyglot/messages_fr.js +4 -0
  98. package/NativeRichMediaPreview/polyglot/messages_he.d.ts +3 -0
  99. package/NativeRichMediaPreview/polyglot/messages_he.js +4 -0
  100. package/NativeRichMediaPreview/polyglot/messages_hi.d.ts +3 -0
  101. package/NativeRichMediaPreview/polyglot/messages_hi.js +4 -0
  102. package/NativeRichMediaPreview/polyglot/messages_ja.d.ts +3 -0
  103. package/NativeRichMediaPreview/polyglot/messages_ja.js +4 -0
  104. package/NativeRichMediaPreview/polyglot/messages_ko.d.ts +3 -0
  105. package/NativeRichMediaPreview/polyglot/messages_ko.js +4 -0
  106. package/NativeRichMediaPreview/polyglot/messages_pt.d.ts +3 -0
  107. package/NativeRichMediaPreview/polyglot/messages_pt.js +4 -0
  108. package/NativeRichMediaPreview/polyglot/messages_ru.d.ts +3 -0
  109. package/NativeRichMediaPreview/polyglot/messages_ru.js +4 -0
  110. package/NativeRichMediaPreview/polyglot/messages_th.d.ts +3 -0
  111. package/NativeRichMediaPreview/polyglot/messages_th.js +4 -0
  112. package/NativeRichMediaPreview/polyglot/messages_zh.d.ts +3 -0
  113. package/NativeRichMediaPreview/polyglot/messages_zh.js +4 -0
  114. package/NativeRichMediaPreview/polyglot/types.d.ts +5 -0
  115. package/NativeRichMediaPreview/polyglot/types.js +1 -0
  116. package/NativeRichMediaPreview/styles.d.ts +19 -0
  117. package/NativeRichMediaPreview/styles.js +45 -0
  118. package/NativeRichMediaPreview/types.d.ts +294 -0
  119. package/NativeRichMediaPreview/types.js +2 -0
  120. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/NativeRichMediaBannerView.d.ts +3 -0
  121. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/NativeRichMediaBannerView.js +46 -0
  122. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/index.d.ts +1 -0
  123. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/index.js +1 -0
  124. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/styles.d.ts +7 -0
  125. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/styles.js +19 -0
  126. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/types.d.ts +4 -0
  127. package/NativeRichMediaPreview/views/NativeRichMediaBannerView/types.js +1 -0
  128. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/NativeRichMediaCarouselView.d.ts +3 -0
  129. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/NativeRichMediaCarouselView.js +43 -0
  130. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/index.d.ts +1 -0
  131. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/index.js +1 -0
  132. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/styles.d.ts +9 -0
  133. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/styles.js +31 -0
  134. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/types.d.ts +6 -0
  135. package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/types.js +1 -0
  136. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/NativeRichMediaFullscreenView.d.ts +3 -0
  137. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/NativeRichMediaFullscreenView.js +42 -0
  138. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/index.d.ts +1 -0
  139. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/index.js +1 -0
  140. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/styles.d.ts +1 -0
  141. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/styles.js +1 -0
  142. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/types.d.ts +4 -0
  143. package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/types.js +1 -0
  144. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/NativeRichMediaInvalidView.d.ts +2 -0
  145. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/NativeRichMediaInvalidView.js +10 -0
  146. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/index.d.ts +1 -0
  147. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/index.js +1 -0
  148. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/styles.d.ts +1 -0
  149. package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/styles.js +6 -0
  150. package/NativeRichMediaPreview/views/NativeRichMediaModalView/NativeRichMediaModalView.d.ts +3 -0
  151. package/NativeRichMediaPreview/views/NativeRichMediaModalView/NativeRichMediaModalView.js +50 -0
  152. package/NativeRichMediaPreview/views/NativeRichMediaModalView/index.d.ts +1 -0
  153. package/NativeRichMediaPreview/views/NativeRichMediaModalView/index.js +1 -0
  154. package/NativeRichMediaPreview/views/NativeRichMediaModalView/styles.d.ts +6 -0
  155. package/NativeRichMediaPreview/views/NativeRichMediaModalView/styles.js +8 -0
  156. package/NativeRichMediaPreview/views/NativeRichMediaModalView/types.d.ts +4 -0
  157. package/NativeRichMediaPreview/views/NativeRichMediaModalView/types.js +1 -0
  158. package/NativeRichMediaPreview/views/NativeRichMediaPipView/NativeRichMediaPipView.d.ts +3 -0
  159. package/NativeRichMediaPreview/views/NativeRichMediaPipView/NativeRichMediaPipView.js +51 -0
  160. package/NativeRichMediaPreview/views/NativeRichMediaPipView/index.d.ts +1 -0
  161. package/NativeRichMediaPreview/views/NativeRichMediaPipView/index.js +1 -0
  162. package/NativeRichMediaPreview/views/NativeRichMediaPipView/styles.d.ts +9 -0
  163. package/NativeRichMediaPreview/views/NativeRichMediaPipView/styles.js +19 -0
  164. package/NativeRichMediaPreview/views/NativeRichMediaPipView/types.d.ts +4 -0
  165. package/NativeRichMediaPreview/views/NativeRichMediaPipView/types.js +1 -0
  166. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/NativeRichMediaScratchcardView.d.ts +3 -0
  167. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/NativeRichMediaScratchcardView.js +68 -0
  168. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/index.d.ts +1 -0
  169. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/index.js +1 -0
  170. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/styles.d.ts +17 -0
  171. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/styles.js +35 -0
  172. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/types.d.ts +4 -0
  173. package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/types.js +1 -0
  174. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/NativeRichMediaSheetView.d.ts +3 -0
  175. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/NativeRichMediaSheetView.js +49 -0
  176. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/index.d.ts +1 -0
  177. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/index.js +1 -0
  178. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/styles.d.ts +4 -0
  179. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/styles.js +12 -0
  180. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/types.d.ts +4 -0
  181. package/NativeRichMediaPreview/views/NativeRichMediaSheetView/types.js +1 -0
  182. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/NativeRichMediaSpinwheelView.d.ts +3 -0
  183. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/NativeRichMediaSpinwheelView.js +63 -0
  184. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/index.d.ts +1 -0
  185. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/index.js +1 -0
  186. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/styles.d.ts +19 -0
  187. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/styles.js +40 -0
  188. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/types.d.ts +4 -0
  189. package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/types.js +1 -0
  190. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/NativeRichMediaStoriesView.d.ts +3 -0
  191. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/NativeRichMediaStoriesView.js +51 -0
  192. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/index.d.ts +1 -0
  193. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/index.js +1 -0
  194. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/styles.d.ts +11 -0
  195. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/styles.js +30 -0
  196. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/types.d.ts +6 -0
  197. package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/types.js +1 -0
  198. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/NativeRichMediaVideoView.d.ts +3 -0
  199. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/NativeRichMediaVideoView.js +49 -0
  200. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/index.d.ts +1 -0
  201. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/index.js +1 -0
  202. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/styles.d.ts +1 -0
  203. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/styles.js +1 -0
  204. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/types.d.ts +4 -0
  205. package/NativeRichMediaPreview/views/NativeRichMediaVideoView/types.js +1 -0
  206. package/NativeRichMediaPreview/views/index.d.ts +11 -0
  207. package/NativeRichMediaPreview/views/index.js +11 -0
  208. package/NativeRichMediaPreview/views/shared/styles.d.ts +8 -0
  209. package/NativeRichMediaPreview/views/shared/styles.js +19 -0
  210. package/index.d.ts +2 -0
  211. package/index.js +1 -0
  212. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaPreviewProps } from './types';
3
+ /**
4
+ * Phone-frame preview of a native rich media (modal, banner, stories,
5
+ * spinwheel, …) rendered from its JSON config; shows an invalid-config
6
+ * placeholder when the config cannot be parsed.
7
+ *
8
+ * @example
9
+ * <NativeRichMediaPreview content={'{"displayType":"modal","modal":{"title":{"text":"Hi"}}}'} />
10
+ */
11
+ export declare function NativeRichMediaPreview(props: NativeRichMediaPreviewProps): ReactElement;
@@ -0,0 +1,151 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { Color } from '@pushwoosh/kit-constants';
4
+ import { Spinner } from '../Spinner';
5
+ import { NativeRichMediaDim } from './components/NativeRichMediaDim';
6
+ import { NativeRichMediaPreviewCanvas } from './components/NativeRichMediaPreviewCanvas';
7
+ import { PT } from './helpers';
8
+ import { parseNativeRichMediaConfig } from './parseNativeRichMediaConfig';
9
+ import { CanvasWrapper, ScaledCanvasHost } from './styles';
10
+ import { NativeRichMediaBannerView, NativeRichMediaCarouselView, NativeRichMediaFullscreenView, NativeRichMediaInvalidView, NativeRichMediaModalView, NativeRichMediaPipView, NativeRichMediaScratchcardView, NativeRichMediaSheetView, NativeRichMediaSpinwheelView, NativeRichMediaStoriesView, NativeRichMediaVideoView } from './views';
11
+ const DEFAULT_WIDTH = 304;
12
+ const DEFAULT_HEIGHT = 659;
13
+ function dimsScreen(config) {
14
+ if (!config) {
15
+ return false;
16
+ }
17
+ switch (config.displayType) {
18
+ case 'modal':
19
+ return config.modal.dimBackground !== false;
20
+ case 'sheet':
21
+ return config.sheet.dimBackground !== false;
22
+ case 'carousel':
23
+ case 'scratchcard':
24
+ case 'spinwheel':
25
+ return true;
26
+ default:
27
+ return false;
28
+ }
29
+ }
30
+ function renderConfig(config, activeIndex, onNavigate) {
31
+ switch (config.displayType) {
32
+ case 'modal':
33
+ return _jsx(NativeRichMediaModalView, {
34
+ block: config.modal
35
+ });
36
+ case 'sheet':
37
+ return _jsx(NativeRichMediaSheetView, {
38
+ block: config.sheet
39
+ });
40
+ case 'carousel':
41
+ return _jsx(NativeRichMediaCarouselView, {
42
+ block: config.carousel,
43
+ activeIndex: activeIndex,
44
+ onNavigate: onNavigate
45
+ });
46
+ case 'stories':
47
+ return _jsx(NativeRichMediaStoriesView, {
48
+ block: config.stories,
49
+ activeIndex: activeIndex,
50
+ onNavigate: onNavigate
51
+ });
52
+ case 'banner':
53
+ return _jsx(NativeRichMediaBannerView, {
54
+ block: config.banner
55
+ });
56
+ case 'fullscreen':
57
+ return _jsx(NativeRichMediaFullscreenView, {
58
+ block: config.fullscreen
59
+ });
60
+ case 'video':
61
+ return _jsx(NativeRichMediaVideoView, {
62
+ block: config.video
63
+ });
64
+ case 'pip':
65
+ return _jsx(NativeRichMediaPipView, {
66
+ block: config.pip
67
+ });
68
+ case 'scratchcard':
69
+ return _jsx(NativeRichMediaScratchcardView, {
70
+ block: config.scratchcard
71
+ });
72
+ case 'spinwheel':
73
+ return _jsx(NativeRichMediaSpinwheelView, {
74
+ block: config.spinwheel
75
+ });
76
+ default:
77
+ return _jsx(NativeRichMediaInvalidView, {});
78
+ }
79
+ }
80
+ /**
81
+ * Phone-frame preview of a native rich media (modal, banner, stories,
82
+ * spinwheel, …) rendered from its JSON config; shows an invalid-config
83
+ * placeholder when the config cannot be parsed.
84
+ *
85
+ * @example
86
+ * <NativeRichMediaPreview content={'{"displayType":"modal","modal":{"title":{"text":"Hi"}}}'} />
87
+ */
88
+ export function NativeRichMediaPreview(props) {
89
+ const {
90
+ content,
91
+ name,
92
+ width = DEFAULT_WIDTH,
93
+ height = DEFAULT_HEIGHT,
94
+ isLoading = false,
95
+ withBackground = true
96
+ } = props;
97
+ const [activeIndex, setActiveIndex] = useState(0);
98
+ const config = useMemo(() => parseNativeRichMediaConfig(content), [content]);
99
+ const hostRef = useRef(null);
100
+ const isSizeString = typeof width !== 'number' || typeof height !== 'number';
101
+ const [measuredSize, setMeasuredSize] = useState(null);
102
+ useEffect(() => {
103
+ const host = hostRef.current;
104
+ if (!isSizeString || !host) {
105
+ return undefined;
106
+ }
107
+ const observer = new ResizeObserver(([entry]) => {
108
+ if (entry) {
109
+ const {
110
+ width: measuredWidth,
111
+ height: measuredHeight
112
+ } = entry.contentRect;
113
+ setMeasuredSize({
114
+ width: measuredWidth,
115
+ height: measuredHeight
116
+ });
117
+ }
118
+ });
119
+ observer.observe(host);
120
+ return () => observer.disconnect();
121
+ }, [isSizeString]);
122
+ const scale = useMemo(() => {
123
+ const effectiveWidth = typeof width === 'number' ? width : (measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.width) ?? DEFAULT_WIDTH;
124
+ const effectiveHeight = typeof height === 'number' ? height : (measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.height) ?? DEFAULT_HEIGHT;
125
+ return Math.min(effectiveWidth / PT.W, effectiveHeight / PT.H);
126
+ }, [width, height, measuredSize]);
127
+ const shouldDim = !isLoading && dimsScreen(config);
128
+ return _jsxs(ScaledCanvasHost, {
129
+ ref: hostRef,
130
+ width: width,
131
+ height: height,
132
+ "$withBackground": withBackground,
133
+ title: name,
134
+ children: [shouldDim && _jsx(NativeRichMediaDim, {}), isLoading && _jsx(CanvasWrapper, {
135
+ "$canvasWidth": PT.W,
136
+ "$canvasHeight": PT.H,
137
+ "$scale": scale,
138
+ children: _jsx(Spinner, {
139
+ size: "medium",
140
+ color: Color.LOCKED
141
+ })
142
+ }), !isLoading && !config && _jsx(NativeRichMediaInvalidView, {}), !isLoading && config && _jsx(CanvasWrapper, {
143
+ "$canvasWidth": PT.W,
144
+ "$canvasHeight": PT.H,
145
+ "$scale": scale,
146
+ children: _jsx(NativeRichMediaPreviewCanvas, {
147
+ children: renderConfig(config, activeIndex, setActiveIndex)
148
+ }, config.displayType)
149
+ })]
150
+ });
151
+ }
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaCardButtonsProps } from './types';
3
+ export declare function NativeRichMediaCardButtons(props: NativeRichMediaCardButtonsProps): ReactElement;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Color } from '@pushwoosh/kit-constants';
3
+ import { Vertical } from '@pushwoosh/kit-helpers';
4
+ import { SECONDARY_LABEL, asText, withAlpha } from '../../helpers';
5
+ import { ButtonRow } from '../../styles';
6
+ export function NativeRichMediaCardButtons(props) {
7
+ const {
8
+ buttons,
9
+ $padding
10
+ } = props;
11
+ return _jsx(Vertical, {
12
+ "$padding": $padding,
13
+ "$gap": 10,
14
+ children: (buttons || []).map((b, i) => {
15
+ const bg = b.background || (i === 0 ? Color.PRIMARY : 'transparent');
16
+ const color = b.textColor || (b.background || i === 0 ? '#FFFFFF' : SECONDARY_LABEL);
17
+ const boxShadow = i === 0 && bg !== 'transparent' ? '0 5px 10px ' + withAlpha(bg, 0.28) : undefined;
18
+ return _jsx(ButtonRow
19
+ // eslint-disable-next-line react/no-array-index-key
20
+ , {
21
+ "$borderRadius": b.cornerRadius !== undefined ? b.cornerRadius : 8,
22
+ "$background": bg,
23
+ "$color": color,
24
+ "$boxShadow": boxShadow,
25
+ children: asText(b.text)
26
+ }, `card-btn-${i}`);
27
+ })
28
+ });
29
+ }
@@ -0,0 +1 @@
1
+ export { NativeRichMediaCardButtons } from './NativeRichMediaCardButtons';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaCardButtons } from './NativeRichMediaCardButtons';
@@ -0,0 +1,5 @@
1
+ import type { NativeRichMediaButton } from '../../types';
2
+ export type NativeRichMediaCardButtonsProps = {
3
+ buttons?: NativeRichMediaButton[];
4
+ $padding: string;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaCloseChipProps } from './types';
3
+ export declare function NativeRichMediaCloseChip(props: NativeRichMediaCloseChipProps): ReactElement;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Chip } from './styles';
3
+ export function NativeRichMediaCloseChip(props) {
4
+ const {
5
+ top,
6
+ right,
7
+ small
8
+ } = props;
9
+ return _jsx(Chip, {
10
+ "$small": small,
11
+ "$top": top,
12
+ "$right": right,
13
+ children: "\u2715"
14
+ });
15
+ }
@@ -0,0 +1,2 @@
1
+ export { NativeRichMediaCloseChip } from './NativeRichMediaCloseChip';
2
+ export { Chip } from './styles';
@@ -0,0 +1,2 @@
1
+ export { NativeRichMediaCloseChip } from './NativeRichMediaCloseChip';
2
+ export { Chip } from './styles';
@@ -0,0 +1,7 @@
1
+ export declare const Chip: import("styled-components").StyledComponent<"div", any, {
2
+ $small?: boolean;
3
+ $top?: number;
4
+ $right?: number;
5
+ $bottom?: number;
6
+ $left?: number;
7
+ }, never>;
@@ -0,0 +1,19 @@
1
+ import styled from 'styled-components';
2
+ export const Chip = styled.div.withConfig({
3
+ displayName: "Chip",
4
+ componentId: "sc-17mcpnr-0"
5
+ })(["position:absolute;width:", ";height:", ";border-radius:50%;background:rgba(70,70,76,0.62);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);color:#FFF;display:flex;align-items:center;justify-content:center;font-size:", ";font-weight:700;z-index:6;line-height:1;", " ", " ", " ", " svg{display:block;}"], ({
6
+ $small
7
+ }) => $small ? '26px' : '34px', ({
8
+ $small
9
+ }) => $small ? '26px' : '34px', ({
10
+ $small
11
+ }) => $small ? '11px' : '14px', ({
12
+ $top
13
+ }) => $top !== undefined ? `top: ${$top}px;` : '', ({
14
+ $right
15
+ }) => $right !== undefined ? `right: ${$right}px;` : '', ({
16
+ $bottom
17
+ }) => $bottom !== undefined ? `bottom: ${$bottom}px;` : '', ({
18
+ $left
19
+ }) => $left !== undefined ? `left: ${$left}px;` : '');
@@ -0,0 +1,5 @@
1
+ export type NativeRichMediaCloseChipProps = {
2
+ top: number;
3
+ right: number;
4
+ small?: boolean;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaCoverImgProps } from './types';
3
+ export declare function NativeRichMediaCoverImg(props: NativeRichMediaCoverImgProps): ReactElement;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CoverBox } from './styles';
3
+ export function NativeRichMediaCoverImg(props) {
4
+ const {
5
+ url,
6
+ margin,
7
+ width,
8
+ height,
9
+ borderRadius,
10
+ position,
11
+ inset,
12
+ backgroundColor,
13
+ flex
14
+ } = props;
15
+ const escapedUrl = url ? String(url).replace(/'/g, '%27') : undefined;
16
+ return _jsx(CoverBox, {
17
+ "$backgroundImage": escapedUrl,
18
+ "$backgroundColor": backgroundColor,
19
+ "$margin": margin,
20
+ "$width": width,
21
+ "$height": height,
22
+ "$borderRadius": borderRadius,
23
+ "$position": position,
24
+ "$inset": inset,
25
+ "$flex": flex
26
+ });
27
+ }
@@ -0,0 +1 @@
1
+ export { NativeRichMediaCoverImg } from './NativeRichMediaCoverImg';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaCoverImg } from './NativeRichMediaCoverImg';
@@ -0,0 +1,11 @@
1
+ export declare const CoverBox: import("styled-components").StyledComponent<"div", any, {
2
+ $backgroundImage?: string;
3
+ $backgroundColor?: string;
4
+ $margin?: string;
5
+ $width?: number;
6
+ $height?: number;
7
+ $borderRadius?: number;
8
+ $position?: "absolute";
9
+ $inset?: boolean;
10
+ $flex?: string;
11
+ }, never>;
@@ -0,0 +1,23 @@
1
+ import styled from 'styled-components';
2
+ export const CoverBox = styled.div.withConfig({
3
+ displayName: "CoverBox",
4
+ componentId: "sc-15zx77-0"
5
+ })(["background-size:cover;background-position:center;background-color:", ";", " ", " ", " ", " ", " ", " ", " ", ""], ({
6
+ $backgroundColor
7
+ }) => $backgroundColor || 'rgba(116, 116, 128, 0.08)', ({
8
+ $backgroundImage
9
+ }) => $backgroundImage !== undefined ? `background-image: url('${$backgroundImage}');` : '', ({
10
+ $margin
11
+ }) => $margin !== undefined ? `margin: ${$margin};` : '', ({
12
+ $width
13
+ }) => $width !== undefined ? `width: ${$width}px;` : '', ({
14
+ $height
15
+ }) => $height !== undefined ? `height: ${$height}px;` : '', ({
16
+ $borderRadius
17
+ }) => $borderRadius !== undefined ? `border-radius: ${$borderRadius}px;` : '', ({
18
+ $position
19
+ }) => $position !== undefined ? `position: ${$position};` : '', ({
20
+ $inset
21
+ }) => $inset ? 'inset: 0;' : '', ({
22
+ $flex
23
+ }) => $flex !== undefined ? `flex: ${$flex};` : '');
@@ -0,0 +1,11 @@
1
+ export type NativeRichMediaCoverImgProps = {
2
+ url?: string;
3
+ margin?: string;
4
+ width?: number;
5
+ height?: number;
6
+ borderRadius?: number;
7
+ position?: 'absolute';
8
+ inset?: boolean;
9
+ backgroundColor?: string;
10
+ flex?: string;
11
+ };
@@ -0,0 +1 @@
1
+ export { NativeRichMediaDim } from './styles';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaDim } from './styles';
@@ -0,0 +1 @@
1
+ export declare const NativeRichMediaDim: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components';
2
+ export const NativeRichMediaDim = styled.div.withConfig({
3
+ displayName: "NativeRichMediaDim",
4
+ componentId: "sc-1xu35ei-0"
5
+ })(["position:absolute;inset:0;background:rgba(14,14,18,0.42);backdrop-filter:blur(9px) saturate(115%);-webkit-backdrop-filter:blur(9px) saturate(115%);"]);
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaExpandChipProps } from './types';
3
+ export declare function NativeRichMediaExpandChip(props: NativeRichMediaExpandChipProps): ReactElement;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ExpandIcon } from '../../icons';
3
+ import { Chip } from '../NativeRichMediaCloseChip';
4
+ export function NativeRichMediaExpandChip(props) {
5
+ const {
6
+ bottom,
7
+ left
8
+ } = props;
9
+ return _jsx(Chip, {
10
+ "$small": true,
11
+ "$bottom": bottom,
12
+ "$left": left,
13
+ children: _jsx(ExpandIcon, {})
14
+ });
15
+ }
@@ -0,0 +1 @@
1
+ export { NativeRichMediaExpandChip } from './NativeRichMediaExpandChip';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaExpandChip } from './NativeRichMediaExpandChip';
@@ -0,0 +1,4 @@
1
+ export type NativeRichMediaExpandChipProps = {
2
+ bottom?: number;
3
+ left?: number;
4
+ };
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaMuteChipProps } from './types';
3
+ export declare function NativeRichMediaMuteChip(props: NativeRichMediaMuteChipProps): ReactElement;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { MutedIcon, SoundIcon } from '../../icons';
3
+ import { Chip } from '../NativeRichMediaCloseChip';
4
+ export function NativeRichMediaMuteChip(props) {
5
+ const {
6
+ muted,
7
+ small,
8
+ top,
9
+ right,
10
+ bottom,
11
+ left
12
+ } = props;
13
+ return _jsx(Chip, {
14
+ "$small": small,
15
+ "$top": top,
16
+ "$right": right,
17
+ "$bottom": bottom,
18
+ "$left": left,
19
+ children: muted === false ? _jsx(SoundIcon, {}) : _jsx(MutedIcon, {})
20
+ });
21
+ }
@@ -0,0 +1 @@
1
+ export { NativeRichMediaMuteChip } from './NativeRichMediaMuteChip';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaMuteChip } from './NativeRichMediaMuteChip';
@@ -0,0 +1,8 @@
1
+ export type NativeRichMediaMuteChipProps = {
2
+ muted?: boolean;
3
+ small?: boolean;
4
+ top?: number;
5
+ right?: number;
6
+ bottom?: number;
7
+ left?: number;
8
+ };
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaOverlayButtonsProps } from './types';
3
+ export declare function NativeRichMediaOverlayButtons(props: NativeRichMediaOverlayButtonsProps): ReactElement;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Vertical } from '@pushwoosh/kit-helpers';
3
+ import { asText } from '../../helpers';
4
+ import { ButtonRow } from '../../styles';
5
+ export function NativeRichMediaOverlayButtons(props) {
6
+ const {
7
+ buttons
8
+ } = props;
9
+ return _jsx(Vertical, {
10
+ "$margin": {
11
+ top: 20
12
+ },
13
+ "$gap": 10,
14
+ children: (buttons || []).map((b, i) => {
15
+ const borderRadius = b.cornerRadius !== undefined ? b.cornerRadius : 8;
16
+ let background;
17
+ let color;
18
+ let border;
19
+ if (b.background) {
20
+ background = b.background;
21
+ color = b.textColor || '#FFFFFF';
22
+ } else if (i === 0) {
23
+ background = '#FFFFFF';
24
+ color = b.textColor || '#0F0F0F';
25
+ } else {
26
+ border = '1.5px solid rgba(255,255,255,0.6)';
27
+ color = b.textColor || '#FFFFFF';
28
+ }
29
+ return _jsx(ButtonRow
30
+ // eslint-disable-next-line react/no-array-index-key
31
+ , {
32
+ "$borderRadius": borderRadius,
33
+ "$background": background,
34
+ "$color": color,
35
+ "$border": border,
36
+ children: asText(b.text)
37
+ }, `overlay-btn-${i}`);
38
+ })
39
+ });
40
+ }
@@ -0,0 +1 @@
1
+ export { NativeRichMediaOverlayButtons } from './NativeRichMediaOverlayButtons';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaOverlayButtons } from './NativeRichMediaOverlayButtons';
@@ -0,0 +1,4 @@
1
+ import type { NativeRichMediaButton } from '../../types';
2
+ export type NativeRichMediaOverlayButtonsProps = {
3
+ buttons?: NativeRichMediaButton[];
4
+ };
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaPreviewCanvasProps } from './types';
3
+ export declare function NativeRichMediaPreviewCanvas(props: NativeRichMediaPreviewCanvasProps): ReactElement;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Canvas } from './styles';
3
+ export function NativeRichMediaPreviewCanvas(props) {
4
+ const {
5
+ children
6
+ } = props;
7
+ return _jsx(Canvas, {
8
+ children: children
9
+ });
10
+ }
@@ -0,0 +1 @@
1
+ export { NativeRichMediaPreviewCanvas } from './NativeRichMediaPreviewCanvas';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaPreviewCanvas } from './NativeRichMediaPreviewCanvas';
@@ -0,0 +1 @@
1
+ export declare const Canvas: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,6 @@
1
+ import styled from 'styled-components';
2
+ import { PT } from '../../helpers';
3
+ export const Canvas = styled.div.withConfig({
4
+ displayName: "Canvas",
5
+ componentId: "sc-1evwb9s-0"
6
+ })(["position:relative;overflow:hidden;width:", "px;height:", "px;font-family:ui-rounded,-apple-system,BlinkMacSystemFont,'SF Pro Rounded','Helvetica Neue',sans-serif;-webkit-font-smoothing:antialiased;*{box-sizing:border-box;}"], PT.W, PT.H);
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ export type NativeRichMediaPreviewCanvasProps = {
3
+ children: ReactNode;
4
+ };
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { NativeRichMediaPtLabelProps } from './types';
3
+ export declare function NativeRichMediaPtLabel(props: NativeRichMediaPtLabelProps): ReactElement;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Label } from './styles';
3
+ import { asText } from '../../helpers';
4
+ export function NativeRichMediaPtLabel(props) {
5
+ const {
6
+ value,
7
+ size,
8
+ weight,
9
+ fallbackColor,
10
+ align,
11
+ lineHeight,
12
+ marginTop,
13
+ truncate,
14
+ clamp2
15
+ } = props;
16
+ return _jsx(Label, {
17
+ "$size": size,
18
+ "$weight": weight,
19
+ "$align": align || 'left',
20
+ "$color": value.color || fallbackColor,
21
+ "$lineHeight": lineHeight,
22
+ "$marginTop": marginTop,
23
+ "$truncate": truncate,
24
+ "$clamp2": clamp2,
25
+ children: asText(value.text)
26
+ });
27
+ }
@@ -0,0 +1 @@
1
+ export { NativeRichMediaPtLabel } from './NativeRichMediaPtLabel';
@@ -0,0 +1 @@
1
+ export { NativeRichMediaPtLabel } from './NativeRichMediaPtLabel';
@@ -0,0 +1,10 @@
1
+ export declare const Label: import("styled-components").StyledComponent<"div", any, {
2
+ $size: number;
3
+ $weight: number;
4
+ $align: "left" | "center" | "right";
5
+ $color: string;
6
+ $lineHeight?: string | number;
7
+ $marginTop?: number;
8
+ $truncate?: boolean;
9
+ $clamp2?: boolean;
10
+ }, never>;