@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
package/dist/index.cjs CHANGED
@@ -38,11 +38,9 @@ __export(index_exports, {
38
38
  EnumRegions: () => EnumRegions,
39
39
  EnumRelationResource: () => EnumRelationResource,
40
40
  EnumResourceType: () => EnumResourceType,
41
- EnumResourceTypeIcon: () => EnumResourceTypeIcon,
42
41
  EnumSocialMedia: () => EnumSocialMedia,
43
42
  EnumUserLicence: () => EnumUserLicence,
44
43
  EnumUserRole: () => EnumUserRole,
45
- GET_CHAT_MESSAGE: () => GET_CHAT_MESSAGE,
46
44
  ImageTypeEnum: () => ImageTypeEnum,
47
45
  SAVED_EMAIL_KEY: () => SAVED_EMAIL_KEY,
48
46
  SAVED_PASSWORD_KEY: () => SAVED_PASSWORD_KEY,
@@ -130,6 +128,7 @@ __export(index_exports, {
130
128
  useCreateUser: () => useCreateUser,
131
129
  useDeleteChat: () => useDeleteChat,
132
130
  useDeleteMarket: () => useDeleteMarket,
131
+ useDeleteNotification: () => useDeleteNotification,
133
132
  useDeleteRelation: () => useDeleteRelation,
134
133
  useDeleteStallholder: () => useDeleteStallholder,
135
134
  useDeleteTester: () => useDeleteTester,
@@ -142,7 +141,7 @@ __export(index_exports, {
142
141
  useGetMarkets: () => useGetMarkets,
143
142
  useGetMarketsByRegion: () => useGetMarketsByRegion,
144
143
  useGetMarketsNearMe: () => useGetMarketsNearMe,
145
- useGetNotificationCount: () => useGetNotificationCount,
144
+ useGetNotificationCountSubscription: () => useGetNotificationCountSubscription,
146
145
  useGetRelation: () => useGetRelation,
147
146
  useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
148
147
  useGetResourceConnections: () => useGetResourceConnections,
@@ -153,12 +152,11 @@ __export(index_exports, {
153
152
  useGetStallholdersByRegion: () => useGetStallholdersByRegion,
154
153
  useGetTester: () => useGetTester,
155
154
  useGetTesters: () => useGetTesters,
156
- useGetUnreadNotifications: () => useGetUnreadNotifications,
157
155
  useGetUser: () => useGetUser,
158
156
  useGetUserChats: () => useGetUserChats,
159
157
  useGetUserFavourites: () => useGetUserFavourites,
160
158
  useGetUserMarkets: () => useGetUserMarkets,
161
- useGetUserNotifications: () => useGetUserNotifications,
159
+ useGetUserNotificationsSubscription: () => useGetUserNotificationsSubscription,
162
160
  useGetUserStallholder: () => useGetUserStallholder,
163
161
  useGetUsers: () => useGetUsers,
164
162
  useLocationSearch: () => useLocationSearch,
@@ -242,11 +240,6 @@ var EnumNotification = /* @__PURE__ */ ((EnumNotification2) => {
242
240
  EnumNotification2["STALLHOLDER_APPLICATION_TO_MARKET"] = "stallholder_application_to_market" /* STALLHOLDER_APPLICATION_TO_MARKET */;
243
241
  return EnumNotification2;
244
242
  })(EnumNotification || {});
245
- var EnumResourceTypeIcon = /* @__PURE__ */ ((EnumResourceTypeIcon2) => {
246
- EnumResourceTypeIcon2["MARKET"] = "compass";
247
- EnumResourceTypeIcon2["STALLHOLDER"] = "store";
248
- return EnumResourceTypeIcon2;
249
- })(EnumResourceTypeIcon || {});
250
243
  var EnumRegions = /* @__PURE__ */ ((EnumRegions2) => {
251
244
  EnumRegions2["Auckland"] = "Auckland";
252
245
  EnumRegions2["BayOfPlentyGisborne"] = "Bay of Plenty & Gisborne";
@@ -2546,6 +2539,14 @@ var USER_CHATS = import_client8.gql`
2546
2539
  }
2547
2540
  ${CHAT_FIELDS_FRAGMENT}
2548
2541
  `;
2542
+ var GET_CHAT_MESSAGE = import_client8.gql`
2543
+ subscription {
2544
+ getChatMessage {
2545
+ ...ChatFields
2546
+ }
2547
+ }
2548
+ ${CHAT_FIELDS_FRAGMENT}
2549
+ `;
2549
2550
 
2550
2551
  // src/graphql/mutations/chat.ts
2551
2552
  var CREATE_CHAT_MUTATION = import_client9.gql`
@@ -2669,22 +2670,9 @@ var useRemoveParticipantFromChat = () => {
2669
2670
  };
2670
2671
 
2671
2672
  // src/graphql/hooks/chat/hooksQuery.ts
2672
- var import_client12 = require("@apollo/client");
2673
-
2674
- // src/graphql/subscriptions/chat.ts
2675
2673
  var import_client11 = require("@apollo/client");
2676
- var GET_CHAT_MESSAGE = import_client11.gql`
2677
- subscription {
2678
- getChatMessage {
2679
- ...ChatFields
2680
- }
2681
- }
2682
- ${CHAT_FIELDS_FRAGMENT}
2683
- `;
2684
-
2685
- // src/graphql/hooks/chat/hooksQuery.ts
2686
2674
  var useGetChat = (_id) => {
2687
- const { loading, error, data, refetch } = (0, import_client12.useQuery)(CHAT, {
2675
+ const { loading, error, data, refetch } = (0, import_client11.useQuery)(CHAT, {
2688
2676
  fetchPolicy: "network-only",
2689
2677
  skip: !_id,
2690
2678
  variables: { _id }
@@ -2693,24 +2681,24 @@ var useGetChat = (_id) => {
2693
2681
  return { chat, error, loading, refetch };
2694
2682
  };
2695
2683
  var useGetUserChats = () => {
2696
- const { loading, error, data, refetch } = (0, import_client12.useQuery)(USER_CHATS, {
2684
+ const { loading, error, data, refetch } = (0, import_client11.useQuery)(USER_CHATS, {
2697
2685
  fetchPolicy: "network-only"
2698
2686
  });
2699
2687
  const userChats = data?.userChats;
2700
2688
  return { error, loading, refetch, userChats };
2701
2689
  };
2702
2690
  var useGetChatSubscription = () => {
2703
- const { data, loading, error } = (0, import_client12.useSubscription)(GET_CHAT_MESSAGE);
2691
+ const { data, loading, error } = (0, import_client11.useSubscription)(GET_CHAT_MESSAGE);
2704
2692
  const chat = data?.getChat;
2705
2693
  return { chat, error, loading };
2706
2694
  };
2707
2695
 
2708
2696
  // src/graphql/hooks/contactUs.ts
2709
- var import_client14 = require("@apollo/client");
2697
+ var import_client13 = require("@apollo/client");
2710
2698
 
2711
2699
  // src/graphql/mutations/contactUs.ts
2712
- var import_client13 = require("@apollo/client");
2713
- var CONTACT_US_MUTATION = import_client13.gql`
2700
+ var import_client12 = require("@apollo/client");
2701
+ var CONTACT_US_MUTATION = import_client12.gql`
2714
2702
  mutation contactUs($input: ContactUsInputType!) {
2715
2703
  contactUs(input: $input) {
2716
2704
  message
@@ -2720,16 +2708,16 @@ var CONTACT_US_MUTATION = import_client13.gql`
2720
2708
 
2721
2709
  // src/graphql/hooks/contactUs.ts
2722
2710
  var useContactUs = () => {
2723
- const [contactUs, { loading, error }] = (0, import_client14.useMutation)(CONTACT_US_MUTATION);
2711
+ const [contactUs, { loading, error }] = (0, import_client13.useMutation)(CONTACT_US_MUTATION);
2724
2712
  return { contactUs, error, loading };
2725
2713
  };
2726
2714
 
2727
2715
  // src/graphql/hooks/market/hooksMutation.ts
2728
- var import_client17 = require("@apollo/client");
2716
+ var import_client16 = require("@apollo/client");
2729
2717
 
2730
2718
  // src/graphql/mutations/market.ts
2731
- var import_client15 = require("@apollo/client");
2732
- var CREATE_MARKET_MUTATION = import_client15.gql`
2719
+ var import_client14 = require("@apollo/client");
2720
+ var CREATE_MARKET_MUTATION = import_client14.gql`
2733
2721
  mutation createMarket($input: MarketInputType!) {
2734
2722
  createMarket(input: $input) {
2735
2723
  ...MarketFields
@@ -2737,7 +2725,7 @@ var CREATE_MARKET_MUTATION = import_client15.gql`
2737
2725
  }
2738
2726
  ${MARKET}
2739
2727
  `;
2740
- var UPDATE_MARKET_MUTATION = import_client15.gql`
2728
+ var UPDATE_MARKET_MUTATION = import_client14.gql`
2741
2729
  mutation updateMarket($_id: ID!, $input: MarketInputType!) {
2742
2730
  updateMarket(_id: $_id, input: $input) {
2743
2731
  ...MarketFields
@@ -2745,12 +2733,12 @@ var UPDATE_MARKET_MUTATION = import_client15.gql`
2745
2733
  }
2746
2734
  ${MARKET}
2747
2735
  `;
2748
- var DELETE_MARKET_MUTATION = import_client15.gql`
2736
+ var DELETE_MARKET_MUTATION = import_client14.gql`
2749
2737
  mutation deleteMarket($_id: ID!) {
2750
2738
  deleteMarket(_id: $_id)
2751
2739
  }
2752
2740
  `;
2753
- var CREATE_MARKET_INFO_MUTATION = import_client15.gql`
2741
+ var CREATE_MARKET_INFO_MUTATION = import_client14.gql`
2754
2742
  mutation createMarketInfo($input: MarketInfoInputType!) {
2755
2743
  createMarketInfo(input: $input) {
2756
2744
  ...MarketInfoFields
@@ -2758,7 +2746,7 @@ var CREATE_MARKET_INFO_MUTATION = import_client15.gql`
2758
2746
  }
2759
2747
  ${MARKET_INFO}
2760
2748
  `;
2761
- var UPDATE_MARKET_INFO_MUTATION = import_client15.gql`
2749
+ var UPDATE_MARKET_INFO_MUTATION = import_client14.gql`
2762
2750
  mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
2763
2751
  updateMarketInfo(_id: $_id, input: $input) {
2764
2752
  ...MarketInfoFields
@@ -2768,8 +2756,8 @@ var UPDATE_MARKET_INFO_MUTATION = import_client15.gql`
2768
2756
  `;
2769
2757
 
2770
2758
  // src/graphql/queries/user.ts
2771
- var import_client16 = require("@apollo/client");
2772
- var GET_USERS = import_client16.gql`
2759
+ var import_client15 = require("@apollo/client");
2760
+ var GET_USERS = import_client15.gql`
2773
2761
  query getUsers {
2774
2762
  users {
2775
2763
  ...UserFields
@@ -2777,7 +2765,7 @@ var GET_USERS = import_client16.gql`
2777
2765
  }
2778
2766
  ${USER_FIELDS_FRAGMENT}
2779
2767
  `;
2780
- var GET_USER = import_client16.gql`
2768
+ var GET_USER = import_client15.gql`
2781
2769
  query getUser($_id: ID!) {
2782
2770
  user(_id: $_id) {
2783
2771
  ...UserFields
@@ -2785,7 +2773,7 @@ var GET_USER = import_client16.gql`
2785
2773
  }
2786
2774
  ${USER_FIELDS_FRAGMENT}
2787
2775
  `;
2788
- var GET_USER_MARKETS = import_client16.gql`
2776
+ var GET_USER_MARKETS = import_client15.gql`
2789
2777
  query getUserMarkets {
2790
2778
  userMarkets {
2791
2779
  ...MarketFields
@@ -2793,7 +2781,7 @@ var GET_USER_MARKETS = import_client16.gql`
2793
2781
  }
2794
2782
  ${MARKET}
2795
2783
  `;
2796
- var GET_USER_STALLHOLDER = import_client16.gql`
2784
+ var GET_USER_STALLHOLDER = import_client15.gql`
2797
2785
  query getUserStallholder {
2798
2786
  userStallholder {
2799
2787
  ...StallholderFields
@@ -2801,7 +2789,7 @@ var GET_USER_STALLHOLDER = import_client16.gql`
2801
2789
  }
2802
2790
  ${STALLHOLDER}
2803
2791
  `;
2804
- var GET_USER_FAVOURITES = import_client16.gql`
2792
+ var GET_USER_FAVOURITES = import_client15.gql`
2805
2793
  query getUserFavourites {
2806
2794
  userFavourites {
2807
2795
  markets {
@@ -2818,7 +2806,7 @@ var GET_USER_FAVOURITES = import_client16.gql`
2818
2806
 
2819
2807
  // src/graphql/hooks/market/hooksMutation.ts
2820
2808
  var useCreateMarket = () => {
2821
- const [createMarket, { loading, error }] = (0, import_client17.useMutation)(
2809
+ const [createMarket, { loading, error }] = (0, import_client16.useMutation)(
2822
2810
  CREATE_MARKET_MUTATION,
2823
2811
  {
2824
2812
  awaitRefetchQueries: true,
@@ -2828,7 +2816,7 @@ var useCreateMarket = () => {
2828
2816
  return { createMarket, error, loading };
2829
2817
  };
2830
2818
  var useUpdateMarket = () => {
2831
- const [updateMarket, { loading, error }] = (0, import_client17.useMutation)(
2819
+ const [updateMarket, { loading, error }] = (0, import_client16.useMutation)(
2832
2820
  UPDATE_MARKET_MUTATION,
2833
2821
  {
2834
2822
  awaitRefetchQueries: true,
@@ -2838,7 +2826,7 @@ var useUpdateMarket = () => {
2838
2826
  return { error, loading, updateMarket };
2839
2827
  };
2840
2828
  var useDeleteMarket = () => {
2841
- const [deleteMarket, { loading, error }] = (0, import_client17.useMutation)(
2829
+ const [deleteMarket, { loading, error }] = (0, import_client16.useMutation)(
2842
2830
  DELETE_MARKET_MUTATION,
2843
2831
  {
2844
2832
  awaitRefetchQueries: true,
@@ -2848,7 +2836,7 @@ var useDeleteMarket = () => {
2848
2836
  return { deleteMarket, error, loading };
2849
2837
  };
2850
2838
  var useCreateMarketInfo = () => {
2851
- const [createMarketInfo, { loading, error }] = (0, import_client17.useMutation)(
2839
+ const [createMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
2852
2840
  CREATE_MARKET_INFO_MUTATION,
2853
2841
  {
2854
2842
  awaitRefetchQueries: true,
@@ -2874,7 +2862,7 @@ var useCreateMarketInfo = () => {
2874
2862
  return { createMarketInfo, error, loading };
2875
2863
  };
2876
2864
  var useUpdateMarketInfo = () => {
2877
- const [updateMarketInfo, { loading, error }] = (0, import_client17.useMutation)(
2865
+ const [updateMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
2878
2866
  UPDATE_MARKET_INFO_MUTATION,
2879
2867
  {
2880
2868
  awaitRefetchQueries: true,
@@ -2900,16 +2888,16 @@ var useUpdateMarketInfo = () => {
2900
2888
  };
2901
2889
 
2902
2890
  // src/graphql/hooks/market/hooksQuery.ts
2903
- var import_client18 = require("@apollo/client");
2891
+ var import_client17 = require("@apollo/client");
2904
2892
  var useGetMarkets = () => {
2905
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS, {
2893
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS, {
2906
2894
  fetchPolicy: "network-only"
2907
2895
  });
2908
2896
  const markets = data?.markets;
2909
2897
  return { error, loading, markets, refetch };
2910
2898
  };
2911
2899
  var useGetMarket = (_id) => {
2912
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKET, {
2900
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET, {
2913
2901
  fetchPolicy: "network-only",
2914
2902
  skip: !_id,
2915
2903
  variables: { _id }
@@ -2918,7 +2906,7 @@ var useGetMarket = (_id) => {
2918
2906
  return { error, loading, market, refetch };
2919
2907
  };
2920
2908
  var useGetMarketsByRegion = (region) => {
2921
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS_BY_REGION, {
2909
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_BY_REGION, {
2922
2910
  fetchPolicy: "no-cache",
2923
2911
  skip: !region,
2924
2912
  variables: { region }
@@ -2927,7 +2915,7 @@ var useGetMarketsByRegion = (region) => {
2927
2915
  return { error, loading, marketsByRegion, refetch };
2928
2916
  };
2929
2917
  var useSearchMarkets = (search, region) => {
2930
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(SEARCH_MARKETS, {
2918
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(SEARCH_MARKETS, {
2931
2919
  fetchPolicy: "network-only",
2932
2920
  skip: search.length < 3,
2933
2921
  variables: { region, search }
@@ -2936,7 +2924,7 @@ var useSearchMarkets = (search, region) => {
2936
2924
  return { error, loading, marketsSearch, refetch };
2937
2925
  };
2938
2926
  var useGetMarketsNearMe = (location) => {
2939
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS_NEAR_ME, {
2927
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_NEAR_ME, {
2940
2928
  fetchPolicy: "network-only",
2941
2929
  skip: !location.latitude || !location.longitude,
2942
2930
  variables: {
@@ -2950,7 +2938,7 @@ var useGetMarketsNearMe = (location) => {
2950
2938
  return { error, loading, marketsNearMe, refetch };
2951
2939
  };
2952
2940
  var useGetMarketInfo = (marketId) => {
2953
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKET_INFO, {
2941
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET_INFO, {
2954
2942
  fetchPolicy: "network-only",
2955
2943
  skip: !marketId,
2956
2944
  variables: { marketId }
@@ -2960,16 +2948,16 @@ var useGetMarketInfo = (marketId) => {
2960
2948
  };
2961
2949
 
2962
2950
  // src/graphql/hooks/notifications/hooksMutation.ts
2963
- var import_client21 = require("@apollo/client");
2951
+ var import_client20 = require("@apollo/client");
2964
2952
 
2965
2953
  // src/graphql/mutations/notification.ts
2966
- var import_client20 = require("@apollo/client");
2954
+ var import_client19 = require("@apollo/client");
2967
2955
 
2968
2956
  // src/graphql/queries/notification.ts
2969
- var import_client19 = require("@apollo/client");
2970
- var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
2957
+ var import_client18 = require("@apollo/client");
2958
+ var USER_NOTIFICATION_FRAGMENT = import_client18.gql`
2971
2959
  fragment UserNotificationFields on Notification {
2972
- id
2960
+ _id
2973
2961
  userId
2974
2962
  title
2975
2963
  message
@@ -2980,33 +2968,15 @@ var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
2980
2968
  updatedAt
2981
2969
  }
2982
2970
  `;
2983
- var GET_USER_NOTIFICATIONS = import_client19.gql`
2984
- query getUserNotifications(
2985
- $userId: String!
2986
- $limit: Int
2987
- $offset: Int
2988
- $isRead: String
2989
- ) {
2990
- userNotifications(
2991
- userId: $userId
2992
- limit: $limit
2993
- offset: $offset
2994
- isRead: $isRead
2995
- ) {
2971
+ var GET_USER_NOTIFICATIONS = import_client18.gql`
2972
+ query getUserNotifications($userId: String!, $limit: Int, $offset: Int) {
2973
+ userNotifications(userId: $userId, limit: $limit, offset: $offset) {
2996
2974
  ...UserNotificationFields
2997
2975
  }
2998
2976
  }
2999
2977
  ${USER_NOTIFICATION_FRAGMENT}
3000
2978
  `;
3001
- var GET_UNREAD_NOTIFICATIONS = import_client19.gql`
3002
- query getUnreadNotifications($userId: String!, $limit: Int) {
3003
- unreadNotifications(userId: $userId, limit: $limit) {
3004
- ...UserNotificationFields
3005
- }
3006
- }
3007
- ${USER_NOTIFICATION_FRAGMENT}
3008
- `;
3009
- var GET_NOTIFICATION_COUNT = import_client19.gql`
2979
+ var GET_NOTIFICATION_COUNT = import_client18.gql`
3010
2980
  query getNotificationCount($userId: String!) {
3011
2981
  notificationCount(userId: $userId) {
3012
2982
  total
@@ -3016,7 +2986,7 @@ var GET_NOTIFICATION_COUNT = import_client19.gql`
3016
2986
  `;
3017
2987
 
3018
2988
  // src/graphql/mutations/notification.ts
3019
- var CREATE_NOTIFICATION = import_client20.gql`
2989
+ var CREATE_NOTIFICATION = import_client19.gql`
3020
2990
  mutation createNotification($input: CreateNotificationInput!) {
3021
2991
  createNotification(input: $input) {
3022
2992
  ...UserNotificationFields
@@ -3024,7 +2994,7 @@ var CREATE_NOTIFICATION = import_client20.gql`
3024
2994
  }
3025
2995
  ${USER_NOTIFICATION_FRAGMENT}
3026
2996
  `;
3027
- var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
2997
+ var CREATE_BULK_NOTIFICATIONS = import_client19.gql`
3028
2998
  mutation createBulkNotifications($input: CreateBulkNotificationInput!) {
3029
2999
  createBulkNotifications(input: $input) {
3030
3000
  ...UserNotificationFields
@@ -3032,7 +3002,7 @@ var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
3032
3002
  }
3033
3003
  ${USER_NOTIFICATION_FRAGMENT}
3034
3004
  `;
3035
- var MARK_NOTIFICATION_READ = import_client20.gql`
3005
+ var MARK_NOTIFICATION_READ = import_client19.gql`
3036
3006
  mutation markNotificationRead($input: MarkNotificationReadInput!) {
3037
3007
  markNotificationRead(input: $input) {
3038
3008
  ...UserNotificationFields
@@ -3040,89 +3010,112 @@ var MARK_NOTIFICATION_READ = import_client20.gql`
3040
3010
  }
3041
3011
  ${USER_NOTIFICATION_FRAGMENT}
3042
3012
  `;
3043
- var MARK_ALL_NOTIFICATIONS_READ = import_client20.gql`
3013
+ var MARK_ALL_NOTIFICATIONS_READ = import_client19.gql`
3044
3014
  mutation markAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
3045
3015
  markAllNotificationsRead(input: $input)
3046
3016
  }
3047
3017
  `;
3018
+ var DELETE_NOTIFICATION = import_client19.gql`
3019
+ mutation deleteNotification($_id: ID!) {
3020
+ deleteNotification(_id: $_id)
3021
+ }
3022
+ `;
3048
3023
 
3049
3024
  // src/graphql/hooks/notifications/hooksMutation.ts
3050
3025
  var useCreateNotification = () => {
3051
- const [createNotification, { loading, error }] = (0, import_client21.useMutation)(CREATE_NOTIFICATION);
3026
+ const [createNotification, { loading, error }] = (0, import_client20.useMutation)(CREATE_NOTIFICATION);
3052
3027
  return { createNotification, error, loading };
3053
3028
  };
3054
3029
  var useCreateBulkNotifications = () => {
3055
- const [createBulkNotifications, { loading, error }] = (0, import_client21.useMutation)(
3030
+ const [createBulkNotifications, { loading, error }] = (0, import_client20.useMutation)(
3056
3031
  CREATE_BULK_NOTIFICATIONS
3057
3032
  );
3058
3033
  return { createBulkNotifications, error, loading };
3059
3034
  };
3060
3035
  var useMarkNotificationRead = () => {
3061
- const [markNotificationRead, { loading, error }] = (0, import_client21.useMutation)(
3062
- MARK_NOTIFICATION_READ
3036
+ const [markNotificationRead, { loading, error }] = (0, import_client20.useMutation)(
3037
+ MARK_NOTIFICATION_READ,
3038
+ {
3039
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
3040
+ }
3063
3041
  );
3064
3042
  return { error, loading, markNotificationRead };
3065
3043
  };
3066
3044
  var useMarkAllNotificationsRead = () => {
3067
- const [markAllNotificationsRead, { loading, error }] = (0, import_client21.useMutation)(
3068
- MARK_ALL_NOTIFICATIONS_READ
3045
+ const [markAllNotificationsRead, { loading, error }] = (0, import_client20.useMutation)(
3046
+ MARK_ALL_NOTIFICATIONS_READ,
3047
+ {
3048
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
3049
+ }
3069
3050
  );
3070
3051
  return { error, loading, markAllNotificationsRead };
3071
3052
  };
3053
+ var useDeleteNotification = () => {
3054
+ const [deleteNotification, { loading, error }] = (0, import_client20.useMutation)(
3055
+ DELETE_NOTIFICATION,
3056
+ {
3057
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
3058
+ }
3059
+ );
3060
+ return { deleteNotification, error, loading };
3061
+ };
3072
3062
 
3073
- // src/graphql/hooks/notifications/hooksQuery.ts
3063
+ // src/graphql/hooks/notifications/hooksSubscription.ts
3074
3064
  var import_client22 = require("@apollo/client");
3075
- var useGetUserNotifications = (userId, limit, offset, isRead) => {
3076
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_USER_NOTIFICATIONS, {
3077
- fetchPolicy: "no-cache",
3078
- skip: !userId,
3079
- variables: {
3080
- isRead,
3081
- limit: limit ?? 50,
3082
- offset: offset ?? 0,
3083
- userId
3065
+
3066
+ // src/graphql/subscriptions/notification.ts
3067
+ var import_client21 = require("@apollo/client");
3068
+ var USER_NOTIFICATION_FRAGMENT2 = import_client21.gql`
3069
+ fragment UserNotificationFields on Notification {
3070
+ _id
3071
+ userId
3072
+ title
3073
+ message
3074
+ type
3075
+ isRead
3076
+ data
3077
+ createdAt
3078
+ updatedAt
3079
+ }
3080
+ `;
3081
+ var GET_USER_NOTIFICATIONS_SUBSCRIPTION = import_client21.gql`
3082
+ subscription getUserNotifications($userId: String!) {
3083
+ getUserNotifications(userId: $userId) {
3084
+ ...UserNotificationFields
3084
3085
  }
3085
- });
3086
- const notifications = data?.userNotifications;
3087
- return {
3088
- error,
3089
- loading,
3090
- notifications,
3091
- refetch
3092
- };
3093
- };
3094
- var useGetUnreadNotifications = (userId, limit) => {
3095
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_UNREAD_NOTIFICATIONS, {
3096
- fetchPolicy: "no-cache",
3097
- skip: !userId,
3098
- variables: {
3099
- limit: limit ?? 50,
3100
- offset: 0,
3101
- userId
3086
+ }
3087
+ ${USER_NOTIFICATION_FRAGMENT2}
3088
+ `;
3089
+ var GET_NOTIFICATION_COUNT_SUBSCRIPTION = import_client21.gql`
3090
+ subscription getNotificationCount($userId: String!) {
3091
+ getNotificationCount(userId: $userId) {
3092
+ total
3093
+ unread
3102
3094
  }
3095
+ }
3096
+ `;
3097
+
3098
+ // src/graphql/hooks/notifications/hooksSubscription.ts
3099
+ var useGetUserNotificationsSubscription = (userId) => {
3100
+ const { data, loading, error } = (0, import_client22.useSubscription)(GET_USER_NOTIFICATIONS_SUBSCRIPTION, {
3101
+ skip: !userId,
3102
+ variables: { userId }
3103
3103
  });
3104
- const notifications = data?.unreadNotifications;
3105
3104
  return {
3106
3105
  error,
3107
3106
  loading,
3108
- notifications,
3109
- refetch
3107
+ notifications: data?.getUserNotifications || []
3110
3108
  };
3111
3109
  };
3112
- var useGetNotificationCount = (userId) => {
3113
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_NOTIFICATION_COUNT, {
3114
- fetchPolicy: "no-cache",
3110
+ var useGetNotificationCountSubscription = (userId) => {
3111
+ const { data, loading, error } = (0, import_client22.useSubscription)(GET_NOTIFICATION_COUNT_SUBSCRIPTION, {
3115
3112
  skip: !userId,
3116
- variables: {
3117
- userId
3118
- }
3113
+ variables: { userId }
3119
3114
  });
3120
- const notificationCount = data?.notificationCount;
3121
3115
  return {
3122
3116
  error,
3123
3117
  loading,
3124
- notificationCount,
3125
- refetch
3118
+ notificationCount: data?.getNotificationCount || { total: 0, unread: 0 }
3126
3119
  };
3127
3120
  };
3128
3121
 
@@ -5256,11 +5249,9 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5256
5249
  EnumRegions,
5257
5250
  EnumRelationResource,
5258
5251
  EnumResourceType,
5259
- EnumResourceTypeIcon,
5260
5252
  EnumSocialMedia,
5261
5253
  EnumUserLicence,
5262
5254
  EnumUserRole,
5263
- GET_CHAT_MESSAGE,
5264
5255
  ImageTypeEnum,
5265
5256
  SAVED_EMAIL_KEY,
5266
5257
  SAVED_PASSWORD_KEY,
@@ -5348,6 +5339,7 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5348
5339
  useCreateUser,
5349
5340
  useDeleteChat,
5350
5341
  useDeleteMarket,
5342
+ useDeleteNotification,
5351
5343
  useDeleteRelation,
5352
5344
  useDeleteStallholder,
5353
5345
  useDeleteTester,
@@ -5360,7 +5352,7 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5360
5352
  useGetMarkets,
5361
5353
  useGetMarketsByRegion,
5362
5354
  useGetMarketsNearMe,
5363
- useGetNotificationCount,
5355
+ useGetNotificationCountSubscription,
5364
5356
  useGetRelation,
5365
5357
  useGetRelationByMarketAndStallholder,
5366
5358
  useGetResourceConnections,
@@ -5371,12 +5363,11 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5371
5363
  useGetStallholdersByRegion,
5372
5364
  useGetTester,
5373
5365
  useGetTesters,
5374
- useGetUnreadNotifications,
5375
5366
  useGetUser,
5376
5367
  useGetUserChats,
5377
5368
  useGetUserFavourites,
5378
5369
  useGetUserMarkets,
5379
- useGetUserNotifications,
5370
+ useGetUserNotificationsSubscription,
5380
5371
  useGetUserStallholder,
5381
5372
  useGetUsers,
5382
5373
  useLocationSearch,