@pushwoosh/dumb-components 2.8.0 → 2.8.2

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.
@@ -7,6 +7,8 @@ import type { InboxPreviewProps } from './types';
7
7
  * a carousel shows at most five valid slides. Content without a single filled
8
8
  * field renders the dashed placeholder of the requested layout.
9
9
  *
10
+ * @deprecated Use `InboxCellPreview` from `@pushwoosh/websdk-common/inbox`, the renderer the WebSDK widget shares.
11
+ *
10
12
  * @example
11
13
  * <InboxPreview platform="ios" localizedContent={preset.localizedContent} language="en" />
12
14
  */
@@ -21,6 +21,8 @@ const CELL_BY_PLATFORM = {
21
21
  * a carousel shows at most five valid slides. Content without a single filled
22
22
  * field renders the dashed placeholder of the requested layout.
23
23
  *
24
+ * @deprecated Use `InboxCellPreview` from `@pushwoosh/websdk-common/inbox`, the renderer the WebSDK widget shares.
25
+ *
24
26
  * @example
25
27
  * <InboxPreview platform="ios" localizedContent={preset.localizedContent} language="en" />
26
28
  */
@@ -1,5 +1,8 @@
1
1
  import type { InboxAvatarShape, InboxLayoutType, InboxPreviewPlatform } from './types';
2
- /** The SDK renders at most this many carousel slides and silently drops the rest. */
2
+ /**
3
+ * The SDK renders at most this many carousel slides and silently drops the rest.
4
+ * @deprecated Use `INBOX_MAX_CAROUSEL_SLIDES` from `@pushwoosh/websdk-common/inbox`.
5
+ */
3
6
  export declare const MAX_CAROUSEL_SLIDES = 5;
4
7
  /** Layouts the SDK knows; anything else falls back to the heuristic. */
5
8
  export declare const KNOWN_LAYOUTS: readonly InboxLayoutType[];
@@ -1,5 +1,8 @@
1
1
  import { ShapeRadius } from '@pushwoosh/kit-constants';
2
- /** The SDK renders at most this many carousel slides and silently drops the rest. */
2
+ /**
3
+ * The SDK renders at most this many carousel slides and silently drops the rest.
4
+ * @deprecated Use `INBOX_MAX_CAROUSEL_SLIDES` from `@pushwoosh/websdk-common/inbox`.
5
+ */
3
6
  export const MAX_CAROUSEL_SLIDES = 5;
4
7
  /** Layouts the SDK knows; anything else falls back to the heuristic. */
5
8
  export const KNOWN_LAYOUTS = ['classic', 'captioned', 'banner', 'carousel'];
@@ -11,6 +11,7 @@ export declare const getHeroUrl: (content: InboxPreviewContent) => string;
11
11
  /**
12
12
  * Resolves the layout the SDK would actually draw: the requested one when it can render,
13
13
  * the SDK heuristic for unknown/absent layouts, and the classic degradation otherwise.
14
+ * @deprecated Use `resolveInboxLayout` from `@pushwoosh/websdk-common/inbox`.
14
15
  */
15
16
  export declare const resolveInboxLayout: (content: InboxPreviewContent) => InboxLayoutType;
16
17
  /** True when the content has nothing to render yet, so the preview shows the layout placeholder. */
@@ -22,6 +22,7 @@ export const getHeroUrl = content => content.bannerUrl || content.iconUrl || '';
22
22
  /**
23
23
  * Resolves the layout the SDK would actually draw: the requested one when it can render,
24
24
  * the SDK heuristic for unknown/absent layouts, and the classic degradation otherwise.
25
+ * @deprecated Use `resolveInboxLayout` from `@pushwoosh/websdk-common/inbox`.
25
26
  */
26
27
  export const resolveInboxLayout = content => {
27
28
  const hasTitle = !!content.title;
@@ -1,15 +1,24 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { TypographyVariant } from '@pushwoosh/kit-typography';
3
- /** Cell layout of an Inbox message. */
3
+ /**
4
+ * Cell layout of an Inbox message.
5
+ * @deprecated Use `InboxLayout` from `@pushwoosh/websdk-common/inbox`.
6
+ */
4
7
  export type InboxLayoutType = 'classic' | 'captioned' | 'banner' | 'carousel';
5
- /** One carousel slide of an Inbox message. */
8
+ /**
9
+ * One carousel slide of an Inbox message.
10
+ * @deprecated Use `InboxSlide` from `@pushwoosh/websdk-common/inbox`.
11
+ */
6
12
  export interface InboxPreviewSlide {
7
13
  /** Slide image URL; a slide without it is dropped, like in the SDK. */
8
14
  imageUrl?: string;
9
15
  /** Caption overlaid at the bottom of the slide. */
10
16
  caption?: string;
11
17
  }
12
- /** One localized Inbox content (mirrors the rpc-v2 `AppInboxPresetLocale` shape). */
18
+ /**
19
+ * One localized Inbox content (mirrors the rpc-v2 `AppInboxPresetLocale` shape).
20
+ * @deprecated Use `InboxCellContent` from `@pushwoosh/websdk-common/inbox`.
21
+ */
13
22
  export interface InboxPreviewContent {
14
23
  /** Cell title. */
15
24
  title?: string;
@@ -24,7 +33,10 @@ export interface InboxPreviewContent {
24
33
  /** Carousel slides; only the first five valid ones are rendered. */
25
34
  carousel?: InboxPreviewSlide[];
26
35
  }
27
- /** Platform skin of {@link InboxPreview}: each OS draws the inbox cell differently. */
36
+ /**
37
+ * Platform skin of {@link InboxPreview}: each OS draws the inbox cell differently.
38
+ * @deprecated Use `InboxCellPlatform` from `@pushwoosh/websdk-common/inbox`.
39
+ */
28
40
  export type InboxPreviewPlatform = 'ios' | 'android' | 'web';
29
41
  /** Inbox icon geometry of one platform. */
30
42
  export interface InboxAvatarShape {
@@ -49,7 +61,10 @@ export interface InboxCellProps {
49
61
  /** Draw the unread dot. */
50
62
  unread: boolean;
51
63
  }
52
- /** Props of {@link InboxPreview}. */
64
+ /**
65
+ * Props of {@link InboxPreview}.
66
+ * @deprecated Use `InboxCellPreviewProps` from `@pushwoosh/websdk-common/inbox`.
67
+ */
53
68
  export interface InboxPreviewProps {
54
69
  /** Platform skin to render (default `ios`); the editor switches it with platform chips. */
55
70
  platform?: InboxPreviewPlatform;
@@ -1,6 +1,7 @@
1
1
  import styled from 'styled-components';
2
+ import { Color } from '@pushwoosh/kit-constants';
2
3
  import { PLACEHOLDER_BACKGROUND } from '../../constants';
3
- import { scaled } from '../../helpers';
4
+ import { placeholderOutline, scaled } from '../../helpers';
4
5
  export const PageImage = styled.img.withConfig({
5
6
  displayName: "PageImage",
6
7
  componentId: "sc-1q2ujdq-0"
@@ -8,11 +9,11 @@ export const PageImage = styled.img.withConfig({
8
9
  export const ImagePlaceholder = styled.div.withConfig({
9
10
  displayName: "ImagePlaceholder",
10
11
  componentId: "sc-1q2ujdq-1"
11
- })(["position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:", ";color:rgba(255,255,255,0.45);"], PLACEHOLDER_BACKGROUND);
12
+ })(["position:absolute;inset:0;display:flex;align-items:center;justify-content:center;", " background:", ";color:", ";> div{transform:scale(1.5);}"], placeholderOutline, PLACEHOLDER_BACKGROUND, Color.PHANTOM);
12
13
  export const BottomArea = styled.div.withConfig({
13
14
  displayName: "BottomArea",
14
15
  componentId: "sc-1q2ujdq-2"
15
- })(["position:absolute;left:0;right:0;bottom:0;z-index:2;display:flex;flex-direction:column;padding:", " ", " ", ";background:linear-gradient(to bottom,rgba(0,0,0,0) 0%,rgba(0,0,0,0.75) 100%);pointer-events:none;"], scaled(44), scaled(24), scaled(24));
16
+ })(["position:absolute;left:0;right:0;bottom:0;z-index:2;display:flex;flex-direction:column;padding:", " ", " ", ";background:linear-gradient(to bottom,rgba(0,0,0,0) 0%,rgba(0,0,0,0.75) 100%);pointer-events:none;", " ~ &:empty{background:none;}"], scaled(44), scaled(24), scaled(24), ImagePlaceholder);
16
17
  export const PageTitle = styled.div.withConfig({
17
18
  displayName: "PageTitle",
18
19
  componentId: "sc-1q2ujdq-3"
@@ -1,5 +1,7 @@
1
1
  import styled, { css, keyframes } from 'styled-components';
2
+ import { Color } from '@pushwoosh/kit-constants';
2
3
  import { scaled } from '../../helpers';
4
+ import { ImagePlaceholder } from '../PushStoriesPage/styles';
3
5
  const grow = keyframes(["from{width:0;}to{width:100%;}"]);
4
6
  export const ProgressRow = styled.div.withConfig({
5
7
  displayName: "ProgressRow",
@@ -8,10 +10,10 @@ export const ProgressRow = styled.div.withConfig({
8
10
  export const ProgressTrack = styled.div.withConfig({
9
11
  displayName: "ProgressTrack",
10
12
  componentId: "sc-1p5nb36-1"
11
- })(["flex:1;height:max(2px,", ");border-radius:", ";background:rgba(255,255,255,0.3);overflow:hidden;"], scaled(3), scaled(1.5));
13
+ })(["flex:1;height:max(2px,", ");border-radius:", ";background:rgba(255,255,255,0.3);overflow:hidden;", " ~ ", " &{background:", ";}"], scaled(3), scaled(1.5), ImagePlaceholder, ProgressRow, Color.FORM);
12
14
  export const ProgressFill = styled.div.withConfig({
13
15
  displayName: "ProgressFill",
14
16
  componentId: "sc-1p5nb36-2"
15
- })(["width:100%;height:100%;background:#FFF;", ""], ({
17
+ })(["width:100%;height:100%;background:#FFF;", " ~ ", " &{background:", ";}", ""], ImagePlaceholder, ProgressRow, Color.LOCKED, ({
16
18
  $duration
17
19
  }) => $duration !== undefined && css(["animation:", " ", "s linear both;"], grow, $duration));
@@ -5,4 +5,4 @@ export declare const PUSH_STORIES_DEFAULT_DURATION = 5;
5
5
  /** Longest page duration in seconds the iOS SDK honours. */
6
6
  export declare const PUSH_STORIES_MAX_DURATION = 30;
7
7
  export declare const REFERENCE_WIDTH = 375;
8
- export declare const PLACEHOLDER_BACKGROUND = "linear-gradient(160deg, #3A3A3C 0%, #1C1C1E 100%)";
8
+ export declare const PLACEHOLDER_BACKGROUND = "linear-gradient(160deg, var(--pw-color-divider, #EBF0F5) 0%, var(--pw-color-frozen, #F7F9FA) 100%)";
@@ -1,3 +1,4 @@
1
+ import { Color } from '@pushwoosh/kit-constants';
1
2
  /** Height ÷ width of the stories area, the iOS SDK's default `storyAspectRatio`. */
2
3
  export const PUSH_STORIES_ASPECT_RATIO = 1.5;
3
4
  /** Seconds a page stays on screen when its duration is missing or invalid. */
@@ -5,4 +6,4 @@ export const PUSH_STORIES_DEFAULT_DURATION = 5;
5
6
  /** Longest page duration in seconds the iOS SDK honours. */
6
7
  export const PUSH_STORIES_MAX_DURATION = 30;
7
8
  export const REFERENCE_WIDTH = 375;
8
- export const PLACEHOLDER_BACKGROUND = 'linear-gradient(160deg, #3A3A3C 0%, #1C1C1E 100%)';
9
+ export const PLACEHOLDER_BACKGROUND = `linear-gradient(160deg, ${Color.DIVIDER} 0%, ${Color.FROZEN} 100%)`;
@@ -5,3 +5,5 @@ export declare function normalizeStoryDuration(duration?: number): number;
5
5
  export declare function hasStoryButton(page: PushStoriesPreviewPage): boolean;
6
6
  export declare function clampStoryIndex(index: number, length: number): number;
7
7
  export declare function scaled(points: number): string;
8
+ /** Hairline outline that keeps a light placeholder visible on a white card. */
9
+ export declare const placeholderOutline: import("styled-components").FlattenSimpleInterpolation;
@@ -1,3 +1,5 @@
1
+ import { css } from 'styled-components';
2
+ import { Color } from '@pushwoosh/kit-constants';
1
3
  import { PUSH_STORIES_DEFAULT_DURATION, PUSH_STORIES_MAX_DURATION, REFERENCE_WIDTH } from './constants';
2
4
  const URL_SCHEME = /^[a-z][a-z\d+.-]*:/i;
3
5
  /** Page duration in seconds as the iOS SDK plays it. */
@@ -16,4 +18,6 @@ export function clampStoryIndex(index, length) {
16
18
  }
17
19
  export function scaled(points) {
18
20
  return `calc(${points} * 100cqw / ${REFERENCE_WIDTH})`;
19
- }
21
+ }
22
+ /** Hairline outline that keeps a light placeholder visible on a white card. */
23
+ export const placeholderOutline = css(["border-radius:inherit;box-shadow:inset 0 0 0 1px ", ";"], Color.DIVIDER);
@@ -1,8 +1,8 @@
1
1
  import styled from 'styled-components';
2
- import { FontFamily } from '@pushwoosh/kit-constants';
2
+ import { Color, FontFamily } from '@pushwoosh/kit-constants';
3
3
  import { toCssValue } from '@pushwoosh/kit-helpers';
4
4
  import { PLACEHOLDER_BACKGROUND, PUSH_STORIES_ASPECT_RATIO } from './constants';
5
- import { scaled } from './helpers';
5
+ import { placeholderOutline, scaled } from './helpers';
6
6
  export const StoriesFrame = styled.div.withConfig({
7
7
  displayName: "StoriesFrame",
8
8
  componentId: "sc-udrlhm-0"
@@ -20,4 +20,4 @@ export const TapZone = styled.button.withConfig({
20
20
  export const EmptyState = styled.div.withConfig({
21
21
  displayName: "EmptyState",
22
22
  componentId: "sc-udrlhm-3"
23
- })(["position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:", ";padding:0 ", ";background:", ";color:rgba(255,255,255,0.7);font-size:", ";line-height:1.35;text-align:center;"], scaled(12), scaled(32), PLACEHOLDER_BACKGROUND, scaled(15));
23
+ })(["position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:", ";padding:0 ", ";", " background:", ";color:", ";font-size:", ";line-height:1.35;text-align:center;> div{margin:", " 0;transform:scale(1.5);}"], scaled(12), scaled(32), placeholderOutline, PLACEHOLDER_BACKGROUND, Color.LOCKED, scaled(15), scaled(6));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",