@wildix/xbees-conversations-utils 1.1.46 → 1.1.48

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.
@@ -113,9 +113,16 @@ function normalizeStreamChannel(channel) {
113
113
  let context = undefined;
114
114
  if (data.context) {
115
115
  try {
116
- context = JSON.parse(data.context);
116
+ if (typeof data.context === 'string') {
117
+ context = JSON.parse(data.context);
118
+ }
119
+ else {
120
+ context = data.context;
121
+ }
122
+ }
123
+ catch (e) {
124
+ console.error('Context Issue: ', e);
117
125
  }
118
- catch (e) { }
119
126
  }
120
127
  let assignee = undefined;
121
128
  if (data.assignee) {
@@ -105,9 +105,16 @@ export function normalizeStreamChannel(channel) {
105
105
  let context = undefined;
106
106
  if (data.context) {
107
107
  try {
108
- context = JSON.parse(data.context);
108
+ if (typeof data.context === 'string') {
109
+ context = JSON.parse(data.context);
110
+ }
111
+ else {
112
+ context = data.context;
113
+ }
114
+ }
115
+ catch (e) {
116
+ console.error('Context Issue: ', e);
109
117
  }
110
- catch (e) { }
111
118
  }
112
119
  let assignee = undefined;
113
120
  if (data.assignee) {
@@ -1,5 +1,5 @@
1
1
  import { Channel, ChannelData, ChannelState, ChannelFilters, ChannelMembership, ChannelMemberResponse, ChannelSort, ChannelResponse, Event, ExtendableGenerics, LiteralStringForUnion, Message, MessageResponse, ReactionResponse, SearchAPIResponse, SyncResponse, UR, UserResponse, GetRepliesAPIResponse, GetReactionsAPIResponse, OwnUserResponse, ChannelAPIResponse, User, Reaction, PartialMessageUpdate, UpdatedMessage, PartialUpdateChannel } from 'stream-chat';
2
- import { MessageQuote, MessageForward, MessageAttachment, MessageGiphy, User as NormalizedUser, ChannelAccess, MessageSmsStatus, MessageWhatsAppStatus, ChannelWhatsAppStatus, Element } from "@wildix/xbees-conversations-client";
2
+ import { MessageQuote, MessageForward, MessageAttachment, MessageGiphy, User as NormalizedUser, ChannelAccess, MessageSmsStatus, MessageWhatsAppStatus, ChannelWhatsAppStatus, Element, ChannelContext } from "@wildix/xbees-conversations-client";
3
3
  export interface StreamChannelFields extends UR {
4
4
  subject?: string;
5
5
  description?: string;
@@ -7,7 +7,7 @@ export interface StreamChannelFields extends UR {
7
7
  picture_color?: string;
8
8
  access?: ChannelAccess;
9
9
  company?: string;
10
- context?: string;
10
+ context?: ChannelContext | string;
11
11
  kite?: boolean;
12
12
  kite_target?: string;
13
13
  kite_variant?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-conversations-utils",
3
- "version": "1.1.46",
3
+ "version": "1.1.48",
4
4
  "description": "",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",