@pushwoosh/websdk-common 6.22.5 → 6.23.1
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/inbox/InboxCellPreview.js +31 -12
- package/inbox/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -35,6 +35,16 @@ const TEXT = {
|
|
|
35
35
|
fontSize: 14,
|
|
36
36
|
lineHeight: 20 / 14,
|
|
37
37
|
fontWeight: 500
|
|
38
|
+
},
|
|
39
|
+
caption: {
|
|
40
|
+
fontSize: 10,
|
|
41
|
+
lineHeight: 13 / 10,
|
|
42
|
+
fontWeight: 400
|
|
43
|
+
},
|
|
44
|
+
body: {
|
|
45
|
+
fontSize: 13,
|
|
46
|
+
lineHeight: 18 / 13,
|
|
47
|
+
fontWeight: 400
|
|
38
48
|
}
|
|
39
49
|
};
|
|
40
50
|
const ELLIPSIS = {
|
|
@@ -239,11 +249,13 @@ function IOSCell(props) {
|
|
|
239
249
|
content,
|
|
240
250
|
layout,
|
|
241
251
|
isEmpty,
|
|
252
|
+
isIconPending,
|
|
242
253
|
title,
|
|
243
254
|
body,
|
|
244
255
|
dateLabel,
|
|
245
256
|
unread
|
|
246
257
|
} = props;
|
|
258
|
+
const isClassic = layout === 'classic';
|
|
247
259
|
const texts = _jsxs("div", {
|
|
248
260
|
style: {
|
|
249
261
|
display: 'flex',
|
|
@@ -255,37 +267,40 @@ function IOSCell(props) {
|
|
|
255
267
|
children: [_jsxs("div", {
|
|
256
268
|
style: {
|
|
257
269
|
display: 'flex',
|
|
258
|
-
alignItems: '
|
|
270
|
+
alignItems: 'flex-start',
|
|
259
271
|
gap: 4
|
|
260
272
|
},
|
|
261
273
|
children: [_jsx("div", {
|
|
262
274
|
style: {
|
|
263
|
-
...
|
|
264
|
-
|
|
275
|
+
...(isClassic ? {
|
|
276
|
+
...TEXT.body,
|
|
277
|
+
fontWeight: 500
|
|
278
|
+
} : TEXT.h5),
|
|
265
279
|
flex: 1,
|
|
266
280
|
minWidth: 0,
|
|
281
|
+
overflowWrap: 'anywhere',
|
|
267
282
|
color: MAIN
|
|
268
283
|
},
|
|
269
284
|
children: title
|
|
270
285
|
}), _jsx("div", {
|
|
271
286
|
style: {
|
|
272
|
-
...TEXT.
|
|
287
|
+
...TEXT.caption,
|
|
273
288
|
flexShrink: 0,
|
|
274
289
|
whiteSpace: 'nowrap',
|
|
275
|
-
color:
|
|
290
|
+
color: PHANTOM
|
|
276
291
|
},
|
|
277
292
|
children: dateLabel
|
|
278
293
|
})]
|
|
279
294
|
}), !!body && _jsx("div", {
|
|
280
295
|
style: {
|
|
281
|
-
...TEXT.footnote,
|
|
282
|
-
|
|
283
|
-
color:
|
|
296
|
+
...(isClassic ? TEXT.body : TEXT.footnote),
|
|
297
|
+
overflowWrap: 'anywhere',
|
|
298
|
+
color: isClassic ? '#333333' : PHANTOM
|
|
284
299
|
},
|
|
285
300
|
children: body
|
|
286
301
|
})]
|
|
287
302
|
});
|
|
288
|
-
if (
|
|
303
|
+
if (isClassic) {
|
|
289
304
|
return _jsxs("div", {
|
|
290
305
|
style: {
|
|
291
306
|
display: 'flex',
|
|
@@ -299,7 +314,7 @@ function IOSCell(props) {
|
|
|
299
314
|
},
|
|
300
315
|
children: [unread && _jsx(UnreadDot, {}), _jsx(Avatar, {
|
|
301
316
|
content: content,
|
|
302
|
-
isEmpty: isEmpty,
|
|
317
|
+
isEmpty: isEmpty || isIconPending,
|
|
303
318
|
platform: "ios"
|
|
304
319
|
}), texts]
|
|
305
320
|
});
|
|
@@ -359,6 +374,7 @@ function AndroidCell(props) {
|
|
|
359
374
|
content,
|
|
360
375
|
layout,
|
|
361
376
|
isEmpty,
|
|
377
|
+
isIconPending,
|
|
362
378
|
title,
|
|
363
379
|
body,
|
|
364
380
|
dateLabel,
|
|
@@ -413,7 +429,7 @@ function AndroidCell(props) {
|
|
|
413
429
|
},
|
|
414
430
|
children: [_jsx(Avatar, {
|
|
415
431
|
content: content,
|
|
416
|
-
isEmpty: isEmpty,
|
|
432
|
+
isEmpty: isEmpty || isIconPending,
|
|
417
433
|
platform: "android"
|
|
418
434
|
}), texts]
|
|
419
435
|
})
|
|
@@ -440,6 +456,7 @@ export function InboxCellPreview(props) {
|
|
|
440
456
|
emptyTitle = 'Message preview',
|
|
441
457
|
emptyDescription = 'Enter text of your inbox message to see the preview',
|
|
442
458
|
renderText = text => text,
|
|
459
|
+
iconPlaceholder = false,
|
|
443
460
|
width = '100%'
|
|
444
461
|
} = props;
|
|
445
462
|
const frame = {
|
|
@@ -462,6 +479,7 @@ export function InboxCellPreview(props) {
|
|
|
462
479
|
}
|
|
463
480
|
const picked = content || {};
|
|
464
481
|
const isEmpty = isInboxContentEmpty(picked);
|
|
482
|
+
const isIconPending = iconPlaceholder && !picked.iconUrl;
|
|
465
483
|
const requested = picked.layoutType;
|
|
466
484
|
let layout = 'classic';
|
|
467
485
|
if (INBOX_KNOWN_LAYOUTS.includes(requested)) {
|
|
@@ -490,7 +508,7 @@ export function InboxCellPreview(props) {
|
|
|
490
508
|
isActionPerformed: !unread,
|
|
491
509
|
isRead: !unread,
|
|
492
510
|
layout: layout,
|
|
493
|
-
placeholder: isEmpty || layout
|
|
511
|
+
placeholder: isEmpty || (layout === 'classic' ? isIconPending : !hasMedia(picked, layout)),
|
|
494
512
|
timeLabel: formatInboxMessageTime(sendDate || new Date().toISOString()),
|
|
495
513
|
title: isEmpty ? emptyTitle : picked.title
|
|
496
514
|
})
|
|
@@ -509,6 +527,7 @@ export function InboxCellPreview(props) {
|
|
|
509
527
|
content: picked,
|
|
510
528
|
dateLabel: dateLabel,
|
|
511
529
|
isEmpty: isEmpty,
|
|
530
|
+
isIconPending: isIconPending,
|
|
512
531
|
layout: layout,
|
|
513
532
|
title: isEmpty ? emptyTitle : renderText(texts.title),
|
|
514
533
|
unread: unread
|
package/inbox/types.d.ts
CHANGED
|
@@ -121,6 +121,8 @@ export interface InboxCellPreviewProps {
|
|
|
121
121
|
renderText?: (text: string) => ReactNode;
|
|
122
122
|
/** Appearance of the web cell. */
|
|
123
123
|
appearance?: Partial<InboxWidgetAppearance>;
|
|
124
|
+
/** Keep the icon placeholder instead of the title's initial while the cell has no icon, as an editor does (default `false`). */
|
|
125
|
+
iconPlaceholder?: boolean;
|
|
124
126
|
/** CSS width of the preview (default `100%`). */
|
|
125
127
|
width?: string | number;
|
|
126
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/websdk-common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.23.1",
|
|
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",
|