@timardex/cluemart-shared 1.0.78 → 1.0.80

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 (46) hide show
  1. package/dist/{chunk-KPXDWQJZ.mjs → chunk-3LHMZDI4.mjs} +3 -1
  2. package/dist/chunk-3LHMZDI4.mjs.map +1 -0
  3. package/dist/chunk-SCXVJDGI.mjs +114 -0
  4. package/dist/chunk-SCXVJDGI.mjs.map +1 -0
  5. package/dist/{chunk-R5WLNKNS.mjs → chunk-ZDTBLK7U.mjs} +2 -2
  6. package/dist/enums/index.cjs +2 -0
  7. package/dist/enums/index.cjs.map +1 -1
  8. package/dist/enums/index.d.mts +2 -0
  9. package/dist/enums/index.d.ts +2 -0
  10. package/dist/enums/index.mjs +1 -1
  11. package/dist/formFields/index.cjs.map +1 -1
  12. package/dist/formFields/index.d.mts +1 -1
  13. package/dist/formFields/index.d.ts +1 -1
  14. package/dist/formFields/index.mjs +2 -2
  15. package/dist/{global-Drk9CYfv.d.ts → global-Bieh1fh8.d.mts} +2 -10
  16. package/dist/{global-2TLPFthS.d.mts → global-By7aHQ1y.d.ts} +2 -10
  17. package/dist/graphql/index.cjs +152 -104
  18. package/dist/graphql/index.cjs.map +1 -1
  19. package/dist/graphql/index.d.mts +11 -13
  20. package/dist/graphql/index.d.ts +11 -13
  21. package/dist/graphql/index.mjs +33 -85
  22. package/dist/graphql/index.mjs.map +1 -1
  23. package/dist/hooks/index.cjs +202 -0
  24. package/dist/hooks/index.cjs.map +1 -1
  25. package/dist/hooks/index.d.mts +26 -3
  26. package/dist/hooks/index.d.ts +26 -3
  27. package/dist/hooks/index.mjs +106 -2
  28. package/dist/hooks/index.mjs.map +1 -1
  29. package/dist/index.cjs +250 -104
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.mts +71 -20
  32. package/dist/index.d.ts +71 -20
  33. package/dist/index.mjs +222 -82
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/{contactUs-CQ9xTjlE.d.mts → notification-H4hE5cdq.d.mts} +38 -1
  36. package/dist/{contactUs-CQ9xTjlE.d.ts → notification-H4hE5cdq.d.ts} +38 -1
  37. package/dist/types/index.cjs.map +1 -1
  38. package/dist/types/index.d.mts +2 -2
  39. package/dist/types/index.d.ts +2 -2
  40. package/dist/utils/index.cjs.map +1 -1
  41. package/dist/utils/index.d.mts +1 -1
  42. package/dist/utils/index.d.ts +1 -1
  43. package/dist/utils/index.mjs +2 -2
  44. package/package.json +1 -1
  45. package/dist/chunk-KPXDWQJZ.mjs.map +0 -1
  46. /package/dist/{chunk-R5WLNKNS.mjs.map → chunk-ZDTBLK7U.mjs.map} +0 -0
package/dist/index.cjs CHANGED
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ CREATE_BULK_NOTIFICATIONS: () => CREATE_BULK_NOTIFICATIONS,
34
+ CREATE_NOTIFICATION: () => CREATE_NOTIFICATION,
33
35
  EnumInviteStatus: () => EnumInviteStatus,
34
36
  EnumNotification: () => EnumNotification,
35
37
  EnumOSType: () => EnumOSType,
