@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/graphql/index.cjs +103 -88
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +3 -7
- package/dist/graphql/index.d.ts +3 -7
- package/dist/graphql/index.mjs +99 -83
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/index.cjs +103 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -7
- package/dist/index.d.ts +3 -7
- package/dist/index.mjs +99 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/graphql/index.cjs
CHANGED
|
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/graphql/index.ts
|
|
21
21
|
var graphql_exports = {};
|
|
22
22
|
__export(graphql_exports, {
|
|
23
|
-
GET_CHAT_MESSAGE: () => GET_CHAT_MESSAGE,
|
|
24
23
|
useAddParticipantToChat: () => useAddParticipantToChat,
|
|
25
24
|
useAddUserFavouriteResource: () => useAddUserFavouriteResource,
|
|
26
25
|
useAdminUpdateResourceType: () => useAdminUpdateResourceType,
|
|
@@ -52,7 +51,7 @@ __export(graphql_exports, {
|
|
|
52
51
|
useGetMarkets: () => useGetMarkets,
|
|
53
52
|
useGetMarketsByRegion: () => useGetMarketsByRegion,
|
|
54
53
|
useGetMarketsNearMe: () => useGetMarketsNearMe,
|
|
55
|
-
|
|
54
|
+
useGetNotificationCountSubscription: () => useGetNotificationCountSubscription,
|
|
56
55
|
useGetRelation: () => useGetRelation,
|
|
57
56
|
useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
|
|
58
57
|
useGetResourceConnections: () => useGetResourceConnections,
|
|
@@ -67,7 +66,7 @@ __export(graphql_exports, {
|
|
|
67
66
|
useGetUserChats: () => useGetUserChats,
|
|
68
67
|
useGetUserFavourites: () => useGetUserFavourites,
|
|
69
68
|
useGetUserMarkets: () => useGetUserMarkets,
|
|
70
|
-
|
|
69
|
+
useGetUserNotificationsSubscription: () => useGetUserNotificationsSubscription,
|
|
71
70
|
useGetUserStallholder: () => useGetUserStallholder,
|
|
72
71
|
useGetUsers: () => useGetUsers,
|
|
73
72
|
useLogin: () => useLogin,
|
|
@@ -642,6 +641,14 @@ var USER_CHATS = import_client8.gql`
|
|
|
642
641
|
}
|
|
643
642
|
${CHAT_FIELDS_FRAGMENT}
|
|
644
643
|
`;
|
|
644
|
+
var GET_CHAT_MESSAGE = import_client8.gql`
|
|
645
|
+
subscription {
|
|
646
|
+
getChatMessage {
|
|
647
|
+
...ChatFields
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
${CHAT_FIELDS_FRAGMENT}
|
|
651
|
+
`;
|
|
645
652
|
|
|
646
653
|
// src/graphql/mutations/chat.ts
|
|
647
654
|
var CREATE_CHAT_MUTATION = import_client9.gql`
|
|
@@ -765,22 +772,9 @@ var useRemoveParticipantFromChat = () => {
|
|
|
765
772
|
};
|
|
766
773
|
|
|
767
774
|
// src/graphql/hooks/chat/hooksQuery.ts
|
|
768
|
-
var import_client12 = require("@apollo/client");
|
|
769
|
-
|
|
770
|
-
// src/graphql/subscriptions/chat.ts
|
|
771
775
|
var import_client11 = require("@apollo/client");
|
|
772
|
-
var GET_CHAT_MESSAGE = import_client11.gql`
|
|
773
|
-
subscription {
|
|
774
|
-
getChatMessage {
|
|
775
|
-
...ChatFields
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
${CHAT_FIELDS_FRAGMENT}
|
|
779
|
-
`;
|
|
780
|
-
|
|
781
|
-
// src/graphql/hooks/chat/hooksQuery.ts
|
|
782
776
|
var useGetChat = (_id) => {
|
|
783
|
-
const { loading, error, data, refetch } = (0,
|
|
777
|
+
const { loading, error, data, refetch } = (0, import_client11.useQuery)(CHAT, {
|
|
784
778
|
fetchPolicy: "network-only",
|
|
785
779
|
skip: !_id,
|
|
786
780
|
variables: { _id }
|
|
@@ -789,24 +783,24 @@ var useGetChat = (_id) => {
|
|
|
789
783
|
return { chat, error, loading, refetch };
|
|
790
784
|
};
|
|
791
785
|
var useGetUserChats = () => {
|
|
792
|
-
const { loading, error, data, refetch } = (0,
|
|
786
|
+
const { loading, error, data, refetch } = (0, import_client11.useQuery)(USER_CHATS, {
|
|
793
787
|
fetchPolicy: "network-only"
|
|
794
788
|
});
|
|
795
789
|
const userChats = data?.userChats;
|
|
796
790
|
return { error, loading, refetch, userChats };
|
|
797
791
|
};
|
|
798
792
|
var useGetChatSubscription = () => {
|
|
799
|
-
const { data, loading, error } = (0,
|
|
793
|
+
const { data, loading, error } = (0, import_client11.useSubscription)(GET_CHAT_MESSAGE);
|
|
800
794
|
const chat = data?.getChat;
|
|
801
795
|
return { chat, error, loading };
|
|
802
796
|
};
|
|
803
797
|
|
|
804
798
|
// src/graphql/hooks/contactUs.ts
|
|
805
|
-
var
|
|
799
|
+
var import_client13 = require("@apollo/client");
|
|
806
800
|
|
|
807
801
|
// src/graphql/mutations/contactUs.ts
|
|
808
|
-
var
|
|
809
|
-
var CONTACT_US_MUTATION =
|
|
802
|
+
var import_client12 = require("@apollo/client");
|
|
803
|
+
var CONTACT_US_MUTATION = import_client12.gql`
|
|
810
804
|
mutation contactUs($input: ContactUsInputType!) {
|
|
811
805
|
contactUs(input: $input) {
|
|
812
806
|
message
|
|
@@ -816,16 +810,16 @@ var CONTACT_US_MUTATION = import_client13.gql`
|
|
|
816
810
|
|
|
817
811
|
// src/graphql/hooks/contactUs.ts
|
|
818
812
|
var useContactUs = () => {
|
|
819
|
-
const [contactUs, { loading, error }] = (0,
|
|
813
|
+
const [contactUs, { loading, error }] = (0, import_client13.useMutation)(CONTACT_US_MUTATION);
|
|
820
814
|
return { contactUs, error, loading };
|
|
821
815
|
};
|
|
822
816
|
|
|
823
817
|
// src/graphql/hooks/market/hooksMutation.ts
|
|
824
|
-
var
|
|
818
|
+
var import_client16 = require("@apollo/client");
|
|
825
819
|
|
|
826
820
|
// src/graphql/mutations/market.ts
|
|
827
|
-
var
|
|
828
|
-
var CREATE_MARKET_MUTATION =
|
|
821
|
+
var import_client14 = require("@apollo/client");
|
|
822
|
+
var CREATE_MARKET_MUTATION = import_client14.gql`
|
|
829
823
|
mutation createMarket($input: MarketInputType!) {
|
|
830
824
|
createMarket(input: $input) {
|
|
831
825
|
...MarketFields
|
|
@@ -833,7 +827,7 @@ var CREATE_MARKET_MUTATION = import_client15.gql`
|
|
|
833
827
|
}
|
|
834
828
|
${MARKET}
|
|
835
829
|
`;
|
|
836
|
-
var UPDATE_MARKET_MUTATION =
|
|
830
|
+
var UPDATE_MARKET_MUTATION = import_client14.gql`
|
|
837
831
|
mutation updateMarket($_id: ID!, $input: MarketInputType!) {
|
|
838
832
|
updateMarket(_id: $_id, input: $input) {
|
|
839
833
|
...MarketFields
|
|
@@ -841,12 +835,12 @@ var UPDATE_MARKET_MUTATION = import_client15.gql`
|
|
|
841
835
|
}
|
|
842
836
|
${MARKET}
|
|
843
837
|
`;
|
|
844
|
-
var DELETE_MARKET_MUTATION =
|
|
838
|
+
var DELETE_MARKET_MUTATION = import_client14.gql`
|
|
845
839
|
mutation deleteMarket($_id: ID!) {
|
|
846
840
|
deleteMarket(_id: $_id)
|
|
847
841
|
}
|
|
848
842
|
`;
|
|
849
|
-
var CREATE_MARKET_INFO_MUTATION =
|
|
843
|
+
var CREATE_MARKET_INFO_MUTATION = import_client14.gql`
|
|
850
844
|
mutation createMarketInfo($input: MarketInfoInputType!) {
|
|
851
845
|
createMarketInfo(input: $input) {
|
|
852
846
|
...MarketInfoFields
|
|
@@ -854,7 +848,7 @@ var CREATE_MARKET_INFO_MUTATION = import_client15.gql`
|
|
|
854
848
|
}
|
|
855
849
|
${MARKET_INFO}
|
|
856
850
|
`;
|
|
857
|
-
var UPDATE_MARKET_INFO_MUTATION =
|
|
851
|
+
var UPDATE_MARKET_INFO_MUTATION = import_client14.gql`
|
|
858
852
|
mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
|
|
859
853
|
updateMarketInfo(_id: $_id, input: $input) {
|
|
860
854
|
...MarketInfoFields
|
|
@@ -864,8 +858,8 @@ var UPDATE_MARKET_INFO_MUTATION = import_client15.gql`
|
|
|
864
858
|
`;
|
|
865
859
|
|
|
866
860
|
// src/graphql/queries/user.ts
|
|
867
|
-
var
|
|
868
|
-
var GET_USERS =
|
|
861
|
+
var import_client15 = require("@apollo/client");
|
|
862
|
+
var GET_USERS = import_client15.gql`
|
|
869
863
|
query getUsers {
|
|
870
864
|
users {
|
|
871
865
|
...UserFields
|
|
@@ -873,7 +867,7 @@ var GET_USERS = import_client16.gql`
|
|
|
873
867
|
}
|
|
874
868
|
${USER_FIELDS_FRAGMENT}
|
|
875
869
|
`;
|
|
876
|
-
var GET_USER =
|
|
870
|
+
var GET_USER = import_client15.gql`
|
|
877
871
|
query getUser($_id: ID!) {
|
|
878
872
|
user(_id: $_id) {
|
|
879
873
|
...UserFields
|
|
@@ -881,7 +875,7 @@ var GET_USER = import_client16.gql`
|
|
|
881
875
|
}
|
|
882
876
|
${USER_FIELDS_FRAGMENT}
|
|
883
877
|
`;
|
|
884
|
-
var GET_USER_MARKETS =
|
|
878
|
+
var GET_USER_MARKETS = import_client15.gql`
|
|
885
879
|
query getUserMarkets {
|
|
886
880
|
userMarkets {
|
|
887
881
|
...MarketFields
|
|
@@ -889,7 +883,7 @@ var GET_USER_MARKETS = import_client16.gql`
|
|
|
889
883
|
}
|
|
890
884
|
${MARKET}
|
|
891
885
|
`;
|
|
892
|
-
var GET_USER_STALLHOLDER =
|
|
886
|
+
var GET_USER_STALLHOLDER = import_client15.gql`
|
|
893
887
|
query getUserStallholder {
|
|
894
888
|
userStallholder {
|
|
895
889
|
...StallholderFields
|
|
@@ -897,7 +891,7 @@ var GET_USER_STALLHOLDER = import_client16.gql`
|
|
|
897
891
|
}
|
|
898
892
|
${STALLHOLDER}
|
|
899
893
|
`;
|
|
900
|
-
var GET_USER_FAVOURITES =
|
|
894
|
+
var GET_USER_FAVOURITES = import_client15.gql`
|
|
901
895
|
query getUserFavourites {
|
|
902
896
|
userFavourites {
|
|
903
897
|
markets {
|
|
@@ -914,7 +908,7 @@ var GET_USER_FAVOURITES = import_client16.gql`
|
|
|
914
908
|
|
|
915
909
|
// src/graphql/hooks/market/hooksMutation.ts
|
|
916
910
|
var useCreateMarket = () => {
|
|
917
|
-
const [createMarket, { loading, error }] = (0,
|
|
911
|
+
const [createMarket, { loading, error }] = (0, import_client16.useMutation)(
|
|
918
912
|
CREATE_MARKET_MUTATION,
|
|
919
913
|
{
|
|
920
914
|
awaitRefetchQueries: true,
|
|
@@ -924,7 +918,7 @@ var useCreateMarket = () => {
|
|
|
924
918
|
return { createMarket, error, loading };
|
|
925
919
|
};
|
|
926
920
|
var useUpdateMarket = () => {
|
|
927
|
-
const [updateMarket, { loading, error }] = (0,
|
|
921
|
+
const [updateMarket, { loading, error }] = (0, import_client16.useMutation)(
|
|
928
922
|
UPDATE_MARKET_MUTATION,
|
|
929
923
|
{
|
|
930
924
|
awaitRefetchQueries: true,
|
|
@@ -934,7 +928,7 @@ var useUpdateMarket = () => {
|
|
|
934
928
|
return { error, loading, updateMarket };
|
|
935
929
|
};
|
|
936
930
|
var useDeleteMarket = () => {
|
|
937
|
-
const [deleteMarket, { loading, error }] = (0,
|
|
931
|
+
const [deleteMarket, { loading, error }] = (0, import_client16.useMutation)(
|
|
938
932
|
DELETE_MARKET_MUTATION,
|
|
939
933
|
{
|
|
940
934
|
awaitRefetchQueries: true,
|
|
@@ -944,7 +938,7 @@ var useDeleteMarket = () => {
|
|
|
944
938
|
return { deleteMarket, error, loading };
|
|
945
939
|
};
|
|
946
940
|
var useCreateMarketInfo = () => {
|
|
947
|
-
const [createMarketInfo, { loading, error }] = (0,
|
|
941
|
+
const [createMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
|
|
948
942
|
CREATE_MARKET_INFO_MUTATION,
|
|
949
943
|
{
|
|
950
944
|
awaitRefetchQueries: true,
|
|
@@ -970,7 +964,7 @@ var useCreateMarketInfo = () => {
|
|
|
970
964
|
return { createMarketInfo, error, loading };
|
|
971
965
|
};
|
|
972
966
|
var useUpdateMarketInfo = () => {
|
|
973
|
-
const [updateMarketInfo, { loading, error }] = (0,
|
|
967
|
+
const [updateMarketInfo, { loading, error }] = (0, import_client16.useMutation)(
|
|
974
968
|
UPDATE_MARKET_INFO_MUTATION,
|
|
975
969
|
{
|
|
976
970
|
awaitRefetchQueries: true,
|
|
@@ -996,16 +990,16 @@ var useUpdateMarketInfo = () => {
|
|
|
996
990
|
};
|
|
997
991
|
|
|
998
992
|
// src/graphql/hooks/market/hooksQuery.ts
|
|
999
|
-
var
|
|
993
|
+
var import_client17 = require("@apollo/client");
|
|
1000
994
|
var useGetMarkets = () => {
|
|
1001
|
-
const { loading, error, data, refetch } = (0,
|
|
995
|
+
const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS, {
|
|
1002
996
|
fetchPolicy: "network-only"
|
|
1003
997
|
});
|
|
1004
998
|
const markets = data?.markets;
|
|
1005
999
|
return { error, loading, markets, refetch };
|
|
1006
1000
|
};
|
|
1007
1001
|
var useGetMarket = (_id) => {
|
|
1008
|
-
const { loading, error, data, refetch } = (0,
|
|
1002
|
+
const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET, {
|
|
1009
1003
|
fetchPolicy: "network-only",
|
|
1010
1004
|
skip: !_id,
|
|
1011
1005
|
variables: { _id }
|
|
@@ -1014,7 +1008,7 @@ var useGetMarket = (_id) => {
|
|
|
1014
1008
|
return { error, loading, market, refetch };
|
|
1015
1009
|
};
|
|
1016
1010
|
var useGetMarketsByRegion = (region) => {
|
|
1017
|
-
const { loading, error, data, refetch } = (0,
|
|
1011
|
+
const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_BY_REGION, {
|
|
1018
1012
|
fetchPolicy: "no-cache",
|
|
1019
1013
|
skip: !region,
|
|
1020
1014
|
variables: { region }
|
|
@@ -1023,7 +1017,7 @@ var useGetMarketsByRegion = (region) => {
|
|
|
1023
1017
|
return { error, loading, marketsByRegion, refetch };
|
|
1024
1018
|
};
|
|
1025
1019
|
var useSearchMarkets = (search, region) => {
|
|
1026
|
-
const { loading, error, data, refetch } = (0,
|
|
1020
|
+
const { loading, error, data, refetch } = (0, import_client17.useQuery)(SEARCH_MARKETS, {
|
|
1027
1021
|
fetchPolicy: "network-only",
|
|
1028
1022
|
skip: search.length < 3,
|
|
1029
1023
|
variables: { region, search }
|
|
@@ -1032,7 +1026,7 @@ var useSearchMarkets = (search, region) => {
|
|
|
1032
1026
|
return { error, loading, marketsSearch, refetch };
|
|
1033
1027
|
};
|
|
1034
1028
|
var useGetMarketsNearMe = (location) => {
|
|
1035
|
-
const { loading, error, data, refetch } = (0,
|
|
1029
|
+
const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKETS_NEAR_ME, {
|
|
1036
1030
|
fetchPolicy: "network-only",
|
|
1037
1031
|
skip: !location.latitude || !location.longitude,
|
|
1038
1032
|
variables: {
|
|
@@ -1046,7 +1040,7 @@ var useGetMarketsNearMe = (location) => {
|
|
|
1046
1040
|
return { error, loading, marketsNearMe, refetch };
|
|
1047
1041
|
};
|
|
1048
1042
|
var useGetMarketInfo = (marketId) => {
|
|
1049
|
-
const { loading, error, data, refetch } = (0,
|
|
1043
|
+
const { loading, error, data, refetch } = (0, import_client17.useQuery)(GET_MARKET_INFO, {
|
|
1050
1044
|
fetchPolicy: "network-only",
|
|
1051
1045
|
skip: !marketId,
|
|
1052
1046
|
variables: { marketId }
|
|
@@ -1056,14 +1050,14 @@ var useGetMarketInfo = (marketId) => {
|
|
|
1056
1050
|
};
|
|
1057
1051
|
|
|
1058
1052
|
// src/graphql/hooks/notifications/hooksMutation.ts
|
|
1059
|
-
var
|
|
1053
|
+
var import_client20 = require("@apollo/client");
|
|
1060
1054
|
|
|
1061
1055
|
// src/graphql/mutations/notification.ts
|
|
1062
|
-
var
|
|
1056
|
+
var import_client19 = require("@apollo/client");
|
|
1063
1057
|
|
|
1064
1058
|
// src/graphql/queries/notification.ts
|
|
1065
|
-
var
|
|
1066
|
-
var USER_NOTIFICATION_FRAGMENT =
|
|
1059
|
+
var import_client18 = require("@apollo/client");
|
|
1060
|
+
var USER_NOTIFICATION_FRAGMENT = import_client18.gql`
|
|
1067
1061
|
fragment UserNotificationFields on Notification {
|
|
1068
1062
|
_id
|
|
1069
1063
|
userId
|
|
@@ -1076,7 +1070,7 @@ var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
|
|
|
1076
1070
|
updatedAt
|
|
1077
1071
|
}
|
|
1078
1072
|
`;
|
|
1079
|
-
var GET_USER_NOTIFICATIONS =
|
|
1073
|
+
var GET_USER_NOTIFICATIONS = import_client18.gql`
|
|
1080
1074
|
query getUserNotifications($userId: String!, $limit: Int, $offset: Int) {
|
|
1081
1075
|
userNotifications(userId: $userId, limit: $limit, offset: $offset) {
|
|
1082
1076
|
...UserNotificationFields
|
|
@@ -1084,7 +1078,7 @@ var GET_USER_NOTIFICATIONS = import_client19.gql`
|
|
|
1084
1078
|
}
|
|
1085
1079
|
${USER_NOTIFICATION_FRAGMENT}
|
|
1086
1080
|
`;
|
|
1087
|
-
var GET_NOTIFICATION_COUNT =
|
|
1081
|
+
var GET_NOTIFICATION_COUNT = import_client18.gql`
|
|
1088
1082
|
query getNotificationCount($userId: String!) {
|
|
1089
1083
|
notificationCount(userId: $userId) {
|
|
1090
1084
|
total
|
|
@@ -1094,7 +1088,7 @@ var GET_NOTIFICATION_COUNT = import_client19.gql`
|
|
|
1094
1088
|
`;
|
|
1095
1089
|
|
|
1096
1090
|
// src/graphql/mutations/notification.ts
|
|
1097
|
-
var CREATE_NOTIFICATION =
|
|
1091
|
+
var CREATE_NOTIFICATION = import_client19.gql`
|
|
1098
1092
|
mutation createNotification($input: CreateNotificationInput!) {
|
|
1099
1093
|
createNotification(input: $input) {
|
|
1100
1094
|
...UserNotificationFields
|
|
@@ -1102,7 +1096,7 @@ var CREATE_NOTIFICATION = import_client20.gql`
|
|
|
1102
1096
|
}
|
|
1103
1097
|
${USER_NOTIFICATION_FRAGMENT}
|
|
1104
1098
|
`;
|
|
1105
|
-
var CREATE_BULK_NOTIFICATIONS =
|
|
1099
|
+
var CREATE_BULK_NOTIFICATIONS = import_client19.gql`
|
|
1106
1100
|
mutation createBulkNotifications($input: CreateBulkNotificationInput!) {
|
|
1107
1101
|
createBulkNotifications(input: $input) {
|
|
1108
1102
|
...UserNotificationFields
|
|
@@ -1110,7 +1104,7 @@ var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
|
|
|
1110
1104
|
}
|
|
1111
1105
|
${USER_NOTIFICATION_FRAGMENT}
|
|
1112
1106
|
`;
|
|
1113
|
-
var MARK_NOTIFICATION_READ =
|
|
1107
|
+
var MARK_NOTIFICATION_READ = import_client19.gql`
|
|
1114
1108
|
mutation markNotificationRead($input: MarkNotificationReadInput!) {
|
|
1115
1109
|
markNotificationRead(input: $input) {
|
|
1116
1110
|
...UserNotificationFields
|
|
@@ -1118,12 +1112,12 @@ var MARK_NOTIFICATION_READ = import_client20.gql`
|
|
|
1118
1112
|
}
|
|
1119
1113
|
${USER_NOTIFICATION_FRAGMENT}
|
|
1120
1114
|
`;
|
|
1121
|
-
var MARK_ALL_NOTIFICATIONS_READ =
|
|
1115
|
+
var MARK_ALL_NOTIFICATIONS_READ = import_client19.gql`
|
|
1122
1116
|
mutation markAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
|
|
1123
1117
|
markAllNotificationsRead(input: $input)
|
|
1124
1118
|
}
|
|
1125
1119
|
`;
|
|
1126
|
-
var DELETE_NOTIFICATION =
|
|
1120
|
+
var DELETE_NOTIFICATION = import_client19.gql`
|
|
1127
1121
|
mutation deleteNotification($_id: ID!) {
|
|
1128
1122
|
deleteNotification(_id: $_id)
|
|
1129
1123
|
}
|
|
@@ -1131,17 +1125,17 @@ var DELETE_NOTIFICATION = import_client20.gql`
|
|
|
1131
1125
|
|
|
1132
1126
|
// src/graphql/hooks/notifications/hooksMutation.ts
|
|
1133
1127
|
var useCreateNotification = () => {
|
|
1134
|
-
const [createNotification, { loading, error }] = (0,
|
|
1128
|
+
const [createNotification, { loading, error }] = (0, import_client20.useMutation)(CREATE_NOTIFICATION);
|
|
1135
1129
|
return { createNotification, error, loading };
|
|
1136
1130
|
};
|
|
1137
1131
|
var useCreateBulkNotifications = () => {
|
|
1138
|
-
const [createBulkNotifications, { loading, error }] = (0,
|
|
1132
|
+
const [createBulkNotifications, { loading, error }] = (0, import_client20.useMutation)(
|
|
1139
1133
|
CREATE_BULK_NOTIFICATIONS
|
|
1140
1134
|
);
|
|
1141
1135
|
return { createBulkNotifications, error, loading };
|
|
1142
1136
|
};
|
|
1143
1137
|
var useMarkNotificationRead = () => {
|
|
1144
|
-
const [markNotificationRead, { loading, error }] = (0,
|
|
1138
|
+
const [markNotificationRead, { loading, error }] = (0, import_client20.useMutation)(
|
|
1145
1139
|
MARK_NOTIFICATION_READ,
|
|
1146
1140
|
{
|
|
1147
1141
|
refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
|
|
@@ -1150,7 +1144,7 @@ var useMarkNotificationRead = () => {
|
|
|
1150
1144
|
return { error, loading, markNotificationRead };
|
|
1151
1145
|
};
|
|
1152
1146
|
var useMarkAllNotificationsRead = () => {
|
|
1153
|
-
const [markAllNotificationsRead, { loading, error }] = (0,
|
|
1147
|
+
const [markAllNotificationsRead, { loading, error }] = (0, import_client20.useMutation)(
|
|
1154
1148
|
MARK_ALL_NOTIFICATIONS_READ,
|
|
1155
1149
|
{
|
|
1156
1150
|
refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
|
|
@@ -1159,7 +1153,7 @@ var useMarkAllNotificationsRead = () => {
|
|
|
1159
1153
|
return { error, loading, markAllNotificationsRead };
|
|
1160
1154
|
};
|
|
1161
1155
|
var useDeleteNotification = () => {
|
|
1162
|
-
const [deleteNotification, { loading, error }] = (0,
|
|
1156
|
+
const [deleteNotification, { loading, error }] = (0, import_client20.useMutation)(
|
|
1163
1157
|
DELETE_NOTIFICATION,
|
|
1164
1158
|
{
|
|
1165
1159
|
refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
|
|
@@ -1168,40 +1162,62 @@ var useDeleteNotification = () => {
|
|
|
1168
1162
|
return { deleteNotification, error, loading };
|
|
1169
1163
|
};
|
|
1170
1164
|
|
|
1171
|
-
// src/graphql/hooks/notifications/
|
|
1165
|
+
// src/graphql/hooks/notifications/hooksSubscription.ts
|
|
1172
1166
|
var import_client22 = require("@apollo/client");
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1167
|
+
|
|
1168
|
+
// src/graphql/subscriptions/notification.ts
|
|
1169
|
+
var import_client21 = require("@apollo/client");
|
|
1170
|
+
var USER_NOTIFICATION_FRAGMENT2 = import_client21.gql`
|
|
1171
|
+
fragment UserNotificationFields on Notification {
|
|
1172
|
+
_id
|
|
1173
|
+
userId
|
|
1174
|
+
title
|
|
1175
|
+
message
|
|
1176
|
+
type
|
|
1177
|
+
isRead
|
|
1178
|
+
data
|
|
1179
|
+
createdAt
|
|
1180
|
+
updatedAt
|
|
1181
|
+
}
|
|
1182
|
+
`;
|
|
1183
|
+
var GET_USER_NOTIFICATIONS_SUBSCRIPTION = import_client21.gql`
|
|
1184
|
+
subscription getUserNotifications($userId: String!) {
|
|
1185
|
+
getUserNotifications(userId: $userId) {
|
|
1186
|
+
...UserNotificationFields
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
${USER_NOTIFICATION_FRAGMENT2}
|
|
1190
|
+
`;
|
|
1191
|
+
var GET_NOTIFICATION_COUNT_SUBSCRIPTION = import_client21.gql`
|
|
1192
|
+
subscription getNotificationCount($userId: String!) {
|
|
1193
|
+
getNotificationCount(userId: $userId) {
|
|
1194
|
+
total
|
|
1195
|
+
unread
|
|
1181
1196
|
}
|
|
1197
|
+
}
|
|
1198
|
+
`;
|
|
1199
|
+
|
|
1200
|
+
// src/graphql/hooks/notifications/hooksSubscription.ts
|
|
1201
|
+
var useGetUserNotificationsSubscription = (userId) => {
|
|
1202
|
+
const { data, loading, error } = (0, import_client22.useSubscription)(GET_USER_NOTIFICATIONS_SUBSCRIPTION, {
|
|
1203
|
+
skip: !userId,
|
|
1204
|
+
variables: { userId }
|
|
1182
1205
|
});
|
|
1183
|
-
const notifications = data?.userNotifications;
|
|
1184
1206
|
return {
|
|
1185
1207
|
error,
|
|
1186
1208
|
loading,
|
|
1187
|
-
notifications
|
|
1188
|
-
refetch
|
|
1209
|
+
notifications: data?.getUserNotifications || []
|
|
1189
1210
|
};
|
|
1190
1211
|
};
|
|
1191
|
-
var
|
|
1192
|
-
const { data,
|
|
1193
|
-
fetchPolicy: "no-cache",
|
|
1212
|
+
var useGetNotificationCountSubscription = (userId) => {
|
|
1213
|
+
const { data, loading, error } = (0, import_client22.useSubscription)(GET_NOTIFICATION_COUNT_SUBSCRIPTION, {
|
|
1194
1214
|
skip: !userId,
|
|
1195
|
-
variables: {
|
|
1196
|
-
userId
|
|
1197
|
-
}
|
|
1215
|
+
variables: { userId }
|
|
1198
1216
|
});
|
|
1199
|
-
const notificationCount = data?.notificationCount;
|
|
1200
1217
|
return {
|
|
1201
1218
|
error,
|
|
1202
1219
|
loading,
|
|
1203
|
-
notificationCount,
|
|
1204
|
-
refetch
|
|
1220
|
+
notificationCount: data?.getNotificationCount || { total: 0, unread: 0 }
|
|
1205
1221
|
};
|
|
1206
1222
|
};
|
|
1207
1223
|
|
|
@@ -2092,7 +2108,6 @@ var useGetUserFavourites = () => {
|
|
|
2092
2108
|
};
|
|
2093
2109
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2094
2110
|
0 && (module.exports = {
|
|
2095
|
-
GET_CHAT_MESSAGE,
|
|
2096
2111
|
useAddParticipantToChat,
|
|
2097
2112
|
useAddUserFavouriteResource,
|
|
2098
2113
|
useAdminUpdateResourceType,
|
|
@@ -2124,7 +2139,7 @@ var useGetUserFavourites = () => {
|
|
|
2124
2139
|
useGetMarkets,
|
|
2125
2140
|
useGetMarketsByRegion,
|
|
2126
2141
|
useGetMarketsNearMe,
|
|
2127
|
-
|
|
2142
|
+
useGetNotificationCountSubscription,
|
|
2128
2143
|
useGetRelation,
|
|
2129
2144
|
useGetRelationByMarketAndStallholder,
|
|
2130
2145
|
useGetResourceConnections,
|
|
@@ -2139,7 +2154,7 @@ var useGetUserFavourites = () => {
|
|
|
2139
2154
|
useGetUserChats,
|
|
2140
2155
|
useGetUserFavourites,
|
|
2141
2156
|
useGetUserMarkets,
|
|
2142
|
-
|
|
2157
|
+
useGetUserNotificationsSubscription,
|
|
2143
2158
|
useGetUserStallholder,
|
|
2144
2159
|
useGetUsers,
|
|
2145
2160
|
useLogin,
|