@timardex/cluemart-shared 1.0.86 → 1.0.88

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.
@@ -584,8 +584,8 @@ var ADD_PARTICIPANT_TO_CHAT_MUTATION = gql7`
584
584
  addParticipantToChat(_id: $_id, input: $input) {
585
585
  ...ChatFields
586
586
  }
587
- ${CHAT_FIELDS_FRAGMENT}
588
587
  }
588
+ ${CHAT_FIELDS_FRAGMENT}
589
589
  `;
590
590
  var REMOVE_PARTICIPANT_FROM_CHAT_MUTATION = gql7`
591
591
  mutation removeParticipantFromChat($_id: ID!, $input: ID!) {
@@ -978,16 +978,16 @@ var USER_NOTIFICATION_FRAGMENT = gql11`
978
978
  }
979
979
  `;
980
980
  var GET_USER_NOTIFICATIONS = gql11`
981
- query getUserNotifications($userId: String!, $limit: Int, $offset: Int) {
982
- userNotifications(userId: $userId, limit: $limit, offset: $offset) {
981
+ query getUserNotifications($limit: Int, $offset: Int) {
982
+ userNotifications(limit: $limit, offset: $offset) {
983
983
  ...UserNotificationFields
984
984
  }
985
985
  }
986
986
  ${USER_NOTIFICATION_FRAGMENT}
987
987
  `;
988
988
  var GET_NOTIFICATION_COUNT = gql11`
989
- query getNotificationCount($userId: String!) {
990
- notificationCount(userId: $userId) {
989
+ query getNotificationCount {
990
+ notificationCount {
991
991
  total
992
992
  unread
993
993
  }
@@ -1004,16 +1004,16 @@ var CREATE_BULK_NOTIFICATIONS = gql12`
1004
1004
  ${USER_NOTIFICATION_FRAGMENT}
1005
1005
  `;
1006
1006
  var MARK_NOTIFICATION_READ = gql12`
1007
- mutation markNotificationRead($input: MarkNotificationReadInput!) {
1008
- markNotificationRead(input: $input) {
1007
+ mutation markNotificationRead($_id: ID!) {
1008
+ markNotificationRead(_id: $_id) {
1009
1009
  ...UserNotificationFields
1010
1010
  }
1011
1011
  }
1012
1012
  ${USER_NOTIFICATION_FRAGMENT}
1013
1013
  `;
1014
1014
  var MARK_ALL_NOTIFICATIONS_READ = gql12`
1015
- mutation markAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
1016
- markAllNotificationsRead(input: $input)
1015
+ mutation markAllNotificationsRead {
1016
+ markAllNotificationsRead
1017
1017
  }
1018
1018
  `;
1019
1019
  var DELETE_NOTIFICATION = gql12`
@@ -1057,6 +1057,32 @@ var useDeleteNotification = () => {
1057
1057
  return { deleteNotification, error, loading };
1058
1058
  };
1059
1059
 
1060
+ // src/graphql/hooks/notifications/hooksQuery.ts
1061
+ import { useQuery as useQuery3 } from "@apollo/client";
1062
+ var useGetUserNotifications = (limit, offset) => {
1063
+ const { data, loading, error, refetch } = useQuery3(GET_USER_NOTIFICATIONS, {
1064
+ fetchPolicy: "cache-and-network",
1065
+ variables: { limit, offset }
1066
+ });
1067
+ return {
1068
+ error,
1069
+ loading,
1070
+ notifications: data?.userNotifications || [],
1071
+ refetch
1072
+ };
1073
+ };
1074
+ var useGetNotificationCount = () => {
1075
+ const { data, loading, error, refetch } = useQuery3(GET_NOTIFICATION_COUNT, {
1076
+ fetchPolicy: "cache-and-network"
1077
+ });
1078
+ return {
1079
+ error,
1080
+ loading,
1081
+ notificationCount: data?.notificationCount || { total: 0, unread: 0 },
1082
+ refetch
1083
+ };
1084
+ };
1085
+
1060
1086
  // src/graphql/hooks/notifications/hooksSubscription.ts
1061
1087
  import { useSubscription as useSubscription2 } from "@apollo/client";
1062
1088
 
@@ -1076,7 +1102,7 @@ var USER_NOTIFICATION_FRAGMENT2 = gql13`
1076
1102
  }
1077
1103
  `;
1078
1104
  var GET_USER_NOTIFICATIONS_SUBSCRIPTION = gql13`
1079
- subscription getUserNotifications($userId: String!) {
1105
+ subscription getUserNotifications($userId: ID!) {
1080
1106
  getUserNotifications(userId: $userId) {
1081
1107
  ...UserNotificationFields
1082
1108
  }
@@ -1084,7 +1110,7 @@ var GET_USER_NOTIFICATIONS_SUBSCRIPTION = gql13`
1084
1110
  ${USER_NOTIFICATION_FRAGMENT2}
1085
1111
  `;
1086
1112
  var GET_NOTIFICATION_COUNT_SUBSCRIPTION = gql13`
1087
- subscription getNotificationCount($userId: String!) {
1113
+ subscription getNotificationCount($userId: ID!) {
1088
1114
  getNotificationCount(userId: $userId) {
1089
1115
  total
1090
1116
  unread
@@ -1093,22 +1119,16 @@ var GET_NOTIFICATION_COUNT_SUBSCRIPTION = gql13`
1093
1119
  `;
1094
1120
 
1095
1121
  // src/graphql/hooks/notifications/hooksSubscription.ts
1096
- var useGetUserNotificationsSubscription = (userId) => {
1097
- const { data, loading, error } = useSubscription2(GET_USER_NOTIFICATIONS_SUBSCRIPTION, {
1098
- skip: !userId,
1099
- variables: { userId }
1100
- });
1122
+ var useGetUserNotificationsSubscription = () => {
1123
+ const { data, loading, error } = useSubscription2(GET_USER_NOTIFICATIONS_SUBSCRIPTION);
1101
1124
  return {
1102
1125
  error,
1103
1126
  loading,
1104
1127
  notifications: data?.getUserNotifications || []
1105
1128
  };
1106
1129
  };
1107
- var useGetNotificationCountSubscription = (userId) => {
1108
- const { data, loading, error } = useSubscription2(GET_NOTIFICATION_COUNT_SUBSCRIPTION, {
1109
- skip: !userId,
1110
- variables: { userId }
1111
- });
1130
+ var useGetNotificationCountSubscription = () => {
1131
+ const { data, loading, error } = useSubscription2(GET_NOTIFICATION_COUNT_SUBSCRIPTION);
1112
1132
  return {
1113
1133
  error,
1114
1134
  loading,
@@ -1511,9 +1531,9 @@ var useDeleteRelation = () => {
1511
1531
  };
1512
1532
 
1513
1533
  // src/graphql/hooks/relation/hooksQuery.ts
1514
- import { useQuery as useQuery3 } from "@apollo/client";
1534
+ import { useQuery as useQuery4 } from "@apollo/client";
1515
1535
  var useGetRelation = (id) => {
1516
- const { loading, error, data, refetch } = useQuery3(GET_RELATION, {
1536
+ const { loading, error, data, refetch } = useQuery4(GET_RELATION, {
1517
1537
  fetchPolicy: "network-only",
1518
1538
  skip: id === "",
1519
1539
  variables: { id }
@@ -1522,7 +1542,7 @@ var useGetRelation = (id) => {
1522
1542
  return { error, loading, refetch, relation };
1523
1543
  };
1524
1544
  var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1525
- const { loading, error, data, refetch } = useQuery3(
1545
+ const { loading, error, data, refetch } = useQuery4(
1526
1546
  GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1527
1547
  {
1528
1548
  fetchPolicy: "network-only",
@@ -1534,7 +1554,7 @@ var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1534
1554
  return { error, loading, refetch, relationByMarketAndStallholder };
1535
1555
  };
1536
1556
  var useGetMarketRelations = (marketId) => {
1537
- const { loading, error, data, refetch } = useQuery3(GET_MARKET_RELATIONS, {
1557
+ const { loading, error, data, refetch } = useQuery4(GET_MARKET_RELATIONS, {
1538
1558
  fetchPolicy: "network-only",
1539
1559
  skip: marketId === "",
1540
1560
  variables: { marketId }
@@ -1543,7 +1563,7 @@ var useGetMarketRelations = (marketId) => {
1543
1563
  return { error, loading, marketRelations, refetch };
1544
1564
  };
1545
1565
  var useGetStallholderRelations = (stallholderId) => {
1546
- const { loading, error, data, refetch } = useQuery3(
1566
+ const { loading, error, data, refetch } = useQuery4(
1547
1567
  GET_STALLHOLDER_RELATIONS,
1548
1568
  {
1549
1569
  fetchPolicy: "network-only",
@@ -1555,7 +1575,7 @@ var useGetStallholderRelations = (stallholderId) => {
1555
1575
  return { error, loading, refetch, stallholderRelations };
1556
1576
  };
1557
1577
  var useGetResourceConnections = (resourceId, resourceType) => {
1558
- const { loading, error, data, refetch } = useQuery3(GET_RESOURCE_CONNECTIONS, {
1578
+ const { loading, error, data, refetch } = useQuery4(GET_RESOURCE_CONNECTIONS, {
1559
1579
  fetchPolicy: "network-only",
1560
1580
  variables: { resourceId, resourceType }
1561
1581
  });
@@ -1689,9 +1709,9 @@ var useUpdateStallholderInfo = () => {
1689
1709
  };
1690
1710
 
1691
1711
  // src/graphql/hooks/stallholder/hooksQuery.ts
1692
- import { useQuery as useQuery4 } from "@apollo/client";
1712
+ import { useQuery as useQuery5 } from "@apollo/client";
1693
1713
  var useGetStallholders = () => {
1694
- const { loading, error, data, refetch } = useQuery4(GET_STALLHOLDERS, {
1714
+ const { loading, error, data, refetch } = useQuery5(GET_STALLHOLDERS, {
1695
1715
  fetchPolicy: "network-only"
1696
1716
  });
1697
1717
  const stallholders = data?.stallholders;
@@ -1703,7 +1723,7 @@ var useGetStallholders = () => {
1703
1723
  };
1704
1724
  };
1705
1725
  var useGetStallholder = (_id) => {
1706
- const { loading, error, data, refetch } = useQuery4(GET_STALLHOLDER, {
1726
+ const { loading, error, data, refetch } = useQuery5(GET_STALLHOLDER, {
1707
1727
  fetchPolicy: "network-only",
1708
1728
  skip: !_id,
1709
1729
  variables: { _id }
@@ -1712,7 +1732,7 @@ var useGetStallholder = (_id) => {
1712
1732
  return { error, loading, refetch, stallholder };
1713
1733
  };
1714
1734
  var useGetStallholdersByRegion = (region) => {
1715
- const { loading, error, data, refetch } = useQuery4(
1735
+ const { loading, error, data, refetch } = useQuery5(
1716
1736
  GET_STALLHOLDERS_BY_REGION,
1717
1737
  {
1718
1738
  fetchPolicy: "no-cache",
@@ -1724,7 +1744,7 @@ var useGetStallholdersByRegion = (region) => {
1724
1744
  return { error, loading, refetch, stallholdersByRegion };
1725
1745
  };
1726
1746
  var useSearchStallholders = (search, region) => {
1727
- const { loading, error, data, refetch } = useQuery4(SEARCH_STALLHOLDERS, {
1747
+ const { loading, error, data, refetch } = useQuery5(SEARCH_STALLHOLDERS, {
1728
1748
  fetchPolicy: "network-only",
1729
1749
  skip: search.length < 3,
1730
1750
  variables: { region, search }
@@ -1733,7 +1753,7 @@ var useSearchStallholders = (search, region) => {
1733
1753
  return { error, loading, refetch, stallholderSearch };
1734
1754
  };
1735
1755
  var useGetStallholderInfo = (stallholderId) => {
1736
- const { loading, error, data, refetch } = useQuery4(GET_STALLHOLDER_INFO, {
1756
+ const { loading, error, data, refetch } = useQuery5(GET_STALLHOLDER_INFO, {
1737
1757
  fetchPolicy: "network-only",
1738
1758
  skip: !stallholderId,
1739
1759
  variables: { stallholderId }
@@ -1839,9 +1859,9 @@ var useDeleteTester = () => {
1839
1859
  };
1840
1860
 
1841
1861
  // src/graphql/hooks/testers/hooksQuery.ts
1842
- import { useQuery as useQuery5 } from "@apollo/client";
1862
+ import { useQuery as useQuery6 } from "@apollo/client";
1843
1863
  var useGetTesters = () => {
1844
- const { data, loading, error, refetch } = useQuery5(GET_TESTERS);
1864
+ const { data, loading, error, refetch } = useQuery6(GET_TESTERS);
1845
1865
  const testers = data?.testers;
1846
1866
  return {
1847
1867
  error,
@@ -1851,7 +1871,7 @@ var useGetTesters = () => {
1851
1871
  };
1852
1872
  };
1853
1873
  var useGetTester = (_id) => {
1854
- const { data, loading, error, refetch } = useQuery5(GET_TESTER, {
1874
+ const { data, loading, error, refetch } = useQuery6(GET_TESTER, {
1855
1875
  skip: !_id,
1856
1876
  variables: { _id }
1857
1877
  });
@@ -1960,37 +1980,37 @@ var useRemoveUserFavouriteResource = () => {
1960
1980
  };
1961
1981
 
1962
1982
  // src/graphql/hooks/user/hooksQuery.ts
1963
- import { useQuery as useQuery6 } from "@apollo/client";
1983
+ import { useQuery as useQuery7 } from "@apollo/client";
1964
1984
  var useGetUsers = () => {
1965
- const { loading, error, data, refetch } = useQuery6(GET_USERS, {
1985
+ const { loading, error, data, refetch } = useQuery7(GET_USERS, {
1966
1986
  fetchPolicy: "network-only"
1967
1987
  });
1968
1988
  const users = data?.users;
1969
1989
  return { error, loading, refetch, users };
1970
1990
  };
1971
1991
  var useGetUser = (_id) => {
1972
- const { loading, error, data, refetch } = useQuery6(GET_USER, {
1992
+ const { loading, error, data, refetch } = useQuery7(GET_USER, {
1973
1993
  variables: { _id }
1974
1994
  });
1975
1995
  const user = data?.user;
1976
1996
  return { error, loading, refetch, user };
1977
1997
  };
1978
1998
  var useGetUserMarkets = () => {
1979
- const { loading, error, data, refetch } = useQuery6(GET_USER_MARKETS, {
1999
+ const { loading, error, data, refetch } = useQuery7(GET_USER_MARKETS, {
1980
2000
  fetchPolicy: "network-only"
1981
2001
  });
1982
2002
  const userMarkets = data?.userMarkets;
1983
2003
  return { error, loading, refetch, userMarkets };
1984
2004
  };
1985
2005
  var useGetUserStallholder = () => {
1986
- const { loading, error, data, refetch } = useQuery6(GET_USER_STALLHOLDER, {
2006
+ const { loading, error, data, refetch } = useQuery7(GET_USER_STALLHOLDER, {
1987
2007
  fetchPolicy: "network-only"
1988
2008
  });
1989
2009
  const userStallholder = data?.userStallholder;
1990
2010
  return { error, loading, refetch, userStallholder };
1991
2011
  };
1992
2012
  var useGetUserFavourites = () => {
1993
- const { loading, error, data, refetch } = useQuery6(GET_USER_FAVOURITES, {
2013
+ const { loading, error, data, refetch } = useQuery7(GET_USER_FAVOURITES, {
1994
2014
  fetchPolicy: "network-only"
1995
2015
  });
1996
2016
  const markets = data?.userFavourites.markets;
@@ -2032,6 +2052,7 @@ export {
2032
2052
  useGetMarkets,
2033
2053
  useGetMarketsByRegion,
2034
2054
  useGetMarketsNearMe,
2055
+ useGetNotificationCount,
2035
2056
  useGetNotificationCountSubscription,
2036
2057
  useGetRelation,
2037
2058
  useGetRelationByMarketAndStallholder,
@@ -2047,6 +2068,7 @@ export {
2047
2068
  useGetUserChats,
2048
2069
  useGetUserFavourites,
2049
2070
  useGetUserMarkets,
2071
+ useGetUserNotifications,
2050
2072
  useGetUserNotificationsSubscription,
2051
2073
  useGetUserStallholder,
2052
2074
  useGetUsers,