@wildix/xbees-conversations-utils 1.1.47 → 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.
@@ -112,7 +112,17 @@ function normalizeStreamChannel(channel) {
112
112
  }
113
113
  let context = undefined;
114
114
  if (data.context) {
115
- context = data.context;
115
+ try {
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);
125
+ }
116
126
  }
117
127
  let assignee = undefined;
118
128
  if (data.assignee) {
@@ -104,7 +104,17 @@ export function normalizeStreamChannel(channel) {
104
104
  }
105
105
  let context = undefined;
106
106
  if (data.context) {
107
- context = data.context;
107
+ try {
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);
117
+ }
108
118
  }
109
119
  let assignee = undefined;
110
120
  if (data.assignee) {
@@ -1,6 +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";
3
- import { ChannelContext } from "@wildix/xbees-kite-client";
2
+ import { MessageQuote, MessageForward, MessageAttachment, MessageGiphy, User as NormalizedUser, ChannelAccess, MessageSmsStatus, MessageWhatsAppStatus, ChannelWhatsAppStatus, Element, ChannelContext } from "@wildix/xbees-conversations-client";
4
3
  export interface StreamChannelFields extends UR {
5
4
  subject?: string;
6
5
  description?: string;
@@ -8,7 +7,7 @@ export interface StreamChannelFields extends UR {
8
7
  picture_color?: string;
9
8
  access?: ChannelAccess;
10
9
  company?: string;
11
- context?: ChannelContext;
10
+ context?: ChannelContext | string;
12
11
  kite?: boolean;
13
12
  kite_target?: string;
14
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.47",
3
+ "version": "1.1.48",
4
4
  "description": "",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",