@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.
@@ -548,6 +548,14 @@ var USER_CHATS = gql6`
548
548
  }
549
549
  ${CHAT_FIELDS_FRAGMENT}
550
550
  `;
551
+ var GET_CHAT_MESSAGE = gql6`
552
+ subscription {
553
+ getChatMessage {
554
+ ...ChatFields
555
+ }
556
+ }
557
+ ${CHAT_FIELDS_FRAGMENT}
558
+ `;
551
559
 
552
560
  // src/graphql/mutations/chat.ts
553
561
  var CREATE_CHAT_MUTATION = gql7`
@@ -672,19 +680,6 @@ var useRemoveParticipantFromChat = () => {
672
680
 
673
681
  // src/graphql/hooks/chat/hooksQuery.ts
674
682
  import { useQuery, useSubscription } from "@apollo/client";
675
-
676
- // src/graphql/subscriptions/chat.ts
677
- import { gql as gql8 } from "@apollo/client";
678
- var GET_CHAT_MESSAGE = gql8`
679
- subscription {
680
- getChatMessage {
681
- ...ChatFields
682
- }
683
- }
684
- ${CHAT_FIELDS_FRAGMENT}
685
- `;
686
-
687
- // src/graphql/hooks/chat/hooksQuery.ts
688
683
  var useGetChat = (_id) => {
689
684
  const { loading, error, data, refetch } = useQuery(CHAT, {
690
685
  fetchPolicy: "network-only",
@@ -711,8 +706,8 @@ var useGetChatSubscription = () => {
711
706
  import { useMutation as useMutation4 } from "@apollo/client";
712
707
 
713
708
  // src/graphql/mutations/contactUs.ts
714
- import { gql as gql9 } from "@apollo/client";
715
- var CONTACT_US_MUTATION = gql9`
709
+ import { gql as gql8 } from "@apollo/client";
710
+ var CONTACT_US_MUTATION = gql8`
716
711
  mutation contactUs($input: ContactUsInputType!) {
717
712
  contactUs(input: $input) {
718
713
  message
@@ -730,8 +725,8 @@ var useContactUs = () => {
730
725
  import { useMutation as useMutation5 } from "@apollo/client";
731
726
 
732
727
  // src/graphql/mutations/market.ts
733
- import { gql as gql10 } from "@apollo/client";
734
- var CREATE_MARKET_MUTATION = gql10`
728
+ import { gql as gql9 } from "@apollo/client";
729
+ var CREATE_MARKET_MUTATION = gql9`
735
730
  mutation createMarket($input: MarketInputType!) {
736
731
  createMarket(input: $input) {
737
732
  ...MarketFields
@@ -739,7 +734,7 @@ var CREATE_MARKET_MUTATION = gql10`
739
734
  }
740
735
  ${MARKET}
741
736
  `;
742
- var UPDATE_MARKET_MUTATION = gql10`
737
+ var UPDATE_MARKET_MUTATION = gql9`
743
738
  mutation updateMarket($_id: ID!, $input: MarketInputType!) {
744
739
  updateMarket(_id: $_id, input: $input) {
745
740
  ...MarketFields
@@ -747,12 +742,12 @@ var UPDATE_MARKET_MUTATION = gql10`
747
742
  }
748
743
  ${MARKET}
749
744
  `;
750
- var DELETE_MARKET_MUTATION = gql10`
745
+ var DELETE_MARKET_MUTATION = gql9`
751
746
  mutation deleteMarket($_id: ID!) {
752
747
  deleteMarket(_id: $_id)
753
748
  }
754
749
  `;
