@linktr.ee/messaging-react 3.5.5-rc-1782980871 → 3.5.5-rc-1782981024
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/dist/{Card-CXpxfxsk.js → Card-BP7VHMzx.js} +2 -2
- package/dist/{Card-CXpxfxsk.js.map → Card-BP7VHMzx.js.map} +1 -1
- package/dist/{Card-Cx5NdR_m.cjs → Card-BmQbBb9A.cjs} +2 -2
- package/dist/{Card-Cx5NdR_m.cjs.map → Card-BmQbBb9A.cjs.map} +1 -1
- package/dist/{Card-5sNhDH41.cjs → Card-C8Bgd2lJ.cjs} +2 -2
- package/dist/{Card-5sNhDH41.cjs.map → Card-C8Bgd2lJ.cjs.map} +1 -1
- package/dist/{Card-CGImMuaB.js → Card-CErKgZmK.js} +2 -2
- package/dist/{Card-CGImMuaB.js.map → Card-CErKgZmK.js.map} +1 -1
- package/dist/{Card-CeWBGjvN.js → Card-DD0muNC6.js} +3 -3
- package/dist/{Card-CeWBGjvN.js.map → Card-DD0muNC6.js.map} +1 -1
- package/dist/{Card-WXgdraGF.cjs → Card-DnKuLKJG.cjs} +2 -2
- package/dist/{Card-WXgdraGF.cjs.map → Card-DnKuLKJG.cjs.map} +1 -1
- package/dist/{LockedThumbnail-DPiO3hh2.cjs → LockedThumbnail-B2Jx7oY5.cjs} +2 -2
- package/dist/{LockedThumbnail-DPiO3hh2.cjs.map → LockedThumbnail-B2Jx7oY5.cjs.map} +1 -1
- package/dist/{LockedThumbnail-D7H6Vllh.js → LockedThumbnail-HyrhKbnz.js} +2 -2
- package/dist/{LockedThumbnail-D7H6Vllh.js.map → LockedThumbnail-HyrhKbnz.js.map} +1 -1
- package/dist/{index-CXWxy_j9.js → index-BVpq3q3z.js} +564 -589
- package/dist/index-BVpq3q3z.js.map +1 -0
- package/dist/index-DhrVhE58.cjs +2 -0
- package/dist/index-DhrVhE58.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/src/components/Avatar/getAvatarEmoji.ts +25 -42
- package/dist/index-CXWxy_j9.js.map +0 -1
- package/dist/index-lw0gsgkI.cjs +0 -2
- package/dist/index-lw0gsgkI.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DhrVhE58.cjs");exports.ActionButton=e.ActionButton;exports.Avatar=e.Avatar;exports.ChannelEmptyState=e.ChannelEmptyState;exports.ChannelList=e.ChannelList;exports.ChannelView=e.ChannelView;exports.CustomMessageProvider=e.CustomMessageProvider;exports.FaqList=e.FaqList;exports.FaqListItem=e.FaqListItem;exports.LinkAttachment=e.LinkAttachment;exports.LockedAttachment=e.LockedAttachment;exports.MediaMessage=e.MediaMessage;exports.MessageAttachment=e.MessageAttachment;exports.MessageVoteButtons=e.MessageVoteButtons;exports.MessagingProvider=e.MessagingProvider;exports.MessagingShell=e.MessagingShell;exports.buildCompactMetaLabel=e.buildCompactMetaLabel;exports.formatFileSize=e.formatFileSize;exports.formatRelativeTime=e.formatRelativeTime;exports.getFileExtensionLabel=e.getFileExtensionLabel;exports.getMessageDisplayText=e.getMessageDisplayText;exports.isLinkAttachment=e.isLinkAttachment;exports.isUuidLike=e.isUuidLike;exports.messageAttachmentGroupPositionFromStream=e.bubbleGroupPositionFromStream;exports.normalizeLanguageCode=e.normalizeLanguageCode;exports.resolveConversationParticipant=e.resolveConversationParticipant;exports.resolveLinkAttachment=e.resolveLinkAttachment;exports.resolveMediaFromMessage=e.resolveMediaFromMessage;exports.resolveParticipantDisplayName=e.resolveParticipantDisplayName;exports.useComposerLocked=e.useComposerLocked;exports.useCustomMessage=e.useCustomMessage;exports.useMessageVote=e.useMessageVote;exports.useMessaging=e.useMessaging;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as d, m as p, n as v, o as C, p as A, q as k, s as F, t as P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } from "./index-
|
|
1
|
+
import { a as e, b as t, C as i, c as o, d as n, e as m, F as r, f as g, L as l, h as M, M as c, i as u, j as L, k as h, l as d, m as p, n as v, o as C, p as A, q as k, s as F, t as P, u as b, v as f, w as x, x as y, y as S, z as q, B as z, D as B, E as D, G as E } from "./index-BVpq3q3z.js";
|
|
2
2
|
export {
|
|
3
3
|
e as ActionButton,
|
|
4
4
|
t as Avatar,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/messaging-react",
|
|
3
|
-
"version": "3.5.5-rc-
|
|
3
|
+
"version": "3.5.5-rc-1782981024",
|
|
4
4
|
"description": "React messaging components built on messaging-core for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@linktr.ee/component-library": "11.8.6",
|
|
41
|
-
"@linktr.ee/messaging-core": "2.3.0-rc-
|
|
41
|
+
"@linktr.ee/messaging-core": "2.3.0-rc-1782981024",
|
|
42
42
|
"@phosphor-icons/react": "^2.1.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -1,44 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Fruit emojis paired with their avatar background color.
|
|
3
|
+
* Single source of truth for both `getAvatarEmoji` and `getAvatarBgColor`.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
6
|
-
'🍎', // Apple
|
|
7
|
-
'🍌', // Banana
|
|
8
|
-
'🍇', // Grape
|
|
9
|
-
'🍊', // Orange
|
|
10
|
-
'🍓', // Strawberry
|
|
11
|
-
'🥥', // Coconut
|
|
12
|
-
'🍒', // Cherry
|
|
13
|
-
'🥭', // Mango
|
|
14
|
-
'🍉', // Watermelon
|
|
15
|
-
'🍋', // Lemon
|
|
16
|
-
'🥝', // Kiwi
|
|
17
|
-
'🫒', // Olive
|
|
18
|
-
'🍈', // Melon
|
|
5
|
+
const FRUITS = [
|
|
6
|
+
{ emoji: '🍎', bgColor: '#FFD1DD' }, // Apple
|
|
7
|
+
{ emoji: '🍌', bgColor: '#FFF1C9' }, // Banana
|
|
8
|
+
{ emoji: '🍇', bgColor: '#E6D9FF' }, // Grape
|
|
9
|
+
{ emoji: '🍊', bgColor: '#D6F4FF' }, // Orange
|
|
10
|
+
{ emoji: '🍓', bgColor: '#FFE0AE' }, // Strawberry
|
|
11
|
+
{ emoji: '🥥', bgColor: '#F7E7D8' }, // Coconut
|
|
12
|
+
{ emoji: '🍒', bgColor: '#DFF4D8' }, // Cherry
|
|
13
|
+
{ emoji: '🥭', bgColor: '#FFD8C2' }, // Mango
|
|
14
|
+
{ emoji: '🍉', bgColor: '#D6EBFF' }, // Watermelon
|
|
15
|
+
{ emoji: '🍋', bgColor: '#CAEEB5' }, // Lemon
|
|
16
|
+
{ emoji: '🥝', bgColor: '#FFE7C7' }, // Kiwi
|
|
17
|
+
{ emoji: '🫒', bgColor: '#F6E3B4' }, // Olive
|
|
18
|
+
{ emoji: '🍈', bgColor: '#D9F7E1' }, // Melon
|
|
19
19
|
]
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Background color paired with each fruit emoji
|
|
23
|
-
*/
|
|
24
|
-
const EMOJI_BG_COLORS: Record<string, string> = {
|
|
25
|
-
'🍉': '#D6EBFF', // Watermelon
|
|
26
|
-
'🍎': '#FFD1DD', // Apple
|
|
27
|
-
'🍓': '#FFE0AE', // Strawberry
|
|
28
|
-
'🍋': '#CAEEB5', // Lemon
|
|
29
|
-
'🍌': '#FFF1C9', // Banana
|
|
30
|
-
'🍇': '#E6D9FF', // Grape
|
|
31
|
-
'🍊': '#D6F4FF', // Orange
|
|
32
|
-
'🥥': '#F7E7D8', // Coconut
|
|
33
|
-
'🍒': '#DFF4D8', // Cherry
|
|
34
|
-
'🥭': '#FFD8C2', // Mango
|
|
35
|
-
'🥝': '#FFE7C7', // Kiwi
|
|
36
|
-
'🫒': '#F6E3B4', // Olive
|
|
37
|
-
'🍈': '#D9F7E1', // Melon
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const DEFAULT_BG_COLOR = '#E6E5E3'
|
|
41
|
-
|
|
42
21
|
/**
|
|
43
22
|
* Simple hash function to convert string to number
|
|
44
23
|
*/
|
|
@@ -52,15 +31,20 @@ function hashString(str: string): number {
|
|
|
52
31
|
return Math.abs(hash)
|
|
53
32
|
}
|
|
54
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Pick a consistent fruit for an id string
|
|
36
|
+
*/
|
|
37
|
+
function getFruit(id: string) {
|
|
38
|
+
return FRUITS[hashString(id) % FRUITS.length]
|
|
39
|
+
}
|
|
40
|
+
|
|
55
41
|
/**
|
|
56
42
|
* Get a fruit emoji based on an id string
|
|
57
43
|
* @param id - The string id to generate emoji from
|
|
58
44
|
* @returns A fruit emoji string
|
|
59
45
|
*/
|
|
60
46
|
export function getAvatarEmoji(id: string): string {
|
|
61
|
-
|
|
62
|
-
const index = hash % EMOJIS.length
|
|
63
|
-
return EMOJIS[index]
|
|
47
|
+
return getFruit(id).emoji
|
|
64
48
|
}
|
|
65
49
|
|
|
66
50
|
/**
|
|
@@ -69,6 +53,5 @@ export function getAvatarEmoji(id: string): string {
|
|
|
69
53
|
* @returns A hex color string
|
|
70
54
|
*/
|
|
71
55
|
export function getAvatarBgColor(id: string): string {
|
|
72
|
-
return
|
|
56
|
+
return getFruit(id).bgColor
|
|
73
57
|
}
|
|
74
|
-
|