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