@timardex/cluemart-shared 1.4.5 → 1.4.7

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.
@@ -67,6 +67,7 @@ __export(graphql_exports, {
67
67
  useGetAppSettings: () => useGetAppSettings,
68
68
  useGetChat: () => useGetChat,
69
69
  useGetChatSubscription: () => useGetChatSubscription,
70
+ useGetChatsByRegion: () => useGetChatsByRegion,
70
71
  useGetEvent: () => useGetEvent,
71
72
  useGetEventByPlaceId: () => useGetEventByPlaceId,
72
73
  useGetEventInfo: () => useGetEventInfo,
@@ -1169,6 +1170,7 @@ var CHAT_FIELDS_FRAGMENT = import_client9.gql`
1169
1170
  participants {
1170
1171
  ...ChatParticipantFields
1171
1172
  }
1173
+ region
1172
1174
  updatedAt
1173
1175
  }
1174
1176
  ${CHAT_MESSAGE_FIELDS_FRAGMENT}
@@ -1190,6 +1192,14 @@ var USER_CHATS = import_client9.gql`
1190
1192
  }
1191
1193
  ${CHAT_FIELDS_FRAGMENT}
1192
1194
  `;
1195
+ var GET_CHATS_BY_REGION = import_client9.gql`
1196
+ query getChatsByRegion($region: String!) {
1197
+ chatsByRegion(region: $region) {
1198
+ ...ChatFields
1199
+ }
1200
+ }
1201
+ ${CHAT_FIELDS_FRAGMENT}
1202
+ `;
1193
1203
 
1194
1204
  // src/graphql/mutations/chat.ts
1195
1205
  var SEND_CHAT_MESSAGE_MUTATION = import_client10.gql`
@@ -1277,13 +1287,16 @@ var useAddParticipantToChat = () => {
1277
1287
  return { addParticipantToChat, error, loading };
1278
1288
  };
1279
1289
  var useRemoveParticipantFromChat = () => {
1280
- const [removeParticipantFromChat, { loading, error }] = (0, import_client11.useMutation)(
1281
- REMOVE_PARTICIPANT_FROM_CHAT_MUTATION,
1282
- {
1283
- awaitRefetchQueries: true,
1284
- refetchQueries: [{ query: USER_CHATS }]
1290
+ const [removeParticipantFromChat, { loading, error }] = (0, import_client11.useMutation)(REMOVE_PARTICIPANT_FROM_CHAT_MUTATION, {
1291
+ awaitRefetchQueries: true,
1292
+ refetchQueries: (mutationResult) => {
1293
+ const region = mutationResult?.data?.removeParticipantFromChat?.region;
1294
+ return [
1295
+ { query: USER_CHATS },
1296
+ { query: GET_CHATS_BY_REGION, variables: { region } }
1297
+ ];
1285
1298
  }
1286
- );
1299
+ });
1287
1300
  return { error, loading, removeParticipantFromChat };
1288
1301
  };
1289
1302
  var useToggleChatMessageLike = () => {
@@ -1358,6 +1371,15 @@ var useGetChatSubscription = () => {
1358
1371
  const chat = data?.getChat;
1359
1372
  return { chat, error, loading };
1360
1373
  };
1374
+ var useGetChatsByRegion = (region) => {
1375
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_CHATS_BY_REGION, {
1376
+ fetchPolicy: "network-only",
1377
+ skip: !region,
1378
+ variables: { region }
1379
+ });
1380
+ const chatsByRegion = data?.chatsByRegion || [];
1381
+ return { chatsByRegion, error, loading, refetch };
1382
+ };
1361
1383
 
1362
1384
  // src/graphql/hooks/contactUs.ts
1363
1385
  var import_client15 = require("@apollo/client");
@@ -3645,6 +3667,7 @@ var useGetAppSettings = () => {
3645
3667
  useGetAppSettings,
3646
3668
  useGetChat,
3647
3669
  useGetChatSubscription,
3670
+ useGetChatsByRegion,
3648
3671
  useGetEvent,
3649
3672
  useGetEventByPlaceId,
3650
3673
  useGetEventInfo,