@timardex/cluemart-shared 1.0.83 → 1.0.85

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.
Files changed (36) hide show
  1. package/dist/{chunk-3LHMZDI4.mjs → chunk-JIL6JFWC.mjs} +1 -7
  2. package/dist/chunk-JIL6JFWC.mjs.map +1 -0
  3. package/dist/{chunk-ZDTBLK7U.mjs → chunk-ORGSRTC4.mjs} +2 -2
  4. package/dist/enums/index.cjs +0 -7
  5. package/dist/enums/index.cjs.map +1 -1
  6. package/dist/enums/index.d.mts +1 -5
  7. package/dist/enums/index.d.ts +1 -5
  8. package/dist/enums/index.mjs +1 -3
  9. package/dist/formFields/index.cjs.map +1 -1
  10. package/dist/formFields/index.mjs +2 -2
  11. package/dist/graphql/index.cjs +127 -129
  12. package/dist/graphql/index.cjs.map +1 -1
  13. package/dist/graphql/index.d.mts +7 -12
  14. package/dist/graphql/index.d.ts +7 -12
  15. package/dist/graphql/index.mjs +124 -125
  16. package/dist/graphql/index.mjs.map +1 -1
  17. package/dist/hooks/index.cjs.map +1 -1
  18. package/dist/hooks/index.mjs +2 -2
  19. package/dist/index.cjs +127 -136
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.mts +7 -16
  22. package/dist/index.d.ts +7 -16
  23. package/dist/index.mjs +123 -130
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/{notification-Dy46qobo.d.mts → notification-DDVH6HnE.d.mts} +1 -1
  26. package/dist/{notification-Dy46qobo.d.ts → notification-DDVH6HnE.d.ts} +1 -1
  27. package/dist/types/index.cjs.map +1 -1
  28. package/dist/types/index.d.mts +1 -1
  29. package/dist/types/index.d.ts +1 -1
  30. package/dist/types/index.mjs +1 -1
  31. package/dist/types/index.mjs.map +1 -1
  32. package/dist/utils/index.cjs.map +1 -1
  33. package/dist/utils/index.mjs +2 -2
  34. package/package.json +1 -1
  35. package/dist/chunk-3LHMZDI4.mjs.map +0 -1
  36. /package/dist/{chunk-ZDTBLK7U.mjs.map → chunk-ORGSRTC4.mjs.map} +0 -0
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/graphql/index.ts
21
21
  var graphql_exports = {};
