@timardex/cluemart-shared 1.0.82 → 1.0.84

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 (37) hide show
  1. package/dist/{chunk-3LHMZDI4.mjs → chunk-JIL6JFWC.mjs} +1 -7
  2. package/dist/chunk-JIL6JFWC.mjs.map +1 -0
  3. package/dist/{chunk-ZDTBLK7U.mjs → chunk-ORGSRTC4.mjs} +2 -2
  4. package/dist/enums/index.cjs +0 -7
  5. package/dist/enums/index.cjs.map +1 -1
  6. package/dist/enums/index.d.mts +1 -5
  7. package/dist/enums/index.d.ts +1 -5
  8. package/dist/enums/index.mjs +1 -3
  9. package/dist/formFields/index.cjs.map +1 -1
  10. package/dist/formFields/index.mjs +2 -2
  11. package/dist/graphql/index.cjs +243 -300
  12. package/dist/graphql/index.cjs.map +1 -1
  13. package/dist/graphql/index.d.mts +41 -30
  14. package/dist/graphql/index.d.ts +41 -30
  15. package/dist/graphql/index.mjs +238 -300
  16. package/dist/graphql/index.mjs.map +1 -1
  17. package/dist/hooks/index.cjs.map +1 -1
  18. package/dist/hooks/index.mjs +2 -2
  19. package/dist/index.cjs +255 -307
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.mts +62 -53
  22. package/dist/index.d.ts +62 -53
  23. package/dist/index.mjs +248 -305
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/{notification-P3Vnadx_.d.mts → notification-DDVH6HnE.d.mts} +23 -21
  26. package/dist/{notification-P3Vnadx_.d.ts → notification-DDVH6HnE.d.ts} +23 -21
  27. package/dist/types/index.cjs +21 -0
  28. package/dist/types/index.cjs.map +1 -1
  29. package/dist/types/index.d.mts +1 -1
  30. package/dist/types/index.d.ts +1 -1
  31. package/dist/types/index.mjs +14 -0
  32. package/dist/types/index.mjs.map +1 -1
  33. package/dist/utils/index.cjs.map +1 -1
  34. package/dist/utils/index.mjs +2 -2
  35. package/package.json +1 -1
  36. package/dist/chunk-3LHMZDI4.mjs.map +0 -1
  37. /package/dist/{chunk-ZDTBLK7U.mjs.map → chunk-ORGSRTC4.mjs.map} +0 -0
