@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
@@ -2,7 +2,7 @@ import styled from 'styled-components';
2
2
  export const Card = styled.div.withConfig({
3
3
  displayName: "Card",
4
4
  componentId: "sc-15b2cux-0"
5
- })(["position:absolute;left:22px;right:22px;top:50%;transform:translateY(-50%);height:461px;border-radius:24px;background:#000;overflow:hidden;box-shadow:0 16px 28px rgba(0,0,0,0.28);"]);
5
+ })(["position:relative;margin:0 12px;height:461px;border-radius:24px;background:#000;overflow:hidden;box-shadow:0 16px 28px rgba(0,0,0,0.28);"]);
6
6
  export const GradientOverlay = styled.div.withConfig({
7
7
  displayName: "GradientOverlay",
8
8
  componentId: "sc-15b2cux-1"
@@ -11,21 +11,13 @@ export const TextBlock = styled.div.withConfig({
11
11
  displayName: "TextBlock",
12
12
  componentId: "sc-15b2cux-2"
13
13
  })(["position:absolute;left:18px;right:18px;bottom:36px;"]);
14
- export const TitleText = styled.div.withConfig({
15
- displayName: "TitleText",
16
- componentId: "sc-15b2cux-3"
17
- })(["font-size:20px;font-weight:700;color:#FFF;line-height:1.25;"]);
18
- export const SubtitleText = styled.div.withConfig({
19
- displayName: "SubtitleText",
20
- componentId: "sc-15b2cux-4"
21
- })(["font-size:14px;color:rgba(255,255,255,0.85);margin-top:3px;"]);
22
14
  export const Dots = styled.div.withConfig({
23
15
  displayName: "Dots",
24
- componentId: "sc-15b2cux-5"
16
+ componentId: "sc-15b2cux-3"
25
17
  })(["position:absolute;left:0;right:0;bottom:12px;text-align:center;font-size:0;"]);
26
18
  export const Dot = styled.div.withConfig({
27
19
  displayName: "Dot",
28
- componentId: "sc-15b2cux-6"
29
- })(["display:inline-block;width:7px;height:7px;border-radius:50%;margin:0 4.5px;cursor:pointer;background:", ";"], ({
20
+ componentId: "sc-15b2cux-4"
21
+ })(["display:inline-block;width:7px;height:7px;border-radius:50%;margin:0 4.5px;background:", ";"], ({
30
22
  $active
31
23
  }) => $active ? '#FFF' : 'rgba(255,255,255,0.4)');
@@ -2,5 +2,4 @@ import type { NativeRichMediaCarouselBlock } from '../../types';
2
2
  export type NativeRichMediaCarouselViewProps = {
3
3
  block: NativeRichMediaCarouselBlock;
4
4
  activeIndex: number;
5
- onNavigate: (index: number) => void;
6
5
  };
@@ -1,42 +1,33 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { GradientOverlay, TextBlock } from './styles';
3
- import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseChip';
4
- import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
5
- import { NativeRichMediaOverlayButtons } from '../../components/NativeRichMediaOverlayButtons';
6
- import { NativeRichMediaPtLabel } from '../../components/NativeRichMediaPtLabel';
7
- import { PT } from '../../helpers';
8
- import { TemplateLayer } from '../../styles';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Vertical } from '@pushwoosh/kit-helpers';
3
+ import { NativeRichMediaButtonList } from '../../components/NativeRichMediaButtonList';
4
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
5
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
6
+ import { asButtonList, asTextValue } from '../../helpers';
7
+ import { TextBlock } from '../shared/styles';
9
8
  export function NativeRichMediaFullscreenView(props) {
10
9
  const {
11
10
  block
12
11
  } = props;
13
- const hasButtons = (block.buttons || []).length > 0;
14
- return _jsxs(TemplateLayer, {
15
- children: [_jsx(NativeRichMediaCoverImg, {
16
- url: block.image,
17
- position: "absolute",
18
- inset: true,
19
- backgroundColor: "#1A1A1E"
20
- }), _jsx(GradientOverlay, {}), _jsxs(TextBlock, {
21
- "$bottom": PT.SAFE_BOTTOM + 28,
22
- children: [block.title && _jsx(NativeRichMediaPtLabel, {
23
- value: block.title,
24
- size: 30,
25
- weight: 700,
26
- fallbackColor: "#FFFFFF"
27
- }), block.message && _jsx(NativeRichMediaPtLabel, {
28
- value: block.message,
29
- size: 16,
30
- weight: 400,
31
- fallbackColor: "rgba(255,255,255,0.85)",
32
- align: "left",
33
- marginTop: block.title ? 8 : undefined
34
- }), hasButtons && _jsx(NativeRichMediaOverlayButtons, {
35
- buttons: block.buttons
12
+ const buttons = asButtonList(block.buttons);
13
+ const hasButtons = buttons.length > 0;
14
+ const title = asTextValue(block.title);
15
+ const message = asTextValue(block.message);
16
+ return _jsx(_Fragment, {
17
+ children: _jsxs(TextBlock, {
18
+ children: [_jsxs(Vertical, {
19
+ "$gap": 4,
20
+ children: [title.text && _jsx(NativeRichMediaTitle, {
21
+ "$color": title.color,
22
+ children: title.text
23
+ }), message.text && _jsx(NativeRichMediaText, {
24
+ "$color": message.color,
25
+ children: message.text
26
+ })]
27
+ }), hasButtons && _jsx(NativeRichMediaButtonList, {
28
+ "$margin": "16px 0 0",
29
+ buttons: buttons
36
30
  })]
37
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
38
- top: PT.SAFE_TOP + 12,
39
- right: 16
40
- })]
31
+ })
41
32
  });
42
33
  }
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Placeholder } from './styles';
2
+ import { Placeholder, PlaceholderText } from './styles';
3
3
  import { Lang } from '../../polyglot';
4
4
  export function NativeRichMediaInvalidView() {
5
5
  return _jsx(Placeholder, {
6
- children: _jsx(Lang, {
7
- message: "DUMB.NATIVE_RICH_MEDIA_PREVIEW.INVALID_CONFIG"
6
+ children: _jsx(PlaceholderText, {
7
+ children: _jsx(Lang, {
8
+ message: "DUMB.NATIVE_RICH_MEDIA_PREVIEW.INVALID_CONFIG"
9
+ })
8
10
  })
9
11
  });
10
12
  }
@@ -1 +1,10 @@
1
1
  export declare const Placeholder: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const PlaceholderText: import("styled-components").StyledComponent<typeof import("@pushwoosh/kit-typography").Footnote, any, {
3
+ $color?: string;
4
+ $align?: "center";
5
+ $clamp?: number;
6
+ $marginTop?: number;
7
+ } & {
8
+ $color: string;
9
+ $align: string;
10
+ }, "$color" | "$align">;
@@ -1,6 +1,15 @@
1
1
  import styled from 'styled-components';
2
+ import { FontWeight } from '@pushwoosh/kit-constants';
3
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
2
4
  import { SECONDARY_LABEL } from '../../helpers';
3
5
  export const Placeholder = styled.div.withConfig({
4
6
  displayName: "Placeholder",
5
7
  componentId: "sc-nwhsvi-0"
6
- })(["position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;text-align:center;font-size:15px;font-weight:500;color:", ";background:rgba(118,118,128,0.12);border:1px solid rgba(118,118,128,0.24);padding:22px 16px;"], SECONDARY_LABEL);
8
+ })(["position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;background:rgba(118,118,128,0.12);border:1px solid rgba(118,118,128,0.24);padding:22px 16px;"]);
9
+ export const PlaceholderText = styled(NativeRichMediaText).attrs({
10
+ $color: SECONDARY_LABEL,
11
+ $align: 'center'
12
+ }).withConfig({
13
+ displayName: "PlaceholderText",
14
+ componentId: "sc-nwhsvi-1"
15
+ })(["font-weight:", ";"], FontWeight.MEDIUM);
@@ -1,50 +1,45 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Vertical } from '@pushwoosh/kit-helpers';
3
3
  import { Card } from './styles';
4
- import { NativeRichMediaCardButtons } from '../../components/NativeRichMediaCardButtons';
4
+ import { NativeRichMediaButtonList } from '../../components/NativeRichMediaButtonList';
5
5
  import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseChip';
6
6
  import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
7
- import { NativeRichMediaPtLabel } from '../../components/NativeRichMediaPtLabel';
8
- import { SECONDARY_LABEL } from '../../helpers';
9
- import { TemplateLayer } from '../../styles';
7
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
8
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
9
+ import { asButtonList, asTextValue } from '../../helpers';
10
10
  export function NativeRichMediaModalView(props) {
11
11
  const {
12
12
  block
13
13
  } = props;
14
- const background = block.background || '#FFFFFF';
15
- const hasButtons = (block.buttons || []).length > 0;
16
- return _jsx(TemplateLayer, {
17
- children: _jsxs(Card, {
18
- "$background": background,
19
- children: [block.image && _jsx(NativeRichMediaCoverImg, {
20
- url: block.image,
21
- margin: "14px 14px 0",
22
- height: 179,
23
- borderRadius: 18
24
- }), (block.title || block.message) && _jsxs(Vertical, {
25
- "$padding": (block.image ? '20px' : '30px') + ' 24px 0',
26
- "$gap": 8,
27
- children: [block.title && _jsx(NativeRichMediaPtLabel, {
28
- value: block.title,
29
- size: 24,
30
- weight: 800,
31
- fallbackColor: "#000000",
32
- align: "center"
33
- }), block.message && _jsx(NativeRichMediaPtLabel, {
34
- value: block.message,
35
- size: 15,
36
- weight: 400,
37
- fallbackColor: SECONDARY_LABEL,
38
- align: "center",
39
- lineHeight: "21.5px"
40
- })]
41
- }), _jsx(NativeRichMediaCardButtons, {
42
- buttons: block.buttons,
43
- "$padding": hasButtons ? '24px 20px 20px' : '0 0 20px'
44
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
45
- top: 20,
46
- right: 20
14
+ const buttons = asButtonList(block.buttons);
15
+ const hasButtons = buttons.length > 0;
16
+ const title = asTextValue(block.title);
17
+ const message = asTextValue(block.message);
18
+ return _jsxs(Card, {
19
+ "$background": block.background,
20
+ children: [block.image && _jsx(NativeRichMediaCoverImg, {
21
+ url: block.image,
22
+ margin: "14px 14px 0",
23
+ height: 179,
24
+ borderRadius: 18
25
+ }), (title.text || message.text) && _jsxs(Vertical, {
26
+ "$padding": (block.image ? '20px' : '30px') + ' 24px 0',
27
+ "$gap": 4,
28
+ children: [title.text && _jsx(NativeRichMediaTitle, {
29
+ "$color": title.color,
30
+ "$align": "center",
31
+ children: title.text
32
+ }), message.text && _jsx(NativeRichMediaText, {
33
+ "$color": message.color,
34
+ "$align": "center",
35
+ children: message.text
47
36
  })]
48
- })
37
+ }), _jsx(NativeRichMediaButtonList, {
38
+ buttons: buttons,
39
+ "$padding": hasButtons ? '24px 20px 20px' : '0 0 20px'
40
+ }), block.showClose && _jsx(NativeRichMediaCloseChip, {
41
+ top: 20,
42
+ right: 20
43
+ })]
49
44
  });
50
45
  }
@@ -4,48 +4,43 @@ import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseC
4
4
  import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
5
5
  import { NativeRichMediaExpandChip } from '../../components/NativeRichMediaExpandChip';
6
6
  import { NativeRichMediaMuteChip } from '../../components/NativeRichMediaMuteChip';
7
- import { PT } from '../../helpers';
8
- import { TemplateLayer } from '../../styles';
7
+ import { EDGE_INSET } from '../../helpers';
9
8
  export function NativeRichMediaPipView(props) {
10
9
  const {
11
10
  block
12
11
  } = props;
13
- const raw = Number.isFinite(block.width) ? block.width : 32;
14
- const frac = Math.min(Math.max(raw > 1 ? raw / 100 : raw, 0.15), 0.7);
15
- const w = Math.round(PT.W * frac);
12
+ const rawWidth = Number.isFinite(block.width) ? block.width : 32;
13
+ const widthPercent = Math.min(Math.max(rawWidth <= 1 ? rawWidth * 100 : rawWidth, 15), 70);
16
14
  const aspectRatio = Number.isFinite(block.aspectRatio) ? block.aspectRatio : 0.5625;
17
- const h = Math.max(0, Math.round(w * aspectRatio));
18
- const cornerRadius = Number.isFinite(block.cornerRadius) ? block.cornerRadius : 16;
19
- const r = Math.min(cornerRadius, h / 2);
15
+ const cornerRadius = Number.isFinite(block.borderRadius) ? block.borderRadius : 16;
20
16
  const position = block.position || 'bottom-right';
21
17
  const isTop = position.includes('top');
22
18
  const isLeft = position.includes('left');
23
- return _jsx(TemplateLayer, {
24
- children: _jsxs(Frame, {
25
- "$width": w,
26
- "$height": h,
27
- "$radius": r,
28
- "$top": isTop ? PT.SAFE_TOP + 14 : undefined,
29
- "$bottom": isTop ? undefined : PT.SAFE_BOTTOM + 14,
30
- "$left": isLeft ? 14 : undefined,
31
- "$right": isLeft ? undefined : 14,
32
- children: [block.poster && _jsx(NativeRichMediaCoverImg, {
33
- url: block.poster,
34
- position: "absolute",
35
- inset: true
36
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
37
- top: 6,
38
- right: 6,
39
- small: true
40
- }), _jsx(NativeRichMediaMuteChip, {
41
- muted: block.muted,
42
- small: true,
43
- bottom: 6,
44
- right: 6
45
- }), _jsx(NativeRichMediaExpandChip, {
46
- bottom: 6,
47
- left: 6
48
- })]
49
- })
19
+ return _jsxs(Frame, {
20
+ "$widthPercent": widthPercent,
21
+ "$aspectRatio": aspectRatio,
22
+ "$radius": cornerRadius,
23
+ "$alignSelf": isLeft ? 'flex-start' : 'flex-end',
24
+ "$marginTop": isTop ? EDGE_INSET : undefined,
25
+ "$marginBottom": isTop ? undefined : EDGE_INSET,
26
+ "$marginLeft": isLeft ? EDGE_INSET : undefined,
27
+ "$marginRight": isLeft ? undefined : EDGE_INSET,
28
+ children: [block.poster && _jsx(NativeRichMediaCoverImg, {
29
+ url: block.poster,
30
+ position: "absolute",
31
+ inset: true
32
+ }), block.showClose && _jsx(NativeRichMediaCloseChip, {
33
+ top: 6,
34
+ right: 6,
35
+ small: true
36
+ }), _jsx(NativeRichMediaMuteChip, {
37
+ muted: block.muted,
38
+ small: true,
39
+ bottom: 6,
40
+ right: 6
41
+ }), _jsx(NativeRichMediaExpandChip, {
42
+ bottom: 6,
43
+ left: 6
44
+ })]
50
45
  });
51
46
  }
@@ -1,9 +1,10 @@
1
1
  export declare const Frame: import("styled-components").StyledComponent<"div", any, {
2
- $width: number;
3
- $height: number;
2
+ $widthPercent: number;
3
+ $aspectRatio: number;
4
4
  $radius: number;
5
- $top?: number;
6
- $bottom?: number;
7
- $left?: number;
8
- $right?: number;
5
+ $alignSelf: "flex-start" | "flex-end";
6
+ $marginTop?: number;
7
+ $marginBottom?: number;
8
+ $marginLeft?: number;
9
+ $marginRight?: number;
9
10
  }, never>;
@@ -2,18 +2,20 @@ import styled from 'styled-components';
2
2
  export const Frame = styled.div.withConfig({
3
3
  displayName: "Frame",
4
4
  componentId: "sc-hjtwid-0"
5
- })(["position:absolute;overflow:hidden;background:#000;box-shadow:0 16px 28px rgba(0,0,0,0.28);width:", "px;height:", "px;border-radius:", "px;", " ", " ", " ", ""], ({
6
- $width
7
- }) => $width, ({
8
- $height
9
- }) => $height, ({
5
+ })(["position:relative;overflow:hidden;background:#000;box-shadow:0 16px 28px rgba(0,0,0,0.28);width:", "%;aspect-ratio:1 / ", ";border-radius:", "px;align-self:", ";", " ", " ", " ", ""], ({
6
+ $widthPercent
7
+ }) => $widthPercent, ({
8
+ $aspectRatio
9
+ }) => $aspectRatio, ({
10
10
  $radius
11
11
  }) => $radius, ({
12
- $top
13
- }) => $top !== undefined ? `top: ${$top}px;` : '', ({
14
- $bottom
15
- }) => $bottom !== undefined ? `bottom: ${$bottom}px;` : '', ({
16
- $left
17
- }) => $left !== undefined ? `left: ${$left}px;` : '', ({
18
- $right
19
- }) => $right !== undefined ? `right: ${$right}px;` : '');
12
+ $alignSelf
13
+ }) => $alignSelf, ({
14
+ $marginTop
15
+ }) => $marginTop !== undefined ? `margin-top: ${$marginTop}px;` : '', ({
16
+ $marginBottom
17
+ }) => $marginBottom !== undefined ? `margin-bottom: ${$marginBottom}px;` : '', ({
18
+ $marginLeft
19
+ }) => $marginLeft !== undefined ? `margin-left: ${$marginLeft}px;` : '', ({
20
+ $marginRight
21
+ }) => $marginRight !== undefined ? `margin-right: ${$marginRight}px;` : '');
@@ -2,67 +2,65 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Card, HintOverlay, HintText, RevealArea, RevealButtonText, RewardSlot } from './styles';
3
3
  import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseChip';
4
4
  import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
5
- import { NativeRichMediaPtLabel } from '../../components/NativeRichMediaPtLabel';
6
5
  import { NativeRichMediaRewardPanel } from '../../components/NativeRichMediaRewardPanel';
7
- import { asText, contrastOn, surfaceBackground, surfaceBaseHex, withAlpha } from '../../helpers';
6
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
7
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
8
+ import { asButtonValue, asTextValue, contrastOn, surfaceBackground, withAlpha } from '../../helpers';
8
9
  import { ScribbleIcon } from '../../icons';
9
10
  import { Lang } from '../../polyglot';
10
- import { TemplateLayer } from '../../styles';
11
11
  export function NativeRichMediaScratchcardView(props) {
12
12
  const {
13
13
  block
14
14
  } = props;
15
- const baseHex = surfaceBaseHex(block.background) || '#FFFFFF';
16
- const cardText = contrastOn(baseHex);
17
- const cover = block.cover || {};
18
- const coverBase = cover.color || '#C7C7C7';
19
- const hintColor = withAlpha(contrastOn(coverBase), 0.45);
20
- return _jsx(TemplateLayer, {
21
- children: _jsxs(Card, {
22
- "$background": surfaceBackground(block.background, '#FFFFFF'),
23
- children: [block.title && _jsx(NativeRichMediaPtLabel, {
24
- value: block.title,
25
- size: 24,
26
- weight: 800,
27
- fallbackColor: cardText,
28
- align: "center"
29
- }), block.message && _jsx(NativeRichMediaPtLabel, {
30
- value: block.message,
31
- size: 15,
32
- weight: 400,
33
- fallbackColor: withAlpha(cardText, 0.72),
34
- align: "center",
35
- marginTop: 14,
36
- lineHeight: "20px"
37
- }), _jsxs(RevealArea, {
38
- children: [_jsx(RewardSlot, {
39
- children: _jsx(NativeRichMediaRewardPanel, {
40
- reward: block.reward,
41
- onBackgroundHex: "#F7F7F7"
15
+ const {
16
+ cover
17
+ } = block;
18
+ const hintColor = withAlpha(contrastOn(cover.background), 0.45);
19
+ const title = asTextValue(block.title);
20
+ const message = asTextValue(block.message);
21
+ const revealButton = asButtonValue(block.revealButton);
22
+ return _jsxs(Card, {
23
+ "$background": surfaceBackground(block.background, '#FFFFFF'),
24
+ children: [title.text && _jsx(NativeRichMediaTitle, {
25
+ "$color": title.color,
26
+ "$align": "center",
27
+ children: title.text
28
+ }), message.text && _jsx(NativeRichMediaText, {
29
+ "$color": message.color,
30
+ "$marginTop": 4,
31
+ "$align": "center",
32
+ children: message.text
33
+ }), _jsxs(RevealArea, {
34
+ children: [_jsx(RewardSlot, {
35
+ children: _jsx(NativeRichMediaRewardPanel, {
36
+ reward: block.reward,
37
+ onBackgroundHex: "#F7F7F7"
38
+ })
39
+ }), cover.image ? _jsx(NativeRichMediaCoverImg, {
40
+ url: cover.image,
41
+ position: "absolute",
42
+ inset: true,
43
+ backgroundColor: cover.background
44
+ }) : _jsxs(HintOverlay, {
45
+ "$coverBase": cover.background,
46
+ children: [_jsx(ScribbleIcon, {
47
+ color: hintColor
48
+ }), _jsx(HintText, {
49
+ "$color": hintColor,
50
+ children: _jsx(Lang, {
51
+ message: "DUMB.NATIVE_RICH_MEDIA_PREVIEW.SCRATCH_HERE"
42
52
  })
43
- }), cover.image ? _jsx(NativeRichMediaCoverImg, {
44
- url: cover.image,
45
- position: "absolute",
46
- inset: true,
47
- backgroundColor: cover.color || '#C7C7CC'
48
- }) : _jsxs(HintOverlay, {
49
- "$coverBase": coverBase,
50
- children: [_jsx(ScribbleIcon, {
51
- color: hintColor
52
- }), _jsx(HintText, {
53
- "$color": hintColor,
54
- children: _jsx(Lang, {
55
- message: "DUMB.NATIVE_RICH_MEDIA_PREVIEW.SCRATCH_HERE"
56
- })
57
- })]
58
53
  })]
59
- }), block.revealButton && _jsx(RevealButtonText, {
60
- "$color": withAlpha(cardText, 0.8),
61
- children: asText(block.revealButton)
62
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
63
- top: 16,
64
- right: 16
65
54
  })]
66
- })
55
+ }), revealButton && _jsx(RevealButtonText, {
56
+ "$color": revealButton.text.color,
57
+ "$background": revealButton.background,
58
+ "$radius": revealButton.border.radius,
59
+ "$borderColor": revealButton.border.color,
60
+ children: revealButton.text.text
61
+ }), block.showClose && _jsx(NativeRichMediaCloseChip, {
62
+ top: 16,
63
+ right: 16
64
+ })]
67
65
  });
68
66
  }
@@ -9,9 +9,22 @@ export declare const RewardSlot: import("styled-components").StyledComponent<"di
9
9
  export declare const HintOverlay: import("styled-components").StyledComponent<"div", any, {
10
10
  $coverBase: string;
11
11
  }, never>;
12
- export declare const HintText: import("styled-components").StyledComponent<"div", any, {
13
- $color: string;
14
- }, never>;
15
- export declare const RevealButtonText: import("styled-components").StyledComponent<"div", any, {
16
- $color: string;
12
+ export declare const HintText: import("styled-components").StyledComponent<typeof import("@pushwoosh/kit-typography").Footnote, any, {
13
+ $color?: string;
14
+ $align?: "center";
15
+ $clamp?: number;
16
+ $marginTop?: number;
17
17
  }, never>;
18
+ export declare const RevealButtonText: import("styled-components").StyledComponent<typeof import("@pushwoosh/kit-typography").Footnote, any, {
19
+ $color?: string;
20
+ $align?: "center";
21
+ $clamp?: number;
22
+ $marginTop?: number;
23
+ } & {
24
+ $align: string;
25
+ $marginTop: number;
26
+ } & {
27
+ $background: string;
28
+ $radius: number;
29
+ $borderColor: string;
30
+ }, "$marginTop" | "$align">;
@@ -1,4 +1,6 @@
1
1
  import styled from 'styled-components';
2
+ import { FontWeight } from '@pushwoosh/kit-constants';
3
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
2
4
  import { mixHex } from '../../helpers';
3
5
  import { Card as SharedCard } from '../shared/styles';
4
6
  export const Card = styled(SharedCard).attrs({
@@ -21,15 +23,20 @@ export const HintOverlay = styled.div.withConfig({
21
23
  })(["position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;background:", ";"], ({
22
24
  $coverBase
23
25
  }) => `linear-gradient(135deg, ${mixHex($coverBase, '#FFFFFF', 0.4)}, ${$coverBase} 45%, ${mixHex($coverBase, '#000000', 0.12)})`);
24
- export const HintText = styled.div.withConfig({
26
+ export const HintText = styled(NativeRichMediaText).withConfig({
25
27
  displayName: "HintText",
26
28
  componentId: "sc-nguevq-4"
27
- })(["font-size:14px;font-weight:600;color:", ";"], ({
28
- $color
29
- }) => $color);
30
- export const RevealButtonText = styled.div.withConfig({
29
+ })(["font-weight:", ";"], FontWeight.MEDIUM);
30
+ export const RevealButtonText = styled(NativeRichMediaText).attrs({
31
+ $align: 'center',
32
+ $marginTop: 14
33
+ }).withConfig({
31
34
  displayName: "RevealButtonText",
32
35
  componentId: "sc-nguevq-5"
33
- })(["margin-top:14px;text-align:center;font-size:15px;font-weight:600;color:", ";"], ({
34
- $color
35
- }) => $color);
36
+ })(["font-weight:", ";width:fit-content;margin-left:auto;margin-right:auto;background:", ";border-radius:", "px;padding:10px 16px;border:1px solid ", ";user-select:none;cursor:pointer;"], FontWeight.MEDIUM, ({
37
+ $background
38
+ }) => $background, ({
39
+ $radius
40
+ }) => $radius, ({
41
+ $borderColor
42
+ }) => $borderColor);