22
22
  __export(graphql_exports, {
23
- GET_CHAT_MESSAGE: () => GET_CHAT_MESSAGE,
24
23
  useAddParticipantToChat: () => useAddParticipantToChat,
25
24
  useAddUserFavouriteResource: () => useAddUserFavouriteResource,
26
25
  useAdminUpdateResourceType: () => useAdminUpdateResourceType,
@@ -39,6 +38,7 @@ __export(graphql_exports, {
39
38
  useCreateUser: () => useCreateUser,
40
39
  useDeleteChat: () => useDeleteChat,
41
40
  useDeleteMarket: () => useDeleteMarket,
41
+ useDeleteNotification: () => useDeleteNotification,
42
42
  useDeleteRelation: () => useDeleteRelation,
43
43
  useDeleteStallholder: () => useDeleteStallholder,
44
44
  useDeleteTester: () => useDeleteTester,
@@ -51,7 +51,7 @@ __export(graphql_exports, {
51
51
  useGetMarkets: () => useGetMarkets,
52
52
  useGetMarketsByRegion: () => useGetMarketsByRegion,
53
53
  useGetMarketsNearMe: () => useGetMarketsNearMe,
54
- useGetNotificationCount: () => useGetNotificationCount,
54
+ useGetNotificationCountSubscription: () => useGetNotificationCountSubscription,
55
55
  useGetRelation: () => useGetRelation,
56
56
  useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
57
57
  useGetResourceConnections: () => useGetResourceConnections,
@@ -62,12 +62,11 @@ __export(graphql_exports, {
62
62
  useGetStallholdersByRegion: () => useGetStallholdersByRegion,
63
63
  useGetTester: () => useGetTester,
64
64
  useGetTesters: () => useGetTesters,
65
- useGetUnreadNotifications: () => useGetUnreadNotifications,
66
65
  useGetUser: () => useGetUser,
67
66
  useGetUserChats: () => useGetUserChats,
68
67
  useGetUserFavourites: () => useGetUserFavourites,
69
68
  useGetUserMarkets: () => useGetUserMarkets,
70
- useGetUserNotifications: () => useGetUserNotifications,
69
+ useGetUserNotificationsSubscription: () => useGetUserNotificationsSubscription,
71
70
  useGetUserStallholder: () => useGetUserStallholder,
72
71
  useGetUsers: () => useGetUsers,
73
72
  useLogin: () => useLogin,
@@ -642,6 +641,14 @@ var USER_CHATS = import_client8.gql`
642
641
  }
643
642
  ${CHAT_FIELDS_FRAGMENT}
644
643
  `;
644
+ var GET_CHAT_MESSAGE = import_client8.gql`
645
+ subscription {
646
+ getChatMessage {
647
+ ...ChatFields
648
+ }
649
+ }
650
+ ${CHAT_FIELDS_FRAGMENT}
651
+ `;
645
652
 
646
653
  // src/graphql/mutations/chat.ts
647
654
  var CREATE_CHAT_MUTATION = import_client9.gql`
@@ -765,22 +772,9 @@ var useRemoveParticipantFromChat = () => {
765
772
  };
766
773
 
767
774
  // src/graphql/hooks/chat/hooksQuery.ts
768
- var import_client12 = require("@apollo/client");
769
-
770
- // src/graphql/subscriptions/chat.ts
771
775
  var import_client11 = require("@apollo/client");
772
- var GET_CHAT_MESSAGE = import_client11.gql`
773
- subscription {
774
- getChatMessage {
775
- ...ChatFields
776
- }
777
- }
778
- ${CHAT_FIELDS_FRAGMENT}
779
- `;
780
-
781
- // src/graphql/hooks/chat/hooksQuery.ts
782
776
  var useGetChat = (_id) => {
783
- const { loading, error, data, refetch } = (0, import_client12.useQuery)(CHAT, {
777
+ const { loading, error, data, refetch } = (0, import_client11.useQuery)(CHAT, {
784
778
  fetchPolicy: "network-only",
785
779
  skip: !_id,
786
780
  variables: { _id }
@@ -789,24 +783,24 @@ var useGetChat = (_id) => {
789
783
  return { chat, error, loading, refetch };
790
784
  };
791
785
  var useGetUserChats = () => {
792
- const { loading, error, data, refetch } = (0, import_client12.useQuery)(USER_CHATS, {
786
+ const { loading, error, data, refetch } = (0, import_client11.useQuery)(USER_CHATS, {
793
787
  fetchPolicy: "network-only"
794
788
  });
795
789
  const userChats = data?.userChats;
796
790
  return { error, loading, refetch, userChats };
797
791
  };
798
792
  var useGetChatSubscription = () => {
799
- const { data, loading, error } = (0, import_client12.useSubscription)(GET_CHAT_MESSAGE);
793
+ const { data, loading, error } = (0, import_client11.useSubscription)(GET_CHAT_MESSAGE);
800
794
  const chat = data?.getChat;
801
795
  return { chat, error, loading };
802
796
  };
803
797
 
804
798
  // src/graphql/hooks/contactUs.ts
805
- var import_client14 = require("@apollo/client");
799
+ var import_client13 = require("@apollo/client");
806
800
 
807
801
  // src/graphql/mutations/contactUs.ts
808
- var import_client13 = require("@apollo/client");
809
- var CONTACT_US_MUTATION = import_client13.gql`
802
+ var import_client12 = require("@apollo/client");
803
+ var CONTACT_US_MUTATION = import_client12.gql`
810
804
  mutation contactUs($input: ContactUsInputType!) {
811
805
  contactUs(input: $input) {
812
806
  message
@@ -816,16 +810,16 @@ var CONTACT_US_MUTATION = import_client13.gql`
816
810
 
817
811
  // src/graphql/hooks/contactUs.ts
818
812
  var useContactUs = () => {
819
- const [contactUs, { loading, error }] = (0, import_client14.useMutation)(CONTACT_US_MUTATION);
813
+ const [contactUs, { loading, error }] = (0, import_client13.useMutation)(CONTACT_US_MUTATION);
820
814
  return { contactUs, error, loading };
821
815
  };
822
816
 
823
817
  // src/graphql/hooks/market/hooksMutation.ts
824
- var import_client17 = require("@apollo/client");
818
+ var import_client16 = require("@apollo/client");
825
819
 
826
820
  // src/graphql/mutations/market.ts
827
- var import_client15 = require("@apollo/client");
828
- var CREATE_MARKET_MUTATION = import_client15.gql`
821
+ var import_client14 = require("@apollo/client");
822
+ var CREATE_MARKET_MUTATION = import_client14.gql`
829
823
  mutation createMarket($input: MarketInputType!) {
830
824
  createMarket(input: $input) {
831
825
  ...MarketFields
@@ -833,7 +827,7 @@ var CREATE_MARKET_MUTATION = import_client15.gql`
833
827
  }
834
828
  ${MARKET}
835
829
  `;
836
- var UPDATE_MARKET_MUTATION = import_client15.gql`
830
+ var UPDATE_MARKET_MUTATION = import_client14.gql`
837
831
  mutation updateMarket($_id: ID!, $input: MarketInputType!) {
838
832
  updateMarket(_id: $_id, input: $input) {
839
833
  ...MarketFields
@@ -841,12 +835,12 @@ var UPDATE_MARKET_MUTATION = import_client15.gql`
841
835
  }
842
836
  ${MARKET}
843
837
  `;
844
- var DELETE_MARKET_MUTATION = import_client15.gql`
838
+ var DELETE_MARKET_MUTATION = import_client14.gql`
845
839
  mutation deleteMarket($_id: ID!) {
846
840
  deleteMarket(_id: $_id)
847
841
  }
848
842
  `;
849
- var CREATE_MARKET_INFO_MUTATION = import_client15.gql`
843
+ var CREATE_MARKET_INFO_MUTATION = import_client14.gql`
850
844
  mutation createMarketInfo($input: MarketInfoInputType!) {
851
845
  createMarketInfo(input: $input) {
852
846
  ...MarketInfoFields
@@ -854,7 +848,7 @@ var CREATE_MARKET_INFO_MUTATION = import_client15.gql`
854
848
  }
855
849
  ${MARKET_INFO}
856
850
  `;
857
- var UPDATE_MARKET_INFO_MUTATION = import_client15.gql`
851
+ var UPDATE_MARKET_INFO_MUTATION = import_client14.gql`
858
852
  mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
859
853
  updateMarketInfo(_id: $_id, input: $input) {
860
854
  ...MarketInfoFields
@@ -864,8 +858,8 @@ var UPDATE_MARKET_INFO_MUTATION = import_client15.gql`
864
858
  `;
865
859
 
866
860
  // src/graphql/queries/user.ts
867
- var import_client16 = require("@apollo/client");
868
- var GET_USERS = import_client16.gql`
861
+ var import_client15 = require("@apollo/client");
862
+ var GET_USERS = import_client15.gql`
869
863
  query getUsers {
870
864
  users {
871
865
  ...UserFields
@@ -873,7 +867,7 @@ var GET_USERS = import_client16.gql`
873
867
  }
874
868
  ${USER_FIELDS_FRAGMENT}
875
869
  `;
876
- var GET_USER = import_client16.gql`
870
+ var GET_USER = import_client15.gql`
877
871
  query getUser($_id: ID!) {
878
872
  user(_id: $_id) {
879
873
  ...UserFields
@@ -881,7 +875,7 @@ var GET_USER = import_client16.gql`
881
875
  }
882
876
  ${USER_FIELDS_FRAGMENT}
883
877
  `;
884
- var GET_USER_MARKETS = import_client16.gql`
878
+ var GET_USER_MARKETS = import_client15.gql`
885
879
  query getUserMarkets {
886
880
  userMarkets {
887
881
  ...MarketFields
@@ -889,7 +883,7 @@ var GET_USER_MARKETS = import_client16.gql`
889
883
  }
890
884
  ${MARKET}
891
885
  `;
892
- var GET_USER_STALLHOLDER = import_client16.gql`
886
+ var GET_USER_STALLHOLDER = import_client15.gql`
893
887
  query getUserStallholder {
894
888
  userStallholder {
895
889
  ...StallholderFields
@@ -897,7 +891,7 @@ var GET_USER_STALLHOLDER = import_client16.gql`
897
891
  }
898
892
  ${STALLHOLDER}
899
893
  `;
900
- var GET_USER_FAVOURITES = import_client16.gql`
894
+ var GET_USER_FAVOURITES = import_client15.gql`
901
895
  query getUserFavourites {
902
896
  userFavourites {
903
897
  markets {
@@ -914,7 +908,7 @@ var GET_USER_FAVOURITES = import_client16.gql`
914
908
 
915
909
  // src/graphql/hooks/market/hooksMutation.ts
916
910
  var useCreateMarket = () => {
917
- const [createMarket, { loading, error }] = (0, import_client17.useMutation)(
911
+ const [createMarket, { loading, error }] = (0, import_client16.useMutation)(
918
912
  CREATE_MARKET_MUTATION,
919
913
  {
920
914
  awaitRefetchQueries: true,
@@ -924,7 +918,7 @@ var useCreateMarket = () => {
924
918
  return { createMarket, error, loading };
925
919
  };
926
920
  var useUpdateMarket = () => {
927
- const [updateMarket, { loading, error }] = (0, import_client17.useMutation)(
921
+ const [updateMarket, { loading, error }] = (0, import_client16.useMutation)(
928
922
  UPDATE_MARKET_MUTATION,
929
923
  {
930
924
  awaitRefetchQueries: true,
@@ -934,7 +928,7 @@ var useUpdateMarket = () => {
934
928
  return { error, loading, updateMarket };
935
929
  };
936
930
  var useDeleteMarket = () => {
937
- const [deleteMarket, { loading, error }] = (0, import_client17.useMutation)(
931
+ const [deleteMarket, { loading, error }] = (0, import_client16.useMutation)(
938
932
  DELETE_MARKET_MUTATION,
939
933
  {
940
934
  awaitRefetchQueries: true,
@@ -944,7 +938,7 @@ var useDeleteMarket = () => {
944
938
  return { deleteMarket, error, loading };
945
939
  };
946
940
  var useCreateMarketInfo = () => {
947
- const [createMarketInfo, { loading, error }] = (0, import_client17.useMutation)(
941
+ const [createMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
948
942
  CREATE_MARKET_INFO_MUTATION,
949
943
  {
950
944
  awaitRefetchQueries: true,
@@ -970,7 +964,7 @@ var useCreateMarketInfo = () => {
970
964
  return { createMarketInfo, error, loading };
971
965
  };
972
966
  var useUpdateMarketInfo = () => {
973
- const [updateMarketInfo, { loading, error }] = (0, import_client17.useMutation)(
967
+ const [updateMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
974
968
  UPDATE_MARKET_INFO_MUTATION,
975
969
  {
976
970
  awaitRefetchQueries: true,
@@ -996,16 +990,16 @@ var useUpdateMarketInfo = () => {
996
990
  };
997
991
 
998
992
  // src/graphql/hooks/market/hooksQuery.ts
999
- var import_client18 = require("@apollo/client");
993
+ var import_client17 = require("@apollo/client");
1000
994
  var useGetMarkets = () => {
1001
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS, {
995
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS, {
1002
996
  fetchPolicy: "network-only"
1003
997
  });
1004
998
  const markets = data?.markets;
1005
999
  return { error, loading, markets, refetch };
1006
1000
  };
1007
1001
  var useGetMarket = (_id) => {
1008
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKET, {
1002
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET, {
1009
1003
  fetchPolicy: "network-only",
1010
1004
  skip: !_id,
1011
1005
  variables: { _id }
@@ -1014,7 +1008,7 @@ var useGetMarket = (_id) => {
1014
1008
  return { error, loading, market, refetch };
1015
1009
  };
1016
1010
  var useGetMarketsByRegion = (region) => {
1017
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS_BY_REGION, {
1011
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_BY_REGION, {
1018
1012
  fetchPolicy: "no-cache",
1019
1013
  skip: !region,
1020
1014
  variables: { region }
@@ -1023,7 +1017,7 @@ var useGetMarketsByRegion = (region) => {
1023
1017
  return { error, loading, marketsByRegion, refetch };
1024
1018
  };
1025
1019
  var useSearchMarkets = (search, region) => {
1026
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(SEARCH_MARKETS, {
1020
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(SEARCH_MARKETS, {
1027
1021
  fetchPolicy: "network-only",
1028
1022
  skip: search.length < 3,
1029
1023
  variables: { region, search }
@@ -1032,7 +1026,7 @@ var useSearchMarkets = (search, region) => {
1032
1026
  return { error, loading, marketsSearch, refetch };
1033
1027
  };
1034
1028
  var useGetMarketsNearMe = (location) => {
1035
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS_NEAR_ME, {
1029
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_NEAR_ME, {
1036
1030
  fetchPolicy: "network-only",
1037
1031
  skip: !location.latitude || !location.longitude,
1038
1032
  variables: {
@@ -1046,7 +1040,7 @@ var useGetMarketsNearMe = (location) => {
1046
1040
  return { error, loading, marketsNearMe, refetch };
1047
1041
  };
1048
1042
  var useGetMarketInfo = (marketId) => {
1049
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKET_INFO, {
1043
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET_INFO, {
1050
1044
  fetchPolicy: "network-only",
1051
1045
  skip: !marketId,
1052
1046
  variables: { marketId }
@@ -1056,16 +1050,16 @@ var useGetMarketInfo = (marketId) => {
1056
1050
  };
1057
1051
 
1058
1052
  // src/graphql/hooks/notifications/hooksMutation.ts
1059
- var import_client21 = require("@apollo/client");
1053
+ var import_client20 = require("@apollo/client");
1060
1054
 
1061
1055
  // src/graphql/mutations/notification.ts
1062
- var import_client20 = require("@apollo/client");
1056
+ var import_client19 = require("@apollo/client");
1063
1057
 
1064
1058
  // src/graphql/queries/notification.ts
1065
- var import_client19 = require("@apollo/client");
1066
- var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
1059
+ var import_client18 = require("@apollo/client");
1060
+ var USER_NOTIFICATION_FRAGMENT = import_client18.gql`
1067
1061
  fragment UserNotificationFields on Notification {
1068
- id
1062
+ _id
1069
1063
  userId
1070
1064
  title
1071
1065
  message
@@ -1076,33 +1070,15 @@ var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
1076
1070
  updatedAt
1077
1071
  }
1078
1072
  `;
1079
- var GET_USER_NOTIFICATIONS = import_client19.gql`
1080
- query getUserNotifications(
1081
- $userId: String!
1082
- $limit: Int
1083
- $offset: Int
1084
- $isRead: String
1085
- ) {
1086
- userNotifications(
1087
- userId: $userId
1088
- limit: $limit
1089
- offset: $offset
1090
- isRead: $isRead
1091
- ) {
1073
+ var GET_USER_NOTIFICATIONS = import_client18.gql`
1074
+ query getUserNotifications($userId: String!, $limit: Int, $offset: Int) {
1075
+ userNotifications(userId: $userId, limit: $limit, offset: $offset) {
1092
1076
  ...UserNotificationFields
1093
1077
  }
1094
1078
  }
1095
1079
  ${USER_NOTIFICATION_FRAGMENT}
1096
1080
  `;
1097
- var GET_UNREAD_NOTIFICATIONS = import_client19.gql`
1098
- query getUnreadNotifications($userId: String!, $limit: Int) {
1099
- unreadNotifications(userId: $userId, limit: $limit) {
1100
- ...UserNotificationFields
1101
- }
1102
- }
1103
- ${USER_NOTIFICATION_FRAGMENT}
1104
- `;
1105
- var GET_NOTIFICATION_COUNT = import_client19.gql`
1081
+ var GET_NOTIFICATION_COUNT = import_client18.gql`
1106
1082
  query getNotificationCount($userId: String!) {
1107
1083
  notificationCount(userId: $userId) {
1108
1084
  total
@@ -1112,7 +1088,7 @@ var GET_NOTIFICATION_COUNT = import_client19.gql`
1112
1088
  `;
1113
1089
 
1114
1090
  // src/graphql/mutations/notification.ts
1115
- var CREATE_NOTIFICATION = import_client20.gql`
1091
+ var CREATE_NOTIFICATION = import_client19.gql`
1116
1092
  mutation createNotification($input: CreateNotificationInput!) {
1117
1093
  createNotification(input: $input) {
1118
1094
  ...UserNotificationFields
@@ -1120,7 +1096,7 @@ var CREATE_NOTIFICATION = import_client20.gql`
1120
1096
  }
1121
1097
  ${USER_NOTIFICATION_FRAGMENT}
1122
1098
  `;
1123
- var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
1099
+ var CREATE_BULK_NOTIFICATIONS = import_client19.gql`
1124
1100
  mutation createBulkNotifications($input: CreateBulkNotificationInput!) {
1125
1101
  createBulkNotifications(input: $input) {
1126
1102
  ...UserNotificationFields
@@ -1128,7 +1104,7 @@ var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
1128
1104
  }
1129
1105
  ${USER_NOTIFICATION_FRAGMENT}
1130
1106
  `;
1131
- var MARK_NOTIFICATION_READ = import_client20.gql`
1107
+ var MARK_NOTIFICATION_READ = import_client19.gql`
1132
1108
  mutation markNotificationRead($input: MarkNotificationReadInput!) {
1133
1109
  markNotificationRead(input: $input) {
1134
1110
  ...UserNotificationFields
@@ -1136,89 +1112,112 @@ var MARK_NOTIFICATION_READ = import_client20.gql`
1136
1112
  }
1137
1113
  ${USER_NOTIFICATION_FRAGMENT}
1138
1114
  `;
1139
- var MARK_ALL_NOTIFICATIONS_READ = import_client20.gql`
1115
+ var MARK_ALL_NOTIFICATIONS_READ = import_client19.gql`
1140
1116
  mutation markAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
1141
1117
  markAllNotificationsRead(input: $input)
1142
1118
  }
1143
1119
  `;
1120
+ var DELETE_NOTIFICATION = import_client19.gql`
1121
+ mutation deleteNotification($_id: ID!) {
1122
+ deleteNotification(_id: $_id)
1123
+ }
1124
+ `;
1144
1125
 
1145
1126
  // src/graphql/hooks/notifications/hooksMutation.ts
1146
1127
  var useCreateNotification = () => {
1147
- const [createNotification, { loading, error }] = (0, import_client21.useMutation)(CREATE_NOTIFICATION);
1128
+ const [createNotification, { loading, error }] = (0, import_client20.useMutation)(CREATE_NOTIFICATION);
1148
1129
  return { createNotification, error, loading };
1149
1130
  };
1150
1131
  var useCreateBulkNotifications = () => {
1151
- const [createBulkNotifications, { loading, error }] = (0, import_client21.useMutation)(
1132
+ const [createBulkNotifications, { loading, error }] = (0, import_client20.useMutation)(
1152
1133
  CREATE_BULK_NOTIFICATIONS
1153
1134
  );
1154
1135
  return { createBulkNotifications, error, loading };
1155
1136
  };
1156
1137
  var useMarkNotificationRead = () => {
1157
- const [markNotificationRead, { loading, error }] = (0, import_client21.useMutation)(
1158
- MARK_NOTIFICATION_READ
1138
+ const [markNotificationRead, { loading, error }] = (0, import_client20.useMutation)(
1139
+ MARK_NOTIFICATION_READ,
1140
+ {
1141
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
1142
+ }
1159
1143
  );
1160
1144
  return { error, loading, markNotificationRead };
1161
1145
  };
1162
1146
  var useMarkAllNotificationsRead = () => {
1163
- const [markAllNotificationsRead, { loading, error }] = (0, import_client21.useMutation)(
1164
- MARK_ALL_NOTIFICATIONS_READ
1147
+ const [markAllNotificationsRead, { loading, error }] = (0, import_client20.useMutation)(
1148
+ MARK_ALL_NOTIFICATIONS_READ,
1149
+ {
1150
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
1151
+ }
1165
1152
  );
1166
1153
  return { error, loading, markAllNotificationsRead };
1167
1154
  };
1155
+ var useDeleteNotification = () => {
1156
+ const [deleteNotification, { loading, error }] = (0, import_client20.useMutation)(
1157
+ DELETE_NOTIFICATION,
1158
+ {
1159
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
1160
+ }
1161
+ );
1162
+ return { deleteNotification, error, loading };
1163
+ };
1168
1164
 
1169
- // src/graphql/hooks/notifications/hooksQuery.ts
1165
+ // src/graphql/hooks/notifications/hooksSubscription.ts
1170
1166
  var import_client22 = require("@apollo/client");
1171
- var useGetUserNotifications = (userId, limit, offset, isRead) => {
1172
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_USER_NOTIFICATIONS, {
1173
- fetchPolicy: "no-cache",
1174
- skip: !userId,
1175
- variables: {
1176
- isRead,
1177
- limit: limit ?? 50,
1178
- offset: offset ?? 0,
1179
- userId
1167
+
1168
+ // src/graphql/subscriptions/notification.ts
1169
+ var import_client21 = require("@apollo/client");
1170
+ var USER_NOTIFICATION_FRAGMENT2 = import_client21.gql`
1171
+ fragment UserNotificationFields on Notification {
1172
+ _id
1173
+ userId
1174
+ title
1175
+ message
1176
+ type
1177
+ isRead
1178
+ data
1179
+ createdAt
1180
+ updatedAt
1181
+ }
1182
+ `;
1183
+ var GET_USER_NOTIFICATIONS_SUBSCRIPTION = import_client21.gql`
1184
+ subscription getUserNotifications($userId: String!) {
1185
+ getUserNotifications(userId: $userId) {
1186
+ ...UserNotificationFields
1180
1187
  }
1181
- });
1182
- const notifications = data?.userNotifications;
1183
- return {
1184
- error,
1185
- loading,
1186
- notifications,
1187
- refetch
1188
- };
1189
- };
1190
- var useGetUnreadNotifications = (userId, limit) => {
1191
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_UNREAD_NOTIFICATIONS, {
1192
- fetchPolicy: "no-cache",
1193
- skip: !userId,
1194
- variables: {
1195
- limit: limit ?? 50,
1196
- offset: 0,
1197
- userId
1188
+ }
1189
+ ${USER_NOTIFICATION_FRAGMENT2}
1190
+ `;
1191
+ var GET_NOTIFICATION_COUNT_SUBSCRIPTION = import_client21.gql`
1192
+ subscription getNotificationCount($userId: String!) {
1193
+ getNotificationCount(userId: $userId) {
1194
+ total
1195
+ unread
1198
1196
  }
1197
+ }
1198
+ `;
1199
+
1200
+ // src/graphql/hooks/notifications/hooksSubscription.ts
1201
+ var useGetUserNotificationsSubscription = (userId) => {
1202
+ const { data, loading, error } = (0, import_client22.useSubscription)(GET_USER_NOTIFICATIONS_SUBSCRIPTION, {
1203
+ skip: !userId,
1204
+ variables: { userId }
1199
1205
  });
1200
- const notifications = data?.unreadNotifications;
1201
1206
  return {
1202
1207
  error,
1203
1208
  loading,
1204
- notifications,
1205
- refetch
1209
+ notifications: data?.getUserNotifications || []
1206
1210
  };
1207
1211
  };
1208
- var useGetNotificationCount = (userId) => {
1209
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_NOTIFICATION_COUNT, {
1210
- fetchPolicy: "no-cache",
1212
+ var useGetNotificationCountSubscription = (userId) => {
1213
+ const { data, loading, error } = (0, import_client22.useSubscription)(GET_NOTIFICATION_COUNT_SUBSCRIPTION, {
1211
1214
  skip: !userId,
1212
- variables: {
1213
- userId
1214
- }
1215
+ variables: { userId }
1215
1216
  });
1216
- const notificationCount = data?.notificationCount;
1217
1217
  return {
1218
1218
  error,
1219
1219
  loading,
1220
- notificationCount,
1221
- refetch
1220
+ notificationCount: data?.getNotificationCount || { total: 0, unread: 0 }
1222
1221
  };
1223
1222
  };
1224
1223
 
@@ -2109,7 +2108,6 @@ var useGetUserFavourites = () => {
2109
2108
  };
2110
2109
  // Annotate the CommonJS export names for ESM import in node:
2111
2110
  0 && (module.exports = {
2112
- GET_CHAT_MESSAGE,
2113
2111
  useAddParticipantToChat,
2114
2112
  useAddUserFavouriteResource,
2115
2113
  useAdminUpdateResourceType,
@@ -2128,6 +2126,7 @@ var useGetUserFavourites = () => {
2128
2126
  useCreateUser,
2129
2127
  useDeleteChat,
2130
2128
  useDeleteMarket,
2129
+ useDeleteNotification,
2131
2130
  useDeleteRelation,
2132
2131
  useDeleteStallholder,
2133
2132
  useDeleteTester,
@@ -2140,7 +2139,7 @@ var useGetUserFavourites = () => {
2140
2139
  useGetMarkets,
2141
2140
  useGetMarketsByRegion,
2142
2141
  useGetMarketsNearMe,
2143
- useGetNotificationCount,
2142
+ useGetNotificationCountSubscription,
2144
2143
  useGetRelation,
2145
2144
  useGetRelationByMarketAndStallholder,
2146
2145
  useGetResourceConnections,
@@ -2151,12 +2150,11 @@ var useGetUserFavourites = () => {
2151
2150
  useGetStallholdersByRegion,
2152
2151
  useGetTester,
2153
2152
  useGetTesters,
2154
- useGetUnreadNotifications,
2155
2153
  useGetUser,
2156
2154
  useGetUserChats,
2157
2155
  useGetUserFavourites,
2158
2156
  useGetUserMarkets,
2159
- useGetUserNotifications,
2157
+ useGetUserNotificationsSubscription,
2160
2158
  useGetUserStallholder,
2161
2159
  useGetUsers,
2162
2160
  useLogin,