@pushwoosh/dumb-components 1.1.224 → 1.1.226
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/Switch/Switch.d.ts +1 -1
- package/Switch/Switch.js +9 -2
- package/Switch/__tests__/Switch.test.d.ts +1 -0
- package/Switch/__tests__/Switch.test.js +44 -0
- package/Switch/styles.js +4 -2
- package/Switch/types.d.ts +2 -1
- package/WhatsAppPreview/WhatsAppPreview.d.ts +1 -1
- package/WhatsAppPreview/WhatsAppPreview.js +31 -92
- package/WhatsAppPreview/__tests__/attachment.test.js +17 -11
- package/WhatsAppPreview/components/WhatsAppAttachment/WhatsAppAttachment.js +41 -38
- package/WhatsAppPreview/components/WhatsAppAttachment/styles.d.ts +11 -30
- package/WhatsAppPreview/components/WhatsAppAttachment/styles.js +23 -30
- package/WhatsAppPreview/components/WhatsAppAttachment/types.d.ts +0 -5
- package/WhatsAppPreview/components/WhatsAppMessageBubble/WhatsAppMessageBubble.d.ts +1 -1
- package/WhatsAppPreview/components/WhatsAppMessageBubble/WhatsAppMessageBubble.js +14 -33
- package/WhatsAppPreview/components/WhatsAppMessageBubble/styles.d.ts +2 -16
- package/WhatsAppPreview/components/WhatsAppMessageBubble/styles.js +5 -33
- package/WhatsAppPreview/constants.d.ts +10 -40
- package/WhatsAppPreview/constants.js +11 -41
- package/WhatsAppPreview/helpers.d.ts +3 -1
- package/WhatsAppPreview/helpers.js +12 -4
- package/WhatsAppPreview/icons/index.d.ts +0 -10
- package/WhatsAppPreview/icons/index.js +1 -11
- package/WhatsAppPreview/index.d.ts +1 -1
- package/WhatsAppPreview/polyglot/messages_ar.js +2 -3
- package/WhatsAppPreview/polyglot/messages_bn.js +2 -3
- package/WhatsAppPreview/polyglot/messages_de.js +2 -3
- package/WhatsAppPreview/polyglot/messages_en.js +2 -3
- package/WhatsAppPreview/polyglot/messages_es.js +2 -3
- package/WhatsAppPreview/polyglot/messages_fr.js +2 -3
- package/WhatsAppPreview/polyglot/messages_he.js +2 -3
- package/WhatsAppPreview/polyglot/messages_hi.js +2 -3
- package/WhatsAppPreview/polyglot/messages_ja.js +2 -3
- package/WhatsAppPreview/polyglot/messages_ko.js +2 -3
- package/WhatsAppPreview/polyglot/messages_pt.js +2 -3
- package/WhatsAppPreview/polyglot/messages_ru.js +2 -3
- package/WhatsAppPreview/polyglot/messages_th.js +2 -3
- package/WhatsAppPreview/polyglot/messages_zh.js +2 -3
- package/WhatsAppPreview/polyglot/types.d.ts +3 -2
- package/WhatsAppPreview/styles.d.ts +21 -14
- package/WhatsAppPreview/styles.js +22 -19
- package/WhatsAppPreview/types.d.ts +11 -35
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/WhatsAppPreview/components/WhatsAppChatHeader/WhatsAppChatHeader.d.ts +0 -4
- package/WhatsAppPreview/components/WhatsAppChatHeader/WhatsAppChatHeader.js +0 -39
- package/WhatsAppPreview/components/WhatsAppChatHeader/index.d.ts +0 -1
- package/WhatsAppPreview/components/WhatsAppChatHeader/index.js +0 -1
- package/WhatsAppPreview/components/WhatsAppChatHeader/styles.d.ts +0 -47
- package/WhatsAppPreview/components/WhatsAppChatHeader/styles.js +0 -37
- package/WhatsAppPreview/components/WhatsAppChatHeader/types.d.ts +0 -10
- package/WhatsAppPreview/components/WhatsAppChatHeader/types.js +0 -1
- package/WhatsAppPreview/components/WhatsAppDateChip/WhatsAppDateChip.d.ts +0 -4
- package/WhatsAppPreview/components/WhatsAppDateChip/WhatsAppDateChip.js +0 -28
- package/WhatsAppPreview/components/WhatsAppDateChip/index.d.ts +0 -1
- package/WhatsAppPreview/components/WhatsAppDateChip/index.js +0 -1
- package/WhatsAppPreview/components/WhatsAppDateChip/styles.d.ts +0 -6
- package/WhatsAppPreview/components/WhatsAppDateChip/styles.js +0 -6
- package/WhatsAppPreview/components/WhatsAppDateChip/types.d.ts +0 -6
- package/WhatsAppPreview/components/WhatsAppDateChip/types.js +0 -1
- package/WhatsAppPreview/components/WhatsAppStatusBar/WhatsAppStatusBar.d.ts +0 -4
- package/WhatsAppPreview/components/WhatsAppStatusBar/WhatsAppStatusBar.js +0 -18
- package/WhatsAppPreview/components/WhatsAppStatusBar/index.d.ts +0 -1
- package/WhatsAppPreview/components/WhatsAppStatusBar/index.js +0 -1
- package/WhatsAppPreview/components/WhatsAppStatusBar/styles.d.ts +0 -69
- package/WhatsAppPreview/components/WhatsAppStatusBar/styles.js +0 -47
- package/WhatsAppPreview/components/WhatsAppStatusBar/types.d.ts +0 -5
- package/WhatsAppPreview/components/WhatsAppStatusBar/types.js +0 -1
- package/WhatsAppPreview/icons/WhatsAppAvatarIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppBackIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppBatteryIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppCallIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppMenuIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppSignalIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppTickIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppTicksIcon.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppWallpaperPattern.svg +0 -1
- package/WhatsAppPreview/icons/WhatsAppWifiIcon.svg +0 -1
|
@@ -1,46 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { WhatsAppTickIcon, WhatsAppTicksIcon } from '../../icons';
|
|
2
|
+
import { BubbleText } from './styles';
|
|
3
|
+
import { drawableAttachments } from '../../helpers';
|
|
4
|
+
import { Bubble } from '../../styles';
|
|
6
5
|
import { WhatsAppAttachment } from '../WhatsAppAttachment';
|
|
7
6
|
import { WhatsAppFormattedText } from '../WhatsAppFormattedText';
|
|
8
|
-
/** Single chat bubble:
|
|
7
|
+
/** Single chat bubble: attachments on top, message body underneath. */
|
|
9
8
|
export function WhatsAppMessageBubble(props) {
|
|
10
9
|
const {
|
|
11
10
|
message
|
|
12
11
|
} = props;
|
|
13
12
|
const {
|
|
14
|
-
direction,
|
|
15
13
|
text = '',
|
|
16
|
-
content
|
|
17
|
-
attachment,
|
|
18
|
-
time,
|
|
19
|
-
status
|
|
14
|
+
content
|
|
20
15
|
} = message;
|
|
21
|
-
const showTicks = direction === 'outgoing' && Boolean(status);
|
|
22
16
|
const hasBody = Boolean(text || content);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"$sizes": "minmax(0, 1fr)",
|
|
33
|
-
children: _jsxs(BubbleBox, {
|
|
34
|
-
"$direction": direction,
|
|
35
|
-
children: [drawnAttachment && _jsx(WhatsAppAttachment, {
|
|
36
|
-
attachment: drawnAttachment,
|
|
37
|
-
hasCaption: hasBody,
|
|
38
|
-
meta: isMediaOnly ? meta : undefined
|
|
39
|
-
}), hasBody && _jsx(BubbleText, {
|
|
40
|
-
children: content ?? _jsx(WhatsAppFormattedText, {
|
|
41
|
-
text: text
|
|
42
|
-
})
|
|
43
|
-
}), !isMediaOnly && meta]
|
|
44
|
-
})
|
|
17
|
+
const attachments = drawableAttachments(message);
|
|
18
|
+
return _jsxs(Bubble, {
|
|
19
|
+
children: [attachments.map((attachment, index) => _jsx(WhatsAppAttachment, {
|
|
20
|
+
attachment: attachment
|
|
21
|
+
}, `${attachment.name}:${attachment.source}:${String(index)}`)), hasBody && _jsx(BubbleText, {
|
|
22
|
+
children: content ?? _jsx(WhatsAppFormattedText, {
|
|
23
|
+
text: text
|
|
24
|
+
})
|
|
25
|
+
})]
|
|
45
26
|
});
|
|
46
27
|
}
|
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
import type { WhatsAppMessageDirection } from '../../types';
|
|
2
|
-
export declare const BubbleBox: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
-
$direction: WhatsAppMessageDirection;
|
|
4
|
-
}, never>;
|
|
5
1
|
export declare const BubbleText: import("styled-components").StyledComponent<"span", any, {
|
|
6
2
|
$color?: string | undefined;
|
|
7
3
|
$uppercase?: boolean | undefined;
|
|
8
4
|
$ellipsis?: boolean | undefined;
|
|
9
5
|
$variant?: import("@pushwoosh/kit-typography").TypographyVariant | undefined;
|
|
10
|
-
} & {
|
|
11
|
-
$color: "#111B21";
|
|
12
|
-
}, "$color">;
|
|
13
|
-
export declare const BubbleMeta: import("styled-components").StyledComponent<"span", any, {
|
|
14
|
-
$color?: string | undefined;
|
|
15
|
-
$uppercase?: boolean | undefined;
|
|
16
|
-
$ellipsis?: boolean | undefined;
|
|
17
|
-
$variant?: import("@pushwoosh/kit-typography").TypographyVariant | undefined;
|
|
18
6
|
} & {
|
|
19
7
|
$variant: "footnote";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
$overlaid?: boolean;
|
|
23
|
-
}, "$variant">;
|
|
8
|
+
$color: import("@pushwoosh/kit-constants").Color;
|
|
9
|
+
}, "$color" | "$variant">;
|
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
import styled
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { WHATSAPP_COLOR } from '../../constants';
|
|
5
|
-
export const BubbleBox = styled.div.withConfig({
|
|
6
|
-
displayName: "BubbleBox",
|
|
7
|
-
componentId: "sc-va3yjo-0"
|
|
8
|
-
})(["display:flow-root;max-width:82%;padding:6px 8px 7px;box-shadow:0 1px 0.5px ", ";overflow-wrap:anywhere;", ""], WHATSAPP_COLOR.BUBBLE_SHADOW, ({
|
|
9
|
-
$direction
|
|
10
|
-
}) => $direction === 'outgoing' ? css(["border-radius:", " 2px ", " ", ";background:", ";"], ShapeRadius.SECTION, ShapeRadius.SECTION, ShapeRadius.SECTION, WHATSAPP_COLOR.OUTGOING_BUBBLE) : css(["border-radius:2px ", " ", " ", ";background:", ";"], ShapeRadius.SECTION, ShapeRadius.SECTION, ShapeRadius.SECTION, WHATSAPP_COLOR.INCOMING_BUBBLE));
|
|
11
|
-
export const BubbleText = styled(Text).attrs({
|
|
12
|
-
$color: WHATSAPP_COLOR.BUBBLE_TEXT
|
|
13
|
-
}).withConfig({
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { PreviewText } from '../../styles';
|
|
3
|
+
export const BubbleText = styled(PreviewText).withConfig({
|
|
14
4
|
displayName: "BubbleText",
|
|
15
|
-
componentId: "sc-va3yjo-
|
|
16
|
-
})(["white-space:pre-wrap;"]);
|
|
17
|
-
export const BubbleMeta = styled(Text).attrs({
|
|
18
|
-
$variant: 'footnote'
|
|
19
|
-
}).withConfig({
|
|
20
|
-
displayName: "BubbleMeta",
|
|
21
|
-
componentId: "sc-va3yjo-2"
|
|
22
|
-
})(["display:inline-flex;align-items:center;gap:3px;color:", ";", " svg{display:block;color:", ";}"], ({
|
|
23
|
-
$overlaid
|
|
24
|
-
}) => $overlaid ? 'inherit' : WHATSAPP_COLOR.BUBBLE_META, ({
|
|
25
|
-
$overlaid
|
|
26
|
-
}) => !$overlaid && css(["float:right;margin:6px 0 -2px 8px;"]), ({
|
|
27
|
-
$read,
|
|
28
|
-
$overlaid
|
|
29
|
-
}) => {
|
|
30
|
-
if ($read) {
|
|
31
|
-
return WHATSAPP_COLOR.READ_TICK;
|
|
32
|
-
}
|
|
33
|
-
return $overlaid ? 'inherit' : WHATSAPP_COLOR.BUBBLE_META;
|
|
34
|
-
});
|
|
5
|
+
componentId: "sc-va3yjo-0"
|
|
6
|
+
})(["white-space:pre-wrap;"]);
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
/** Colours of the replicated WhatsApp
|
|
1
|
+
/** Colours of the replicated WhatsApp bubble; they are WhatsApp's, not Pushwoosh design tokens. */
|
|
2
2
|
export declare const WHATSAPP_COLOR: {
|
|
3
|
-
readonly DEVICE_SHELL: "#DFE2E5";
|
|
4
|
-
readonly DEVICE_EDGE: "#C7CCD1";
|
|
5
|
-
readonly SCREEN: "#EFE7DE";
|
|
6
|
-
readonly HEADER: "#F6F3EF";
|
|
7
|
-
readonly HEADER_BORDER: "#DAD5CF";
|
|
8
|
-
readonly ISLAND: "#2B2F33";
|
|
9
|
-
readonly STATUS_BAR: "#0B0C0D";
|
|
10
|
-
readonly TITLE: "#111B21";
|
|
11
|
-
readonly SUBTITLE: "#667781";
|
|
12
|
-
readonly ACTION: "#3B4A54";
|
|
13
|
-
readonly AVATAR: "#CFD6DB";
|
|
14
|
-
readonly AVATAR_GLYPH: "#FFFFFF";
|
|
15
3
|
readonly INCOMING_BUBBLE: "#FFFFFF";
|
|
16
4
|
readonly MEDIA_BACKDROP: "#0B141A";
|
|
17
5
|
readonly MEDIA_META: "#FFFFFF";
|
|
@@ -19,36 +7,18 @@ export declare const WHATSAPP_COLOR: {
|
|
|
19
7
|
readonly PLAY_BUTTON: "rgba(255, 255, 255, 0.85)";
|
|
20
8
|
readonly PLAY_GLYPH: "#111B21";
|
|
21
9
|
readonly DOCUMENT_CARD: "#F5F6F6";
|
|
22
|
-
readonly
|
|
23
|
-
readonly DOCUMENT_TEXT: "#2E7CD6";
|
|
24
|
-
readonly DOCUMENT_GENERIC: "#8696A0";
|
|
10
|
+
readonly DOCUMENT_GLYPH: "#8696A0";
|
|
25
11
|
readonly OUTGOING_BUBBLE: "#D9FDD3";
|
|
26
|
-
readonly BUBBLE_TEXT: "#111B21";
|
|
27
|
-
readonly BUBBLE_META: "#667781";
|
|
28
|
-
readonly BUBBLE_SHADOW: "rgba(11, 20, 26, 0.13)";
|
|
29
|
-
readonly READ_TICK: "#53BDEB";
|
|
30
|
-
readonly DATE_CHIP_TEXT: "#54656F";
|
|
31
|
-
readonly WALLPAPER_INK: "#D8CCBD";
|
|
32
12
|
};
|
|
33
|
-
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const
|
|
37
|
-
export declare const
|
|
38
|
-
/** Status bar geometry at {@link WHATSAPP_SCREEN_WIDTH}; a narrower device gets the same layout scaled down. */
|
|
39
|
-
export declare const WHATSAPP_STATUS_BAR: {
|
|
40
|
-
readonly HEIGHT: 44;
|
|
41
|
-
readonly PADDING_LEFT: 28;
|
|
42
|
-
readonly PADDING_RIGHT: 22;
|
|
43
|
-
readonly CLOCK_FONT_SIZE: 14;
|
|
44
|
-
readonly ISLAND_WIDTH: 92;
|
|
45
|
-
readonly ISLAND_HEIGHT: 26;
|
|
46
|
-
readonly ISLAND_TOP: 8;
|
|
47
|
-
readonly INDICATOR_GAP: 5;
|
|
48
|
-
readonly INDICATOR_HEIGHT: 12;
|
|
49
|
-
};
|
|
50
|
-
export declare const WHATSAPP_STATUS_BAR_TIME = "12:02";
|
|
13
|
+
/** Bubble geometry from the design: 280px of content inside a 12px padding and a 1px border, border-box. */
|
|
14
|
+
export declare const WHATSAPP_BUBBLE_WIDTH = 306;
|
|
15
|
+
export declare const WHATSAPP_BUBBLE_PADDING = 12;
|
|
16
|
+
export declare const WHATSAPP_BACKDROP_PADDING = 24;
|
|
17
|
+
export declare const WHATSAPP_BACKDROP_WIDTH: number;
|
|
51
18
|
export declare const WHATSAPP_MEDIA_MAX_HEIGHT = 320;
|
|
19
|
+
/** A tiny or very wide file still has to fit the duration badge, so media never draws thinner than this. */
|
|
20
|
+
export declare const WHATSAPP_MEDIA_MIN_HEIGHT = 48;
|
|
21
|
+
export declare const WHATSAPP_MEDIA_RADIUS = 4;
|
|
52
22
|
export declare const WHATSAPP_ATTACHMENT_EXTENSIONS: {
|
|
53
23
|
readonly image: string[];
|
|
54
24
|
readonly video: string[];
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
/** Colours of the replicated WhatsApp
|
|
1
|
+
/** Colours of the replicated WhatsApp bubble; they are WhatsApp's, not Pushwoosh design tokens. */
|
|
2
2
|
export const WHATSAPP_COLOR = {
|
|
3
|
-
DEVICE_SHELL: '#DFE2E5',
|
|
4
|
-
DEVICE_EDGE: '#C7CCD1',
|
|
5
|
-
SCREEN: '#EFE7DE',
|
|
6
|
-
HEADER: '#F6F3EF',
|
|
7
|
-
HEADER_BORDER: '#DAD5CF',
|
|
8
|
-
ISLAND: '#2B2F33',
|
|
9
|
-
STATUS_BAR: '#0B0C0D',
|
|
10
|
-
TITLE: '#111B21',
|
|
11
|
-
SUBTITLE: '#667781',
|
|
12
|
-
ACTION: '#3B4A54',
|
|
13
|
-
AVATAR: '#CFD6DB',
|
|
14
|
-
AVATAR_GLYPH: '#FFFFFF',
|
|
15
3
|
INCOMING_BUBBLE: '#FFFFFF',
|
|
16
4
|
MEDIA_BACKDROP: '#0B141A',
|
|
17
5
|
MEDIA_META: '#FFFFFF',
|
|
@@ -19,36 +7,18 @@ export const WHATSAPP_COLOR = {
|
|
|
19
7
|
PLAY_BUTTON: 'rgba(255, 255, 255, 0.85)',
|
|
20
8
|
PLAY_GLYPH: '#111B21',
|
|
21
9
|
DOCUMENT_CARD: '#F5F6F6',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
DOCUMENT_GENERIC: '#8696A0',
|
|
25
|
-
OUTGOING_BUBBLE: '#D9FDD3',
|
|
26
|
-
BUBBLE_TEXT: '#111B21',
|
|
27
|
-
BUBBLE_META: '#667781',
|
|
28
|
-
BUBBLE_SHADOW: 'rgba(11, 20, 26, 0.13)',
|
|
29
|
-
READ_TICK: '#53BDEB',
|
|
30
|
-
DATE_CHIP_TEXT: '#54656F',
|
|
31
|
-
WALLPAPER_INK: '#D8CCBD'
|
|
10
|
+
DOCUMENT_GLYPH: '#8696A0',
|
|
11
|
+
OUTGOING_BUBBLE: '#D9FDD3'
|
|
32
12
|
};
|
|
33
|
-
|
|
34
|
-
export const
|
|
35
|
-
export const
|
|
36
|
-
export const
|
|
37
|
-
export const
|
|
38
|
-
/** Status bar geometry at {@link WHATSAPP_SCREEN_WIDTH}; a narrower device gets the same layout scaled down. */
|
|
39
|
-
export const WHATSAPP_STATUS_BAR = {
|
|
40
|
-
HEIGHT: 44,
|
|
41
|
-
PADDING_LEFT: 28,
|
|
42
|
-
PADDING_RIGHT: 22,
|
|
43
|
-
CLOCK_FONT_SIZE: 14,
|
|
44
|
-
ISLAND_WIDTH: 92,
|
|
45
|
-
ISLAND_HEIGHT: 26,
|
|
46
|
-
ISLAND_TOP: 8,
|
|
47
|
-
INDICATOR_GAP: 5,
|
|
48
|
-
INDICATOR_HEIGHT: 12
|
|
49
|
-
};
|
|
50
|
-
export const WHATSAPP_STATUS_BAR_TIME = '12:02';
|
|
13
|
+
/** Bubble geometry from the design: 280px of content inside a 12px padding and a 1px border, border-box. */
|
|
14
|
+
export const WHATSAPP_BUBBLE_WIDTH = 306;
|
|
15
|
+
export const WHATSAPP_BUBBLE_PADDING = 12;
|
|
16
|
+
export const WHATSAPP_BACKDROP_PADDING = 24;
|
|
17
|
+
export const WHATSAPP_BACKDROP_WIDTH = WHATSAPP_BUBBLE_WIDTH + WHATSAPP_BACKDROP_PADDING * 2;
|
|
51
18
|
export const WHATSAPP_MEDIA_MAX_HEIGHT = 320;
|
|
19
|
+
/** A tiny or very wide file still has to fit the duration badge, so media never draws thinner than this. */
|
|
20
|
+
export const WHATSAPP_MEDIA_MIN_HEIGHT = 48;
|
|
21
|
+
export const WHATSAPP_MEDIA_RADIUS = 4;
|
|
52
22
|
const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
|
|
53
23
|
const VIDEO_EXTENSIONS = ['mp4', 'mov', 'webm', '3gp'];
|
|
54
24
|
export const WHATSAPP_ATTACHMENT_EXTENSIONS = {
|
|
@@ -2,12 +2,14 @@ import type { WhatsAppTextNode } from './components/WhatsAppFormattedText/types'
|
|
|
2
2
|
import type { WhatsAppAttachment, WhatsAppAttachmentKind, WhatsAppMessage } from './types';
|
|
3
3
|
/** Splits WhatsApp markup (`*bold*`, `_italic_`, `~strike~`, backtick monospace) into a render tree. */
|
|
4
4
|
export declare function parseWhatsAppMarkup(text: string): WhatsAppTextNode[];
|
|
5
|
-
/**
|
|
5
|
+
/** File type shown on a document card: the name extension, or the MIME subtype when the name carries none. */
|
|
6
6
|
export declare function getAttachmentExtension(attachment: WhatsAppAttachment): string;
|
|
7
7
|
/** Picks how the attachment is drawn: explicit `kind` first, then the MIME type, then the extension. */
|
|
8
8
|
export declare function resolveAttachmentKind(attachment: WhatsAppAttachment): WhatsAppAttachmentKind;
|
|
9
9
|
/** Whether the message has anything to show; a bubble with neither body nor file content is not drawn at all. */
|
|
10
10
|
export declare function isMessageDrawable(message: WhatsAppMessage): boolean;
|
|
11
|
+
/** Attachments that have something to render; a file without a source is skipped. */
|
|
12
|
+
export declare function drawableAttachments(message: WhatsAppMessage): WhatsAppAttachment[];
|
|
11
13
|
/** File size the way WhatsApp writes it on a document card: `912 B`, `68 kB`, `1.4 MB`. */
|
|
12
14
|
export declare function formatAttachmentSize(size: number): string;
|
|
13
15
|
/** Video length as the `m:ss` badge of a WhatsApp video bubble. */
|
|
@@ -55,13 +55,17 @@ export function parseWhatsAppMarkup(text) {
|
|
|
55
55
|
flush();
|
|
56
56
|
return nodes;
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
58
|
+
/** File type shown on a document card: the name extension, or the MIME subtype when the name carries none. */
|
|
59
59
|
export function getAttachmentExtension(attachment) {
|
|
60
60
|
const {
|
|
61
|
-
name
|
|
61
|
+
name,
|
|
62
|
+
mimeType = ''
|
|
62
63
|
} = attachment;
|
|
63
64
|
const dot = name.lastIndexOf('.');
|
|
64
|
-
|
|
65
|
+
if (dot > 0) {
|
|
66
|
+
return name.slice(dot + 1).toLowerCase();
|
|
67
|
+
}
|
|
68
|
+
return mimeType.split('/')[1]?.toLowerCase() || '';
|
|
65
69
|
}
|
|
66
70
|
/** Picks how the attachment is drawn: explicit `kind` first, then the MIME type, then the extension. */
|
|
67
71
|
export function resolveAttachmentKind(attachment) {
|
|
@@ -86,7 +90,11 @@ export function resolveAttachmentKind(attachment) {
|
|
|
86
90
|
}
|
|
87
91
|
/** Whether the message has anything to show; a bubble with neither body nor file content is not drawn at all. */
|
|
88
92
|
export function isMessageDrawable(message) {
|
|
89
|
-
return Boolean(message.text || message.content || message.
|
|
93
|
+
return Boolean(message.text || message.content || drawableAttachments(message).length);
|
|
94
|
+
}
|
|
95
|
+
/** Attachments that have something to render; a file without a source is skipped. */
|
|
96
|
+
export function drawableAttachments(message) {
|
|
97
|
+
return (message.attachments || []).filter(attachment => attachment.source);
|
|
90
98
|
}
|
|
91
99
|
/** File size the way WhatsApp writes it on a document card: `912 B`, `68 kB`, `1.4 MB`. */
|
|
92
100
|
export function formatAttachmentSize(size) {
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
export { default as WhatsAppAvatarIcon } from './WhatsAppAvatarIcon.svg';
|
|
2
|
-
export { default as WhatsAppBackIcon } from './WhatsAppBackIcon.svg';
|
|
3
|
-
export { default as WhatsAppBatteryIcon } from './WhatsAppBatteryIcon.svg';
|
|
4
|
-
export { default as WhatsAppCallIcon } from './WhatsAppCallIcon.svg';
|
|
5
1
|
export { default as WhatsAppDocumentIcon } from './WhatsAppDocumentIcon.svg';
|
|
6
|
-
export { default as WhatsAppMenuIcon } from './WhatsAppMenuIcon.svg';
|
|
7
2
|
export { default as WhatsAppPlayIcon } from './WhatsAppPlayIcon.svg';
|
|
8
|
-
export { default as WhatsAppSignalIcon } from './WhatsAppSignalIcon.svg';
|
|
9
|
-
export { default as WhatsAppTickIcon } from './WhatsAppTickIcon.svg';
|
|
10
|
-
export { default as WhatsAppTicksIcon } from './WhatsAppTicksIcon.svg';
|
|
11
3
|
export { default as WhatsAppVideoIcon } from './WhatsAppVideoIcon.svg';
|
|
12
|
-
export { default as WhatsAppWallpaperPattern } from './WhatsAppWallpaperPattern.svg';
|
|
13
|
-
export { default as WhatsAppWifiIcon } from './WhatsAppWifiIcon.svg';
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
export { default as WhatsAppAvatarIcon } from './WhatsAppAvatarIcon.svg';
|
|
2
|
-
export { default as WhatsAppBackIcon } from './WhatsAppBackIcon.svg';
|
|
3
|
-
export { default as WhatsAppBatteryIcon } from './WhatsAppBatteryIcon.svg';
|
|
4
|
-
export { default as WhatsAppCallIcon } from './WhatsAppCallIcon.svg';
|
|
5
1
|
export { default as WhatsAppDocumentIcon } from './WhatsAppDocumentIcon.svg';
|
|
6
|
-
export { default as WhatsAppMenuIcon } from './WhatsAppMenuIcon.svg';
|
|
7
2
|
export { default as WhatsAppPlayIcon } from './WhatsAppPlayIcon.svg';
|
|
8
|
-
export { default as
|
|
9
|
-
export { default as WhatsAppTickIcon } from './WhatsAppTickIcon.svg';
|
|
10
|
-
export { default as WhatsAppTicksIcon } from './WhatsAppTicksIcon.svg';
|
|
11
|
-
export { default as WhatsAppVideoIcon } from './WhatsAppVideoIcon.svg';
|
|
12
|
-
export { default as WhatsAppWallpaperPattern } from './WhatsAppWallpaperPattern.svg';
|
|
13
|
-
export { default as WhatsAppWifiIcon } from './WhatsAppWifiIcon.svg';
|
|
3
|
+
export { default as WhatsAppVideoIcon } from './WhatsAppVideoIcon.svg';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { WhatsAppPreview } from './WhatsAppPreview';
|
|
2
|
-
export type { WhatsAppAttachment, WhatsAppAttachmentKind, WhatsAppMessage,
|
|
2
|
+
export type { WhatsAppAttachment, WhatsAppAttachmentKind, WhatsAppMessage, WhatsAppPreviewProps, } from './types';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'الرسالة فارغة…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'اليوم'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} صفحة',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'الرسالة فارغة…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'বার্তাটি খালি…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'আজ'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}}টি পৃষ্ঠা',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'বার্তাটি খালি…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Die Nachricht ist leer…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'Heute'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} {{count | pluralize: "Seite", "Seiten"}}',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Die Nachricht ist leer…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Message is empty…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'Today'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} {{count | pluralize: "page", "pages"}}',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Message is empty…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'El mensaje está vacío…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'Hoy'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} {{count | pluralize: "página", "páginas"}}',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'El mensaje está vacío…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Le message est vide…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'Aujourd’hui'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} {{count | pluralize: "page", "pages"}}',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Le message est vide…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'ההודעה ריקה…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'היום'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} עמודים',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'ההודעה ריקה…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'संदेश खाली है…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'आज'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} पृष्ठ',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'संदेश खाली है…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'メッセージが空です…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': '今日'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} ページ',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'メッセージが空です…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': '메시지가 비어 있습니다…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': '오늘'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}}페이지',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': '메시지가 비어 있습니다…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'A mensagem está vazia…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'Hoje'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} {{count | pluralize: "página", "páginas"}}',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'A mensagem está vazia…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Сообщение пустое…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'Сегодня'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} {{count | pluralize: "страница", "страницы", "страниц"}}',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'Сообщение пустое…'
|
|
5
4
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messages = {
|
|
2
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'ข้อความว่างเปล่า…'
|
|
4
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': 'วันนี้'
|
|
2
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': '{{count}} หน้า',
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.EMPTY': 'ข้อความว่างเปล่า…'
|
|
5
4
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NoParams } from '../../polyglot';
|
|
2
2
|
export type WhatsAppPreviewMessages = {
|
|
3
|
-
'DUMB.WHATSAPP_PREVIEW.
|
|
3
|
+
'DUMB.WHATSAPP_PREVIEW.DOCUMENT_PAGES': {
|
|
4
|
+
count: number;
|
|
5
|
+
};
|
|
4
6
|
'DUMB.WHATSAPP_PREVIEW.EMPTY': NoParams;
|
|
5
|
-
'DUMB.WHATSAPP_PREVIEW.TODAY': NoParams;
|
|
6
7
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
2
|
+
export declare const Backdrop: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
2
3
|
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
|
|
3
4
|
$alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
4
5
|
$gap?: import("@pushwoosh/kit-helpers/styled-helpers").StrNum | undefined;
|
|
@@ -8,15 +9,9 @@ export declare const DeviceBox: import("styled-components").StyledComponent<"div
|
|
|
8
9
|
$justifyItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
9
10
|
$placeItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
10
11
|
} & {
|
|
11
|
-
$
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
$padding: number;
|
|
15
|
-
$borderRadius: number;
|
|
16
|
-
$bgColor: "#DFE2E5";
|
|
17
|
-
$border: string;
|
|
18
|
-
}, "$bgColor" | "$border" | "$borderRadius" | "$padding" | "$sizes">;
|
|
19
|
-
export declare const WallpaperLayer: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
12
|
+
$gridAutoFlow: string;
|
|
13
|
+
}, "$gridAutoFlow">;
|
|
14
|
+
export declare const Bubble: import("styled-components").StyledComponent<"div", any, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
20
15
|
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue | undefined;
|
|
21
16
|
$alignItems?: import("@pushwoosh/kit-helpers/styled-helpers").ItemAlignmentValue | undefined;
|
|
22
17
|
$gap?: import("@pushwoosh/kit-helpers/styled-helpers").StrNum | undefined;
|
|
@@ -28,7 +23,19 @@ export declare const WallpaperLayer: import("styled-components").StyledComponent
|
|
|
28
23
|
} & {
|
|
29
24
|
$gridAutoFlow: string;
|
|
30
25
|
} & {
|
|
31
|
-
$
|
|
32
|
-
$
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
$bgColor: Color;
|
|
27
|
+
$border: string;
|
|
28
|
+
$borderRadius: ShapeRadius;
|
|
29
|
+
$gap: number;
|
|
30
|
+
$padding: number;
|
|
31
|
+
$width: number;
|
|
32
|
+
}, "$gridAutoFlow" | "$bgColor" | "$border" | "$borderRadius" | "$padding" | "$width" | "$gap">;
|
|
33
|
+
export declare const PreviewText: import("styled-components").StyledComponent<"span", any, {
|
|
34
|
+
$color?: string | undefined;
|
|
35
|
+
$uppercase?: boolean | undefined;
|
|
36
|
+
$ellipsis?: boolean | undefined;
|
|
37
|
+
$variant?: import("@pushwoosh/kit-typography").TypographyVariant | undefined;
|
|
38
|
+
} & {
|
|
39
|
+
$variant: "footnote";
|
|
40
|
+
$color: Color;
|
|
41
|
+
}, "$color" | "$variant">;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
$bgColor: WHATSAPP_COLOR.DEVICE_SHELL,
|
|
9
|
-
$border: `${WHATSAPP_DEVICE_BORDER}px solid ${WHATSAPP_COLOR.DEVICE_EDGE}`
|
|
10
|
-
}).withConfig({
|
|
11
|
-
displayName: "DeviceBox",
|
|
2
|
+
import { Color, Shadow, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { Text } from '@pushwoosh/kit-typography';
|
|
5
|
+
import { WHATSAPP_BUBBLE_PADDING, WHATSAPP_BUBBLE_WIDTH } from './constants';
|
|
6
|
+
export const Backdrop = styled(Vertical).withConfig({
|
|
7
|
+
displayName: "Backdrop",
|
|
12
8
|
componentId: "sc-15y0kbp-0"
|
|
13
|
-
})(["-webkit-font-smoothing:antialiased
|
|
14
|
-
export const
|
|
15
|
-
$
|
|
16
|
-
$
|
|
9
|
+
})(["-webkit-font-smoothing:antialiased;&,*{box-sizing:border-box;}"]);
|
|
10
|
+
export const Bubble = styled(Vertical).attrs({
|
|
11
|
+
$bgColor: Color.CLEAR,
|
|
12
|
+
$border: `1px solid ${Color.DIVIDER}`,
|
|
13
|
+
$borderRadius: ShapeRadius.SECTION,
|
|
14
|
+
$gap: WHATSAPP_BUBBLE_PADDING,
|
|
15
|
+
$padding: WHATSAPP_BUBBLE_PADDING,
|
|
16
|
+
$width: WHATSAPP_BUBBLE_WIDTH
|
|
17
17
|
}).withConfig({
|
|
18
|
-
displayName: "
|
|
18
|
+
displayName: "Bubble",
|
|
19
19
|
componentId: "sc-15y0kbp-1"
|
|
20
|
-
})(["
|
|
21
|
-
export const
|
|
22
|
-
|
|
20
|
+
})(["box-shadow:", ";overflow-wrap:anywhere;"], Shadow.LARGE);
|
|
21
|
+
export const PreviewText = styled(Text).attrs({
|
|
22
|
+
$variant: 'footnote',
|
|
23
|
+
$color: Color.MAIN
|
|
24
|
+
}).withConfig({
|
|
25
|
+
displayName: "PreviewText",
|
|
23
26
|
componentId: "sc-15y0kbp-2"
|
|
24
|
-
})(["
|
|
27
|
+
})(["overflow:hidden;line-height:18px;text-overflow:ellipsis;"]);
|