@wildix/xbees-conversations-utils 1.1.4 → 1.1.42
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.
|
@@ -74,6 +74,7 @@ function normalizeStreamMessage(streamMessage, channelId) {
|
|
|
74
74
|
}
|
|
75
75
|
exports.normalizeStreamMessage = normalizeStreamMessage;
|
|
76
76
|
function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
77
|
+
const { pinned, ref } = streamMessage;
|
|
77
78
|
const normalizedMessage = normalizeStreamMessage(streamMessage, channelId);
|
|
78
79
|
const createdAt = new Date(normalizedMessage.createdAt);
|
|
79
80
|
const updatedAt = normalizedMessage.updatedAt ? new Date(normalizedMessage.updatedAt) : undefined;
|
|
@@ -85,7 +86,7 @@ function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
|
85
86
|
ownReactions.push(reaction);
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
|
-
const direction = userId ===
|
|
89
|
+
const direction = userId === normalizedMessage.user.id ? types_1.MessageDirection.OUTGOING : types_1.MessageDirection.INCOMING;
|
|
89
90
|
return {
|
|
90
91
|
...normalizedMessage,
|
|
91
92
|
user: localizeStreamUser(streamMessage.user),
|
|
@@ -93,6 +94,8 @@ function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
|
93
94
|
direction,
|
|
94
95
|
createdAt,
|
|
95
96
|
updatedAt,
|
|
97
|
+
pinned,
|
|
98
|
+
ref: ref || null,
|
|
96
99
|
};
|
|
97
100
|
}
|
|
98
101
|
exports.localizeStreamMessage = localizeStreamMessage;
|
|
@@ -127,7 +130,7 @@ function normalizeStreamChannel(channel) {
|
|
|
127
130
|
company: data.company,
|
|
128
131
|
context,
|
|
129
132
|
createdAt: data.created_at,
|
|
130
|
-
createdBy: data.created_by_id,
|
|
133
|
+
createdBy: data.created_by_id || data.created_by.id,
|
|
131
134
|
description: data.description,
|
|
132
135
|
external: data.external,
|
|
133
136
|
kite: data.kite,
|
package/dist-es/normalization.js
CHANGED
|
@@ -67,6 +67,7 @@ export function normalizeStreamMessage(streamMessage, channelId) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
export function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
70
|
+
const { pinned, ref } = streamMessage;
|
|
70
71
|
const normalizedMessage = normalizeStreamMessage(streamMessage, channelId);
|
|
71
72
|
const createdAt = new Date(normalizedMessage.createdAt);
|
|
72
73
|
const updatedAt = normalizedMessage.updatedAt ? new Date(normalizedMessage.updatedAt) : undefined;
|
|
@@ -78,7 +79,7 @@ export function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
|
78
79
|
ownReactions.push(reaction);
|
|
79
80
|
}
|
|
80
81
|
});
|
|
81
|
-
const direction = userId ===
|
|
82
|
+
const direction = userId === normalizedMessage.user.id ? MessageDirection.OUTGOING : MessageDirection.INCOMING;
|
|
82
83
|
return {
|
|
83
84
|
...normalizedMessage,
|
|
84
85
|
user: localizeStreamUser(streamMessage.user),
|
|
@@ -86,6 +87,8 @@ export function localizeStreamMessage(streamMessage, channelId, userId) {
|
|
|
86
87
|
direction,
|
|
87
88
|
createdAt,
|
|
88
89
|
updatedAt,
|
|
90
|
+
pinned,
|
|
91
|
+
ref: ref || null,
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
94
|
export function normalizeStreamChannel(channel) {
|
|
@@ -119,7 +122,7 @@ export function normalizeStreamChannel(channel) {
|
|
|
119
122
|
company: data.company,
|
|
120
123
|
context,
|
|
121
124
|
createdAt: data.created_at,
|
|
122
|
-
createdBy: data.created_by_id,
|
|
125
|
+
createdBy: data.created_by_id || data.created_by.id,
|
|
123
126
|
description: data.description,
|
|
124
127
|
external: data.external,
|
|
125
128
|
kite: data.kite,
|
package/dist-types/types.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface LocalizedMessage extends Omit<Message, 'user' | 'createdAt' | '
|
|
|
16
16
|
direction: MessageDirection;
|
|
17
17
|
createdAt: Date;
|
|
18
18
|
updatedAt?: Date;
|
|
19
|
+
pinned: boolean | undefined;
|
|
20
|
+
ref?: string | null;
|
|
19
21
|
}
|
|
20
22
|
export interface LocalizedChannel extends Omit<Channel, 'createdAt' | 'updatedAt' | 'is_broadcast' | 'external' | 'hidden'> {
|
|
21
23
|
createdAt: Date;
|