@@ -25,9 +25,11 @@ __export(graphql_exports, {
25
25
  useAddUserFavouriteResource: () => useAddUserFavouriteResource,
26
26
  useAdminUpdateResourceType: () => useAdminUpdateResourceType,
27
27
  useContactUs: () => useContactUs,
28
+ useCreateBulkNotifications: () => useCreateBulkNotifications,
28
29
  useCreateChat: () => useCreateChat,
29
30
  useCreateMarket: () => useCreateMarket,
30
31
  useCreateMarketInfo: () => useCreateMarketInfo,
32
+ useCreateNotification: () => useCreateNotification,
31
33
  useCreatePoster: () => useCreatePoster,
32
34
  useCreatePushToken: () => useCreatePushToken,
33
35
  useCreateRelation: () => useCreateRelation,
@@ -37,6 +39,7 @@ __export(graphql_exports, {
37
39
  useCreateUser: () => useCreateUser,
38
40
  useDeleteChat: () => useDeleteChat,
39
41
  useDeleteMarket: () => useDeleteMarket,
42
+ useDeleteNotification: () => useDeleteNotification,
40
43
  useDeleteRelation: () => useDeleteRelation,
41
44
  useDeleteStallholder: () => useDeleteStallholder,
42
45
  useDeleteTester: () => useDeleteTester,
@@ -49,6 +52,7 @@ __export(graphql_exports, {
49
52
  useGetMarkets: () => useGetMarkets,
50
53
  useGetMarketsByRegion: () => useGetMarketsByRegion,
51
54
  useGetMarketsNearMe: () => useGetMarketsNearMe,
55
+ useGetNotificationCount: () => useGetNotificationCount,
52
56
  useGetRelation: () => useGetRelation,
53
57
  useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
54
58
  useGetResourceConnections: () => useGetResourceConnections,
@@ -68,7 +72,8 @@ __export(graphql_exports, {
68
72
  useGetUsers: () => useGetUsers,
69
73
  useLogin: () => useLogin,
70
74
  useLogout: () => useLogout,
71
- useNotifications: () => useNotifications,
75
+ useMarkAllNotificationsRead: () => useMarkAllNotificationsRead,
76
+ useMarkNotificationRead: () => useMarkNotificationRead,
72
77
  useRefreshToken: () => useRefreshToken,
73
78
  useRegister: () => useRegister,
74
79
  useRemoveParticipantFromChat: () => useRemoveParticipantFromChat,
@@ -906,11 +911,6 @@ var GET_USER_FAVOURITES = import_client16.gql`
906
911
  ${MARKET}
907
912
  ${STALLHOLDER}
908
913
  `;
909
- var GET_USER_NOTIFICATIONS = import_client16.gql`
910
- query getMissedNotifications {
911
- userNotifications
912
- }
913
- `;
914
914
 
915
915
  // src/graphql/hooks/market/hooksMutation.ts
916
916
  var useCreateMarket = () => {
@@ -1055,12 +1055,162 @@ var useGetMarketInfo = (marketId) => {
1055
1055
  return { error, loading, marketInfo, refetch };
1056
1056
  };
1057
1057
 
1058
- // src/graphql/hooks/poster.ts
1058
+ // src/graphql/hooks/notifications/hooksMutation.ts
1059
+ var import_client21 = require("@apollo/client");
1060
+
1061
+ // src/graphql/mutations/notification.ts
1059
1062
  var import_client20 = require("@apollo/client");
1060
1063
 
1061
- // src/graphql/mutations/poster.ts
1064
+ // src/graphql/queries/notification.ts
1062
1065
  var import_client19 = require("@apollo/client");
1063
- var CREATE_POSTER_MUTATION = import_client19.gql`
1066
+ var USER_NOTIFICATION_FRAGMENT = import_client19.gql`
1067
+ fragment UserNotificationFields on Notification {
1068
+ _id
1069
+ userId
1070
+ title
1071
+ message
1072
+ type
1073
+ isRead
1074
+ data
1075
+ createdAt
1076
+ updatedAt
1077
+ }
1078
+ `;
1079
+ var GET_USER_NOTIFICATIONS = import_client19.gql`
1080
+ query getUserNotifications($userId: String!, $limit: Int, $offset: Int) {
1081
+ userNotifications(userId: $userId, limit: $limit, offset: $offset) {
1082
+ ...UserNotificationFields
1083
+ }
1084
+ }
1085
+ ${USER_NOTIFICATION_FRAGMENT}
1086
+ `;
1087
+ var GET_NOTIFICATION_COUNT = import_client19.gql`
1088
+ query getNotificationCount($userId: String!) {
1089
+ notificationCount(userId: $userId) {
1090
+ total
1091
+ unread
1092
+ }
1093
+ }
1094
+ `;
1095
+
1096
+ // src/graphql/mutations/notification.ts
1097
+ var CREATE_NOTIFICATION = import_client20.gql`
1098
+ mutation createNotification($input: CreateNotificationInput!) {
1099
+ createNotification(input: $input) {
1100
+ ...UserNotificationFields
1101
+ }
1102
+ }
1103
+ ${USER_NOTIFICATION_FRAGMENT}
1104
+ `;
1105
+ var CREATE_BULK_NOTIFICATIONS = import_client20.gql`
1106
+ mutation createBulkNotifications($input: CreateBulkNotificationInput!) {
1107
+ createBulkNotifications(input: $input) {
1108
+ ...UserNotificationFields
1109
+ }
1110
+ }
1111
+ ${USER_NOTIFICATION_FRAGMENT}
1112
+ `;
1113
+ var MARK_NOTIFICATION_READ = import_client20.gql`
1114
+ mutation markNotificationRead($input: MarkNotificationReadInput!) {
1115
+ markNotificationRead(input: $input) {
1116
+ ...UserNotificationFields
1117
+ }
1118
+ }
1119
+ ${USER_NOTIFICATION_FRAGMENT}
1120
+ `;
1121
+ var MARK_ALL_NOTIFICATIONS_READ = import_client20.gql`
1122
+ mutation markAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
1123
+ markAllNotificationsRead(input: $input)
1124
+ }
1125
+ `;
1126
+ var DELETE_NOTIFICATION = import_client20.gql`
1127
+ mutation deleteNotification($_id: ID!) {
1128
+ deleteNotification(_id: $_id)
1129
+ }
1130
+ `;
1131
+
1132
+ // src/graphql/hooks/notifications/hooksMutation.ts
1133
+ var useCreateNotification = () => {
1134
+ const [createNotification, { loading, error }] = (0, import_client21.useMutation)(CREATE_NOTIFICATION);
1135
+ return { createNotification, error, loading };
1136
+ };
1137
+ var useCreateBulkNotifications = () => {
1138
+ const [createBulkNotifications, { loading, error }] = (0, import_client21.useMutation)(
1139
+ CREATE_BULK_NOTIFICATIONS
1140
+ );
1141
+ return { createBulkNotifications, error, loading };
1142
+ };
1143
+ var useMarkNotificationRead = () => {
1144
+ const [markNotificationRead, { loading, error }] = (0, import_client21.useMutation)(
1145
+ MARK_NOTIFICATION_READ,
1146
+ {
1147
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
1148
+ }
1149
+ );
1150
+ return { error, loading, markNotificationRead };
1151
+ };
1152
+ var useMarkAllNotificationsRead = () => {
1153
+ const [markAllNotificationsRead, { loading, error }] = (0, import_client21.useMutation)(
1154
+ MARK_ALL_NOTIFICATIONS_READ,
1155
+ {
1156
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
1157
+ }
1158
+ );
1159
+ return { error, loading, markAllNotificationsRead };
1160
+ };
1161
+ var useDeleteNotification = () => {
1162
+ const [deleteNotification, { loading, error }] = (0, import_client21.useMutation)(
1163
+ DELETE_NOTIFICATION,
1164
+ {
1165
+ refetchQueries: [{ query: GET_USER_NOTIFICATIONS }]
1166
+ }
1167
+ );
1168
+ return { deleteNotification, error, loading };
1169
+ };
1170
+
1171
+ // src/graphql/hooks/notifications/hooksQuery.ts
1172
+ var import_client22 = require("@apollo/client");
1173
+ var useGetUserNotifications = (userId, limit, offset) => {
1174
+ const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_USER_NOTIFICATIONS, {
1175
+ fetchPolicy: "no-cache",
1176
+ skip: !userId,
1177
+ variables: {
1178
+ limit: limit ?? 50,
1179
+ offset: offset ?? 0,
1180
+ userId
1181
+ }
1182
+ });
1183
+ const notifications = data?.userNotifications;
1184
+ return {
1185
+ error,
1186
+ loading,
1187
+ notifications,
1188
+ refetch
1189
+ };
1190
+ };
1191
+ var useGetNotificationCount = (userId) => {
1192
+ const { data, error, loading, refetch } = (0, import_client22.useQuery)(GET_NOTIFICATION_COUNT, {
1193
+ fetchPolicy: "no-cache",
1194
+ skip: !userId,
1195
+ variables: {
1196
+ userId
1197
+ }
1198
+ });
1199
+ const notificationCount = data?.notificationCount;
1200
+ return {
1201
+ error,
1202
+ loading,
1203
+ notificationCount,
1204
+ refetch
1205
+ };
1206
+ };
1207
+
1208
+ // src/graphql/hooks/poster.ts
1209
+ var import_client24 = require("@apollo/client");
1210
+
1211
+ // src/graphql/mutations/poster.ts
1212
+ var import_client23 = require("@apollo/client");
1213
+ var CREATE_POSTER_MUTATION = import_client23.gql`
1064
1214
  mutation createPoster($input: PosterInputType!) {
1065
1215
  createPoster(input: $input) {
1066
1216
  message
@@ -1070,18 +1220,18 @@ var CREATE_POSTER_MUTATION = import_client19.gql`
1070
1220
 
1071
1221
  // src/graphql/hooks/poster.ts
1072
1222
  var useCreatePoster = () => {
1073
- const [createPoster, { loading, error }] = (0, import_client20.useMutation)(
1223
+ const [createPoster, { loading, error }] = (0, import_client24.useMutation)(
1074
1224
  CREATE_POSTER_MUTATION
1075
1225
  );
1076
1226
  return { createPoster, error, loading };
1077
1227
  };
1078
1228
 
1079
1229
  // src/graphql/hooks/pushToken.ts
1080
- var import_client22 = require("@apollo/client");
1230
+ var import_client26 = require("@apollo/client");
1081
1231
 
1082
1232
  // src/graphql/mutations/pushToken.ts
1083
- var import_client21 = require("@apollo/client");
1084
- var CREATE_PUSH_TOKEN_MUTATION = import_client21.gql`
1233
+ var import_client25 = require("@apollo/client");
1234
+ var CREATE_PUSH_TOKEN_MUTATION = import_client25.gql`
1085
1235
  mutation createPushToken($input: PushTokenInput!) {
1086
1236
  createPushToken(input: $input) {
1087
1237
  success
@@ -1091,21 +1241,21 @@ var CREATE_PUSH_TOKEN_MUTATION = import_client21.gql`
1091
1241
 
1092
1242
  // src/graphql/hooks/pushToken.ts
1093
1243
  var useCreatePushToken = () => {
1094
- const [createPushToken, { loading, error }] = (0, import_client22.useMutation)(
1244
+ const [createPushToken, { loading, error }] = (0, import_client26.useMutation)(
1095
1245
  CREATE_PUSH_TOKEN_MUTATION
1096
1246
  );
1097
1247
  return { createPushToken, error, loading };
1098
1248
  };
1099
1249
 
1100
1250
  // src/graphql/hooks/relation/hooksMutation.ts
1101
- var import_client25 = require("@apollo/client");
1251
+ var import_client29 = require("@apollo/client");
1102
1252
 
1103
1253
  // src/graphql/mutations/relation.ts
1104
- var import_client24 = require("@apollo/client");
1254
+ var import_client28 = require("@apollo/client");
1105
1255
 
1106
1256
  // src/graphql/queries/relation.ts
1107
- var import_client23 = require("@apollo/client");
1108
- var RELATION_DATES_FRAGMENT = import_client23.gql`
1257
+ var import_client27 = require("@apollo/client");
1258
+ var RELATION_DATES_FRAGMENT = import_client27.gql`
1109
1259
  fragment RelationDates on RelationDateType {
1110
1260
  lastUpdateBy
1111
1261
  paymentReference
@@ -1119,7 +1269,7 @@ var RELATION_DATES_FRAGMENT = import_client23.gql`
1119
1269
  status
1120
1270
  }
1121
1271
  `;
1122
- var RELATION_FIELDS_FRAGMENT = import_client23.gql`
1272
+ var RELATION_FIELDS_FRAGMENT = import_client27.gql`
1123
1273
  fragment RelationFields on RelationType {
1124
1274
  _id
1125
1275
  apiMessage
@@ -1136,7 +1286,7 @@ var RELATION_FIELDS_FRAGMENT = import_client23.gql`
1136
1286
  }
1137
1287
  ${RELATION_DATES_FRAGMENT}
1138
1288
  `;
1139
- var GET_RELATION = import_client23.gql`
1289
+ var GET_RELATION = import_client27.gql`
1140
1290
  query getRelation($id: ID!) {
1141
1291
  relation(_id: $id) {
1142
1292
  ...RelationFields
@@ -1144,7 +1294,7 @@ var GET_RELATION = import_client23.gql`
1144
1294
  }
1145
1295
  ${RELATION_FIELDS_FRAGMENT}
1146
1296
  `;
1147
- var GET_RELATION_BY_MARKET_AND_STALLHOLDER = import_client23.gql`
1297
+ var GET_RELATION_BY_MARKET_AND_STALLHOLDER = import_client27.gql`
1148
1298
  query getRelationByMarketAndStallholder($marketId: ID!, $stallholderId: ID!) {
1149
1299
  relationByMarketAndStallholder(
1150
1300
  marketId: $marketId
@@ -1155,7 +1305,7 @@ var GET_RELATION_BY_MARKET_AND_STALLHOLDER = import_client23.gql`
1155
1305
  }
1156
1306
  ${RELATION_FIELDS_FRAGMENT}
1157
1307
  `;
1158
- var GET_MARKET_RELATIONS = import_client23.gql`
1308
+ var GET_MARKET_RELATIONS = import_client27.gql`
1159
1309
  query getMarketRelations($marketId: ID!) {
1160
1310
  marketRelations(marketId: $marketId) {
1161
1311
  ...RelationFields
@@ -1163,7 +1313,7 @@ var GET_MARKET_RELATIONS = import_client23.gql`
1163
1313
  }
1164
1314
  ${RELATION_FIELDS_FRAGMENT}
1165
1315
  `;
1166
- var GET_STALLHOLDER_RELATIONS = import_client23.gql`
1316
+ var GET_STALLHOLDER_RELATIONS = import_client27.gql`
1167
1317
  query getStallholderRelations($stallholderId: ID!) {
1168
1318
  stallholderRelations(stallholderId: $stallholderId) {
1169
1319
  ...RelationFields
@@ -1171,7 +1321,7 @@ var GET_STALLHOLDER_RELATIONS = import_client23.gql`
1171
1321
  }
1172
1322
  ${RELATION_FIELDS_FRAGMENT}
1173
1323
  `;
1174
- var GET_RESOURCE_CONNECTIONS = import_client23.gql`
1324
+ var GET_RESOURCE_CONNECTIONS = import_client27.gql`
1175
1325
  query getResourceConnections(
1176
1326
  $resourceId: ID!
1177
1327
  $resourceType: ResourceTypeEnum!
@@ -1274,7 +1424,7 @@ var GET_RESOURCE_CONNECTIONS = import_client23.gql`
1274
1424
  `;
1275
1425
 
1276
1426
  // src/graphql/mutations/relation.ts
1277
- var CREATE_RELATION_MUTATION = import_client24.gql`
1427
+ var CREATE_RELATION_MUTATION = import_client28.gql`
1278
1428
  mutation createRelation($input: RelationInputType!) {
1279
1429
  createRelation(input: $input) {
1280
1430
  ...RelationFields
@@ -1282,7 +1432,7 @@ var CREATE_RELATION_MUTATION = import_client24.gql`
1282
1432
  }
1283
1433
  ${RELATION_FIELDS_FRAGMENT}
1284
1434
  `;
1285
- var UPDATE_RELATION_MUTATION = import_client24.gql`
1435
+ var UPDATE_RELATION_MUTATION = import_client28.gql`
1286
1436
  mutation updateRelation($_id: ID!, $input: RelationInputType!) {
1287
1437
  updateRelation(_id: $_id, input: $input) {
1288
1438
  ...RelationFields
@@ -1290,7 +1440,7 @@ var UPDATE_RELATION_MUTATION = import_client24.gql`
1290
1440
  }
1291
1441
  ${RELATION_FIELDS_FRAGMENT}
1292
1442
  `;
1293
- var DELETE_RELATION_MUTATION = import_client24.gql`
1443
+ var DELETE_RELATION_MUTATION = import_client28.gql`
1294
1444
  mutation deleteRelation($_id: ID!) {
1295
1445
  deleteRelation(_id: $_id) {
1296
1446
  ...RelationFields
@@ -1302,7 +1452,7 @@ var DELETE_RELATION_MUTATION = import_client24.gql`
1302
1452
  // src/graphql/hooks/relation/hooksMutation.ts
1303
1453
  var fetchPolicy = "no-cache";
1304
1454
  var useCreateRelation = () => {
1305
- const [createRelation, { loading, error }] = (0, import_client25.useMutation)(
1455
+ const [createRelation, { loading, error }] = (0, import_client29.useMutation)(
1306
1456
  CREATE_RELATION_MUTATION,
1307
1457
  {
1308
1458
  awaitRefetchQueries: true,
@@ -1354,7 +1504,7 @@ var useCreateRelation = () => {
1354
1504
  return { createRelation, error, loading };
1355
1505
  };
1356
1506
  var useUpdateRelation = () => {
1357
- const [updateRelation, { loading, error }] = (0, import_client25.useMutation)(
1507
+ const [updateRelation, { loading, error }] = (0, import_client29.useMutation)(
1358
1508
  UPDATE_RELATION_MUTATION,
1359
1509
  {
1360
1510
  awaitRefetchQueries: true,
@@ -1402,7 +1552,7 @@ var useUpdateRelation = () => {
1402
1552
  return { error, loading, updateRelation };
1403
1553
  };
1404
1554
  var useDeleteRelation = () => {
1405
- const [deleteRelation, { loading, error }] = (0, import_client25.useMutation)(
1555
+ const [deleteRelation, { loading, error }] = (0, import_client29.useMutation)(
1406
1556
  DELETE_RELATION_MUTATION,
1407
1557
  {
1408
1558
  awaitRefetchQueries: true,
@@ -1450,9 +1600,9 @@ var useDeleteRelation = () => {
1450
1600
  };
1451
1601
 
1452
1602
  // src/graphql/hooks/relation/hooksQuery.ts
1453
- var import_client26 = require("@apollo/client");
1603
+ var import_client30 = require("@apollo/client");
1454
1604
  var useGetRelation = (id) => {
1455
- const { loading, error, data, refetch } = (0, import_client26.useQuery)(GET_RELATION, {
1605
+ const { loading, error, data, refetch } = (0, import_client30.useQuery)(GET_RELATION, {
1456
1606
  fetchPolicy: "network-only",
1457
1607
  skip: id === "",
1458
1608
  variables: { id }
@@ -1461,7 +1611,7 @@ var useGetRelation = (id) => {
1461
1611
  return { error, loading, refetch, relation };
1462
1612
  };
1463
1613
  var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1464
- const { loading, error, data, refetch } = (0, import_client26.useQuery)(
1614
+ const { loading, error, data, refetch } = (0, import_client30.useQuery)(
1465
1615
  GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1466
1616
  {
1467
1617
  fetchPolicy: "network-only",
@@ -1473,7 +1623,7 @@ var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1473
1623
  return { error, loading, refetch, relationByMarketAndStallholder };
1474
1624
  };
1475
1625
  var useGetMarketRelations = (marketId) => {
1476
- const { loading, error, data, refetch } = (0, import_client26.useQuery)(GET_MARKET_RELATIONS, {
1626
+ const { loading, error, data, refetch } = (0, import_client30.useQuery)(GET_MARKET_RELATIONS, {
1477
1627
  fetchPolicy: "network-only",
1478
1628
  skip: marketId === "",
1479
1629
  variables: { marketId }
@@ -1482,7 +1632,7 @@ var useGetMarketRelations = (marketId) => {
1482
1632
  return { error, loading, marketRelations, refetch };
1483
1633
  };
1484
1634
  var useGetStallholderRelations = (stallholderId) => {
1485
- const { loading, error, data, refetch } = (0, import_client26.useQuery)(
1635
+ const { loading, error, data, refetch } = (0, import_client30.useQuery)(
1486
1636
  GET_STALLHOLDER_RELATIONS,
1487
1637
  {
1488
1638
  fetchPolicy: "network-only",
@@ -1494,7 +1644,7 @@ var useGetStallholderRelations = (stallholderId) => {
1494
1644
  return { error, loading, refetch, stallholderRelations };
1495
1645
  };
1496
1646
  var useGetResourceConnections = (resourceId, resourceType) => {
1497
- const { loading, error, data, refetch } = (0, import_client26.useQuery)(GET_RESOURCE_CONNECTIONS, {
1647
+ const { loading, error, data, refetch } = (0, import_client30.useQuery)(GET_RESOURCE_CONNECTIONS, {
1498
1648
  fetchPolicy: "network-only",
1499
1649
  variables: { resourceId, resourceType }
1500
1650
  });
@@ -1503,11 +1653,11 @@ var useGetResourceConnections = (resourceId, resourceType) => {
1503
1653
  };
1504
1654
 
1505
1655
  // src/graphql/hooks/stallholder/hooksMutation.ts
1506
- var import_client28 = require("@apollo/client");
1656
+ var import_client32 = require("@apollo/client");
1507
1657
 
1508
1658
  // src/graphql/mutations/stallholder.ts
1509
- var import_client27 = require("@apollo/client");
1510
- var CREATE_STALLHOLDER_MUTATION = import_client27.gql`
1659
+ var import_client31 = require("@apollo/client");
1660
+ var CREATE_STALLHOLDER_MUTATION = import_client31.gql`
1511
1661
  mutation createStallholder($input: StallholderInputType!) {
1512
1662
  createStallholder(input: $input) {
1513
1663
  ...StallholderFields
@@ -1515,7 +1665,7 @@ var CREATE_STALLHOLDER_MUTATION = import_client27.gql`
1515
1665
  }
1516
1666
  ${STALLHOLDER}
1517
1667
  `;
1518
- var UPDATE_STALLHOLDER_MUTATION = import_client27.gql`
1668
+ var UPDATE_STALLHOLDER_MUTATION = import_client31.gql`
1519
1669
  mutation updateStallholder($_id: ID!, $input: StallholderInputType!) {
1520
1670
  updateStallholder(_id: $_id, input: $input) {
1521
1671
  ...StallholderFields
@@ -1523,12 +1673,12 @@ var UPDATE_STALLHOLDER_MUTATION = import_client27.gql`
1523
1673
  }
1524
1674
  ${STALLHOLDER}
1525
1675
  `;
1526
- var DELETE_STALLHOLDER_MUTATION = import_client27.gql`
1676
+ var DELETE_STALLHOLDER_MUTATION = import_client31.gql`
1527
1677
  mutation deleteStallholder($_id: ID!) {
1528
1678
  deleteStallholder(_id: $_id)
1529
1679
  }
1530
1680
  `;
1531
- var CREATE_STALLHOLDER_INFO_MUTATION = import_client27.gql`
1681
+ var CREATE_STALLHOLDER_INFO_MUTATION = import_client31.gql`
1532
1682
  mutation createStallholderInfo($input: StallholderInfoInputType!) {
1533
1683
  createStallholderInfo(input: $input) {
1534
1684
  ...StallholderInfoFields
@@ -1536,7 +1686,7 @@ var CREATE_STALLHOLDER_INFO_MUTATION = import_client27.gql`
1536
1686
  }
1537
1687
  ${STALLHOLDER_INFO}
1538
1688
  `;
1539
- var UPDATE_STALLHOLDER_INFO_MUTATION = import_client27.gql`
1689
+ var UPDATE_STALLHOLDER_INFO_MUTATION = import_client31.gql`
1540
1690
  mutation updateStallholderInfo($_id: ID!, $input: StallholderInfoInputType!) {
1541
1691
  updateStallholderInfo(_id: $_id, input: $input) {
1542
1692
  ...StallholderInfoFields
@@ -1547,7 +1697,7 @@ var UPDATE_STALLHOLDER_INFO_MUTATION = import_client27.gql`
1547
1697
 
1548
1698
  // src/graphql/hooks/stallholder/hooksMutation.ts
1549
1699
  var useCreateStallholder = () => {
1550
- const [createStallholder, { loading, error }] = (0, import_client28.useMutation)(
1700
+ const [createStallholder, { loading, error }] = (0, import_client32.useMutation)(
1551
1701
  CREATE_STALLHOLDER_MUTATION,
1552
1702
  {
1553
1703
  awaitRefetchQueries: true,
@@ -1559,7 +1709,7 @@ var useCreateStallholder = () => {
1559
1709
  return { createStallholder, error, loading };
1560
1710
  };
1561
1711
  var useUpdateStallholder = () => {
1562
- const [updateStallholder, { loading, error }] = (0, import_client28.useMutation)(
1712
+ const [updateStallholder, { loading, error }] = (0, import_client32.useMutation)(
1563
1713
  UPDATE_STALLHOLDER_MUTATION,
1564
1714
  {
1565
1715
  awaitRefetchQueries: true,
@@ -1571,7 +1721,7 @@ var useUpdateStallholder = () => {
1571
1721
  return { error, loading, updateStallholder };
1572
1722
  };
1573
1723
  var useDeleteStallholder = () => {
1574
- const [deleteStallholder, { loading, error }] = (0, import_client28.useMutation)(
1724
+ const [deleteStallholder, { loading, error }] = (0, import_client32.useMutation)(
1575
1725
  DELETE_STALLHOLDER_MUTATION,
1576
1726
  {
1577
1727
  awaitRefetchQueries: true,
@@ -1583,7 +1733,7 @@ var useDeleteStallholder = () => {
1583
1733
  return { deleteStallholder, error, loading };
1584
1734
  };
1585
1735
  var useCreateStallholderInfo = () => {
1586
- const [createStallholderInfo, { loading, error }] = (0, import_client28.useMutation)(
1736
+ const [createStallholderInfo, { loading, error }] = (0, import_client32.useMutation)(
1587
1737
  CREATE_STALLHOLDER_INFO_MUTATION,
1588
1738
  {
1589
1739
  awaitRefetchQueries: true,
@@ -1607,7 +1757,7 @@ var useCreateStallholderInfo = () => {
1607
1757
  return { createStallholderInfo, error, loading };
1608
1758
  };
1609
1759
  var useUpdateStallholderInfo = () => {
1610
- const [updateStallholderInfo, { loading, error }] = (0, import_client28.useMutation)(
1760
+ const [updateStallholderInfo, { loading, error }] = (0, import_client32.useMutation)(
1611
1761
  UPDATE_STALLHOLDER_INFO_MUTATION,
1612
1762
  {
1613
1763
  awaitRefetchQueries: true,
@@ -1628,9 +1778,9 @@ var useUpdateStallholderInfo = () => {
1628
1778
  };
1629
1779
 
1630
1780
  // src/graphql/hooks/stallholder/hooksQuery.ts
1631
- var import_client29 = require("@apollo/client");
1781
+ var import_client33 = require("@apollo/client");
1632
1782
  var useGetStallholders = () => {
1633
- const { loading, error, data, refetch } = (0, import_client29.useQuery)(GET_STALLHOLDERS, {
1783
+ const { loading, error, data, refetch } = (0, import_client33.useQuery)(GET_STALLHOLDERS, {
1634
1784
  fetchPolicy: "network-only"
1635
1785
  });
1636
1786
  const stallholders = data?.stallholders;
@@ -1642,7 +1792,7 @@ var useGetStallholders = () => {
1642
1792
  };
1643
1793
  };
1644
1794
  var useGetStallholder = (_id) => {
1645
- const { loading, error, data, refetch } = (0, import_client29.useQuery)(GET_STALLHOLDER, {
1795
+ const { loading, error, data, refetch } = (0, import_client33.useQuery)(GET_STALLHOLDER, {
1646
1796
  fetchPolicy: "network-only",
1647
1797
  skip: !_id,
1648
1798
  variables: { _id }
@@ -1651,7 +1801,7 @@ var useGetStallholder = (_id) => {
1651
1801
  return { error, loading, refetch, stallholder };
1652
1802
  };
1653
1803
  var useGetStallholdersByRegion = (region) => {
1654
- const { loading, error, data, refetch } = (0, import_client29.useQuery)(
1804
+ const { loading, error, data, refetch } = (0, import_client33.useQuery)(
1655
1805
  GET_STALLHOLDERS_BY_REGION,
1656
1806
  {
1657
1807
  fetchPolicy: "no-cache",
@@ -1663,7 +1813,7 @@ var useGetStallholdersByRegion = (region) => {
1663
1813
  return { error, loading, refetch, stallholdersByRegion };
1664
1814
  };
1665
1815
  var useSearchStallholders = (search, region) => {
1666
- const { loading, error, data, refetch } = (0, import_client29.useQuery)(SEARCH_STALLHOLDERS, {
1816
+ const { loading, error, data, refetch } = (0, import_client33.useQuery)(SEARCH_STALLHOLDERS, {
1667
1817
  fetchPolicy: "network-only",
1668
1818
  skip: search.length < 3,
1669
1819
  variables: { region, search }
@@ -1672,7 +1822,7 @@ var useSearchStallholders = (search, region) => {
1672
1822
  return { error, loading, refetch, stallholderSearch };
1673
1823
  };
1674
1824
  var useGetStallholderInfo = (stallholderId) => {
1675
- const { loading, error, data, refetch } = (0, import_client29.useQuery)(GET_STALLHOLDER_INFO, {
1825
+ const { loading, error, data, refetch } = (0, import_client33.useQuery)(GET_STALLHOLDER_INFO, {
1676
1826
  fetchPolicy: "network-only",
1677
1827
  skip: !stallholderId,
1678
1828
  variables: { stallholderId }
@@ -1687,14 +1837,14 @@ var useGetStallholderInfo = (stallholderId) => {
1687
1837
  };
1688
1838
 
1689
1839
  // src/graphql/hooks/testers/hooksMutation.ts
1690
- var import_client32 = require("@apollo/client");
1840
+ var import_client36 = require("@apollo/client");
1691
1841
 
1692
1842
  // src/graphql/mutations/testers.ts
1693
- var import_client31 = require("@apollo/client");
1843
+ var import_client35 = require("@apollo/client");
1694
1844
 
1695
1845
  // src/graphql/queries/testers.ts
1696
- var import_client30 = require("@apollo/client");
1697
- var TESTER_FIELDS_FRAGMENT = import_client30.gql`
1846
+ var import_client34 = require("@apollo/client");
1847
+ var TESTER_FIELDS_FRAGMENT = import_client34.gql`
1698
1848
  fragment TesterFields on TesterType {
1699
1849
  _id
1700
1850
  active
@@ -1707,7 +1857,7 @@ var TESTER_FIELDS_FRAGMENT = import_client30.gql`
1707
1857
  updatedAt
1708
1858
  }
1709
1859
  `;
1710
- var GET_TESTERS = import_client30.gql`
1860
+ var GET_TESTERS = import_client34.gql`
1711
1861
  query getTesters {
1712
1862
  testers {
1713
1863
  ...TesterFields
@@ -1715,7 +1865,7 @@ var GET_TESTERS = import_client30.gql`
1715
1865
  }
1716
1866
  ${TESTER_FIELDS_FRAGMENT}
1717
1867
  `;
1718
- var GET_TESTER = import_client30.gql`
1868
+ var GET_TESTER = import_client34.gql`
1719
1869
  query getTester($_id: ID!) {
1720
1870
  tester(_id: $_id) {
1721
1871
  ...TesterFields
@@ -1725,7 +1875,7 @@ var GET_TESTER = import_client30.gql`
1725
1875
  `;
1726
1876
 
1727
1877
  // src/graphql/mutations/testers.ts
1728
- var CREATE_TESTER_MUTATION = import_client31.gql`
1878
+ var CREATE_TESTER_MUTATION = import_client35.gql`
1729
1879
  mutation createTester($input: TesterInputType!) {
1730
1880
  createTester(input: $input) {
1731
1881
  ...TesterFields
@@ -1733,7 +1883,7 @@ var CREATE_TESTER_MUTATION = import_client31.gql`
1733
1883
  }
1734
1884
  ${TESTER_FIELDS_FRAGMENT}
1735
1885
  `;
1736
- var UPDATE_TESTER_MUTATION = import_client31.gql`
1886
+ var UPDATE_TESTER_MUTATION = import_client35.gql`
1737
1887
  mutation updateTester($_id: ID!, $input: TesterInputType!) {
1738
1888
  updateTester(_id: $_id, input: $input) {
1739
1889
  ...TesterFields
@@ -1741,7 +1891,7 @@ var UPDATE_TESTER_MUTATION = import_client31.gql`
1741
1891
  }
1742
1892
  ${TESTER_FIELDS_FRAGMENT}
1743
1893
  `;
1744
- var DELETE_TESTER_MUTATION = import_client31.gql`
1894
+ var DELETE_TESTER_MUTATION = import_client35.gql`
1745
1895
  mutation deleteTester($_id: ID!) {
1746
1896
  deleteTester(_id: $_id)
1747
1897
  }
@@ -1749,7 +1899,7 @@ var DELETE_TESTER_MUTATION = import_client31.gql`
1749
1899
 
1750
1900
  // src/graphql/hooks/testers/hooksMutation.ts
1751
1901
  var useCreateTester = () => {
1752
- const [createTester, { data, loading, error }] = (0, import_client32.useMutation)(
1902
+ const [createTester, { data, loading, error }] = (0, import_client36.useMutation)(
1753
1903
  CREATE_TESTER_MUTATION
1754
1904
  );
1755
1905
  return {
@@ -1760,7 +1910,7 @@ var useCreateTester = () => {
1760
1910
  };
1761
1911
  };
1762
1912
  var useUpdateTester = () => {
1763
- const [updateTester, { data, loading, error }] = (0, import_client32.useMutation)(
1913
+ const [updateTester, { data, loading, error }] = (0, import_client36.useMutation)(
1764
1914
  UPDATE_TESTER_MUTATION
1765
1915
  );
1766
1916
  return {
@@ -1771,16 +1921,16 @@ var useUpdateTester = () => {
1771
1921
  };
1772
1922
  };
1773
1923
  var useDeleteTester = () => {
1774
- const [deleteTester, { loading, error }] = (0, import_client32.useMutation)(
1924
+ const [deleteTester, { loading, error }] = (0, import_client36.useMutation)(
1775
1925
  DELETE_TESTER_MUTATION
1776
1926
  );
1777
1927
  return { deleteTester, error, loading };
1778
1928
  };
1779
1929
 
1780
1930
  // src/graphql/hooks/testers/hooksQuery.ts
1781
- var import_client33 = require("@apollo/client");
1931
+ var import_client37 = require("@apollo/client");
1782
1932
  var useGetTesters = () => {
1783
- const { data, loading, error, refetch } = (0, import_client33.useQuery)(GET_TESTERS);
1933
+ const { data, loading, error, refetch } = (0, import_client37.useQuery)(GET_TESTERS);
1784
1934
  const testers = data?.testers;
1785
1935
  return {
1786
1936
  error,
@@ -1790,7 +1940,7 @@ var useGetTesters = () => {
1790
1940
  };
1791
1941
  };
1792
1942
  var useGetTester = (_id) => {
1793
- const { data, loading, error, refetch } = (0, import_client33.useQuery)(GET_TESTER, {
1943
+ const { data, loading, error, refetch } = (0, import_client37.useQuery)(GET_TESTER, {
1794
1944
  skip: !_id,
1795
1945
  variables: { _id }
1796
1946
  });
@@ -1799,11 +1949,11 @@ var useGetTester = (_id) => {
1799
1949
  };
1800
1950
 
1801
1951
  // src/graphql/hooks/user/hooksMutation.ts
1802
- var import_client35 = require("@apollo/client");
1952
+ var import_client39 = require("@apollo/client");
1803
1953
 
1804
1954
  // src/graphql/mutations/user.ts
1805
- var import_client34 = require("@apollo/client");
1806
- var CREATE_USER_MUTATION = import_client34.gql`
1955
+ var import_client38 = require("@apollo/client");
1956
+ var CREATE_USER_MUTATION = import_client38.gql`
1807
1957
  mutation createUser($input: UserInputType!) {
1808
1958
  createUser(input: $input) {
1809
1959
  ...UserFields
@@ -1811,7 +1961,7 @@ var CREATE_USER_MUTATION = import_client34.gql`
1811
1961
  }
1812
1962
  ${USER_FIELDS_FRAGMENT}
1813
1963
  `;
1814
- var UPDATE_USER_MUTATION = import_client34.gql`
1964
+ var UPDATE_USER_MUTATION = import_client38.gql`
1815
1965
  mutation updateUser($_id: ID!, $input: UserInputType!) {
1816
1966
  updateUser(_id: $_id, input: $input) {
1817
1967
  ...UserFields
@@ -1819,12 +1969,12 @@ var UPDATE_USER_MUTATION = import_client34.gql`
1819
1969
  }
1820
1970
  ${USER_FIELDS_FRAGMENT}
1821
1971
  `;
1822
- var DELETE_USER_MUTATION = import_client34.gql`
1972
+ var DELETE_USER_MUTATION = import_client38.gql`
1823
1973
  mutation deleteUser($_id: ID!) {
1824
1974
  deleteUser(_id: $_id)
1825
1975
  }
1826
1976
  `;
1827
- var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client34.gql`
1977
+ var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client38.gql`
1828
1978
  mutation addUserFavouriteResource(
1829
1979
  $resourceId: ID!
1830
1980
  $resourceType: ResourceTypeEnum!
@@ -1840,7 +1990,7 @@ var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client34.gql`
1840
1990
  }
1841
1991
  ${USER_FIELDS_FRAGMENT}
1842
1992
  `;
1843
- var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client34.gql`
1993
+ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client38.gql`
1844
1994
  mutation removeUserFavouriteResource(
1845
1995
  $resourceId: ID!
1846
1996
  $resourceType: ResourceTypeEnum!
@@ -1859,11 +2009,11 @@ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client34.gql`
1859
2009
 
1860
2010
  // src/graphql/hooks/user/hooksMutation.ts
1861
2011
  var useCreateUser = () => {
1862
- const [createUser, { loading, error }] = (0, import_client35.useMutation)(CREATE_USER_MUTATION);
2012
+ const [createUser, { loading, error }] = (0, import_client39.useMutation)(CREATE_USER_MUTATION);
1863
2013
  return { createUser, error, loading };
1864
2014
  };
1865
2015
  var useUpdateUser = () => {
1866
- const [updateUser, { loading, error }] = (0, import_client35.useMutation)(UPDATE_USER_MUTATION, {
2016
+ const [updateUser, { loading, error }] = (0, import_client39.useMutation)(UPDATE_USER_MUTATION, {
1867
2017
  awaitRefetchQueries: true,
1868
2018
  refetchQueries: (mutationResult) => {
1869
2019
  const userId = mutationResult?.data?.updateUser?._id;
@@ -1874,11 +2024,11 @@ var useUpdateUser = () => {
1874
2024
  return { error, loading, updateUser };
1875
2025
  };
1876
2026
  var useDeleteUser = () => {
1877
- const [deleteUser, { loading, error }] = (0, import_client35.useMutation)(DELETE_USER_MUTATION);
2027
+ const [deleteUser, { loading, error }] = (0, import_client39.useMutation)(DELETE_USER_MUTATION);
1878
2028
  return { deleteUser, error, loading };
1879
2029
  };
1880
2030
  var useAddUserFavouriteResource = () => {
1881
- const [addUserFavouriteResource, { loading, error }] = (0, import_client35.useMutation)(
2031
+ const [addUserFavouriteResource, { loading, error }] = (0, import_client39.useMutation)(
1882
2032
  ADD_USER_FAVOURITE_RESOURCE_MUTATION,
1883
2033
  {
1884
2034
  awaitRefetchQueries: true,
@@ -1888,7 +2038,7 @@ var useAddUserFavouriteResource = () => {
1888
2038
  return { addUserFavouriteResource, error, loading };
1889
2039
  };
1890
2040
  var useRemoveUserFavouriteResource = () => {
1891
- const [removeUserFavouriteResource, { loading, error }] = (0, import_client35.useMutation)(
2041
+ const [removeUserFavouriteResource, { loading, error }] = (0, import_client39.useMutation)(
1892
2042
  REMOVE_USER_FAVOURITE_RESOURCE_MUTATION,
1893
2043
  {
1894
2044
  awaitRefetchQueries: true,
@@ -1899,37 +2049,37 @@ var useRemoveUserFavouriteResource = () => {
1899
2049
  };
1900
2050
 
1901
2051
  // src/graphql/hooks/user/hooksQuery.ts
1902
- var import_client36 = require("@apollo/client");
2052
+ var import_client40 = require("@apollo/client");
1903
2053
  var useGetUsers = () => {
1904
- const { loading, error, data, refetch } = (0, import_client36.useQuery)(GET_USERS, {
2054
+ const { loading, error, data, refetch } = (0, import_client40.useQuery)(GET_USERS, {
1905
2055
  fetchPolicy: "network-only"
1906
2056
  });
1907
2057
  const users = data?.users;
1908
2058
  return { error, loading, refetch, users };
1909
2059
  };
1910
2060
  var useGetUser = (_id) => {
1911
- const { loading, error, data, refetch } = (0, import_client36.useQuery)(GET_USER, {
2061
+ const { loading, error, data, refetch } = (0, import_client40.useQuery)(GET_USER, {
1912
2062
  variables: { _id }
1913
2063
  });
1914
2064
  const user = data?.user;
1915
2065
  return { error, loading, refetch, user };
1916
2066
  };
1917
2067
  var useGetUserMarkets = () => {
1918
- const { loading, error, data, refetch } = (0, import_client36.useQuery)(GET_USER_MARKETS, {
2068
+ const { loading, error, data, refetch } = (0, import_client40.useQuery)(GET_USER_MARKETS, {
1919
2069
  fetchPolicy: "network-only"
1920
2070
  });
1921
2071
  const userMarkets = data?.userMarkets;
1922
2072
  return { error, loading, refetch, userMarkets };
1923
2073
  };
1924
2074
  var useGetUserStallholder = () => {
1925
- const { loading, error, data, refetch } = (0, import_client36.useQuery)(GET_USER_STALLHOLDER, {
2075
+ const { loading, error, data, refetch } = (0, import_client40.useQuery)(GET_USER_STALLHOLDER, {
1926
2076
  fetchPolicy: "network-only"
1927
2077
  });
1928
2078
  const userStallholder = data?.userStallholder;
1929
2079
  return { error, loading, refetch, userStallholder };
1930
2080
  };
1931
2081
  var useGetUserFavourites = () => {
1932
- const { loading, error, data, refetch } = (0, import_client36.useQuery)(GET_USER_FAVOURITES, {
2082
+ const { loading, error, data, refetch } = (0, import_client40.useQuery)(GET_USER_FAVOURITES, {
1933
2083
  fetchPolicy: "network-only"
1934
2084
  });
1935
2085
  const markets = data?.userFavourites.markets;
@@ -1940,218 +2090,6 @@ var useGetUserFavourites = () => {
1940
2090
  };
1941
2091
  return { error, loading, refetch, userFavourites };
1942
2092
  };
1943
- var useGetUserNotifications = () => {
1944
- const { loading, error, data, refetch } = (0, import_client36.useQuery)(GET_USER_NOTIFICATIONS, {
1945
- fetchPolicy: "network-only"
1946
- });
1947
- const userNotifications = data?.userNotifications;
1948
- return { error, loading, refetch, userNotifications };
1949
- };
1950
-
1951
- // src/graphql/hooks/notifications.ts
1952
- var import_client39 = require("@apollo/client");
1953
-
1954
- // src/graphql/mutations/notification.ts
1955
- var import_client37 = require("@apollo/client");
1956
- var CREATE_NOTIFICATION = import_client37.gql`
1957
- mutation CreateNotification($input: CreateNotificationInput!) {
1958
- createNotification(input: $input) {
1959
- id
1960
- userId
1961
- title
1962
- message
1963
- type
1964
- isRead
1965
- data
1966
- createdAt
1967
- updatedAt
1968
- }
1969
- }
1970
- `;
1971
- var CREATE_BULK_NOTIFICATIONS = import_client37.gql`
1972
- mutation CreateBulkNotifications($input: CreateBulkNotificationInput!) {
1973
- createBulkNotifications(input: $input) {
1974
- id
1975
- userId
1976
- title
1977
- message
1978
- type
1979
- isRead
1980
- data
1981
- createdAt
1982
- updatedAt
1983
- }
1984
- }
1985
- `;
1986
- var MARK_NOTIFICATION_READ = import_client37.gql`
1987
- mutation MarkNotificationRead($input: MarkNotificationReadInput!) {
1988
- markNotificationRead(input: $input) {
1989
- id
1990
- userId
1991
- title
1992
- message
1993
- type
1994
- isRead
1995
- data
1996
- createdAt
1997
- updatedAt
1998
- }
1999
- }
2000
- `;
2001
- var MARK_ALL_NOTIFICATIONS_READ = import_client37.gql`
2002
- mutation MarkAllNotificationsRead($input: MarkAllNotificationsReadInput!) {
2003
- markAllNotificationsRead(input: $input)
2004
- }
2005
- `;
2006
-
2007
- // src/graphql/queries/notification.ts
2008
- var import_client38 = require("@apollo/client");
2009
- var GET_USER_NOTIFICATIONS2 = import_client38.gql`
2010
- query GetUserNotifications(
2011
- $userId: String!
2012
- $limit: Int
2013
- $offset: Int
2014
- $isRead: String
2015
- ) {
2016
- userNotifications(
2017
- userId: $userId
2018
- limit: $limit
2019
- offset: $offset
2020
- isRead: $isRead
2021
- ) {
2022
- id
2023
- userId
2024
- title
2025
- message
2026
- type
2027
- isRead
2028
- data
2029
- createdAt
2030
- updatedAt
2031
- }
2032
- }
2033
- `;
2034
- var GET_NOTIFICATION_COUNT = import_client38.gql`
2035
- query GetNotificationCount($userId: String!) {
2036
- notificationCount(userId: $userId) {
2037
- total
2038
- unread
2039
- }
2040
- }
2041
- `;
2042
- var GET_UNREAD_NOTIFICATIONS = import_client38.gql`
2043
- query GetUnreadNotifications($userId: String!, $limit: Int) {
2044
- unreadNotifications(userId: $userId, limit: $limit) {
2045
- id
2046
- userId
2047
- title
2048
- message
2049
- type
2050
- isRead
2051
- data
2052
- createdAt
2053
- updatedAt
2054
- }
2055
- }
2056
- `;
2057
-
2058
- // src/graphql/hooks/notifications.ts
2059
- var useNotifications = (userId) => {
2060
- const client = (0, import_client39.useApolloClient)();
2061
- const {
2062
- data: notificationsData,
2063
- loading: notificationsLoading,
2064
- error: notificationsError,
2065
- refetch: refetchNotifications
2066
- } = (0, import_client39.useQuery)(GET_USER_NOTIFICATIONS2, {
2067
- variables: { userId, limit: 50, offset: 0 },
2068
- fetchPolicy: "cache-and-network",
2069
- skip: !userId
2070
- });
2071
- const {
2072
- data: countData,
2073
- loading: countLoading,
2074
- error: countError,
2075
- refetch: refetchCount
2076
- } = (0, import_client39.useQuery)(GET_NOTIFICATION_COUNT, {
2077
- variables: { userId },
2078
- fetchPolicy: "cache-and-network",
2079
- skip: !userId
2080
- });
2081
- const {
2082
- data: unreadData,
2083
- loading: unreadLoading,
2084
- error: unreadError,
2085
- refetch: refetchUnread
2086
- } = (0, import_client39.useQuery)(GET_UNREAD_NOTIFICATIONS, {
2087
- variables: { userId, limit: 20 },
2088
- fetchPolicy: "cache-and-network",
2089
- skip: !userId
2090
- });
2091
- const [createNotification, { loading: createLoading }] = (0, import_client39.useMutation)(CREATE_NOTIFICATION);
2092
- const [createBulkNotifications, { loading: createBulkLoading }] = (0, import_client39.useMutation)(
2093
- CREATE_BULK_NOTIFICATIONS
2094
- );
2095
- const [markNotificationRead, { loading: markReadLoading }] = (0, import_client39.useMutation)(
2096
- MARK_NOTIFICATION_READ
2097
- );
2098
- const [markAllNotificationsRead, { loading: markAllReadLoading }] = (0, import_client39.useMutation)(MARK_ALL_NOTIFICATIONS_READ);
2099
- const refetchAll = () => {
2100
- if (userId) {
2101
- refetchNotifications();
2102
- refetchCount();
2103
- refetchUnread();
2104
- }
2105
- };
2106
- const invalidateCache = () => {
2107
- client.cache.evict({ fieldName: "userNotifications" });
2108
- client.cache.evict({ fieldName: "notificationCount" });
2109
- client.cache.evict({ fieldName: "unreadNotifications" });
2110
- client.cache.gc();
2111
- };
2112
- return {
2113
- // Data
2114
- notifications: notificationsData?.userNotifications || [],
2115
- count: countData?.notificationCount || { total: 0, unread: 0 },
2116
- unreadNotifications: unreadData?.unreadNotifications || [],
2117
- // Loading states
2118
- notificationsLoading,
2119
- countLoading,
2120
- unreadLoading,
2121
- createLoading,
2122
- createBulkLoading,
2123
- markReadLoading,
2124
- markAllReadLoading,
2125
- // Errors
2126
- notificationsError,
2127
- countError,
2128
- unreadError,
2129
- // Actions
2130
- createNotification: async (input) => {
2131
- const result = await createNotification({ variables: { input } });
2132
- refetchAll();
2133
- return result;
2134
- },
2135
- createBulkNotifications: async (input) => {
2136
- const result = await createBulkNotifications({ variables: { input } });
2137
- refetchAll();
2138
- return result;
2139
- },
2140
- markNotificationRead: async (input) => {
2141
- const result = await markNotificationRead({ variables: { input } });
2142
- refetchAll();
2143
- return result;
2144
- },
2145
- markAllNotificationsRead: async (input) => {
2146
- const result = await markAllNotificationsRead({ variables: { input } });
2147
- refetchAll();
2148
- return result;
2149
- },
2150
- // Utilities
2151
- refetchAll,
2152
- invalidateCache
2153
- };
2154
- };
2155
2093
  // Annotate the CommonJS export names for ESM import in node:
2156
2094
  0 && (module.exports = {
2157
2095
  GET_CHAT_MESSAGE,
@@ -2159,9 +2097,11 @@ var useNotifications = (userId) => {
2159
2097
  useAddUserFavouriteResource,
2160
2098
  useAdminUpdateResourceType,
2161
2099
  useContactUs,
2100
+ useCreateBulkNotifications,
2162
2101
  useCreateChat,
2163
2102
  useCreateMarket,
2164
2103
  useCreateMarketInfo,
2104
+ useCreateNotification,
2165
2105
  useCreatePoster,
2166
2106
  useCreatePushToken,
2167
2107
  useCreateRelation,
@@ -2171,6 +2111,7 @@ var useNotifications = (userId) => {
2171
2111
  useCreateUser,
2172
2112
  useDeleteChat,
2173
2113
  useDeleteMarket,
2114
+ useDeleteNotification,
2174
2115
  useDeleteRelation,
2175
2116
  useDeleteStallholder,
2176
2117
  useDeleteTester,
@@ -2183,6 +2124,7 @@ var useNotifications = (userId) => {
2183
2124
  useGetMarkets,
2184
2125
  useGetMarketsByRegion,
2185
2126
  useGetMarketsNearMe,
2127
+ useGetNotificationCount,
2186
2128
  useGetRelation,
2187
2129
  useGetRelationByMarketAndStallholder,
2188
2130
  useGetResourceConnections,
@@ -2202,7 +2144,8 @@ var useNotifications = (userId) => {
2202
2144
  useGetUsers,
2203
2145
  useLogin,
2204
2146
  useLogout,
2205
- useNotifications,
2147
+ useMarkAllNotificationsRead,
2148
+ useMarkNotificationRead,
2206
2149
  useRefreshToken,
2207
2150
  useRegister,
2208
2151
  useRemoveParticipantFromChat,