@timardex/cluemart-shared 1.5.757 → 1.5.758

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.
@@ -1,827 +1,375 @@
1
1
  import {
2
- mapArrayToOptions
3
- } from "./chunk-UK4D5N3O.mjs";
2
+ gameScreenIdentifierList
3
+ } from "./chunk-GSOQZF6M.mjs";
4
4
  import {
5
- EnumFoodFlavor
5
+ EnumEventDateStatus,
6
+ EnumInviteStatus,
7
+ EnumPaymentMethod,
8
+ EnumRegions
6
9
  } from "./chunk-4SNW63TJ.mjs";
7
10
 
8
- // src/formFields/vendor/vendor.ts
9
- var vendorBasicInfoFields = [
10
- {
11
- helperText: "Business Name *",
12
- name: "name",
13
- placeholder: "Business Name"
14
- },
15
- {
16
- helperText: "Description *",
17
- isTextArea: true,
18
- name: "description",
19
- placeholder: "Description"
11
+ // src/utils/date.ts
12
+ import dayjs from "dayjs";
13
+ import customParseFormat from "dayjs/plugin/customParseFormat.js";
14
+ import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
15
+ import timezone from "dayjs/plugin/timezone.js";
16
+ import utc from "dayjs/plugin/utc.js";
17
+
18
+ // src/utils/utils.ts
19
+ var removeTypename = (obj) => {
20
+ if (obj instanceof Date) {
21
+ return obj;
20
22
  }
21
- ];
22
- var vendorFullAddress = {
23
- helperText: "Enter address",
24
- name: "fullAddress",
25
- placeholder: "Start typing to find address"
26
- };
27
- var vendorStartDateFields = [
28
- {
29
- dateMode: "date",
30
- helperText: "Start Date",
31
- name: "startDate",
32
- placeholder: "Start Date"
33
- },
34
- {
35
- dateMode: "time",
36
- helperText: "Start Time",
37
- name: "startTime",
38
- placeholder: "Start Time"
23
+ if (obj instanceof File) {
24
+ return obj;
39
25
  }
40
- ];
41
- var vendorEndDateFields = [
42
- {
43
- dateMode: "date",
44
- helperText: "End Date",
45
- name: "endDate",
46
- placeholder: "End Date"
47
- },
48
- {
49
- dateMode: "time",
50
- helperText: "End Time",
51
- name: "endTime",
52
- placeholder: "End Time"
26
+ if (isIsoDateString(obj)) {
27
+ return obj;
53
28
  }
54
- ];
55
- var vendorAvailability = [
56
- {
57
- name: "availability.school",
58
- placeholder: "School events"
59
- },
60
- {
61
- name: "availability.private",
62
- placeholder: "Private events"
63
- },
64
- {
65
- name: "availability.corporate",
66
- placeholder: "Corporate events"
29
+ if (Array.isArray(obj)) {
30
+ return obj.map(removeTypename);
67
31
  }
68
- ];
69
- var vendorLocationDescription = {
70
- helperText: "Description",
71
- isTextArea: true,
72
- name: "description",
73
- placeholder: "Description"
74
- };
75
- var vendorMenuFields = [
76
- {
77
- helperText: "Item name",
78
- name: "name",
79
- placeholder: "Item name"
80
- },
81
- {
82
- helperText: "Price",
83
- keyboardType: "decimal-pad",
84
- name: "price",
85
- placeholder: "Price"
86
- },
87
- {
88
- helperText: "Item Description",
89
- isTextArea: true,
90
- name: "description",
91
- placeholder: "Item Description"
32
+ if (obj !== null && typeof obj === "object") {
33
+ const { __typename, ...cleanedObj } = obj;
34
+ return Object.keys(cleanedObj).reduce((acc, key) => {
35
+ acc[key] = removeTypename(cleanedObj[key]);
36
+ return acc;
37
+ }, {});
92
38
  }
39
+ return obj;
40
+ };
41
+ var truncateText = (text, maxLength = 30) => {
42
+ return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
43
+ };
44
+ var mapArrayToOptions = (items) => items.map((item) => ({
45
+ label: item,
46
+ value: item
47
+ }));
48
+ var capitalizeFirstLetter = (str) => {
49
+ return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
50
+ };
51
+ var statusOptions = [
52
+ ...Object.values(EnumInviteStatus).map((status) => ({
53
+ label: status,
54
+ value: status
55
+ })).sort((a, b) => a.label.localeCompare(b.label))
56
+ // Sort the options alphabetically
93
57
  ];
94
- var productLabelGroups = [
95
- {
96
- category: "Food Sensitivity",
97
- items: [
98
- { abbreviation: "DF", fullName: "Dairy-Free" },
99
- { abbreviation: "EF", fullName: "Egg-Free" },
100
- { abbreviation: "GF", fullName: "Gluten-Free" },
101
- { abbreviation: "NF", fullName: "Nut-Free" }
102
- ]
103
- },
104
- {
105
- category: "Lifestyle",
106
- items: [
107
- { abbreviation: "KETO", fullName: "Keto-Friendly" },
108
- { abbreviation: "P", fullName: "Paleo" },
109
- { abbreviation: "V", fullName: "Vegan" },
110
- { abbreviation: "VG", fullName: "Vegetarian" },
111
- { abbreviation: "KID", fullName: "Kid-Friendly" },
112
- // Gyerekbarát
113
- { abbreviation: "PET", fullName: "Pet-Friendly Product" }
114
- // Állatok
115
- ]
116
- },
117
- {
118
- category: "Natural",
119
- items: [
120
- { abbreviation: "ECO", fullName: "Eco-Friendly" },
121
- { abbreviation: "ORGANIC", fullName: "Organic Product" },
122
- { abbreviation: "NAT", fullName: "Natural Product" },
123
- // Természetesség
124
- { abbreviation: "NPF", fullName: "Non-Pesticide / Chemical-Free" },
125
- { abbreviation: "PLN", fullName: "Plant-Based" }
126
- ]
127
- },
128
- {
129
- category: "Market Character",
130
- items: [
131
- { abbreviation: "HM", fullName: "Handmade" },
132
- { abbreviation: "LOC", fullName: "Local Product" },
133
- { abbreviation: "ART", fullName: "Artisan" },
134
- { abbreviation: "LTD", fullName: "Limited Edition" }
135
- ]
136
- },
137
- {
138
- category: "Cosmetic / Natural",
139
- items: [
140
- { abbreviation: "AROM", fullName: "Aromatherapy" },
141
- { abbreviation: "CRF", fullName: "Cruelty-Free" },
142
- { abbreviation: "HYPO", fullName: "Hypoallergenic" },
143
- { abbreviation: "BODY", fullName: "Body Care" }
144
- // Testápolás
145
- ]
146
- },
58
+ var availableRegionTypes = Object.values(EnumRegions);
59
+ var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
60
+ var paymentMethodOptions = mapArrayToOptions(
61
+ Object.values(EnumPaymentMethod)
62
+ );
63
+ function normalizeUrl(url) {
64
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
65
+ return `https://${url}`;
66
+ }
67
+ return url;
68
+ }
69
+ var licenseNiceNames = {
70
+ ["pro_event" /* PRO_EVENT */]: "Pro Event",
71
+ ["pro_vendor" /* PRO_VENDOR */]: "Pro Stallholder",
72
+ ["standard_event" /* STANDARD_EVENT */]: "Standard Event",
73
+ ["standard_vendor" /* STANDARD_VENDOR */]: "Standard Stallholder",
74
+ ["pro_plus_event" /* PRO_PLUS_EVENT */]: "Pro+Ads Event",
75
+ ["pro_plus_vendor" /* PRO_PLUS_VENDOR */]: "Pro+Ads Stallholder",
76
+ ["standard_partner" /* STANDARD_PARTNER */]: "Partner"
77
+ };
78
+ var cluemartSocialMedia = [
147
79
  {
148
- category: "Wellbeing",
149
- items: [
150
- { abbreviation: "CARE", fullName: "Health Support Product" },
151
- // Egészség / testi jóllét
152
- { abbreviation: "PHYS", fullName: "Physical Wellbeing" },
153
- // Fizikai jóllét
154
- { abbreviation: "MENTAL", fullName: "Mental Wellbeing" },
155
- // Mentális jóllét
156
- { abbreviation: "RELAX", fullName: "Relaxation Product" },
157
- // Relaxáció / lazítás
158
- { abbreviation: "SPIRIT", fullName: "Spiritual Wellbeing" }
159
- // Lelki jóllét
160
- ]
80
+ link: "https://www.facebook.com/ClueMartApp",
81
+ name: "facebook" /* FACEBOOK */
161
82
  },
162
83
  {
163
- category: "Tech & Digital",
164
- items: [
165
- { abbreviation: "TECH", fullName: "Technology Product" },
166
- // Technológia
167
- { abbreviation: "DIGI", fullName: "Digital Technology" }
168
- // Digitális technológia
169
- ]
84
+ link: "https://www.instagram.com/cluemart_app",
85
+ name: "instagram" /* INSTAGRAM */
170
86
  },
171
87
  {
172
- category: "Practical & Home",
173
- items: [
174
- { abbreviation: "PRAC", fullName: "Practical Solution" },
175
- // Praktikum
176
- { abbreviation: "HOME", fullName: "Home & Living" }
177
- // Otthon / lakókörnyezet
178
- ]
88
+ link: "https://www.tiktok.com/@cluemart",
89
+ name: "tiktok" /* TIKTOK */
179
90
  },
180
91
  {
181
- category: "Sustainability",
182
- items: [
183
- { abbreviation: "ZWP", fullName: "Zero-Waste Product" },
184
- { abbreviation: "SUST", fullName: "Sustainable Product" }
185
- // Fenntarthatóság
186
- ]
92
+ link: "https://www.youtube.com/@ClueMart-App-NZ",
93
+ name: "youtube" /* YOUTUBE */
187
94
  }
188
95
  ];
189
- var priceUnits = [
190
- { label: "Piece", value: "PIECE" },
191
- { label: "Portion", value: "PORTION" },
192
- { label: "Slice", value: "SLICE" },
193
- { label: "Cup", value: "CUP" },
194
- { label: "Bottle", value: "BOTTLE" },
195
- { label: "Can", value: "CAN" },
196
- { label: "Jar", value: "JAR" },
197
- { label: "Box", value: "BOX" },
198
- { label: "Pack", value: "PACK" },
199
- { label: "Bag", value: "BAG" },
200
- { label: "Bunch", value: "BUNCH" },
201
- { label: "Tray", value: "TRAY" },
202
- { label: "Punnet", value: "PUNNET" },
203
- { label: "Gr", value: "GRAM" },
204
- { label: "Kg", value: "KILOGRAM" },
205
- { label: "L", value: "LITRE" },
206
- { label: "Ml", value: "MILLILITRE" },
207
- { label: "Dozen", value: "DOZEN" },
208
- { label: "Half dozen", value: "HALF_DOZEN" }
209
- ];
210
-
211
- // src/formFields/vendor/vendorInfo.ts
212
- var vendorElectricity = {
213
- details: {
214
- helperText: "Please describe details e.g. amps, voltage, etc.",
215
- isTextArea: true,
216
- name: "requirements.electricity.details",
217
- placeholder: "Electricity requirements"
218
- },
219
- isRequired: {
220
- name: "requirements.electricity.isRequired",
221
- placeholder: "Do you require electricity?"
96
+ var IOS_URL = "https://apps.apple.com/nz/app/cluemart/id6747251008";
97
+ var ANDROID_URL = "https://play.google.com/store/apps/details?id=com.timardex.cluemart";
98
+ var DEFAULT_RESOURCES_RETURN_LIMIT = 1e3;
99
+ var DEFAULT_RESOURCES_RETURN_OFFSET = 0;
100
+ var CLUEMART_MAIN_DOMAIN_URL = "https://cluemart.co.nz";
101
+ var rewardNiceNames = {
102
+ ["mystery_joy_box" /* MYSTERY_JOY_BOX */]: {
103
+ name: "Mystery Joy Box",
104
+ points: 250
105
+ },
106
+ ["mystery_squeeze_box" /* MYSTERY_SQUEEZE_BOX */]: {
107
+ name: "Mystery Squeeze Box",
108
+ points: 350
109
+ },
110
+ ["mystery_deluxe_box" /* MYSTERY_DELUXE_BOX */]: {
111
+ name: "Mystery Deluxe Box",
112
+ points: 500
222
113
  }
223
114
  };
224
- var vendorGazebo = {
225
- details: {
226
- helperText: "Please describe details e.g. size, etc.",
227
- isTextArea: true,
228
- name: "requirements.gazebo.details",
229
- placeholder: "Gazebo requirements"
230
- },
231
- isRequired: {
232
- name: "requirements.gazebo.isRequired",
233
- placeholder: "Do you require Gazebo?"
234
- }
115
+ var PostTypeLabels = {
116
+ ["market_faces" /* MARKET_FACES */]: "Market Faces",
117
+ ["clue_bites" /* CLUE_BITES */]: "Clue Bites",
118
+ ["play_and_win" /* PLAY_AND_WIN */]: "Play & Win"
235
119
  };
236
- var vendorTable = {
237
- details: {
238
- helperText: "Please describe details e.g. size, etc.",
239
- isTextArea: true,
240
- name: "requirements.table.details",
241
- placeholder: "Table requirements"
242
- },
243
- isRequired: {
244
- name: "requirements.table.isRequired",
245
- placeholder: "Do you require Table?"
120
+
121
+ // src/utils/date.ts
122
+ var dateFormat = "DD-MM-YYYY";
123
+ var timeFormat = "HH:mm";
124
+ dayjs.extend(customParseFormat);
125
+ dayjs.extend(utc);
126
+ dayjs.extend(timezone);
127
+ dayjs.extend(isSameOrAfter);
128
+ var NZ_TZ = "Pacific/Auckland";
129
+ function toNZTime(date) {
130
+ return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
131
+ }
132
+ function nzStartOfDay(input) {
133
+ if (input == null) {
134
+ return dayjs().tz(NZ_TZ).startOf("day");
246
135
  }
247
- };
248
- var vendorPriceRange = {
249
- max: {
250
- helperText: "Product maximum price",
251
- name: "product.priceRange.max",
252
- placeholder: "Maximum price: "
253
- },
254
- min: {
255
- helperText: "Product minimum price",
256
- name: "product.priceRange.min",
257
- placeholder: "Minimum price: "
136
+ return dayjs.tz(input, NZ_TZ).startOf("day");
137
+ }
138
+ var formatDate = (dateStr, display = "datetime", timeStr) => {
139
+ const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
140
+ const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
141
+ const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
142
+ const formattedTime = dateTime.format("h:mm a");
143
+ switch (display) {
144
+ case "date":
145
+ return formattedDate;
146
+ case "time":
147
+ return formattedTime;
148
+ case "datetime":
149
+ return `${formattedDate} at ${formattedTime}`;
150
+ default:
151
+ return formattedDate;
258
152
  }
259
153
  };
260
- var vendorStallSize = {
261
- depth: {
262
- helperText: "Stall size in depth",
263
- name: "stallInfo.size.depth",
264
- placeholder: "Stall Depth: "
265
- },
266
- width: {
267
- helperText: "Stall size in width",
268
- name: "stallInfo.size.width",
269
- placeholder: "Stall Width: "
270
- }
154
+ var getCurrentAndFutureDates = (dates) => {
155
+ const now = dayjs();
156
+ return dates.filter((dateObj) => {
157
+ const dateTime = dayjs(
158
+ `${dateObj.startDate} ${dateObj.startTime}`,
159
+ `${dateFormat} ${timeFormat}`
160
+ );
161
+ return dateTime.isSameOrAfter(now);
162
+ });
271
163
  };
272
- var vendorPackaging = {
273
- helperText: "Select packaging type, you can select more than one",
274
- name: "product.packaging",
275
- placeholder: "Packaging type"
164
+ var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
165
+ const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
166
+ const dateTime = dayjs(
167
+ `${date.startDate} ${date.startTime}`,
168
+ `${dateFormat} ${timeFormat}`
169
+ );
170
+ return dateTime.isSameOrAfter(threshold);
276
171
  };
277
- var vendorProducedIn = {
278
- helperText: "Select where the product is produced, you can select more than one",
279
- name: "product.producedIn",
280
- placeholder: "Produced type"
172
+ var formatTimestamp = (timestamp) => {
173
+ const formattedDate = toNZTime(timestamp).format(dateFormat);
174
+ return formatDate(formattedDate, "date");
281
175
  };
282
- var vendorFoodFlavour = {
283
- helperText: "You can select more than one food flavour",
284
- name: "product.foodFlavors",
285
- placeholder: "Food flavours"
176
+ var isIsoDateString = (value) => {
177
+ return typeof value === "string" && !Number.isNaN(Date.parse(value));
286
178
  };
287
- var vendorCompliance = [
288
- {
289
- name: "compliance.liabilityInsurance",
290
- placeholder: "Liability Insurance"
291
- },
292
- {
293
- name: "compliance.foodBeverageLicense",
294
- placeholder: "Food and Beverage License"
179
+ function sortDatesChronologically(dates) {
180
+ if (!dates?.length) {
181
+ return [];
295
182
  }
296
- ];
297
- var packagingTypes = [
298
- "Biodegradable",
299
- "Compostable",
300
- "Fabric",
301
- "Glass",
302
- "Other",
303
- "Paper",
304
- "Plastic",
305
- "Recyclable",
306
- "Reusable",
307
- "Single-use",
308
- "Wood"
309
- ];
310
- var producedIngTypes = [
311
- "Commercial Kitchen",
312
- "Home Premises",
313
- "Factory",
314
- "Farm",
315
- "Other"
316
- ];
317
- var packagingOptions = mapArrayToOptions(packagingTypes);
318
- var producedIngOptions = mapArrayToOptions(producedIngTypes);
319
- var foodFlavourOptions = Object.values(
320
- EnumFoodFlavor
321
- ).map((flavour) => ({
322
- label: flavour.replaceAll("_", " "),
323
- value: flavour
183
+ return [...dates].sort((a, b) => {
184
+ const dateTimeFormat = `${dateFormat} ${timeFormat}`;
185
+ const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
186
+ const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
187
+ return dateA.valueOf() - dateB.valueOf();
188
+ });
189
+ }
190
+ var futureTimePeriods = mapArrayToOptions(
191
+ Object.values(EnumEventDateStatus)
192
+ ).filter(
193
+ (period) => period.value !== "Starting_Soon" /* STARTING_SOON */ && period.value !== "Canceled" /* CANCELED */ && period.value !== "Rescheduled" /* RE_SCHEDULED */ && period.value !== "Started" /* STARTED */ && period.value !== "Ended" /* ENDED */ && period.value !== "Invalid" /* INVALID */
194
+ ).map((period) => ({
195
+ label: period.value.replaceAll("_", " "),
196
+ value: period.value
324
197
  }));
325
198
 
326
- // src/formFields/event/event.ts
327
- var eventBasicInfoFields = [
328
- {
329
- helperText: "Name of the Event *",
330
- name: "name",
331
- placeholder: "Name"
332
- },
333
- {
334
- helperText: "NZBN number (required \u2013 ClueMart only accepts events with valid NZBN number) *",
335
- keyboardType: "number-pad",
336
- name: "nzbn",
337
- placeholder: "NZBN number"
338
- },
339
- {
340
- helperText: "Name of the Provider (if applicable)",
341
- name: "provider",
342
- placeholder: "Provider"
343
- },
344
- {
345
- helperText: "Description of the Event *",
346
- isTextArea: true,
347
- name: "description",
348
- placeholder: "Description"
199
+ // src/utils/dailyClueGame.ts
200
+ function createSeededRng(seed) {
201
+ let t = seed >>> 0;
202
+ return function random() {
203
+ t += 1831565813;
204
+ let x = t;
205
+ x = Math.imul(x ^ x >>> 15, x | 1);
206
+ x ^= x + Math.imul(x ^ x >>> 7, x | 61);
207
+ return ((x ^ x >>> 14) >>> 0) / 4294967296;
208
+ };
209
+ }
210
+ function hashStringToNumber(seed) {
211
+ let hash = 2166136261;
212
+ for (let i = 0; i < seed.length; i++) {
213
+ hash ^= seed.codePointAt(i) ?? 0;
214
+ hash = Math.imul(hash, 16777619);
349
215
  }
350
- ];
351
- var eventStartDateFields = [
352
- {
353
- dateMode: "date",
354
- helperText: "Start Date of the Event *",
355
- name: "startDate",
356
- placeholder: "Start Date"
357
- },
358
- {
359
- dateMode: "time",
360
- helperText: "Start Time of the Event *",
361
- name: "startTime",
362
- placeholder: "Start Time"
363
- }
364
- ];
365
- var eventEndDateFields = [
366
- {
367
- dateMode: "date",
368
- helperText: "End Date of the Event *",
369
- name: "endDate",
370
- placeholder: "End Date"
371
- },
372
- {
373
- dateMode: "time",
374
- helperText: "End Time of the Event *",
375
- name: "endTime",
376
- placeholder: "End Time"
216
+ return hash >>> 0;
217
+ }
218
+ function seededShuffle(array, seed) {
219
+ const rng = createSeededRng(hashStringToNumber(seed));
220
+ const result = [...array];
221
+ for (let i = result.length - 1; i > 0; i--) {
222
+ const j = Math.floor(rng() * (i + 1));
223
+ [result[i], result[j]] = [result[j], result[i]];
377
224
  }
378
- ];
379
- var availableTagTypes = [
380
- { icon: "human-male-female-child", label: "All Ages" },
381
- { icon: "weather-sunny", label: "Day Market" },
382
- { icon: "account-child", label: "Family Friendly" },
383
- { icon: "ticket-percent", label: "Free Entry" },
384
- { icon: "home-city", label: "Indoor Market" },
385
- { icon: "music", label: "Live Music" },
386
- { icon: "bus", label: "Near Bustop" },
387
- { icon: "slide", label: "Near Playground" },
388
- { icon: "train", label: "Near Train Station" },
389
- { icon: "weather-night", label: "Night Market" },
390
- { icon: "tree", label: "Outdoor Market" },
391
- { icon: "car", label: "Parking Available" },
392
- { icon: "dog", label: "Pet Friendly" },
393
- { icon: "ship-wheel", label: "Port Nearby" },
394
- { icon: "toilet", label: "Toilet Available" },
395
- { icon: "wheelchair-accessibility", label: "Wheelchair Accessible" }
396
- ];
397
- var tagOptions = availableTagTypes.map((tag) => ({
398
- label: tag.label,
399
- value: tag.label
400
- }));
401
-
402
- // src/formFields/event/eventInfo.ts
403
- var eventInfo = [
404
- {
405
- helperText: "Application Deadline (hours before event start) *",
406
- keyboardType: "number-pad",
407
- name: "applicationDeadlineHours",
408
- placeholder: "Application Deadline (in hours)"
409
- },
410
- {
411
- helperText: "Payment Due (hours after application or invitation acceptance) *",
412
- keyboardType: "number-pad",
413
- name: "paymentDueHours",
414
- placeholder: "Payment Due (in hours)"
415
- },
416
- {
417
- helperText: "Pack-In Time (hours before event start) *",
418
- keyboardType: "number-pad",
419
- name: "packInTime",
420
- placeholder: "Pack In Time (in hours)"
225
+ return result;
226
+ }
227
+ function getDayIndex(start, today) {
228
+ return today.diff(start, "day");
229
+ }
230
+ function computeDailyClueState(dailyClue) {
231
+ const { startDate, endDate } = dailyClue.gameFields.gameDate;
232
+ const { solutionShuffled, collected } = dailyClue.letterInfo;
233
+ const today = nzStartOfDay();
234
+ const start = nzStartOfDay(startDate);
235
+ const end = nzStartOfDay(endDate);
236
+ if (today.isBefore(start)) {
237
+ return null;
421
238
  }
422
- ];
423
- var eventInfoPaymentInfo = [
424
- {
425
- helperText: "Account holder name *",
426
- name: "accountHolderName",
427
- placeholder: "Account holder name"
428
- },
429
- {
430
- helperText: "Account number *",
431
- keyboardType: "number-pad",
432
- name: "accountNumber",
433
- placeholder: "Account number"
434
- },
435
- {
436
- helperText: "Payment link, where applicants can pay *",
437
- keyboardType: "url",
438
- name: "link",
439
- placeholder: "Payment link"
239
+ const shuffledPlacements = seededShuffle(
240
+ gameScreenIdentifierList,
241
+ start.toISOString()
242
+ );
243
+ const index = getDayIndex(start, today);
244
+ if (today.isAfter(end)) {
245
+ return {
246
+ todaysClue: null,
247
+ todaysLetter: null,
248
+ todaysPlacement: null
249
+ };
440
250
  }
441
- ];
442
- var requirementsOptions = [
443
- {
444
- category: "Environment",
445
- label: "All packaging must be eco-friendly or recyclable where possible.",
446
- value: false
447
- },
448
- {
449
- category: "Environment",
450
- label: "No single-use plastic bags are to be handed out.",
451
- value: false
452
- },
453
- {
454
- category: "Environment",
455
- label: "Stall area must be left clean with no trace of activity after pack-down.",
456
- value: false
457
- },
458
- {
459
- category: "Environment",
460
- label: "No disposal of oils, fats, or chemicals in public drains or on grassed areas.",
461
- value: false
462
- },
463
- {
464
- category: "Environment",
465
- label: "You must provide bins at your site for rubbish and recycling, and take away all bins including rubbish, to dispose of outside of the town centre.",
466
- value: false
467
- },
468
- {
469
- category: "Food Safety",
470
- label: "Food must be prepared and stored according to your food regulation.",
471
- value: false
472
- },
473
- {
474
- category: "Food Safety",
475
- label: "The stallholder must display a current food grade certificate.",
476
- value: false
477
- },
478
- {
479
- category: "Food Safety",
480
- label: "Only licensed food vendors may sell ready-to-eat food items.",
481
- value: false
482
- },
483
- {
484
- category: "Food Safety",
485
- label: "Handwashing facilities must be available at your stall if preparing food.",
486
- value: false
487
- },
488
- {
489
- category: "Food Safety",
490
- label: "You must have a food safety plan in place for your stall.",
491
- value: false
492
- },
493
- {
494
- category: "Food Safety",
495
- label: "Allergens must be clearly listed on packaged and unpackaged food items.",
496
- value: false
497
- },
498
- {
499
- category: "Legal & Safety",
500
- label: "All stallholders must comply with local council regulations.",
501
- value: false
502
- },
503
- {
504
- category: "Legal & Safety",
505
- label: "No unauthorised subletting of stall space to other vendors.",
506
- value: false
507
- },
508
- {
509
- category: "Legal & Safety",
510
- label: "Gas bottles and fuel containers must be secured and in good condition if applicable.",
511
- value: false
512
- },
513
- {
514
- category: "Legal & Safety",
515
- label: "Fire extinguishers must be available for stalls using cooking or heating equipment.",
516
- value: false
517
- },
518
- {
519
- category: "Legal & Safety",
520
- label: "Stallholders must not sell items that are illegal or prohibited by law.",
521
- value: false
522
- },
523
- {
524
- category: "Legal & Safety",
525
- label: "All electrical equipment must be tested and tagged.",
526
- value: false
527
- },
528
- {
529
- category: "Legal & Safety",
530
- label: "Noise levels must be kept to a minimum unless part of a permitted performance.",
531
- value: false
532
- },
533
- {
534
- category: "Legal & Safety",
535
- label: "Pets at the stall must be secured and well-behaved at all times.",
536
- value: false
537
- },
538
- {
539
- category: "Legal & Safety",
540
- label: "Cables must be secured and not create tripping hazards.",
541
- value: false
542
- },
543
- {
544
- category: "Legal & Safety",
545
- label: "Stalls must not obstruct emergency access routes.",
546
- value: false
547
- },
548
- {
549
- category: "Legal & Safety",
550
- label: "First aid kit must be available at the stall for minor injuries.",
551
- value: false
552
- },
553
- {
554
- category: "Legal & Safety",
555
- label: "Stallholders must hold valid liability insurance where required.",
556
- value: false
557
- },
558
- {
559
- category: "Legal & Safety",
560
- label: "You must secure your gazebo and equipment to withstand wind or bad weather.",
561
- value: false
562
- },
563
- {
564
- category: "Legal & Safety",
565
- label: "You are responsible for the safety of your setup and any potential hazards.",
566
- value: false
567
- },
568
- {
569
- category: "Operations",
570
- label: "Generators must be quiet and pre-approved by the event organiser.",
571
- value: false
572
- },
573
- {
574
- category: "Operations",
575
- label: "Only approved products or services may be sold \u2014 no last-minute changes.",
576
- value: false
577
- },
578
- {
579
- category: "Operations",
580
- label: "Stallholders must arrive and be fully set up by the designated opening time.",
581
- value: false
582
- },
583
- {
584
- category: "Operations",
585
- label: "You may not pack down your stall before the event officially ends.",
586
- value: false
587
- },
588
- {
589
- category: "Operations",
590
- label: "You must be self-sufficient in all operations.",
591
- value: false
592
- },
593
- {
594
- category: "Operations",
595
- label: "Stall layout must be kept within your allocated space.",
596
- value: false
251
+ if (index < 0 || index >= solutionShuffled.length || index >= shuffledPlacements.length) {
252
+ return null;
597
253
  }
598
- ];
599
- var stallTypes = [
600
- "1.8m table only",
601
- "2x2m mini stall",
602
- "3x3m tent site",
603
- "Corner stall",
604
- "Craft stall with power",
605
- "Craft stall without power",
606
- "Double stall (6x3m)",
607
- "Food truck site",
608
- "Food vendor with power",
609
- "Food vendor without power",
610
- "Inside hall stall",
611
- "Non-profit/community stall",
612
- "Outdoor open area",
613
- "Shared table space",
614
- "Wall-based vendor",
615
- "Workshop/seating area"
616
- ];
617
- var stallTypeOptions = stallTypes.map((type) => ({
618
- label: type,
619
- price: 0,
620
- stallCapacity: 0
621
- }));
622
- var refundPolicyOptions = [
623
- {
624
- category: "Cancelled by Vendor",
625
- label: "Full refund if cancelled 30+ days before the event.",
626
- value: false
627
- },
628
- {
629
- category: "Cancelled by Vendor",
630
- label: "50% refund if cancelled 14\u201329 days before the event.",
631
- value: false
632
- },
633
- {
634
- category: "Cancelled by Vendor",
635
- label: "No refund if cancelled less than 14 days before the event.",
636
- value: false
637
- },
638
- {
639
- category: "Cancelled by Vendor",
640
- label: "Full refund if cancelled due to illness or emergency.",
641
- value: false
642
- },
643
- {
644
- category: "Cancelled by Vendor",
645
- label: "No refund for no-shows or last-minute cancellations.",
646
- value: false
647
- },
648
- {
649
- category: "Cancelled by Vendor",
650
- label: "No refund",
651
- value: false
652
- },
653
- {
654
- category: "Cancelled by Organiser",
655
- label: "Full refund if the event is cancelled by the organiser.",
656
- value: false
657
- },
658
- {
659
- category: "Cancelled by Organiser",
660
- label: "Credit towards a future event if cancelled by the organiser.",
661
- value: false
662
- },
663
- {
664
- category: "Cancelled by Organiser",
665
- label: "Refund only in cases of force majeure (e.g., natural disasters, government restrictions).",
666
- value: false
667
- },
668
- {
669
- category: "Cancelled by Organiser",
670
- label: "No refund",
671
- value: false
254
+ const letterToday = solutionShuffled[index];
255
+ const placement = shuffledPlacements[index];
256
+ if (!letterToday || !placement) return null;
257
+ const alreadyCollectedToday = (collected ?? []).includes(letterToday);
258
+ if (alreadyCollectedToday) {
259
+ return {
260
+ todaysClue: null,
261
+ todaysLetter: null,
262
+ todaysPlacement: null
263
+ };
672
264
  }
673
- ];
265
+ return {
266
+ todaysClue: placement.clue,
267
+ todaysLetter: letterToday,
268
+ todaysPlacement: placement.id
269
+ };
270
+ }
674
271
 
675
- // src/formFields/global.ts
676
- var emailField = {
677
- helperText: "Enter email address",
678
- keyboardType: "email-address",
679
- name: "email",
680
- placeholder: "Email"
272
+ // src/utils/school.ts
273
+ var SCHOOL_MIN_STUDENT_COUNT = 300;
274
+ var SCHOOL_MAX_STUDENT_COUNT = 0;
275
+
276
+ // src/utils/eventDateStatus.ts
277
+ var EVENT_DATE_STATUS_PERIOD_MAP = {
278
+ ["Today" /* TODAY */]: [
279
+ "Started" /* STARTED */,
280
+ "Starting_Soon" /* STARTING_SOON */,
281
+ "Today" /* TODAY */
282
+ ],
283
+ ["This_Week" /* THIS_WEEK */]: [
284
+ "Started" /* STARTED */,
285
+ "Starting_Soon" /* STARTING_SOON */,
286
+ "This_Week" /* THIS_WEEK */,
287
+ "Today" /* TODAY */,
288
+ "Tomorrow" /* TOMORROW */
289
+ ]
681
290
  };
682
- var companyContactFields = [
683
- {
684
- ...emailField,
685
- name: "contactDetails.email"
686
- },
687
- {
688
- helperText: "Enter your mobile phone number",
689
- keyboardType: "phone-pad",
690
- name: "contactDetails.mobilePhone",
691
- placeholder: "Mobile Phone Number"
692
- },
693
- {
694
- helperText: "Enter your landline phone number",
695
- keyboardType: "phone-pad",
696
- name: "contactDetails.landlinePhone",
697
- placeholder: "Landline Phone Number"
698
- }
699
- ];
291
+ function getAllowedEventDateStatuses(period) {
292
+ return EVENT_DATE_STATUS_PERIOD_MAP[period] ?? [period];
293
+ }
294
+ function eventMatchesDateStatusPeriod(dateTime, period) {
295
+ const allowedStatuses = getAllowedEventDateStatuses(period);
296
+ return dateTime?.some((dt) => allowedStatuses.includes(dt.dateStatus)) ?? false;
297
+ }
298
+ function filterEventsByDateStatusPeriod(events, period) {
299
+ return events.filter(
300
+ (event) => eventMatchesDateStatusPeriod(event.dateTime, period)
301
+ );
302
+ }
700
303
 
701
- // src/formFields/auth.ts
702
- var loginFields = [
703
- {
704
- ...emailField,
705
- required: true
706
- },
707
- {
708
- helperText: "Enter password",
709
- keyboardType: "default",
710
- name: "password",
711
- placeholder: "Password",
712
- required: true,
713
- secureTextEntry: true
714
- }
715
- ];
716
- var registerFields = [
717
- {
718
- helperText: "Enter first name",
719
- keyboardType: "default",
720
- name: "firstName",
721
- placeholder: "First Name",
722
- required: true
723
- },
724
- {
725
- helperText: "Enter last name",
726
- keyboardType: "default",
727
- name: "lastName",
728
- placeholder: "Last Name",
729
- required: true
730
- },
731
- {
732
- ...emailField,
733
- required: true
734
- },
735
- {
736
- helperText: "Enter password",
737
- keyboardType: "default",
738
- name: "password",
739
- placeholder: "Password",
740
- required: true,
741
- secureTextEntry: true
742
- },
743
- {
744
- helperText: "Promotional code (optional)",
745
- keyboardType: "default",
746
- name: "promoCode",
747
- placeholder: "Promotional Code",
748
- required: false
749
- }
750
- ];
751
- var requestPasswordResetFields = [
752
- {
753
- ...emailField,
754
- helperText: "Enter email address to reset your password",
755
- required: true
756
- }
757
- ];
758
- var resetPasswordFields = [
759
- {
760
- helperText: "Enter your new password",
761
- keyboardType: "default",
762
- name: "password",
763
- placeholder: "Password",
764
- required: true,
765
- secureTextEntry: true
766
- },
767
- {
768
- helperText: "Confirm your new password",
769
- keyboardType: "default",
770
- name: "confirmPassword",
771
- placeholder: "Confirm Password",
772
- required: true,
773
- secureTextEntry: true
304
+ // src/calendar/eventCalendar.ts
305
+ import dayjs2 from "dayjs";
306
+ var KNOWN_EVENT_SCHEDULE_STATUSES = /* @__PURE__ */ new Set([
307
+ "Started" /* STARTED */,
308
+ "Starting_Soon" /* STARTING_SOON */,
309
+ "Ended" /* ENDED */
310
+ ]);
311
+ function toCalendarIsoDate(startDate) {
312
+ const formatted = dayjs2(startDate, dateFormat).format("YYYY-MM-DD");
313
+ return dayjs2(formatted, "YYYY-MM-DD", true).isValid() ? formatted : null;
314
+ }
315
+ function fromCalendarIsoDate(isoDate) {
316
+ return dayjs2(isoDate, "YYYY-MM-DD").format(dateFormat);
317
+ }
318
+ function getEventCalendarIsoDates(dateTimes) {
319
+ return dateTimes?.map((dateTime) => toCalendarIsoDate(dateTime.startDate)).filter((date) => Boolean(date)) ?? [];
320
+ }
321
+ function findEventDateTimeByIsoDate(dateTimes, isoDate) {
322
+ const selected = fromCalendarIsoDate(isoDate);
323
+ return dateTimes?.find((dateTime) => dateTime.startDate === selected) ?? null;
324
+ }
325
+ function buildCalendarSheetContentData(dateTimes, isoDate, location, resourceId, resourceType) {
326
+ const dateTime = findEventDateTimeByIsoDate(dateTimes, isoDate);
327
+ if (!dateTime) {
328
+ return null;
774
329
  }
775
- ];
776
- var validateVerificationTokenFields = [
777
- {
778
- ...emailField,
779
- disabled: true,
780
- helperText: "Your email address"
781
- },
782
- {
783
- helperText: "Enter the Verification code sent to you by email",
784
- keyboardType: "number-pad",
785
- name: "verificationToken",
786
- placeholder: "Verification code",
787
- required: true
330
+ return {
331
+ dateTime,
332
+ location,
333
+ resourceId,
334
+ resourceType
335
+ };
336
+ }
337
+ function getEventScheduleStatusTone(status) {
338
+ switch (status) {
339
+ case "Started" /* STARTED */:
340
+ return "started";
341
+ case "Starting_Soon" /* STARTING_SOON */:
342
+ return "startingSoon";
343
+ case "Ended" /* ENDED */:
344
+ return "ended";
345
+ default:
346
+ return "default";
788
347
  }
789
- ];
790
-
791
- // src/formFields/user.ts
792
- var profileFields = [
793
- {
794
- ...emailField,
795
- disabled: true,
796
- helperText: "Email cannot be changed"
797
- },
798
- {
799
- helperText: "Enter first name",
800
- keyboardType: "default",
801
- name: "firstName",
802
- placeholder: "First Name"
803
- },
804
- {
805
- helperText: "Enter last name",
806
- keyboardType: "default",
807
- name: "lastName",
808
- placeholder: "Last Name"
809
- },
810
- {
811
- helperText: "Enter your new password",
812
- keyboardType: "default",
813
- name: "password",
814
- placeholder: "Password",
815
- secureTextEntry: true
816
- },
817
- {
818
- helperText: "Confirm your new password",
819
- keyboardType: "default",
820
- name: "confirmPassword",
821
- placeholder: "Confirm Password",
822
- secureTextEntry: true
348
+ }
349
+ function getEventScheduleStatusPresentation(dateTime) {
350
+ return {
351
+ status: dateTime.dateStatus,
352
+ statusLabel: dateTime.dateStatus.replaceAll("_", " ").toLowerCase(),
353
+ tone: getEventScheduleStatusTone(dateTime.dateStatus)
354
+ };
355
+ }
356
+ function getEventScheduleStatusLabel(dateTime, onlyShowKnownStatuses) {
357
+ const { dateStatus: status } = dateTime;
358
+ const isKnownStatus = Boolean(
359
+ status && KNOWN_EVENT_SCHEDULE_STATUSES.has(status)
360
+ );
361
+ if (onlyShowKnownStatuses && !isKnownStatus) {
362
+ return null;
823
363
  }
824
- ];
364
+ return isKnownStatus ? status.replaceAll("_", " ").toLowerCase() : `Next event date: ${formatDate(dateTime.startDate, "date")}`;
365
+ }
366
+ function shouldShowEventActionsWithWeather(resourceType, dateTime, location) {
367
+ return resourceType === "event" /* EVENT */ && Boolean(location) && Boolean(dateTime?.dateStatus) && ![
368
+ "Ended" /* ENDED */,
369
+ "Canceled" /* CANCELED */,
370
+ "Started" /* STARTED */
371
+ ].includes(dateTime.dateStatus);
372
+ }
825
373
 
826
374
  // src/formFields/categories/clothingAndFashion.ts
827
375
  var clothingAndFashion = [
@@ -1818,138 +1366,248 @@ var availableCategories = assignColorToCategories([
1818
1366
  ...serviceAndExperience
1819
1367
  ]);
1820
1368
 
1821
- // src/formFields/socialMedia.ts
1822
- var socialMedia = [
1823
- {
1824
- key: "facebook",
1825
- name: "Facebook",
1826
- placeholder: "https://www.facebook.com/your-page"
1827
- },
1828
- {
1829
- key: "instagram",
1830
- name: "Instagram",
1831
- placeholder: "https://www.instagram.com/your-profile"
1832
- },
1833
- {
1834
- key: "tiktok",
1835
- name: "TikTok",
1836
- placeholder: "https://www.tiktok.com/@your-profile"
1837
- },
1838
- {
1839
- key: "twitter",
1840
- name: "Twitter",
1841
- placeholder: "https://twitter.com/your-profile"
1842
- },
1843
- {
1844
- key: "website",
1845
- name: "Website",
1846
- placeholder: "https://www.yourwebsite.com"
1847
- },
1848
- {
1849
- key: "youtube",
1850
- name: "YouTube",
1851
- placeholder: "https://www.youtube.com/channel/your-channel"
1369
+ // src/eventStallholders/eventStallholderFilters.ts
1370
+ function eventStartDatesSet(dateTime) {
1371
+ return new Set((dateTime ?? []).map((date) => date.startDate));
1372
+ }
1373
+ function hasMatchingEventDate(vendorStartDates, eventStartDates) {
1374
+ return vendorStartDates.some((startDate) => eventStartDates.has(startDate));
1375
+ }
1376
+ function matchesSelectedDate(vendorStartDates, selectedDate) {
1377
+ if (!selectedDate) {
1378
+ return true;
1852
1379
  }
1853
- ];
1854
- var socialMediaFields = socialMedia.map((link) => ({
1855
- helperText: link.name,
1856
- keyboardType: "url",
1857
- name: link.key,
1858
- placeholder: link.placeholder
1859
- }));
1860
-
1861
- // src/formFields/contactUs.ts
1862
- var contactUsFields = [
1863
- {
1864
- helperText: "Enter first name *",
1865
- keyboardType: "default",
1866
- name: "firstName",
1867
- placeholder: "First Name"
1868
- },
1869
- {
1870
- helperText: "Enter last name *",
1871
- keyboardType: "default",
1872
- name: "lastName",
1873
- placeholder: "Last Name"
1874
- },
1875
- {
1876
- ...emailField,
1877
- helperText: "Enter email address *"
1878
- },
1879
- {
1880
- helperText: "Enter your message *",
1881
- isTextArea: true,
1882
- keyboardType: "default",
1883
- name: "message",
1884
- placeholder: "Message"
1380
+ return vendorStartDates.includes(selectedDate);
1381
+ }
1382
+ function matchesCategory(categoryNames, selectedCategory) {
1383
+ if (!selectedCategory) {
1384
+ return true;
1885
1385
  }
1886
- ];
1386
+ return categoryNames.includes(selectedCategory);
1387
+ }
1388
+ function getRegisteredVendorStartDates(vendor) {
1389
+ const relations = vendor.relations ?? [];
1390
+ return relations.flatMap(
1391
+ (relation) => (relation.relationDates ?? []).map(
1392
+ (relationDate) => relationDate.dateTime.startDate
1393
+ )
1394
+ );
1395
+ }
1396
+ function getRegisteredVendorCategoryNames(vendor) {
1397
+ return (vendor.categories ?? []).map((category) => category.name);
1398
+ }
1399
+ function getUnregisteredVendorStartDates(vendor) {
1400
+ return (vendor.invitations ?? []).flatMap(
1401
+ (invitation) => invitation.dateTime.map((date) => date.startDate)
1402
+ );
1403
+ }
1404
+ function getUnregisteredVendorCategoryNames(vendor) {
1405
+ return availableCategories.filter(
1406
+ (category) => category.id && vendor.categoryIds.includes(category.id)
1407
+ ).map((category) => category.name);
1408
+ }
1409
+ function filterRegisteredVendorsForEvent(vendors, eventStartDates, selectedDate, selectedCategory) {
1410
+ if (!vendors) {
1411
+ return [];
1412
+ }
1413
+ return vendors.filter((vendor) => {
1414
+ const startDates = getRegisteredVendorStartDates(vendor);
1415
+ return hasMatchingEventDate(startDates, eventStartDates) && matchesSelectedDate(startDates, selectedDate) && matchesCategory(
1416
+ getRegisteredVendorCategoryNames(vendor),
1417
+ selectedCategory
1418
+ );
1419
+ });
1420
+ }
1421
+ function filterUnregisteredVendorsForEvent(vendors, eventStartDates, selectedDate, selectedCategory) {
1422
+ return vendors.filter((vendor) => {
1423
+ const startDates = getUnregisteredVendorStartDates(vendor);
1424
+ return hasMatchingEventDate(startDates, eventStartDates) && matchesSelectedDate(startDates, selectedDate) && matchesCategory(
1425
+ getUnregisteredVendorCategoryNames(vendor),
1426
+ selectedCategory
1427
+ );
1428
+ });
1429
+ }
1430
+ function filterRegisteredVendorsByEventDatesOnly(vendors, eventStartDates) {
1431
+ if (!vendors) {
1432
+ return [];
1433
+ }
1434
+ return vendors.filter(
1435
+ (vendor) => hasMatchingEventDate(
1436
+ getRegisteredVendorStartDates(vendor),
1437
+ eventStartDates
1438
+ )
1439
+ );
1440
+ }
1441
+ function filterUnregisteredVendorsByEventDatesOnly(vendors, eventStartDates) {
1442
+ return vendors.filter(
1443
+ (vendor) => hasMatchingEventDate(
1444
+ getUnregisteredVendorStartDates(vendor),
1445
+ eventStartDates
1446
+ )
1447
+ );
1448
+ }
1449
+ function collectStallholderStartDates(registeredVendors, unregisteredVendors = []) {
1450
+ return [
1451
+ ...registeredVendors.flatMap(getRegisteredVendorStartDates),
1452
+ ...unregisteredVendors.flatMap(getUnregisteredVendorStartDates)
1453
+ ];
1454
+ }
1455
+ function getEventDatesWithStallholders(eventDateTime, stallholderStartDates) {
1456
+ if (!eventDateTime?.length) {
1457
+ return [];
1458
+ }
1459
+ const startDates = new Set(stallholderStartDates);
1460
+ return sortDatesChronologically(
1461
+ eventDateTime.filter((date) => startDates.has(date.startDate))
1462
+ );
1463
+ }
1464
+ function getStallholderCategoryNames(registeredVendors, unregisteredVendors = []) {
1465
+ const names = [
1466
+ ...registeredVendors.flatMap(getRegisteredVendorCategoryNames),
1467
+ ...unregisteredVendors.flatMap(getUnregisteredVendorCategoryNames)
1468
+ ];
1469
+ return Array.from(new Set(names));
1470
+ }
1471
+ function getStallholderCategoryOptions(registeredVendors, unregisteredVendors = []) {
1472
+ return getStallholderCategoryNames(
1473
+ registeredVendors,
1474
+ unregisteredVendors
1475
+ ).map((name) => ({
1476
+ label: name,
1477
+ value: name
1478
+ }));
1479
+ }
1480
+ function getEventStallholderEmptyMessage(hasAnyStallholdersForEvent, selectedDate) {
1481
+ return hasAnyStallholdersForEvent && selectedDate ? "No stallholders found for this event date." : "No stallholders found for this event.";
1482
+ }
1887
1483
 
1888
- // src/formFields/partner.ts
1889
- var partnerBasicInfoFields = [
1890
- {
1891
- helperText: "Business Name *",
1892
- name: "name",
1893
- placeholder: "Business Name"
1894
- },
1895
- {
1896
- helperText: "NZBN number (required \u2013 ClueMart only accepts partners with valid NZBN number) *",
1897
- keyboardType: "number-pad",
1898
- name: "nzbn",
1899
- placeholder: "NZBN number"
1900
- },
1901
- {
1902
- helperText: "Description *",
1903
- isTextArea: true,
1904
- name: "description",
1905
- placeholder: "Description"
1484
+ // src/vendorEvents/vendorEventFilters.ts
1485
+ function relationHasSelectedDate(relation, selectedDate) {
1486
+ return relation.relationDates?.some(
1487
+ (date) => date.dateTime.startDate === selectedDate
1488
+ ) ?? false;
1489
+ }
1490
+ function eventHasSelectedDate(event, selectedDate) {
1491
+ return event.relations?.some(
1492
+ (relation) => relationHasSelectedDate(relation, selectedDate)
1493
+ ) ?? false;
1494
+ }
1495
+ function filterVendorEventsBySelectedDate(events, selectedDate) {
1496
+ if (!events) {
1497
+ return [];
1906
1498
  }
1907
- ];
1499
+ if (!selectedDate) {
1500
+ return events;
1501
+ }
1502
+ return events.filter((event) => eventHasSelectedDate(event, selectedDate));
1503
+ }
1504
+ function collectVendorEventRelationDateTimes(events) {
1505
+ if (!events?.length) {
1506
+ return [];
1507
+ }
1508
+ return events.flatMap(
1509
+ (event) => (event.relations ?? []).flatMap(
1510
+ (relation) => (relation.relationDates ?? []).map(
1511
+ (relationDate) => relationDate.dateTime
1512
+ )
1513
+ )
1514
+ );
1515
+ }
1516
+ function getVendorEventRelationStartDates(events) {
1517
+ const sortedDates = sortDatesChronologically(
1518
+ collectVendorEventRelationDateTimes(events)
1519
+ );
1520
+ const uniqueStartDates = [];
1521
+ for (const dateTime of sortedDates) {
1522
+ if (!uniqueStartDates.includes(dateTime.startDate)) {
1523
+ uniqueStartDates.push(dateTime.startDate);
1524
+ }
1525
+ }
1526
+ return uniqueStartDates;
1527
+ }
1528
+ function getVendorEventRelationDateOptions(events) {
1529
+ return getVendorEventRelationStartDates(events).map((startDate) => ({
1530
+ label: startDate,
1531
+ value: startDate
1532
+ }));
1533
+ }
1534
+ function getVendorEventsEmptyMessage() {
1535
+ return "No events found.";
1536
+ }
1908
1537
 
1909
1538
  export {
1910
- vendorBasicInfoFields,
1911
- vendorFullAddress,
1912
- vendorStartDateFields,
1913
- vendorEndDateFields,
1914
- vendorAvailability,
1915
- vendorLocationDescription,
1916
- vendorMenuFields,
1917
- productLabelGroups,
1918
- priceUnits,
1919
- vendorElectricity,
1920
- vendorGazebo,
1921
- vendorTable,
1922
- vendorPriceRange,
1923
- vendorStallSize,
1924
- vendorPackaging,
1925
- vendorProducedIn,
1926
- vendorFoodFlavour,
1927
- vendorCompliance,
1928
- packagingOptions,
1929
- producedIngOptions,
1930
- foodFlavourOptions,
1931
- eventBasicInfoFields,
1932
- eventStartDateFields,
1933
- eventEndDateFields,
1934
- availableTagTypes,
1935
- tagOptions,
1936
- eventInfo,
1937
- eventInfoPaymentInfo,
1938
- requirementsOptions,
1939
- stallTypeOptions,
1940
- refundPolicyOptions,
1941
- emailField,
1942
- companyContactFields,
1943
- loginFields,
1944
- registerFields,
1945
- requestPasswordResetFields,
1946
- resetPasswordFields,
1947
- validateVerificationTokenFields,
1948
- profileFields,
1539
+ removeTypename,
1540
+ truncateText,
1541
+ mapArrayToOptions,
1542
+ capitalizeFirstLetter,
1543
+ statusOptions,
1544
+ availableRegionTypes,
1545
+ availableRegionOptions,
1546
+ paymentMethodOptions,
1547
+ normalizeUrl,
1548
+ licenseNiceNames,
1549
+ cluemartSocialMedia,
1550
+ IOS_URL,
1551
+ ANDROID_URL,
1552
+ DEFAULT_RESOURCES_RETURN_LIMIT,
1553
+ DEFAULT_RESOURCES_RETURN_OFFSET,
1554
+ CLUEMART_MAIN_DOMAIN_URL,
1555
+ rewardNiceNames,
1556
+ PostTypeLabels,
1557
+ dateFormat,
1558
+ timeFormat,
1559
+ toNZTime,
1560
+ nzStartOfDay,
1561
+ formatDate,
1562
+ getCurrentAndFutureDates,
1563
+ isFutureDatesBeforeThreshold,
1564
+ formatTimestamp,
1565
+ isIsoDateString,
1566
+ sortDatesChronologically,
1567
+ futureTimePeriods,
1568
+ seededShuffle,
1569
+ computeDailyClueState,
1570
+ SCHOOL_MIN_STUDENT_COUNT,
1571
+ SCHOOL_MAX_STUDENT_COUNT,
1572
+ EVENT_DATE_STATUS_PERIOD_MAP,
1573
+ getAllowedEventDateStatuses,
1574
+ eventMatchesDateStatusPeriod,
1575
+ filterEventsByDateStatusPeriod,
1576
+ KNOWN_EVENT_SCHEDULE_STATUSES,
1577
+ toCalendarIsoDate,
1578
+ fromCalendarIsoDate,
1579
+ getEventCalendarIsoDates,
1580
+ findEventDateTimeByIsoDate,
1581
+ buildCalendarSheetContentData,
1582
+ getEventScheduleStatusTone,
1583
+ getEventScheduleStatusPresentation,
1584
+ getEventScheduleStatusLabel,
1585
+ shouldShowEventActionsWithWeather,
1949
1586
  categoryColors,
1950
1587
  availableCategories,
1951
- socialMediaFields,
1952
- contactUsFields,
1953
- partnerBasicInfoFields
1588
+ eventStartDatesSet,
1589
+ hasMatchingEventDate,
1590
+ matchesSelectedDate,
1591
+ matchesCategory,
1592
+ getRegisteredVendorStartDates,
1593
+ getRegisteredVendorCategoryNames,
1594
+ getUnregisteredVendorStartDates,
1595
+ getUnregisteredVendorCategoryNames,
1596
+ filterRegisteredVendorsForEvent,
1597
+ filterUnregisteredVendorsForEvent,
1598
+ filterRegisteredVendorsByEventDatesOnly,
1599
+ filterUnregisteredVendorsByEventDatesOnly,
1600
+ collectStallholderStartDates,
1601
+ getEventDatesWithStallholders,
1602
+ getStallholderCategoryNames,
1603
+ getStallholderCategoryOptions,
1604
+ getEventStallholderEmptyMessage,
1605
+ relationHasSelectedDate,
1606
+ eventHasSelectedDate,
1607
+ filterVendorEventsBySelectedDate,
1608
+ collectVendorEventRelationDateTimes,
1609
+ getVendorEventRelationStartDates,
1610
+ getVendorEventRelationDateOptions,
1611
+ getVendorEventsEmptyMessage
1954
1612
  };
1955
- //# sourceMappingURL=chunk-6CRQZK5X.mjs.map
1613
+ //# sourceMappingURL=chunk-IIOU4CXQ.mjs.map