@pushwoosh/dumb-components 1.0.56 → 1.0.58
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.
|
@@ -5,6 +5,7 @@ import { SilentPushPreview } from './components/SilentPushPreview';
|
|
|
5
5
|
import { PREVIEW_ICON_URL } from './constants';
|
|
6
6
|
import { getLocalizedContent } from './helpers';
|
|
7
7
|
import { PushBox, PushIcon, PushTitle, PushDescription } from './styles';
|
|
8
|
+
import { RichMessageViewer } from '../RichMessageEditor';
|
|
8
9
|
export function PushPreview(props) {
|
|
9
10
|
const {
|
|
10
11
|
pushPreset,
|
|
@@ -17,7 +18,7 @@ export function PushPreview(props) {
|
|
|
17
18
|
} = props;
|
|
18
19
|
const title = getLocalizedContent((pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.title) || (pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.localizedTitle), language) || appTitle;
|
|
19
20
|
const content = getLocalizedContent((pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.content) || (pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.localizedContent), language);
|
|
20
|
-
const icon =
|
|
21
|
+
const icon = (pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.icon) || appIcon || PREVIEW_ICON_URL;
|
|
21
22
|
const isLocked = !pushPreset || !content || view === 'silent';
|
|
22
23
|
if (isLoading) {
|
|
23
24
|
return React.createElement(PushBox, {
|
|
@@ -40,8 +41,13 @@ export function PushPreview(props) {
|
|
|
40
41
|
src: icon
|
|
41
42
|
}), React.createElement(Vertical, null, React.createElement(PushTitle, {
|
|
42
43
|
locked: isLocked
|
|
43
|
-
},
|
|
44
|
+
}, React.createElement(RichMessageViewer, {
|
|
45
|
+
value: title,
|
|
46
|
+
flat: true
|
|
47
|
+
})), React.createElement(PushDescription, {
|
|
44
48
|
view: view,
|
|
45
49
|
locked: !content
|
|
46
|
-
}, !content ? 'Message is empty…' :
|
|
50
|
+
}, !content ? 'Message is empty…' : React.createElement(RichMessageViewer, {
|
|
51
|
+
value: content
|
|
52
|
+
}))));
|
|
47
53
|
}
|
package/PushPreview/styles.js
CHANGED
|
@@ -25,7 +25,7 @@ export const IconContainer = styled.div.withConfig({
|
|
|
25
25
|
export const PushIcon = styled.img.withConfig({
|
|
26
26
|
displayName: "PushIcon",
|
|
27
27
|
componentId: "sc-185rvhg-2"
|
|
28
|
-
})(["width:24px;height:24px;
|
|
28
|
+
})(["width:24px;height:24px;border-radius:", ";"], ShapeRadius.CONTROL);
|
|
29
29
|
export const PushTitle = styled.div.withConfig({
|
|
30
30
|
displayName: "PushTitle",
|
|
31
31
|
componentId: "sc-185rvhg-3"
|
|
@@ -3,12 +3,12 @@ import { DynamicContentBracket, DynamicContentRoot } from './RichMessageViewer.s
|
|
|
3
3
|
import { isElement, string2content } from './slate/helpers';
|
|
4
4
|
export const RichMessageViewer = ({
|
|
5
5
|
value,
|
|
6
|
-
|
|
6
|
+
flat
|
|
7
7
|
}) => {
|
|
8
8
|
const content = useMemo(() => {
|
|
9
9
|
return Array.isArray(value) ? value : string2content(value);
|
|
10
10
|
}, [value]);
|
|
11
|
-
const separator =
|
|
11
|
+
const separator = flat ? ' ' : React.createElement("br", null);
|
|
12
12
|
return content.map((node, index) => {
|
|
13
13
|
const children = node.children.map((child, idx) => {
|
|
14
14
|
if (isElement(child) && child.type === 'dc') {
|