@timardex/cluemart-shared 1.0.15 → 1.0.16

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