@@ -41,7 +43,12 @@ __export(index_exports, {
41
43
  EnumSocialMedia: () => EnumSocialMedia,
42
44
  EnumUserLicence: () => EnumUserLicence,
43
45
  EnumUserRole: () => EnumUserRole,
46
+ GET_NOTIFICATION_COUNT: () => GET_NOTIFICATION_COUNT,
47
+ GET_UNREAD_NOTIFICATIONS: () => GET_UNREAD_NOTIFICATIONS,
48
+ GET_USER_NOTIFICATIONS: () => GET_USER_NOTIFICATIONS2,
44
49
  ImageTypeEnum: () => ImageTypeEnum,
50
+ MARK_ALL_NOTIFICATIONS_READ: () => MARK_ALL_NOTIFICATIONS_READ,
51
+ MARK_NOTIFICATION_READ: () => MARK_NOTIFICATION_READ,
45
52
  SAVED_EMAIL_KEY: () => SAVED_EMAIL_KEY,
46
53
  SAVED_PASSWORD_KEY: () => SAVED_PASSWORD_KEY,
47
54
  SAVED_REFRESH_TOKEN_KEY: () => SAVED_REFRESH_TOKEN_KEY,
@@ -131,14 +138,12 @@ __export(index_exports, {
131
138
  useDeleteTester: () => useDeleteTester,
132
139
  useDeleteUser: () => useDeleteUser,
133
140
  useGetChat: () => useGetChat,
134
- useGetChatSubscription: () => useGetChatSubscription,
135
141
  useGetMarket: () => useGetMarket,
136
142
  useGetMarketInfo: () => useGetMarketInfo,
137
143
  useGetMarketRelations: () => useGetMarketRelations,
138
144
  useGetMarkets: () => useGetMarkets,
139
145
  useGetMarketsByRegion: () => useGetMarketsByRegion,
140
146
  useGetMarketsNearMe: () => useGetMarketsNearMe,
141
- useGetNotification: () => useGetNotification,
142
147
  useGetRelation: () => useGetRelation,
143
148
  useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
144
149
  useGetResourceConnections: () => useGetResourceConnections,
@@ -162,6 +167,7 @@ __export(index_exports, {
162
167
  useLogout: () => useLogout,
163
168
  useMarketForm: () => useMarketForm,
164
169
  useMarketInfoForm: () => useMarketInfoForm,
170
+ useNotifications: () => useNotifications,
165
171
  useRefreshToken: () => useRefreshToken,
166
172
  useRegister: () => useRegister,
167
173
  useRegisterForm: () => useRegisterForm,
@@ -228,6 +234,8 @@ var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource2) => {
228
234
  var EnumNotification = /* @__PURE__ */ ((EnumNotification2) => {
229
235
  EnumNotification2["CREATED_MARKET"] = "created_market";
230
236
  EnumNotification2["CREATED_STALLHOLDER"] = "created_stallholder";
237
+ EnumNotification2["APPROVED_MARKET"] = "approved_market";
238
+ EnumNotification2["APPROVED_STALLHOLDER"] = "approved_stallholder";
231
239
  EnumNotification2["NEW_CHAT_MESSAGE"] = "new_chat_message";
232
240
  EnumNotification2["MARKET_INVITE_STALLHOLDER"] = "market_invite_stallholder" /* MARKET_INVITE_STALLHOLDER */;
233
241
  EnumNotification2["STALLHOLDER_APPLICATION_TO_MARKET"] = "stallholder_application_to_market" /* STALLHOLDER_APPLICATION_TO_MARKET */;
@@ -3568,81 +3576,15 @@ var useGetStallholderInfo = (stallholderId) => {
3568
3576
  };
3569
3577
  };
3570
3578
 
3571
- // src/graphql/hooks/subscriptions.ts
3572
- var import_client31 = require("@apollo/client");
3573
-
3574
- // src/graphql/subscriptions/chat.ts
3575
- var import_client29 = require("@apollo/client");
3576
- var GET_CHAT_MESSAGE = import_client29.gql`
3577
- subscription {
3578
- getChatMessage {
3579
- ...ChatFields
3580
- }
3581
- }
3582
- ${CHAT_FIELDS_FRAGMENT}
3583
- `;
3584
-
3585
- // src/graphql/subscriptions/notification.ts
3586
- var import_client30 = require("@apollo/client");
3587
- var NOTIFICATION_FIELDS_FRAGMENT = import_client30.gql`
3588
- fragment NotificationFields on NotificationType {
3589
- createdBy
3590
- important
3591
- message
3592
- notifyUser
3593
- resourceId
3594
- resourceType
3595
- }
3596
- `;
3597
- var GET_GLOBAL_NOTIFICATION = import_client30.gql`
3598
- subscription {
3599
- getGlobalNotification {
3600
- ...NotificationFields
3601
- }
3602
- }
3603
- ${NOTIFICATION_FIELDS_FRAGMENT}
3604
- `;
3605
- var GET_RELATION_NOTIFICATION = import_client30.gql`
3606
- subscription {
3607
- getRelationNotification {
3608
- ...NotificationFields
3609
- }
3610
- }
3611
- ${NOTIFICATION_FIELDS_FRAGMENT}
3612
- `;
3613
-
3614
- // src/graphql/hooks/subscriptions.ts
3615
- var useGetNotification = () => {
3616
- const {
3617
- data: global,
3618
- loading: loadingGlobal,
3619
- error: errorGlobal
3620
- } = (0, import_client31.useSubscription)(GET_GLOBAL_NOTIFICATION);
3621
- const {
3622
- data: relation,
3623
- loading: loadingImportant,
3624
- error: errorImportant
3625
- } = (0, import_client31.useSubscription)(GET_RELATION_NOTIFICATION);
3626
- const error = errorGlobal || errorImportant;
3627
- const loading = loadingGlobal || loadingImportant;
3628
- const notification = relation?.getRelationNotification || global?.getGlobalNotification;
3629
- return { error, loading, notification };
3630
- };
3631
- var useGetChatSubscription = () => {
3632
- const { data, loading, error } = (0, import_client31.useSubscription)(GET_CHAT_MESSAGE);
3633
- const chat = data?.getChat;
3634
- return { chat, error, loading };
3635
- };
3636
-
3637
3579
  // src/graphql/hooks/testers/hooksMutation.ts
3638
- var import_client34 = require("@apollo/client");
3580
+ var import_client31 = require("@apollo/client");
3639
3581
 
3640
3582
  // src/graphql/mutations/testers.ts
3641
- var import_client33 = require("@apollo/client");
3583
+ var import_client30 = require("@apollo/client");
3642
3584
 
3643
3585
  // src/graphql/queries/testers.ts
3644
- var import_client32 = require("@apollo/client");
3645
- var TESTER_FIELDS_FRAGMENT = import_client32.gql`
3586
+ var import_client29 = require("@apollo/client");
3587
+ var TESTER_FIELDS_FRAGMENT = import_client29.gql`
3646
3588
  fragment TesterFields on TesterType {
3647
3589
  _id
3648
3590
  active
@@ -3655,7 +3597,7 @@ var TESTER_FIELDS_FRAGMENT = import_client32.gql`
3655
3597
  updatedAt
3656
3598
  }
3657
3599
  `;
3658
- var GET_TESTERS = import_client32.gql`
3600
+ var GET_TESTERS = import_client29.gql`
3659
3601
  query getTesters {
3660
3602
  testers {
3661
3603
  ...TesterFields
@@ -3663,7 +3605,7 @@ var GET_TESTERS = import_client32.gql`
3663
3605
  }
3664
3606
  ${TESTER_FIELDS_FRAGMENT}
3665
3607
  `;
3666
- var GET_TESTER = import_client32.gql`
3608
+ var GET_TESTER = import_client29.gql`
3667
3609
  query getTester($_id: ID!) {
3668
3610
  tester(_id: $_id) {
3669
3611
  ...TesterFields
@@ -3673,7 +3615,7 @@ var GET_TESTER = import_client32.gql`
3673
3615
  `;
3674
3616
 
3675
3617
  // src/graphql/mutations/testers.ts
3676
- var CREATE_TESTER_MUTATION = import_client33.gql`
3618
+ var CREATE_TESTER_MUTATION = import_client30.gql`
3677
3619
  mutation createTester($input: TesterInputType!) {
3678
3620
  createTester(input: $input) {
3679
3621
  ...TesterFields
@@ -3681,7 +3623,7 @@ var CREATE_TESTER_MUTATION = import_client33.gql`
3681
3623
  }
3682
3624
  ${TESTER_FIELDS_FRAGMENT}
3683
3625
  `;
3684
- var UPDATE_TESTER_MUTATION = import_client33.gql`
3626
+ var UPDATE_TESTER_MUTATION = import_client30.gql`
3685
3627
  mutation updateTester($_id: ID!, $input: TesterInputType!) {
3686
3628
  updateTester(_id: $_id, input: $input) {
3687
3629
  ...TesterFields
@@ -3689,7 +3631,7 @@ var UPDATE_TESTER_MUTATION = import_client33.gql`
3689
3631
  }
3690
3632
  ${TESTER_FIELDS_FRAGMENT}
3691
3633
  `;
3692
- var DELETE_TESTER_MUTATION = import_client33.gql`
3634
+ var DELETE_TESTER_MUTATION = import_client30.gql`
3693
3635
  mutation deleteTester($_id: ID!) {
3694
3636
  deleteTester(_id: $_id)
3695
3637
  }
@@ -3697,7 +3639,7 @@ var DELETE_TESTER_MUTATION = import_client33.gql`
3697
3639
 
3698
3640
  // src/graphql/hooks/testers/hooksMutation.ts
3699
3641
  var useCreateTester = () => {
3700
- const [createTester, { data, loading, error }] = (0, import_client34.useMutation)(
3642
+ const [createTester, { data, loading, error }] = (0, import_client31.useMutation)(
3701
3643
  CREATE_TESTER_MUTATION
3702
3644
  );
3703
3645
  return {
@@ -3708,7 +3650,7 @@ var useCreateTester = () => {
3708
3650
  };
3709
3651
  };
3710
3652
  var useUpdateTester = () => {
3711
- const [updateTester, { data, loading, error }] = (0, import_client34.useMutation)(
3653
+ const [updateTester, { data, loading, error }] = (0, import_client31.useMutation)(
3712
3654
  UPDATE_TESTER_MUTATION
3713
3655
  );
3714
3656
  return {
@@ -3719,16 +3661,16 @@ var useUpdateTester = () => {
3719
3661
  };
3720
3662
  };
3721
3663
  var useDeleteTester = () => {
3722
- const [deleteTester, { loading, error }] = (0, import_client34.useMutation)(
3664
+ const [deleteTester, { loading, error }] = (0, import_client31.useMutation)(
3723
3665
  DELETE_TESTER_MUTATION
3724
3666
  );
3725
3667
  return { deleteTester, error, loading };
3726
3668
  };
3727
3669
 
3728
3670
  // src/graphql/hooks/testers/hooksQuery.ts
3729
- var import_client35 = require("@apollo/client");
3671
+ var import_client32 = require("@apollo/client");
3730
3672
  var useGetTesters = () => {
3731
- const { data, loading, error, refetch } = (0, import_client35.useQuery)(GET_TESTERS);
3673
+ const { data, loading, error, refetch } = (0, import_client32.useQuery)(GET_TESTERS);
3732
3674
  const testers = data?.testers;
3733
3675
  return {
3734
3676
  error,
@@ -3738,7 +3680,7 @@ var useGetTesters = () => {
3738
3680
  };
3739
3681
  };
3740
3682
  var useGetTester = (_id) => {
3741
- const { data, loading, error, refetch } = (0, import_client35.useQuery)(GET_TESTER, {
3683
+ const { data, loading, error, refetch } = (0, import_client32.useQuery)(GET_TESTER, {
3742
3684
  skip: !_id,
3743
3685
  variables: { _id }
3744
3686
  });
@@ -3747,11 +3689,11 @@ var useGetTester = (_id) => {
3747
3689
  };
3748
3690
 
3749
3691
  // src/graphql/hooks/user/hooksMutation.ts
3750
- var import_client37 = require("@apollo/client");
3692
+ var import_client34 = require("@apollo/client");
3751
3693
 
3752
3694
  // src/graphql/mutations/user.ts
3753
- var import_client36 = require("@apollo/client");
3754
- var CREATE_USER_MUTATION = import_client36.gql`
3695
+ var import_client33 = require("@apollo/client");
3696
+ var CREATE_USER_MUTATION = import_client33.gql`
3755
3697
  mutation createUser($input: UserInputType!) {
3756
3698
  createUser(input: $input) {
3757
3699
  ...UserFields
@@ -3759,7 +3701,7 @@ var CREATE_USER_MUTATION = import_client36.gql`
3759
3701
  }
3760
3702
  ${USER_FIELDS_FRAGMENT}
3761
3703
  `;
3762
- var UPDATE_USER_MUTATION = import_client36.gql`
3704
+ var UPDATE_USER_MUTATION = import_client33.gql`
3763
3705
  mutation updateUser($_id: ID!, $input: UserInputType!) {
3764
3706
  updateUser(_id: $_id, input: $input) {
3765
3707
  ...UserFields
@@ -3767,12 +3709,12 @@ var UPDATE_USER_MUTATION = import_client36.gql`
3767
3709
  }
3768
3710
  ${USER_FIELDS_FRAGMENT}
3769
3711
  `;
3770
- var DELETE_USER_MUTATION = import_client36.gql`
3712
+ var DELETE_USER_MUTATION = import_client33.gql`
3771
3713
  mutation deleteUser($_id: ID!) {
3772
3714
  deleteUser(_id: $_id)
3773
3715
  }
3774
3716
  `;
3775
- var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client36.gql`
3717
+ var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client33.gql`
3776
3718
  mutation addUserFavouriteResource(
3777
3719
  $resourceId: ID!
3778
3720
  $resourceType: ResourceTypeEnum!
@@ -3788,7 +3730,7 @@ var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client36.gql`
3788
3730
  }
3789
3731
  ${USER_FIELDS_FRAGMENT}
3790
3732
  `;
3791
- var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client36.gql`
3733
+ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client33.gql`
3792
3734
  mutation removeUserFavouriteResource(
3793
3735
  $resourceId: ID!
3794
3736
  $resourceType: ResourceTypeEnum!
@@ -3807,11 +3749,11 @@ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client36.gql`
3807
3749
 
3808
3750
  // src/graphql/hooks/user/hooksMutation.ts
3809
3751
  var useCreateUser = () => {
3810
- const [createUser, { loading, error }] = (0, import_client37.useMutation)(CREATE_USER_MUTATION);
3752
+ const [createUser, { loading, error }] = (0, import_client34.useMutation)(CREATE_USER_MUTATION);
3811
3753
  return { createUser, error, loading };
3812
3754
  };
3813
3755
  var useUpdateUser = () => {
3814
- const [updateUser, { loading, error }] = (0, import_client37.useMutation)(UPDATE_USER_MUTATION, {
3756
+ const [updateUser, { loading, error }] = (0, import_client34.useMutation)(UPDATE_USER_MUTATION, {
3815
3757
  awaitRefetchQueries: true,
3816
3758
  refetchQueries: (mutationResult) => {
3817
3759
  const userId = mutationResult?.data?.updateUser?._id;
@@ -3822,11 +3764,11 @@ var useUpdateUser = () => {
3822
3764
  return { error, loading, updateUser };
3823
3765
  };
3824
3766
  var useDeleteUser = () => {
3825
- const [deleteUser, { loading, error }] = (0, import_client37.useMutation)(DELETE_USER_MUTATION);
3767
+ const [deleteUser, { loading, error }] = (0, import_client34.useMutation)(DELETE_USER_MUTATION);
3826
3768
  return { deleteUser, error, loading };
3827
3769
  };
3828
3770
  var useAddUserFavouriteResource = () => {
3829
- const [addUserFavouriteResource, { loading, error }] = (0, import_client37.useMutation)(
3771
+ const [addUserFavouriteResource, { loading, error }] = (0, import_client34.useMutation)(
3830
3772
  ADD_USER_FAVOURITE_RESOURCE_MUTATION,
3831
3773
  {
3832
3774
  awaitRefetchQueries: true,
@@ -3836,7 +3778,7 @@ var useAddUserFavouriteResource = () => {
3836
3778
  return { addUserFavouriteResource, error, loading };
3837
3779
  };
3838
3780
  var useRemoveUserFavouriteResource = () => {
3839
- const [removeUserFavouriteResource, { loading, error }] = (0, import_client37.useMutation)(
3781
+ const [removeUserFavouriteResource, { loading, error }] = (0, import_client34.useMutation)(
3840
3782
  REMOVE_USER_FAVOURITE_RESOURCE_MUTATION,
3841
3783
  {
3842
3784
  awaitRefetchQueries: true,
@@ -3847,37 +3789,37 @@ var useRemoveUserFavouriteResource = () => {
3847
3789
  };
3848
3790
 
3849
3791
  // src/graphql/hooks/user/hooksQuery.ts
3850
- var import_client38 = require("@apollo/client");
3792
+ var import_client35 = require("@apollo/client");
3851
3793
  var useGetUsers = () => {
3852
- const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_USERS, {
3794
+ const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USERS, {
3853
3795
  fetchPolicy: "network-only"
3854
3796
  });
3855
3797
  const users = data?.users;
3856
3798
  return { error, loading, refetch, users };
3857
3799
  };
3858
3800
  var useGetUser = (_id) => {
3859
- const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_USER, {
3801
+ const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER, {
3860
3802
  variables: { _id }
3861
3803
  });
3862
3804
  const user = data?.user;
3863
3805
  return { error, loading, refetch, user };
3864
3806
  };
3865
3807
  var useGetUserMarkets = () => {
3866
- const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_USER_MARKETS, {
3808
+ const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_MARKETS, {
3867
3809
  fetchPolicy: "network-only"
3868
3810
  });
3869
3811
  const userMarkets = data?.userMarkets;
3870
3812
  return { error, loading, refetch, userMarkets };
3871
3813
  };
3872
3814
  var useGetUserStallholder = () => {
3873
- const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_USER_STALLHOLDER, {
3815
+ const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_STALLHOLDER, {
3874
3816
  fetchPolicy: "network-only"
3875
3817
  });
3876
3818
  const userStallholder = data?.userStallholder;
3877
3819
  return { error, loading, refetch, userStallholder };
3878
3820
  };
3879
3821
  var useGetUserFavourites = () => {
3880
- const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_USER_FAVOURITES, {
3822
+ const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_FAVOURITES, {
3881
3823
  fetchPolicy: "network-only"
3882
3824
  });
3883
3825
  const markets = data?.userFavourites.markets;
@@ -3889,13 +3831,117 @@ var useGetUserFavourites = () => {
3889
3831
  return { error, loading, refetch, userFavourites };
3890
3832
  };
3891
3833
  var useGetUserNotifications = () => {
3892
- const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_USER_NOTIFICATIONS, {
3834
+ const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_NOTIFICATIONS, {
3893
3835
  fetchPolicy: "network-only"
3894
3836
  });
3895
3837
  const userNotifications = data?.userNotifications;
3896
3838
  return { error, loading, refetch, userNotifications };
3897
3839
  };
3898
3840
 
3841
+ // src/graphql/queries/notificationQueries.ts
3842
+ var import_client36 = require("@apollo/client");
3843
+ var GET_USER_NOTIFICATIONS2 = import_client36.gql`
3844
+ query GetUserNotifications(
3845
+ $userId: String!
3846
+ $limit: Int
3847
+ $offset: Int
3848
+ $isRead: String
3849
+ ) {
3850
+ userNotifications(
3851
+ userId: $userId
3852
+ limit: $limit
3853
+ offset: $offset
3854
+ isRead: $isRead
3855
+ ) {
3856
+ id
3857
+ userId
3858
+ title
3859
+ message
3860
+ type
3861
+ isRead
3862
+ data
3863
+ createdAt
3864
+ updatedAt
3865
+ }
3866
+ }
3867
+ `;
3868
+ var GET_NOTIFICATION_COUNT = import_client36.gql`
3869
+ query GetNotificationCount($userId: String!) {
3870
+ notificationCount(userId: $userId) {
3871
+ total
3872
+ unread
3873
+ }
3874
+ }
3875
+ `;
3876
+ var GET_UNREAD_NOTIFICATIONS = import_client36.gql`
3877
+ query GetUnreadNotifications($userId: String!, $limit: Int) {
3878
+ unreadNotifications(userId: $userId, limit: $limit) {
3879
+ id
3880
+ userId
3881
+ title
3882
+ message
3883
+ type
3884
+ isRead
3885
+ data
3886
+ createdAt
3887
+ updatedAt
3888
+ }
3889
+ }
3890
+ `;
3891
+
3892
+ // src/graphql/mutations/notificationMutations.ts
3893
+ var import_client37 = require("@apollo/client");
3894
+ var CREATE_NOTIFICATION = import_client37.gql`
3895
+ mutation CreateNotification($input: CreateNotificationInput!) {
3896
+ createNotification(input: $input) {
3897
+ id
3898
+ userId
3899
+ title
3900
+ message
3901
+ type
3902
+ isRead
3903
+ data
3904
+ createdAt
3905
+ updatedAt
3906
+ }
3907
+ }
3908
+ `;
3909
+ var CREATE_BULK_NOTIFICATIONS = import_client37.gql`
3910
+ mutation CreateBulkNotifications($input: CreateBulkNotificationInput!) {
3911
+ createBulkNotifications(input: $input) {
3912
+ id
3913
+ userId
3914
+ title
3915
+ message
3916
+ type
3917
+ isRead
3918
+ data
3919
+ createdAt
3920
+ updatedAt
3921
+ }
3922
+ }
3923
+ `;
3924
+ var MARK_NOTIFICATION_READ = import_client37.gql`
3925
+ mutation MarkNotificationRead($input: MarkNotificationReadInput!) {
3926
+ markNotificationRead(input: $input) {
3927
+ id
3928
+ userId
3929
+ title
3930
+ message
3931
+ type
3932
+ isRead
3933
+ data
3934
+ createdAt
3935
+ updatedAt
3936
+ }
3937
+ }
3938
+ `;
3939
+ var MARK_ALL_NOTIFICATIONS_READ = import_client37.gql`
3940
+ mutation MarkAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
3941
+ markAllNotificationsRead(input: $input)
3942
+ }
3943
+ `;
3944
+
3899
3945
  // src/hooks/useLocationSearch.ts
3900
3946
  var handleApiError = (error, message) => {
3901
3947
  console.error(message, error);
@@ -5076,6 +5122,100 @@ function useContactUsForm(data) {
5076
5122
  };
5077
5123
  }
5078
5124
 
5125
+ // src/hooks/useNotifications.ts
5126
+ var import_client38 = require("@apollo/client");
5127
+ var useNotifications = (userId) => {
5128
+ const client = (0, import_client38.useApolloClient)();
5129
+ const {
5130
+ data: notificationsData,
5131
+ loading: notificationsLoading,
5132
+ error: notificationsError,
5133
+ refetch: refetchNotifications
5134
+ } = (0, import_client38.useQuery)(GET_USER_NOTIFICATIONS2, {
5135
+ variables: { userId, limit: 50, offset: 0 },
5136
+ fetchPolicy: "cache-and-network"
5137
+ });
5138
+ const {
5139
+ data: countData,
5140
+ loading: countLoading,
5141
+ error: countError,
5142
+ refetch: refetchCount
5143
+ } = (0, import_client38.useQuery)(GET_NOTIFICATION_COUNT, {
5144
+ variables: { userId },
5145
+ fetchPolicy: "cache-and-network"
5146
+ });
5147
+ const {
5148
+ data: unreadData,
5149
+ loading: unreadLoading,
5150
+ error: unreadError,
5151
+ refetch: refetchUnread
5152
+ } = (0, import_client38.useQuery)(GET_UNREAD_NOTIFICATIONS, {
5153
+ variables: { userId, limit: 20 },
5154
+ fetchPolicy: "cache-and-network"
5155
+ });
5156
+ const [createNotification, { loading: createLoading }] = (0, import_client38.useMutation)(CREATE_NOTIFICATION);
5157
+ const [createBulkNotifications, { loading: createBulkLoading }] = (0, import_client38.useMutation)(
5158
+ CREATE_BULK_NOTIFICATIONS
5159
+ );
5160
+ const [markNotificationRead, { loading: markReadLoading }] = (0, import_client38.useMutation)(
5161
+ MARK_NOTIFICATION_READ
5162
+ );
5163
+ const [markAllNotificationsRead, { loading: markAllReadLoading }] = (0, import_client38.useMutation)(MARK_ALL_NOTIFICATIONS_READ);
5164
+ const refetchAll = () => {
5165
+ refetchNotifications();
5166
+ refetchCount();
5167
+ refetchUnread();
5168
+ };
5169
+ const invalidateCache = () => {
5170
+ client.cache.evict({ fieldName: "userNotifications" });
5171
+ client.cache.evict({ fieldName: "notificationCount" });
5172
+ client.cache.evict({ fieldName: "unreadNotifications" });
5173
+ client.cache.gc();
5174
+ };
5175
+ return {
5176
+ // Data
5177
+ notifications: notificationsData?.userNotifications || [],
5178
+ count: countData?.notificationCount || { total: 0, unread: 0 },
5179
+ unreadNotifications: unreadData?.unreadNotifications || [],
5180
+ // Loading states
5181
+ notificationsLoading,
5182
+ countLoading,
5183
+ unreadLoading,
5184
+ createLoading,
5185
+ createBulkLoading,
5186
+ markReadLoading,
5187
+ markAllReadLoading,
5188
+ // Errors
5189
+ notificationsError,
5190
+ countError,
5191
+ unreadError,
5192
+ // Actions
5193
+ createNotification: async (input) => {
5194
+ const result = await createNotification({ variables: { input } });
5195
+ refetchAll();
5196
+ return result;
5197
+ },
5198
+ createBulkNotifications: async (input) => {
5199
+ const result = await createBulkNotifications({ variables: { input } });
5200
+ refetchAll();
5201
+ return result;
5202
+ },
5203
+ markNotificationRead: async (input) => {
5204
+ const result = await markNotificationRead({ variables: { input } });
5205
+ refetchAll();
5206
+ return result;
5207
+ },
5208
+ markAllNotificationsRead: async (input) => {
5209
+ const result = await markAllNotificationsRead({ variables: { input } });
5210
+ refetchAll();
5211
+ return result;
5212
+ },
5213
+ // Utilities
5214
+ refetchAll,
5215
+ invalidateCache
5216
+ };
5217
+ };
5218
+
5079
5219
  // src/storage/index.ts
5080
5220
  var SAVED_PASSWORD_KEY = "savedPassword";
5081
5221
  var SAVED_EMAIL_KEY = "savedEmail";
@@ -5122,6 +5262,8 @@ var fonts = {
5122
5262
  };
5123
5263
  // Annotate the CommonJS export names for ESM import in node:
5124
5264
  0 && (module.exports = {
5265
+ CREATE_BULK_NOTIFICATIONS,
5266
+ CREATE_NOTIFICATION,
5125
5267
  EnumInviteStatus,
5126
5268
  EnumNotification,
5127
5269
  EnumOSType,
@@ -5133,7 +5275,12 @@ var fonts = {
5133
5275
  EnumSocialMedia,
5134
5276
  EnumUserLicence,
5135
5277
  EnumUserRole,
5278
+ GET_NOTIFICATION_COUNT,
5279
+ GET_UNREAD_NOTIFICATIONS,
5280
+ GET_USER_NOTIFICATIONS,
5136
5281
  ImageTypeEnum,
5282
+ MARK_ALL_NOTIFICATIONS_READ,
5283
+ MARK_NOTIFICATION_READ,
5137
5284
  SAVED_EMAIL_KEY,
5138
5285
  SAVED_PASSWORD_KEY,
5139
5286
  SAVED_REFRESH_TOKEN_KEY,
@@ -5223,14 +5370,12 @@ var fonts = {
5223
5370
  useDeleteTester,
5224
5371
  useDeleteUser,
5225
5372
  useGetChat,
5226
- useGetChatSubscription,
5227
5373
  useGetMarket,
5228
5374
  useGetMarketInfo,
5229
5375
  useGetMarketRelations,
5230
5376
  useGetMarkets,
5231
5377
  useGetMarketsByRegion,
5232
5378
  useGetMarketsNearMe,
5233
- useGetNotification,
5234
5379
  useGetRelation,
5235
5380
  useGetRelationByMarketAndStallholder,
5236
5381
  useGetResourceConnections,
@@ -5254,6 +5399,7 @@ var fonts = {
5254
5399
  useLogout,
5255
5400
  useMarketForm,
5256
5401
  useMarketInfoForm,
5402
+ useNotifications,
5257
5403
  useRefreshToken,
5258
5404
  useRegister,
5259
5405
  useRegisterForm,