755
- var CREATE_MARKET_INFO_MUTATION = gql10`
750
+ var CREATE_MARKET_INFO_MUTATION = gql9`
756
751
  mutation createMarketInfo($input: MarketInfoInputType!) {
757
752
  createMarketInfo(input: $input) {
758
753
  ...MarketInfoFields
@@ -760,7 +755,7 @@ var CREATE_MARKET_INFO_MUTATION = gql10`
760
755
  }
761
756
  ${MARKET_INFO}
762
757
  `;
763
- var UPDATE_MARKET_INFO_MUTATION = gql10`
758
+ var UPDATE_MARKET_INFO_MUTATION = gql9`
764
759
  mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
765
760
  updateMarketInfo(_id: $_id, input: $input) {
766
761
  ...MarketInfoFields
@@ -770,8 +765,8 @@ var UPDATE_MARKET_INFO_MUTATION = gql10`
770
765
  `;
771
766
 
772
767
  // src/graphql/queries/user.ts
773
- import { gql as gql11 } from "@apollo/client";
774
- var GET_USERS = gql11`
768
+ import { gql as gql10 } from "@apollo/client";
769
+ var GET_USERS = gql10`
775
770
  query getUsers {
776
771
  users {
777
772
  ...UserFields
@@ -779,7 +774,7 @@ var GET_USERS = gql11`
779
774
  }
780
775
  ${USER_FIELDS_FRAGMENT}
781
776
  `;
782
- var GET_USER = gql11`
777
+ var GET_USER = gql10`
783
778
  query getUser($_id: ID!) {
784
779
  user(_id: $_id) {
785
780
  ...UserFields
@@ -787,7 +782,7 @@ var GET_USER = gql11`
787
782
  }
788
783
  ${USER_FIELDS_FRAGMENT}
789
784
  `;
790
- var GET_USER_MARKETS = gql11`
785
+ var GET_USER_MARKETS = gql10`
791
786
  query getUserMarkets {
792
787
  userMarkets {
793
788
  ...MarketFields
@@ -795,7 +790,7 @@ var GET_USER_MARKETS = gql11`
795
790
  }
796
791
  ${MARKET}
797
792
  `;
798
- var GET_USER_STALLHOLDER = gql11`
793
+ var GET_USER_STALLHOLDER = gql10`
799
794
  query getUserStallholder {
800
795
  userStallholder {
801
796
  ...StallholderFields
@@ -803,7 +798,7 @@ var GET_USER_STALLHOLDER = gql11`
803
798
  }
804
799
  ${STALLHOLDER}
805
800
  `;
806
- var GET_USER_FAVOURITES = gql11`
801
+ var GET_USER_FAVOURITES = gql10`
807
802
  query getUserFavourites {
808
803
  userFavourites {
809
804
  markets {
@@ -965,11 +960,11 @@ var useGetMarketInfo = (marketId) => {
965
960
  import { useMutation as useMutation6 } from "@apollo/client";
966
961
 
967
962
  // src/graphql/mutations/notification.ts
968
- import { gql as gql13 } from "@apollo/client";
963
+ import { gql as gql12 } from "@apollo/client";
969
964
 
970
965
  // src/graphql/queries/notification.ts
971
- import { gql as gql12 } from "@apollo/client";
972
- var USER_NOTIFICATION_FRAGMENT = gql12`
966
+ import { gql as gql11 } from "@apollo/client";
967
+ var USER_NOTIFICATION_FRAGMENT = gql11`
973
968
  fragment UserNotificationFields on Notification {
974
969
  _id
975
970
  userId
@@ -982,7 +977,7 @@ var USER_NOTIFICATION_FRAGMENT = gql12`
982
977
  updatedAt
983
978
  }
984
979
  `;
985
- var GET_USER_NOTIFICATIONS = gql12`
980
+ var GET_USER_NOTIFICATIONS = gql11`
986
981
  query getUserNotifications($userId: String!, $limit: Int, $offset: Int) {
987
982
  userNotifications(userId: $userId, limit: $limit, offset: $offset) {
988
983
  ...UserNotificationFields
@@ -990,7 +985,7 @@ var GET_USER_NOTIFICATIONS = gql12`
990
985
  }
991
986
  ${USER_NOTIFICATION_FRAGMENT}
992
987
  `;
993
- var GET_NOTIFICATION_COUNT = gql12`
988
+ var GET_NOTIFICATION_COUNT = gql11`
994
989
  query getNotificationCount($userId: String!) {
995
990
  notificationCount(userId: $userId) {
996
991
  total
@@ -1000,7 +995,7 @@ var GET_NOTIFICATION_COUNT = gql12`
1000
995
  `;
1001
996
 
1002
997
  // src/graphql/mutations/notification.ts
1003
- var CREATE_NOTIFICATION = gql13`
998
+ var CREATE_NOTIFICATION = gql12`
1004
999
  mutation createNotification($input: CreateNotificationInput!) {
1005
1000
  createNotification(input: $input) {
1006
1001
  ...UserNotificationFields
@@ -1008,7 +1003,7 @@ var CREATE_NOTIFICATION = gql13`
1008
1003
  }
1009
1004
  ${USER_NOTIFICATION_FRAGMENT}
1010
1005
  `;
1011
- var CREATE_BULK_NOTIFICATIONS = gql13`
1006
+ var CREATE_BULK_NOTIFICATIONS = gql12`
1012
1007
  mutation createBulkNotifications($input: CreateBulkNotificationInput!) {
1013
1008
  createBulkNotifications(input: $input) {
1014
1009
  ...UserNotificationFields
@@ -1016,7 +1011,7 @@ var CREATE_BULK_NOTIFICATIONS = gql13`
1016
1011
  }
1017
1012
  ${USER_NOTIFICATION_FRAGMENT}
1018
1013
  `;
1019
- var MARK_NOTIFICATION_READ = gql13`
1014
+ var MARK_NOTIFICATION_READ = gql12`
1020
1015
  mutation markNotificationRead($input: MarkNotificationReadInput!) {
1021
1016
  markNotificationRead(input: $input) {
1022
1017
  ...UserNotificationFields
@@ -1024,12 +1019,12 @@ var MARK_NOTIFICATION_READ = gql13`
1024
1019
  }
1025
1020
  ${USER_NOTIFICATION_FRAGMENT}
1026
1021
  `;
1027
- var MARK_ALL_NOTIFICATIONS_READ = gql13`
1022
+ var MARK_ALL_NOTIFICATIONS_READ = gql12`
1028
1023
  mutation markAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
1029
1024
  markAllNotificationsRead(input: $input)
1030
1025
  }
1031
1026
  `;
1032
- var DELETE_NOTIFICATION = gql13`
1027
+ var DELETE_NOTIFICATION = gql12`
1033
1028
  mutation deleteNotification($_id: ID!) {
1034
1029
  deleteNotification(_id: $_id)
1035
1030
  }
@@ -1074,40 +1069,62 @@ var useDeleteNotification = () => {
1074
1069
  return { deleteNotification, error, loading };
1075
1070
  };
1076
1071
 
1077
- // src/graphql/hooks/notifications/hooksQuery.ts
1078
- import { useQuery as useQuery3 } from "@apollo/client";
1079
- var useGetUserNotifications = (userId, limit, offset) => {
1080
- const { data, error, loading, refetch } = useQuery3(GET_USER_NOTIFICATIONS, {
1081
- fetchPolicy: "no-cache",
1082
- skip: !userId,
1083
- variables: {
1084
- limit: limit ?? 50,
1085
- offset: offset ?? 0,
1086
- userId
1072
+ // src/graphql/hooks/notifications/hooksSubscription.ts
1073
+ import { useSubscription as useSubscription2 } from "@apollo/client";
1074
+
1075
+ // src/graphql/subscriptions/notification.ts
1076
+ import { gql as gql13 } from "@apollo/client";
1077
+ var USER_NOTIFICATION_FRAGMENT2 = gql13`
1078
+ fragment UserNotificationFields on Notification {
1079
+ _id
1080
+ userId
1081
+ title
1082
+ message
1083
+ type
1084
+ isRead
1085
+ data
1086
+ createdAt
1087
+ updatedAt
1088
+ }
1089
+ `;
1090
+ var GET_USER_NOTIFICATIONS_SUBSCRIPTION = gql13`
1091
+ subscription getUserNotifications($userId: String!) {
1092
+ getUserNotifications(userId: $userId) {
1093
+ ...UserNotificationFields
1094
+ }
1095
+ }
1096
+ ${USER_NOTIFICATION_FRAGMENT2}
1097
+ `;
1098
+ var GET_NOTIFICATION_COUNT_SUBSCRIPTION = gql13`
1099
+ subscription getNotificationCount($userId: String!) {
1100
+ getNotificationCount(userId: $userId) {
1101
+ total
1102
+ unread
1087
1103
  }
1104
+ }
1105
+ `;
1106
+
1107
+ // src/graphql/hooks/notifications/hooksSubscription.ts
1108
+ var useGetUserNotificationsSubscription = (userId) => {
1109
+ const { data, loading, error } = useSubscription2(GET_USER_NOTIFICATIONS_SUBSCRIPTION, {
1110
+ skip: !userId,
1111
+ variables: { userId }
1088
1112
  });
1089
- const notifications = data?.userNotifications;
1090
1113
  return {
1091
1114
  error,
1092
1115
  loading,
1093
- notifications,
1094
- refetch
1116
+ notifications: data?.getUserNotifications || []
1095
1117
  };
1096
1118
  };
1097
- var useGetNotificationCount = (userId) => {
1098
- const { data, error, loading, refetch } = useQuery3(GET_NOTIFICATION_COUNT, {
1099
- fetchPolicy: "no-cache",
1119
+ var useGetNotificationCountSubscription = (userId) => {
1120
+ const { data, loading, error } = useSubscription2(GET_NOTIFICATION_COUNT_SUBSCRIPTION, {
1100
1121
  skip: !userId,
1101
- variables: {
1102
- userId
1103
- }
1122
+ variables: { userId }
1104
1123
  });
1105
- const notificationCount = data?.notificationCount;
1106
1124
  return {
1107
1125
  error,
1108
1126
  loading,
1109
- notificationCount,
1110
- refetch
1127
+ notificationCount: data?.getNotificationCount || { total: 0, unread: 0 }
1111
1128
  };
1112
1129
  };
1113
1130
 
@@ -1506,9 +1523,9 @@ var useDeleteRelation = () => {
1506
1523
  };
1507
1524
 
1508
1525
  // src/graphql/hooks/relation/hooksQuery.ts
1509
- import { useQuery as useQuery4 } from "@apollo/client";
1526
+ import { useQuery as useQuery3 } from "@apollo/client";
1510
1527
  var useGetRelation = (id) => {
1511
- const { loading, error, data, refetch } = useQuery4(GET_RELATION, {
1528
+ const { loading, error, data, refetch } = useQuery3(GET_RELATION, {
1512
1529
  fetchPolicy: "network-only",
1513
1530
  skip: id === "",
1514
1531
  variables: { id }
@@ -1517,7 +1534,7 @@ var useGetRelation = (id) => {
1517
1534
  return { error, loading, refetch, relation };
1518
1535
  };
1519
1536
  var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1520
- const { loading, error, data, refetch } = useQuery4(
1537
+ const { loading, error, data, refetch } = useQuery3(
1521
1538
  GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1522
1539
  {
1523
1540
  fetchPolicy: "network-only",
@@ -1529,7 +1546,7 @@ var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1529
1546
  return { error, loading, refetch, relationByMarketAndStallholder };
1530
1547
  };
1531
1548
  var useGetMarketRelations = (marketId) => {
1532
- const { loading, error, data, refetch } = useQuery4(GET_MARKET_RELATIONS, {
1549
+ const { loading, error, data, refetch } = useQuery3(GET_MARKET_RELATIONS, {
1533
1550
  fetchPolicy: "network-only",
1534
1551
  skip: marketId === "",
1535
1552
  variables: { marketId }
@@ -1538,7 +1555,7 @@ var useGetMarketRelations = (marketId) => {
1538
1555
  return { error, loading, marketRelations, refetch };
1539
1556
  };
1540
1557
  var useGetStallholderRelations = (stallholderId) => {
1541
- const { loading, error, data, refetch } = useQuery4(
1558
+ const { loading, error, data, refetch } = useQuery3(
1542
1559
  GET_STALLHOLDER_RELATIONS,
1543
1560
  {
1544
1561
  fetchPolicy: "network-only",
@@ -1550,7 +1567,7 @@ var useGetStallholderRelations = (stallholderId) => {
1550
1567
  return { error, loading, refetch, stallholderRelations };
1551
1568
  };
1552
1569
  var useGetResourceConnections = (resourceId, resourceType) => {
1553
- const { loading, error, data, refetch } = useQuery4(GET_RESOURCE_CONNECTIONS, {
1570
+ const { loading, error, data, refetch } = useQuery3(GET_RESOURCE_CONNECTIONS, {
1554
1571
  fetchPolicy: "network-only",
1555
1572
  variables: { resourceId, resourceType }
1556
1573
  });
@@ -1684,9 +1701,9 @@ var useUpdateStallholderInfo = () => {
1684
1701
  };
1685
1702
 
1686
1703
  // src/graphql/hooks/stallholder/hooksQuery.ts
1687
- import { useQuery as useQuery5 } from "@apollo/client";
1704
+ import { useQuery as useQuery4 } from "@apollo/client";
1688
1705
  var useGetStallholders = () => {
1689
- const { loading, error, data, refetch } = useQuery5(GET_STALLHOLDERS, {
1706
+ const { loading, error, data, refetch } = useQuery4(GET_STALLHOLDERS, {
1690
1707
  fetchPolicy: "network-only"
1691
1708
  });
1692
1709
  const stallholders = data?.stallholders;
@@ -1698,7 +1715,7 @@ var useGetStallholders = () => {
1698
1715
  };
1699
1716
  };
1700
1717
  var useGetStallholder = (_id) => {
1701
- const { loading, error, data, refetch } = useQuery5(GET_STALLHOLDER, {
1718
+ const { loading, error, data, refetch } = useQuery4(GET_STALLHOLDER, {
1702
1719
  fetchPolicy: "network-only",
1703
1720
  skip: !_id,
1704
1721
  variables: { _id }
@@ -1707,7 +1724,7 @@ var useGetStallholder = (_id) => {
1707
1724
  return { error, loading, refetch, stallholder };
1708
1725
  };
1709
1726
  var useGetStallholdersByRegion = (region) => {
1710
- const { loading, error, data, refetch } = useQuery5(
1727
+ const { loading, error, data, refetch } = useQuery4(
1711
1728
  GET_STALLHOLDERS_BY_REGION,
1712
1729
  {
1713
1730
  fetchPolicy: "no-cache",
@@ -1719,7 +1736,7 @@ var useGetStallholdersByRegion = (region) => {
1719
1736
  return { error, loading, refetch, stallholdersByRegion };
1720
1737
  };
1721
1738
  var useSearchStallholders = (search, region) => {
1722
- const { loading, error, data, refetch } = useQuery5(SEARCH_STALLHOLDERS, {
1739
+ const { loading, error, data, refetch } = useQuery4(SEARCH_STALLHOLDERS, {
1723
1740
  fetchPolicy: "network-only",
1724
1741
  skip: search.length < 3,
1725
1742
  variables: { region, search }
@@ -1728,7 +1745,7 @@ var useSearchStallholders = (search, region) => {
1728
1745
  return { error, loading, refetch, stallholderSearch };
1729
1746
  };
1730
1747
  var useGetStallholderInfo = (stallholderId) => {
1731
- const { loading, error, data, refetch } = useQuery5(GET_STALLHOLDER_INFO, {
1748
+ const { loading, error, data, refetch } = useQuery4(GET_STALLHOLDER_INFO, {
1732
1749
  fetchPolicy: "network-only",
1733
1750
  skip: !stallholderId,
1734
1751
  variables: { stallholderId }
@@ -1834,9 +1851,9 @@ var useDeleteTester = () => {
1834
1851
  };
1835
1852
 
1836
1853
  // src/graphql/hooks/testers/hooksQuery.ts
1837
- import { useQuery as useQuery6 } from "@apollo/client";
1854
+ import { useQuery as useQuery5 } from "@apollo/client";
1838
1855
  var useGetTesters = () => {
1839
- const { data, loading, error, refetch } = useQuery6(GET_TESTERS);
1856
+ const { data, loading, error, refetch } = useQuery5(GET_TESTERS);
1840
1857
  const testers = data?.testers;
1841
1858
  return {
1842
1859
  error,
@@ -1846,7 +1863,7 @@ var useGetTesters = () => {
1846
1863
  };
1847
1864
  };
1848
1865
  var useGetTester = (_id) => {
1849
- const { data, loading, error, refetch } = useQuery6(GET_TESTER, {
1866
+ const { data, loading, error, refetch } = useQuery5(GET_TESTER, {
1850
1867
  skip: !_id,
1851
1868
  variables: { _id }
1852
1869
  });
@@ -1955,37 +1972,37 @@ var useRemoveUserFavouriteResource = () => {
1955
1972
  };
1956
1973
 
1957
1974
  // src/graphql/hooks/user/hooksQuery.ts
1958
- import { useQuery as useQuery7 } from "@apollo/client";
1975
+ import { useQuery as useQuery6 } from "@apollo/client";
1959
1976
  var useGetUsers = () => {
1960
- const { loading, error, data, refetch } = useQuery7(GET_USERS, {
1977
+ const { loading, error, data, refetch } = useQuery6(GET_USERS, {
1961
1978
  fetchPolicy: "network-only"
1962
1979
  });
1963
1980
  const users = data?.users;
1964
1981
  return { error, loading, refetch, users };
1965
1982
  };
1966
1983
  var useGetUser = (_id) => {
1967
- const { loading, error, data, refetch } = useQuery7(GET_USER, {
1984
+ const { loading, error, data, refetch } = useQuery6(GET_USER, {
1968
1985
  variables: { _id }
1969
1986
  });
1970
1987
  const user = data?.user;
1971
1988
  return { error, loading, refetch, user };
1972
1989
  };
1973
1990
  var useGetUserMarkets = () => {
1974
- const { loading, error, data, refetch } = useQuery7(GET_USER_MARKETS, {
1991
+ const { loading, error, data, refetch } = useQuery6(GET_USER_MARKETS, {
1975
1992
  fetchPolicy: "network-only"
1976
1993
  });
1977
1994
  const userMarkets = data?.userMarkets;
1978
1995
  return { error, loading, refetch, userMarkets };
1979
1996
  };
1980
1997
  var useGetUserStallholder = () => {
1981
- const { loading, error, data, refetch } = useQuery7(GET_USER_STALLHOLDER, {
1998
+ const { loading, error, data, refetch } = useQuery6(GET_USER_STALLHOLDER, {
1982
1999
  fetchPolicy: "network-only"
1983
2000
  });
1984
2001
  const userStallholder = data?.userStallholder;
1985
2002
  return { error, loading, refetch, userStallholder };
1986
2003
  };
1987
2004
  var useGetUserFavourites = () => {
1988
- const { loading, error, data, refetch } = useQuery7(GET_USER_FAVOURITES, {
2005
+ const { loading, error, data, refetch } = useQuery6(GET_USER_FAVOURITES, {
1989
2006
  fetchPolicy: "network-only"
1990
2007
  });
1991
2008
  const markets = data?.userFavourites.markets;
@@ -1997,7 +2014,6 @@ var useGetUserFavourites = () => {
1997
2014
  return { error, loading, refetch, userFavourites };
1998
2015
  };
1999
2016
  export {
2000
- GET_CHAT_MESSAGE,
2001
2017
  useAddParticipantToChat,
2002
2018
  useAddUserFavouriteResource,
2003
2019
  useAdminUpdateResourceType,
@@ -2029,7 +2045,7 @@ export {
2029
2045
  useGetMarkets,
2030
2046
  useGetMarketsByRegion,
2031
2047
  useGetMarketsNearMe,
2032
- useGetNotificationCount,
2048
+ useGetNotificationCountSubscription,
2033
2049
  useGetRelation,
2034
2050
  useGetRelationByMarketAndStallholder,
2035
2051
  useGetResourceConnections,
@@ -2044,7 +2060,7 @@ export {
2044
2060
  useGetUserChats,
2045
2061
  useGetUserFavourites,
2046
2062
  useGetUserMarkets,
2047
- useGetUserNotifications,
2063
+ useGetUserNotificationsSubscription,
2048
2064
  useGetUserStallholder,
2049
2065
  useGetUsers,
2050
2066
  useLogin,