@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,49 +1,43 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Vertical } from '@pushwoosh/kit-helpers';
3
3
  import { Handle, Sheet } 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 NativeRichMediaSheetView(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(Sheet, {
18
- "$background": background,
19
- children: [_jsx(Handle, {}), block.image && _jsx(NativeRichMediaCoverImg, {
20
- url: block.image,
21
- margin: "26px 14px 0",
22
- height: 190,
23
- borderRadius: 18
24
- }), (block.title || block.message) && _jsxs(Vertical, {
25
- "$padding": (block.image ? '16px' : '20px') + ' 24px 0',
26
- "$gap": 6,
27
- children: [block.title && _jsx(NativeRichMediaPtLabel, {
28
- value: block.title,
29
- size: 22,
30
- weight: 800,
31
- fallbackColor: "#000000"
32
- }), block.message && _jsx(NativeRichMediaPtLabel, {
33
- value: block.message,
34
- size: 15,
35
- weight: 400,
36
- fallbackColor: SECONDARY_LABEL,
37
- align: "left",
38
- lineHeight: "20px"
39
- })]
40
- }), hasButtons && _jsx(NativeRichMediaCardButtons, {
41
- buttons: block.buttons,
42
- "$padding": "24px 20px 0"
43
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
44
- top: 16,
45
- right: 16
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(Sheet, {
19
+ "$background": block.background,
20
+ children: [_jsx(Handle, {}), block.image && _jsx(NativeRichMediaCoverImg, {
21
+ url: block.image,
22
+ margin: "26px 14px 0",
23
+ height: 190,
24
+ borderRadius: 18
25
+ }), (title.text || message.text) && _jsxs(Vertical, {
26
+ "$padding": (block.image ? '16px' : '20px') + ' 24px 0',
27
+ "$gap": 4,
28
+ children: [title.text && _jsx(NativeRichMediaTitle, {
29
+ "$color": title.color,
30
+ children: title.text
31
+ }), message.text && _jsx(NativeRichMediaText, {
32
+ "$color": message.color,
33
+ children: message.text
46
34
  })]
47
- })
35
+ }), hasButtons && _jsx(NativeRichMediaButtonList, {
36
+ buttons: buttons,
37
+ "$padding": "24px 20px 0"
38
+ }), block.showClose && _jsx(NativeRichMediaCloseChip, {
39
+ top: 16,
40
+ right: 16
41
+ })]
48
42
  });
49
43
  }
@@ -3,7 +3,7 @@ import { TERTIARY_LABEL } from '../../helpers';
3
3
  export const Sheet = styled.div.withConfig({
4
4
  displayName: "Sheet",
5
5
  componentId: "sc-17o8tnc-0"
6
- })(["position:absolute;left:0;right:0;bottom:0;border-radius:28px 28px 0 0;box-shadow:0 -16px 28px rgba(0,0,0,0.28);padding-bottom:50px;background:", ";"], ({
6
+ })(["position:relative;border-radius:28px 28px 0 0;box-shadow:0 -16px 28px rgba(0,0,0,0.28);padding-bottom:50px;background:", ";"], ({
7
7
  $background
8
8
  }) => $background);
9
9
  export const Handle = styled.div.withConfig({
@@ -2,62 +2,60 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment } from 'react';
3
3
  import { Card, Hub, Pointer, Ring, SegmentLabel, Tick, Wheel } from './styles';
4
4
  import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseChip';
5
- import { NativeRichMediaPtLabel } from '../../components/NativeRichMediaPtLabel';
6
- import { SEG_FALLBACK, asText, contrastOn, surfaceBackground, surfaceBaseHex, withAlpha } from '../../helpers';
7
- import { TemplateLayer } from '../../styles';
5
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
6
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
7
+ import { SEG_FALLBACK, asButtonValue, asTextValue, surfaceBackground } from '../../helpers';
8
8
  export function NativeRichMediaSpinwheelView(props) {
9
9
  const {
10
10
  block
11
11
  } = props;
12
- const baseHex = surfaceBaseHex(block.background) || '#FFFFFF';
13
- const cardText = contrastOn(baseHex);
14
12
  const segs = block.segments;
15
13
  const hasSegments = segs.length > 0;
16
14
  const per = hasSegments ? 360 / segs.length : 0;
17
15
  const fills = segs.map((s, i) => s.color || SEG_FALLBACK[i % SEG_FALLBACK.length]);
18
16
  const stops = fills.map((c, i) => `${c} ${i * per}deg ${(i + 1) * per}deg`).join(', ');
19
- return _jsx(TemplateLayer, {
20
- children: _jsxs(Card, {
21
- "$background": surfaceBackground(block.background, '#FFFFFF'),
22
- children: [block.title && _jsx(NativeRichMediaPtLabel, {
23
- value: block.title,
24
- size: 24,
25
- weight: 800,
26
- fallbackColor: cardText,
27
- align: "center"
28
- }), block.message && _jsx(NativeRichMediaPtLabel, {
29
- value: block.message,
30
- size: 15,
31
- weight: 400,
32
- fallbackColor: withAlpha(cardText, 0.72),
33
- align: "center",
34
- marginTop: 14,
35
- lineHeight: "20px"
36
- }), hasSegments && _jsxs(Wheel, {
37
- children: [_jsx(Ring, {
38
- "$stops": stops,
39
- children: segs.map((s, i) => {
40
- const theta = -90 + (i + 0.5) * per;
41
- return (
42
- // eslint-disable-next-line react/no-array-index-key
43
- _jsxs(Fragment, {
44
- children: [_jsx(Tick, {
45
- "$rotate": i * per - 180
46
- }), _jsx(SegmentLabel, {
47
- "$color": s.textColor || contrastOn(fills[i]),
48
- "$rotate": theta,
49
- children: asText(s.text)
50
- })]
51
- }, `spin-segment-${i}`)
52
- );
53
- })
54
- }), _jsx(Pointer, {}), _jsx(Hub, {
55
- children: asText(block.spinButton) || 'SPIN'
56
- })]
57
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
58
- top: 16,
59
- right: 16
17
+ const title = asTextValue(block.title);
18
+ const message = asTextValue(block.message);
19
+ const spinButton = asButtonValue(block.spinButton);
20
+ return _jsxs(Card, {
21
+ "$background": surfaceBackground(block.background, '#FFFFFF'),
22
+ children: [title.text && _jsx(NativeRichMediaTitle, {
23
+ "$color": title.color,
24
+ "$align": "center",
25
+ children: title.text
26
+ }), message.text && _jsx(NativeRichMediaText, {
27
+ "$color": message.color,
28
+ "$marginTop": 4,
29
+ "$align": "center",
30
+ children: message.text
31
+ }), hasSegments && _jsxs(Wheel, {
32
+ children: [_jsx(Ring, {
33
+ "$stops": stops,
34
+ children: segs.map((s, i) => {
35
+ const theta = -90 + (i + 0.5) * per;
36
+ const label = asTextValue(s.message);
37
+ return (
38
+ // eslint-disable-next-line react/no-array-index-key
39
+ _jsxs(Fragment, {
40
+ children: [_jsx(Tick, {
41
+ "$rotate": i * per - 180
42
+ }), _jsx(SegmentLabel, {
43
+ "$color": label.color,
44
+ "$rotate": theta,
45
+ children: label.text
46
+ })]
47
+ }, `spin-segment-${i}`)
48
+ );
49
+ })
50
+ }), _jsx(Pointer, {}), _jsx(Hub, {
51
+ "$background": spinButton === null || spinButton === void 0 ? void 0 : spinButton.background,
52
+ "$color": spinButton === null || spinButton === void 0 ? void 0 : spinButton.text.color,
53
+ "$borderColor": spinButton === null || spinButton === void 0 ? void 0 : spinButton.border.color,
54
+ children: (spinButton === null || spinButton === void 0 ? void 0 : spinButton.text.text) || 'SPIN'
60
55
  })]
61
- })
56
+ }), block.showClose && _jsx(NativeRichMediaCloseChip, {
57
+ top: 16,
58
+ right: 16
59
+ })]
62
60
  });
63
61
  }
@@ -11,9 +11,17 @@ export declare const Ring: import("styled-components").StyledComponent<"div", an
11
11
  export declare const Tick: import("styled-components").StyledComponent<"div", any, {
12
12
  $rotate: number;
13
13
  }, never>;
14
- export declare const SegmentLabel: import("styled-components").StyledComponent<"div", any, {
15
- $color: string;
14
+ export declare const SegmentLabel: import("styled-components").StyledComponent<typeof import("@pushwoosh/kit-typography").Footnote, any, {
15
+ $color?: string;
16
+ $align?: "center";
17
+ $clamp?: number;
18
+ $marginTop?: number;
19
+ } & {
16
20
  $rotate: number;
17
21
  }, never>;
18
22
  export declare const Pointer: import("styled-components").StyledComponent<"div", any, {}, never>;
19
- export declare const Hub: import("styled-components").StyledComponent<"div", any, {}, never>;
23
+ export declare const Hub: import("styled-components").StyledComponent<"div", any, {
24
+ $background?: string;
25
+ $color?: string;
26
+ $borderColor?: string;
27
+ }, never>;
@@ -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 { Card as SharedCard } from '../shared/styles';
3
5
  export const Card = styled(SharedCard).attrs({
4
6
  $padding: '28px 24px 24px'
@@ -9,32 +11,36 @@ export const Card = styled(SharedCard).attrs({
9
11
  export const Wheel = styled.div.withConfig({
10
12
  displayName: "Wheel",
11
13
  componentId: "sc-1tz3wky-1"
12
- })(["position:relative;margin-top:14px;width:289px;height:289px;"]);
14
+ })(["position:relative;margin:14px auto 0;width:289px;max-width:100%;aspect-ratio:1;container-type:inline-size;"]);
13
15
  export const Ring = styled.div.withConfig({
14
16
  displayName: "Ring",
15
17
  componentId: "sc-1tz3wky-2"
16
- })(["position:absolute;inset:30px;border-radius:50%;border:1px solid rgba(255,255,255,0.35);background:", ";"], ({
18
+ })(["position:absolute;inset:10.4cqw;border-radius:50%;border:1px solid rgba(255,255,255,0.35);background:", ";"], ({
17
19
  $stops
18
20
  }) => `conic-gradient(from 0deg, ${$stops})`);
19
21
  export const Tick = styled.div.withConfig({
20
22
  displayName: "Tick",
21
23
  componentId: "sc-1tz3wky-3"
22
- })(["position:absolute;left:50%;top:50%;width:1px;height:114.5px;background:rgba(255,255,255,0.35);transform-origin:0 0;transform:", ";"], ({
24
+ })(["position:absolute;left:50%;top:50%;width:1px;height:39.6cqw;background:rgba(255,255,255,0.35);transform-origin:0 0;transform:", ";"], ({
23
25
  $rotate
24
26
  }) => `rotate(${$rotate}deg)`);
25
- export const SegmentLabel = styled.div.withConfig({
27
+ export const SegmentLabel = styled(NativeRichMediaText).withConfig({
26
28
  displayName: "SegmentLabel",
27
29
  componentId: "sc-1tz3wky-4"
28
- })(["position:absolute;left:50%;top:50%;font-size:14px;font-weight:700;white-space:nowrap;max-width:86px;overflow:hidden;text-overflow:ellipsis;color:", ";transform:", ";"], ({
29
- $color
30
- }) => $color, ({
30
+ })(["position:absolute;left:50%;top:50%;font-size:4.2cqw;line-height:1.3;font-weight:", ";white-space:nowrap;max-width:29.8cqw;overflow:hidden;text-overflow:ellipsis;transform:", ";"], FontWeight.BOLD, ({
31
31
  $rotate
32
- }) => `translate(-50%,-50%) rotate(${$rotate}deg) translateX(63px)`);
32
+ }) => `translate(-50%,-50%) rotate(${$rotate}deg) translateX(21.8cqw)`);
33
33
  export const Pointer = styled.div.withConfig({
34
34
  displayName: "Pointer",
35
35
  componentId: "sc-1tz3wky-5"
36
- })(["position:absolute;top:4px;left:50%;transform:translateX(-50%);width:0;height:0;border-left:13px solid transparent;border-right:13px solid transparent;border-top:26px solid #0F0F0F;filter:drop-shadow(0 2px 3px rgba(0,0,0,0.3));z-index:3;"]);
36
+ })(["position:absolute;top:1.4cqw;left:50%;transform:translateX(-50%);width:0;height:0;border-left:4.5cqw solid transparent;border-right:4.5cqw solid transparent;border-top:9cqw solid #0F0F0F;filter:drop-shadow(0 2px 3px rgba(0,0,0,0.3));z-index:3;"]);
37
37
  export const Hub = styled.div.withConfig({
38
38
  displayName: "Hub",
39
39
  componentId: "sc-1tz3wky-6"
40
- })(["position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:72px;height:72px;border-radius:50%;background:#FFF;color:#000;display:flex;align-items:center;justify-content:center;font-size:17px;font-weight:800;box-shadow:0 3px 8px rgba(0,0,0,0.25);z-index:2;white-space:nowrap;overflow:hidden;padding:0 6px;"]);
40
+ })(["position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:24.9cqw;height:24.9cqw;border-radius:50%;background:", ";color:", ";", " display:flex;align-items:center;justify-content:center;font-size:4.9cqw;font-weight:", ";box-shadow:0 3px 8px rgba(0,0,0,0.25);z-index:2;white-space:nowrap;overflow:hidden;padding:0 6px;user-select:none;cursor:pointer;"], ({
41
+ $background
42
+ }) => $background || '#FFF', ({
43
+ $color
44
+ }) => $color || '#000', ({
45
+ $borderColor
46
+ }) => $borderColor ? `border: 2px solid ${$borderColor};` : '', FontWeight.BOLD);
@@ -1,50 +1,41 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { GradientOverlay, ProgressFill, ProgressRow, ProgressTrack, SubtitleText, TextBlock, TitleText } from './styles';
3
- import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseChip';
4
- import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
5
- import { PT, asText } from '../../helpers';
6
- import { ButtonRow, TemplateLayer } from '../../styles';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ProgressFill, ProgressRow, ProgressTrack } from './styles';
3
+ import { NativeRichMediaButtonList } from '../../components/NativeRichMediaButtonList';
4
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
5
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
6
+ import { asButtonList, asTextValue, clampIndex } from '../../helpers';
7
+ import { TextBlock } from '../shared/styles';
7
8
  export function NativeRichMediaStoriesView(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 _jsxs(TemplateLayer, {
17
- children: [_jsx(NativeRichMediaCoverImg, {
18
- url: item.image,
19
- position: "absolute",
20
- inset: true,
21
- backgroundColor: "#000"
22
- }), _jsx(GradientOverlay, {}), _jsx(ProgressRow, {
23
- "$top": PT.SAFE_TOP + 14,
16
+ const title = asTextValue(item.title);
17
+ const message = asTextValue(item.message);
18
+ const buttons = asButtonList(item.buttons);
19
+ return _jsxs(_Fragment, {
20
+ children: [_jsx(ProgressRow, {
24
21
  children: items.map((_, i) => _jsxs(ProgressTrack
25
22
  // eslint-disable-next-line react/no-array-index-key
26
23
  , {
27
- onClick: () => onNavigate(i),
28
24
  children: [i < idx && _jsx(ProgressFill, {
29
25
  "$full": true
30
26
  }), i === idx && _jsx(ProgressFill, {})]
31
27
  }, `stories-bar-${i}`))
32
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
33
- top: PT.SAFE_TOP + 14 + 3 + 10,
34
- right: 16
35
28
  }), _jsxs(TextBlock, {
36
- "$bottom": PT.SAFE_BOTTOM + 24,
37
- children: [item.title && _jsx(TitleText, {
38
- children: asText(item.title)
39
- }), item.subtitle && _jsx(SubtitleText, {
40
- children: asText(item.subtitle)
41
- }), item.button && item.url && _jsx(ButtonRow, {
42
- "$marginTop": 16,
43
- "$borderRadius": 26,
44
- "$background": "#FFF",
45
- "$color": "#0F0F0F",
46
- "$boxShadow": "0 6px 14px rgba(0,0,0,0.28)",
47
- children: asText(item.button)
29
+ children: [title.text && _jsx(NativeRichMediaTitle, {
30
+ "$color": title.color,
31
+ children: title.text
32
+ }), message.text && _jsx(NativeRichMediaText, {
33
+ "$color": message.color,
34
+ "$marginTop": 4,
35
+ children: message.text
36
+ }), buttons.length > 0 && _jsx(NativeRichMediaButtonList, {
37
+ "$margin": "16px 0 0",
38
+ buttons: buttons
48
39
  })]
49
40
  })]
50
41
  });
@@ -1,11 +1,5 @@
1
- export { TextBlock } from '../shared/styles';
2
- export declare const GradientOverlay: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export declare const ProgressRow: import("styled-components").StyledComponent<"div", any, {
4
- $top: number;
5
- }, never>;
1
+ export declare const ProgressRow: import("styled-components").StyledComponent<"div", any, {}, never>;
6
2
  export declare const ProgressTrack: import("styled-components").StyledComponent<"div", any, {}, never>;
7
3
  export declare const ProgressFill: import("styled-components").StyledComponent<"div", any, {
8
4
  $full?: boolean;
9
5
  }, never>;
10
- export declare const TitleText: import("styled-components").StyledComponent<"div", any, {}, never>;
11
- export declare const SubtitleText: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,30 +1,16 @@
1
1
  import styled from 'styled-components';
2
- export { TextBlock } from '../shared/styles';
3
- export const GradientOverlay = styled.div.withConfig({
4
- displayName: "GradientOverlay",
5
- componentId: "sc-qgnxqx-0"
6
- })(["position:absolute;left:0;right:0;bottom:0;top:55%;background:linear-gradient(180deg,rgba(0,0,0,0),rgba(0,0,0,0.75));"]);
2
+ import { EDGE_INSET } from '../../helpers';
7
3
  export const ProgressRow = styled.div.withConfig({
8
4
  displayName: "ProgressRow",
9
- componentId: "sc-qgnxqx-1"
10
- })(["position:absolute;left:12px;right:12px;display:flex;gap:4px;top:", "px;"], ({
11
- $top
12
- }) => $top);
5
+ componentId: "sc-qgnxqx-0"
6
+ })(["display:flex;gap:4px;margin:", "px 12px 0;"], EDGE_INSET);
13
7
  export const ProgressTrack = styled.div.withConfig({
14
8
  displayName: "ProgressTrack",
15
- componentId: "sc-qgnxqx-2"
16
- })(["flex:1;height:3px;border-radius:1.5px;background:rgba(255,255,255,0.3);overflow:hidden;cursor:pointer;"]);
9
+ componentId: "sc-qgnxqx-1"
10
+ })(["flex:1;height:3px;border-radius:1.5px;background:rgba(255,255,255,0.3);overflow:hidden;"]);
17
11
  export const ProgressFill = styled.div.withConfig({
18
12
  displayName: "ProgressFill",
19
- componentId: "sc-qgnxqx-3"
13
+ componentId: "sc-qgnxqx-2"
20
14
  })(["height:100%;background:#FFF;width:", ";"], ({
21
15
  $full
22
- }) => $full ? '100%' : '45%');
23
- export const TitleText = styled.div.withConfig({
24
- displayName: "TitleText",
25
- componentId: "sc-qgnxqx-4"
26
- })(["font-size:23px;font-weight:700;color:#FFF;line-height:1.25;"]);
27
- export const SubtitleText = styled.div.withConfig({
28
- displayName: "SubtitleText",
29
- componentId: "sc-qgnxqx-5"
30
- })(["font-size:14px;color:rgba(255,255,255,0.85);margin-top:6px;"]);
16
+ }) => $full ? '100%' : '45%');
@@ -2,5 +2,4 @@ import type { NativeRichMediaStoriesBlock } from '../../types';
2
2
  export type NativeRichMediaStoriesViewProps = {
3
3
  block: NativeRichMediaStoriesBlock;
4
4
  activeIndex: number;
5
- onNavigate: (index: number) => void;
6
5
  };
@@ -1,49 +1,29 @@
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 { NativeRichMediaMuteChip } from '../../components/NativeRichMediaMuteChip';
6
- import { NativeRichMediaPtLabel } from '../../components/NativeRichMediaPtLabel';
7
- import { PT, asText } from '../../helpers';
8
- import { ButtonRow, TemplateLayer } from '../../styles';
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { NativeRichMediaButtonList } from '../../components/NativeRichMediaButtonList';
3
+ import { NativeRichMediaText } from '../../components/NativeRichMediaText';
4
+ import { NativeRichMediaTitle } from '../../components/NativeRichMediaTitle';
5
+ import { asButtonList, asTextValue } from '../../helpers';
6
+ import { TextBlock } from '../shared/styles';
9
7
  export function NativeRichMediaVideoView(props) {
10
8
  const {
11
9
  block
12
10
  } = props;
13
- return _jsxs(TemplateLayer, {
14
- children: [_jsx(NativeRichMediaCoverImg, {
15
- url: block.poster,
16
- position: "absolute",
17
- inset: true,
18
- backgroundColor: "#000"
19
- }), _jsx(GradientOverlay, {}), _jsxs(TextBlock, {
20
- "$bottom": PT.SAFE_BOTTOM + 28,
21
- children: [block.title && _jsx(NativeRichMediaPtLabel, {
22
- value: block.title,
23
- size: 28,
24
- weight: 700,
25
- fallbackColor: "#FFFFFF"
26
- }), block.message && _jsx(NativeRichMediaPtLabel, {
27
- value: block.message,
28
- size: 16,
29
- weight: 400,
30
- fallbackColor: "rgba(255,255,255,0.85)",
31
- align: "left",
32
- marginTop: block.title ? 8 : undefined
33
- }), block.button && block.action && _jsx(ButtonRow, {
34
- "$marginTop": 20,
35
- "$borderRadius": 14,
36
- "$background": "#FFF",
37
- "$color": "#0F0F0F",
38
- children: asText(block.button)
11
+ const title = asTextValue(block.title);
12
+ const message = asTextValue(block.message);
13
+ const buttons = asButtonList(block.buttons);
14
+ return _jsx(_Fragment, {
15
+ children: _jsxs(TextBlock, {
16
+ children: [title.text && _jsx(NativeRichMediaTitle, {
17
+ "$color": title.color,
18
+ children: title.text
19
+ }), message.text && _jsx(NativeRichMediaText, {
20
+ "$color": message.color,
21
+ "$marginTop": title.text ? 4 : undefined,
22
+ children: message.text
23
+ }), buttons.length > 0 && _jsx(NativeRichMediaButtonList, {
24
+ "$margin": "20px 0 0",
25
+ buttons: buttons
39
26
  })]
40
- }), _jsx(NativeRichMediaMuteChip, {
41
- muted: block.muted,
42
- top: PT.SAFE_TOP + 12,
43
- left: 16
44
- }), block.showClose !== false && _jsx(NativeRichMediaCloseChip, {
45
- top: PT.SAFE_TOP + 12,
46
- right: 16
47
- })]
27
+ })
48
28
  });
49
29
  }
@@ -1,7 +1,7 @@
1
- export declare const GradientOverlay: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const TextBlock: import("styled-components").StyledComponent<"div", any, {
3
- $bottom: number;
1
+ export declare const GradientOverlay: import("styled-components").StyledComponent<"div", any, {
2
+ $topOffset?: string;
4
3
  }, never>;
4
+ export declare const TextBlock: import("styled-components").StyledComponent<"div", any, {}, never>;
5
5
  export declare const Card: import("styled-components").StyledComponent<"div", any, {
6
6
  $background: string;
7
7
  $padding: string;
@@ -1,18 +1,19 @@
1
1
  import styled from 'styled-components';
2
+ import { EDGE_INSET } from '../../helpers';
2
3
  export const GradientOverlay = styled.div.withConfig({
3
4
  displayName: "GradientOverlay",
4
5
  componentId: "sc-x5bn03-0"
5
- })(["position:absolute;left:0;right:0;bottom:0;top:45%;background:linear-gradient(180deg,rgba(0,0,0,0),rgba(0,0,0,0.75));"]);
6
+ })(["position:absolute;left:0;right:0;bottom:0;top:", ";background:linear-gradient(180deg,rgba(0,0,0,0),rgba(0,0,0,0.75));"], ({
7
+ $topOffset
8
+ }) => $topOffset ?? '45%');
6
9
  export const TextBlock = styled.div.withConfig({
7
10
  displayName: "TextBlock",
8
11
  componentId: "sc-x5bn03-1"
9
- })(["position:absolute;left:24px;right:24px;bottom:", "px;"], ({
10
- $bottom
11
- }) => $bottom);
12
+ })(["margin:0 ", "px ", "px;"], EDGE_INSET, EDGE_INSET);
12
13
  export const Card = styled.div.withConfig({
13
14
  displayName: "Card",
14
15
  componentId: "sc-x5bn03-2"
15
- })(["position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:337px;border-radius:24px;box-shadow:0 16px 28px rgba(0,0,0,0.28);padding:", ";background:", ";"], ({
16
+ })(["position:relative;margin:0 12px;border-radius:24px;box-shadow:0 16px 28px rgba(0,0,0,0.28);padding:", ";background:", ";"], ({
16
17
  $padding
17
18
  }) => $padding, ({
18
19
  $background
package/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export { EnhancedInput, SearchInput } from './EnhancedInput';
44
44
  export { Chip, type ChipProps, type ChipVariant } from './Chip';
45
45
  export { RichmediaPreview, useRichmediaHtml } from './RichmediaPreview';
46
46
  export { NativeRichMediaPreview, parseNativeRichMediaConfig, NATIVE_RICH_MEDIA_DISPLAY_TYPES } from './NativeRichMediaPreview';
47
- export type { NativeRichMediaConfig, NativeRichMediaDisplayType, NativeRichMediaText, NativeRichMediaAction, NativeRichMediaButton, NativeRichMediaReward, NativeRichMediaModalBlock, NativeRichMediaSheetBlock, NativeRichMediaCarouselBlock, NativeRichMediaCarouselItem, NativeRichMediaStoriesBlock, NativeRichMediaStoryItem, NativeRichMediaBannerBlock, NativeRichMediaFullscreenBlock, NativeRichMediaVideoBlock, NativeRichMediaPipBlock, NativeRichMediaScratchcardBlock, NativeRichMediaScratchcardCover, NativeRichMediaSpinwheelBlock, NativeRichMediaSpinwheelSegment, NativeRichMediaPreviewProps, } from './NativeRichMediaPreview';
47
+ export type { NativeRichMediaConfig, NativeRichMediaDisplayType, NativeRichMediaText, NativeRichMediaBorder, NativeRichMediaCover, NativeRichMediaAction, NativeRichMediaButton, NativeRichMediaReward, NativeRichMediaModalBlock, NativeRichMediaSheetBlock, NativeRichMediaCarouselBlock, NativeRichMediaStoriesBlock, NativeRichMediaBannerBlock, NativeRichMediaFullscreenBlock, NativeRichMediaVideoBlock, NativeRichMediaPipBlock, NativeRichMediaScratchcardBlock, NativeRichMediaSpinwheelBlock, NativeRichMediaPreviewProps, } from './NativeRichMediaPreview';
48
48
  export { RichMessageEditor, RichMessageViewer, type DynamicContent, } from './RichMessageEditor';
49
49
  export { FrequencyCappingEdit, FrequencyCappingReadonly, FrequencyCappingInApps, type LocalCapping, type CappingInAppBase, } from './FrequencyCapping';
50
50
  export { SendRateEdit, SendRateReadonly, type SendRateBase, type SendRateEditProps, type SendRateReadonlyProps, } from './SendRate';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.162",
3
+ "version": "1.1.164",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -1,3 +0,0 @@
1
- import { type ReactElement } from 'react';
2
- import type { NativeRichMediaCardButtonsProps } from './types';
3
- export declare function NativeRichMediaCardButtons(props: NativeRichMediaCardButtonsProps): ReactElement;
@@ -1,29 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export { NativeRichMediaCardButtons } from './NativeRichMediaCardButtons';
@@ -1 +0,0 @@
1
- export { NativeRichMediaCardButtons } from './NativeRichMediaCardButtons';
@@ -1,5 +0,0 @@
1
- import type { NativeRichMediaButton } from '../../types';
2
- export type NativeRichMediaCardButtonsProps = {
3
- buttons?: NativeRichMediaButton[];
4
- $padding: string;
5
- };
@@ -1,3 +0,0 @@
1
- import { type ReactElement } from 'react';
2
- import type { NativeRichMediaOverlayButtonsProps } from './types';
3
- export declare function NativeRichMediaOverlayButtons(props: NativeRichMediaOverlayButtonsProps): ReactElement;