@timardex/cluemart-shared 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2992 @@
1
+ // src/utils.ts
2
+ import dayjs, { extend } from "dayjs";
3
+ import customParseFormat from "dayjs/plugin/customParseFormat";
4
+ import timezone from "dayjs/plugin/timezone";
5
+ import utc from "dayjs/plugin/utc";
6
+
7
+ // src/enums.ts
8
+ var EnumInviteStatus = /* @__PURE__ */ ((EnumInviteStatus2) => {
9
+ EnumInviteStatus2["ACCEPTED"] = "ACCEPTED";
10
+ EnumInviteStatus2["COMPLETED"] = "COMPLETED";
11
+ EnumInviteStatus2["PENDING"] = "PENDING";
12
+ EnumInviteStatus2["REJECTED"] = "REJECTED";
13
+ EnumInviteStatus2["NO_STATUS"] = "NO_STATUS";
14
+ return EnumInviteStatus2;
15
+ })(EnumInviteStatus || {});
16
+ var EnumRejectionPolicy = /* @__PURE__ */ ((EnumRejectionPolicy2) => {
17
+ EnumRejectionPolicy2["SINGLE_DATE_ALLOWED"] = "single_date_allowed";
18
+ EnumRejectionPolicy2["MULTI_DATE_ALLOWED"] = "multi_date_allowed";
19
+ return EnumRejectionPolicy2;
20
+ })(EnumRejectionPolicy || {});
21
+ var EnumResourceType = /* @__PURE__ */ ((EnumResourceType2) => {
22
+ EnumResourceType2["MARKET"] = "market";
23
+ EnumResourceType2["STALLHOLDER"] = "stallholder";
24
+ return EnumResourceType2;
25
+ })(EnumResourceType || {});
26
+ var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource2) => {
27
+ EnumRelationResource2["CREATED_MARKET"] = "created_market";
28
+ EnumRelationResource2["CREATED_STALLHOLDER"] = "created_stallholder";
29
+ EnumRelationResource2["STALLHOLDER_APPLICATION_TO_MARKET"] = "stallholder_application_to_market";
30
+ EnumRelationResource2["MARKET_INVITE_STALLHOLDER"] = "market_invite_stallholder";
31
+ return EnumRelationResource2;
32
+ })(EnumRelationResource || {});
33
+ var EnumResourceTypeIcon = /* @__PURE__ */ ((EnumResourceTypeIcon2) => {
34
+ EnumResourceTypeIcon2["MARKET"] = "compass";
35
+ EnumResourceTypeIcon2["STALLHOLDER"] = "store";
36
+ return EnumResourceTypeIcon2;
37
+ })(EnumResourceTypeIcon || {});
38
+ var EnumRegions = /* @__PURE__ */ ((EnumRegions2) => {
39
+ EnumRegions2["Auckland"] = "Auckland";
40
+ EnumRegions2["BayOfPlenty"] = "Bay of Plenty";
41
+ EnumRegions2["Canterbury"] = "Canterbury";
42
+ EnumRegions2["Gisborne"] = "Gisborne";
43
+ EnumRegions2["HawkesBay"] = "Hawke's Bay";
44
+ EnumRegions2["ManawatuWanganui"] = "Manawatu-Wanganui";
45
+ EnumRegions2["Marlborough"] = "Marlborough";
46
+ EnumRegions2["Nelson"] = "Nelson";
47
+ EnumRegions2["Northland"] = "Northland";
48
+ EnumRegions2["Otago"] = "Otago";
49
+ EnumRegions2["Southland"] = "Southland";
50
+ EnumRegions2["Taranaki"] = "Taranaki";
51
+ EnumRegions2["Tasman"] = "Tasman";
52
+ EnumRegions2["Waikato"] = "Waikato";
53
+ EnumRegions2["Wellington"] = "Wellington";
54
+ EnumRegions2["WestCoast"] = "West Coast";
55
+ return EnumRegions2;
56
+ })(EnumRegions || {});
57
+ var ImageTypeEnum = /* @__PURE__ */ ((ImageTypeEnum2) => {
58
+ ImageTypeEnum2["AVATAR"] = "avatar";
59
+ ImageTypeEnum2["COVER"] = "cover";
60
+ ImageTypeEnum2["IMAGE"] = "image";
61
+ ImageTypeEnum2["LOGO"] = "logo";
62
+ return ImageTypeEnum2;
63
+ })(ImageTypeEnum || {});
64
+ var EnumUserLicence = /* @__PURE__ */ ((EnumUserLicence2) => {
65
+ EnumUserLicence2["ENTERPRISE_MARKET"] = "enterprise_market";
66
+ EnumUserLicence2["ENTERPRISE_STALLHOLDER"] = "enterprise_stallholder";
67
+ EnumUserLicence2["PRO_MARKET"] = "pro_market";
68
+ EnumUserLicence2["PRO_STALLHOLDER"] = "pro_stallholder";
69
+ EnumUserLicence2["STANDARD_MARKET"] = "standard_market";
70
+ EnumUserLicence2["STANDARD_STALLHOLDER"] = "standard_stallholder";
71
+ return EnumUserLicence2;
72
+ })(EnumUserLicence || {});
73
+ var EnumUserRole = /* @__PURE__ */ ((EnumUserRole2) => {
74
+ EnumUserRole2["ADMIN"] = "admin";
75
+ EnumUserRole2["CUSTOMER"] = "customer";
76
+ return EnumUserRole2;
77
+ })(EnumUserRole || {});
78
+
79
+ // src/utils.ts
80
+ var dateFormat = "DD-MM-YYYY";
81
+ var timeFormat = "HH:mm";
82
+ extend(customParseFormat);
83
+ extend(utc);
84
+ extend(timezone);
85
+ var formatDate = (dateStr, display = "datetime", timeStr) => {
86
+ const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
87
+ const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
88
+ const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
89
+ const formattedTime = dateTime.format("h:mm a");
90
+ switch (display) {
91
+ case "date":
92
+ return formattedDate;
93
+ case "time":
94
+ return formattedTime;
95
+ case "datetime":
96
+ return `${formattedDate} at ${formattedTime}`;
97
+ default:
98
+ return formattedDate;
99
+ }
100
+ };
101
+ var getCurrentAndFutureDates = (dates) => {
102
+ const today = dayjs().startOf("day");
103
+ return dates.filter((dateObj) => {
104
+ const dateTime = dayjs(dateObj.startDate, dateFormat);
105
+ return dateTime.isSameOrAfter(today);
106
+ });
107
+ };
108
+ var getFutureDatesAfterThreshold = (dates, minHoursFromNow) => {
109
+ const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
110
+ return dates.filter((dateObj) => {
111
+ const dateTime = dayjs(
112
+ `${dateObj.startDate} ${dateObj.startTime}`,
113
+ `${dateFormat} ${timeFormat}`
114
+ );
115
+ return dateTime.isSameOrAfter(threshold);
116
+ });
117
+ };
118
+ var formatTimestamp = (timestamp) => {
119
+ const formattedDate = dayjs(timestamp).tz("Pacific/Auckland").format(dateFormat);
120
+ const formattedTime = dayjs(timestamp).tz("Pacific/Auckland").format(timeFormat);
121
+ return formatDate(formattedDate, "date");
122
+ };
123
+ var GOOGLE_API_KEY = "AIzaSyC8UkMGkrF6lIInF9yHxaVQQvlN-zqCfMc";
124
+ var defaultRegion = {
125
+ latitude: -36.8624942,
126
+ // Default: New Zealand
127
+ latitudeDelta: 5,
128
+ longitude: 174.7450494,
129
+ longitudeDelta: 5
130
+ };
131
+ var removeTypename = (obj) => {
132
+ if (Array.isArray(obj)) {
133
+ return obj.map((item) => removeTypename(item));
134
+ } else if (obj !== null && typeof obj === "object") {
135
+ const { __typename, ...cleanedObj } = obj;
136
+ return Object.keys(cleanedObj).reduce(
137
+ (acc, key) => {
138
+ acc[key] = removeTypename(cleanedObj[key]);
139
+ return acc;
140
+ },
141
+ {}
142
+ );
143
+ }
144
+ return obj;
145
+ };
146
+ var truncateText = (text, maxLength = 30) => {
147
+ return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
148
+ };
149
+ var mapArrayToOptions = (items) => items.map((item) => ({
150
+ label: item.replace(/_/g, " "),
151
+ value: item.replace(/\s+/g, "_").toLowerCase()
152
+ }));
153
+ var capitalizeFirstLetter = (str) => {
154
+ return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
155
+ };
156
+ var statusOptions = [
157
+ ...Object.values(EnumInviteStatus).map((status) => ({
158
+ label: status,
159
+ value: status
160
+ })).sort((a, b) => a.label.localeCompare(b.label))
161
+ // Sort the options alphabetically
162
+ ];
163
+ function sortDatesByProximity(dates) {
164
+ if (!dates || !dates.length) {
165
+ return [];
166
+ }
167
+ const reference = dayjs();
168
+ return [...dates].sort((a, b) => {
169
+ const dateA = dayjs(a.startDate, dateFormat);
170
+ const dateB = dayjs(b.startDate, dateFormat);
171
+ const diffA = Math.abs(dateA.diff(reference));
172
+ const diffB = Math.abs(dateB.diff(reference));
173
+ return diffA - diffB;
174
+ });
175
+ }
176
+
177
+ // src/hooks/useLocationSearch.ts
178
+ var handleApiError = (error, message) => {
179
+ console.error(message, error);
180
+ };
181
+ var useLocationSearch = () => {
182
+ const getPredictions = async (text) => {
183
+ try {
184
+ const response = await fetch(
185
+ `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${text}&components=country:nz&key=${GOOGLE_API_KEY}`
186
+ );
187
+ if (!response.ok) {
188
+ throw new Error(`HTTP error! Status: ${response.status}`);
189
+ }
190
+ const data = await response.json();
191
+ return data.predictions;
192
+ } catch (error) {
193
+ console.error("Error fetching predictions:", error);
194
+ handleApiError(error, "Failed to fetch address predictions.");
195
+ }
196
+ };
197
+ const getPlaceDetails = async (placeId) => {
198
+ try {
199
+ const response = await fetch(
200
+ `https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&key=${GOOGLE_API_KEY}`
201
+ );
202
+ if (!response.ok) {
203
+ throw new Error(`HTTP error! Status: ${response.status}`);
204
+ }
205
+ const data = await response.json();
206
+ const { result } = data;
207
+ const { lat, lng } = result.geometry.location;
208
+ const { address_components, formatted_address } = result;
209
+ const address = address_components.reduce((acc, item) => {
210
+ if (item.types.includes("street_number")) {
211
+ return { ...acc, streetNumber: item.long_name };
212
+ }
213
+ if (item.types.includes("route")) {
214
+ return { ...acc, streetName: item.long_name };
215
+ }
216
+ if (item.types.includes("locality")) {
217
+ return { ...acc, city: item.long_name };
218
+ }
219
+ if (item.types.includes("administrative_area_level_1")) {
220
+ return { ...acc, region: item.long_name };
221
+ }
222
+ if (item.types.includes("country")) {
223
+ return { ...acc, country: item.long_name };
224
+ }
225
+ return acc;
226
+ }, {});
227
+ const newLocation = {
228
+ city: address.city.toLowerCase(),
229
+ coordinates: [lng, lat],
230
+ // [longitude, latitude]
231
+ country: address.country,
232
+ fullAddress: formatted_address,
233
+ latitude: lat,
234
+ longitude: lng,
235
+ region: address.region.replace(/ Region$/, ""),
236
+ // Remove " Region" suffix
237
+ type: "Point"
238
+ // Mongoose GeoJSON type
239
+ };
240
+ return newLocation;
241
+ } catch (error) {
242
+ handleApiError(error, "Failed to fetch place details.");
243
+ }
244
+ };
245
+ return {
246
+ getPlaceDetails,
247
+ getPredictions
248
+ };
249
+ };
250
+
251
+ // src/hooks/stallholder/useStallholderForm.ts
252
+ import { yupResolver } from "@hookform/resolvers/yup";
253
+ import * as React from "react";
254
+ import { useForm } from "react-hook-form";
255
+
256
+ // src/yupSchema/global.ts
257
+ import dayjs2, { extend as extend2 } from "dayjs";
258
+ import customParseFormat2 from "dayjs/plugin/customParseFormat";
259
+ import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
260
+ import * as yup from "yup";
261
+ extend2(isSameOrAfter);
262
+ extend2(customParseFormat2);
263
+ var now = dayjs2();
264
+ var endDateNotInPastTest = yup.string().test("not-in-past", "End date cannot be in the past", (value) => {
265
+ return value ? dayjs2(value, dateFormat, true).isSameOrAfter(now, "day") : false;
266
+ });
267
+ var startDateNotInPastTest = yup.string().test("not-in-past", "Start date cannot be in the past", (value) => {
268
+ return value ? dayjs2(value, dateFormat, true).isSameOrAfter(now, "day") : false;
269
+ });
270
+ var endDateAfterStartDateTest = yup.string().test(
271
+ "end-after-start",
272
+ "End date cannot be before start date",
273
+ function(value) {
274
+ const { startDate } = this.parent;
275
+ if (!startDate || !value) return false;
276
+ return dayjs2(value, dateFormat, true).isSameOrAfter(
277
+ dayjs2(startDate, dateFormat, true),
278
+ "day"
279
+ );
280
+ }
281
+ );
282
+ var endTimeMustBeAfterStartTimeTest = yup.string().test(
283
+ "valid-end-time",
284
+ "End time must be after start time",
285
+ function(value) {
286
+ const { startDate, endDate, startTime } = this.parent;
287
+ if (!startDate || !endDate || !startTime || !value) return false;
288
+ const startDateTime = dayjs2(
289
+ `${startDate} ${startTime}`,
290
+ `${dateFormat} ${timeFormat}`,
291
+ true
292
+ );
293
+ const endDateTime = dayjs2(
294
+ `${endDate} ${value}`,
295
+ `${dateFormat} ${timeFormat}`,
296
+ true
297
+ );
298
+ return endDateTime.isAfter(startDateTime);
299
+ }
300
+ );
301
+ var startTimeCannotBeInPastTest = yup.string().test(
302
+ "valid-start-time",
303
+ "Start time cannot be in the past",
304
+ function(value) {
305
+ const { startDate } = this.parent;
306
+ if (!startDate || !value) return false;
307
+ const startDateTime = dayjs2(
308
+ `${startDate} ${value}`,
309
+ `${dateFormat} ${timeFormat}`,
310
+ true
311
+ );
312
+ return startDateTime.isSameOrAfter(now);
313
+ }
314
+ );
315
+ var dateTimeSchema = yup.object().shape({
316
+ endDate: yup.string().concat(endDateNotInPastTest).concat(endDateAfterStartDateTest).required("End date is required"),
317
+ endTime: yup.string().concat(endTimeMustBeAfterStartTimeTest).required("End time is required"),
318
+ startDate: yup.string().concat(startDateNotInPastTest).required("Start date is required"),
319
+ startTime: yup.string().concat(startTimeCannotBeInPastTest).required("Start time is required")
320
+ });
321
+ var locationSchema = yup.object().shape({
322
+ city: yup.string().required("City is required"),
323
+ coordinates: yup.array().of(yup.number().required("Coordinates must be numbers")).length(
324
+ 2,
325
+ "Coordinates must contain exactly two numbers (longitude, latitude)"
326
+ ).required("Coordinates are required"),
327
+ country: yup.string().required("Country is required"),
328
+ fullAddress: yup.string().required("Address is required"),
329
+ latitude: yup.number().required("Latitude is required"),
330
+ longitude: yup.number().required("Longitude is required"),
331
+ region: yup.string().required("Region is required"),
332
+ type: yup.string().oneOf(["Point"], "Type must be 'Point'").default("Point").required("Type is required")
333
+ });
334
+ var emailSchema = yup.string().email("Invalid email address").required("Email is required").transform(
335
+ (value) => typeof value === "string" ? value.toLowerCase() : value
336
+ );
337
+ var passwordSchema = yup.string().trim().min(8, "Password must be at least 8 characters long").required("Password is required");
338
+ var globalResourceSchema = yup.object().shape({
339
+ active: yup.boolean().required("Active is required"),
340
+ cover: yup.object({
341
+ source: yup.string().required("Cover is required"),
342
+ title: yup.string().required("Cover is required")
343
+ }),
344
+ description: yup.string().trim().min(3).required("Description is required"),
345
+ name: yup.string().trim().min(3).required("Name is required"),
346
+ region: yup.string().required("Region is required")
347
+ });
348
+
349
+ // src/yupSchema/market.ts
350
+ import * as yup2 from "yup";
351
+ var marketSchema = globalResourceSchema.shape({
352
+ dateTime: yup2.array().of(dateTimeSchema).required("DateTime is required"),
353
+ location: locationSchema,
354
+ provider: yup2.string().trim().min(3).required("Provider is required"),
355
+ stallApplicationInfo: yup2.object().shape({
356
+ applicationDeadlineHours: yup2.number().min(1).required("Application deadline hours is required"),
357
+ rejectionPolicy: yup2.mixed().oneOf(Object.values(EnumRejectionPolicy)).required("Rejection policy is required"),
358
+ stallCapacity: yup2.number().min(1).required("Stall capacity is required")
359
+ }),
360
+ tags: yup2.array().of(yup2.string().defined()).nullable()
361
+ });
362
+
363
+ // src/yupSchema/stallholder.ts
364
+ import * as yup3 from "yup";
365
+ var stallHolderSchema = globalResourceSchema.shape({
366
+ categories: yup3.array().of(
367
+ yup3.object().shape({
368
+ id: yup3.string().required("Category id is required"),
369
+ name: yup3.string().required("Category name is required"),
370
+ subcategories: yup3.array().of(
371
+ yup3.object().shape({
372
+ id: yup3.string().defined(),
373
+ items: yup3.array().of(yup3.string().defined()).nullable(),
374
+ name: yup3.string().defined()
375
+ })
376
+ ).nullable()
377
+ })
378
+ ).min(1, "Category list must contain at least one item").required("Categories are required"),
379
+ multiLocation: yup3.boolean().required("Multi location is required"),
380
+ products: yup3.array().of(yup3.string().defined()).min(1, "Product list must contain at least one item").required("Products are required")
381
+ });
382
+ var stallholderApplyFormSchema = yup3.object().shape({
383
+ active: yup3.boolean().required("Active is required"),
384
+ electricity: yup3.object().shape({
385
+ details: yup3.string().trim().test("details-required", "Please add details", function(value) {
386
+ return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
387
+ }).nullable(),
388
+ isRequired: yup3.boolean().required("Electricity requirement is required")
389
+ }),
390
+ foodSafetyGradeFiles: yup3.array().of(yup3.string().defined()).nullable(),
391
+ foodSafetyGradeFilesUpload: yup3.array().of(yup3.string().defined()).nullable(),
392
+ gazebo: yup3.object().shape({
393
+ details: yup3.string().trim().test("details-required", "Please add details", function(value) {
394
+ return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
395
+ }).nullable(),
396
+ isRequired: yup3.boolean().required("Gazebo requirement is required")
397
+ }),
398
+ packaging: yup3.array().of(yup3.string().defined()).min(1, "Packaging list must contain at least one item").required("Packaging is required"),
399
+ paymentMethod: yup3.string().required("Please select a Payment method"),
400
+ priceRange: yup3.object().shape({
401
+ max: yup3.number().min(1).required("Max price is required").test(
402
+ "is-greater",
403
+ "Max price must be greater than or equal to Min price",
404
+ function(max) {
405
+ const { min } = this.parent;
406
+ return max >= min;
407
+ }
408
+ ),
409
+ min: yup3.number().min(1).required("Min price is required")
410
+ }),
411
+ producedIn: yup3.array().of(yup3.string().defined()).min(1, "Produced in list must contain at least one item").required("Produced in is required"),
412
+ stallSize: yup3.object().shape({
413
+ depth: yup3.number().min(1).required("Depth is required"),
414
+ width: yup3.number().min(1).required("Width is required")
415
+ }),
416
+ table: yup3.object().shape({
417
+ details: yup3.string().trim().test("details-required", "Please add details", function(value) {
418
+ return !this.parent?.isRequired || (value?.trim().length ?? 0) > 0;
419
+ }).nullable(),
420
+ isRequired: yup3.boolean().required("Table requirement is required")
421
+ })
422
+ });
423
+
424
+ // src/yupSchema/user.ts
425
+ import * as yup4 from "yup";
426
+ var userSchema = yup4.object().shape({
427
+ active: yup4.boolean().required("Active is required"),
428
+ email: emailSchema,
429
+ firstName: yup4.string().required("First name is required"),
430
+ lastName: yup4.string().required("Last name is required"),
431
+ password: passwordSchema,
432
+ // eslint-disable-next-line sort-keys
433
+ confirmPassword: yup4.string().oneOf([yup4.ref("password")], "Passwords must match").required("Confirm Password is required"),
434
+ role: yup4.mixed().oneOf(Object.values(EnumUserRole)).required("Role is required")
435
+ });
436
+
437
+ // src/yupSchema/auth.ts
438
+ import * as yup5 from "yup";
439
+ var loginSchema = yup5.object().shape({
440
+ email: emailSchema,
441
+ password: passwordSchema
442
+ });
443
+ var registerSchema = yup5.object().shape({
444
+ email: emailSchema,
445
+ firstName: yup5.string().required("First Name is required"),
446
+ lastName: yup5.string().required("Last Name is required"),
447
+ password: passwordSchema,
448
+ role: yup5.mixed().oneOf(Object.values(EnumUserRole)).required("Role is required")
449
+ });
450
+ var forgotPasswordSchema = yup5.object().shape({
451
+ email: emailSchema
452
+ });
453
+ var resetPasswordSchema = yup5.object().shape({
454
+ password: passwordSchema,
455
+ // eslint-disable-next-line sort-keys
456
+ confirmPassword: yup5.string().oneOf([yup5.ref("password")], "Passwords must match").required("Confirm Password is required")
457
+ });
458
+ var validateEmailSchema = yup5.object().shape({
459
+ token: yup5.string().required("Token is required")
460
+ });
461
+
462
+ // src/hooks/utils.ts
463
+ var globalDefaultValues = {
464
+ active: false,
465
+ cover: {
466
+ source: "",
467
+ title: ""
468
+ },
469
+ coverUpload: {
470
+ source: "",
471
+ title: ""
472
+ },
473
+ description: "Lorem Ipsum is a placeholder text commonly used in design and publishing to represent the visual form of a document without relying on meaningful content. It's a jumbled Latin text, not intended to be read or understood, and is used to show the layout and typography before actual content is added.",
474
+ images: null,
475
+ imagesUpload: null,
476
+ logo: null,
477
+ logoUpload: null,
478
+ name: "Resource name",
479
+ promoCode: "",
480
+ region: ""
481
+ };
482
+ var defaultMarketFormValues = {
483
+ ...globalDefaultValues,
484
+ dateTime: [
485
+ {
486
+ endDate: "04-05-2025",
487
+ endTime: "15:00",
488
+ startDate: "04-05-2025",
489
+ startTime: "09:00"
490
+ },
491
+ {
492
+ endDate: "05-05-2025",
493
+ endTime: "15:00",
494
+ startDate: "05-05-2025",
495
+ startTime: "09:00"
496
+ }
497
+ ],
498
+ location: {
499
+ city: "",
500
+ coordinates: [0, 0],
501
+ // [longitude, latitude]
502
+ country: "",
503
+ fullAddress: "",
504
+ latitude: 0,
505
+ longitude: 0,
506
+ region: "",
507
+ type: "Point"
508
+ // Default type for GeoJSON
509
+ },
510
+ provider: "Provider name",
511
+ stallApplicationInfo: {
512
+ applicationDeadlineHours: 72,
513
+ rejectionPolicy: "multi_date_allowed" /* MULTI_DATE_ALLOWED */,
514
+ stallCapacity: 4
515
+ },
516
+ tags: null
517
+ };
518
+ var defaultStallholderFormValues = {
519
+ ...globalDefaultValues,
520
+ categories: [],
521
+ locations: null,
522
+ multiLocation: false,
523
+ products: ["Prod uct 1", "Product 2"],
524
+ specialities: null
525
+ };
526
+ var defaultStallholderApplyFormValues = {
527
+ active: false,
528
+ electricity: { details: null, isRequired: false },
529
+ foodSafetyGradeFiles: null,
530
+ foodSafetyGradeFilesUpload: null,
531
+ gazebo: { details: null, isRequired: false },
532
+ packaging: [],
533
+ paymentMethod: "",
534
+ priceRange: { max: 0, min: 0 },
535
+ producedIn: [],
536
+ stallSize: { depth: 0, width: 0 },
537
+ table: { details: null, isRequired: false }
538
+ };
539
+
540
+ // src/hooks/stallholder/useStallholderForm.ts
541
+ function useStallholderForm(data) {
542
+ const {
543
+ control,
544
+ formState: { errors },
545
+ getValues,
546
+ handleSubmit,
547
+ reset,
548
+ setValue,
549
+ watch
550
+ } = useForm({
551
+ defaultValues: defaultStallholderFormValues,
552
+ resolver: yupResolver(stallHolderSchema)
553
+ });
554
+ React.useEffect(() => {
555
+ if (data) {
556
+ reset({
557
+ _id: data._id,
558
+ active: data.active,
559
+ categories: data.categories,
560
+ cover: data.cover,
561
+ coverUpload: data.coverUpload,
562
+ description: data.description,
563
+ images: data.images,
564
+ imagesUpload: data.imagesUpload,
565
+ locations: data.locations,
566
+ logo: data.logo,
567
+ logoUpload: data.logoUpload,
568
+ multiLocation: data.multiLocation,
569
+ name: data.name,
570
+ products: data.products,
571
+ promoCode: data.promoCode,
572
+ region: data.region,
573
+ specialities: data.specialities
574
+ });
575
+ } else {
576
+ reset(defaultStallholderFormValues);
577
+ }
578
+ }, [data]);
579
+ const {
580
+ _id,
581
+ active,
582
+ categories,
583
+ cover,
584
+ coverUpload,
585
+ description,
586
+ images,
587
+ imagesUpload,
588
+ locations,
589
+ logo,
590
+ logoUpload,
591
+ multiLocation,
592
+ name,
593
+ products,
594
+ promoCode,
595
+ region,
596
+ specialities
597
+ } = getValues();
598
+ return {
599
+ control,
600
+ fields: {
601
+ _id,
602
+ active,
603
+ categories,
604
+ cover,
605
+ coverUpload,
606
+ description,
607
+ images,
608
+ imagesUpload,
609
+ locations,
610
+ logo,
611
+ logoUpload,
612
+ multiLocation,
613
+ name,
614
+ products,
615
+ promoCode,
616
+ region,
617
+ specialities
618
+ },
619
+ formState: { errors },
620
+ handleSubmit,
621
+ reset,
622
+ setValue,
623
+ watch
624
+ };
625
+ }
626
+
627
+ // src/hooks/stallholder/useStallholderApplyForm.ts
628
+ import { yupResolver as yupResolver2 } from "@hookform/resolvers/yup";
629
+ import * as React2 from "react";
630
+ import { useForm as useForm2 } from "react-hook-form";
631
+ function useStallholderApplyForm(data) {
632
+ const {
633
+ control,
634
+ formState: { errors },
635
+ getValues,
636
+ handleSubmit,
637
+ reset,
638
+ setValue,
639
+ watch
640
+ } = useForm2({
641
+ defaultValues: defaultStallholderApplyFormValues,
642
+ resolver: yupResolver2(stallholderApplyFormSchema)
643
+ });
644
+ React2.useEffect(() => {
645
+ if (data) {
646
+ reset({
647
+ _id: data._id,
648
+ active: data.active,
649
+ electricity: data.electricity,
650
+ foodSafetyGradeFiles: data.foodSafetyGradeFiles,
651
+ foodSafetyGradeFilesUpload: data.foodSafetyGradeFilesUpload,
652
+ gazebo: data.gazebo,
653
+ packaging: data.packaging,
654
+ paymentMethod: data.paymentMethod,
655
+ priceRange: data.priceRange,
656
+ producedIn: data.producedIn,
657
+ stallSize: data.stallSize,
658
+ table: data.table
659
+ });
660
+ } else {
661
+ reset(defaultStallholderApplyFormValues);
662
+ }
663
+ }, [data]);
664
+ const {
665
+ _id,
666
+ active,
667
+ electricity,
668
+ foodSafetyGradeFiles,
669
+ foodSafetyGradeFilesUpload,
670
+ gazebo,
671
+ packaging,
672
+ paymentMethod,
673
+ priceRange,
674
+ producedIn,
675
+ stallSize,
676
+ table
677
+ } = getValues();
678
+ return {
679
+ control,
680
+ fields: {
681
+ _id,
682
+ active,
683
+ electricity,
684
+ foodSafetyGradeFiles,
685
+ foodSafetyGradeFilesUpload,
686
+ gazebo,
687
+ packaging,
688
+ paymentMethod,
689
+ priceRange,
690
+ producedIn,
691
+ stallSize,
692
+ table
693
+ },
694
+ formState: { errors },
695
+ handleSubmit,
696
+ reset,
697
+ setValue,
698
+ watch
699
+ };
700
+ }
701
+
702
+ // src/hooks/useMarketForm.ts
703
+ import { yupResolver as yupResolver3 } from "@hookform/resolvers/yup";
704
+ import * as React3 from "react";
705
+ import { useForm as useForm3 } from "react-hook-form";
706
+ function useMarketForm(data) {
707
+ const {
708
+ control,
709
+ formState: { errors },
710
+ getValues,
711
+ handleSubmit,
712
+ reset,
713
+ setValue,
714
+ watch
715
+ } = useForm3({
716
+ defaultValues: defaultMarketFormValues,
717
+ resolver: yupResolver3(marketSchema)
718
+ });
719
+ React3.useEffect(() => {
720
+ if (data) {
721
+ reset({
722
+ _id: data._id,
723
+ active: data.active,
724
+ cover: data.cover,
725
+ coverUpload: data.coverUpload,
726
+ dateTime: data.dateTime,
727
+ description: data.description,
728
+ images: data.images,
729
+ imagesUpload: data.imagesUpload,
730
+ location: data.location,
731
+ logo: data.logo,
732
+ logoUpload: data.logoUpload,
733
+ name: data.name,
734
+ promoCode: data.promoCode,
735
+ provider: data.provider,
736
+ region: data.region,
737
+ stallApplicationInfo: data.stallApplicationInfo,
738
+ tags: data.tags
739
+ });
740
+ } else {
741
+ reset(defaultMarketFormValues);
742
+ }
743
+ }, [data]);
744
+ const {
745
+ _id,
746
+ active,
747
+ cover,
748
+ coverUpload,
749
+ dateTime,
750
+ description,
751
+ images,
752
+ imagesUpload,
753
+ location,
754
+ logo,
755
+ logoUpload,
756
+ name,
757
+ provider,
758
+ region,
759
+ stallApplicationInfo: stallApplicationInfo2,
760
+ tags
761
+ } = getValues();
762
+ return {
763
+ control,
764
+ fields: {
765
+ _id,
766
+ active,
767
+ cover,
768
+ coverUpload,
769
+ dateTime,
770
+ description,
771
+ images,
772
+ imagesUpload,
773
+ location,
774
+ logo,
775
+ logoUpload,
776
+ name,
777
+ provider,
778
+ region,
779
+ stallApplicationInfo: stallApplicationInfo2,
780
+ tags
781
+ },
782
+ formState: { errors },
783
+ handleSubmit,
784
+ reset,
785
+ setValue,
786
+ watch
787
+ };
788
+ }
789
+
790
+ // src/hooks/useUserForm.ts
791
+ import { yupResolver as yupResolver4 } from "@hookform/resolvers/yup";
792
+ import * as React4 from "react";
793
+ import { useForm as useForm4 } from "react-hook-form";
794
+ var defaultValues = {
795
+ active: false,
796
+ avatar: null,
797
+ avatarUpload: null,
798
+ confirmPassword: "",
799
+ email: "",
800
+ firstName: "",
801
+ lastName: "",
802
+ password: "",
803
+ role: "customer" /* CUSTOMER */
804
+ };
805
+ function useUserForm(data) {
806
+ const {
807
+ control,
808
+ formState: { errors },
809
+ getValues,
810
+ handleSubmit,
811
+ reset,
812
+ setValue,
813
+ watch
814
+ } = useForm4({
815
+ defaultValues,
816
+ resolver: yupResolver4(userSchema)
817
+ });
818
+ React4.useEffect(() => {
819
+ if (data) {
820
+ reset({
821
+ _id: data._id,
822
+ active: data.active,
823
+ avatar: data.avatar,
824
+ avatarUpload: data.avatarUpload,
825
+ confirmPassword: data.confirmPassword,
826
+ email: data.email,
827
+ firstName: data.firstName,
828
+ lastName: data.lastName,
829
+ password: data.password,
830
+ role: data.role
831
+ });
832
+ } else {
833
+ reset(defaultValues);
834
+ }
835
+ }, [data]);
836
+ const {
837
+ _id,
838
+ active,
839
+ avatar,
840
+ avatarUpload,
841
+ confirmPassword,
842
+ email,
843
+ firstName,
844
+ lastName,
845
+ password,
846
+ role
847
+ } = getValues();
848
+ return {
849
+ control,
850
+ fields: {
851
+ _id,
852
+ active,
853
+ avatar,
854
+ avatarUpload,
855
+ confirmPassword,
856
+ email,
857
+ firstName,
858
+ lastName,
859
+ password,
860
+ role
861
+ },
862
+ formState: { errors },
863
+ handleSubmit,
864
+ reset,
865
+ setValue,
866
+ watch
867
+ };
868
+ }
869
+
870
+ // src/hooks/auth/useLoginForm.ts
871
+ import { yupResolver as yupResolver5 } from "@hookform/resolvers/yup";
872
+ import { useForm as useForm5 } from "react-hook-form";
873
+ var defaultValues2 = {
874
+ email: "",
875
+ password: ""
876
+ };
877
+ function useLoginForm() {
878
+ const {
879
+ control,
880
+ formState: { errors },
881
+ getValues,
882
+ handleSubmit,
883
+ reset,
884
+ setValue,
885
+ watch
886
+ } = useForm5({
887
+ defaultValues: defaultValues2,
888
+ resolver: yupResolver5(loginSchema)
889
+ });
890
+ const { email, password } = getValues();
891
+ return {
892
+ control,
893
+ fields: {
894
+ email,
895
+ password
896
+ },
897
+ formState: { errors },
898
+ handleSubmit,
899
+ reset,
900
+ setValue,
901
+ watch
902
+ };
903
+ }
904
+
905
+ // src/hooks/auth/useRegisterForm.ts
906
+ import { yupResolver as yupResolver6 } from "@hookform/resolvers/yup";
907
+ import { useForm as useForm6 } from "react-hook-form";
908
+ var defaultValues3 = {
909
+ email: "timardex@gmail.com",
910
+ firstName: "Csaba",
911
+ lastName: "Timar",
912
+ password: "qwertyui",
913
+ role: "admin" /* ADMIN */
914
+ };
915
+ function useRegisterForm() {
916
+ const {
917
+ control,
918
+ formState: { errors },
919
+ getValues,
920
+ handleSubmit,
921
+ reset,
922
+ setValue,
923
+ watch
924
+ } = useForm6({
925
+ defaultValues: defaultValues3,
926
+ resolver: yupResolver6(registerSchema)
927
+ });
928
+ const { email, firstName, lastName, password, role } = getValues();
929
+ return {
930
+ control,
931
+ fields: {
932
+ email,
933
+ firstName,
934
+ lastName,
935
+ password,
936
+ role
937
+ },
938
+ formState: { errors },
939
+ handleSubmit,
940
+ reset,
941
+ setValue,
942
+ watch
943
+ };
944
+ }
945
+
946
+ // src/graphql/hooks/auth.ts
947
+ import { useMutation } from "@apollo/client";
948
+
949
+ // src/graphql/mutations/auth.ts
950
+ import { gql as gql2 } from "@apollo/client";
951
+
952
+ // src/graphql/queries/global.ts
953
+ import { gql } from "@apollo/client";
954
+ var RESOURCE_IMAGE_FIELDS_FRAGMENT = gql`
955
+ fragment ResourceImageFields on ResourceImageType {
956
+ source
957
+ title
958
+ }
959
+ `;
960
+ var OWNER_FIELDS_FRAGMENT = gql`
961
+ fragment OwnerFields on OwnerType {
962
+ _id
963
+ email
964
+ licences
965
+ }
966
+ `;
967
+ var CATEGORY_FIELDS_FRAGMENT = gql`
968
+ fragment CategoryFields on CategoryType {
969
+ id
970
+ name
971
+ subcategories {
972
+ id
973
+ items
974
+ name
975
+ }
976
+ }
977
+ `;
978
+ var USER_FIELDS_FRAGMENT = gql`
979
+ fragment UserFields on UserType {
980
+ _id
981
+ active
982
+ avatar {
983
+ ...ResourceImageFields
984
+ }
985
+ createdAt
986
+ email
987
+ favourites {
988
+ markets
989
+ stallholders
990
+ }
991
+ firstName
992
+ lastName
993
+ licences
994
+ markets
995
+ role
996
+ stallholder
997
+ updatedAt
998
+ }
999
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1000
+ `;
1001
+
1002
+ // src/graphql/mutations/auth.ts
1003
+ var LOGIN_MUTATION = gql2`
1004
+ mutation login($input: LoginInputType!) {
1005
+ login(input: $input) {
1006
+ message
1007
+ token
1008
+ user {
1009
+ ...UserFields
1010
+ }
1011
+ }
1012
+ }
1013
+ ${USER_FIELDS_FRAGMENT}
1014
+ `;
1015
+ var REGISTER_MUTATION = gql2`
1016
+ mutation register($input: RegisterInputType!) {
1017
+ register(input: $input) {
1018
+ message
1019
+ token
1020
+ user {
1021
+ ...UserFields
1022
+ }
1023
+ }
1024
+ }
1025
+ ${USER_FIELDS_FRAGMENT}
1026
+ `;
1027
+ var RESET_PASSWORD_MUTATION = gql2`
1028
+ mutation resetPassword($input: ResetPasswordInputType!) {
1029
+ resetPassword(input: $input) {
1030
+ message
1031
+ }
1032
+ }
1033
+ `;
1034
+ var FORGOT_PASSWORD_MUTATION = gql2`
1035
+ mutation forgotPassword($input: ForgotPasswordInputType!) {
1036
+ forgotPassword(input: $input) {
1037
+ message
1038
+ }
1039
+ }
1040
+ `;
1041
+ var VERYFY_EMAIL_MUTATION = gql2`
1042
+ mutation verifyEmail($input: VerifyEmailInputType!) {
1043
+ verifyEmail(input: $input) {
1044
+ message
1045
+ }
1046
+ }
1047
+ `;
1048
+
1049
+ // src/graphql/hooks/auth.ts
1050
+ var useLogin = () => {
1051
+ const [login, { loading, error }] = useMutation(LOGIN_MUTATION);
1052
+ return { error, loading, login };
1053
+ };
1054
+ var useRegister = () => {
1055
+ const [register, { loading, error }] = useMutation(REGISTER_MUTATION);
1056
+ return { error, loading, register };
1057
+ };
1058
+ var useForgotPassword = () => {
1059
+ const [forgotPassword, { loading, error }] = useMutation(
1060
+ FORGOT_PASSWORD_MUTATION
1061
+ );
1062
+ return { error, forgotPassword, loading };
1063
+ };
1064
+ var useVerifyEmail = () => {
1065
+ const [verifyEmail, { loading, error }] = useMutation(VERYFY_EMAIL_MUTATION);
1066
+ return { error, loading, verifyEmail };
1067
+ };
1068
+
1069
+ // src/graphql/hooks/market/hooksMutation.ts
1070
+ import { useMutation as useMutation2 } from "@apollo/client";
1071
+
1072
+ // src/graphql/mutations/market.ts
1073
+ import { gql as gql4 } from "@apollo/client";
1074
+
1075
+ // src/graphql/queries/market.ts
1076
+ import { gql as gql3 } from "@apollo/client";
1077
+ var MARKET_DATETIME_FIELDS_FRAGMENT = gql3`
1078
+ fragment MarketDateTimeFields on MarketDateTimeType {
1079
+ endDate
1080
+ endTime
1081
+ startDate
1082
+ startTime
1083
+ }
1084
+ `;
1085
+ var MARKET_LOCATION_FIELDS_FRAGMENT = gql3`
1086
+ fragment MarketLocationFields on MarketLocationType {
1087
+ city
1088
+ coordinates
1089
+ country
1090
+ fullAddress
1091
+ latitude
1092
+ longitude
1093
+ region
1094
+ type
1095
+ }
1096
+ `;
1097
+ var MARKET = gql3`
1098
+ fragment MarketFields on MarketType {
1099
+ _id
1100
+ active
1101
+ cover {
1102
+ ...ResourceImageFields
1103
+ }
1104
+ createdAt
1105
+ dateTime {
1106
+ ...MarketDateTimeFields
1107
+ }
1108
+ description
1109
+ images {
1110
+ ...ResourceImageFields
1111
+ }
1112
+ location {
1113
+ ...MarketLocationFields
1114
+ }
1115
+ logo {
1116
+ ...ResourceImageFields
1117
+ }
1118
+ name
1119
+ owner {
1120
+ ...OwnerFields
1121
+ }
1122
+ promoCode
1123
+ provider
1124
+ region
1125
+ relationIds
1126
+ stallApplicationInfo {
1127
+ applicationDeadlineHours
1128
+ rejectionPolicy
1129
+ stallCapacity
1130
+ }
1131
+ tags
1132
+ updatedAt
1133
+ }
1134
+ ${MARKET_DATETIME_FIELDS_FRAGMENT}
1135
+ ${MARKET_LOCATION_FIELDS_FRAGMENT}
1136
+ ${OWNER_FIELDS_FRAGMENT}
1137
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1138
+ `;
1139
+ var GET_MARKETS = gql3`
1140
+ query getMarkets {
1141
+ markets {
1142
+ ...MarketFields
1143
+ }
1144
+ }
1145
+ ${MARKET}
1146
+ `;
1147
+ var GET_MARKET = gql3`
1148
+ query getMarket($_id: ID!) {
1149
+ market(_id: $_id) {
1150
+ ...MarketFields
1151
+ }
1152
+ }
1153
+ ${MARKET}
1154
+ `;
1155
+ var GET_MARKETS_BY_REGION = gql3`
1156
+ query getMarketsByRegion($region: String!) {
1157
+ marketsByRegion(region: $region) {
1158
+ ...MarketFields
1159
+ }
1160
+ }
1161
+ ${MARKET}
1162
+ `;
1163
+ var SEARCH_MARKETS = gql3`
1164
+ query searchMarkets($search: String!, $region: String) {
1165
+ marketSearch(search: $search, region: $region) {
1166
+ ...MarketFields
1167
+ }
1168
+ }
1169
+ ${MARKET}
1170
+ `;
1171
+ var GET_MARKETS_NEAR_ME = gql3`
1172
+ query getMarketsNearMe($latitude: Float!, $longitude: Float!, $radius: Int) {
1173
+ marketsNearMe(latitude: $latitude, longitude: $longitude, radius: $radius) {
1174
+ ...MarketFields
1175
+ }
1176
+ }
1177
+ ${MARKET}
1178
+ `;
1179
+
1180
+ // src/graphql/mutations/market.ts
1181
+ var CREATE_MARKET_MUTATION = gql4`
1182
+ mutation createMarket($input: MarketInputType!) {
1183
+ createMarket(input: $input) {
1184
+ ...MarketFields
1185
+ }
1186
+ }
1187
+ ${MARKET}
1188
+ `;
1189
+ var UPDATE_MARKET_MUTATION = gql4`
1190
+ mutation updateMarket($_id: ID!, $input: MarketInputType!) {
1191
+ updateMarket(_id: $_id, input: $input) {
1192
+ ...MarketFields
1193
+ }
1194
+ }
1195
+ ${MARKET}
1196
+ `;
1197
+ var DELETE_MARKET_MUTATION = gql4`
1198
+ mutation deleteMarket($_id: ID!) {
1199
+ deleteMarket(_id: $_id)
1200
+ }
1201
+ `;
1202
+
1203
+ // src/graphql/queries/user.ts
1204
+ import { gql as gql6 } from "@apollo/client";
1205
+
1206
+ // src/graphql/queries/stallholder.ts
1207
+ import { gql as gql5 } from "@apollo/client";
1208
+ var STALLHOLDER_LOCATION_FIELDS_FRAGMENT = gql5`
1209
+ fragment StallholderLocationFields on StallholderLocationType {
1210
+ city
1211
+ coordinates
1212
+ country
1213
+ fullAddress
1214
+ latitude
1215
+ longitude
1216
+ region
1217
+ type
1218
+ }
1219
+ `;
1220
+ var STALLHOLDER_DATETIME_FIELDS_FRAGMENT = gql5`
1221
+ fragment StallholderDateTimeFields on StallholderDateTimeType {
1222
+ endDate
1223
+ endTime
1224
+ startDate
1225
+ startTime
1226
+ }
1227
+ `;
1228
+ var STALLHOLDER = gql5`
1229
+ fragment StallholderFields on StallholderType {
1230
+ _id
1231
+ active
1232
+ applyFormId
1233
+ categories {
1234
+ ...CategoryFields
1235
+ }
1236
+ cover {
1237
+ ...ResourceImageFields
1238
+ }
1239
+ createdAt
1240
+ description
1241
+ images {
1242
+ ...ResourceImageFields
1243
+ }
1244
+ locations {
1245
+ dateTime {
1246
+ ...StallholderDateTimeFields
1247
+ }
1248
+ description
1249
+ location {
1250
+ ...StallholderLocationFields
1251
+ }
1252
+ }
1253
+ logo {
1254
+ ...ResourceImageFields
1255
+ }
1256
+ multiLocation
1257
+ name
1258
+ owner {
1259
+ ...OwnerFields
1260
+ }
1261
+ products
1262
+ promoCode
1263
+ region
1264
+ relationIds
1265
+ specialities
1266
+ updatedAt
1267
+ }
1268
+ ${CATEGORY_FIELDS_FRAGMENT}
1269
+ ${STALLHOLDER_DATETIME_FIELDS_FRAGMENT}
1270
+ ${STALLHOLDER_LOCATION_FIELDS_FRAGMENT}
1271
+ ${OWNER_FIELDS_FRAGMENT}
1272
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1273
+ `;
1274
+ var STALLHOLDER_APPLY_FORM = gql5`
1275
+ fragment StallholderApplyFormFields on StallholderApplyFormType {
1276
+ _id
1277
+ active
1278
+ electricity {
1279
+ details
1280
+ isRequired
1281
+ }
1282
+ foodSafetyGradeFiles
1283
+ gazebo {
1284
+ details
1285
+ isRequired
1286
+ }
1287
+ packaging
1288
+ paymentMethod
1289
+ priceRange {
1290
+ max
1291
+ min
1292
+ }
1293
+ producedIn
1294
+ stallholderId
1295
+ stallSize {
1296
+ depth
1297
+ width
1298
+ }
1299
+ table {
1300
+ details
1301
+ isRequired
1302
+ }
1303
+ }
1304
+ `;
1305
+ var GET_STALLHOLDERS = gql5`
1306
+ query getStallHolders {
1307
+ stallholders {
1308
+ ...StallholderFields
1309
+ }
1310
+ }
1311
+ ${STALLHOLDER}
1312
+ `;
1313
+ var GET_STALLHOLDER = gql5`
1314
+ query getStallHolder($_id: ID!) {
1315
+ stallholder(_id: $_id) {
1316
+ ...StallholderFields
1317
+ }
1318
+ }
1319
+ ${STALLHOLDER}
1320
+ `;
1321
+ var GET_STALLHOLDERS_BY_REGION = gql5`
1322
+ query getStallholdersByRegion($region: String!) {
1323
+ stallholdersByRegion(region: $region) {
1324
+ ...StallholderFields
1325
+ }
1326
+ }
1327
+ ${STALLHOLDER}
1328
+ `;
1329
+ var SEARCH_STALLHOLDERS = gql5`
1330
+ query searchStallholders($search: String!, $region: String) {
1331
+ stallholderSearch(search: $search, region: $region) {
1332
+ ...StallholderFields
1333
+ }
1334
+ }
1335
+ ${STALLHOLDER}
1336
+ `;
1337
+ var GET_STALLHOLDER_APPLY_FORM = gql5`
1338
+ query getStallholderApplyForm($stallholderId: ID!) {
1339
+ stallholderApplyForm(stallholderId: $stallholderId) {
1340
+ ...StallholderApplyFormFields
1341
+ }
1342
+ }
1343
+ ${STALLHOLDER_APPLY_FORM}
1344
+ `;
1345
+
1346
+ // src/graphql/queries/user.ts
1347
+ var GET_USERS = gql6`
1348
+ query getUsers {
1349
+ users {
1350
+ ...UserFields
1351
+ }
1352
+ }
1353
+ ${USER_FIELDS_FRAGMENT}
1354
+ `;
1355
+ var GET_USER = gql6`
1356
+ query getUser($id: ID!) {
1357
+ user(_id: $id) {
1358
+ ...UserFields
1359
+ }
1360
+ }
1361
+ ${USER_FIELDS_FRAGMENT}
1362
+ `;
1363
+ var GET_USER_MARKETS = gql6`
1364
+ query getUserMarkets {
1365
+ userMarkets {
1366
+ ...MarketFields
1367
+ }
1368
+ }
1369
+ ${MARKET}
1370
+ `;
1371
+ var GET_USER_FAVOURITES = gql6`
1372
+ query getUserFavourites {
1373
+ userFavourites {
1374
+ markets {
1375
+ ...MarketFields
1376
+ }
1377
+ stallholders {
1378
+ ...StallholderFields
1379
+ }
1380
+ }
1381
+ }
1382
+ ${MARKET}
1383
+ ${STALLHOLDER}
1384
+ `;
1385
+ var GET_USER_NOTIFICATIONS = gql6`
1386
+ query getMissedNotifications {
1387
+ userNotifications
1388
+ }
1389
+ `;
1390
+
1391
+ // src/graphql/hooks/market/hooksMutation.ts
1392
+ var useCreateMarket = () => {
1393
+ const [createMarket, { loading, error }] = useMutation2(
1394
+ CREATE_MARKET_MUTATION,
1395
+ {
1396
+ awaitRefetchQueries: true,
1397
+ refetchQueries: [{ query: GET_USER_MARKETS }, { query: GET_MARKETS }]
1398
+ }
1399
+ );
1400
+ return { createMarket, error, loading };
1401
+ };
1402
+ var useUpdateMarket = () => {
1403
+ const [updateMarket, { loading, error }] = useMutation2(
1404
+ UPDATE_MARKET_MUTATION,
1405
+ {
1406
+ awaitRefetchQueries: true,
1407
+ refetchQueries: [{ query: GET_USER_MARKETS }, { query: GET_MARKETS }]
1408
+ }
1409
+ );
1410
+ return { error, loading, updateMarket };
1411
+ };
1412
+ var useDeleteMarket = () => {
1413
+ const [deleteMarket, { loading, error }] = useMutation2(
1414
+ DELETE_MARKET_MUTATION,
1415
+ {
1416
+ awaitRefetchQueries: true,
1417
+ refetchQueries: [{ query: GET_USER_MARKETS }, { query: GET_MARKETS }]
1418
+ }
1419
+ );
1420
+ return { deleteMarket, error, loading };
1421
+ };
1422
+
1423
+ // src/graphql/hooks/market/hooksQuery.ts
1424
+ import { useQuery } from "@apollo/client";
1425
+ var useGetMarkets = () => {
1426
+ const { loading, error, data, refetch } = useQuery(GET_MARKETS, {
1427
+ fetchPolicy: "network-only"
1428
+ });
1429
+ const markets = data?.markets;
1430
+ return { error, loading, markets, refetch };
1431
+ };
1432
+ var useGetMarket = (_id) => {
1433
+ const { loading, error, data, refetch } = useQuery(GET_MARKET, {
1434
+ fetchPolicy: "network-only",
1435
+ skip: !_id,
1436
+ variables: { _id }
1437
+ });
1438
+ const market = data?.market;
1439
+ return { error, loading, market, refetch };
1440
+ };
1441
+ var useGetMarketsByRegion = (region) => {
1442
+ const { loading, error, data, refetch } = useQuery(GET_MARKETS_BY_REGION, {
1443
+ fetchPolicy: "network-only",
1444
+ skip: !region,
1445
+ variables: { region }
1446
+ });
1447
+ const markets = data?.marketsByRegion;
1448
+ return { error, loading, markets, refetch };
1449
+ };
1450
+ var useSearchMarkets = (search, region) => {
1451
+ const { loading, error, data, refetch } = useQuery(SEARCH_MARKETS, {
1452
+ fetchPolicy: "network-only",
1453
+ skip: search.length < 3,
1454
+ variables: { region, search }
1455
+ });
1456
+ const markets = data?.marketSearch;
1457
+ return { error, loading, markets, refetch };
1458
+ };
1459
+ var useGetMarketsNearMe = (location) => {
1460
+ const { loading, error, data, refetch } = useQuery(GET_MARKETS_NEAR_ME, {
1461
+ fetchPolicy: "network-only",
1462
+ skip: !location.latitude || !location.longitude,
1463
+ variables: {
1464
+ latitude: location.latitude,
1465
+ longitude: location.longitude,
1466
+ radius: location.radius || 1e4
1467
+ // Default to 10km if no radius is provided
1468
+ }
1469
+ });
1470
+ const markets = data?.marketsNearMe;
1471
+ return { error, loading, markets, refetch };
1472
+ };
1473
+
1474
+ // src/graphql/hooks/relation/hooksMutation.ts
1475
+ import { useMutation as useMutation3 } from "@apollo/client";
1476
+
1477
+ // src/graphql/mutations/relation.ts
1478
+ import { gql as gql8 } from "@apollo/client";
1479
+
1480
+ // src/graphql/queries/relation.ts
1481
+ import { gql as gql7 } from "@apollo/client";
1482
+ var RELATION_UPDATE_BY_FRAGMENT = gql7`
1483
+ fragment RelationUpdateBy on RelationUpdateByType {
1484
+ resourceId
1485
+ resourceName
1486
+ resourceType
1487
+ startDate
1488
+ toStatus
1489
+ }
1490
+ `;
1491
+ var RELATION_LOGS_FRAGMENT = gql7`
1492
+ fragment RelationLogs on RelationLogType {
1493
+ createdAt
1494
+ updatedAt
1495
+ updatedBy {
1496
+ ...RelationUpdateBy
1497
+ }
1498
+ }
1499
+ ${RELATION_UPDATE_BY_FRAGMENT}
1500
+ `;
1501
+ var RELATION_DATES_FRAGMENT = gql7`
1502
+ fragment RelationDates on RelationDateType {
1503
+ lastUpdateBy
1504
+ startDate
1505
+ status
1506
+ }
1507
+ `;
1508
+ var RELATION_FIELDS_FRAGMENT = gql7`
1509
+ fragment RelationFields on RelationType {
1510
+ _id
1511
+ createdAt
1512
+ lastUpdateBy
1513
+ marketId
1514
+ relationDates {
1515
+ ...RelationDates
1516
+ }
1517
+ relationLogs {
1518
+ ...RelationLogs
1519
+ }
1520
+ relationType
1521
+ stallholderId
1522
+ updatedAt
1523
+ }
1524
+ ${RELATION_DATES_FRAGMENT}
1525
+ ${RELATION_LOGS_FRAGMENT}
1526
+ `;
1527
+ var GET_RELATION = gql7`
1528
+ query getRelation($id: ID!) {
1529
+ relation(_id: $id) {
1530
+ ...RelationFields
1531
+ }
1532
+ }
1533
+ ${RELATION_FIELDS_FRAGMENT}
1534
+ `;
1535
+ var GET_RELATION_BY_MARKET_AND_STALLHOLDER = gql7`
1536
+ query getRelationByMarketAndStallholder($marketId: ID!, $stallholderId: ID!) {
1537
+ relationByMarketAndStallholder(
1538
+ marketId: $marketId
1539
+ stallholderId: $stallholderId
1540
+ ) {
1541
+ ...RelationFields
1542
+ }
1543
+ }
1544
+ ${RELATION_FIELDS_FRAGMENT}
1545
+ `;
1546
+ var GET_MARKET_RELATIONS = gql7`
1547
+ query getMarketRelations($marketId: ID!) {
1548
+ marketRelations(marketId: $marketId) {
1549
+ ...RelationFields
1550
+ }
1551
+ }
1552
+ ${RELATION_FIELDS_FRAGMENT}
1553
+ `;
1554
+ var GET_STALLHOLDER_RELATIONS = gql7`
1555
+ query getStallholderRelations($stallholderId: ID!) {
1556
+ stallholderRelations(stallholderId: $stallholderId) {
1557
+ ...RelationFields
1558
+ }
1559
+ }
1560
+ ${RELATION_FIELDS_FRAGMENT}
1561
+ `;
1562
+ var GET_RESOURCE_CONNECTIONS = gql7`
1563
+ query getResourceConnections(
1564
+ $resourceId: ID!
1565
+ $resourceType: ResourceTypeEnum!
1566
+ ) {
1567
+ resourceConnections(resourceId: $resourceId, resourceType: $resourceType) {
1568
+ markets {
1569
+ _id
1570
+ active
1571
+ cover {
1572
+ ...ResourceImageFields
1573
+ }
1574
+ createdAt
1575
+ dateTime {
1576
+ ...MarketDateTimeFields
1577
+ }
1578
+ description
1579
+ images {
1580
+ ...ResourceImageFields
1581
+ }
1582
+ location {
1583
+ ...MarketLocationFields
1584
+ }
1585
+ logo {
1586
+ ...ResourceImageFields
1587
+ }
1588
+ name
1589
+ owner {
1590
+ ...OwnerFields
1591
+ }
1592
+ promoCode
1593
+ provider
1594
+ relationDates {
1595
+ ...RelationDates
1596
+ }
1597
+ relationIds
1598
+ stallApplicationInfo {
1599
+ applicationDeadlineHours
1600
+ rejectionPolicy
1601
+ stallCapacity
1602
+ }
1603
+ tags
1604
+ updatedAt
1605
+ }
1606
+ stallholders {
1607
+ _id
1608
+ active
1609
+ applyFormId
1610
+ categories {
1611
+ ...CategoryFields
1612
+ }
1613
+ cover {
1614
+ ...ResourceImageFields
1615
+ }
1616
+ createdAt
1617
+ description
1618
+ images {
1619
+ ...ResourceImageFields
1620
+ }
1621
+ locations {
1622
+ dateTime {
1623
+ ...StallholderDateTimeFields
1624
+ }
1625
+ location {
1626
+ ...StallholderLocationFields
1627
+ }
1628
+ }
1629
+ logo {
1630
+ ...ResourceImageFields
1631
+ }
1632
+ multiLocation
1633
+ name
1634
+ owner {
1635
+ ...OwnerFields
1636
+ }
1637
+ products
1638
+ promoCode
1639
+ relationDates {
1640
+ ...RelationDates
1641
+ }
1642
+ relationIds
1643
+ specialities
1644
+ updatedAt
1645
+ }
1646
+ }
1647
+ }
1648
+ ${MARKET_DATETIME_FIELDS_FRAGMENT}
1649
+ ${MARKET_LOCATION_FIELDS_FRAGMENT}
1650
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1651
+ ${RELATION_DATES_FRAGMENT}
1652
+ ${CATEGORY_FIELDS_FRAGMENT}
1653
+ ${STALLHOLDER_DATETIME_FIELDS_FRAGMENT}
1654
+ ${STALLHOLDER_LOCATION_FIELDS_FRAGMENT}
1655
+ ${OWNER_FIELDS_FRAGMENT}
1656
+ ${RESOURCE_IMAGE_FIELDS_FRAGMENT}
1657
+ `;
1658
+
1659
+ // src/graphql/mutations/relation.ts
1660
+ var CREATE_RELATION_MUTATION = gql8`
1661
+ mutation createRelation($input: RelationInputType!) {
1662
+ createRelation(input: $input) {
1663
+ ...RelationFields
1664
+ }
1665
+ }
1666
+ ${RELATION_FIELDS_FRAGMENT}
1667
+ `;
1668
+ var UPDATE_RELATION_MUTATION = gql8`
1669
+ mutation updateRelation($_id: ID!, $input: RelationInputType!) {
1670
+ updateRelation(_id: $_id, input: $input) {
1671
+ ...RelationFields
1672
+ }
1673
+ }
1674
+ ${RELATION_FIELDS_FRAGMENT}
1675
+ `;
1676
+ var DELETE_RELATION_MUTATION = gql8`
1677
+ mutation deleteRelation($_id: ID!) {
1678
+ deleteRelation(_id: $_id) {
1679
+ ...RelationFields
1680
+ }
1681
+ }
1682
+ ${RELATION_FIELDS_FRAGMENT}
1683
+ `;
1684
+
1685
+ // src/graphql/hooks/relation/hooksMutation.ts
1686
+ var useCreateRelation = () => {
1687
+ const [createRelation, { loading, error }] = useMutation3(
1688
+ CREATE_RELATION_MUTATION,
1689
+ {
1690
+ awaitRefetchQueries: true,
1691
+ refetchQueries: (mutationResult) => {
1692
+ const marketId = mutationResult?.data?.createRelation?.marketId;
1693
+ const stallholderId = mutationResult?.data?.createRelation?.stallholderId;
1694
+ return [
1695
+ {
1696
+ query: GET_MARKET_RELATIONS,
1697
+ variables: { marketId }
1698
+ },
1699
+ {
1700
+ query: GET_MARKET,
1701
+ variables: { _id: marketId }
1702
+ },
1703
+ {
1704
+ query: GET_STALLHOLDER_RELATIONS,
1705
+ variables: { stallholderId }
1706
+ },
1707
+ {
1708
+ query: GET_STALLHOLDER,
1709
+ variables: { _id: stallholderId }
1710
+ },
1711
+ {
1712
+ query: GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1713
+ variables: { marketId, stallholderId }
1714
+ }
1715
+ ];
1716
+ }
1717
+ }
1718
+ );
1719
+ return { createRelation, error, loading };
1720
+ };
1721
+ var useUpdateRelation = () => {
1722
+ const [updateRelation, { loading, error }] = useMutation3(
1723
+ UPDATE_RELATION_MUTATION,
1724
+ {
1725
+ awaitRefetchQueries: true,
1726
+ refetchQueries: (mutationResult) => {
1727
+ const marketId = mutationResult?.data?.updateRelation?.marketId;
1728
+ const stallholderId = mutationResult?.data?.updateRelation?.stallholderId;
1729
+ return [
1730
+ {
1731
+ query: GET_MARKET_RELATIONS,
1732
+ variables: { marketId }
1733
+ },
1734
+ {
1735
+ query: GET_MARKET,
1736
+ variables: { _id: marketId }
1737
+ },
1738
+ {
1739
+ query: GET_STALLHOLDER_RELATIONS,
1740
+ variables: { stallholderId }
1741
+ },
1742
+ {
1743
+ query: GET_STALLHOLDER,
1744
+ variables: { _id: stallholderId }
1745
+ },
1746
+ {
1747
+ query: GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1748
+ variables: { marketId, stallholderId }
1749
+ }
1750
+ ];
1751
+ }
1752
+ }
1753
+ );
1754
+ return { error, loading, updateRelation };
1755
+ };
1756
+ var useDeleteRelation = () => {
1757
+ const [deleteRelation, { loading, error }] = useMutation3(
1758
+ DELETE_RELATION_MUTATION,
1759
+ {
1760
+ awaitRefetchQueries: true,
1761
+ refetchQueries: (mutationResult) => {
1762
+ const marketId = mutationResult?.data?.deleteRelation?.marketId;
1763
+ const stallholderId = mutationResult?.data?.deleteRelation?.stallholderId;
1764
+ return [
1765
+ {
1766
+ query: GET_MARKET_RELATIONS,
1767
+ variables: { marketId }
1768
+ },
1769
+ {
1770
+ query: GET_STALLHOLDER_RELATIONS,
1771
+ variables: { stallholderId }
1772
+ },
1773
+ {
1774
+ query: GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1775
+ variables: { marketId, stallholderId }
1776
+ }
1777
+ ];
1778
+ }
1779
+ }
1780
+ );
1781
+ return { deleteRelation, error, loading };
1782
+ };
1783
+
1784
+ // src/graphql/hooks/relation/hooksQuery.ts
1785
+ import { useQuery as useQuery2 } from "@apollo/client";
1786
+ var useGetRelation = (id) => {
1787
+ const { loading, error, data, refetch } = useQuery2(GET_RELATION, {
1788
+ fetchPolicy: "network-only",
1789
+ skip: id === "",
1790
+ variables: { id }
1791
+ });
1792
+ const relation = data?.relation;
1793
+ return { error, loading, refetch, relation };
1794
+ };
1795
+ var useGetRelationByMarketAndStallholder = (marketId, stallholderId) => {
1796
+ const { loading, error, data, refetch } = useQuery2(
1797
+ GET_RELATION_BY_MARKET_AND_STALLHOLDER,
1798
+ {
1799
+ fetchPolicy: "no-cache",
1800
+ skip: marketId === "" || stallholderId === "",
1801
+ variables: { marketId, stallholderId }
1802
+ }
1803
+ );
1804
+ const relationByMarketAndStallholder = data?.relationByMarketAndStallholder;
1805
+ return { error, loading, refetch, relationByMarketAndStallholder };
1806
+ };
1807
+ var useGetMarketRelations = (marketId) => {
1808
+ const { loading, error, data, refetch } = useQuery2(GET_MARKET_RELATIONS, {
1809
+ fetchPolicy: "network-only",
1810
+ skip: marketId === "",
1811
+ variables: { marketId }
1812
+ });
1813
+ const marketRelations = data?.marketRelations;
1814
+ return { error, loading, marketRelations, refetch };
1815
+ };
1816
+ var useGetStallholderRelations = (stallholderId) => {
1817
+ const { loading, error, data, refetch } = useQuery2(
1818
+ GET_STALLHOLDER_RELATIONS,
1819
+ {
1820
+ fetchPolicy: "network-only",
1821
+ skip: stallholderId === "",
1822
+ variables: { stallholderId }
1823
+ }
1824
+ );
1825
+ const stallholderRelations = data?.stallholderRelations;
1826
+ return { error, loading, refetch, stallholderRelations };
1827
+ };
1828
+ var useGetResourceConnections = (resourceId, resourceType) => {
1829
+ const { loading, error, data, refetch } = useQuery2(GET_RESOURCE_CONNECTIONS, {
1830
+ fetchPolicy: "network-only",
1831
+ variables: { resourceId, resourceType }
1832
+ });
1833
+ const resourceConnections = data?.resourceConnections;
1834
+ return { error, loading, refetch, resourceConnections };
1835
+ };
1836
+
1837
+ // src/graphql/hooks/stallholder/hooksMutation.ts
1838
+ import { useMutation as useMutation4 } from "@apollo/client";
1839
+
1840
+ // src/graphql/mutations/stallholder.ts
1841
+ import { gql as gql9 } from "@apollo/client";
1842
+ var CREATE_STALLHOLDER_MUTATION = gql9`
1843
+ mutation createStallholder($input: StallholderInputType!) {
1844
+ createStallholder(input: $input) {
1845
+ ...StallholderFields
1846
+ }
1847
+ }
1848
+ ${STALLHOLDER}
1849
+ `;
1850
+ var UPDATE_STALLHOLDER_MUTATION = gql9`
1851
+ mutation updateStallholder($_id: ID!, $input: StallholderInputType!) {
1852
+ updateStallholder(_id: $_id, input: $input) {
1853
+ ...StallholderFields
1854
+ }
1855
+ }
1856
+ ${STALLHOLDER}
1857
+ `;
1858
+ var DELETE_STALLHOLDER_MUTATION = gql9`
1859
+ mutation deleteStallholder($_id: ID!) {
1860
+ deleteStallholder(_id: $_id)
1861
+ }
1862
+ `;
1863
+ var CREATE_STALLHOLDER_APPLY_FORM_MUTATION = gql9`
1864
+ mutation createStallholderApplyForm($input: StallholderApplyFormInputType!) {
1865
+ createStallholderApplyForm(input: $input) {
1866
+ ...StallholderApplyFormFields
1867
+ }
1868
+ }
1869
+ ${STALLHOLDER_APPLY_FORM}
1870
+ `;
1871
+ var UPDATE_STALLHOLDER_APPLY_FORM_MUTATION = gql9`
1872
+ mutation updateStallholderApplyForm(
1873
+ $_id: ID!
1874
+ $input: StallholderApplyFormInputType!
1875
+ ) {
1876
+ updateStallholderApplyForm(_id: $_id, input: $input) {
1877
+ ...StallholderApplyFormFields
1878
+ }
1879
+ }
1880
+ ${STALLHOLDER_APPLY_FORM}
1881
+ `;
1882
+
1883
+ // src/graphql/hooks/stallholder/hooksMutation.ts
1884
+ var useCreateStallholder = () => {
1885
+ const [createStallholder, { loading, error }] = useMutation4(
1886
+ CREATE_STALLHOLDER_MUTATION,
1887
+ {
1888
+ awaitRefetchQueries: true,
1889
+ refetchQueries: [{ query: GET_STALLHOLDERS }]
1890
+ }
1891
+ );
1892
+ return { createStallholder, error, loading };
1893
+ };
1894
+ var useUpdateStallholder = () => {
1895
+ const [updateStallholder, { loading, error }] = useMutation4(
1896
+ UPDATE_STALLHOLDER_MUTATION,
1897
+ {
1898
+ awaitRefetchQueries: true,
1899
+ refetchQueries: [{ query: GET_STALLHOLDERS }]
1900
+ }
1901
+ );
1902
+ return { error, loading, updateStallholder };
1903
+ };
1904
+ var useDeleteStallholder = () => {
1905
+ const [deleteStallholder, { loading, error }] = useMutation4(
1906
+ DELETE_STALLHOLDER_MUTATION,
1907
+ {
1908
+ awaitRefetchQueries: true,
1909
+ refetchQueries: [{ query: GET_STALLHOLDERS }]
1910
+ }
1911
+ );
1912
+ return { deleteStallholder, error, loading };
1913
+ };
1914
+ var useCreateStallholderApplyForm = () => {
1915
+ const [createStallholderApplyForm, { loading, error }] = useMutation4(
1916
+ CREATE_STALLHOLDER_APPLY_FORM_MUTATION,
1917
+ {
1918
+ awaitRefetchQueries: true,
1919
+ refetchQueries: (mutationResult) => {
1920
+ const stallholderId = mutationResult?.data?.createStallholderApplyForm?.stallholderId;
1921
+ if (!stallholderId) return [];
1922
+ return [
1923
+ {
1924
+ query: GET_STALLHOLDER_APPLY_FORM,
1925
+ variables: { stallholderId }
1926
+ // Pass the stallholderId for refetching
1927
+ }
1928
+ ];
1929
+ }
1930
+ }
1931
+ );
1932
+ return { createStallholderApplyForm, error, loading };
1933
+ };
1934
+ var useUpdateStallholderApplyForm = () => {
1935
+ const [updateStallholderApplyForm, { loading, error }] = useMutation4(
1936
+ UPDATE_STALLHOLDER_APPLY_FORM_MUTATION,
1937
+ {
1938
+ awaitRefetchQueries: true,
1939
+ refetchQueries: (mutationResult) => {
1940
+ const stallholderId = mutationResult?.data?.createStallholderApplyForm?.stallholderId;
1941
+ if (!stallholderId) return [];
1942
+ return [
1943
+ {
1944
+ query: GET_STALLHOLDER_APPLY_FORM,
1945
+ variables: { stallholderId }
1946
+ // Pass the stallholderId for refetching
1947
+ }
1948
+ ];
1949
+ }
1950
+ }
1951
+ );
1952
+ return { error, loading, updateStallholderApplyForm };
1953
+ };
1954
+
1955
+ // src/graphql/hooks/stallholder/hooksQuery.ts
1956
+ import { useQuery as useQuery3 } from "@apollo/client";
1957
+ var useGetStallholders = () => {
1958
+ const { loading, error, data, refetch } = useQuery3(GET_STALLHOLDERS, {
1959
+ fetchPolicy: "network-only"
1960
+ });
1961
+ const stallholders = data?.stallholders;
1962
+ return {
1963
+ error,
1964
+ loading,
1965
+ refetch,
1966
+ stallholders
1967
+ };
1968
+ };
1969
+ var useGetStallholder = (_id) => {
1970
+ const { loading, error, data, refetch } = useQuery3(GET_STALLHOLDER, {
1971
+ fetchPolicy: "network-only",
1972
+ skip: !_id,
1973
+ variables: { _id }
1974
+ });
1975
+ const stallholder = data?.stallholder;
1976
+ return { error, loading, refetch, stallholder };
1977
+ };
1978
+ var useGetStallholdersByRegion = (region) => {
1979
+ const { loading, error, data, refetch } = useQuery3(
1980
+ GET_STALLHOLDERS_BY_REGION,
1981
+ {
1982
+ fetchPolicy: "network-only",
1983
+ skip: !region,
1984
+ variables: { region }
1985
+ }
1986
+ );
1987
+ const stallholders = data?.stallholdersByRegion;
1988
+ return { error, loading, refetch, stallholders };
1989
+ };
1990
+ var useSearchStallholders = (search, region) => {
1991
+ const { loading, error, data, refetch } = useQuery3(SEARCH_STALLHOLDERS, {
1992
+ fetchPolicy: "network-only",
1993
+ skip: search.length < 3,
1994
+ variables: { region, search }
1995
+ });
1996
+ const stallholders = data?.stallholderSearch;
1997
+ return { error, loading, refetch, stallholders };
1998
+ };
1999
+ var useGetStallholderApplyForm = (stallholderId) => {
2000
+ const { loading, error, data, refetch } = useQuery3(
2001
+ GET_STALLHOLDER_APPLY_FORM,
2002
+ {
2003
+ variables: { stallholderId }
2004
+ }
2005
+ );
2006
+ const applyForm = data?.stallholderApplyForm;
2007
+ return {
2008
+ applyForm,
2009
+ error,
2010
+ loading,
2011
+ refetch
2012
+ };
2013
+ };
2014
+
2015
+ // src/graphql/hooks/subscriptions.ts
2016
+ import { useSubscription } from "@apollo/client";
2017
+
2018
+ // src/graphql/subscriptions/notification.ts
2019
+ import { gql as gql10 } from "@apollo/client";
2020
+ var NOTIFICATION_FIELDS_FRAGMENT = gql10`
2021
+ fragment NotificationFields on NotificationType {
2022
+ createdBy
2023
+ important
2024
+ message
2025
+ notifyUser
2026
+ resourceId
2027
+ resourceType
2028
+ }
2029
+ `;
2030
+ var GET_GLOBAL_NOTIFICATION = gql10`
2031
+ subscription {
2032
+ getGlobalNotification {
2033
+ ...NotificationFields
2034
+ }
2035
+ }
2036
+ ${NOTIFICATION_FIELDS_FRAGMENT}
2037
+ `;
2038
+ var GET_RELATION_NOTIFICATION = gql10`
2039
+ subscription {
2040
+ getRelationNotification {
2041
+ ...NotificationFields
2042
+ }
2043
+ }
2044
+ ${NOTIFICATION_FIELDS_FRAGMENT}
2045
+ `;
2046
+
2047
+ // src/graphql/hooks/subscriptions.ts
2048
+ var useGetNotification = () => {
2049
+ const {
2050
+ data: global,
2051
+ loading: loadingGlobal,
2052
+ error: errorGlobal
2053
+ } = useSubscription(GET_GLOBAL_NOTIFICATION);
2054
+ const {
2055
+ data: relation,
2056
+ loading: loadingImportant,
2057
+ error: errorImportant
2058
+ } = useSubscription(GET_RELATION_NOTIFICATION);
2059
+ const error = errorGlobal || errorImportant;
2060
+ const loading = loadingGlobal || loadingImportant;
2061
+ const notification = relation?.getRelationNotification || global?.getGlobalNotification;
2062
+ return { error, loading, notification };
2063
+ };
2064
+
2065
+ // src/graphql/hooks/user/hooksMutation.ts
2066
+ import { useMutation as useMutation5 } from "@apollo/client";
2067
+
2068
+ // src/graphql/mutations/user.ts
2069
+ import { gql as gql11 } from "@apollo/client";
2070
+ var CREATE_USER_MUTATION = gql11`
2071
+ mutation createUser($input: UserInputType!) {
2072
+ createUser(input: $input) {
2073
+ ...UserFields
2074
+ }
2075
+ }
2076
+ ${USER_FIELDS_FRAGMENT}
2077
+ `;
2078
+ var UPDATE_USER_MUTATION = gql11`
2079
+ mutation updateUser($_id: ID!, $input: UserInputType!) {
2080
+ updateUser(_id: $_id, input: $input) {
2081
+ ...UserFields
2082
+ }
2083
+ }
2084
+ ${USER_FIELDS_FRAGMENT}
2085
+ `;
2086
+ var ADD_USER_FAVOURITE_RESOURCE_MUTATION = gql11`
2087
+ mutation addUserFavouriteResource(
2088
+ $resourceId: ID!
2089
+ $resourceType: ResourceTypeEnum!
2090
+ $userId: ID!
2091
+ ) {
2092
+ addUserFavouriteResource(
2093
+ resourceId: $resourceId
2094
+ resourceType: $resourceType
2095
+ userId: $userId
2096
+ ) {
2097
+ ...UserFields
2098
+ }
2099
+ }
2100
+ ${USER_FIELDS_FRAGMENT}
2101
+ `;
2102
+ var REMOVE_USER_FAVOURITE_RESOURCE_MUTATION = gql11`
2103
+ mutation removeUserFavouriteResource(
2104
+ $resourceId: ID!
2105
+ $resourceType: ResourceTypeEnum!
2106
+ $userId: ID!
2107
+ ) {
2108
+ removeUserFavouriteResource(
2109
+ resourceId: $resourceId
2110
+ resourceType: $resourceType
2111
+ userId: $userId
2112
+ ) {
2113
+ ...UserFields
2114
+ }
2115
+ }
2116
+ ${USER_FIELDS_FRAGMENT}
2117
+ `;
2118
+
2119
+ // src/graphql/hooks/user/hooksMutation.ts
2120
+ var useCreateUser = () => {
2121
+ const [createUser, { loading, error }] = useMutation5(CREATE_USER_MUTATION, {
2122
+ awaitRefetchQueries: true
2123
+ });
2124
+ return { createUser, error, loading };
2125
+ };
2126
+ var useUpdateUser = () => {
2127
+ const [updateUser, { loading, error }] = useMutation5(UPDATE_USER_MUTATION, {
2128
+ awaitRefetchQueries: true
2129
+ });
2130
+ return { error, loading, updateUser };
2131
+ };
2132
+ var useAddUserFavouriteResource = () => {
2133
+ const [addUserFavouriteResource, { loading, error }] = useMutation5(
2134
+ ADD_USER_FAVOURITE_RESOURCE_MUTATION,
2135
+ {
2136
+ awaitRefetchQueries: true,
2137
+ refetchQueries: [{ query: GET_USER_FAVOURITES }]
2138
+ }
2139
+ );
2140
+ return { addUserFavouriteResource, error, loading };
2141
+ };
2142
+ var useRemoveUserFavouriteResource = () => {
2143
+ const [removeUserFavouriteResource, { loading, error }] = useMutation5(
2144
+ REMOVE_USER_FAVOURITE_RESOURCE_MUTATION,
2145
+ {
2146
+ awaitRefetchQueries: true,
2147
+ refetchQueries: [{ query: GET_USER_FAVOURITES }]
2148
+ }
2149
+ );
2150
+ return { error, loading, removeUserFavouriteResource };
2151
+ };
2152
+
2153
+ // src/graphql/hooks/user/hooksQuery.ts
2154
+ import { useQuery as useQuery4 } from "@apollo/client";
2155
+ var useGetUsers = () => {
2156
+ const { loading, error, data, refetch } = useQuery4(GET_USERS, {
2157
+ fetchPolicy: "network-only"
2158
+ });
2159
+ const users = data?.users;
2160
+ return { error, loading, refetch, users };
2161
+ };
2162
+ var useGetUser = (id) => {
2163
+ const { loading, error, data, refetch } = useQuery4(GET_USER, {
2164
+ variables: { id }
2165
+ });
2166
+ const user = data?.user;
2167
+ return { error, loading, refetch, user };
2168
+ };
2169
+ var useGetUserMarkets = () => {
2170
+ const { loading, error, data, refetch } = useQuery4(GET_USER_MARKETS, {
2171
+ fetchPolicy: "network-only"
2172
+ });
2173
+ const userMarkets = data?.userMarkets;
2174
+ return { error, loading, refetch, userMarkets };
2175
+ };
2176
+ var useGetUserFavourites = () => {
2177
+ const { loading, error, data, refetch } = useQuery4(GET_USER_FAVOURITES, {
2178
+ fetchPolicy: "network-only"
2179
+ });
2180
+ const markets = data?.userFavourites.markets;
2181
+ const stallholders = data?.userFavourites.stallholders;
2182
+ const userFavourites = {
2183
+ markets,
2184
+ stallholders
2185
+ };
2186
+ return { error, loading, refetch, userFavourites };
2187
+ };
2188
+ var useGetUserNotifications = () => {
2189
+ const { loading, error, data, refetch } = useQuery4(GET_USER_NOTIFICATIONS, {
2190
+ fetchPolicy: "network-only"
2191
+ });
2192
+ const userNotifications = data?.userNotifications;
2193
+ return { error, loading, refetch, userNotifications };
2194
+ };
2195
+
2196
+ // src/formFields/stallholder/createEditStallholder.ts
2197
+ var stallholderBasicInfoFields = [
2198
+ {
2199
+ helperText: "Business Name of the Stallholder *",
2200
+ name: "name",
2201
+ placeholder: "Business Name"
2202
+ },
2203
+ {
2204
+ helperText: "Description of the Stallholder *",
2205
+ isTextArea: true,
2206
+ name: "description",
2207
+ placeholder: "Description"
2208
+ },
2209
+ {
2210
+ helperText: "Enter Promo code if you have one.",
2211
+ name: "promoCode",
2212
+ placeholder: "Promo code"
2213
+ }
2214
+ ];
2215
+ var stallholderMultiLocation = {
2216
+ helperText: "Usefull when you are not only selling products on Markets but also providing services at other locations.",
2217
+ name: "multiLocation",
2218
+ placeholder: "Enable multi location"
2219
+ };
2220
+ var stallholderFullAddress = {
2221
+ helperText: "Enter address",
2222
+ name: "fullAddress",
2223
+ placeholder: "Start typing to find address"
2224
+ };
2225
+ var stallholderStartDateFields = [
2226
+ {
2227
+ dateMode: "date",
2228
+ helperText: "Start Date",
2229
+ name: "startDate",
2230
+ placeholder: "Start Date"
2231
+ },
2232
+ {
2233
+ dateMode: "time",
2234
+ helperText: "Start Time",
2235
+ name: "startTime",
2236
+ placeholder: "Start Time"
2237
+ }
2238
+ ];
2239
+ var stallholderEndDateFields = [
2240
+ {
2241
+ dateMode: "date",
2242
+ helperText: "End Date",
2243
+ name: "endDate",
2244
+ placeholder: "End Date"
2245
+ },
2246
+ {
2247
+ dateMode: "time",
2248
+ helperText: "End Time",
2249
+ name: "endTime",
2250
+ placeholder: "End Time"
2251
+ }
2252
+ ];
2253
+ var stallholderLocationDescription = {
2254
+ helperText: "Description",
2255
+ isTextArea: true,
2256
+ name: "description",
2257
+ placeholder: "Description"
2258
+ };
2259
+ var availableCityTypes = [
2260
+ "Auckland",
2261
+ "Christchurch",
2262
+ "Hamilton",
2263
+ "Wellington"
2264
+ ];
2265
+ var availableRegionTypes = Object.values(EnumRegions);
2266
+ var availableCityOptions = mapArrayToOptions(availableCityTypes);
2267
+ var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
2268
+
2269
+ // src/formFields/stallholder/stallholderApplyForm.ts
2270
+ var stallholderElectricity = {
2271
+ details: {
2272
+ helperText: "Please describe details e.g. amps, voltage, etc.",
2273
+ isTextArea: true,
2274
+ name: "electricity.details",
2275
+ placeholder: "Electricity requirements"
2276
+ },
2277
+ isRequired: {
2278
+ name: "electricity.isRequired",
2279
+ placeholder: "Do you require electricity?"
2280
+ }
2281
+ };
2282
+ var stallholderGazebo = {
2283
+ details: {
2284
+ helperText: "Please describe details e.g. size, etc.",
2285
+ isTextArea: true,
2286
+ name: "gazebo.details",
2287
+ placeholder: "Gazebo requirements"
2288
+ },
2289
+ isRequired: {
2290
+ name: "gazebo.isRequired",
2291
+ placeholder: "Do you require Gazebo?"
2292
+ }
2293
+ };
2294
+ var stallholderTable = {
2295
+ details: {
2296
+ helperText: "Please describe details e.g. size, etc.",
2297
+ isTextArea: true,
2298
+ name: "table.details",
2299
+ placeholder: "Table requirements"
2300
+ },
2301
+ isRequired: {
2302
+ name: "table.isRequired",
2303
+ placeholder: "Do you require Table?"
2304
+ }
2305
+ };
2306
+ var stallholderPriceRange = {
2307
+ max: {
2308
+ helperText: "Product maximum price",
2309
+ name: "priceRange.max",
2310
+ placeholder: "Maximum price: "
2311
+ },
2312
+ min: {
2313
+ helperText: "Product minimum price",
2314
+ name: "priceRange.min",
2315
+ placeholder: "Minimum price: "
2316
+ }
2317
+ };
2318
+ var stallholderStallSize = {
2319
+ depth: {
2320
+ helperText: "Stall size in depth",
2321
+ name: "stallSize.depth",
2322
+ placeholder: "Stall Depth: "
2323
+ },
2324
+ width: {
2325
+ helperText: "Stall size in width",
2326
+ name: "stallSize.width",
2327
+ placeholder: "Stall Width: "
2328
+ }
2329
+ };
2330
+ var stallholderPackaging = {
2331
+ helperText: "Select packaging type, you can select more than one",
2332
+ name: "packaging",
2333
+ placeholder: "Packaging type"
2334
+ };
2335
+ var stallholderPaymentMethod = {
2336
+ helperText: "Select payment method",
2337
+ name: "paymentMethod",
2338
+ placeholder: "Payment Method type"
2339
+ };
2340
+ var stallholderProducedIn = {
2341
+ helperText: "Select where the product is produced, you can select more than one",
2342
+ name: "producedIn",
2343
+ placeholder: "Produced type"
2344
+ };
2345
+ var packagingTypes = [
2346
+ "Biodegradable",
2347
+ "Compostable",
2348
+ "Recyclable",
2349
+ "Reusable",
2350
+ "Single-use",
2351
+ "Glass",
2352
+ "Paper",
2353
+ "Plastic",
2354
+ "Wood",
2355
+ "Other"
2356
+ ];
2357
+ var producedIngTypes = [
2358
+ "Commercial Kitchen",
2359
+ "Home Premises",
2360
+ "Factory",
2361
+ "Farm",
2362
+ "Other"
2363
+ ];
2364
+ var paymentMethodTyes = ["Cash", "Eftpos", "Transfer"];
2365
+ var packagingOptions = mapArrayToOptions(packagingTypes);
2366
+ var producedIngOptions = mapArrayToOptions(producedIngTypes);
2367
+ var paymentMethodOptions = mapArrayToOptions(paymentMethodTyes);
2368
+
2369
+ // src/formFields/market.ts
2370
+ var marketBasicInfoFields = [
2371
+ {
2372
+ helperText: "Name of the Market *",
2373
+ name: "name",
2374
+ placeholder: "Name"
2375
+ },
2376
+ {
2377
+ helperText: "Name of the Provider *",
2378
+ name: "provider",
2379
+ placeholder: "Provider"
2380
+ },
2381
+ {
2382
+ helperText: "Description of the Market *",
2383
+ isTextArea: true,
2384
+ name: "description",
2385
+ placeholder: "Description"
2386
+ },
2387
+ {
2388
+ helperText: "Enter Promo code if you have one.",
2389
+ name: "promoCode",
2390
+ placeholder: "Promo code"
2391
+ }
2392
+ ];
2393
+ var stallApplicationInfo = [
2394
+ {
2395
+ helperText: "Application Deadline of the Market *",
2396
+ keyboardType: "number-pad",
2397
+ name: "stallApplicationInfo.applicationDeadlineHours",
2398
+ placeholder: "Application Deadline Hours"
2399
+ },
2400
+ {
2401
+ helperText: "Stall Capacity of the Market *",
2402
+ keyboardType: "number-pad",
2403
+ name: "stallApplicationInfo.stallCapacity",
2404
+ placeholder: "Stall Capacity"
2405
+ }
2406
+ ];
2407
+ var marketStartDateFields = [
2408
+ {
2409
+ dateMode: "date",
2410
+ helperText: "Start Date of the Market *",
2411
+ name: "startDate",
2412
+ placeholder: "Start Date"
2413
+ },
2414
+ {
2415
+ dateMode: "time",
2416
+ helperText: "Start Time of the Market *",
2417
+ name: "startTime",
2418
+ placeholder: "Start Time"
2419
+ }
2420
+ ];
2421
+ var marketEndDateFields = [
2422
+ {
2423
+ dateMode: "date",
2424
+ helperText: "End Date of the Market *",
2425
+ name: "endDate",
2426
+ placeholder: "End Date"
2427
+ },
2428
+ {
2429
+ dateMode: "time",
2430
+ helperText: "End Time of the Market *",
2431
+ name: "endTime",
2432
+ placeholder: "End Time"
2433
+ }
2434
+ ];
2435
+ var availableTagTypes = [
2436
+ "All Ages",
2437
+ "Day Market",
2438
+ "Family Friendly",
2439
+ "Free Entry",
2440
+ "Indoor Market",
2441
+ "Live Music",
2442
+ "Night Market",
2443
+ "Outdoor Market",
2444
+ "Pet Friendly",
2445
+ "Near Bustop",
2446
+ "Near Train Station",
2447
+ "Parking Available",
2448
+ "Toilet Available",
2449
+ "Wheelchair Accessible",
2450
+ "Near Playground"
2451
+ ];
2452
+ var tagOptions = mapArrayToOptions(availableTagTypes);
2453
+ var rejectionPolicyOptions = mapArrayToOptions(
2454
+ Object.values(EnumRejectionPolicy)
2455
+ );
2456
+
2457
+ // src/formFields/auth.ts
2458
+ var loginFields = [
2459
+ {
2460
+ helperText: "Enter your email address",
2461
+ keyboardType: "email-address",
2462
+ name: "email",
2463
+ placeholder: "Email"
2464
+ },
2465
+ {
2466
+ helperText: "Enter your password",
2467
+ keyboardType: "default",
2468
+ name: "password",
2469
+ placeholder: "Password",
2470
+ secureTextEntry: true
2471
+ }
2472
+ ];
2473
+ var registerFields = [
2474
+ {
2475
+ helperText: "Enter your first name",
2476
+ keyboardType: "default",
2477
+ name: "firstName",
2478
+ placeholder: "First Name"
2479
+ },
2480
+ {
2481
+ helperText: "Enter your last name",
2482
+ keyboardType: "default",
2483
+ name: "lastName",
2484
+ placeholder: "Last Name"
2485
+ },
2486
+ {
2487
+ helperText: "Enter your email address",
2488
+ keyboardType: "email-address",
2489
+ name: "email",
2490
+ placeholder: "Email"
2491
+ },
2492
+ {
2493
+ helperText: "Enter your password",
2494
+ keyboardType: "default",
2495
+ name: "password",
2496
+ placeholder: "Password",
2497
+ secureTextEntry: true
2498
+ }
2499
+ ];
2500
+ var forgotPasswordFields = [
2501
+ {
2502
+ helperText: "Enter your email address",
2503
+ keyboardType: "email-address",
2504
+ name: "email",
2505
+ placeholder: "Email"
2506
+ }
2507
+ ];
2508
+ var resetPasswordFields = [
2509
+ {
2510
+ helperText: "Enter your new password",
2511
+ keyboardType: "default",
2512
+ name: "password",
2513
+ placeholder: "Password",
2514
+ secureTextEntry: true
2515
+ },
2516
+ {
2517
+ helperText: "Confirm your new password",
2518
+ keyboardType: "default",
2519
+ name: "confirmPassword",
2520
+ placeholder: "Confirm Password",
2521
+ secureTextEntry: true
2522
+ }
2523
+ ];
2524
+
2525
+ // src/formFields/user.ts
2526
+ var profileFields = [
2527
+ {
2528
+ disabled: true,
2529
+ helperText: "Email cannot be changed",
2530
+ keyboardType: "email-address",
2531
+ name: "email",
2532
+ placeholder: "Email"
2533
+ },
2534
+ {
2535
+ helperText: "Enter your first name",
2536
+ keyboardType: "default",
2537
+ name: "firstName",
2538
+ placeholder: "First Name"
2539
+ },
2540
+ {
2541
+ helperText: "Enter your last name",
2542
+ keyboardType: "default",
2543
+ name: "lastName",
2544
+ placeholder: "Last Name"
2545
+ },
2546
+ {
2547
+ helperText: "Enter your new password",
2548
+ keyboardType: "default",
2549
+ name: "password",
2550
+ placeholder: "Password",
2551
+ secureTextEntry: true
2552
+ },
2553
+ {
2554
+ helperText: "Confirm your new password",
2555
+ keyboardType: "default",
2556
+ name: "confirmPassword",
2557
+ placeholder: "Confirm Password",
2558
+ secureTextEntry: true
2559
+ }
2560
+ ];
2561
+
2562
+ // src/formFields/categories.ts
2563
+ var availableCategories = [
2564
+ {
2565
+ id: "food-drinks",
2566
+ name: "Food & Drinks",
2567
+ subcategories: [
2568
+ {
2569
+ id: "fresh-food-groceries",
2570
+ items: [
2571
+ "Fruits & Vegetables",
2572
+ "Meat & Seafood",
2573
+ "Dairy & Eggs",
2574
+ "Bakery & Desserts",
2575
+ "Spices & Condiments",
2576
+ "Packaged & Specialty Foods",
2577
+ "Other"
2578
+ ],
2579
+ name: "Fresh Food & Groceries"
2580
+ },
2581
+ {
2582
+ id: "beverages-specialty-drinks",
2583
+ items: [
2584
+ "Fresh Juices & Smoothies",
2585
+ "Coffee & Teas",
2586
+ "Dairy & Plant-Based Drinks",
2587
+ "Alcoholic Beverages",
2588
+ "Other"
2589
+ ],
2590
+ name: "Beverages & Specialty Drinks"
2591
+ },
2592
+ {
2593
+ id: "prepared-street-foods",
2594
+ items: [
2595
+ "Local & International Specialties",
2596
+ "Vegan & Vegetarian Options",
2597
+ "Candies & Sweets",
2598
+ "BBQ & Grilled Foods",
2599
+ "Other"
2600
+ ],
2601
+ name: "Prepared & Street Foods"
2602
+ }
2603
+ ]
2604
+ },
2605
+ {
2606
+ id: "handmade-local-products",
2607
+ name: "Handmade & Local Products",
2608
+ subcategories: [
2609
+ {
2610
+ id: "home-lifestyle",
2611
+ items: [
2612
+ "Textiles & Home Decor",
2613
+ "Pottery & Ceramics",
2614
+ "Woodwork & Carving",
2615
+ "Handwoven Baskets & Bags",
2616
+ "Other"
2617
+ ],
2618
+ name: "Home & Lifestyle"
2619
+ },
2620
+ {
2621
+ id: "fashion-accessories",
2622
+ items: [
2623
+ "Leather & Hand-Stitched Items",
2624
+ "Handcrafted Jewelry & Accessories",
2625
+ "Traditional & Cultural Clothing",
2626
+ "Other"
2627
+ ],
2628
+ name: "Fashion & Accessories"
2629
+ },
2630
+ {
2631
+ id: "eco-friendly-products",
2632
+ items: [
2633
+ "Recycled Goods",
2634
+ "Eco-Packaging",
2635
+ "Sustainable Fashion & Accessories",
2636
+ "Other"
2637
+ ],
2638
+ name: "Eco-Friendly & Sustainable Products"
2639
+ },
2640
+ {
2641
+ id: "arts-crafts",
2642
+ items: ["Art & Crafts", "Traditional & Cultural Items", "Other"],
2643
+ name: "Arts & Crafts"
2644
+ }
2645
+ ]
2646
+ },
2647
+ {
2648
+ id: "clothing-fashion",
2649
+ name: "Clothing & Fashion",
2650
+ subcategories: [
2651
+ {
2652
+ id: "casual-modern-wear",
2653
+ items: [
2654
+ "Modern & Casual Clothes",
2655
+ "Jackets & Outerwear",
2656
+ "Baby & Kids Clothing",
2657
+ "Scarves & Shawls",
2658
+ "Second-Hand Designer Clothes",
2659
+ "Underwear",
2660
+ "Other"
2661
+ ],
2662
+ name: "Casual & Modern Wear"
2663
+ },
2664
+ {
2665
+ id: "footwear",
2666
+ items: [
2667
+ "Everyday Shoes",
2668
+ "Formal Shoes",
2669
+ "Handmade & Leather Shoes",
2670
+ "Other"
2671
+ ],
2672
+ name: "Footwear"
2673
+ },
2674
+ {
2675
+ id: "bags-accessories",
2676
+ items: [
2677
+ "Bags, Belts, Hats, Sunglasses, Watches",
2678
+ "Retro and Vintage Accessories",
2679
+ "Other"
2680
+ ],
2681
+ name: "Bags & Accessories"
2682
+ },
2683
+ {
2684
+ id: "luxury-designer-brands",
2685
+ items: [
2686
+ "Luxury Clothing",
2687
+ "Designer Shoes",
2688
+ "Exclusive Accessories",
2689
+ "Other"
2690
+ ],
2691
+ name: "Luxury & Designer Brands"
2692
+ }
2693
+ ]
2694
+ },
2695
+ {
2696
+ id: "home-garden-household",
2697
+ name: "Home, Garden & Household Goods",
2698
+ subcategories: [
2699
+ {
2700
+ id: "home-essentials-kitchenware",
2701
+ items: [
2702
+ "Kitchenware & Dining",
2703
+ "Sustainable & Eco-Friendly Items",
2704
+ "Handmade & Artisan Home Goods",
2705
+ "Other"
2706
+ ],
2707
+ name: "Home Essentials & Kitchenware"
2708
+ },
2709
+ {
2710
+ id: "furniture-decor-organization",
2711
+ items: [
2712
+ "Furniture & Home Decor",
2713
+ "Textiles & Bedding",
2714
+ "Storage & Organization",
2715
+ "Other"
2716
+ ],
2717
+ name: "Furniture, Decor & Organization"
2718
+ },
2719
+ {
2720
+ id: "outdoor-cleaning-essentials",
2721
+ items: [
2722
+ "Garden, Plants & Decorations",
2723
+ "DIY & Home Improvement",
2724
+ "Cleaning Supplies & Household Essentials",
2725
+ "Other"
2726
+ ],
2727
+ name: "Outdoor & Cleaning Essentials"
2728
+ }
2729
+ ]
2730
+ },
2731
+ {
2732
+ id: "toys-pets",
2733
+ name: "Toys & Pets",
2734
+ subcategories: [
2735
+ {
2736
+ id: "handmade-eco-friendly-kids",
2737
+ items: ["Handmade & Local Toys", "Eco-Friendly Kids Products", "Other"],
2738
+ name: "Handmade & Eco-Friendly Kids Products"
2739
+ },
2740
+ {
2741
+ id: "toys-all-ages",
2742
+ items: [
2743
+ "Classic & Interactive Toys",
2744
+ "Building Blocks & Board Games",
2745
+ "Balloons & Party Accessories",
2746
+ "Other"
2747
+ ],
2748
+ name: "Toys for All Ages"
2749
+ },
2750
+ {
2751
+ id: "pet-products-animal-goods",
2752
+ items: [
2753
+ "Natural Pet Foods",
2754
+ "Handmade Pet Accessories",
2755
+ "Livestock & Farm Supplies",
2756
+ "Other"
2757
+ ],
2758
+ name: "Pet Products & Animal Goods"
2759
+ }
2760
+ ]
2761
+ },
2762
+ {
2763
+ id: "health-wellness-selfcare",
2764
+ name: "Health, Wellness & Self-Care",
2765
+ subcategories: [
2766
+ {
2767
+ id: "natural-remedies-supplements",
2768
+ items: [
2769
+ "Vitamins, Minerals & Herbal Remedies",
2770
+ "Superfoods, Probiotics & Detox Teas",
2771
+ "Other"
2772
+ ],
2773
+ name: "Natural Remedies & Supplements"
2774
+ },
2775
+ {
2776
+ id: "organic-natural-products",
2777
+ items: [
2778
+ "Organic Produce, Honey, Nuts & Seeds",
2779
+ "Gluten-Free & Specialty Items",
2780
+ "Other"
2781
+ ],
2782
+ name: "Organic & Natural Products"
2783
+ },
2784
+ {
2785
+ id: "fitness-sports-nutrition",
2786
+ items: ["Protein Powders & Bars", "Sports & Energy Drinks", "Other"],
2787
+ name: "Fitness & Sports Nutrition"
2788
+ },
2789
+ {
2790
+ id: "mental-wellbeing-relaxation",
2791
+ items: [
2792
+ "Yoga, Meditation & Stress-Relief Tools",
2793
+ "Massage & Muscle Relaxers",
2794
+ "Motivational Books & Tools",
2795
+ "Other"
2796
+ ],
2797
+ name: "Mental Wellbeing & Relaxation"
2798
+ }
2799
+ ]
2800
+ },
2801
+ {
2802
+ id: "electronics-technology",
2803
+ name: "Electronics & Technology",
2804
+ subcategories: [
2805
+ {
2806
+ id: "electronic-devices-accessories",
2807
+ items: [
2808
+ "Refurbished & Used Electronics",
2809
+ "Smartphones & Gadgets",
2810
+ "Computers & Gaming Gear",
2811
+ "Photography & Audio Equipment",
2812
+ "Other"
2813
+ ],
2814
+ name: "Electronic Devices & Accessories"
2815
+ }
2816
+ ]
2817
+ },
2818
+ {
2819
+ id: "antiques-collectibles",
2820
+ name: "Antiques & Collectibles",
2821
+ subcategories: [
2822
+ {
2823
+ id: "antiques-vintage-furniture",
2824
+ items: [
2825
+ "Old Clocks, Paintings & Sculptures",
2826
+ "Coins, Stamps & Rare Books",
2827
+ "Antique & Vintage Furniture & Home Decor",
2828
+ "Other"
2829
+ ],
2830
+ name: "Antiques & Vintage Furniture"
2831
+ },
2832
+ {
2833
+ id: "historical-rare-items",
2834
+ items: [
2835
+ "War Relics & Military Medals",
2836
+ "Limited Edition Artworks & Memorabilia",
2837
+ "Other"
2838
+ ],
2839
+ name: "Historical & Rare Items"
2840
+ },
2841
+ {
2842
+ id: "collectible-toys-games",
2843
+ items: [
2844
+ "Limited Edition Figures & Retro Board Games",
2845
+ "Pop Culture & Sports Memorabilia",
2846
+ "Other"
2847
+ ],
2848
+ name: "Collectible Toys & Games"
2849
+ }
2850
+ ]
2851
+ }
2852
+ ];
2853
+ var categoryColors = {
2854
+ "antiques-collectibles": "#DE630A",
2855
+ "clothing-fashion": "#6A08C5",
2856
+ "electronics-technology": "#0303BE",
2857
+ "food-drinks": "#FF004D",
2858
+ "handmade-local-products": "#8E4827",
2859
+ "health-wellness-selfcare": "#7DFB03",
2860
+ "home-garden-household": "#006400",
2861
+ "toys-pets": "#3357FF"
2862
+ };
2863
+ export {
2864
+ EnumInviteStatus,
2865
+ EnumRegions,
2866
+ EnumRejectionPolicy,
2867
+ EnumRelationResource,
2868
+ EnumResourceType,
2869
+ EnumResourceTypeIcon,
2870
+ EnumUserLicence,
2871
+ EnumUserRole,
2872
+ GOOGLE_API_KEY,
2873
+ ImageTypeEnum,
2874
+ availableCategories,
2875
+ availableCityOptions,
2876
+ availableRegionOptions,
2877
+ availableRegionTypes,
2878
+ availableTagTypes,
2879
+ capitalizeFirstLetter,
2880
+ categoryColors,
2881
+ dateFormat,
2882
+ dateTimeSchema,
2883
+ defaultMarketFormValues,
2884
+ defaultRegion,
2885
+ defaultStallholderApplyFormValues,
2886
+ defaultStallholderFormValues,
2887
+ emailSchema,
2888
+ endDateAfterStartDateTest,
2889
+ endDateNotInPastTest,
2890
+ endTimeMustBeAfterStartTimeTest,
2891
+ forgotPasswordFields,
2892
+ forgotPasswordSchema,
2893
+ formatDate,
2894
+ formatTimestamp,
2895
+ getCurrentAndFutureDates,
2896
+ getFutureDatesAfterThreshold,
2897
+ globalDefaultValues,
2898
+ globalResourceSchema,
2899
+ locationSchema,
2900
+ loginFields,
2901
+ loginSchema,
2902
+ mapArrayToOptions,
2903
+ marketBasicInfoFields,
2904
+ marketEndDateFields,
2905
+ marketSchema,
2906
+ marketStartDateFields,
2907
+ packagingOptions,
2908
+ passwordSchema,
2909
+ paymentMethodOptions,
2910
+ producedIngOptions,
2911
+ profileFields,
2912
+ registerFields,
2913
+ registerSchema,
2914
+ rejectionPolicyOptions,
2915
+ removeTypename,
2916
+ resetPasswordFields,
2917
+ resetPasswordSchema,
2918
+ sortDatesByProximity,
2919
+ stallApplicationInfo,
2920
+ stallHolderSchema,
2921
+ stallholderApplyFormSchema,
2922
+ stallholderBasicInfoFields,
2923
+ stallholderElectricity,
2924
+ stallholderEndDateFields,
2925
+ stallholderFullAddress,
2926
+ stallholderGazebo,
2927
+ stallholderLocationDescription,
2928
+ stallholderMultiLocation,
2929
+ stallholderPackaging,
2930
+ stallholderPaymentMethod,
2931
+ stallholderPriceRange,
2932
+ stallholderProducedIn,
2933
+ stallholderStallSize,
2934
+ stallholderStartDateFields,
2935
+ stallholderTable,
2936
+ startDateNotInPastTest,
2937
+ startTimeCannotBeInPastTest,
2938
+ statusOptions,
2939
+ tagOptions,
2940
+ timeFormat,
2941
+ truncateText,
2942
+ useAddUserFavouriteResource,
2943
+ useCreateMarket,
2944
+ useCreateRelation,
2945
+ useCreateStallholder,
2946
+ useCreateStallholderApplyForm,
2947
+ useCreateUser,
2948
+ useDeleteMarket,
2949
+ useDeleteRelation,
2950
+ useDeleteStallholder,
2951
+ useForgotPassword,
2952
+ useGetMarket,
2953
+ useGetMarketRelations,
2954
+ useGetMarkets,
2955
+ useGetMarketsByRegion,
2956
+ useGetMarketsNearMe,
2957
+ useGetNotification,
2958
+ useGetRelation,
2959
+ useGetRelationByMarketAndStallholder,
2960
+ useGetResourceConnections,
2961
+ useGetStallholder,
2962
+ useGetStallholderApplyForm,
2963
+ useGetStallholderRelations,
2964
+ useGetStallholders,
2965
+ useGetStallholdersByRegion,
2966
+ useGetUser,
2967
+ useGetUserFavourites,
2968
+ useGetUserMarkets,
2969
+ useGetUserNotifications,
2970
+ useGetUsers,
2971
+ useLocationSearch,
2972
+ useLogin,
2973
+ useLoginForm,
2974
+ useMarketForm,
2975
+ useRegister,
2976
+ useRegisterForm,
2977
+ useRemoveUserFavouriteResource,
2978
+ useSearchMarkets,
2979
+ useSearchStallholders,
2980
+ useStallholderApplyForm,
2981
+ useStallholderForm,
2982
+ useUpdateMarket,
2983
+ useUpdateRelation,
2984
+ useUpdateStallholder,
2985
+ useUpdateStallholderApplyForm,
2986
+ useUpdateUser,
2987
+ useUserForm,
2988
+ useVerifyEmail,
2989
+ userSchema,
2990
+ validateEmailSchema
2991
+ };
2992
+ //# sourceMappingURL=index.mjs.map