@timardex/cluemart-shared 1.4.4 → 1.4.6

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.cjs CHANGED
@@ -176,6 +176,7 @@ __export(index_exports, {
176
176
  useGetAppSettings: () => useGetAppSettings,
177
177
  useGetChat: () => useGetChat,
178
178
  useGetChatSubscription: () => useGetChatSubscription,
179
+ useGetChatsByRegion: () => useGetChatsByRegion,
179
180
  useGetEvent: () => useGetEvent,
180
181
  useGetEventByPlaceId: () => useGetEventByPlaceId,
181
182
  useGetEventInfo: () => useGetEventInfo,
@@ -220,6 +221,7 @@ __export(index_exports, {
220
221
  useLoginForm: () => useLoginForm,
221
222
  useLogout: () => useLogout,
222
223
  useMarkAllNotificationsRead: () => useMarkAllNotificationsRead,
224
+ useMarkChatMessagesSeen: () => useMarkChatMessagesSeen,
223
225
  useMarkNotificationRead: () => useMarkNotificationRead,
224
226
  usePartnerForm: () => usePartnerForm,
225
227
  usePostForm: () => usePostForm,
@@ -241,6 +243,7 @@ __export(index_exports, {
241
243
  useSelectPackage: () => useSelectPackage,
242
244
  useSendChatMessage: () => useSendChatMessage,
243
245
  useTesterForm: () => useTesterForm,
246
+ useToggleChatMessageLike: () => useToggleChatMessageLike,
244
247
  useUpdateAd: () => useUpdateAd,
245
248
  useUpdateAppSettings: () => useUpdateAppSettings,
246
249
  useUpdateEvent: () => useUpdateEvent,
@@ -3492,7 +3495,21 @@ var CHAT_MESSAGE_FIELDS_FRAGMENT = import_client9.gql`
3492
3495
  _id
3493
3496
  content
3494
3497
  createdAt
3498
+ replyToMessageId
3499
+ replyPreview {
3500
+ senderId
3501
+ senderName
3502
+ contentPreview
3503
+ }
3504
+ likedBy {
3505
+ userId
3506
+ createdAt
3507
+ }
3495
3508
  senderId
3509
+ seenBy {
3510
+ userId
3511
+ seenAt
3512
+ }
3496
3513
  updatedAt
3497
3514
  }
3498
3515
  `;
@@ -3519,6 +3536,7 @@ var CHAT_FIELDS_FRAGMENT = import_client9.gql`
3519
3536
  participants {
3520
3537
  ...ChatParticipantFields
3521
3538
  }
3539
+ region
3522
3540
  updatedAt
3523
3541
  }
3524
3542
  ${CHAT_MESSAGE_FIELDS_FRAGMENT}
@@ -3540,6 +3558,14 @@ var USER_CHATS = import_client9.gql`
3540
3558
  }
3541
3559
  ${CHAT_FIELDS_FRAGMENT}
3542
3560
  `;
3561
+ var GET_CHATS_BY_REGION = import_client9.gql`
3562
+ query getChatsByRegion($region: String!) {
3563
+ chatsByRegion(region: $region) {
3564
+ ...ChatFields
3565
+ }
3566
+ }
3567
+ ${CHAT_FIELDS_FRAGMENT}
3568
+ `;
3543
3569
 
3544
3570
  // src/graphql/mutations/chat.ts
3545
3571
  var SEND_CHAT_MESSAGE_MUTATION = import_client10.gql`
@@ -3568,6 +3594,22 @@ var REMOVE_PARTICIPANT_FROM_CHAT_MUTATION = import_client10.gql`
3568
3594
  removeParticipantFromChat(chatId: $chatId, userId: $userId)
3569
3595
  }
3570
3596
  `;
3597
+ var TOGGLE_CHAT_MESSAGE_LIKE_MUTATION = import_client10.gql`
3598
+ mutation toggleChatMessageLike($chatId: ID!, $messageId: ID!) {
3599
+ toggleChatMessageLike(chatId: $chatId, messageId: $messageId) {
3600
+ ...ChatFields
3601
+ }
3602
+ }
3603
+ ${CHAT_FIELDS_FRAGMENT}
3604
+ `;
3605
+ var MARK_CHAT_MESSAGES_SEEN_MUTATION = import_client10.gql`
3606
+ mutation markChatMessagesSeen($chatId: ID!, $messageIds: [ID!]!) {
3607
+ markChatMessagesSeen(chatId: $chatId, messageIds: $messageIds) {
3608
+ ...ChatFields
3609
+ }
3610
+ }
3611
+ ${CHAT_FIELDS_FRAGMENT}
3612
+ `;
3571
3613
 
3572
3614
  // src/graphql/hooks/chat/hooksMutation.ts
3573
3615
  var useSendChatMessage = () => {
@@ -3620,6 +3662,36 @@ var useRemoveParticipantFromChat = () => {
3620
3662
  );
3621
3663
  return { error, loading, removeParticipantFromChat };
3622
3664
  };
3665
+ var useToggleChatMessageLike = () => {
3666
+ const [toggleChatMessageLike, { loading, error }] = (0, import_client11.useMutation)(TOGGLE_CHAT_MESSAGE_LIKE_MUTATION, {
3667
+ awaitRefetchQueries: true,
3668
+ refetchQueries: (mutationResult) => {
3669
+ const chatId = mutationResult?.data?.toggleChatMessageLike?._id;
3670
+ return [
3671
+ {
3672
+ query: CHAT,
3673
+ variables: { _id: chatId }
3674
+ }
3675
+ ];
3676
+ }
3677
+ });
3678
+ return { error, loading, toggleChatMessageLike };
3679
+ };
3680
+ var useMarkChatMessagesSeen = () => {
3681
+ const [markChatMessagesSeen, { loading, error }] = (0, import_client11.useMutation)(MARK_CHAT_MESSAGES_SEEN_MUTATION, {
3682
+ awaitRefetchQueries: true,
3683
+ refetchQueries: (mutationResult) => {
3684
+ const chatId = mutationResult?.data?.markChatMessagesSeen?._id;
3685
+ return [
3686
+ {
3687
+ query: CHAT,
3688
+ variables: { _id: chatId }
3689
+ }
3690
+ ];
3691
+ }
3692
+ });
3693
+ return { error, loading, markChatMessagesSeen };
3694
+ };
3623
3695
 
3624
3696
  // src/graphql/hooks/chat/hooksQuery.ts
3625
3697
  var import_client13 = require("@apollo/client");
@@ -3662,6 +3734,15 @@ var useGetChatSubscription = () => {
3662
3734
  const chat = data?.getChat;
3663
3735
  return { chat, error, loading };
3664
3736
  };
3737
+ var useGetChatsByRegion = (region) => {
3738
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_CHATS_BY_REGION, {
3739
+ fetchPolicy: "network-only",
3740
+ skip: !region,
3741
+ variables: { region }
3742
+ });
3743
+ const chatsByRegion = data?.chatsByRegion || [];
3744
+ return { chatsByRegion, error, loading, refetch };
3745
+ };
3665
3746
 
3666
3747
  // src/graphql/hooks/contactUs.ts
3667
3748
  var import_client15 = require("@apollo/client");
@@ -8054,6 +8135,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
8054
8135
  useGetAppSettings,
8055
8136
  useGetChat,
8056
8137
  useGetChatSubscription,
8138
+ useGetChatsByRegion,
8057
8139
  useGetEvent,
8058
8140
  useGetEventByPlaceId,
8059
8141
  useGetEventInfo,
@@ -8098,6 +8180,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
8098
8180
  useLoginForm,
8099
8181
  useLogout,
8100
8182
  useMarkAllNotificationsRead,
8183
+ useMarkChatMessagesSeen,
8101
8184
  useMarkNotificationRead,
8102
8185
  usePartnerForm,
8103
8186
  usePostForm,
@@ -8119,6 +8202,7 @@ var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
8119
8202
  useSelectPackage,
8120
8203
  useSendChatMessage,
8121
8204
  useTesterForm,
8205
+ useToggleChatMessageLike,
8122
8206
  useUpdateAd,
8123
8207
  useUpdateAppSettings,
8124
8208
  useUpdateEvent,