@pushwoosh/websdk-common 6.26.1 → 6.27.0

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.
@@ -46,6 +46,11 @@ const TEXT = {
46
46
  fontSize: 13,
47
47
  lineHeight: 18 / 13,
48
48
  fontWeight: 400
49
+ },
50
+ h6: {
51
+ fontSize: 11,
52
+ lineHeight: 13 / 11,
53
+ fontWeight: 600
49
54
  }
50
55
  };
51
56
  const ELLIPSIS = {
@@ -319,9 +324,28 @@ function IOSCell(props) {
319
324
  title,
320
325
  body,
321
326
  dateLabel,
322
- unread
327
+ unread,
328
+ compactText
323
329
  } = props;
324
330
  const isClassic = layout === 'classic';
331
+ let titleText = isClassic ? {
332
+ ...TEXT.body,
333
+ fontWeight: 500
334
+ } : TEXT.h5;
335
+ let bodyText = isClassic ? {
336
+ ...TEXT.body,
337
+ color: '#333333'
338
+ } : {
339
+ ...TEXT.footnote,
340
+ color: PHANTOM
341
+ };
342
+ if (compactText) {
343
+ titleText = TEXT.h6;
344
+ bodyText = {
345
+ ...TEXT.caption,
346
+ color: PHANTOM
347
+ };
348
+ }
325
349
  const texts = _jsxs("div", {
326
350
  style: {
327
351
  display: 'flex',
@@ -338,10 +362,7 @@ function IOSCell(props) {
338
362
  },
339
363
  children: [_jsx("div", {
340
364
  style: {
341
- ...(isClassic ? {
342
- ...TEXT.body,
343
- fontWeight: 500
344
- } : TEXT.h5),
365
+ ...titleText,
345
366
  flex: 1,
346
367
  minWidth: 0,
347
368
  overflowWrap: 'anywhere',
@@ -359,9 +380,8 @@ function IOSCell(props) {
359
380
  })]
360
381
  }), !!body && _jsx("div", {
361
382
  style: {
362
- ...(isClassic ? TEXT.body : TEXT.footnote),
363
- overflowWrap: 'anywhere',
364
- color: isClassic ? '#333333' : PHANTOM
383
+ ...bodyText,
384
+ overflowWrap: 'anywhere'
365
385
  },
366
386
  children: body
367
387
  })]
@@ -523,6 +543,8 @@ export function InboxCellPreview(props) {
523
543
  emptyDescription = 'Enter text of your inbox message to see the preview',
524
544
  renderText = renderInboxTags,
525
545
  iconPlaceholder = false,
546
+ appIconUrl,
547
+ compactText = false,
526
548
  width = '100%'
527
549
  } = props;
528
550
  const frame = {
@@ -589,6 +611,7 @@ export function InboxCellPreview(props) {
589
611
  });
590
612
  }
591
613
  const texts = getInboxMobileTexts(picked, layout);
614
+ const useAppIcon = layout === 'classic' && !picked.iconUrl && !!appIconUrl;
592
615
  const Cell = platform === 'android' ? AndroidCell : IOSCell;
593
616
  const rtl = !isEmpty && getInboxTextDirection(texts.title, texts.body) === 'rtl';
594
617
  return _jsx("div", {
@@ -596,13 +619,17 @@ export function InboxCellPreview(props) {
596
619
  style: frame,
597
620
  children: _jsx(Cell, {
598
621
  body: isEmpty ? emptyDescription : texts.body && renderText(texts.body),
599
- content: picked,
622
+ content: useAppIcon ? {
623
+ ...picked,
624
+ iconUrl: appIconUrl
625
+ } : picked,
600
626
  dateLabel: dateLabel,
601
627
  isEmpty: isEmpty,
602
- isIconPending: isIconPending,
628
+ isIconPending: isIconPending && !useAppIcon,
603
629
  layout: layout,
604
630
  title: isEmpty ? emptyTitle : renderText(texts.title),
605
- unread: unread
631
+ unread: unread,
632
+ compactText: compactText
606
633
  })
607
634
  });
608
635
  }
package/inbox/types.d.ts CHANGED
@@ -123,6 +123,10 @@ export interface InboxCellPreviewProps {
123
123
  appearance?: Partial<InboxWidgetAppearance>;
124
124
  /** Keep the icon placeholder instead of the title's initial while the cell has no icon, as an editor does (default `false`). */
125
125
  iconPlaceholder?: boolean;
126
+ /** Application icon the mobile cells draw for a message without its own icon. */
127
+ appIconUrl?: string;
128
+ /** Draw the iOS title at 11px and the text at 10px, as the preset editor's mockup does (default `false`). */
129
+ compactText?: boolean;
126
130
  /** CSS width of the preview (default `100%`). */
127
131
  width?: string | number;
128
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/websdk-common",
3
- "version": "6.26.1",
3
+ "version": "6.27.0",
4
4
  "description": "Code shared by the Pushwoosh WebSDK and the Control Panel, one entry point per module (web-popups: web popup model and renderer; subscription-widget: push subscription widget model and renderer; inbox: web inbox widget and inbox cell previews)",
5
5
  "main": "index.js",
6
6
  "module": "index.js",