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