@timardex/cluemart-shared 1.0.15 → 1.0.17

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 (54) hide show
  1. package/dist/auth-CAeHx-BM.d.mts +84 -0
  2. package/dist/auth-gmfsaSPo.d.ts +84 -0
  3. package/dist/chat-BUVCf9Tu.d.mts +27 -0
  4. package/dist/chat-BUVCf9Tu.d.ts +27 -0
  5. package/dist/chunk-K5NK2CK5.mjs +133 -0
  6. package/dist/chunk-K5NK2CK5.mjs.map +1 -0
  7. package/dist/chunk-L2H5WFGC.mjs +100 -0
  8. package/dist/chunk-L2H5WFGC.mjs.map +1 -0
  9. package/dist/enums/index.cjs +134 -0
  10. package/dist/enums/index.cjs.map +1 -0
  11. package/dist/enums/index.d.mts +75 -0
  12. package/dist/enums/index.d.ts +75 -0
  13. package/dist/enums/index.mjs +27 -0
  14. package/dist/enums/index.mjs.map +1 -0
  15. package/dist/formFields/index.cjs +890 -0
  16. package/dist/formFields/index.cjs.map +1 -0
  17. package/dist/formFields/index.d.mts +61 -0
  18. package/dist/formFields/index.d.ts +61 -0
  19. package/dist/formFields/index.mjs +756 -0
  20. package/dist/formFields/index.mjs.map +1 -0
  21. package/dist/global-B6OE9jjE.d.mts +349 -0
  22. package/dist/global-Diphaotm.d.ts +349 -0
  23. package/dist/graphql/index.cjs +1712 -0
  24. package/dist/graphql/index.cjs.map +1 -0
  25. package/dist/graphql/index.d.mts +315 -0
  26. package/dist/graphql/index.d.ts +315 -0
  27. package/dist/graphql/index.mjs +1633 -0
  28. package/dist/graphql/index.mjs.map +1 -0
  29. package/dist/hooks/index.cjs +1167 -0
  30. package/dist/hooks/index.cjs.map +1 -0
  31. package/dist/hooks/index.d.mts +87 -0
  32. package/dist/hooks/index.d.ts +87 -0
  33. package/dist/hooks/index.mjs +1045 -0
  34. package/dist/hooks/index.mjs.map +1 -0
  35. package/dist/index.cjs +312 -193
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.mts +48 -297
  38. package/dist/index.d.ts +48 -297
  39. package/dist/index.mjs +305 -171
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/types/index.cjs +19 -0
  42. package/dist/types/index.cjs.map +1 -0
  43. package/dist/types/index.d.mts +12 -0
  44. package/dist/types/index.d.ts +12 -0
  45. package/dist/types/index.mjs +1 -0
  46. package/dist/types/index.mjs.map +1 -0
  47. package/dist/utils/index.cjs +215 -0
  48. package/dist/utils/index.cjs.map +1 -0
  49. package/dist/utils/index.d.mts +66 -0
  50. package/dist/utils/index.d.ts +66 -0
  51. package/dist/utils/index.mjs +38 -0
  52. package/dist/utils/index.mjs.map +1 -0
  53. package/package.json +37 -4
  54. package/dist/index.js.map +0 -1
