@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.
- package/Modal/components/Modal/styles.js +3 -3
- package/NativeRichMediaPreview/NativeRichMediaPreview.d.ts +23 -4
- package/NativeRichMediaPreview/NativeRichMediaPreview.js +125 -63
- package/NativeRichMediaPreview/components/NativeRichMediaButtonList/NativeRichMediaButtonList.d.ts +3 -0
- package/NativeRichMediaPreview/components/NativeRichMediaButtonList/NativeRichMediaButtonList.js +24 -0
- package/NativeRichMediaPreview/components/NativeRichMediaButtonList/index.d.ts +1 -0
- package/NativeRichMediaPreview/components/NativeRichMediaButtonList/index.js +1 -0
- package/NativeRichMediaPreview/components/NativeRichMediaButtonList/types.d.ts +6 -0
- package/NativeRichMediaPreview/components/NativeRichMediaCloseChip/styles.js +4 -5
- package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/NativeRichMediaRewardPanel.js +26 -26
- package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/styles.d.ts +29 -2
- package/NativeRichMediaPreview/components/NativeRichMediaRewardPanel/styles.js +19 -4
- package/NativeRichMediaPreview/components/NativeRichMediaText/index.d.ts +1 -0
- package/NativeRichMediaPreview/components/NativeRichMediaText/index.js +1 -0
- package/NativeRichMediaPreview/components/NativeRichMediaText/styles.d.ts +7 -0
- package/NativeRichMediaPreview/components/NativeRichMediaText/styles.js +19 -0
- package/NativeRichMediaPreview/components/NativeRichMediaTitle/index.d.ts +1 -0
- package/NativeRichMediaPreview/components/NativeRichMediaTitle/index.js +1 -0
- package/NativeRichMediaPreview/components/NativeRichMediaTitle/styles.d.ts +12 -0
- package/NativeRichMediaPreview/components/NativeRichMediaTitle/styles.js +22 -0
- package/NativeRichMediaPreview/helpers.d.ts +22 -6
- package/NativeRichMediaPreview/helpers.js +45 -6
- package/NativeRichMediaPreview/icons/MutedIcon.svg +1 -1
- package/NativeRichMediaPreview/icons/SoundIcon.svg +1 -1
- package/NativeRichMediaPreview/index.d.ts +1 -1
- package/NativeRichMediaPreview/parseNativeRichMediaConfig.d.ts +3 -1
- package/NativeRichMediaPreview/parseNativeRichMediaConfig.js +74 -18
- package/NativeRichMediaPreview/styles.d.ts +7 -7
- package/NativeRichMediaPreview/styles.js +25 -23
- package/NativeRichMediaPreview/types.d.ts +180 -176
- package/NativeRichMediaPreview/views/NativeRichMediaBannerView/NativeRichMediaBannerView.js +31 -36
- package/NativeRichMediaPreview/views/NativeRichMediaBannerView/styles.d.ts +3 -4
- package/NativeRichMediaPreview/views/NativeRichMediaBannerView/styles.js +8 -11
- package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/NativeRichMediaCarouselView.js +31 -30
- package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/styles.d.ts +0 -2
- package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/styles.js +4 -12
- package/NativeRichMediaPreview/views/NativeRichMediaCarouselView/types.d.ts +0 -1
- package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/NativeRichMediaFullscreenView.js +26 -35
- package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/NativeRichMediaInvalidView.js +5 -3
- package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/styles.d.ts +9 -0
- package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/styles.js +10 -1
- package/NativeRichMediaPreview/views/NativeRichMediaModalView/NativeRichMediaModalView.js +33 -38
- package/NativeRichMediaPreview/views/NativeRichMediaPipView/NativeRichMediaPipView.js +30 -35
- package/NativeRichMediaPreview/views/NativeRichMediaPipView/styles.d.ts +7 -6
- package/NativeRichMediaPreview/views/NativeRichMediaPipView/styles.js +15 -13
- package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/NativeRichMediaScratchcardView.js +50 -52
- package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/styles.d.ts +18 -5
- package/NativeRichMediaPreview/views/NativeRichMediaScratchcardView/styles.js +15 -8
- package/NativeRichMediaPreview/views/NativeRichMediaSheetView/NativeRichMediaSheetView.js +31 -37
- package/NativeRichMediaPreview/views/NativeRichMediaSheetView/styles.js +1 -1
- package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/NativeRichMediaSpinwheelView.js +45 -47
- package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/styles.d.ts +11 -3
- package/NativeRichMediaPreview/views/NativeRichMediaSpinwheelView/styles.js +16 -10
- package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/NativeRichMediaStoriesView.js +24 -33
- package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/styles.d.ts +1 -7
- package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/styles.js +7 -21
- package/NativeRichMediaPreview/views/NativeRichMediaStoriesView/types.d.ts +0 -1
- package/NativeRichMediaPreview/views/NativeRichMediaVideoView/NativeRichMediaVideoView.js +22 -42
- package/NativeRichMediaPreview/views/shared/styles.d.ts +3 -3
- package/NativeRichMediaPreview/views/shared/styles.js +6 -5
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/NativeRichMediaCardButtons.d.ts +0 -3
- package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/NativeRichMediaCardButtons.js +0 -29
- package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/index.d.ts +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/index.js +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaCardButtons/types.d.ts +0 -5
- package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/NativeRichMediaOverlayButtons.d.ts +0 -3
- package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/NativeRichMediaOverlayButtons.js +0 -40
- package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/index.d.ts +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/index.js +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/types.d.ts +0 -4
- package/NativeRichMediaPreview/components/NativeRichMediaOverlayButtons/types.js +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/NativeRichMediaPreviewCanvas.d.ts +0 -3
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/NativeRichMediaPreviewCanvas.js +0 -10
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/index.d.ts +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/index.js +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/styles.d.ts +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/styles.js +0 -6
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/types.d.ts +0 -4
- package/NativeRichMediaPreview/components/NativeRichMediaPreviewCanvas/types.js +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/NativeRichMediaPtLabel.d.ts +0 -3
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/NativeRichMediaPtLabel.js +0 -27
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/index.d.ts +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/index.js +0 -1
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/styles.d.ts +0 -10
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/styles.js +0 -30
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/types.d.ts +0 -12
- package/NativeRichMediaPreview/components/NativeRichMediaPtLabel/types.js +0 -1
- package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/styles.d.ts +0 -1
- package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/styles.js +0 -1
- package/NativeRichMediaPreview/views/NativeRichMediaVideoView/styles.d.ts +0 -1
- package/NativeRichMediaPreview/views/NativeRichMediaVideoView/styles.js +0 -1
- /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:
|
|
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-
|
|
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-
|
|
29
|
-
})(["display:inline-block;width:7px;height:7px;border-radius:50%;margin:0 4.5px;
|
|
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)');
|
package/NativeRichMediaPreview/views/NativeRichMediaFullscreenView/NativeRichMediaFullscreenView.js
CHANGED
|
@@ -1,42 +1,33 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
})
|
|
38
|
-
top: PT.SAFE_TOP + 12,
|
|
39
|
-
right: 16
|
|
40
|
-
})]
|
|
31
|
+
})
|
|
41
32
|
});
|
|
42
33
|
}
|
package/NativeRichMediaPreview/views/NativeRichMediaInvalidView/NativeRichMediaInvalidView.js
CHANGED
|
@@ -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(
|
|
7
|
-
|
|
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;
|
|
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 {
|
|
4
|
+
import { NativeRichMediaButtonList } from '../../components/NativeRichMediaButtonList';
|
|
5
5
|
import { NativeRichMediaCloseChip } from '../../components/NativeRichMediaCloseChip';
|
|
6
6
|
import { NativeRichMediaCoverImg } from '../../components/NativeRichMediaCoverImg';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
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
|
|
15
|
-
const hasButtons =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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 {
|
|
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
|
|
14
|
-
const
|
|
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
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
$
|
|
3
|
-
$
|
|
2
|
+
$widthPercent: number;
|
|
3
|
+
$aspectRatio: number;
|
|
4
4
|
$radius: number;
|
|
5
|
-
$
|
|
6
|
-
$
|
|
7
|
-
$
|
|
8
|
-
$
|
|
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:
|
|
6
|
-
$
|
|
7
|
-
}) => $
|
|
8
|
-
$
|
|
9
|
-
}) => $
|
|
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
|
-
$
|
|
13
|
-
}) => $
|
|
14
|
-
$
|
|
15
|
-
}) => $
|
|
16
|
-
$
|
|
17
|
-
}) => $
|
|
18
|
-
$
|
|
19
|
-
}) => $
|
|
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 {
|
|
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
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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<"
|
|
13
|
-
$color
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
$
|
|
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.
|
|
26
|
+
export const HintText = styled(NativeRichMediaText).withConfig({
|
|
25
27
|
displayName: "HintText",
|
|
26
28
|
componentId: "sc-nguevq-4"
|
|
27
|
-
})(["font-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
})(["
|
|
34
|
-
$
|
|
35
|
-
}) => $
|
|
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);
|