@timardex/cluemart-shared 1.0.79 → 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.
- package/dist/chunk-SCXVJDGI.mjs +114 -0
- package/dist/chunk-SCXVJDGI.mjs.map +1 -0
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/{global-Drk9CYfv.d.ts → global-Bieh1fh8.d.mts} +2 -10
- package/dist/{global-2TLPFthS.d.mts → global-By7aHQ1y.d.ts} +2 -10
- package/dist/graphql/index.cjs +152 -104
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +11 -13
- package/dist/graphql/index.d.ts +11 -13
- package/dist/graphql/index.mjs +32 -84
- package/dist/graphql/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +202 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +26 -3
- package/dist/hooks/index.d.ts +26 -3
- package/dist/hooks/index.mjs +104 -0
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +248 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +69 -20
- package/dist/index.d.ts +69 -20
- package/dist/index.mjs +220 -82
- package/dist/index.mjs.map +1 -1
- package/dist/{contactUs-CQ9xTjlE.d.mts → notification-H4hE5cdq.d.mts} +38 -1
- package/dist/{contactUs-CQ9xTjlE.d.ts → notification-H4hE5cdq.d.ts} +38 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
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,
|
|
@@ -3570,81 +3576,15 @@ var useGetStallholderInfo = (stallholderId) => {
|
|
|
3570
3576
|
};
|
|
3571
3577
|
};
|
|
3572
3578
|
|
|
3573
|
-
// src/graphql/hooks/subscriptions.ts
|
|
3574
|
-
var import_client31 = require("@apollo/client");
|
|
3575
|
-
|
|
3576
|
-
// src/graphql/subscriptions/chat.ts
|
|
3577
|
-
var import_client29 = require("@apollo/client");
|
|
3578
|
-
var GET_CHAT_MESSAGE = import_client29.gql`
|
|
3579
|
-
subscription {
|
|
3580
|
-
getChatMessage {
|
|
3581
|
-
...ChatFields
|
|
3582
|
-
}
|
|
3583
|
-
}
|
|
3584
|
-
${CHAT_FIELDS_FRAGMENT}
|
|
3585
|
-
`;
|
|
3586
|
-
|
|
3587
|
-
// src/graphql/subscriptions/notification.ts
|
|
3588
|
-
var import_client30 = require("@apollo/client");
|
|
3589
|
-
var NOTIFICATION_FIELDS_FRAGMENT = import_client30.gql`
|
|
3590
|
-
fragment NotificationFields on NotificationType {
|
|
3591
|
-
createdBy
|
|
3592
|
-
important
|
|
3593
|
-
message
|
|
3594
|
-
notifyUser
|
|
3595
|
-
resourceId
|
|
3596
|
-
resourceType
|
|
3597
|
-
}
|
|
3598
|
-
`;
|
|
3599
|
-
var GET_GLOBAL_NOTIFICATION = import_client30.gql`
|
|
3600
|
-
subscription {
|
|
3601
|
-
getGlobalNotification {
|
|
3602
|
-
...NotificationFields
|
|
3603
|
-
}
|
|
3604
|
-
}
|
|
3605
|
-
${NOTIFICATION_FIELDS_FRAGMENT}
|
|
3606
|
-
`;
|
|
3607
|
-
var GET_RELATION_NOTIFICATION = import_client30.gql`
|
|
3608
|
-
subscription {
|
|
3609
|
-
getRelationNotification {
|
|
3610
|
-
...NotificationFields
|
|
3611
|
-
}
|
|
3612
|
-
}
|
|
3613
|
-
${NOTIFICATION_FIELDS_FRAGMENT}
|
|
3614
|
-
`;
|
|
3615
|
-
|
|
3616
|
-
// src/graphql/hooks/subscriptions.ts
|
|
3617
|
-
var useGetNotification = () => {
|
|
3618
|
-
const {
|
|
3619
|
-
data: global,
|
|
3620
|
-
loading: loadingGlobal,
|
|
3621
|
-
error: errorGlobal
|
|
3622
|
-
} = (0, import_client31.useSubscription)(GET_GLOBAL_NOTIFICATION);
|
|
3623
|
-
const {
|
|
3624
|
-
data: relation,
|
|
3625
|
-
loading: loadingImportant,
|
|
3626
|
-
error: errorImportant
|
|
3627
|
-
} = (0, import_client31.useSubscription)(GET_RELATION_NOTIFICATION);
|
|
3628
|
-
const error = errorGlobal || errorImportant;
|
|
3629
|
-
const loading = loadingGlobal || loadingImportant;
|
|
3630
|
-
const notification = relation?.getRelationNotification || global?.getGlobalNotification;
|
|
3631
|
-
return { error, loading, notification };
|
|
3632
|
-
};
|
|
3633
|
-
var useGetChatSubscription = () => {
|
|
3634
|
-
const { data, loading, error } = (0, import_client31.useSubscription)(GET_CHAT_MESSAGE);
|
|
3635
|
-
const chat = data?.getChat;
|
|
3636
|
-
return { chat, error, loading };
|
|
3637
|
-
};
|
|
3638
|
-
|
|
3639
3579
|
// src/graphql/hooks/testers/hooksMutation.ts
|
|
3640
|
-
var
|
|
3580
|
+
var import_client31 = require("@apollo/client");
|
|
3641
3581
|
|
|
3642
3582
|
// src/graphql/mutations/testers.ts
|
|
3643
|
-
var
|
|
3583
|
+
var import_client30 = require("@apollo/client");
|
|
3644
3584
|
|
|
3645
3585
|
// src/graphql/queries/testers.ts
|
|
3646
|
-
var
|
|
3647
|
-
var TESTER_FIELDS_FRAGMENT =
|
|
3586
|
+
var import_client29 = require("@apollo/client");
|
|
3587
|
+
var TESTER_FIELDS_FRAGMENT = import_client29.gql`
|
|
3648
3588
|
fragment TesterFields on TesterType {
|
|
3649
3589
|
_id
|
|
3650
3590
|
active
|
|
@@ -3657,7 +3597,7 @@ var TESTER_FIELDS_FRAGMENT = import_client32.gql`
|
|
|
3657
3597
|
updatedAt
|
|
3658
3598
|
}
|
|
3659
3599
|
`;
|
|
3660
|
-
var GET_TESTERS =
|
|
3600
|
+
var GET_TESTERS = import_client29.gql`
|
|
3661
3601
|
query getTesters {
|
|
3662
3602
|
testers {
|
|
3663
3603
|
...TesterFields
|
|
@@ -3665,7 +3605,7 @@ var GET_TESTERS = import_client32.gql`
|
|
|
3665
3605
|
}
|
|
3666
3606
|
${TESTER_FIELDS_FRAGMENT}
|
|
3667
3607
|
`;
|
|
3668
|
-
var GET_TESTER =
|
|
3608
|
+
var GET_TESTER = import_client29.gql`
|
|
3669
3609
|
query getTester($_id: ID!) {
|
|
3670
3610
|
tester(_id: $_id) {
|
|
3671
3611
|
...TesterFields
|
|
@@ -3675,7 +3615,7 @@ var GET_TESTER = import_client32.gql`
|
|
|
3675
3615
|
`;
|
|
3676
3616
|
|
|
3677
3617
|
// src/graphql/mutations/testers.ts
|
|
3678
|
-
var CREATE_TESTER_MUTATION =
|
|
3618
|
+
var CREATE_TESTER_MUTATION = import_client30.gql`
|
|
3679
3619
|
mutation createTester($input: TesterInputType!) {
|
|
3680
3620
|
createTester(input: $input) {
|
|
3681
3621
|
...TesterFields
|
|
@@ -3683,7 +3623,7 @@ var CREATE_TESTER_MUTATION = import_client33.gql`
|
|
|
3683
3623
|
}
|
|
3684
3624
|
${TESTER_FIELDS_FRAGMENT}
|
|
3685
3625
|
`;
|
|
3686
|
-
var UPDATE_TESTER_MUTATION =
|
|
3626
|
+
var UPDATE_TESTER_MUTATION = import_client30.gql`
|
|
3687
3627
|
mutation updateTester($_id: ID!, $input: TesterInputType!) {
|
|
3688
3628
|
updateTester(_id: $_id, input: $input) {
|
|
3689
3629
|
...TesterFields
|
|
@@ -3691,7 +3631,7 @@ var UPDATE_TESTER_MUTATION = import_client33.gql`
|
|
|
3691
3631
|
}
|
|
3692
3632
|
${TESTER_FIELDS_FRAGMENT}
|
|
3693
3633
|
`;
|
|
3694
|
-
var DELETE_TESTER_MUTATION =
|
|
3634
|
+
var DELETE_TESTER_MUTATION = import_client30.gql`
|
|
3695
3635
|
mutation deleteTester($_id: ID!) {
|
|
3696
3636
|
deleteTester(_id: $_id)
|
|
3697
3637
|
}
|
|
@@ -3699,7 +3639,7 @@ var DELETE_TESTER_MUTATION = import_client33.gql`
|
|
|
3699
3639
|
|
|
3700
3640
|
// src/graphql/hooks/testers/hooksMutation.ts
|
|
3701
3641
|
var useCreateTester = () => {
|
|
3702
|
-
const [createTester, { data, loading, error }] = (0,
|
|
3642
|
+
const [createTester, { data, loading, error }] = (0, import_client31.useMutation)(
|
|
3703
3643
|
CREATE_TESTER_MUTATION
|
|
3704
3644
|
);
|
|
3705
3645
|
return {
|
|
@@ -3710,7 +3650,7 @@ var useCreateTester = () => {
|
|
|
3710
3650
|
};
|
|
3711
3651
|
};
|
|
3712
3652
|
var useUpdateTester = () => {
|
|
3713
|
-
const [updateTester, { data, loading, error }] = (0,
|
|
3653
|
+
const [updateTester, { data, loading, error }] = (0, import_client31.useMutation)(
|
|
3714
3654
|
UPDATE_TESTER_MUTATION
|
|
3715
3655
|
);
|
|
3716
3656
|
return {
|
|
@@ -3721,16 +3661,16 @@ var useUpdateTester = () => {
|
|
|
3721
3661
|
};
|
|
3722
3662
|
};
|
|
3723
3663
|
var useDeleteTester = () => {
|
|
3724
|
-
const [deleteTester, { loading, error }] = (0,
|
|
3664
|
+
const [deleteTester, { loading, error }] = (0, import_client31.useMutation)(
|
|
3725
3665
|
DELETE_TESTER_MUTATION
|
|
3726
3666
|
);
|
|
3727
3667
|
return { deleteTester, error, loading };
|
|
3728
3668
|
};
|
|
3729
3669
|
|
|
3730
3670
|
// src/graphql/hooks/testers/hooksQuery.ts
|
|
3731
|
-
var
|
|
3671
|
+
var import_client32 = require("@apollo/client");
|
|
3732
3672
|
var useGetTesters = () => {
|
|
3733
|
-
const { data, loading, error, refetch } = (0,
|
|
3673
|
+
const { data, loading, error, refetch } = (0, import_client32.useQuery)(GET_TESTERS);
|
|
3734
3674
|
const testers = data?.testers;
|
|
3735
3675
|
return {
|
|
3736
3676
|
error,
|
|
@@ -3740,7 +3680,7 @@ var useGetTesters = () => {
|
|
|
3740
3680
|
};
|
|
3741
3681
|
};
|
|
3742
3682
|
var useGetTester = (_id) => {
|
|
3743
|
-
const { data, loading, error, refetch } = (0,
|
|
3683
|
+
const { data, loading, error, refetch } = (0, import_client32.useQuery)(GET_TESTER, {
|
|
3744
3684
|
skip: !_id,
|
|
3745
3685
|
variables: { _id }
|
|
3746
3686
|
});
|
|
@@ -3749,11 +3689,11 @@ var useGetTester = (_id) => {
|
|
|
3749
3689
|
};
|
|
3750
3690
|
|
|
3751
3691
|
// src/graphql/hooks/user/hooksMutation.ts
|
|
3752
|
-
var
|
|
3692
|
+
var import_client34 = require("@apollo/client");
|
|
3753
3693
|
|
|
3754
3694
|
// src/graphql/mutations/user.ts
|
|
3755
|
-
var
|
|
3756
|
-
var CREATE_USER_MUTATION =
|
|
3695
|
+
var import_client33 = require("@apollo/client");
|
|
3696
|
+
var CREATE_USER_MUTATION = import_client33.gql`
|
|
3757
3697
|
mutation createUser($input: UserInputType!) {
|
|
3758
3698
|
createUser(input: $input) {
|
|
3759
3699
|
...UserFields
|
|
@@ -3761,7 +3701,7 @@ var CREATE_USER_MUTATION = import_client36.gql`
|
|
|
3761
3701
|
}
|
|
3762
3702
|
${USER_FIELDS_FRAGMENT}
|
|
3763
3703
|
`;
|
|
3764
|
-
var UPDATE_USER_MUTATION =
|
|
3704
|
+
var UPDATE_USER_MUTATION = import_client33.gql`
|
|
3765
3705
|
mutation updateUser($_id: ID!, $input: UserInputType!) {
|
|
3766
3706
|
updateUser(_id: $_id, input: $input) {
|
|
3767
3707
|
...UserFields
|
|
@@ -3769,12 +3709,12 @@ var UPDATE_USER_MUTATION = import_client36.gql`
|
|
|
3769
3709
|
}
|
|
3770
3710
|
${USER_FIELDS_FRAGMENT}
|
|
3771
3711
|
`;
|
|
3772
|
-
var DELETE_USER_MUTATION =
|
|
3712
|
+
var DELETE_USER_MUTATION = import_client33.gql`
|
|
3773
3713
|
mutation deleteUser($_id: ID!) {
|
|
3774
3714
|
deleteUser(_id: $_id)
|
|
3775
3715
|
}
|
|
3776
3716
|
`;
|
|
3777
|
-
var ADD_USER_FAVOURITE_RESOURCE_MUTATION =
|
|
3717
|
+
var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client33.gql`
|
|
3778
3718
|
mutation addUserFavouriteResource(
|
|
3779
3719
|
$resourceId: ID!
|
|
3780
3720
|
$resourceType: ResourceTypeEnum!
|
|
@@ -3790,7 +3730,7 @@ var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client36.gql`
|
|
|
3790
3730
|
}
|
|
3791
3731
|
${USER_FIELDS_FRAGMENT}
|
|
3792
3732
|
`;
|
|
3793
|
-
var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION =
|
|
3733
|
+
var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client33.gql`
|
|
3794
3734
|
mutation removeUserFavouriteResource(
|
|
3795
3735
|
$resourceId: ID!
|
|
3796
3736
|
$resourceType: ResourceTypeEnum!
|
|
@@ -3809,11 +3749,11 @@ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client36.gql`
|
|
|
3809
3749
|
|
|
3810
3750
|
// src/graphql/hooks/user/hooksMutation.ts
|
|
3811
3751
|
var useCreateUser = () => {
|
|
3812
|
-
const [createUser, { loading, error }] = (0,
|
|
3752
|
+
const [createUser, { loading, error }] = (0, import_client34.useMutation)(CREATE_USER_MUTATION);
|
|
3813
3753
|
return { createUser, error, loading };
|
|
3814
3754
|
};
|
|
3815
3755
|
var useUpdateUser = () => {
|
|
3816
|
-
const [updateUser, { loading, error }] = (0,
|
|
3756
|
+
const [updateUser, { loading, error }] = (0, import_client34.useMutation)(UPDATE_USER_MUTATION, {
|
|
3817
3757
|
awaitRefetchQueries: true,
|
|
3818
3758
|
refetchQueries: (mutationResult) => {
|
|
3819
3759
|
const userId = mutationResult?.data?.updateUser?._id;
|
|
@@ -3824,11 +3764,11 @@ var useUpdateUser = () => {
|
|
|
3824
3764
|
return { error, loading, updateUser };
|
|
3825
3765
|
};
|
|
3826
3766
|
var useDeleteUser = () => {
|
|
3827
|
-
const [deleteUser, { loading, error }] = (0,
|
|
3767
|
+
const [deleteUser, { loading, error }] = (0, import_client34.useMutation)(DELETE_USER_MUTATION);
|
|
3828
3768
|
return { deleteUser, error, loading };
|
|
3829
3769
|
};
|
|
3830
3770
|
var useAddUserFavouriteResource = () => {
|
|
3831
|
-
const [addUserFavouriteResource, { loading, error }] = (0,
|
|
3771
|
+
const [addUserFavouriteResource, { loading, error }] = (0, import_client34.useMutation)(
|
|
3832
3772
|
ADD_USER_FAVOURITE_RESOURCE_MUTATION,
|
|
3833
3773
|
{
|
|
3834
3774
|
awaitRefetchQueries: true,
|
|
@@ -3838,7 +3778,7 @@ var useAddUserFavouriteResource = () => {
|
|
|
3838
3778
|
return { addUserFavouriteResource, error, loading };
|
|
3839
3779
|
};
|
|
3840
3780
|
var useRemoveUserFavouriteResource = () => {
|
|
3841
|
-
const [removeUserFavouriteResource, { loading, error }] = (0,
|
|
3781
|
+
const [removeUserFavouriteResource, { loading, error }] = (0, import_client34.useMutation)(
|
|
3842
3782
|
REMOVE_USER_FAVOURITE_RESOURCE_MUTATION,
|
|
3843
3783
|
{
|
|
3844
3784
|
awaitRefetchQueries: true,
|
|
@@ -3849,37 +3789,37 @@ var useRemoveUserFavouriteResource = () => {
|
|
|
3849
3789
|
};
|
|
3850
3790
|
|
|
3851
3791
|
// src/graphql/hooks/user/hooksQuery.ts
|
|
3852
|
-
var
|
|
3792
|
+
var import_client35 = require("@apollo/client");
|
|
3853
3793
|
var useGetUsers = () => {
|
|
3854
|
-
const { loading, error, data, refetch } = (0,
|
|
3794
|
+
const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USERS, {
|
|
3855
3795
|
fetchPolicy: "network-only"
|
|
3856
3796
|
});
|
|
3857
3797
|
const users = data?.users;
|
|
3858
3798
|
return { error, loading, refetch, users };
|
|
3859
3799
|
};
|
|
3860
3800
|
var useGetUser = (_id) => {
|
|
3861
|
-
const { loading, error, data, refetch } = (0,
|
|
3801
|
+
const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER, {
|
|
3862
3802
|
variables: { _id }
|
|
3863
3803
|
});
|
|
3864
3804
|
const user = data?.user;
|
|
3865
3805
|
return { error, loading, refetch, user };
|
|
3866
3806
|
};
|
|
3867
3807
|
var useGetUserMarkets = () => {
|
|
3868
|
-
const { loading, error, data, refetch } = (0,
|
|
3808
|
+
const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_MARKETS, {
|
|
3869
3809
|
fetchPolicy: "network-only"
|
|
3870
3810
|
});
|
|
3871
3811
|
const userMarkets = data?.userMarkets;
|
|
3872
3812
|
return { error, loading, refetch, userMarkets };
|
|
3873
3813
|
};
|
|
3874
3814
|
var useGetUserStallholder = () => {
|
|
3875
|
-
const { loading, error, data, refetch } = (0,
|
|
3815
|
+
const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_STALLHOLDER, {
|
|
3876
3816
|
fetchPolicy: "network-only"
|
|
3877
3817
|
});
|
|
3878
3818
|
const userStallholder = data?.userStallholder;
|
|
3879
3819
|
return { error, loading, refetch, userStallholder };
|
|
3880
3820
|
};
|
|
3881
3821
|
var useGetUserFavourites = () => {
|
|
3882
|
-
const { loading, error, data, refetch } = (0,
|
|
3822
|
+
const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_FAVOURITES, {
|
|
3883
3823
|
fetchPolicy: "network-only"
|
|
3884
3824
|
});
|
|
3885
3825
|
const markets = data?.userFavourites.markets;
|
|
@@ -3891,13 +3831,117 @@ var useGetUserFavourites = () => {
|
|
|
3891
3831
|
return { error, loading, refetch, userFavourites };
|
|
3892
3832
|
};
|
|
3893
3833
|
var useGetUserNotifications = () => {
|
|
3894
|
-
const { loading, error, data, refetch } = (0,
|
|
3834
|
+
const { loading, error, data, refetch } = (0, import_client35.useQuery)(GET_USER_NOTIFICATIONS, {
|
|
3895
3835
|
fetchPolicy: "network-only"
|
|
3896
3836
|
});
|
|
3897
3837
|
const userNotifications = data?.userNotifications;
|
|
3898
3838
|
return { error, loading, refetch, userNotifications };
|
|
3899
3839
|
};
|
|
3900
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
|
+
|
|
3901
3945
|
// src/hooks/useLocationSearch.ts
|
|
3902
3946
|
var handleApiError = (error, message) => {
|
|
3903
3947
|
console.error(message, error);
|
|
@@ -5078,6 +5122,100 @@ function useContactUsForm(data) {
|
|
|
5078
5122
|
};
|
|
5079
5123
|
}
|
|
5080
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
|
+
|
|
5081
5219
|
// src/storage/index.ts
|
|
5082
5220
|
var SAVED_PASSWORD_KEY = "savedPassword";
|
|
5083
5221
|
var SAVED_EMAIL_KEY = "savedEmail";
|
|
@@ -5124,6 +5262,8 @@ var fonts = {
|
|
|
5124
5262
|
};
|
|
5125
5263
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5126
5264
|
0 && (module.exports = {
|
|
5265
|
+
CREATE_BULK_NOTIFICATIONS,
|
|
5266
|
+
CREATE_NOTIFICATION,
|
|
5127
5267
|
EnumInviteStatus,
|
|
5128
5268
|
EnumNotification,
|
|
5129
5269
|
EnumOSType,
|
|
@@ -5135,7 +5275,12 @@ var fonts = {
|
|
|
5135
5275
|
EnumSocialMedia,
|
|
5136
5276
|
EnumUserLicence,
|
|
5137
5277
|
EnumUserRole,
|
|
5278
|
+
GET_NOTIFICATION_COUNT,
|
|
5279
|
+
GET_UNREAD_NOTIFICATIONS,
|
|
5280
|
+
GET_USER_NOTIFICATIONS,
|
|
5138
5281
|
ImageTypeEnum,
|
|
5282
|
+
MARK_ALL_NOTIFICATIONS_READ,
|
|
5283
|
+
MARK_NOTIFICATION_READ,
|
|
5139
5284
|
SAVED_EMAIL_KEY,
|
|
5140
5285
|
SAVED_PASSWORD_KEY,
|
|
5141
5286
|
SAVED_REFRESH_TOKEN_KEY,
|
|
@@ -5225,14 +5370,12 @@ var fonts = {
|
|
|
5225
5370
|
useDeleteTester,
|
|
5226
5371
|
useDeleteUser,
|
|
5227
5372
|
useGetChat,
|
|
5228
|
-
useGetChatSubscription,
|
|
5229
5373
|
useGetMarket,
|
|
5230
5374
|
useGetMarketInfo,
|
|
5231
5375
|
useGetMarketRelations,
|
|
5232
5376
|
useGetMarkets,
|
|
5233
5377
|
useGetMarketsByRegion,
|
|
5234
5378
|
useGetMarketsNearMe,
|
|
5235
|
-
useGetNotification,
|
|
5236
5379
|
useGetRelation,
|
|
5237
5380
|
useGetRelationByMarketAndStallholder,
|
|
5238
5381
|
useGetResourceConnections,
|
|
@@ -5256,6 +5399,7 @@ var fonts = {
|
|
|
5256
5399
|
useLogout,
|
|
5257
5400
|
useMarketForm,
|
|
5258
5401
|
useMarketInfoForm,
|
|
5402
|
+
useNotifications,
|
|
5259
5403
|
useRefreshToken,
|
|
5260
5404
|
useRegister,
|
|
5261
5405
|
useRegisterForm,
|