@@ -0,0 +1,1712 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/graphql/index.ts
21
+ var graphql_exports = {};
22
+ __export(graphql_exports, {
23
+ useAddParticipantToChat: () => useAddParticipantToChat,
24
+ useAddUserFavouriteResource: () => useAddUserFavouriteResource,
25
+ useCreateChat: () => useCreateChat,
26
+ useCreateMarket: () => useCreateMarket,
27
+ useCreateMarketInfo: () => useCreateMarketInfo,
28
+ useCreatePoster: () => useCreatePoster,
29
+ useCreateRelation: () => useCreateRelation,
30
+ useCreateStallholder: () => useCreateStallholder,
31
+ useCreateStallholderApplyForm: () => useCreateStallholderApplyForm,
32
+ useCreateUser: () => useCreateUser,
33
+ useDeleteChat: () => useDeleteChat,
34
+ useDeleteMarket: () => useDeleteMarket,
35
+ useDeleteRelation: () => useDeleteRelation,
36
+ useDeleteStallholder: () => useDeleteStallholder,
37
+ useGetChat: () => useGetChat,
38
+ useGetChatSubscription: () => useGetChatSubscription,
39
+ useGetMarket: () => useGetMarket,
40
+ useGetMarketInfo: () => useGetMarketInfo,
41
+ useGetMarketRelations: () => useGetMarketRelations,
42
+ useGetMarkets: () => useGetMarkets,
43
+ useGetMarketsByRegion: () => useGetMarketsByRegion,
44
+ useGetMarketsNearMe: () => useGetMarketsNearMe,
45
+ useGetNotification: () => useGetNotification,
46
+ useGetRelation: () => useGetRelation,
47
+ useGetRelationByMarketAndStallholder: () => useGetRelationByMarketAndStallholder,
48
+ useGetResourceConnections: () => useGetResourceConnections,
49
+ useGetStallholder: () => useGetStallholder,
50
+ useGetStallholderApplyForm: () => useGetStallholderApplyForm,
51
+ useGetStallholderRelations: () => useGetStallholderRelations,
52
+ useGetStallholders: () => useGetStallholders,
53
+ useGetStallholdersByRegion: () => useGetStallholdersByRegion,
54
+ useGetUser: () => useGetUser,
55
+ useGetUserChats: () => useGetUserChats,
56
+ useGetUserFavourites: () => useGetUserFavourites,
57
+ useGetUserMarkets: () => useGetUserMarkets,
58
+ useGetUserNotifications: () => useGetUserNotifications,
59
+ useGetUsers: () => useGetUsers,
60
+ useLogin: () => useLogin,
61
+ useRegister: () => useRegister,
62
+ useRemoveParticipantFromChat: () => useRemoveParticipantFromChat,
63
+ useRemoveUserFavouriteResource: () => useRemoveUserFavouriteResource,
64
+ useRequestPasswordReset: () => useRequestPasswordReset,
65
+ useResetPassword: () => useResetPassword,
66
+ useSearchMarkets: () => useSearchMarkets,
67
+ useSearchStallholders: () => useSearchStallholders,
68
+ useSendChatMessage: () => useSendChatMessage,
69
+ useUpdateMarket: () => useUpdateMarket,
70
+ useUpdateMarketInfo: () => useUpdateMarketInfo,
71
+ useUpdateRelation: () => useUpdateRelation,
72
+ useUpdateStallholder: () => useUpdateStallholder,
73
+ useUpdateStallholderApplyForm: () => useUpdateStallholderApplyForm,
74
+ useUpdateUser: () => useUpdateUser,
75
+ useValidateToken: () => useValidateToken
76
+ });
77
+ module.exports = __toCommonJS(graphql_exports);
78
+
79
+ // src/graphql/hooks/auth.ts
80
+ var import_client3 = require("@apollo/client");
81
+
82
+ // src/graphql/mutations/auth.ts
83
+ var import_client2 = require("@apollo/client");
84
+
85
+ // src/graphql/queries/global.ts
86
+ var import_client = require("@apollo/client");
87
+ var RESOURCE_IMAGE_FIELDS_FRAGMENT = import_client.gql`
88
+ fragment ResourceImageFields on ResourceImageType {
89
+ source
90
+ title
91
+ }
92
+ `;
93
+ var OWNER_FIELDS_FRAGMENT = import_client.gql`
94
+ fragment OwnerFields on OwnerType {
95
+ _id
96
+ email
97
+ licences
98
+ }
99
+ `;
100
+ var CATEGORY_FIELDS_FRAGMENT = import_client.gql`
101
+ fragment CategoryFields on CategoryType {
102
+ id
103
+ name
104
+ subcategories {
105
+ id
106
+ items
107
+ name
108
+ }
109
+ }
110
+ `;
111
+ var USER_FIELDS_FRAGMENT = import_client.gql`
112
+ fragment UserFields on UserType {
113
+ _id
114
+ active
115
+ avatar {
116
+ ...ResourceImageFields
117
+ }
118
+ createdAt
119
+ email
120
+ favourites {
121
+ markets
122
+ stallholders
123
+ }
124
+ firstName
125
+ lastName
126
+ licences
127
+ markets
128
+ preferredRegion
129
+ role
130
+ stallholder
131
+ updatedAt
132
+ }
133
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
134
+ `;
135
+
136
+ // src/graphql/mutations/auth.ts
137
+ var LOGIN_MUTATION = import_client2.gql`
138
+ mutation login($input: LoginInputType!) {
139
+ login(input: $input) {
140
+ message
141
+ token
142
+ user {
143
+ ...UserFields
144
+ }
145
+ }
146
+ }
147
+ ${USER_FIELDS_FRAGMENT}
148
+ `;
149
+ var REGISTER_MUTATION = import_client2.gql`
150
+ mutation register($input: RegisterInputType!) {
151
+ register(input: $input) {
152
+ message
153
+ token
154
+ user {
155
+ ...UserFields
156
+ }
157
+ }
158
+ }
159
+ ${USER_FIELDS_FRAGMENT}
160
+ `;
161
+ var RESET_PASSWORD_MUTATION = import_client2.gql`
162
+ mutation resetPassword($input: ResetPasswordInputType!) {
163
+ resetPassword(input: $input) {
164
+ message
165
+ }
166
+ }
167
+ `;
168
+ var REQUEST_PASSWORD_RESET_MUTATION = import_client2.gql`
169
+ mutation requestPasswordReset($input: RequestPasswordResetInputType!) {
170
+ requestPasswordReset(input: $input) {
171
+ message
172
+ }
173
+ }
174
+ `;
175
+ var VALIDATE_TOKEN_MUTATION = import_client2.gql`
176
+ mutation validateToken($input: ValidateTokenInputType!) {
177
+ validateToken(input: $input) {
178
+ message
179
+ }
180
+ }
181
+ `;
182
+
183
+ // src/graphql/hooks/auth.ts
184
+ var useLogin = () => {
185
+ const [login, { loading, error }] = (0, import_client3.useMutation)(LOGIN_MUTATION);
186
+ return { error, loading, login };
187
+ };
188
+ var useRegister = () => {
189
+ const [register, { loading, error }] = (0, import_client3.useMutation)(REGISTER_MUTATION);
190
+ return { error, loading, register };
191
+ };
192
+ var useRequestPasswordReset = () => {
193
+ const [requestPasswordReset, { loading, error }] = (0, import_client3.useMutation)(
194
+ REQUEST_PASSWORD_RESET_MUTATION
195
+ );
196
+ return { error, loading, requestPasswordReset };
197
+ };
198
+ var useValidateToken = () => {
199
+ const [validateToken, { loading, error }] = (0, import_client3.useMutation)(
200
+ VALIDATE_TOKEN_MUTATION
201
+ );
202
+ return { error, loading, validateToken };
203
+ };
204
+ var useResetPassword = () => {
205
+ const [resetPassword, { loading, error }] = (0, import_client3.useMutation)(
206
+ RESET_PASSWORD_MUTATION
207
+ );
208
+ return { error, loading, resetPassword };
209
+ };
210
+
211
+ // src/graphql/hooks/chat/hooksMutation.ts
212
+ var import_client6 = require("@apollo/client");
213
+
214
+ // src/graphql/mutations/chat.ts
215
+ var import_client5 = require("@apollo/client");
216
+
217
+ // src/graphql/queries/chat.ts
218
+ var import_client4 = require("@apollo/client");
219
+ var CHAT_MESSAGE_FIELDS_FRAGMENT = import_client4.gql`
220
+ fragment ChatMessageFields on ChatMessageType {
221
+ _id
222
+ content
223
+ createdAt
224
+ senderId
225
+ senderName
226
+ updatedAt
227
+ }
228
+ `;
229
+ var CHAT_FIELDS_FRAGMENT = import_client4.gql`
230
+ fragment ChatFields on ChatType {
231
+ _id
232
+ createdAt
233
+ messages {
234
+ ...ChatMessageFields
235
+ }
236
+ name
237
+ participants
238
+ updatedAt
239
+ }
240
+ ${CHAT_MESSAGE_FIELDS_FRAGMENT}
241
+ `;
242
+ var CHAT = import_client4.gql`
243
+ query chat($_id: ID!) {
244
+ chat(_id: $_id) {
245
+ ...ChatFields
246
+ }
247
+ }
248
+ ${CHAT_FIELDS_FRAGMENT}
249
+ `;
250
+ var USER_CHATS = import_client4.gql`
251
+ query userChats {
252
+ userChats {
253
+ ...ChatFields
254
+ }
255
+ }
256
+ ${CHAT_FIELDS_FRAGMENT}
257
+ `;
258
+
259
+ // src/graphql/mutations/chat.ts
260
+ var CREATE_CHAT_MUTATION = import_client5.gql`
261
+ mutation createChat($input: ChatInputType!) {
262
+ createChat(input: $input) {
263
+ ...ChatFields
264
+ }
265
+ }
266
+ ${CHAT_FIELDS_FRAGMENT}
267
+ `;
268
+ var SEND_CHAT_MESSAGE_MUTATION = import_client5.gql`
269
+ mutation sendChatMessage($_id: ID!, $input: ChatMessageInputType!) {
270
+ sendChatMessage(_id: $_id, input: $input) {
271
+ ...ChatFields
272
+ }
273
+ }
274
+ ${CHAT_FIELDS_FRAGMENT}
275
+ `;
276
+ var DELETE_CHAT_MUTATION = import_client5.gql`
277
+ mutation deleteChat($_id: ID!) {
278
+ deleteChat(_id: $_id)
279
+ }
280
+ `;
281
+ var ADD_PARTICIPANT_TO_CHAT_MUTATION = import_client5.gql`
282
+ mutation addParticipantToChat($_id: ID!, $input: ID!) {
283
+ addParticipantToChat(_id: $_id, input: $input) {
284
+ ...ChatFields
285
+ }
286
+ ${CHAT_FIELDS_FRAGMENT}
287
+ }
288
+ `;
289
+ var REMOVE_PARTICIPANT_FROM_CHAT_MUTATION = import_client5.gql`
290
+ mutation removeParticipantFromChat($_id: ID!, $input: ID!) {
291
+ removeParticipantFromChat(_id: $_id, input: $input) {
292
+ ...ChatFields
293
+ }
294
+ }
295
+ ${CHAT_FIELDS_FRAGMENT}
296
+ `;
297
+
298
+ // src/graphql/hooks/chat/hooksMutation.ts
299
+ var useCreateChat = () => {
300
+ const [createChat, { loading, error }] = (0, import_client6.useMutation)(CREATE_CHAT_MUTATION, {
301
+ awaitRefetchQueries: true,
302
+ refetchQueries: (mutationResult) => {
303
+ const chatId = mutationResult?.data?.createChat?._id;
304
+ return [
305
+ {
306
+ query: USER_CHATS,
307
+ variables: { userId: mutationResult?.data?.createChat?.userId }
308
+ },
309
+ {
310
+ query: CHAT,
311
+ variables: { _id: chatId }
312
+ }
313
+ ];
314
+ }
315
+ });
316
+ return { createChat, error, loading };
317
+ };
318
+ var useSendChatMessage = () => {
319
+ const [sendChatMessage, { loading, error }] = (0, import_client6.useMutation)(
320
+ SEND_CHAT_MESSAGE_MUTATION,
321
+ {
322
+ awaitRefetchQueries: true,
323
+ refetchQueries: (mutationResult) => {
324
+ const chatId = mutationResult?.data?.sendChatMessage?._id;
325
+ return [
326
+ {
327
+ query: CHAT,
328
+ variables: { _id: chatId }
329
+ }
330
+ ];
331
+ }
332
+ }
333
+ );
334
+ return { error, loading, sendChatMessage };
335
+ };
336
+ var useDeleteChat = () => {
337
+ const [deleteChat, { loading, error }] = (0, import_client6.useMutation)(DELETE_CHAT_MUTATION, {
338
+ awaitRefetchQueries: true,
339
+ refetchQueries: [{ query: USER_CHATS }]
340
+ });
341
+ return { deleteChat, error, loading };
342
+ };
343
+ var useAddParticipantToChat = () => {
344
+ const [addParticipantToChat, { loading, error }] = (0, import_client6.useMutation)(
345
+ ADD_PARTICIPANT_TO_CHAT_MUTATION,
346
+ {
347
+ awaitRefetchQueries: true,
348
+ refetchQueries: (mutationResult) => {
349
+ const chatId = mutationResult?.data?.addParticipantToChat?._id;
350
+ return [
351
+ {
352
+ query: CHAT,
353
+ variables: { _id: chatId }
354
+ }
355
+ ];
356
+ }
357
+ }
358
+ );
359
+ return { addParticipantToChat, error, loading };
360
+ };
361
+ var useRemoveParticipantFromChat = () => {
362
+ const [removeParticipantFromChat, { loading, error }] = (0, import_client6.useMutation)(
363
+ REMOVE_PARTICIPANT_FROM_CHAT_MUTATION,
364
+ {
365
+ awaitRefetchQueries: true,
366
+ refetchQueries: (mutationResult) => {
367
+ const chatId = mutationResult?.data?.removeParticipantFromChat?._id;
368
+ return [
369
+ {
370
+ query: CHAT,
371
+ variables: { _id: chatId }
372
+ }
373
+ ];
374
+ }
375
+ }
376
+ );
377
+ return { error, loading, removeParticipantFromChat };
378
+ };
379
+
380
+ // src/graphql/hooks/chat/hooksQuery.ts
381
+ var import_client7 = require("@apollo/client");
382
+ var useGetChat = (_id) => {
383
+ const { loading, error, data, refetch } = (0, import_client7.useQuery)(CHAT, {
384
+ fetchPolicy: "network-only",
385
+ skip: !_id,
386
+ variables: { _id }
387
+ });
388
+ const chat = data?.chat;
389
+ return { chat, error, loading, refetch };
390
+ };
391
+ var useGetUserChats = () => {
392
+ const { loading, error, data, refetch } = (0, import_client7.useQuery)(USER_CHATS, {
393
+ fetchPolicy: "network-only"
394
+ });
395
+ const userChats = data?.userChats;
396
+ return { error, loading, refetch, userChats };
397
+ };
398
+
399
+ // src/graphql/hooks/market/hooksMutation.ts
400
+ var import_client12 = require("@apollo/client");
401
+
402
+ // src/graphql/mutations/market.ts
403
+ var import_client9 = require("@apollo/client");
404
+
405
+ // src/graphql/queries/market.ts
406
+ var import_client8 = require("@apollo/client");
407
+ var MARKET_DATETIME_FIELDS_FRAGMENT = import_client8.gql`
408
+ fragment MarketDateTimeFields on MarketDateTimeType {
409
+ endDate
410
+ endTime
411
+ startDate
412
+ startTime
413
+ }
414
+ `;
415
+ var MARKET_LOCATION_FIELDS_FRAGMENT = import_client8.gql`
416
+ fragment MarketLocationFields on MarketLocationType {
417
+ city
418
+ coordinates
419
+ country
420
+ fullAddress
421
+ latitude
422
+ longitude
423
+ region
424
+ type
425
+ }
426
+ `;
427
+ var MARKET_INFO = import_client8.gql`
428
+ fragment MarketInfoFields on MarketInfoType {
429
+ _id
430
+ applicationDeadlineHours
431
+ dateTime {
432
+ endDate
433
+ endTime
434
+ marketPrice
435
+ startDate
436
+ startTime
437
+ }
438
+ paymentDueHours
439
+ paymentMethod
440
+ paymentTarget {
441
+ accountHolderName
442
+ accountNumber
443
+ link
444
+ }
445
+ rejectionPolicy
446
+ stallCapacity
447
+ }
448
+ `;
449
+ var MARKET = import_client8.gql`
450
+ fragment MarketFields on MarketType {
451
+ _id
452
+ active
453
+ cover {
454
+ ...ResourceImageFields
455
+ }
456
+ createdAt
457
+ dateTime {
458
+ ...MarketDateTimeFields
459
+ }
460
+ description
461
+ images {
462
+ ...ResourceImageFields
463
+ }
464
+ location {
465
+ ...MarketLocationFields
466
+ }
467
+ logo {
468
+ ...ResourceImageFields
469
+ }
470
+ name
471
+ owner {
472
+ ...OwnerFields
473
+ }
474
+ promoCode
475
+ provider
476
+ region
477
+ relationIds
478
+ tags
479
+ updatedAt
480
+ }
481
+ ${MARKET_DATETIME_FIELDS_FRAGMENT}
482
+ ${MARKET_LOCATION_FIELDS_FRAGMENT}
483
+ ${OWNER_FIELDS_FRAGMENT}
484
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
485
+ `;
486
+ var GET_MARKETS = import_client8.gql`
487
+ query getMarkets {
488
+ markets {
489
+ ...MarketFields
490
+ }
491
+ }
492
+ ${MARKET}
493
+ `;
494
+ var GET_MARKET = import_client8.gql`
495
+ query getMarket($_id: ID!) {
496
+ market(_id: $_id) {
497
+ ...MarketFields
498
+ }
499
+ }
500
+ ${MARKET}
501
+ `;
502
+ var GET_MARKETS_BY_REGION = import_client8.gql`
503
+ query getMarketsByRegion($region: String!) {
504
+ marketsByRegion(region: $region) {
505
+ ...MarketFields
506
+ }
507
+ }
508
+ ${MARKET}
509
+ `;
510
+ var SEARCH_MARKETS = import_client8.gql`
511
+ query searchMarkets($search: String!, $region: String) {
512
+ marketSearch(search: $search, region: $region) {
513
+ ...MarketFields
514
+ }
515
+ }
516
+ ${MARKET}
517
+ `;
518
+ var GET_MARKETS_NEAR_ME = import_client8.gql`
519
+ query getMarketsNearMe($latitude: Float!, $longitude: Float!, $radius: Int) {
520
+ marketsNearMe(latitude: $latitude, longitude: $longitude, radius: $radius) {
521
+ ...MarketFields
522
+ }
523
+ }
524
+ ${MARKET}
525
+ `;
526
+ var GET_MARKET_INFO = import_client8.gql`
527
+ query getMarketInfo($_id: ID!) {
528
+ marketInfo(_id: $_id) {
529
+ ...MarketInfoFields
530
+ }
531
+ }
532
+ ${MARKET_INFO}
533
+ `;
534
+
535
+ // src/graphql/mutations/market.ts
536
+ var CREATE_MARKET_MUTATION = import_client9.gql`
537
+ mutation createMarket($input: MarketInputType!) {
538
+ createMarket(input: $input) {
539
+ ...MarketFields
540
+ }
541
+ }
542
+ ${MARKET}
543
+ `;
544
+ var UPDATE_MARKET_MUTATION = import_client9.gql`
545
+ mutation updateMarket($_id: ID!, $input: MarketInputType!) {
546
+ updateMarket(_id: $_id, input: $input) {
547
+ ...MarketFields
548
+ }
549
+ }
550
+ ${MARKET}
551
+ `;
552
+ var DELETE_MARKET_MUTATION = import_client9.gql`
553
+ mutation deleteMarket($_id: ID!) {
554
+ deleteMarket(_id: $_id)
555
+ }
556
+ `;
557
+ var CREATE_MARKET_INFO_MUTATION = import_client9.gql`
558
+ mutation createMarketInfo($input: MarketInfoInputType!) {
559
+ createMarketInfo(input: $input) {
560
+ ...MarketInfoFields
561
+ }
562
+ }
563
+ ${MARKET_INFO}
564
+ `;
565
+ var UPDATE_MARKET_INFO_MUTATION = import_client9.gql`
566
+ mutation updateMarketInfo($_id: ID!, $input: MarketInfoInputType!) {
567
+ updateMarketInfo(_id: $_id, input: $input) {
568
+ ...MarketInfoFields
569
+ }
570
+ }
571
+ ${MARKET_INFO}
572
+ `;
573
+
574
+ // src/graphql/queries/user.ts
575
+ var import_client11 = require("@apollo/client");
576
+
577
+ // src/graphql/queries/stallholder.ts
578
+ var import_client10 = require("@apollo/client");
579
+ var STALLHOLDER_LOCATION_FIELDS_FRAGMENT = import_client10.gql`
580
+ fragment StallholderLocationFields on StallholderLocationType {
581
+ city
582
+ coordinates
583
+ country
584
+ fullAddress
585
+ latitude
586
+ longitude
587
+ region
588
+ type
589
+ }
590
+ `;
591
+ var STALLHOLDER_DATETIME_FIELDS_FRAGMENT = import_client10.gql`
592
+ fragment StallholderDateTimeFields on StallholderDateTimeType {
593
+ endDate
594
+ endTime
595
+ startDate
596
+ startTime
597
+ }
598
+ `;
599
+ var STALLHOLDER = import_client10.gql`
600
+ fragment StallholderFields on StallholderType {
601
+ _id
602
+ active
603
+ applyFormId
604
+ categories {
605
+ ...CategoryFields
606
+ }
607
+ cover {
608
+ ...ResourceImageFields
609
+ }
610
+ createdAt
611
+ description
612
+ images {
613
+ ...ResourceImageFields
614
+ }
615
+ locations {
616
+ dateTime {
617
+ ...StallholderDateTimeFields
618
+ }
619
+ description
620
+ location {
621
+ ...StallholderLocationFields
622
+ }
623
+ }
624
+ logo {
625
+ ...ResourceImageFields
626
+ }
627
+ multiLocation
628
+ name
629
+ owner {
630
+ ...OwnerFields
631
+ }
632
+ products
633
+ promoCode
634
+ region
635
+ relationIds
636
+ specialities
637
+ updatedAt
638
+ }
639
+ ${CATEGORY_FIELDS_FRAGMENT}
640
+ ${STALLHOLDER_DATETIME_FIELDS_FRAGMENT}
641
+ ${STALLHOLDER_LOCATION_FIELDS_FRAGMENT}
642
+ ${OWNER_FIELDS_FRAGMENT}
643
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
644
+ `;
645
+ var STALLHOLDER_APPLY_FORM = import_client10.gql`
646
+ fragment StallholderApplyFormFields on StallholderApplyFormType {
647
+ _id
648
+ active
649
+ electricity {
650
+ details
651
+ isRequired
652
+ }
653
+ foodSafetyGradeFiles
654
+ gazebo {
655
+ details
656
+ isRequired
657
+ }
658
+ packaging
659
+ paymentMethod
660
+ priceRange {
661
+ max
662
+ min
663
+ }
664
+ producedIn
665
+ stallholderId
666
+ stallSize {
667
+ depth
668
+ width
669
+ }
670
+ table {
671
+ details
672
+ isRequired
673
+ }
674
+ }
675
+ `;
676
+ var GET_STALLHOLDERS = import_client10.gql`
677
+ query getStallHolders {
678
+ stallholders {
679
+ ...StallholderFields
680
+ }
681
+ }
682
+ ${STALLHOLDER}
683
+ `;
684
+ var GET_STALLHOLDER = import_client10.gql`
685
+ query getStallHolder($_id: ID!) {
686
+ stallholder(_id: $_id) {
687
+ ...StallholderFields
688
+ }
689
+ }
690
+ ${STALLHOLDER}
691
+ `;
692
+ var GET_STALLHOLDERS_BY_REGION = import_client10.gql`
693
+ query getStallholdersByRegion($region: String!) {
694
+ stallholdersByRegion(region: $region) {
695
+ ...StallholderFields
696
+ }
697
+ }
698
+ ${STALLHOLDER}
699
+ `;
700
+ var SEARCH_STALLHOLDERS = import_client10.gql`
701
+ query searchStallholders($search: String!, $region: String) {
702
+ stallholderSearch(search: $search, region: $region) {
703
+ ...StallholderFields
704
+ }
705
+ }
706
+ ${STALLHOLDER}
707
+ `;
708
+ var GET_STALLHOLDER_APPLY_FORM = import_client10.gql`
709
+ query getStallholderApplyForm($stallholderId: ID!) {
710
+ stallholderApplyForm(stallholderId: $stallholderId) {
711
+ ...StallholderApplyFormFields
712
+ }
713
+ }
714
+ ${STALLHOLDER_APPLY_FORM}
715
+ `;
716
+
717
+ // src/graphql/queries/user.ts
718
+ var GET_USERS = import_client11.gql`
719
+ query getUsers {
720
+ users {
721
+ ...UserFields
722
+ }
723
+ }
724
+ ${USER_FIELDS_FRAGMENT}
725
+ `;
726
+ var GET_USER = import_client11.gql`
727
+ query getUser($id: ID!) {
728
+ user(_id: $id) {
729
+ ...UserFields
730
+ }
731
+ }
732
+ ${USER_FIELDS_FRAGMENT}
733
+ `;
734
+ var GET_USER_MARKETS = import_client11.gql`
735
+ query getUserMarkets {
736
+ userMarkets {
737
+ ...MarketFields
738
+ }
739
+ }
740
+ ${MARKET}
741
+ `;
742
+ var GET_USER_FAVOURITES = import_client11.gql`
743
+ query getUserFavourites {
744
+ userFavourites {
745
+ markets {
746
+ ...MarketFields
747
+ }
748
+ stallholders {
749
+ ...StallholderFields
750
+ }
751
+ }
752
+ }
753
+ ${MARKET}
754
+ ${STALLHOLDER}
755
+ `;
756
+ var GET_USER_NOTIFICATIONS = import_client11.gql`
757
+ query getMissedNotifications {
758
+ userNotifications
759
+ }
760
+ `;
761
+
762
+ // src/graphql/hooks/market/hooksMutation.ts
763
+ var useCreateMarket = () => {
764
+ const [createMarket, { loading, error }] = (0, import_client12.useMutation)(
765
+ CREATE_MARKET_MUTATION,
766
+ {
767
+ awaitRefetchQueries: true,
768
+ refetchQueries: [{ query: GET_USER_MARKETS }, { query: GET_MARKETS }]
769
+ }
770
+ );
771
+ return { createMarket, error, loading };
772
+ };
773
+ var useUpdateMarket = () => {
774
+ const [updateMarket, { loading, error }] = (0, import_client12.useMutation)(
775
+ UPDATE_MARKET_MUTATION,
776
+ {
777
+ awaitRefetchQueries: true,
778
+ refetchQueries: [{ query: GET_USER_MARKETS }, { query: GET_MARKETS }]
779
+ }
780
+ );
781
+ return { error, loading, updateMarket };
782
+ };
783
+ var useDeleteMarket = () => {
784
+ const [deleteMarket, { loading, error }] = (0, import_client12.useMutation)(
785
+ DELETE_MARKET_MUTATION,
786
+ {
787
+ awaitRefetchQueries: true,
788
+ refetchQueries: [{ query: GET_USER_MARKETS }, { query: GET_MARKETS }]
789
+ }
790
+ );
791
+ return { deleteMarket, error, loading };
792
+ };
793
+ var useCreateMarketInfo = () => {
794
+ const [createMarketInfo, { loading, error }] = (0, import_client12.useMutation)(
795
+ CREATE_MARKET_INFO_MUTATION,
796
+ {
797
+ awaitRefetchQueries: true,
798
+ refetchQueries: (mutationResult) => {
799
+ const marketId = mutationResult?.data?.createMarketInfo?.stallholderId;
800
+ if (!marketId) return [];
801
+ return [
802
+ {
803
+ query: GET_MARKET_INFO,
804
+ variables: { marketId }
805
+ // Pass the marketId for refetching
806
+ }
807
+ ];
808
+ }
809
+ }
810
+ );
811
+ return { createMarketInfo, error, loading };
812
+ };
813
+ var useUpdateMarketInfo = () => {
814
+ const [updateMarketInfo, { loading, error }] = (0, import_client12.useMutation)(
815
+ UPDATE_MARKET_INFO_MUTATION,
816
+ {
817
+ awaitRefetchQueries: true,
818
+ refetchQueries: (mutationResult) => {
819
+ const marketId = mutationResult?.data?.updateMarketInfo?.marketId;
820
+ if (!marketId) return [];
821
+ return [
822
+ {
823
+ query: GET_MARKET_INFO,
824
+ variables: { marketId }
825
+ // Pass the marketId for refetching
826
+ }
827
+ ];
828
+ }
829
+ }
830
+ );
831
+ return { error, loading, updateMarketInfo };
832
+ };
833
+
834
+ // src/graphql/hooks/market/hooksQuery.ts
835
+ var import_client13 = require("@apollo/client");
836
+ var useGetMarkets = () => {
837
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKETS, {
838
+ fetchPolicy: "network-only"
839
+ });
840
+ const markets = data?.markets;
841
+ return { error, loading, markets, refetch };
842
+ };
843
+ var useGetMarket = (_id) => {
844
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKET, {
845
+ fetchPolicy: "network-only",
846
+ skip: !_id,
847
+ variables: { _id }
848
+ });
849
+ const market = data?.market;
850
+ return { error, loading, market, refetch };
851
+ };
852
+ var useGetMarketsByRegion = (region) => {
853
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKETS_BY_REGION, {
854
+ fetchPolicy: "network-only",
855
+ skip: !region,
856
+ variables: { region }
857
+ });
858
+ const markets = data?.marketsByRegion;
859
+ return { error, loading, markets, refetch };
860
+ };
861
+ var useSearchMarkets = (search, region) => {
862
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(SEARCH_MARKETS, {
863
+ fetchPolicy: "network-only",
864
+ skip: search.length < 3,
865
+ variables: { region, search }
866
+ });
867
+ const markets = data?.marketSearch;
868
+ return { error, loading, markets, refetch };
869
+ };
870
+ var useGetMarketsNearMe = (location) => {
871
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKETS_NEAR_ME, {
872
+ fetchPolicy: "network-only",
873
+ skip: !location.latitude || !location.longitude,
874
+ variables: {
875
+ latitude: location.latitude,
876
+ longitude: location.longitude,
877
+ radius: location.radius || 1e4
878
+ // Default to 10km if no radius is provided
879
+ }
880
+ });
881
+ const markets = data?.marketsNearMe;
882
+ return { error, loading, markets, refetch };
883
+ };
884
+ var useGetMarketInfo = (marketId) => {
885
+ const { loading, error, data, refetch } = (0, import_client13.useQuery)(GET_MARKET_INFO, {
886
+ fetchPolicy: "network-only",
887
+ skip: !marketId,
888
+ variables: { marketId }
889
+ });
890
+ const marketInfo = data?.marketInfo;
891
+ return { error, loading, marketInfo, refetch };
892
+ };
893
+
894
+ // src/graphql/hooks/poster.ts
895
+ var import_client15 = require("@apollo/client");
896
+
897
+ // src/graphql/mutations/poster.ts
898
+ var import_client14 = require("@apollo/client");
899
+ var CREATE_POSTER_MUTATION = import_client14.gql`
900
+ mutation createPoster($input: PosterInputType!) {
901
+ createPoster(input: $input) {
902
+ message
903
+ }
904
+ }
905
+ `;
906
+
907
+ // src/graphql/hooks/poster.ts
908
+ var useCreatePoster = () => {
909
+ const [createPoster, { loading, error }] = (0, import_client15.useMutation)(
910
+ CREATE_POSTER_MUTATION
911
+ );
912
+ return { createPoster, error, loading };
913
+ };
914
+
915
+ // src/graphql/hooks/relation/hooksMutation.ts
916
+ var import_client18 = require("@apollo/client");
917
+
918
+ // src/graphql/mutations/relation.ts
919
+ var import_client17 = require("@apollo/client");
920
+
921
+ // src/graphql/queries/relation.ts
922
+ var import_client16 = require("@apollo/client");
923
+ var RELATION_UPDATE_BY_FRAGMENT = import_client16.gql`
924
+ fragment RelationUpdateBy on RelationUpdateByType {
925
+ resourceId
926
+ resourceName
927
+ resourceType
928
+ startDate
929
+ toStatus
930
+ }
931
+ `;
932
+ var RELATION_LOGS_FRAGMENT = import_client16.gql`
933
+ fragment RelationLogs on RelationLogType {
934
+ createdAt
935
+ updatedAt
936
+ updatedBy {
937
+ ...RelationUpdateBy
938
+ }
939
+ }
940
+ ${RELATION_UPDATE_BY_FRAGMENT}
941
+ `;
942
+ var RELATION_DATES_FRAGMENT = import_client16.gql`
943
+ fragment RelationDates on RelationDateType {
944
+ lastUpdateBy
945
+ marketPrice
946
+ startDate
947
+ status
948
+ }
949
+ `;
950
+ var RELATION_FIELDS_FRAGMENT = import_client16.gql`
951
+ fragment RelationFields on RelationType {
952
+ _id
953
+ apiMessage
954
+ createdAt
955
+ lastUpdateBy
956
+ marketId
957
+ relationDates {
958
+ ...RelationDates
959
+ }
960
+ relationLogs {
961
+ ...RelationLogs
962
+ }
963
+ relationType
964
+ stallholderId
965
+ updatedAt
966
+ }
967
+ ${RELATION_DATES_FRAGMENT}
968
+ ${RELATION_LOGS_FRAGMENT}
969
+ `;
970
+ var GET_RELATION = import_client16.gql`
971
+ query getRelation($id: ID!) {
972
+ relation(_id: $id) {
973
+ ...RelationFields
974
+ }
975
+ }
976
+ ${RELATION_FIELDS_FRAGMENT}
977
+ `;
978
+ var GET_RELATION_BY_MARKET_AND_STALLHOLDER = import_client16.gql`
979
+ query getRelationByMarketAndStallholder($marketId: ID!, $stallholderId: ID!) {
980
+ relationByMarketAndStallholder(
981
+ marketId: $marketId
982
+ stallholderId: $stallholderId
983
+ ) {
984
+ ...RelationFields
985
+ }
986
+ }
987
+ ${RELATION_FIELDS_FRAGMENT}
988
+ `;
989
+ var GET_MARKET_RELATIONS = import_client16.gql`
990
+ query getMarketRelations($marketId: ID!) {
991
+ marketRelations(marketId: $marketId) {
992
+ ...RelationFields
993
+ }
994
+ }
995
+ ${RELATION_FIELDS_FRAGMENT}
996
+ `;
997
+ var GET_STALLHOLDER_RELATIONS = import_client16.gql`
998
+ query getStallholderRelations($stallholderId: ID!) {
999
+ stallholderRelations(stallholderId: $stallholderId) {
1000
+ ...RelationFields
1001
+ }
1002
+ }
1003
+ ${RELATION_FIELDS_FRAGMENT}
1004
+ `;
1005
+ var GET_RESOURCE_CONNECTIONS = import_client16.gql`
1006
+ query getResourceConnections(
1007
+ $resourceId: ID!
1008
+ $resourceType: ResourceTypeEnum!
1009
+ ) {
1010
+ resourceConnections(resourceId: $resourceId, resourceType: $resourceType) {
1011
+ markets {
1012
+ _id
1013
+ active
1014
+ cover {
1015
+ ...ResourceImageFields
1016
+ }
1017
+ createdAt
1018
+ dateTime {
1019
+ ...MarketDateTimeFields
1020
+ }
1021
+ description
1022
+ images {
1023
+ ...ResourceImageFields
1024
+ }
1025
+ location {
1026
+ ...MarketLocationFields
1027
+ }
1028
+ logo {
1029
+ ...ResourceImageFields
1030
+ }
1031
+ name
1032
+ owner {
1033
+ ...OwnerFields
1034
+ }
1035
+ promoCode
1036
+ provider
1037
+ relationDates {
1038
+ ...RelationDates
1039
+ }
1040
+ relationIds
1041
+ stallApplicationInfo {
1042
+ applicationDeadlineHours
1043
+ rejectionPolicy
1044
+ stallCapacity
1045
+ }
1046
+ tags
1047
+ updatedAt
1048
+ }
1049
+ stallholders {
1050
+ _id
1051
+ active
1052
+ applyFormId
1053
+ categories {
1054
+ ...CategoryFields
1055
+ }
1056
+ cover {
1057
+ ...ResourceImageFields
1058
+ }
1059
+ createdAt
1060
+ description
1061
+ images {
1062
+ ...ResourceImageFields
1063
+ }
1064
+ locations {
1065
+ dateTime {
1066
+ ...StallholderDateTimeFields
1067
+ }
1068
+ location {
1069
+ ...StallholderLocationFields
1070
+ }
1071
+ }
1072
+ logo {
1073
+ ...ResourceImageFields
1074
+ }
1075
+ multiLocation
1076
+ name
1077
+ owner {
1078
+ ...OwnerFields
1079
+ }
1080
+ products
1081
+ promoCode
1082
+ relationDates {
1083
+ ...RelationDates
1084
+ }
1085
+ relationIds
1086
+ specialities
1087
+ updatedAt
1088
+ }
1089
+ }
1090
+ }
1091
+ ${MARKET_DATETIME_FIELDS_FRAGMENT}
1092
+ ${MARKET_LOCATION_FIELDS_FRAGMENT}
1093
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1094
+ ${RELATION_DATES_FRAGMENT}
1095
+ ${CATEGORY_FIELDS_FRAGMENT}
1096
+ ${STALLHOLDER_DATETIME_FIELDS_FRAGMENT}
1097
+ ${STALLHOLDER_LOCATION_FIELDS_FRAGMENT}
1098
+ ${OWNER_FIELDS_FRAGMENT}
1099
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1100
+ `;
1101
+
1102
+ // src/graphql/mutations/relation.ts
1103
+ var CREATE_RELATION_MUTATION = import_client17.gql`
1104
+ mutation createRelation($input: RelationInputType!) {
1105
+ createRelation(input: $input) {
1106
+ ...RelationFields
1107
+ }
1108
+ }
1109
+ ${RELATION_FIELDS_FRAGMENT}
1110
+ `;
1111
+ var UPDATE_RELATION_MUTATION = import_client17.gql`
1112
+ mutation updateRelation($_id: ID!, $input: RelationInputType!) {
1113
+ updateRelation(_id: $_id, input: $input) {
1114
+ ...RelationFields
1115
+ }
1116
+ }
1117
+ ${RELATION_FIELDS_FRAGMENT}
1118
+ `;
1119
+ var DELETE_RELATION_MUTATION = import_client17.gql`
1120
+ mutation deleteRelation($_id: ID!) {
1121
+ deleteRelation(_id: $_id) {
1122
+ ...RelationFields
1123
+ }
1124
+ }
1125
+ ${RELATION_FIELDS_FRAGMENT}
1126
+ `;
1127
+
1128
+ // src/graphql/hooks/relation/hooksMutation.ts
1129
+ var useCreateRelation = () => {
1130
+ const [createRelation, { loading, error }] = (0, import_client18.useMutation)(
1131
+ CREATE_RELATION_MUTATION,
1132
+ {
1133
+ awaitRefetchQueries: true,
1134
+ refetchQueries: (mutationResult) => {
1135
+ const marketId = mutationResult?.data?.createRelation?.marketId;
1136
+ const stallholderId = mutationResult?.data?.createRelation?.stallholderId;
1137
+ return [
1138
+ {
1139
+ query: GET_MARKET_RELATIONS,
1140
+ variables: { marketId }
1141
+ },
1142
+ {
1143
+ query: GET_MARKET,
1144
+ variables: { _id: marketId }
1145
+ },
1146
+ {
1147
+ query: GET_STALLHOLDER_RELATIONS,
1148
+ variables: { stallholderId }
1149
+ },
1150
+ {
1151
+ query: GET_STALLHOLDER,
1152
+ variables: { _id: stallholderId }
1153
+ },
1154
+ {
1155
+ query: GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1156
+ variables: { marketId, stallholderId }
1157
+ }
1158
+ ];
1159
+ }
1160
+ }
1161
+ );
1162
+ return { createRelation, error, loading };
1163
+ };
1164
+ var useUpdateRelation = () => {
1165
+ const [updateRelation, { loading, error }] = (0, import_client18.useMutation)(
1166
+ UPDATE_RELATION_MUTATION,
1167
+ {
1168
+ awaitRefetchQueries: true,
1169
+ refetchQueries: (mutationResult) => {
1170
+ const marketId = mutationResult?.data?.updateRelation?.marketId;
1171
+ const stallholderId = mutationResult?.data?.updateRelation?.stallholderId;
1172
+ return [
1173
+ {
1174
+ query: GET_MARKET_RELATIONS,
1175
+ variables: { marketId }
1176
+ },
1177
+ {
1178
+ query: GET_MARKET,
1179
+ variables: { _id: marketId }
1180
+ },
1181
+ {
1182
+ query: GET_STALLHOLDER_RELATIONS,
1183
+ variables: { stallholderId }
1184
+ },
1185
+ {
1186
+ query: GET_STALLHOLDER,
1187
+ variables: { _id: stallholderId }
1188
+ },
1189
+ {
1190
+ query: GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1191
+ variables: { marketId, stallholderId }
1192
+ }
1193
+ ];
1194
+ }
1195
+ }
1196
+ );
1197
+ return { error, loading, updateRelation };
1198
+ };
1199
+ var useDeleteRelation = () => {
1200
+ const [deleteRelation, { loading, error }] = (0, import_client18.useMutation)(
1201
+ DELETE_RELATION_MUTATION,
1202
+ {
1203
+ awaitRefetchQueries: true,
1204
+ refetchQueries: (mutationResult) => {
1205
+ const marketId = mutationResult?.data?.deleteRelation?.marketId;
1206
+ const stallholderId = mutationResult?.data?.deleteRelation?.stallholderId;
1207
+ return [
1208
+ {
1209
+ query: GET_MARKET_RELATIONS,
1210
+ variables: { marketId }
1211
+ },
1212
+ {
1213
+ query: GET_STALLHOLDER_RELATIONS,
1214
+ variables: { stallholderId }
1215
+ },
1216
+ {
1217
+ query: GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1218
+ variables: { marketId, stallholderId }
1219
+ }
1220
+ ];
1221
+ }
1222
+ }
1223
+ );
1224
+ return { deleteRelation, error, loading };
1225
+ };
1226
+
1227
+ // src/graphql/hooks/relation/hooksQuery.ts
1228
+ var import_client19 = require("@apollo/client");
1229
+ var useGetRelation = (id) => {
1230
+ const { loading, error, data, refetch } = (0, import_client19.useQuery)(GET_RELATION, {
1231
+ fetchPolicy: "network-only",
1232
+ skip: id === "",
1233
+ variables: { id }
1234
+ });
1235
+ const relation = data?.relation;
1236
+ return { error, loading, refetch, relation };
1237
+ };
1238
+ var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1239
+ const { loading, error, data, refetch } = (0, import_client19.useQuery)(
1240
+ GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1241
+ {
1242
+ fetchPolicy: "no-cache",
1243
+ skip: marketId === "" || stallholderId === "",
1244
+ variables: { marketId, stallholderId }
1245
+ }
1246
+ );
1247
+ const relationByMarketAndStallholder = data?.relationByMarketAndStallholder;
1248
+ return { error, loading, refetch, relationByMarketAndStallholder };
1249
+ };
1250
+ var useGetMarketRelations = (marketId) => {
1251
+ const { loading, error, data, refetch } = (0, import_client19.useQuery)(GET_MARKET_RELATIONS, {
1252
+ fetchPolicy: "network-only",
1253
+ skip: marketId === "",
1254
+ variables: { marketId }
1255
+ });
1256
+ const marketRelations = data?.marketRelations;
1257
+ return { error, loading, marketRelations, refetch };
1258
+ };
1259
+ var useGetStallholderRelations = (stallholderId) => {
1260
+ const { loading, error, data, refetch } = (0, import_client19.useQuery)(
1261
+ GET_STALLHOLDER_RELATIONS,
1262
+ {
1263
+ fetchPolicy: "network-only",
1264
+ skip: stallholderId === "",
1265
+ variables: { stallholderId }
1266
+ }
1267
+ );
1268
+ const stallholderRelations = data?.stallholderRelations;
1269
+ return { error, loading, refetch, stallholderRelations };
1270
+ };
1271
+ var useGetResourceConnections = (resourceId, resourceType) => {
1272
+ const { loading, error, data, refetch } = (0, import_client19.useQuery)(GET_RESOURCE_CONNECTIONS, {
1273
+ fetchPolicy: "network-only",
1274
+ variables: { resourceId, resourceType }
1275
+ });
1276
+ const resourceConnections = data?.resourceConnections;
1277
+ return { error, loading, refetch, resourceConnections };
1278
+ };
1279
+
1280
+ // src/graphql/hooks/stallholder/hooksMutation.ts
1281
+ var import_client21 = require("@apollo/client");
1282
+
1283
+ // src/graphql/mutations/stallholder.ts
1284
+ var import_client20 = require("@apollo/client");
1285
+ var CREATE_STALLHOLDER_MUTATION = import_client20.gql`
1286
+ mutation createStallholder($input: StallholderInputType!) {
1287
+ createStallholder(input: $input) {
1288
+ ...StallholderFields
1289
+ }
1290
+ }
1291
+ ${STALLHOLDER}
1292
+ `;
1293
+ var UPDATE_STALLHOLDER_MUTATION = import_client20.gql`
1294
+ mutation updateStallholder($_id: ID!, $input: StallholderInputType!) {
1295
+ updateStallholder(_id: $_id, input: $input) {
1296
+ ...StallholderFields
1297
+ }
1298
+ }
1299
+ ${STALLHOLDER}
1300
+ `;
1301
+ var DELETE_STALLHOLDER_MUTATION = import_client20.gql`
1302
+ mutation deleteStallholder($_id: ID!) {
1303
+ deleteStallholder(_id: $_id)
1304
+ }
1305
+ `;
1306
+ var CREATE_STALLHOLDER_APPLY_FORM_MUTATION = import_client20.gql`
1307
+ mutation createStallholderApplyForm($input: StallholderApplyFormInputType!) {
1308
+ createStallholderApplyForm(input: $input) {
1309
+ ...StallholderApplyFormFields
1310
+ }
1311
+ }
1312
+ ${STALLHOLDER_APPLY_FORM}
1313
+ `;
1314
+ var UPDATE_STALLHOLDER_APPLY_FORM_MUTATION = import_client20.gql`
1315
+ mutation updateStallholderApplyForm(
1316
+ $_id: ID!
1317
+ $input: StallholderApplyFormInputType!
1318
+ ) {
1319
+ updateStallholderApplyForm(_id: $_id, input: $input) {
1320
+ ...StallholderApplyFormFields
1321
+ }
1322
+ }
1323
+ ${STALLHOLDER_APPLY_FORM}
1324
+ `;
1325
+
1326
+ // src/graphql/hooks/stallholder/hooksMutation.ts
1327
+ var useCreateStallholder = () => {
1328
+ const [createStallholder, { loading, error }] = (0, import_client21.useMutation)(
1329
+ CREATE_STALLHOLDER_MUTATION,
1330
+ {
1331
+ awaitRefetchQueries: true,
1332
+ refetchQueries: [{ query: GET_STALLHOLDERS }]
1333
+ }
1334
+ );
1335
+ return { createStallholder, error, loading };
1336
+ };
1337
+ var useUpdateStallholder = () => {
1338
+ const [updateStallholder, { loading, error }] = (0, import_client21.useMutation)(
1339
+ UPDATE_STALLHOLDER_MUTATION,
1340
+ {
1341
+ awaitRefetchQueries: true,
1342
+ refetchQueries: [{ query: GET_STALLHOLDERS }]
1343
+ }
1344
+ );
1345
+ return { error, loading, updateStallholder };
1346
+ };
1347
+ var useDeleteStallholder = () => {
1348
+ const [deleteStallholder, { loading, error }] = (0, import_client21.useMutation)(
1349
+ DELETE_STALLHOLDER_MUTATION,
1350
+ {
1351
+ awaitRefetchQueries: true,
1352
+ refetchQueries: [{ query: GET_STALLHOLDERS }]
1353
+ }
1354
+ );
1355
+ return { deleteStallholder, error, loading };
1356
+ };
1357
+ var useCreateStallholderApplyForm = () => {
1358
+ const [createStallholderApplyForm, { loading, error }] = (0, import_client21.useMutation)(
1359
+ CREATE_STALLHOLDER_APPLY_FORM_MUTATION,
1360
+ {
1361
+ awaitRefetchQueries: true,
1362
+ refetchQueries: (mutationResult) => {
1363
+ const stallholderId = mutationResult?.data?.createStallholderApplyForm?.stallholderId;
1364
+ if (!stallholderId) return [];
1365
+ return [
1366
+ {
1367
+ query: GET_STALLHOLDER_APPLY_FORM,
1368
+ variables: { stallholderId }
1369
+ // Pass the stallholderId for refetching
1370
+ }
1371
+ ];
1372
+ }
1373
+ }
1374
+ );
1375
+ return { createStallholderApplyForm, error, loading };
1376
+ };
1377
+ var useUpdateStallholderApplyForm = () => {
1378
+ const [updateStallholderApplyForm, { loading, error }] = (0, import_client21.useMutation)(
1379
+ UPDATE_STALLHOLDER_APPLY_FORM_MUTATION,
1380
+ {
1381
+ awaitRefetchQueries: true,
1382
+ refetchQueries: (mutationResult) => {
1383
+ const stallholderId = mutationResult?.data?.createStallholderApplyForm?.stallholderId;
1384
+ if (!stallholderId) return [];
1385
+ return [
1386
+ {
1387
+ query: GET_STALLHOLDER_APPLY_FORM,
1388
+ variables: { stallholderId }
1389
+ // Pass the stallholderId for refetching
1390
+ }
1391
+ ];
1392
+ }
1393
+ }
1394
+ );
1395
+ return { error, loading, updateStallholderApplyForm };
1396
+ };
1397
+
1398
+ // src/graphql/hooks/stallholder/hooksQuery.ts
1399
+ var import_client22 = require("@apollo/client");
1400
+ var useGetStallholders = () => {
1401
+ const { loading, error, data, refetch } = (0, import_client22.useQuery)(GET_STALLHOLDERS, {
1402
+ fetchPolicy: "network-only"
1403
+ });
1404
+ const stallholders = data?.stallholders;
1405
+ return {
1406
+ error,
1407
+ loading,
1408
+ refetch,
1409
+ stallholders
1410
+ };
1411
+ };
1412
+ var useGetStallholder = (_id) => {
1413
+ const { loading, error, data, refetch } = (0, import_client22.useQuery)(GET_STALLHOLDER, {
1414
+ fetchPolicy: "network-only",
1415
+ skip: !_id,
1416
+ variables: { _id }
1417
+ });
1418
+ const stallholder = data?.stallholder;
1419
+ return { error, loading, refetch, stallholder };
1420
+ };
1421
+ var useGetStallholdersByRegion = (region) => {
1422
+ const { loading, error, data, refetch } = (0, import_client22.useQuery)(
1423
+ GET_STALLHOLDERS_BY_REGION,
1424
+ {
1425
+ fetchPolicy: "network-only",
1426
+ skip: !region,
1427
+ variables: { region }
1428
+ }
1429
+ );
1430
+ const stallholders = data?.stallholdersByRegion;
1431
+ return { error, loading, refetch, stallholders };
1432
+ };
1433
+ var useSearchStallholders = (search, region) => {
1434
+ const { loading, error, data, refetch } = (0, import_client22.useQuery)(SEARCH_STALLHOLDERS, {
1435
+ fetchPolicy: "network-only",
1436
+ skip: search.length < 3,
1437
+ variables: { region, search }
1438
+ });
1439
+ const stallholders = data?.stallholderSearch;
1440
+ return { error, loading, refetch, stallholders };
1441
+ };
1442
+ var useGetStallholderApplyForm = (stallholderId) => {
1443
+ const { loading, error, data, refetch } = (0, import_client22.useQuery)(
1444
+ GET_STALLHOLDER_APPLY_FORM,
1445
+ {
1446
+ fetchPolicy: "network-only",
1447
+ skip: !stallholderId,
1448
+ variables: { stallholderId }
1449
+ }
1450
+ );
1451
+ const applyForm = data?.stallholderApplyForm;
1452
+ return {
1453
+ applyForm,
1454
+ error,
1455
+ loading,
1456
+ refetch
1457
+ };
1458
+ };
1459
+
1460
+ // src/graphql/hooks/subscriptions.ts
1461
+ var import_client25 = require("@apollo/client");
1462
+
1463
+ // src/graphql/subscriptions/chat.ts
1464
+ var import_client23 = require("@apollo/client");
1465
+ var GET_CHAT_MESSAGE = import_client23.gql`
1466
+ subscription {
1467
+ getChatMessage {
1468
+ ...ChatFields
1469
+ }
1470
+ }
1471
+ ${CHAT_FIELDS_FRAGMENT}
1472
+ `;
1473
+
1474
+ // src/graphql/subscriptions/notification.ts
1475
+ var import_client24 = require("@apollo/client");
1476
+ var NOTIFICATION_FIELDS_FRAGMENT = import_client24.gql`
1477
+ fragment NotificationFields on NotificationType {
1478
+ createdBy
1479
+ important
1480
+ message
1481
+ notifyUser
1482
+ resourceId
1483
+ resourceType
1484
+ }
1485
+ `;
1486
+ var GET_GLOBAL_NOTIFICATION = import_client24.gql`
1487
+ subscription {
1488
+ getGlobalNotification {
1489
+ ...NotificationFields
1490
+ }
1491
+ }
1492
+ ${NOTIFICATION_FIELDS_FRAGMENT}
1493
+ `;
1494
+ var GET_RELATION_NOTIFICATION = import_client24.gql`
1495
+ subscription {
1496
+ getRelationNotification {
1497
+ ...NotificationFields
1498
+ }
1499
+ }
1500
+ ${NOTIFICATION_FIELDS_FRAGMENT}
1501
+ `;
1502
+
1503
+ // src/graphql/hooks/subscriptions.ts
1504
+ var useGetNotification = () => {
1505
+ const {
1506
+ data: global,
1507
+ loading: loadingGlobal,
1508
+ error: errorGlobal
1509
+ } = (0, import_client25.useSubscription)(GET_GLOBAL_NOTIFICATION);
1510
+ const {
1511
+ data: relation,
1512
+ loading: loadingImportant,
1513
+ error: errorImportant
1514
+ } = (0, import_client25.useSubscription)(GET_RELATION_NOTIFICATION);
1515
+ const error = errorGlobal || errorImportant;
1516
+ const loading = loadingGlobal || loadingImportant;
1517
+ const notification = relation?.getRelationNotification || global?.getGlobalNotification;
1518
+ return { error, loading, notification };
1519
+ };
1520
+ var useGetChatSubscription = () => {
1521
+ const { data, loading, error } = (0, import_client25.useSubscription)(GET_CHAT_MESSAGE);
1522
+ const chat = data?.getChat;
1523
+ return { chat, error, loading };
1524
+ };
1525
+
1526
+ // src/graphql/hooks/user/hooksMutation.ts
1527
+ var import_client27 = require("@apollo/client");
1528
+
1529
+ // src/graphql/mutations/user.ts
1530
+ var import_client26 = require("@apollo/client");
1531
+ var CREATE_USER_MUTATION = import_client26.gql`
1532
+ mutation createUser($input: UserInputType!) {
1533
+ createUser(input: $input) {
1534
+ ...UserFields
1535
+ }
1536
+ }
1537
+ ${USER_FIELDS_FRAGMENT}
1538
+ `;
1539
+ var UPDATE_USER_MUTATION = import_client26.gql`
1540
+ mutation updateUser($_id: ID!, $input: UserInputType!) {
1541
+ updateUser(_id: $_id, input: $input) {
1542
+ ...UserFields
1543
+ }
1544
+ }
1545
+ ${USER_FIELDS_FRAGMENT}
1546
+ `;
1547
+ var ADD_USER_FAVOURITE_RESOURCE_MUTATION = import_client26.gql`
1548
+ mutation addUserFavouriteResource(
1549
+ $resourceId: ID!
1550
+ $resourceType: ResourceTypeEnum!
1551
+ $userId: ID!
1552
+ ) {
1553
+ addUserFavouriteResource(
1554
+ resourceId: $resourceId
1555
+ resourceType: $resourceType
1556
+ userId: $userId
1557
+ ) {
1558
+ ...UserFields
1559
+ }
1560
+ }
1561
+ ${USER_FIELDS_FRAGMENT}
1562
+ `;
1563
+ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = import_client26.gql`
1564
+ mutation removeUserFavouriteResource(
1565
+ $resourceId: ID!
1566
+ $resourceType: ResourceTypeEnum!
1567
+ $userId: ID!
1568
+ ) {
1569
+ removeUserFavouriteResource(
1570
+ resourceId: $resourceId
1571
+ resourceType: $resourceType
1572
+ userId: $userId
1573
+ ) {
1574
+ ...UserFields
1575
+ }
1576
+ }
1577
+ ${USER_FIELDS_FRAGMENT}
1578
+ `;
1579
+
1580
+ // src/graphql/hooks/user/hooksMutation.ts
1581
+ var useCreateUser = () => {
1582
+ const [createUser, { loading, error }] = (0, import_client27.useMutation)(CREATE_USER_MUTATION, {
1583
+ awaitRefetchQueries: true
1584
+ });
1585
+ return { createUser, error, loading };
1586
+ };
1587
+ var useUpdateUser = () => {
1588
+ const [updateUser, { loading, error }] = (0, import_client27.useMutation)(UPDATE_USER_MUTATION, {
1589
+ awaitRefetchQueries: true
1590
+ });
1591
+ return { error, loading, updateUser };
1592
+ };
1593
+ var useAddUserFavouriteResource = () => {
1594
+ const [addUserFavouriteResource, { loading, error }] = (0, import_client27.useMutation)(
1595
+ ADD_USER_FAVOURITE_RESOURCE_MUTATION,
1596
+ {
1597
+ awaitRefetchQueries: true,
1598
+ refetchQueries: [{ query: GET_USER_FAVOURITES }]
1599
+ }
1600
+ );
1601
+ return { addUserFavouriteResource, error, loading };
1602
+ };
1603
+ var useRemoveUserFavouriteResource = () => {
1604
+ const [removeUserFavouriteResource, { loading, error }] = (0, import_client27.useMutation)(
1605
+ REMOVE_USER_FAVOURITE_RESOURCE_MUTATION,
1606
+ {
1607
+ awaitRefetchQueries: true,
1608
+ refetchQueries: [{ query: GET_USER_FAVOURITES }]
1609
+ }
1610
+ );
1611
+ return { error, loading, removeUserFavouriteResource };
1612
+ };
1613
+
1614
+ // src/graphql/hooks/user/hooksQuery.ts
1615
+ var import_client28 = require("@apollo/client");
1616
+ var useGetUsers = () => {
1617
+ const { loading, error, data, refetch } = (0, import_client28.useQuery)(GET_USERS, {
1618
+ fetchPolicy: "network-only"
1619
+ });
1620
+ const users = data?.users;
1621
+ return { error, loading, refetch, users };
1622
+ };
1623
+ var useGetUser = (id) => {
1624
+ const { loading, error, data, refetch } = (0, import_client28.useQuery)(GET_USER, {
1625
+ variables: { id }
1626
+ });
1627
+ const user = data?.user;
1628
+ return { error, loading, refetch, user };
1629
+ };
1630
+ var useGetUserMarkets = () => {
1631
+ const { loading, error, data, refetch } = (0, import_client28.useQuery)(GET_USER_MARKETS, {
1632
+ fetchPolicy: "network-only"
1633
+ });
1634
+ const userMarkets = data?.userMarkets;
1635
+ return { error, loading, refetch, userMarkets };
1636
+ };
1637
+ var useGetUserFavourites = () => {
1638
+ const { loading, error, data, refetch } = (0, import_client28.useQuery)(GET_USER_FAVOURITES, {
1639
+ fetchPolicy: "network-only"
1640
+ });
1641
+ const markets = data?.userFavourites.markets;
1642
+ const stallholders = data?.userFavourites.stallholders;
1643
+ const userFavourites = {
1644
+ markets,
1645
+ stallholders
1646
+ };
1647
+ return { error, loading, refetch, userFavourites };
1648
+ };
1649
+ var useGetUserNotifications = () => {
1650
+ const { loading, error, data, refetch } = (0, import_client28.useQuery)(GET_USER_NOTIFICATIONS, {
1651
+ fetchPolicy: "network-only"
1652
+ });
1653
+ const userNotifications = data?.userNotifications;
1654
+ return { error, loading, refetch, userNotifications };
1655
+ };
1656
+ // Annotate the CommonJS export names for ESM import in node:
1657
+ 0 && (module.exports = {
1658
+ useAddParticipantToChat,
1659
+ useAddUserFavouriteResource,
1660
+ useCreateChat,
1661
+ useCreateMarket,
1662
+ useCreateMarketInfo,
1663
+ useCreatePoster,
1664
+ useCreateRelation,
1665
+ useCreateStallholder,
1666
+ useCreateStallholderApplyForm,
1667
+ useCreateUser,
1668
+ useDeleteChat,
1669
+ useDeleteMarket,
1670
+ useDeleteRelation,
1671
+ useDeleteStallholder,
1672
+ useGetChat,
1673
+ useGetChatSubscription,
1674
+ useGetMarket,
1675
+ useGetMarketInfo,
1676
+ useGetMarketRelations,
1677
+ useGetMarkets,
1678
+ useGetMarketsByRegion,
1679
+ useGetMarketsNearMe,
1680
+ useGetNotification,
1681
+ useGetRelation,
1682
+ useGetRelationByMarketAndStallholder,
1683
+ useGetResourceConnections,
1684
+ useGetStallholder,
1685
+ useGetStallholderApplyForm,
1686
+ useGetStallholderRelations,
1687
+ useGetStallholders,
1688
+ useGetStallholdersByRegion,
1689
+ useGetUser,
1690
+ useGetUserChats,
1691
+ useGetUserFavourites,
1692
+ useGetUserMarkets,
1693
+ useGetUserNotifications,
1694
+ useGetUsers,
1695
+ useLogin,
1696
+ useRegister,
1697
+ useRemoveParticipantFromChat,
1698
+ useRemoveUserFavouriteResource,
1699
+ useRequestPasswordReset,
1700
+ useResetPassword,
1701
+ useSearchMarkets,
1702
+ useSearchStallholders,
1703
+ useSendChatMessage,
1704
+ useUpdateMarket,
1705
+ useUpdateMarketInfo,
1706
+ useUpdateRelation,
1707
+ useUpdateStallholder,
1708
+ useUpdateStallholderApplyForm,
1709
+ useUpdateUser,
1710
+ useValidateToken
1711
+ });
1712
+ //# sourceMappingURL=index.cjs.map