@smartspace/chat-ui 1.14.4-pr.501.904a19b → 1.14.4-pr.501.b2a0bb9
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/index.d.ts +2 -11
- package/dist/index.js +6 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -572,18 +572,9 @@ type MessageErrorDto = NonNullable<MessageDto['errors']>[number] & {
|
|
|
572
572
|
error_code?: string | null;
|
|
573
573
|
};
|
|
574
574
|
type MessageError = NonNullable<Message['errors']>[number];
|
|
575
|
-
/**
|
|
576
|
-
* Maps one value as the API sent it. Does not apply the unknown-type rule, so
|
|
577
|
-
* existing callers keep their contract; map a list through
|
|
578
|
-
* `mapMessageValuesDtoToModels` to get it.
|
|
579
|
-
*/
|
|
580
575
|
declare function mapMessageValueDtoToModel(dto: MessageValueDto): MessageValue;
|
|
581
|
-
/**
|
|
582
|
-
|
|
583
|
-
* unknown type. An API value this build has never seen hides that value; it
|
|
584
|
-
* never breaks the message.
|
|
585
|
-
*/
|
|
586
|
-
declare function mapMessageValuesDtoToModels(dtos: MessageValueDto[]): MessageValue[];
|
|
576
|
+
/** `type` is an extensible enum; a value this UI cannot place is dropped. */
|
|
577
|
+
declare const mapMessageValuesDtoToModels: (dtos: MessageValueDto[]) => MessageValue[];
|
|
587
578
|
declare function mapMessageErrorDtoToModel(dto: MessageErrorDto): MessageError;
|
|
588
579
|
declare function mapMessageDtoToModel(dto: MessageDto): Message;
|
|
589
580
|
declare function mapMessagesDtoToModels(dto: MessageDto[]): Message[];
|
package/dist/index.js
CHANGED
|
@@ -21147,6 +21147,11 @@ function MessageListSkeleton() {
|
|
|
21147
21147
|
i
|
|
21148
21148
|
)) });
|
|
21149
21149
|
}
|
|
21150
|
+
|
|
21151
|
+
// src/shared/utils/enums.ts
|
|
21152
|
+
var isMember = (e, value) => Object.values(e).includes(value);
|
|
21153
|
+
|
|
21154
|
+
// src/domains/messages/mapper.ts
|
|
21150
21155
|
var {
|
|
21151
21156
|
messageThreadsThreadMessagesIdMessagesResponse: messagesResponseSchema
|
|
21152
21157
|
} = ChatZod;
|
|
@@ -21161,8 +21166,6 @@ var toChannelNumber = (value) => {
|
|
|
21161
21166
|
var normalizeChannels = (channels) => Object.fromEntries(
|
|
21162
21167
|
Object.entries(channels).map(([key, val]) => [key, toChannelNumber(val)])
|
|
21163
21168
|
);
|
|
21164
|
-
var placeableTypes = new Set(Object.values(MessageValueType));
|
|
21165
|
-
var warnedTypes = /* @__PURE__ */ new Set();
|
|
21166
21169
|
function mapMessageValueDtoToModel(dto) {
|
|
21167
21170
|
return {
|
|
21168
21171
|
id: dto.id,
|
|
@@ -21175,24 +21178,7 @@ function mapMessageValueDtoToModel(dto) {
|
|
|
21175
21178
|
createdByUserId: dto.createdByUserId ?? void 0
|
|
21176
21179
|
};
|
|
21177
21180
|
}
|
|
21178
|
-
|
|
21179
|
-
const kept = [];
|
|
21180
|
-
for (const dto of dtos) {
|
|
21181
|
-
if (!placeableTypes.has(dto.type)) {
|
|
21182
|
-
if (!warnedTypes.has(dto.type)) {
|
|
21183
|
-
warnedTypes.add(dto.type);
|
|
21184
|
-
console.warn(
|
|
21185
|
-
"[messages] dropped value with unknown type:",
|
|
21186
|
-
dto.type,
|
|
21187
|
-
dto.id
|
|
21188
|
-
);
|
|
21189
|
-
}
|
|
21190
|
-
continue;
|
|
21191
|
-
}
|
|
21192
|
-
kept.push(mapMessageValueDtoToModel(dto));
|
|
21193
|
-
}
|
|
21194
|
-
return kept;
|
|
21195
|
-
}
|
|
21181
|
+
var mapMessageValuesDtoToModels = (dtos) => dtos.filter((dto) => isMember(MessageValueType, dto.type)).map(mapMessageValueDtoToModel);
|
|
21196
21182
|
function mapMessageErrorDtoToModel(dto) {
|
|
21197
21183
|
const { error_code, ...rest } = dto;
|
|
21198
21184
|
return {
|