@timardex/cluemart-shared 1.0.84 → 1.0.86

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
@@ -41,7 +41,6 @@ __export(index_exports, {
41
41
  EnumSocialMedia: () => EnumSocialMedia,
42
42
  EnumUserLicence: () => EnumUserLicence,
43
43
  EnumUserRole: () => EnumUserRole,
44
- GET_CHAT_MESSAGE: () => GET_CHAT_MESSAGE,
45
44
  ImageTypeEnum: () => ImageTypeEnum,
46
45
  SAVED_EMAIL_KEY: () => SAVED_EMAIL_KEY,
47
46
  SAVED_PASSWORD_KEY: () => SAVED_PASSWORD_KEY,
@@ -119,7 +118,6 @@ __export(index_exports, {
119
118
  useCreateChat: () => useCreateChat,
120
119
  useCreateMarket: () => useCreateMarket,
121
120
  useCreateMarketInfo: () => useCreateMarketInfo,
122
- useCreateNotification: () => useCreateNotification,
123
121
  useCreatePoster: () => useCreatePoster,
124
122
  useCreatePushToken: () => useCreatePushToken,
125
123
  useCreateRelation: () => useCreateRelation,
@@ -142,7 +140,7 @@ __export(index_exports, {
142
140
  useGetMarkets: () => useGetMarkets,
143
141
  useGetMarketsByRegion: () => useGetMarketsByRegion,
144
142
  useGetMarketsNearMe: () => useGetMarketsNearMe,
145
- useGetNotificationCount: () => useGetNotificationCount,
143
+ useGetNotificationCountSubscription: () => useGetNotificationCountSubscription,
146
144
  useGetRelation: () => useGetRelation,
147
145
  useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
148
146
  useGetResourceConnections: () => useGetResourceConnections,
@@ -157,7 +155,7 @@ __export(index_exports, {
157
155
  useGetUserChats: () => useGetUserChats,
158
156
  useGetUserFavourites: () => useGetUserFavourites,
159
157
  useGetUserMarkets: () => useGetUserMarkets,
160
- useGetUserNotifications: () => useGetUserNotifications,
158
+ useGetUserNotificationsSubscription: () => useGetUserNotificationsSubscription,
161
159
  useGetUserStallholder: () => useGetUserStallholder,
162
160
  useGetUsers: () => useGetUsers,
163
161
  useLocationSearch: () => useLocationSearch,
@@ -2540,6 +2538,14 @@ var USER_CHATS = import_client8.gql`
2540
2538
  }
2541
2539
  ${CHAT_FIELDS_FRAGMENT}
2542
2540
  `;
2541
+ var GET_CHAT_MESSAGE = import_client8.gql`
2542
+ subscription {
2543
+ getChatMessage {
2544
+ ...ChatFields
2545
+ }
2546
+ }
2547
+ ${CHAT_FIELDS_FRAGMENT}
2548
+ `;
2543
2549
 
2544
2550
  // src/graphql/mutations/chat.ts
2545
2551
  var CREATE_CHAT_MUTATION = import_client9.gql`
@@ -2663,22 +2669,9 @@ var useRemoveParticipantFromChat = () => {
2663
2669
  };
2664
2670
 
2665
2671
  // src/graphql/hooks/chat/hooksQuery.ts
2666
- var import_client12 = require("@apollo/client");
2667
-
2668
- // src/graphql/subscriptions/chat.ts
2669
2672
  var import_client11 = require("@apollo/client");
2670
- var GET_CHAT_MESSAGE = import_client11.gql`
2671
- subscription {
2672
- getChatMessage {
2673
- ...ChatFields
2674
- }
2675
- }
2676
- ${CHAT_FIELDS_FRAGMENT}
2677
- `;
2678
-
2679
- // src/graphql/hooks/chat/hooksQuery.ts
2680
2673
  var useGetChat = (_id) => {
2681
- const { loading, error, data, refetch } = (0, import_client12.useQuery)(CHAT, {
2674
+ const { loading, error, data, refetch } = (0, import_client11.useQuery)(CHAT, {
2682
2675
  fetchPolicy: "network-only",
2683
2676
  skip: !_id,
2684
2677
  variables: { _id }
@@ -2687,24 +2680,24 @@ var useGetChat = (_id) => {
2687
2680
  return { chat, error, loading, refetch };
2688
2681
  };
2689
2682
  var useGetUserChats = () => {
2690
- const { loading, error, data, refetch } = (0, import_client12.useQuery)(USER_CHATS, {
2683
+ const { loading, error, data, refetch } = (0, import_client11.useQuery)(USER_CHATS, {
2691
2684
  fetchPolicy: "network-only"
2692
2685
  });
2693
2686
  const userChats = data?.userChats;
2694
2687
  return { error, loading, refetch, userChats };
2695
2688
  };
2696
2689
  var useGetChatSubscription = () => {
2697
- const { data, loading, error } = (0, import_client12.useSubscription)(GET_CHAT_MESSAGE);
2690
+ const { data, loading, error } = (0, import_client11.useSubscription)(GET_CHAT_MESSAGE);
2698
2691
  const chat = data?.getChat;
2699
2692
  return { chat, error, loading };
2700
2693
  };
2701
2694
 
2702
2695
  // src/graphql/hooks/contactUs.ts
2703
- var import_client14 = require("@apollo/client");
2696
+ var import_client13 = require("@apollo/client");
2704
2697
 
2705
2698
  // src/graphql/mutations/contactUs.ts
2706
- var import_client13 = require("@apollo/client");
2707
- var CONTACT_US_MUTATION = import_client13.gql`
2699
+ var import_client12 = require("@apollo/client");
2700
+ var CONTACT_US_MUTATION = import_client12.gql`
2708
2701
  mutation contactUs($input: ContactUsInputType!) {
2709
2702
  contactUs(input: $input) {
2710
2703
  message
@@ -2714,16 +2707,16 @@ var CONTACT_US_MUTATION = import_client13.gql`
2714
2707
 
2715
2708
  // src/graphql/hooks/contactUs.ts
2716
2709
  var useContactUs = () => {
2717
- const [contactUs, { loading, error }] = (0, import_client14.useMutation)(CONTACT_US_MUTATION);
2710
+ const [contactUs, { loading, error }] = (0, import_client13.useMutation)(CONTACT_US_MUTATION);
2718
2711
  return { contactUs, error, loading };
2719
2712
  };
2720
2713
 
2721
2714
  // src/graphql/hooks/market/hooksMutation.ts
2722
- var import_client17 = require("@apollo/client");
2715
+ var import_client16 = require("@apollo/client");
2723
2716
 
2724
2717
  // src/graphql/mutations/market.ts
2725
- var import_client15 = require("@apollo/client");
2726
- var CREATE_MARKET_MUTATION = import_client15.gql`
2718
+ var import_client14 = require("@apollo/client");
2719
+ var CREATE_MARKET_MUTATION = import_client14.gql`
2727
2720
  mutation createMarket($input: MarketInputType!) {
2728
2721
  createMarket(input: $input) {
2729
2722
  ...MarketFields
@@ -2731,7 +2724,7 @@ var CREATE_MARKET_MUTATION = import_client15.gql`
2731
2724
  }
2732
2725
  ${MARKET}
2733
2726
  `;
2734
- var UPDATE_MARKET_MUTATION = import_client15.gql`
2727
+ var UPDATE_MARKET_MUTATION = import_client14.gql`
2735
2728
  mutation updateMarket($_id: ID!, $input: MarketInputType!) {
2736
2729
  updateMarket(_id: $_id, input: $input) {
2737
2730
  ...MarketFields
@@ -2739,12 +2732,12 @@ var UPDATE_MARKET_MUTATION = import_client15.gql`
2739
2732
  }
2740
2733
  ${MARKET}
2741
2734
  `;
2742
- var DELETE_MARKET_MUTATION = import_client15.gql`
2735
+ var DELETE_MARKET_MUTATION = import_client14.gql`
2743
2736
  mutation deleteMarket($_id: ID!) {
2744
2737
  deleteMarket(_id: $_id)
2745
2738
  }
2746
2739
  `;
2747
- var CREATE_MARKET_INFO_MUTATION = import_client15.gql`
2740
+ var CREATE_MARKET_INFO_MUTATION = import_client14.gql`
2748
2741
  mutation createMarketInfo($input: MarketInfoInputType!) {
2749
2742
  createMarketInfo(input: $input) {
2750
2743
  ...MarketInfoFields
@@ -2752,7 +2745,7 @@ var CREATE_MARKET_INFO_MUTATION = import_client15.gql`
2752
2745
  }
2753
2746
  ${MARKET_INFO}
2754
2747
  `;
2755
- var UPDATE_MARKET_INFO_MUTATION = import_client15.gql`
2748
+ var UPDATE_MARKET_INFO_MUTATION = import_client14.gql`
2756
2749
  mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
2757
2750
  updateMarketInfo(_id: $_id, input: $input) {
2758
2751
  ...MarketInfoFields
@@ -2762,8 +2755,8 @@ var UPDATE_MARKET_INFO_MUTATION = import_client15.gql`
2762
2755
  `;
2763
2756
 
2764
2757
  // src/graphql/queries/user.ts
2765
- var import_client16 = require("@apollo/client");
2766
- var GET_USERS = import_client16.gql`
2758
+ var import_client15 = require("@apollo/client");
2759
+ var GET_USERS = import_client15.gql`
2767
2760
  query getUsers {
2768
2761
  users {
2769
2762
  ...UserFields
@@ -2771,7 +2764,7 @@ var GET_USERS = import_client16.gql`
2771
2764
  }
2772
2765
  ${USER_FIELDS_FRAGMENT}
2773
2766
  `;
2774
- var GET_USER = import_client16.gql`
2767
+ var GET_USER = import_client15.gql`
2775
2768
  query getUser($_id: ID!) {
2776
2769
  user(_id: $_id) {
2777
2770
  ...UserFields
@@ -2779,7 +2772,7 @@ var GET_USER = import_client16.gql`
2779
2772
  }
2780
2773
  ${USER_FIELDS_FRAGMENT}
2781
2774
  `;
2782
- var GET_USER_MARKETS = import_client16.gql`
2775
+ var GET_USER_MARKETS = import_client15.gql`
2783
2776
  query getUserMarkets {
2784
2777
  userMarkets {
2785
2778
  ...MarketFields
@@ -2787,7 +2780,7 @@ var GET_USER_MARKETS = import_client16.gql`
2787
2780
  }
2788
2781
  ${MARKET}
2789
2782
  `;
2790
- var GET_USER_STALLHOLDER = import_client16.gql`
2783
+ var GET_USER_STALLHOLDER = import_client15.gql`
2791
2784
  query getUserStallholder {
2792
2785
  userStallholder {
2793
2786
  ...StallholderFields
@@ -2795,7 +2788,7 @@ var GET_USER_STALLHOLDER = import_client16.gql`
2795
2788
  }
2796
2789
  ${STALLHOLDER}
2797
2790
  `;
2798
- var GET_USER_FAVOURITES = import_client16.gql`
2791
+ var GET_USER_FAVOURITES = import_client15.gql`
2799
2792
  query getUserFavourites {
2800
2793
  userFavourites {
2801
2794
  markets {
@@ -2812,7 +2805,7 @@ var GET_USER_FAVOURITES = import_client16.gql`
2812
2805
 
2813
2806
  // src/graphql/hooks/market/hooksMutation.ts
2814
2807
  var useCreateMarket = () => {
2815
- const [createMarket, { loading, error }] = (0, import_client17.useMutation)(
2808
+ const [createMarket, { loading, error }] = (0, import_client16.useMutation)(
2816
2809
  CREATE_MARKET_MUTATION,
2817
2810
  {
2818
2811
  awaitRefetchQueries: true,
@@ -2822,7 +2815,7 @@ var useCreateMarket = () => {
2822
2815
  return { createMarket, error, loading };
2823
2816
  };
2824
2817
  var useUpdateMarket = () => {
2825
- const [updateMarket, { loading, error }] = (0, import_client17.useMutation)(
2818
+ const [updateMarket, { loading, error }] = (0, import_client16.useMutation)(
2826
2819
  UPDATE_MARKET_MUTATION,
2827
2820
  {
2828
2821
  awaitRefetchQueries: true,
@@ -2832,7 +2825,7 @@ var useUpdateMarket = () => {
2832
2825
  return { error, loading, updateMarket };
2833
2826
  };
2834
2827
  var useDeleteMarket = () => {
2835
- const [deleteMarket, { loading, error }] = (0, import_client17.useMutation)(
2828
+ const [deleteMarket, { loading, error }] = (0, import_client16.useMutation)(
2836
2829
  DELETE_MARKET_MUTATION,
2837
2830
  {
2838
2831
  awaitRefetchQueries: true,
@@ -2842,7 +2835,7 @@ var useDeleteMarket = () => {
2842
2835
  return { deleteMarket, error, loading };
2843
2836
  };
2844
2837
  var useCreateMarketInfo = () => {
2845
- const [createMarketInfo, { loading, error }] = (0, import_client17.useMutation)(
2838
+ const [createMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
2846
2839
  CREATE_MARKET_INFO_MUTATION,
2847
2840
  {
2848
2841
  awaitRefetchQueries: true,
@@ -2868,7 +2861,7 @@ var useCreateMarketInfo = () => {
2868
2861
  return { createMarketInfo, error, loading };
2869
2862
  };
2870
2863
  var useUpdateMarketInfo = () => {
2871
- const [updateMarketInfo, { loading, error }] = (0, import_client17.useMutation)(
2864
+ const [updateMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
2872
2865
  UPDATE_MARKET_INFO_MUTATION,
2873
2866
  {
2874
2867
  awaitRefetchQueries: true,
@@ -2894,16 +2887,16 @@ var useUpdateMarketInfo = () => {
2894
2887
  };
2895
2888
 
2896
2889
  // src/graphql/hooks/market/hooksQuery.ts
2897
- var import_client18 = require("@apollo/client");
2890
+ var import_client17 = require("@apollo/client");
2898
2891
  var useGetMarkets = () => {
2899
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS, {
2892
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS, {
2900
2893
  fetchPolicy: "network-only"
2901
2894
  });
2902
2895
  const markets = data?.markets;
2903
2896
  return { error, loading, markets, refetch };
2904
2897
  };
2905
2898
  var useGetMarket = (_id) => {
2906
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKET, {
2899
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET, {
2907
2900
  fetchPolicy: "network-only",
2908
2901
  skip: !_id,
2909
2902
  variables: { _id }
@@ -2912,7 +2905,7 @@ var useGetMarket = (_id) => {
2912
2905
  return { error, loading, market, refetch };
2913
2906
  };
2914
2907
  var useGetMarketsByRegion = (region) => {
2915
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS_BY_REGION, {
2908
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_BY_REGION, {
2916
2909
  fetchPolicy: "no-cache",
2917
2910
  skip: !region,
2918
2911
  variables: { region }
@@ -2921,7 +2914,7 @@ var useGetMarketsByRegion = (region) => {
2921
2914
  return { error, loading, marketsByRegion, refetch };
2922
2915
  };
2923
2916
  var useSearchMarkets = (search, region) => {
2924
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(SEARCH_MARKETS, {
2917
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(SEARCH_MARKETS, {
2925
2918
  fetchPolicy: "network-only",
2926
2919
  skip: search.length < 3,
2927
2920
  variables: { region, search }
@@ -2930,7 +2923,7 @@ var useSearchMarkets = (search, region) => {
2930
2923
  return { error, loading, marketsSearch, refetch };
2931
2924
  };
2932
2925
  var useGetMarketsNearMe = (location) => {
2933
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKETS_NEAR_ME, {
2926
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_NEAR_ME, {
2934
2927
  fetchPolicy: "network-only",
2935
2928
  skip: !location.latitude || !location.longitude,
2936
2929
  variables: {
@@ -2944,7 +2937,7 @@ var useGetMarketsNearMe = (location) => {
2944
2937
  return { error, loading, marketsNearMe, refetch };
2945
2938
  };
2946
2939
  var useGetMarketInfo = (marketId) => {
2947
- const { loading, error, data, refetch } = (0, import_client18.useQuery)(GET_MARKET_INFO, {
2940
+ const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET_INFO, {
2948
2941
  fetchPolicy: "network-only",
2949
2942
  skip: !marketId,
2950
2943
  variables: { marketId }
@@ -2954,14 +2947,14 @@ var useGetMarketInfo = (marketId) => {
2954
2947
  };
2955
2948
 
2956
2949
  // src/graphql/hooks/notifications/hooksMutation.ts
2957
- var import_client21 = require("@apollo/client");
2950
+ var import_client20 = require("@apollo/client");
2958
2951
 
2959
2952
  // src/graphql/mutations/notification.ts
2960
- var import_client20 = require("@apollo/client");
2953
+ var import_client19 = require("@apollo/client");
2961
2954
 
2962
2955
  // src/graphql/queries/notification.ts
2963
- var import_client19 = require("@apollo/client");
2964
- var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
2956
+ var import_client18 = require("@apollo/client");
2957
+ var USER_NOTIFICATION_FRAGMENT = import_client18.gql`
2965
2958
  fragment UserNotificationFields on Notification {
2966
2959
  _id
2967
2960
  userId
@@ -2974,7 +2967,7 @@ var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
2974
2967
  updatedAt
2975
2968
  }
2976
2969
  `;
2977
- var GET_USER_NOTIFICATIONS = import_client19.gql`
2970
+ var GET_USER_NOTIFICATIONS = import_client18.gql`
2978
2971
  query getUserNotifications($userId: String!, $limit: Int, $offset: Int) {
2979
2972
  userNotifications(userId: $userId, limit: $limit, offset: $offset) {
2980
2973
  ...UserNotificationFields
@@ -2982,7 +2975,7 @@ var GET_USER_NOTIFICATIONS = import_client19.gql`
2982
2975
  }
2983
2976
  ${USER_NOTIFICATION_FRAGMENT}
2984
2977
  `;
2985
- var GET_NOTIFICATION_COUNT = import_client19.gql`
2978
+ var GET_NOTIFICATION_COUNT = import_client18.gql`
2986
2979
  query getNotificationCount($userId: String!) {
2987
2980
  notificationCount(userId: $userId) {
2988
2981
  total
@@ -2992,15 +2985,7 @@ var GET_NOTIFICATION_COUNT = import_client19.gql`
2992
2985
  `;
2993
2986
 
2994
2987
  // src/graphql/mutations/notification.ts
2995
- var CREATE_NOTIFICATION = import_client20.gql`
2996
- mutation createNotification($input: CreateNotificationInput!) {
2997
- createNotification(input: $input) {
2998
- ...UserNotificationFields
2999
- }
3000
- }
3001
- ${USER_NOTIFICATION_FRAGMENT}
3002
- `;
3003
- var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
2988
+ var CREATE_BULK_NOTIFICATIONS = import_client19.gql`
3004
2989
  mutation createBulkNotifications($input: CreateBulkNotificationInput!) {
3005
2990
  createBulkNotifications(input: $input) {
3006
2991
  ...UserNotificationFields
@@ -3008,7 +2993,7 @@ var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
3008
2993
  }
3009
2994
  ${USER_NOTIFICATION_FRAGMENT}
3010
2995
  `;
3011
- var MARK_NOTIFICATION_READ = import_client20.gql`
2996
+ var MARK_NOTIFICATION_READ = import_client19.gql`
3012
2997
  mutation markNotificationRead($input: MarkNotificationReadInput!) {
3013
2998
  markNotificationRead(input: $input) {
3014
2999
  ...UserNotificationFields
@@ -3016,30 +3001,26 @@ var MARK_NOTIFICATION_READ = import_client20.gql`
3016
3001
  }
3017
3002
  ${USER_NOTIFICATION_FRAGMENT}
3018
3003
  `;
3019
- var MARK_ALL_NOTIFICATIONS_READ = import_client20.gql`
3004
+ var MARK_ALL_NOTIFICATIONS_READ = import_client19.gql`
3020
3005
  mutation markAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
3021
3006
  markAllNotificationsRead(input: $input)
3022
3007
  }
3023
3008
  `;
3024
- var DELETE_NOTIFICATION = import_client20.gql`
3009
+ var DELETE_NOTIFICATION = import_client19.gql`
3025
3010
  mutation deleteNotification($_id: ID!) {
3026
3011
  deleteNotification(_id: $_id)
3027
3012
  }
3028
3013
  `;
3029
3014
 
3030
3015
  // src/graphql/hooks/notifications/hooksMutation.ts
3031
- var useCreateNotification = () => {
3032
- const [createNotification, { loading, error }] = (0, import_client21.useMutation)(CREATE_NOTIFICATION);
3033
- return { createNotification, error, loading };
3034
- };
3035
3016
  var useCreateBulkNotifications = () => {
3036
- const [createBulkNotifications, { loading, error }] = (0, import_client21.useMutation)(
3017
+ const [createBulkNotifications, { loading, error }] = (0, import_client20.useMutation)(
3037
3018
  CREATE_BULK_NOTIFICATIONS
3038
3019
  );
3039
3020
  return { createBulkNotifications, error, loading };
3040
3021
  };
3041
3022
  var useMarkNotificationRead = () => {
3042
- const [markNotificationRead, { loading, error }] = (0, import_client21.useMutation)(
3023
+ const [markNotificationRead, { loading, error }] = (0, import_client20.useMutation)(
3043
3024
  MARK_NOTIFICATION_READ,
3044
3025
  {
3045
3026
  refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
@@ -3048,7 +3029,7 @@ var useMarkNotificationRead = () => {
3048
3029
  return { error, loading, markNotificationRead };
3049
3030
  };
3050
3031
  var useMarkAllNotificationsRead = () => {
3051
- const [markAllNotificationsRead, { loading, error }] = (0, import_client21.useMutation)(
3032
+ const [markAllNotificationsRead, { loading, error }] = (0, import_client20.useMutation)(
3052
3033
  MARK_ALL_NOTIFICATIONS_READ,
3053
3034
  {
3054
3035
  refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
@@ -3057,7 +3038,7 @@ var useMarkAllNotificationsRead = () => {
3057
3038
  return { error, loading, markAllNotificationsRead };
3058
3039
  };
3059
3040
  var useDeleteNotification = () => {
3060
- const [deleteNotification, { loading, error }] = (0, import_client21.useMutation)(
3041
+ const [deleteNotification, { loading, error }] = (0, import_client20.useMutation)(
3061
3042
  DELETE_NOTIFICATION,
3062
3043
  {
3063
3044
  refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
@@ -3066,40 +3047,62 @@ var useDeleteNotification = () => {
3066
3047
  return { deleteNotification, error, loading };
3067
3048
  };
3068
3049
 
3069
- // src/graphql/hooks/notifications/hooksQuery.ts
3050
+ // src/graphql/hooks/notifications/hooksSubscription.ts
3070
3051
  var import_client22 = require("@apollo/client");
3071
- var useGetUserNotifications = (userId, limit, offset) => {
3072
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_USER_NOTIFICATIONS, {
3073
- fetchPolicy: "no-cache",
3074
- skip: !userId,
3075
- variables: {
3076
- limit: limit ?? 50,
3077
- offset: offset ?? 0,
3078
- userId
3052
+
3053
+ // src/graphql/subscriptions/notification.ts
3054
+ var import_client21 = require("@apollo/client");
3055
+ var USER_NOTIFICATION_FRAGMENT2 = import_client21.gql`
3056
+ fragment UserNotificationFields on Notification {
3057
+ _id
3058
+ userId
3059
+ title
3060
+ message
3061
+ type
3062
+ isRead
3063
+ data
3064
+ createdAt
3065
+ updatedAt
3066
+ }
3067
+ `;
3068
+ var GET_USER_NOTIFICATIONS_SUBSCRIPTION = import_client21.gql`
3069
+ subscription getUserNotifications($userId: String!) {
3070
+ getUserNotifications(userId: $userId) {
3071
+ ...UserNotificationFields
3072
+ }
3073
+ }
3074
+ ${USER_NOTIFICATION_FRAGMENT2}
3075
+ `;
3076
+ var GET_NOTIFICATION_COUNT_SUBSCRIPTION = import_client21.gql`
3077
+ subscription getNotificationCount($userId: String!) {
3078
+ getNotificationCount(userId: $userId) {
3079
+ total
3080
+ unread
3079
3081
  }
3082
+ }
3083
+ `;
3084
+
3085
+ // src/graphql/hooks/notifications/hooksSubscription.ts
3086
+ var useGetUserNotificationsSubscription = (userId) => {
3087
+ const { data, loading, error } = (0, import_client22.useSubscription)(GET_USER_NOTIFICATIONS_SUBSCRIPTION, {
3088
+ skip: !userId,
3089
+ variables: { userId }
3080
3090
  });
3081
- const notifications = data?.userNotifications;
3082
3091
  return {
3083
3092
  error,
3084
3093
  loading,
3085
- notifications,
3086
- refetch
3094
+ notifications: data?.getUserNotifications || []
3087
3095
  };
3088
3096
  };
3089
- var useGetNotificationCount = (userId) => {
3090
- const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_NOTIFICATION_COUNT, {
3091
- fetchPolicy: "no-cache",
3097
+ var useGetNotificationCountSubscription = (userId) => {
3098
+ const { data, loading, error } = (0, import_client22.useSubscription)(GET_NOTIFICATION_COUNT_SUBSCRIPTION, {
3092
3099
  skip: !userId,
3093
- variables: {
3094
- userId
3095
- }
3100
+ variables: { userId }
3096
3101
  });
3097
- const notificationCount = data?.notificationCount;
3098
3102
  return {
3099
3103
  error,
3100
3104
  loading,
3101
- notificationCount,
3102
- refetch
3105
+ notificationCount: data?.getNotificationCount || { total: 0, unread: 0 }
3103
3106
  };
3104
3107
  };
3105
3108
 
@@ -5236,7 +5239,6 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5236
5239
  EnumSocialMedia,
5237
5240
  EnumUserLicence,
5238
5241
  EnumUserRole,
5239
- GET_CHAT_MESSAGE,
5240
5242
  ImageTypeEnum,
5241
5243
  SAVED_EMAIL_KEY,
5242
5244
  SAVED_PASSWORD_KEY,
@@ -5314,7 +5316,6 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5314
5316
  useCreateChat,
5315
5317
  useCreateMarket,
5316
5318
  useCreateMarketInfo,
5317
- useCreateNotification,
5318
5319
  useCreatePoster,
5319
5320
  useCreatePushToken,
5320
5321
  useCreateRelation,
@@ -5337,7 +5338,7 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5337
5338
  useGetMarkets,
5338
5339
  useGetMarketsByRegion,
5339
5340
  useGetMarketsNearMe,
5340
- useGetNotificationCount,
5341
+ useGetNotificationCountSubscription,
5341
5342
  useGetRelation,
5342
5343
  useGetRelationByMarketAndStallholder,
5343
5344
  useGetResourceConnections,
@@ -5352,7 +5353,7 @@ var EnumNotificationType = ((EnumNotificationType2) => {
5352
5353
  useGetUserChats,
5353
5354
  useGetUserFavourites,
5354
5355
  useGetUserMarkets,
5355
- useGetUserNotifications,
5356
+ useGetUserNotificationsSubscription,
5356
5357
  useGetUserStallholder,
5357
5358
  useGetUsers,
5358
5359
  useLocationSearch,