@timardex/cluemart-shared 3.0.0 → 4.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.
Files changed (51) hide show
  1. package/dist/{ad-C7GbDyUi.d.ts → ad-CJlx_QPS.d.ts} +7 -2
  2. package/dist/{ad-DB9gvcJW.d.mts → ad-DJUHk_vq.d.mts} +7 -2
  3. package/dist/{affiliate-DJhVZJ2h.d.mts → affiliate-BPVDrFmw.d.mts} +1 -1
  4. package/dist/{affiliate-DuDoOxK_.d.ts → affiliate-D8tYZCzH.d.ts} +1 -1
  5. package/dist/auth/index.cjs +29 -1
  6. package/dist/auth/index.cjs.map +1 -1
  7. package/dist/auth/index.d.mts +11 -3
  8. package/dist/auth/index.d.ts +11 -3
  9. package/dist/auth/index.mjs +2 -2
  10. package/dist/auth/index.mjs.map +1 -1
  11. package/dist/{chunk-WOBG6I4T.mjs → chunk-2P66EBGO.mjs} +2 -2
  12. package/dist/{chunk-XXHTG4GJ.mjs → chunk-RNY3JPNY.mjs} +11 -5
  13. package/dist/{chunk-XXHTG4GJ.mjs.map → chunk-RNY3JPNY.mjs.map} +1 -1
  14. package/dist/{chunk-WWAHS5R2.mjs → chunk-RU6XOXWO.mjs} +1 -1
  15. package/dist/chunk-RU6XOXWO.mjs.map +1 -0
  16. package/dist/{chunk-FVUZ5SPE.mjs → chunk-UN33JW2N.mjs} +2 -2
  17. package/dist/{chunk-TKSBCN3N.mjs → chunk-WT663GKK.mjs} +46 -4
  18. package/dist/chunk-WT663GKK.mjs.map +1 -0
  19. package/dist/formFields/index.mjs +3 -3
  20. package/dist/graphql/index.cjs +225 -175
  21. package/dist/graphql/index.cjs.map +1 -1
  22. package/dist/graphql/index.d.mts +29 -4
  23. package/dist/graphql/index.d.ts +29 -4
  24. package/dist/graphql/index.mjs +18 -2
  25. package/dist/hooks/index.cjs +197 -169
  26. package/dist/hooks/index.cjs.map +1 -1
  27. package/dist/hooks/index.d.mts +3 -3
  28. package/dist/hooks/index.d.ts +3 -3
  29. package/dist/hooks/index.mjs +5 -5
  30. package/dist/index.cjs +234 -178
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.mts +43 -4
  33. package/dist/index.d.ts +43 -4
  34. package/dist/index.mjs +221 -173
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/types/index.cjs.map +1 -1
  37. package/dist/types/index.d.mts +3 -3
  38. package/dist/types/index.d.ts +3 -3
  39. package/dist/types/index.mjs +1 -1
  40. package/dist/{user-GnrqZmZP.d.ts → user-5leuGSFx.d.ts} +1 -2
  41. package/dist/{user-Znc91Cw5.d.mts → user-DM2rH8ii.d.mts} +1 -2
  42. package/dist/utils/index.cjs +9 -3
  43. package/dist/utils/index.cjs.map +1 -1
  44. package/dist/utils/index.d.mts +13 -3
  45. package/dist/utils/index.d.ts +13 -3
  46. package/dist/utils/index.mjs +2 -2
  47. package/package.json +1 -1
  48. package/dist/chunk-TKSBCN3N.mjs.map +0 -1
  49. package/dist/chunk-WWAHS5R2.mjs.map +0 -1
  50. /package/dist/{chunk-WOBG6I4T.mjs.map → chunk-2P66EBGO.mjs.map} +0 -0
  51. /package/dist/{chunk-FVUZ5SPE.mjs.map → chunk-UN33JW2N.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts","../../src/types/game/dailyClue.ts","../../src/utils/date.ts","../../src/enums/index.ts","../../src/utils/dateFormats.ts","../../src/utils/eventDateStatus.ts","../../src/utils/dailyClueGame.ts","../../src/utils/distance.ts","../../src/utils/pagination.ts","../../src/utils/mapArrayToOptions.ts","../../src/sharing/relationShareTypes.ts","../../src/sharing/constants.ts","../../src/sharing/normalizeShareDescription.ts","../../src/types/global.ts","../../src/types/subscription.ts","../../src/utils/utils.ts","../../src/utils/resourceImage.ts","../../src/utils/school.ts","../../src/utils/userPoints.ts","../../src/calendar/eventCalendar.ts","../../src/formFields/categories/clothingAndFashion.ts","../../src/formFields/categories/electronicsAndTechnology.ts","../../src/formFields/categories/foodAndBeverages.ts","../../src/formFields/categories/handmadeAndLocalProducts.ts","../../src/formFields/categories/healthAndWellness.ts","../../src/formFields/categories/homeGardenHousehold.ts","../../src/formFields/categories/petProductsAndAnimalGoods.ts","../../src/formFields/categories/serviceAndExperience.ts","../../src/formFields/categories/toysChildren.ts","../../src/formFields/categories/vintageAndAntique.ts","../../src/formFields/categories/index.ts","../../src/eventStallholders/eventStallholderFilters.ts","../../src/vendorEvents/vendorEventFilters.ts","../../src/utils/affiliate.ts","../../src/utils/irdNumber.ts","../../src/utils/isTransientNetworkError.ts","../../src/utils/adMetrics.ts","../../src/utils/billingCatalog/index.ts","../../src/utils/relations/eventStallholders.ts","../../src/utils/relations/vendorEvents.ts","../../src/utils/relations/preservedRelationDateStatuses.ts","../../src/utils/toUserFacingErrorMessage.ts"],"sourcesContent":["// Re-export the daily-clue occurrence helpers so the server can apply the same\n// duplicate-letter counting logic as `computeDailyClueState`.\nexport {\n computeDailyClueState,\n countLetterOccurrences,\n countLetterOccurrencesUpTo,\n getDailyClueDayIndex,\n seededShuffle,\n} from \"./dailyClueGame\";\nexport {\n formatDistance,\n getDistanceInKilometers,\n getDistanceInMeters,\n} from \"./distance\";\nexport {\n DEFAULT_PAGE_SIZE,\n accumulateItems,\n computeHasMore,\n defaultGetId,\n} from \"./pagination\";\nexport {\n NZ_TZ,\n toNZTime,\n nzStartOfDay,\n nzDayKey,\n formatDate,\n formatDateOptionLabel,\n getCurrentAndFutureDates,\n isFutureStartDate,\n isFutureDatesBeforeThreshold,\n formatTimestamp,\n isIsoDateString,\n sortDatesChronologically,\n getUniqueStartDates,\n timeFormat,\n dateFormat,\n isoDateFormat,\n isUtcMidnight,\n futureTimePeriods,\n} from \"./date\";\n\nexport { mapArrayToOptions } from \"./mapArrayToOptions\";\nexport {\n removeTypename,\n truncateText,\n capitalizeFirstLetter,\n statusOptions,\n availableRegionTypes,\n availableRegionOptions,\n paymentMethodOptions,\n normalizeUrl,\n licenseNiceNames,\n vendorLicences,\n cluemartSocialMedia,\n IOS_URL,\n ANDROID_URL,\n DEFAULT_RESOURCES_RETURN_LIMIT,\n DEFAULT_RESOURCES_RETURN_OFFSET,\n CLUEMART_MAIN_DOMAIN_URL,\n rewardNiceNames,\n PostTypeLabels,\n CM_SCHOOL_PROMO_CODE,\n CM_AFFILIATE_PROMO_CODE,\n formatNZBankAccount,\n} from \"./utils\";\n\nexport {\n isResourceImageActive,\n normalizeResourceImage,\n resolveResourceImageActive,\n} from \"./resourceImage\";\nexport { SCHOOL_MIN_STUDENT_COUNT, SCHOOL_MAX_STUDENT_COUNT } from \"./school\";\nexport { sumUserOverallPoints } from \"./userPoints\";\nexport {\n EVENT_DATE_STATUS_PERIOD_MAP,\n EVENT_DATE_STATUS_LABELS,\n eventMatchesDateStatusPeriod,\n filterEventsByDateStatusPeriod,\n getAllowedEventDateStatuses,\n FUTURE_EVENT_DATE_STATUSES,\n MANUAL_DATE_STATUSES,\n isFutureEventDateStatus,\n filterDatesByFutureStatus,\n buildRelationEligibleEventSchedule,\n getFutureEventStatus,\n updateSingleDateTimeStatus,\n} from \"./eventDateStatus\";\nexport * from \"../calendar\";\nexport * from \"../eventStallholders\";\nexport * from \"../vendorEvents\";\nexport {\n AFFILIATE_PARTICIPANT_TYPE_LABELS,\n AFFILIATE_REWARDS,\n createAffiliateReward,\n} from \"./affiliate\";\nexport {\n isValidIrdNumber,\n normalizeIrdNumber,\n formatIrdNumber,\n} from \"./irdNumber\";\nexport { isTransientNetworkError } from \"./isTransientNetworkError\";\nexport * from \"./adMetrics\";\nexport * from \"./billingCatalog\";\nexport * from \"./relations\";\nexport {\n DEFAULT_USER_FACING_ERROR,\n NETWORK_USER_FACING_ERROR,\n getErrorMessage,\n isInternalErrorMessage,\n toUserFacingErrorMessage,\n} from \"./toUserFacingErrorMessage\";\n","import { GameDate, GlobalGameData } from \"./global\";\n\nconst OBJECT_ID_PATH_SEGMENT = \"[a-f0-9]{24}\";\nconst OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;\n\nexport const gameScreenIdentifierList = [\n {\n clue: \"Where conversations happen without speaking.\",\n id: \"chat\",\n match: \"/chat\",\n },\n {\n clue: \"Where you can find your loyalties.\",\n id: \"coupons\",\n match: \"/profile/account/coupons\",\n },\n {\n clue: \"A single moment worth showing up for.\",\n id: \"single-event\",\n match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"What’s happening around you, right now.\",\n id: \"events-near-me\",\n match: \"/events/events-near-me\",\n },\n {\n clue: \"Where events appear as pins on a map.\",\n id: \"events-map\",\n match: \"/events/events-map\",\n },\n {\n clue: \"A collection of events worth attending.\",\n id: \"events\",\n match: \"/events\",\n },\n {\n clue: \"What’s happening in a wider area — not just nearby.\",\n id: \"events-region\",\n match: /^\\/events\\/region\\/[^/]+$/,\n },\n {\n clue: \"Where fun becomes a challenge.\",\n id: \"games\",\n match: \"/profile/account/games\",\n },\n {\n clue: \"Your starting point for everything.\",\n id: \"home\",\n match: \"/home\",\n },\n {\n clue: \"Where the app whispers what you shouldn’t miss.\",\n id: \"notifications\",\n match: \"/notifications\",\n },\n {\n clue: \"An organisation or creator supporting the community.\",\n id: \"single-partner\",\n match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Organisations and creators supporting the community.\",\n id: \"partners\",\n match: \"/partners\",\n },\n {\n clue: \"Where your actions turn into a timeline.\",\n id: \"activities\",\n match: \"/profile/account/favourites\",\n },\n {\n clue: \"The place to redefine who you are.\",\n id: \"edit-profile\",\n match: \"/profile/account\",\n },\n {\n clue: \"Your identity, on display.\",\n id: \"profile\",\n match: \"/profile\",\n },\n {\n clue: \"Where you can redeem your rewards.\",\n id: \"rewards\",\n match: \"/profile/account/rewards\",\n },\n {\n clue: \"A single published post in full view.\",\n id: \"single-visitor-post\",\n match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"One stallholder offering something valuable.\",\n id: \"single-vendor\",\n match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Where every stallholder waits under the right category.\",\n id: \"vendors\",\n match: \"/vendors\",\n },\n {\n clue: \"Where you browse articles and posts from around the platform.\",\n id: \"visitors\",\n match: \"/visitors\",\n },\n {\n clue: \"Where you fine-tune your experience.\",\n id: \"options\",\n match: \"/options\",\n },\n] as const;\n\nexport type GamePlacement = (typeof gameScreenIdentifierList)[number][\"id\"];\nexport type GamePlacementClue =\n (typeof gameScreenIdentifierList)[number][\"clue\"];\n\nexport type DailyClueBaseGame = {\n gameDate: GameDate;\n gameSolution: string;\n};\n\nexport type DailyClueGameData = GlobalGameData & {\n gameFields: DailyClueBaseGame;\n lastFoundDate: Date | null;\n letterInfo: {\n // Multiset of found letters: one entry per collected occurrence, so a\n // duplicate letter (e.g. two \"E\"s in \"EXPLORE\") appears twice once both\n // are found. Consumers must count occurrences, not use `includes`.\n collected: string[] | null;\n solutionShuffled: string[]; // The letters of the solution, but shuffled, e.g. [\"L\", \"C\", \"U\"]\n todaysClue: GamePlacementClue | null; // The clue for user to find the letter, e.g. related to {todaysPlacement}\n todaysLetter: string | null; // The letter the user has to find today, e.g. \"C\"\n todaysPlacement: GamePlacement | null; // The screen where the user has to find the clue, e.g. \"HomeScreen\"\n };\n};\n","import dayjs from \"dayjs\";\nimport customParseFormat from \"dayjs/plugin/customParseFormat.js\";\nimport isSameOrAfter from \"dayjs/plugin/isSameOrAfter.js\";\nimport timezone from \"dayjs/plugin/timezone.js\";\nimport utc from \"dayjs/plugin/utc.js\";\n\nimport { EnumEventDateStatus } from \"src/enums\";\n\nimport { dateFormat, timeFormat, isoDateFormat } from \"./dateFormats\";\nimport {\n FUTURE_EVENT_DATE_STATUSES,\n EVENT_DATE_STATUS_LABELS,\n} from \"./eventDateStatus\";\n\nexport { dateFormat, timeFormat, isoDateFormat };\n\n// Enable custom format parsing\ndayjs.extend(customParseFormat);\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(isSameOrAfter);\n\nexport const NZ_TZ = \"Pacific/Auckland\";\n\nexport function toNZTime(date?: Date | string) {\n return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);\n}\n\n/** Start of the calendar day in Pacific/Auckland (daily games, streaks, etc.). */\nexport function nzStartOfDay(\n input?: Date | string | number | null,\n): dayjs.Dayjs {\n if (input == null) {\n return dayjs().tz(NZ_TZ).startOf(\"day\");\n }\n return dayjs.tz(input, NZ_TZ).startOf(\"day\");\n}\n\n/**\n * UTC-midnight of the given instant's NZ calendar day (today when omitted).\n * This is the canonical \"day key\" encoding used by ad bookings and metrics:\n * stored as a UTC Date, rendered with `.toISOString().slice(0, 10)`.\n */\nexport function nzDayKey(input?: Date | string | number | null): Date {\n const day =\n input == null\n ? dayjs().tz(NZ_TZ).format(isoDateFormat)\n : dayjs.tz(input, NZ_TZ).format(isoDateFormat);\n return new Date(`${day}T00:00:00Z`);\n}\n\n/**\n * Type guard for the canonical \"day key\" encoding: a valid Date that is\n * exactly UTC midnight. Accepts `unknown` so it can validate untrusted values\n * (GraphQL/JSON inputs) without a preceding cast.\n */\nexport function isUtcMidnight(value: unknown): value is Date {\n return (\n value instanceof Date &&\n !Number.isNaN(value.getTime()) &&\n value.getUTCHours() === 0 &&\n value.getUTCMinutes() === 0 &&\n value.getUTCSeconds() === 0 &&\n value.getUTCMilliseconds() === 0\n );\n}\n\ntype DateFormat = \"date\" | \"time\" | \"datetime\";\n\n/**\n * Format a date string to a more readable format.\n * @param dateStr - the date string\n * @param timeStr - optional time string\n * @param display - 'date' | 'time' | 'datetime'\n * @returns formatted string based on display option\n */\nexport const formatDate = (\n dateStr: string,\n display: DateFormat = \"datetime\",\n timeStr?: string,\n) => {\n // Combine date and time into a single string if time is provided\n const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;\n\n // Parse with formats\n const dateTime = timeStr\n ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`)\n : dayjs(dateStr, dateFormat);\n\n // Format parts\n const formattedDate = dateTime.format(\"dddd, D MMMM, YYYY\");\n const formattedTime = dateTime.format(\"h:mm a\");\n\n // Return based on display option\n switch (display) {\n case \"date\":\n return formattedDate;\n case \"time\":\n return formattedTime;\n case \"datetime\":\n return `${formattedDate} at ${formattedTime}`;\n default:\n return formattedDate;\n }\n};\n\n/**\n * Date-filter label: the {@link formatDate} date text, marked `(Past)` when the\n * date falls before today. Used by the event/vendor date pills, which also list\n * historical relation dates.\n *\n * \"Today\" is the **runtime's local calendar day** (`dayjs()`), matching how\n * `formatDate` parses the value — not `Pacific/Auckland`, so the marker reflects\n * the day the viewer's device is on. The NZ helpers in this module (`nzDayKey`,\n * `nzStartOfDay`, …) are a separate basis and are deliberately not used here.\n *\n * Parsed once, strictly: an impossible or malformed value (`31-02-2026`) is\n * returned as-is instead of being rolled into another day, and the past check\n * uses that same parsed value so label and marker always agree.\n */\nexport function formatDateOptionLabel(dateStr: string): string {\n const parsed = dayjs(dateStr, dateFormat, true);\n\n if (!parsed.isValid()) {\n return dateStr;\n }\n\n const label = formatDate(dateStr, \"date\");\n\n return parsed.isBefore(dayjs(), \"day\") ? `${label} (Past)` : label;\n}\n\n/**\n * Formats accepted for a stored slot. The canonical writer is\n * `dayjs(...).format(`${dateFormat} ${timeFormat}`)`; the variants cover legacy\n * rows with an unpadded hour or trailing seconds. Each is parsed **strictly**, so\n * impossible values (`31-02`, `25:00`) are rejected instead of rolling over into\n * a real instant.\n */\nconst SLOT_FORMATS = [\n `${dateFormat} ${timeFormat}`,\n `${dateFormat} H:mm`,\n `${dateFormat} ${timeFormat}:ss`,\n `${dateFormat} H:mm:ss`,\n];\n\nconst parseSlot = (date: {\n startDate?: string;\n startTime?: string;\n}): dayjs.Dayjs | null => {\n if (!date.startDate || !date.startTime) {\n return null;\n }\n\n const value = `${date.startDate} ${date.startTime}`;\n\n for (const format of SLOT_FORMATS) {\n const parsed = dayjs(value, format, true);\n\n if (parsed.isValid()) {\n return parsed;\n }\n }\n\n return null;\n};\n\n/**\n * Shared \"starts now or later\" rule for `dd-mm-yyyy` + `HH:mm` slots. `now` is\n * passed in so a caller filtering a list compares every slot against the same\n * instant. A slot with a missing or unparseable date/time is never future.\n */\nconst isFutureDateTime = (\n date: { startDate?: string; startTime?: string },\n now: dayjs.Dayjs,\n): boolean => {\n const slot = parseSlot(date);\n\n return slot ? slot.isSameOrAfter(now) : false;\n};\n\nexport const getCurrentAndFutureDates = <\n T extends { startDate?: string; startTime?: string },\n>(\n dates: T[],\n): T[] => {\n const now = dayjs(); // current date and time\n\n return dates.filter((dateObj) => isFutureDateTime(dateObj, now));\n};\n\n/**\n * True when the slot starts now or later. Status-agnostic: used to hide past\n * relation dates from reads while the records stay in the database.\n */\nexport const isFutureStartDate = (date: {\n startDate?: string;\n startTime?: string;\n}): boolean => isFutureDateTime(date, dayjs());\n\nexport const isFutureDatesBeforeThreshold = (\n date: {\n startDate?: string;\n startTime?: string;\n },\n minHoursFromNow: number,\n): boolean => {\n if (!date.startDate || !date.startTime) {\n return false;\n }\n\n const threshold = minHoursFromNow\n ? dayjs().add(minHoursFromNow, \"hour\")\n : dayjs().startOf(\"day\");\n\n const dateTime = dayjs(\n `${date.startDate} ${date.startTime}`,\n `${dateFormat} ${timeFormat}`,\n );\n\n return dateTime.isSameOrAfter(threshold);\n};\n\nexport const formatTimestamp = (timestamp: string) => {\n const formattedDate = toNZTime(timestamp).format(dateFormat);\n\n return formatDate(formattedDate, \"date\");\n};\n\nexport const isIsoDateString = (value: unknown): value is string => {\n return typeof value === \"string\" && !Number.isNaN(Date.parse(value));\n};\n\n/**\n * Sort an array of date strings by their proximity to the current date.\n * @param dates - The array of date strings to sort.\n * @returns - The sorted array of date strings.\n */\nexport function sortDatesChronologically<\n T extends { startDate?: string; startTime?: string },\n>(dates: T[]): T[] {\n if (!dates?.length) {\n return [];\n }\n\n return [...dates].sort((a, b) => {\n const dateTimeFormat = `${dateFormat} ${timeFormat}`;\n const dateA =\n a.startDate && a.startTime\n ? dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat)\n : null;\n const dateB =\n b.startDate && b.startTime\n ? dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat)\n : null;\n\n if (dateA && dateB) {\n return dateA.valueOf() - dateB.valueOf();\n }\n\n if (dateA) {\n return -1;\n }\n\n if (dateB) {\n return 1;\n }\n\n return 0;\n });\n}\n\n/**\n * Start dates of the given date/time slots, chronological and de-duplicated.\n * Slots that share a `startDate` (e.g. two stall slots on the same day) collapse\n * into a single entry.\n */\nexport function getUniqueStartDates(\n dates: Array<{ startDate?: string; startTime?: string }> | null | undefined,\n): string[] {\n const seenStartDates = new Set<string>();\n const uniqueStartDates: string[] = [];\n\n for (const { startDate } of sortDatesChronologically(dates ?? [])) {\n if (!startDate || seenStartDates.has(startDate)) {\n continue;\n }\n\n seenStartDates.add(startDate);\n uniqueStartDates.push(startDate);\n }\n\n return uniqueStartDates;\n}\n\n/**\n * UI filter options for user-activity event periods. Derived from the canonical\n * {@link FUTURE_EVENT_DATE_STATUSES} list, minus `STARTING_SOON` (a presentational\n * choice: \"starting soon\" is surfaced separately rather than as a filter).\n */\nexport const futureTimePeriods = FUTURE_EVENT_DATE_STATUSES.filter(\n (status) => status !== EnumEventDateStatus.STARTING_SOON,\n).map((status) => ({\n label: EVENT_DATE_STATUS_LABELS[status],\n value: status,\n}));\n","export enum EnumInviteStatus {\n ACCEPTED = \"Accepted\",\n CANCELED = \"Canceled\",\n COMPLETED = \"Completed\",\n EXPIRED = \"Expired\",\n NO_STATUS = \"No_Status\",\n PENDING = \"Pending\",\n REJECTED = \"Rejected\",\n}\n\nexport enum EnumChatReportReason {\n INAPPROPRIATE_CONTENT = \"Inappropriate_Content\",\n HARASSMENT_OR_BULLYING = \"Harassment_or_Bullying\",\n HATE_SPEECH = \"Hate_Speech\",\n SPAM_OR_SCAM = \"Spam_or_Scam\",\n VIOLENCE_OR_DANGEROUS_BEHAVIOR = \"Violence_or_Dangerous_Behavior\",\n OTHER = \"Other\",\n}\n\nexport enum EnumChatType {\n GROUP = \"group\",\n PRIVATE = \"private\",\n}\n\nexport enum EnumPaymentMethod {\n CASH = \"cash\",\n EFTPOS = \"eftpos\",\n BANK_TRANSFER = \"bank_transfer\",\n PAYPAL = \"paypal\",\n STRIPE = \"stripe\",\n}\n\nexport enum EnumFoodFlavor {\n SALTY = \"Salty\",\n SAVOURY = \"Savoury\",\n SPICY = \"Spicy\",\n SWEET = \"Sweet\",\n OTHER = \"Not_Applicable\",\n}\n\nexport enum EnumFoodType {\n ADDITIVE_FREE = \"Additive_Free\",\n AIR_FRIED = \"Air_Fried\",\n ALLERGEN_FRIENDLY = \"Allergen_Friendly\",\n ATHLETE_FRIENDLY = \"Athlete_Friendly\",\n BAKED = \"Baked\",\n DAIRY_FREE = \"Dairy_Free\",\n DIABETIC_FRIENDLY = \"Diabetic_Friendly\",\n EGG_FREE = \"Egg_Free\",\n FRESH = \"Fresh\",\n GLUTEN_FREE = \"Gluten_Free\",\n GRILLED = \"Grilled\",\n HALAL = \"Halal\",\n HEART_HEALTHY = \"Heart_Healthy\",\n HIGH_FIBER = \"High_Fiber\",\n HIGH_PROTEIN = \"High_Protein\",\n KETO = \"Keto\",\n KOSHER = \"Kosher\",\n LACTOSE_FREE = \"Lactose_Free\",\n LOW_CALORIE = \"Low_Calorie\",\n LOW_CARB = \"Low_Carb\",\n LOW_FAT = \"Low_Fat\",\n LOW_SODIUM = \"Low_Sodium\",\n NO_ADDED_SUGAR = \"No_Added_Sugar\",\n NO_PRESERVATIVES = \"No_Preservatives\",\n NON_GMO = \"Non_GMO\",\n NUT_FREE = \"Nut_Free\",\n ORGANIC = \"Organic\",\n PALEO = \"Paleo\",\n PLANT_BASED = \"Plant_Based\",\n RAW = \"Raw\",\n SMOKED = \"Smoked\",\n SOY_FREE = \"Soy_Free\",\n SUGAR_FREE = \"Sugar_Free\",\n VEGAN = \"Vegan\",\n VEGETARIAN = \"Vegetarian\",\n}\n\nexport enum EnumResourceType {\n AFFILIATE = \"affiliate\",\n EVENT = \"event\",\n PARTNER = \"partner\",\n SCHOOL = \"school\",\n VENDOR = \"vendor\",\n VISITOR = \"visitor\",\n}\n\n/** `EnumResourceType` values that map to a stored resource — excludes the user-only `VISITOR` type. */\nexport type NonVisitorResourceType = Exclude<\n EnumResourceType,\n EnumResourceType.VISITOR\n>;\n\n/** Type guard that narrows an `EnumResourceType` to `NonVisitorResourceType`. */\nexport function isNonVisitorResourceType(\n value: EnumResourceType,\n): value is NonVisitorResourceType {\n return value !== EnumResourceType.VISITOR;\n}\n\nexport enum EnumEventType {\n MARKET = \"Market\",\n EXPO = \"Expo\",\n FAIR = \"Fair\",\n FESTIVAL = \"Festival\",\n}\n\nexport enum EnumVendorType {\n STALLHOLDER = \"Stallholder\",\n SHOP = \"Shop\",\n}\n\nexport enum EnumPartnerType {\n CHARITY_PARTNER = \"Charity_Partner\",\n MEDIA_PARTNER = \"Media_Partner\",\n SUPPORTING_PARTNER = \"Supporting_Partner\",\n}\n\nexport enum EnumOSPlatform {\n ANDROID = \"android\",\n IOS = \"ios\",\n WEB = \"web\",\n}\n\nexport enum EnumRelationResource {\n EVENT_INVITE_VENDOR = \"event_invite_vendor\",\n EVENT_UPDATE_RELATION_TO_VENDOR = \"event_update_relation_to_vendor\",\n VENDOR_UPDATE_RELATION_TO_EVENT = \"vendor_update_relation_to_event\",\n VENDOR_APPLICATION_TO_EVENT = \"vendor_application_to_event\",\n}\n\nexport enum EnumNotificationResourceType {\n AFFILIATE_REWARD_RECEIVED = \"affiliate_reward_received\",\n APPROVED_AFFILIATE = \"approved_affiliate\",\n APPROVED_EVENT = \"approved_event\",\n APPROVED_PARTNER = \"approved_partner\",\n APPROVED_SCHOOL = \"approved_school\",\n APPROVED_VENDOR = \"approved_vendor\",\n CREATED_EVENT = \"created_event\",\n CREATED_PARTNER = \"created_partner\",\n CREATED_VENDOR = \"created_vendor\",\n CREATED_COUPON = \"created_coupon\",\n DAILY_CLUE_GAME = \"daily_clue_game\",\n DEACTIVATED_EVENT = \"deactivated_event\",\n DEACTIVATED_PARTNER = \"deactivated_partner\",\n DEACTIVATED_VENDOR = \"deactivated_vendor\",\n DECLINED_EVENT = \"declined_event\",\n DECLINED_PARTNER = \"declined_partner\",\n DECLINED_VENDOR = \"declined_vendor\",\n DOWNGRADED_EVENT = \"downgraded_event\",\n DOWNGRADED_PARTNER = \"downgraded_partner\",\n DOWNGRADED_VENDOR = \"downgraded_vendor\",\n EVENT_DATE_CANCELED = \"event_date_canceled\",\n EVENT_INFO_CREATED = \"event_info_created\",\n EVENT_INVITE_VENDOR = EnumRelationResource.EVENT_INVITE_VENDOR,\n EVENT_STARTING_SOON = \"event_starting_soon\",\n EVENT_UPDATE_RELATION_TO_VENDOR = EnumRelationResource.EVENT_UPDATE_RELATION_TO_VENDOR,\n EXPIRATION_REMINDER_EVENT = \"expiration_reminder_event\",\n EXPIRATION_REMINDER_PARTNER = \"expiration_reminder_partner\",\n EXPIRATION_REMINDER_VENDOR = \"expiration_reminder_vendor\",\n NEW_CHAT_MESSAGE = \"new_chat_message\",\n NEW_POST_CREATED = \"new_post_created\",\n REGISTERED_USER_BY_SCHOOL_CODE = \"registered_user_by_school_code\",\n SYSTEM_ALERT = \"system_alert\",\n USER_COUPON_REDEEMED = \"user_coupon_redeemed\",\n VENDOR_APPLICATION_TO_EVENT = EnumRelationResource.VENDOR_APPLICATION_TO_EVENT,\n VENDOR_UPDATE_RELATION_TO_EVENT = EnumRelationResource.VENDOR_UPDATE_RELATION_TO_EVENT,\n}\n\nexport enum EnumNotificationType {\n CHAT = \"chat\",\n EVENT = EnumResourceType.EVENT,\n RELATION = \"relation\",\n SYSTEM = \"system\",\n VENDOR = EnumResourceType.VENDOR,\n}\n\nexport enum EnumRegions {\n All = \"All Regions\",\n Auckland = \"Auckland\",\n BayOfPlentyGisborne = \"Bay of Plenty & Gisborne\",\n CanterburyWestCoast = \"Canterbury & West Coast\",\n HawkesBay = \"Hawke's Bay\",\n ManawatuWanganui = \"Manawatu-Wanganui\",\n MarlboroughNelsonTasman = \"Marlborough & Nelson & Tasman\",\n Northland = \"Northland\",\n Otago = \"Otago\",\n Southland = \"Southland\",\n Taranaki = \"Taranaki\",\n Waikato = \"Waikato\",\n Wellington = \"Wellington\",\n}\n\nexport enum ImageTypeEnum {\n AVATAR = \"avatar\",\n COVER = \"cover\",\n IMAGE = \"image\",\n LOGO = \"logo\",\n}\n\nexport enum EnumUserLicence {\n PRO_EVENT = \"pro_event\",\n PRO_PLUS_EVENT = \"pro_plus_event\",\n PRO_PLUS_VENDOR = \"pro_plus_vendor\",\n PRO_VENDOR = \"pro_vendor\",\n STANDARD_EVENT = \"standard_event\",\n STANDARD_VENDOR = \"standard_vendor\",\n STANDARD_PARTNER = \"standard_partner\",\n STANDARD_AFFILIATE = \"standard_affiliate\",\n STANDARD_SCHOOL = \"standard_school\",\n}\n\nexport enum LicenceExpiryDate {\n ONE_YEAR = \"1 year\",\n ONE_MONTH = \"1 month\",\n TWO_MONTHS = \"2 months\",\n THREE_MONTHS = \"3 months\",\n SIX_MONTHS = \"6 months\",\n}\n\nexport enum EnumUserRole {\n ADMIN = \"admin\",\n AFFILIATE = \"affiliate\",\n CUSTOMER = \"customer\",\n EVENT = \"event\",\n PARTNER = \"partner\",\n SCHOOL = \"school\",\n SUPER_ADMIN = \"super_admin\",\n VENDOR = \"vendor\",\n}\n\nexport enum EnumSocialMedia {\n FACEBOOK = \"facebook\",\n INSTAGRAM = \"instagram\",\n TIKTOK = \"tiktok\",\n TWITTER = \"twitter\",\n WEBSITE = \"website\",\n YOUTUBE = \"youtube\",\n}\n\nexport enum EnumEventDateStatus {\n STARTING_SOON = \"Starting_Soon\",\n STARTED = \"Started\",\n TODAY = \"Today\",\n TOMORROW = \"Tomorrow\",\n THIS_WEEK = \"This_Week\",\n NEXT_WEEK = \"Next_Week\",\n UPCOMING = \"Upcoming\",\n ENDED = \"Ended\",\n RE_SCHEDULED = \"Rescheduled\",\n CANCELED = \"Canceled\",\n INVALID = \"Invalid\",\n}\n\nexport enum EnumSubscriptionStatus {\n ACTIVE = \"active\",\n INACTIVE = \"inactive\",\n CANCELLED = \"cancelled\",\n NO_SUBSCRIPTION = \"no_subscription\",\n PAST_DUE = \"past_due\",\n TRIALING = \"trialing\",\n}\n\nexport enum EnumBillingPeriod {\n MONTHLY_CANCEL_ANYTIME = \"monthly_cancel_anytime\",\n YEARLY_ANNUAL_BILLED = \"yearly_annual_billed\",\n}\n\nexport enum EnumReward {\n MYSTERY_JOY_BOX = \"mystery_joy_box\",\n MYSTERY_SQUEEZE_BOX = \"mystery_squeeze_box\",\n MYSTERY_DELUXE_BOX = \"mystery_deluxe_box\",\n}\n\nexport enum EnumPointType {\n DAILY_CLUE_GAME = \"daily_clue_game\",\n EVENT_CHECKIN = \"event_checkin\",\n INITIAL = \"initial\",\n MINI_QUIZ_GAME = \"mini_quiz_game\",\n ODD_ONE_OUT_GAME = \"odd_one_out_game\",\n}\n","export const dateFormat = \"DD-MM-YYYY\";\nexport const timeFormat = \"HH:mm\";\n/** ISO 8601 machine/sortable format: day keys, Date construction, strict parsing, HTML date inputs. */\nexport const isoDateFormat = \"YYYY-MM-DD\";\n","import dayjs from \"dayjs\";\nimport customParseFormat from \"dayjs/plugin/customParseFormat.js\";\nimport isoWeek from \"dayjs/plugin/isoWeek.js\";\n\nimport { EnumEventDateStatus } from \"../enums\";\nimport type { DateTimeType } from \"../types/global\";\n\nimport { dateFormat, timeFormat } from \"./dateFormats\";\n\n// Enable dayjs plugins used by event date parsing/status logic\ndayjs.extend(customParseFormat);\ndayjs.extend(isoWeek);\n\n/**\n * Display label per date status. Single source of truth instead of deriving\n * the label with `replaceAll(\"_\", \" \")` / text-transform tricks, so each\n * status maps to an explicit, correctly-cased string (e.g. \"This Week\",\n * \"Starting Soon\", \"Rescheduled\"). Lives here (not in `calendar`) so both\n * `calendar/eventCalendar` and `utils/date` can consume it without a circular\n * import.\n */\nexport const EVENT_DATE_STATUS_LABELS: Record<EnumEventDateStatus, string> = {\n [EnumEventDateStatus.STARTING_SOON]: \"Starting Soon\",\n [EnumEventDateStatus.STARTED]: \"Started\",\n [EnumEventDateStatus.TODAY]: \"Today\",\n [EnumEventDateStatus.TOMORROW]: \"Tomorrow\",\n [EnumEventDateStatus.THIS_WEEK]: \"This Week\",\n [EnumEventDateStatus.NEXT_WEEK]: \"Next Week\",\n [EnumEventDateStatus.UPCOMING]: \"Upcoming\",\n [EnumEventDateStatus.ENDED]: \"Ended\",\n [EnumEventDateStatus.RE_SCHEDULED]: \"Rescheduled\",\n [EnumEventDateStatus.CANCELED]: \"Canceled\",\n [EnumEventDateStatus.INVALID]: \"Invalid\",\n};\n\nexport const EVENT_DATE_STATUS_PERIOD_MAP: Partial<\n Record<EnumEventDateStatus, EnumEventDateStatus[]>\n> = {\n [EnumEventDateStatus.TODAY]: [\n EnumEventDateStatus.STARTED,\n EnumEventDateStatus.STARTING_SOON,\n EnumEventDateStatus.TODAY,\n ],\n [EnumEventDateStatus.THIS_WEEK]: [\n EnumEventDateStatus.STARTED,\n EnumEventDateStatus.STARTING_SOON,\n EnumEventDateStatus.THIS_WEEK,\n EnumEventDateStatus.TODAY,\n EnumEventDateStatus.TOMORROW,\n ],\n};\n\nexport function getAllowedEventDateStatuses(\n period: EnumEventDateStatus,\n): EnumEventDateStatus[] {\n return EVENT_DATE_STATUS_PERIOD_MAP[period] ?? [period];\n}\n\nexport function eventMatchesDateStatusPeriod(\n dateTime: Pick<DateTimeType, \"dateStatus\">[] | null | undefined,\n period: EnumEventDateStatus,\n): boolean {\n const allowedStatuses = getAllowedEventDateStatuses(period);\n\n return (\n dateTime?.some((dt) => allowedStatuses.includes(dt.dateStatus)) ?? false\n );\n}\n\nexport function filterEventsByDateStatusPeriod<\n T extends { dateTime?: Pick<DateTimeType, \"dateStatus\">[] | null },\n>(events: T[], period: EnumEventDateStatus): T[] {\n return events.filter((event) =>\n eventMatchesDateStatusPeriod(event.dateTime, period),\n );\n}\n\n/**\n * Canonical list of date statuses whose start date/time is still in the future\n * (i.e. the slot has not started yet). `STARTED`, `ENDED`, `INVALID`,\n * `CANCELED` and `RE_SCHEDULED` are intentionally excluded.\n *\n * This is the single source of truth for \"is this slot still in the future\".\n * `futureTimePeriods` (in `utils/date.ts`) derives from this list for UI\n * filters, additionally excluding `STARTING_SOON`.\n */\nexport const FUTURE_EVENT_DATE_STATUSES: readonly EnumEventDateStatus[] = [\n EnumEventDateStatus.STARTING_SOON,\n EnumEventDateStatus.TODAY,\n EnumEventDateStatus.TOMORROW,\n EnumEventDateStatus.THIS_WEEK,\n EnumEventDateStatus.NEXT_WEEK,\n EnumEventDateStatus.UPCOMING,\n];\n\nexport function isFutureEventDateStatus(\n dateStatus: EnumEventDateStatus | null | undefined,\n): boolean {\n return Boolean(dateStatus && FUTURE_EVENT_DATE_STATUSES.includes(dateStatus));\n}\n\nexport function filterDatesByFutureStatus<\n T extends { dateStatus?: EnumEventDateStatus | null },\n>(dates: T[]): T[] {\n return dates.filter((date) => isFutureEventDateStatus(date.dateStatus));\n}\n\n/**\n * Statuses set by an explicit user action rather than derived from the\n * schedule clock. The status recomputation below must leave them untouched,\n * otherwise a canceled/rescheduled date would silently flip back to a\n * time-derived status on the next run.\n */\nexport const MANUAL_DATE_STATUSES: ReadonlySet<EnumEventDateStatus> = new Set([\n EnumEventDateStatus.CANCELED,\n EnumEventDateStatus.RE_SCHEDULED,\n]);\n\n/**\n * Builds the event schedule that relation dates should be matched against.\n *\n * Manual statuses (`MANUAL_DATE_STATUSES`: CANCELED and RE_SCHEDULED) stay on\n * the live `Event.dateTime` for visibility, but a relation date pointing at\n * them is treated as removed. Archived (ended) slots are appended separately\n * so relation dates for archived history still match instead of being wrongly\n * marked canceled.\n *\n * Shared by the event-update relation sync and the cron orphan-date cleanup so\n * both use the same archive-aware schedule.\n */\nexport function buildRelationEligibleEventSchedule<\n T extends { dateStatus?: EnumEventDateStatus | null },\n>(liveDateTime: T[], archivedDateTime: T[] = []): T[] {\n const eligible = liveDateTime.filter(\n (slot) => !slot.dateStatus || !MANUAL_DATE_STATUSES.has(slot.dateStatus),\n );\n return [...eligible, ...archivedDateTime];\n}\n\n/**\n * Determines the dateStatus for a future event date\n * @param startDateTime The start date-time of the event\n * @param now The current date-time\n * @returns The appropriate EnumEventDateStatus\n */\nexport function getFutureEventStatus(\n startDateTime: dayjs.Dayjs,\n now: dayjs.Dayjs,\n): EnumEventDateStatus {\n const hoursUntilStart = startDateTime.diff(now, \"hour\", true);\n if (hoursUntilStart > 0 && hoursUntilStart <= 4) {\n return EnumEventDateStatus.STARTING_SOON;\n }\n\n if (startDateTime.isSame(now, \"day\")) {\n return EnumEventDateStatus.TODAY;\n }\n\n if (startDateTime.isSame(now.add(1, \"day\"), \"day\")) {\n return EnumEventDateStatus.TOMORROW;\n }\n\n if (startDateTime.isSame(now, \"isoWeek\")) {\n return EnumEventDateStatus.THIS_WEEK;\n }\n\n if (startDateTime.isSame(now.add(1, \"week\"), \"isoWeek\")) {\n return EnumEventDateStatus.NEXT_WEEK;\n }\n\n return EnumEventDateStatus.UPCOMING;\n}\n\n/**\n * Updates the dateStatus field for a single DateTimeType object based on the current date/time.\n * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.\n * @param dateTime The date-time object to update\n * @returns A new object with an updated dateStatus value, or the original\n * object when the stored status is a manual override\n */\nexport function updateSingleDateTimeStatus<T extends DateTimeType>(\n dateTime: T,\n now: dayjs.Dayjs = dayjs(),\n): T {\n if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {\n return dateTime;\n }\n\n // Parse start and end date-time\n const dateTimeFormat = `${dateFormat} ${timeFormat}`;\n const startDateTime = dayjs(\n `${dateTime.startDate} ${dateTime.startTime}`,\n dateTimeFormat,\n true,\n );\n const endDateTime = dayjs(\n `${dateTime.endDate} ${dateTime.endTime}`,\n dateTimeFormat,\n true,\n );\n\n // Skip if dates are invalid\n if (!startDateTime.isValid() || !endDateTime.isValid()) {\n return {\n ...dateTime,\n dateStatus: EnumEventDateStatus.INVALID,\n };\n }\n\n if (endDateTime.isBefore(startDateTime)) {\n return {\n ...dateTime,\n dateStatus: EnumEventDateStatus.INVALID,\n };\n }\n\n let dateStatus: EnumEventDateStatus;\n\n if (endDateTime.isAfter(now)) {\n if (startDateTime.isAfter(now)) {\n // Event has not started yet\n dateStatus = getFutureEventStatus(startDateTime, now);\n } else {\n // Event is in progress\n dateStatus = EnumEventDateStatus.STARTED;\n }\n } else {\n // Event has ended\n dateStatus = EnumEventDateStatus.ENDED;\n }\n\n return {\n ...dateTime,\n dateStatus,\n };\n}\n","import type { Dayjs } from \"dayjs\";\n\nimport {\n DailyClueGameData,\n GamePlacement,\n GamePlacementClue,\n gameScreenIdentifierList,\n} from \"../types/game/dailyClue\";\n\nimport { nzStartOfDay } from \"./date\";\n\nfunction createSeededRng(seed: number) {\n let t = seed >>> 0;\n\n return function random() {\n t += 0x6d2b79f5;\n let x = t;\n\n x = Math.imul(x ^ (x >>> 15), x | 1);\n x ^= x + Math.imul(x ^ (x >>> 7), x | 61);\n\n return ((x ^ (x >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nfunction hashStringToNumber(seed: string): number {\n let hash = 2166136261;\n\n for (let i = 0; i < seed.length; i++) {\n hash ^= seed.codePointAt(i) ?? 0;\n hash = Math.imul(hash, 16777619);\n }\n\n return hash >>> 0;\n}\n\n/** Seeded shuffle so all players see the same letter order / placements for a game. */\nexport function seededShuffle<T>(array: readonly T[], seed: string): T[] {\n const rng = createSeededRng(hashStringToNumber(seed));\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(rng() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n\nfunction getDayIndex(start: Dayjs, today: Dayjs): number {\n return today.diff(start, \"day\");\n}\n\n/**\n * Number of whole days since `dailyClue`'s start date (NZ time), i.e. today's\n * slot index into the game's day-based arrays.\n *\n * Returns `0` on the start date and a positive value on later days up to and\n * including the end date. Returns `null` outside the game window (before the\n * start date or after the end date), so callers must handle `null` instead of\n * blindly indexing arrays — an out-of-window index would silently produce\n * `undefined` or, in the occurrence helpers, wrongly report a letter as\n * already collected.\n *\n * Extracted from `computeDailyClueState` so callers (e.g. the update mutation)\n * can resolve the same index without re-implementing the day-math.\n */\nexport function getDailyClueDayIndex(\n dailyClue: DailyClueGameData,\n): number | null {\n const today = nzStartOfDay();\n const start = nzStartOfDay(dailyClue.gameFields.gameDate.startDate);\n const end = nzStartOfDay(dailyClue.gameFields.gameDate.endDate);\n\n if (today.isBefore(start) || today.isAfter(end)) {\n return null;\n }\n\n return getDayIndex(start, today);\n}\n\n/**\n * Number of times `letter` appears in `letters`.\n *\n * `collected` is a multiset (duplicate letters are stored once per found\n * occurrence), so membership checks such as `includes` are not enough — callers\n * must count how many occurrences have actually been collected.\n */\nexport function countLetterOccurrences(\n letters: readonly string[],\n letter: string,\n): number {\n return letters.reduce(\n (count, candidate) => (candidate === letter ? count + 1 : count),\n 0,\n );\n}\n\n/**\n * Number of times `letter` appears at or before `index` in `letters`.\n *\n * This is the \"required\" count for today's slot: a duplicate letter must not be\n * considered already collected until every earlier occurrence of it in\n * `solutionShuffled` has also been found.\n */\nexport function countLetterOccurrencesUpTo(\n letters: readonly string[],\n letter: string,\n index: number,\n): number {\n let count = 0;\n const end = Math.min(index, letters.length - 1);\n\n for (let i = 0; i <= end; i++) {\n if (letters[i] === letter) {\n count++;\n }\n }\n\n return count;\n}\n\nexport function computeDailyClueState(dailyClue: DailyClueGameData): {\n todaysClue: GamePlacementClue | null;\n todaysLetter: string | null;\n todaysPlacement: GamePlacement | null;\n} | null {\n const { startDate, endDate } = dailyClue.gameFields.gameDate;\n const { solutionShuffled, collected } = dailyClue.letterInfo;\n\n const today = nzStartOfDay();\n const start = nzStartOfDay(startDate);\n const end = nzStartOfDay(endDate);\n\n // Before game starts\n if (today.isBefore(start)) {\n return null;\n }\n\n const shuffledPlacements = seededShuffle(\n gameScreenIdentifierList,\n start.toISOString(),\n );\n\n const index = getDayIndex(start, today);\n\n // After game ends\n if (today.isAfter(end)) {\n return {\n todaysClue: null,\n todaysLetter: null,\n todaysPlacement: null,\n };\n }\n\n // Safety: index must exist in BOTH arrays\n if (\n index < 0 ||\n index >= solutionShuffled.length ||\n index >= shuffledPlacements.length\n ) {\n return null;\n }\n\n const letterToday = solutionShuffled[index];\n const placement = shuffledPlacements[index];\n\n if (!letterToday || !placement) return null;\n\n const collectedLetters = collected ?? [];\n\n // Compare collected occurrences against how many of today's letter have\n // appeared at or before this day's slot. This fixes solutions with duplicate\n // letters (e.g. \"EXPLORE\" has two \"E\"s): one collected \"E\" must not hide the\n // second \"E\" day. Membership checks (`includes`) can't express that.\n const alreadyCollectedToday =\n countLetterOccurrences(collectedLetters, letterToday) >=\n countLetterOccurrencesUpTo(solutionShuffled, letterToday, index);\n\n // Already completed today\n if (alreadyCollectedToday) {\n return {\n todaysClue: null,\n todaysLetter: null,\n todaysPlacement: null,\n };\n }\n\n // Active state\n return {\n todaysClue: placement.clue,\n todaysLetter: letterToday,\n todaysPlacement: placement.id,\n };\n}\n","export function getDistanceInMeters(\n coordinates1: number[],\n coordinates2: number[],\n): number {\n const [lon1, lat1] = coordinates1;\n const [lon2, lat2] = coordinates2;\n\n const values = [lon1, lat1, lon2, lat2];\n if (values.some((v) => !Number.isFinite(v))) {\n return Infinity;\n }\n\n const toRadians = (deg: number) => (deg * Math.PI) / 180;\n const R = 6371000; // Earth radius in meters\n\n const dLat = toRadians(lat2 - lat1);\n const dLon = toRadians(lon2 - lon1);\n const radLat1 = toRadians(lat1);\n const radLat2 = toRadians(lat2);\n\n const a =\n Math.sin(dLat / 2) ** 2 +\n Math.sin(dLon / 2) ** 2 * Math.cos(radLat1) * Math.cos(radLat2);\n\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return R * c;\n}\n\nexport function getDistanceInKilometers(\n coordinates1: number[],\n coordinates2: number[],\n): number {\n const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);\n\n if (!Number.isFinite(distanceInMeters)) {\n return Infinity;\n }\n\n return Math.round(distanceInMeters / 1000);\n}\n\nexport function formatDistance(\n coordinates1: number[],\n coordinates2: number[],\n): string {\n const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);\n\n if (!Number.isFinite(distanceInMeters)) {\n return \"—\";\n }\n\n const roundedMeters = Math.round(distanceInMeters);\n\n if (roundedMeters < 1000) {\n return `${roundedMeters} m`;\n }\n\n return `${Math.round(roundedMeters / 1000)} km`;\n}\n","/** Default page size shared by paginated list consumers. */\nexport const DEFAULT_PAGE_SIZE = 50;\n\n/**\n * Default identity extractor for paginated items. Assumes the item has an `_id`\n * field; callers with a different key (e.g. `userId`) should pass `getId`.\n */\nexport function defaultGetId<TItem>(item: TItem): string {\n const id = (item as { _id?: unknown } | null)?._id;\n return id != null ? String(id) : \"\";\n}\n\n/**\n * Appends `page` onto `items`, de-duplicating by `getId` (first occurrence\n * wins) and preserving order. Returns the same reference when nothing new was\n * added, so callers can rely on reference equality to avoid extra renders.\n */\nexport function accumulateItems<TItem>(\n items: TItem[],\n page: TItem[],\n getId: (item: TItem) => string,\n): TItem[] {\n if (page.length === 0) {\n return items;\n }\n\n const seen = new Set<string>();\n for (const item of items) {\n const id = getId(item);\n if (id !== \"\") {\n seen.add(id);\n }\n }\n\n const fresh = page.filter((item) => {\n const id = getId(item);\n // An empty ID carries no stable identity, so it cannot be de-duplicated;\n // keep such items rather than letting them all collide in `seen`.\n if (id === \"\") {\n return true;\n }\n if (seen.has(id)) {\n return false;\n }\n seen.add(id);\n return true;\n });\n\n return fresh.length === 0 ? items : [...items, ...fresh];\n}\n\n/** A full page means more pages may exist (offset pagination has no total count). */\nexport function computeHasMore(pageLength: number, pageSize: number): boolean {\n return pageLength === pageSize;\n}\n","import { OptionItem } from \"src/types\";\n\n/**\n * Convert an array of strings to an array of objects with label and value properties.\n */\nexport const mapArrayToOptions = (items: string[]): OptionItem[] =>\n items.map((item) => ({\n label: item,\n value: item,\n }));\n","/** Path segments for relation share URLs — must match mobile `RelationTitle` values. */\nexport const RELATION_SHARE_INVITATION = \"invitation\" as const;\nexport const RELATION_SHARE_APPLICATION = \"application\" as const;\n\n/**\n * Bump when relation overlay SVG/layout changes so og:image URLs and API ETags\n * invalidate after deploy. Facebook caches preview JPEGs by exact URL — changing\n * this value forces crawlers to fetch a fresh image after server deploy.\n */\nexport const RELATION_OVERLAY_LAYOUT_VERSION = 43;\n\nexport const RELATION_SHARE_RESOURCE_TYPES = [\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_APPLICATION,\n] as const;\n\nexport type RelationShareResourceType =\n (typeof RELATION_SHARE_RESOURCE_TYPES)[number];\n\nexport function isRelationShareResourceType(\n resourceType: string,\n): resourceType is RelationShareResourceType {\n return (RELATION_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n RELATION_OVERLAY_LAYOUT_VERSION,\n RELATION_SHARE_RESOURCE_TYPES,\n isRelationShareResourceType,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\n/** Open Graph recommended preview size (must match admin `SHARE_OG_IMAGE_*`). */\nexport const SOCIAL_IMAGE_WIDTH = 1200;\n\n/** Open Graph recommended preview size (must match admin `SHARE_OG_IMAGE_*`). */\nexport const SOCIAL_IMAGE_HEIGHT = 630;\n\n/** Keep in sync with `CLUEMART_MAIN_DOMAIN_URL` in utils (avoid utils↔sharing import cycle). */\nexport const SHARE_SITE_URL = \"https://cluemart.co.nz\";\n\n/** Calendar marker for invitation market-dates share copy (U+1F4C5 📅). */\nexport const SHARE_CALENDAR_ICON = \"\\u{1F4C5}\";\n\nexport const SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;\n\n/** Check mark for invitation requirements share copy (U+2705 ✅). */\nexport const SHARE_CHECKMARK_ICON = \"\\u{2705}\";\n\nexport const SHARE_REQUIREMENTS_SECTION_HEADING = `${SHARE_CHECKMARK_ICON} Requirements:`;\n\n/** Information marker for tags share copy (U+2139 ℹ️). */\nexport const SHARE_INFO_ICON = \"\\u{2139}\\u{FE0F}\";\n\nexport const SHARE_TAGS_SECTION_HEADING = `${SHARE_INFO_ICON} Tags:`;\n\n/** Standalone line when `rainOrShine` is true (invitation share + OG section parsing). */\nexport const SHARE_RAIN_OR_SHINE_LINE = \"Rain or Shine\";\n\n/** Standalone line when `foodTruck` is true (application share + OG section parsing). */\nexport const SHARE_FOOD_TRUCK_LINE = \"Food Truck\";\n\n/** Prefix for application compliance line (share text + OG section parsing). */\nexport const SHARE_COMPLIANCE_PREFIX = `${SHARE_CHECKMARK_ICON} Compliance:`;\n\n/** Label tag for application categories share copy (U+1F3F7 🏷️). */\nexport const SHARE_CATEGORY_ICON = \"\\u{1F3F7}\\u{FE0F}\";\n\nexport const SHARE_CATEGORIES_SECTION_HEADING = `${SHARE_CATEGORY_ICON} Categories:`;\n\n/** Straight ruler for application stall-size share copy (U+1F4CF 📏). */\nexport const SHARE_RULER_ICON = \"\\u{1F4CF}\";\n\n/** Prefix for application stall-size line (share text + OG section parsing). */\nexport const SHARE_STALL_SIZE_PREFIX = `${SHARE_RULER_ICON} Stall size:`;\n\n/** Dollar marker for price-range share copy (U+0024 $ — text, not emoji, so it stays black). */\nexport const SHARE_DOLLAR_ICON = \"$\";\n\n/** Prefix for application price-range line (share text + OG section parsing). */\nexport const SHARE_PRICE_RANGE_PREFIX = `${SHARE_DOLLAR_ICON} Price range:`;\n\n/** Alarm clock for invitation application-deadline share copy (U+23F0 ⏰). */\nexport const SHARE_CLOCK_ICON = \"\\u{23F0}\";\n\n/** Prefix for the invitation application-deadline sentence (share text + OG section parsing). */\nexport const SHARE_APPLICATION_DEADLINE_PREFIX = `${SHARE_CLOCK_ICON} Application deadline:`;\n\n/** First line of `og:description` (and legacy share-message text). */\nexport const SHARE_MORE_INFO_LINE = \"Shared from ClueMart\";\n\nexport const DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;\n\nexport const RESOURCE_SHARE_TYPES = [\n \"market\",\n \"stallholder\",\n \"partner\",\n \"affiliate\",\n \"school\",\n] as const;\n\nexport type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];\n\nexport const POST_SHARE_RESOURCE_TYPES = [\n \"market_faces\",\n \"clue_bites\",\n \"play_and_win\",\n] as const;\n\nexport type PostShareResourceType = (typeof POST_SHARE_RESOURCE_TYPES)[number];\n\nexport type ShareResourceType =\n ResourceShareType | PostShareResourceType | RelationShareResourceType;\n\nexport const SHARE_RESOURCE_LABEL: Record<ShareResourceType, string> = {\n [RELATION_SHARE_APPLICATION]: \"Application\",\n [RELATION_SHARE_INVITATION]: \"Invitation\",\n affiliate: \"Affiliate\",\n clue_bites: \"Clue Bites\",\n market_faces: \"Market Faces\",\n market: \"Market\",\n partner: \"Partner\",\n play_and_win: \"Play & Win\",\n school: \"School\",\n stallholder: \"Stallholder\",\n};\n\nexport function isPostShareResourceType(\n resourceType: ShareResourceType,\n): resourceType is PostShareResourceType {\n return (POST_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import { joinShareOgDescriptionSections } from \"./joinShareDescriptionSections\";\n\nexport {\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n} from \"./joinShareDescriptionSections\";\n\n/** Trims share text and collapses spaces per line; preserves `\\n\\n` section breaks. */\nconst LEADING_WHITESPACE = /^[ \\t]*/;\n\nexport function normalizeShareText(value: string | null | undefined): string {\n if (value == null) {\n return \"\";\n }\n return value\n .trim()\n .split(\"\\n\")\n .map((line) => {\n const leading = LEADING_WHITESPACE.exec(line)?.[0] ?? \"\";\n const rest = line\n .slice(leading.length)\n .trim()\n .replace(/[ \\t]{2,}/g, \" \");\n return leading + rest;\n })\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\nexport function splitShareDescriptionSections(value: string): string[] {\n const trimmed = normalizeShareText(value);\n if (!trimmed) {\n return [];\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => normalizeShareText(section))\n .filter((section) => section.length > 0);\n }\n\n if (/\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n+/)\n .map((section) => normalizeShareText(section))\n .filter((section) => section.length > 0);\n }\n\n return [trimmed];\n}\n\n/**\n * Formats share descriptions for Open Graph / Twitter meta tags.\n * Sections are joined with {@link OG_DESCRIPTION_LINE_BREAK} (`&#10;`).\n */\nexport function normalizeShareOgDescription(value: string): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(value));\n}\n\n/**\n * Open Graph / Twitter description from pre-built section strings.\n * Prefer {@link joinShareOgDescriptionSections} when sections are already known.\n */\nexport function buildShareOgDescriptionFromSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return joinShareOgDescriptionSections(sections);\n}\n\n/** Open Graph / Twitter description — body sections only (`og:title` is separate). */\nexport function buildShareOgDescription(\n _title: string,\n description: string,\n): string {\n return joinShareOgDescriptionSections(\n splitShareDescriptionSections(description),\n );\n}\n\n/**\n * Strips emoji and symbols that do not render reliably in overlay SVG fonts.\n * Keeps letters, numbers, whitespace, and common sentence punctuation.\n */\nexport function stripOverlaySubtitleSpecialChars(text: string): string {\n const regex = /[^\\p{L}\\p{M}\\p{N}\\s.,!?'\"&\\-():;/]/gu;\n const result = text\n .replace(/\\p{Extended_Pictographic}/gu, \"\")\n .replace(regex, \"\");\n return result.trim();\n}\n","import {\n Control,\n FieldValues,\n FormState,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormReset,\n UseFormSetValue,\n UseFormWatch,\n} from \"react-hook-form\";\n\nimport {\n EnumEventDateStatus,\n EnumEventType,\n EnumPartnerType,\n EnumRegions,\n EnumResourceType,\n EnumSocialMedia,\n EnumUserLicence,\n EnumUserRole,\n} from \"../enums\";\n\nimport { EventListItemType } from \"./event\";\nimport { EnumPostType } from \"./post\";\nimport { VendorType } from \"./vendor\";\n\nexport const PROMO_CODE_PREFIX = \"CM-\";\n\nexport type PromoCodeType = `${typeof PROMO_CODE_PREFIX}${string}`;\n\nexport type Nullable<T> = {\n [K in keyof T]: T[K] | null | undefined;\n};\n\n/** Uniform mutation response envelope used across GraphQL mutations. */\nexport type MutationResponse<T> = {\n data: T | null;\n message: string | null;\n};\n\nexport type DeviceInfo = {\n appBuildNumber: string;\n appId: string;\n appVersion: string;\n brand: string;\n deviceName: string;\n installationId: string;\n manufacturer: string;\n modelName: string;\n osName: string;\n osVersion: string;\n timestamp: Date;\n};\n\nexport type TermsAgreement = DeviceInfo & {\n termVersion: string;\n};\n\nexport type ResourceContactDetailsType = {\n email?: string | null;\n landlinePhone?: string | null;\n mobilePhone?: string | null;\n};\n\nexport type ResourceImageType = {\n active: boolean;\n source: string;\n title: string;\n};\n\nexport type SocialMediaType = {\n name?: EnumSocialMedia;\n link?: string;\n};\n\nexport type UserLicenceType = {\n expiryDate: Date;\n issuedDate: Date;\n licenceType: EnumUserLicence;\n prevLicenceType?: EnumUserLicence | null;\n};\n\nexport type OwnerType = {\n email: string;\n userId: string;\n};\n\nexport interface BaseResourceTypeFormData {\n _id?: string;\n active: boolean;\n contactDetails: ResourceContactDetailsType | null;\n cover: ResourceImageType;\n coverUpload?: ResourceImageType | null;\n description: string;\n images?: ResourceImageType[] | null;\n imagesUpload?: ResourceImageType[] | null;\n logo?: ResourceImageType | null;\n logoUpload?: ResourceImageType | null;\n name: string;\n promoCodes?: PromoCodeType[] | null;\n region: string;\n socialMedia: SocialMediaType[] | null;\n termsAgreement?: TermsAgreement | null;\n}\n\nexport type PosterUsageType = {\n month: string;\n count: number;\n};\n\nexport type RelatedPostType = {\n postActive: boolean;\n postId: string;\n postSlug: string;\n postType: EnumPostType;\n};\n\nexport type SocialShareResourceType = {\n qrCode: ResourceImageType;\n socialImage: ResourceImageType;\n};\n\nexport type BaseResourceType = Omit<\n BaseResourceTypeFormData,\n \"_id\" | \"coverUpload\" | \"imagesUpload\" | \"logoUpload\"\n> & {\n _id: string;\n adIds?: string[] | null;\n approvedAt?: Date | null;\n createdAt: Date;\n deletedAt: Date | null;\n owner: OwnerType;\n posterUsage?: PosterUsageType | null;\n rating?: number | null;\n relatedPost?: RelatedPostType | null;\n reviewCount?: number | null;\n sharePublic?: SocialShareResourceType | null;\n slug: string;\n updatedAt: Date | null;\n};\n\nexport type LocationGeoType = {\n coordinates: number[]; // [longitude, latitude]\n type: \"Point\"; // Mongoose GeoJSON type\n};\n\nexport type LocationType = {\n city: string;\n country: string;\n fullAddress: string;\n geo: LocationGeoType;\n latitude: number;\n longitude: number;\n region: string;\n};\n\nexport type DateTimeType = {\n dateStatus: EnumEventDateStatus;\n endDate: string;\n endTime: string;\n startDate: string;\n startTime: string;\n};\n\nexport type DateTimeFormValue = {\n dateStatus: EnumEventDateStatus;\n endDate?: string;\n endTime?: string;\n startDate?: string;\n startTime?: string;\n};\n\nexport type Region = {\n latitude: number;\n latitudeDelta: number;\n longitude: number;\n longitudeDelta: number;\n};\n\nexport type ResourceDetails = {\n dateTime: DateTimeType[] | null;\n description: string | null;\n eventStatus?: EventStatusType | null;\n location: LocationType | null;\n resourceCover: ResourceImageType | null;\n resourceId: string;\n resourceLogo: ResourceImageType | null;\n resourceName: string;\n resourceType: EnumResourceType;\n};\n\nexport type GeocodeLocation = Pick<LocationType, \"latitude\" | \"longitude\">;\n\nexport type EventStatusType = {\n claimed: boolean;\n eventType: EnumEventType;\n googlePlaceId?: string | null;\n};\n\nexport interface FormField {\n disabled?: boolean;\n helperText?: string;\n isTextArea?: boolean;\n keyboardType?:\n | \"default\"\n | \"email-address\"\n | \"number-pad\"\n | \"url\"\n | \"decimal-pad\"\n | \"phone-pad\";\n name: string;\n placeholder: string;\n required?: boolean;\n secureTextEntry?: boolean;\n}\n\nexport interface FormDateField {\n dateMode: \"date\" | \"time\";\n helperText?: string;\n name: \"endDate\" | \"endTime\" | \"startDate\" | \"startTime\";\n placeholder: string;\n}\n\nexport interface SubcategoryItems {\n id: string;\n name: string;\n description?: string | null;\n}\n\nexport interface Subcategory {\n id: string;\n name: string;\n items?: SubcategoryItems[] | null;\n}\n\nexport type CategoryColorType = {\n primary: string;\n secondary: string;\n};\n\nexport interface Category {\n color?: CategoryColorType | null;\n description?: string | null;\n id: string;\n name: string;\n subcategories: Subcategory[];\n}\n\nexport type OptionItem = {\n value: string;\n label: string;\n};\n\nexport type ImageObjectType = {\n uri: string;\n type: string;\n name: string;\n};\n\nexport interface ResourceConnectionsType {\n events: EventListItemType[] | null;\n vendors: VendorType[] | null;\n}\n\nexport interface CreateFormData<T extends FieldValues> {\n control: Control<T, any>;\n fields: T;\n formState: FormState<T>;\n handleSubmit: UseFormHandleSubmit<T, any>;\n reset: UseFormReset<T>;\n setValue: UseFormSetValue<T>;\n watch: UseFormWatch<T>;\n getValues: UseFormGetValues<T>;\n}\n\n/** Offset-pagination input for plain list fields (events/vendors/partners/posts/users). */\nexport interface PaginationOptions {\n limit?: number;\n offset?: number;\n}\n\n/** Server-side filter input for the super-admin users list query. */\nexport interface UserListFilter {\n active?: boolean | null;\n hasLicences?: boolean | null;\n role?: EnumUserRole | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin partners list query. */\nexport interface PartnerListFilter {\n active?: boolean | null;\n partnerType?: EnumPartnerType | null;\n region?: EnumRegions | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin vendors list query. */\nexport interface VendorListFilter {\n active?: boolean | null;\n region?: EnumRegions | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin events list query. */\nexport interface EventListFilter {\n active?: boolean | null;\n claimed?: boolean | null;\n region?: EnumRegions | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin posts list query. */\nexport interface PostListFilter {\n active?: boolean | null;\n postType?: EnumPostType | null;\n search?: string | null;\n}\n\nexport interface UseGetResourcesByRegionOptions extends PaginationOptions {\n onlyClaimed?: boolean;\n skip?: boolean;\n}\n","import { EnumUserLicence } from \"../enums\";\n\n/** Tier keys in descending priority (highest first) for licence resolution. */\nexport const TIERS_BY_PRIORITY = [\"pro_plus\", \"pro\", \"standard\"] as const;\n\n/** Canonical subscription tier keys — matches Stripe/server tier identifiers. */\nexport type Tier = (typeof TIERS_BY_PRIORITY)[number];\n\n/** User-facing tier labels (decoupled from the Tier discriminant). */\nexport const TIER_DISPLAY_LABELS: Record<Tier, string> = {\n pro: \"Pro\",\n // eslint-disable-next-line camelcase\n pro_plus: \"Pro+ Ads\",\n standard: \"Standard\",\n};\n\n/** Maps licence enums to their canonical tier key. */\nexport const TIER_FROM_LICENCE: Record<EnumUserLicence, Tier> = {\n [EnumUserLicence.PRO_EVENT]: \"pro\",\n [EnumUserLicence.PRO_PLUS_EVENT]: \"pro_plus\",\n [EnumUserLicence.PRO_PLUS_VENDOR]: \"pro_plus\",\n [EnumUserLicence.PRO_VENDOR]: \"pro\",\n [EnumUserLicence.STANDARD_EVENT]: \"standard\",\n [EnumUserLicence.STANDARD_PARTNER]: \"standard\",\n [EnumUserLicence.STANDARD_VENDOR]: \"standard\",\n [EnumUserLicence.STANDARD_AFFILIATE]: \"standard\",\n [EnumUserLicence.STANDARD_SCHOOL]: \"standard\",\n};\n","import {\n EnumInviteStatus,\n EnumPaymentMethod,\n EnumRegions,\n EnumReward,\n EnumSocialMedia,\n EnumUserLicence,\n} from \"src/enums\";\nimport { stripOverlaySubtitleSpecialChars } from \"src/sharing/normalizeShareDescription\";\nimport {\n EnumPostType,\n OptionItem,\n PROMO_CODE_PREFIX,\n SocialMediaType,\n} from \"src/types\";\n\nimport { isIsoDateString } from \"./date\";\nimport { mapArrayToOptions } from \"./mapArrayToOptions\";\n\nexport const removeTypename = (obj: any): any => {\n // Preserve Date objects\n if (obj instanceof Date) {\n return obj;\n }\n\n // Preserve File objects (for apollo-upload-client)\n if (obj instanceof File) {\n return obj;\n }\n\n // Preserve ISO date strings\n if (isIsoDateString(obj)) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map(removeTypename);\n }\n\n // Handle plain objects only\n if (obj !== null && typeof obj === \"object\") {\n const { __typename, ...cleanedObj } = obj;\n\n return Object.keys(cleanedObj).reduce((acc: any, key) => {\n acc[key] = removeTypename(cleanedObj[key]);\n return acc;\n }, {});\n }\n\n // Primitives\n return obj;\n};\n\n/**\n * Truncate text to a specified length and append ellipsis if necessary.\n * @param text\n * @param maxLength\n * @returns\n */\nexport const truncateText = (text: string, maxLength: number = 30): string => {\n const result = stripOverlaySubtitleSpecialChars(text);\n return result.length > maxLength\n ? result.substring(0, maxLength) + \"...\"\n : result;\n};\n\nexport const capitalizeFirstLetter = (str: string): string => {\n return str\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \");\n};\n\nexport const statusOptions = [\n ...Object.values(EnumInviteStatus)\n .map((status) => ({\n label: status,\n value: status,\n }))\n .sort((a, b) => a.label.localeCompare(b.label)), // Sort the options alphabetically\n];\n\nexport const availableRegionTypes = Object.values(EnumRegions);\nexport const availableRegionOptions: OptionItem[] =\n mapArrayToOptions(availableRegionTypes);\n\nexport const paymentMethodOptions: OptionItem[] = mapArrayToOptions(\n Object.values(EnumPaymentMethod),\n);\n\nexport function normalizeUrl(url: string): string {\n const withProtocol =\n !url.startsWith(\"http://\") && !url.startsWith(\"https://\")\n ? `https://${url}`\n : url;\n return withProtocol.replace(/\\/+$/, \"\");\n}\n\nexport const licenseNiceNames: Record<EnumUserLicence, string> = {\n [EnumUserLicence.PRO_EVENT]: \"Pro Event\",\n [EnumUserLicence.PRO_VENDOR]: \"Pro Stallholder\",\n [EnumUserLicence.STANDARD_EVENT]: \"Standard Event\",\n [EnumUserLicence.STANDARD_VENDOR]: \"Standard Stallholder\",\n [EnumUserLicence.PRO_PLUS_EVENT]: \"Pro+Ads Event\",\n [EnumUserLicence.PRO_PLUS_VENDOR]: \"Pro+Ads Stallholder\",\n [EnumUserLicence.STANDARD_PARTNER]: \"Partner\",\n [EnumUserLicence.STANDARD_AFFILIATE]: \"Affiliate\",\n [EnumUserLicence.STANDARD_SCHOOL]: \"School\",\n};\n\nexport const vendorLicences: EnumUserLicence[] = [\n EnumUserLicence.STANDARD_VENDOR,\n EnumUserLicence.PRO_VENDOR,\n EnumUserLicence.PRO_PLUS_VENDOR,\n];\n\nexport const cluemartSocialMedia: SocialMediaType[] = [\n {\n link: \"https://www.facebook.com/ClueMartApp\",\n name: EnumSocialMedia.FACEBOOK,\n },\n {\n link: \"https://www.instagram.com/cluemart_app\",\n name: EnumSocialMedia.INSTAGRAM,\n },\n {\n link: \"https://www.tiktok.com/@cluemart\",\n name: EnumSocialMedia.TIKTOK,\n },\n {\n link: \"https://www.youtube.com/@ClueMart-App-NZ\",\n name: EnumSocialMedia.YOUTUBE,\n },\n];\n\nexport const IOS_URL = \"https://apps.apple.com/nz/app/cluemart/id6747251008\";\nexport const ANDROID_URL =\n \"https://play.google.com/store/apps/details?id=com.timardex.cluemart\";\n\nexport const DEFAULT_RESOURCES_RETURN_LIMIT = 1000;\nexport const DEFAULT_RESOURCES_RETURN_OFFSET = 0;\nexport const CLUEMART_MAIN_DOMAIN_URL = \"https://cluemart.co.nz\";\n\nexport const rewardNiceNames: Record<\n EnumReward,\n { name: string; points: number }\n> = {\n [EnumReward.MYSTERY_JOY_BOX]: {\n name: \"Mystery Joy Box\",\n points: 250,\n },\n [EnumReward.MYSTERY_SQUEEZE_BOX]: {\n name: \"Mystery Squeeze Box\",\n points: 350,\n },\n [EnumReward.MYSTERY_DELUXE_BOX]: {\n name: \"Mystery Deluxe Box\",\n points: 500,\n },\n};\n\nexport const PostTypeLabels: Record<EnumPostType, string> = {\n [EnumPostType.MARKET_FACES]: \"Market Faces\",\n [EnumPostType.CLUE_BITES]: \"Clue Bites\",\n [EnumPostType.PLAY_AND_WIN]: \"Play & Win\",\n //[EnumPostType.CLUE_GUIDES_FOR_ORGANISERS]: \"Clue Guides for Organisers\",\n //[EnumPostType.CLUE_GUIDES_FOR_VENDORS]: \"Clue Guides for Stallholders\",\n};\n\n/** Hardcoded registration gateway code; only valid at sign-up (not a generated school referral code). */\nexport const CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;\n\n/** Hardcoded registration gateway code; only valid at sign-up (not a generated affiliate referral code). */\nexport const CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;\n\nexport function formatNZBankAccount(input: string): string {\n // Remove all non-digit characters\n const digitsOnly = input.replaceAll(/\\D/g, \"\");\n\n // Build the formatted string step-by-step\n const parts = [];\n if (digitsOnly.length > 0) parts.push(digitsOnly.slice(0, 2)); // bank\n if (digitsOnly.length > 2) parts.push(digitsOnly.slice(2, 6)); // branch\n if (digitsOnly.length > 6) parts.push(digitsOnly.slice(6, 13)); // account\n if (digitsOnly.length > 13) parts.push(digitsOnly.slice(13, 15)); // suffix\n\n return parts.join(\"-\");\n}\n","import { ResourceImageType } from \"../types/global\";\n\n/**\n * Loose input shape for normalization helpers. Callers often pass partial or legacy\n * data (e.g. Mongo docs without `active`, GraphQL input, empty placeholders) before\n * it becomes a strict `ResourceImageType`.\n */\ntype ResourceImageLike = {\n active?: boolean | null;\n source?: string | null;\n title?: string | null;\n};\n\n/**\n * Resolves whether a resource image is active.\n * Only an explicit `active: true` shows the image; missing `active` defaults to false\n * so licence downgrades (e.g. standard vendor gallery limit) are not overridden.\n */\nexport function resolveResourceImageActive(\n image: ResourceImageLike | null | undefined,\n): boolean {\n if (image?.active != null) {\n return image.active;\n }\n\n return false;\n}\n\nexport function normalizeResourceImage(\n image: ResourceImageLike | null | undefined,\n): ResourceImageType {\n return {\n active: resolveResourceImageActive(image),\n source: image?.source ?? \"\",\n title: image?.title ?? \"\",\n };\n}\n\nexport function isResourceImageActive(\n image: ResourceImageLike | null | undefined,\n): boolean {\n return resolveResourceImageActive(image);\n}\n","export const SCHOOL_MIN_STUDENT_COUNT = 300;\nexport const SCHOOL_MAX_STUDENT_COUNT = 0;\n","import type { UserOverallPointsEntry } from \"../types/user\";\n\n/**\n * Spendable points for a user.\n *\n * `overallPoints` is an append-only ledger (one entry per award), so the total\n * is always the sum of every entry rather than a single stored number.\n *\n * Nullish ledgers and nullish entries are skipped, so a partially written\n * document cannot throw while the total is computed.\n */\nexport function sumUserOverallPoints(\n points: (UserOverallPointsEntry | null | undefined)[] | null | undefined,\n): number {\n return (points ?? []).reduce(\n (total, entry) => total + (entry?.points ?? 0),\n 0,\n );\n}\n","import dayjs from \"dayjs\";\n\nimport { EVENT_DATE_STATUS_LABELS } from \"src/utils/eventDateStatus\";\n\nimport { EnumEventDateStatus, EnumResourceType } from \"../enums\";\nimport type { DateTimeType, LocationType } from \"../types/global\";\nimport { dateFormat, formatDate, isoDateFormat } from \"../utils/date\";\n\nexport type CalendarSheetContentData = {\n dateTime: DateTimeType;\n location: LocationType;\n resourceId: string;\n resourceType: EnumResourceType;\n};\n\nexport type EventScheduleStatusTone =\n | \"started\"\n | \"startingSoon\"\n | \"upcoming\"\n | \"ended\"\n | \"canceled\"\n | \"rescheduled\"\n | \"invalid\"\n | \"default\";\n\nexport type EventScheduleStatusPresentation = {\n status: EnumEventDateStatus;\n statusLabel: string;\n tone: EventScheduleStatusTone;\n};\n\nexport function toCalendarIsoDate(startDate: string): string | null {\n const formatted = dayjs(startDate, dateFormat).format(isoDateFormat);\n\n return dayjs(formatted, isoDateFormat, true).isValid() ? formatted : null;\n}\n\nexport function fromCalendarIsoDate(isoDate: string): string {\n return dayjs(isoDate, isoDateFormat).format(dateFormat);\n}\n\nexport function getEventCalendarIsoDates(\n dateTimes: Array<{ startDate?: string | null }> | null | undefined,\n): string[] {\n return (\n dateTimes\n ?.map((dateTime) =>\n dateTime.startDate ? toCalendarIsoDate(dateTime.startDate) : null,\n )\n .filter((date): date is string => Boolean(date)) ?? []\n );\n}\n\nexport function findEventDateTimeByIsoDate(\n dateTimes: DateTimeType[] | null | undefined,\n isoDate: string,\n): DateTimeType | null {\n const selected = fromCalendarIsoDate(isoDate);\n\n return dateTimes?.find((dateTime) => dateTime.startDate === selected) ?? null;\n}\n\nexport function buildCalendarSheetContentData(\n dateTimes: DateTimeType[],\n isoDate: string,\n location: LocationType,\n resourceId: string,\n resourceType: EnumResourceType,\n): CalendarSheetContentData | null {\n const dateTime = findEventDateTimeByIsoDate(dateTimes, isoDate);\n\n if (!dateTime) {\n return null;\n }\n\n return {\n dateTime,\n location,\n resourceId,\n resourceType,\n };\n}\n\nexport function getEventScheduleStatusTone(\n status: EnumEventDateStatus,\n): EventScheduleStatusTone {\n switch (status) {\n case EnumEventDateStatus.STARTED:\n return \"started\";\n case EnumEventDateStatus.STARTING_SOON:\n return \"startingSoon\";\n case EnumEventDateStatus.TODAY:\n case EnumEventDateStatus.TOMORROW:\n case EnumEventDateStatus.THIS_WEEK:\n case EnumEventDateStatus.NEXT_WEEK:\n case EnumEventDateStatus.UPCOMING:\n return \"upcoming\";\n case EnumEventDateStatus.ENDED:\n return \"ended\";\n case EnumEventDateStatus.CANCELED:\n return \"canceled\";\n case EnumEventDateStatus.RE_SCHEDULED:\n return \"rescheduled\";\n case EnumEventDateStatus.INVALID:\n return \"invalid\";\n default:\n return \"default\";\n }\n}\n\nexport function getEventScheduleStatusPresentation(\n dateTime: DateTimeType,\n): EventScheduleStatusPresentation {\n return {\n status: dateTime.dateStatus,\n statusLabel: EVENT_DATE_STATUS_LABELS[dateTime.dateStatus],\n tone: getEventScheduleStatusTone(dateTime.dateStatus),\n };\n}\n\nexport function getEventScheduleStatusLabel(\n dateTime: DateTimeType,\n): string | null {\n const { dateStatus: status } = dateTime;\n\n if (!status) {\n return null;\n }\n\n return EVENT_DATE_STATUS_LABELS[status];\n}\n\nexport function shouldShowEventActionsWithWeather(\n resourceType: EnumResourceType,\n dateTime: DateTimeType,\n location: LocationType | null | undefined,\n): boolean {\n return (\n resourceType === EnumResourceType.EVENT &&\n Boolean(location) &&\n Boolean(dateTime?.dateStatus) &&\n ![EnumEventDateStatus.ENDED, EnumEventDateStatus.CANCELED].includes(\n dateTime.dateStatus,\n )\n );\n}\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const clothingAndFashion: Category[] = [\n {\n id: \"clothing-fashion\",\n name: \"Clothing & Fashion\",\n description:\n \"New, handmade, or upcycled clothing and accessories with a creative twist.\",\n subcategories: [\n {\n id: \"apparel-babywear\",\n name: \"Apparel & Babywear\",\n items: [\n {\n id: \"apparel\",\n name: \"Apparel\",\n description: \"Dresses, t-shirts, jumpers, rompers, sets, kidswear.\",\n },\n {\n id: \"baby-toddler-apparel\",\n name: \"Baby & Toddler Apparel\",\n description:\n \"Handmade baby clothes, soft shoes, bibs, hats, knitted sets.\",\n },\n {\n id: \"upcycled-fashion\",\n name: \"Upcycled Fashion\",\n description:\n \"Reworked garments, patchwork pieces, restyled vintage.\",\n },\n {\n id: \"other-wearable-items\",\n name: \"Other wearable items\",\n description: \"Unique clothing not listed above.\",\n },\n ],\n },\n {\n id: \"fashion-accessories\",\n name: \"Fashion Accessories\",\n items: [\n {\n id: \"accessories\",\n name: \"Accessories\",\n description: \"Scarves, belts, gloves, hats, headbands, caps.\",\n },\n {\n id: \"shoes\",\n name: \"Shoes\",\n description: \"Handmade shoes, baby booties, sandals, slippers.\",\n },\n {\n id: \"bags-wallets\",\n name: \"Bags & Wallets\",\n description:\n \"Leather bags, fabric purses, wallets, backpacks, totes.\",\n },\n {\n id: \"other-accessories\",\n name: \"Other accessories\",\n description: \"Brooches, pins, or hybrid functional items.\",\n },\n ],\n },\n {\n id: \"jewelry-creative-wearables\",\n name: \"Jewelry & Creative Wearables\",\n items: [\n {\n id: \"jewelry\",\n name: \"Jewelry\",\n description: \"Necklaces, earrings, bracelets, rings, anklets.\",\n },\n {\n id: \"other-creative-wearables\",\n name: \"Other creative wearables\",\n description:\n \"Wearable art, statement pieces, bold handmade designs.\",\n },\n ],\n },\n {\n id: \"traditional-cultural-clothing-accessories\",\n name: \"Traditional & Cultural Clothing and Accessories\",\n items: [\n {\n id: \"traditional-clothing-accessories\",\n name: \"Traditional Clothing & Accessories \",\n description:\n \"raditional clothing, jewellery, accessories and footwear from around the world, including both handmade and non-handmade items.\",\n },\n {\n id: \"other-traditional-cultural-items\",\n name: \"Other Traditional & Cultural Items\",\n description:\n \"traditional or culturally inspired wearables and decorative cultural pieces such as plates, table linens and similar items.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const electronicsAndTechnology: Category[] = [\n {\n id: \"electronics-technology\",\n name: \"Electronics & Technology\",\n description:\n \"New, second-hand, or handmade tech and digital items commonly found at markets.\",\n subcategories: [\n {\n id: \"mobile-everyday-tech\",\n name: \"Mobile & Everyday Tech\",\n items: [\n {\n id: \"mobile-phone-accessories\",\n name: \"Mobile & Phone Accessories\",\n description:\n \"Phone cases, holders, screen protectors, charging cables, power banks, grips.\",\n },\n {\n id: \"other-mobile-gadgets\",\n name: \"Other mobile gadgets\",\n description:\n \"Stands, styluses, SIM tools, cleaning kits, wallet accessories.\",\n },\n ],\n },\n {\n id: \"audio-music-creative-tech\",\n name: \"Audio, Music & Creative Tech\",\n items: [\n {\n id: \"audio-music-tech\",\n name: \"Audio & Music Tech\",\n description:\n \"Portable speakers, headphones, mini radios, Bluetooth adapters, sound accessories.\",\n },\n {\n id: \"instruments-music-gear\",\n name: \"Instruments & Music Gear\",\n description:\n \"Small electronic instruments, DIY synth kits, drum pads, loop machines.\",\n },\n {\n id: \"recording-creative-devices\",\n name: \"Recording & Creative Devices\",\n description:\n \"USB microphones, podcast tools, voice recorders, mobile lighting, content tools.\",\n },\n {\n id: \"other-audio-music-items\",\n name: \"Other audio or music-related items\",\n description: \"Musical gadgets or creative gear not listed above.\",\n },\n ],\n },\n {\n id: \"diy-gadgets-secondhand-finds\",\n name: \"DIY, Gadgets & Second-Hand Finds\",\n items: [\n {\n id: \"diy-electronics-tools\",\n name: \"DIY Electronics & Tools\",\n description:\n \"LED lights, USB gadgets, circuit boards, repair kits, tech-themed toys, novelty items.\",\n },\n {\n id: \"other-tech-finds\",\n name: \"Other Tech Finds\",\n description:\n \"Used electronics, smart gadgets, wearable tech, calculators, tablet stands, e-waste upcycles.\",\n },\n {\n id: \"other-technology-innovation-items\",\n name: \"Other technology or innovation-related items\",\n description: \"Anything not covered but clearly tech-driven.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const foodAndBeverages: Category[] = [\n {\n id: \"food-beverages\",\n name: \"Food & Beverages\",\n description:\n \"Fresh produce, drinks, sweet and savoury street food, ready-to-eat meals, and packaged goods.\",\n subcategories: [\n {\n id: \"fresh-food-groceries\",\n name: \"Fresh Food & Groceries\",\n items: [\n {\n id: \"fruits-vegetables\",\n name: \"Fruits & Vegetables\",\n description:\n \"Fresh seasonal fruit, organic vegetables, specialty produce, berries, tropical fruit, heritage varieties.\",\n },\n {\n id: \"meat-seafood\",\n name: \"Meat & Seafood\",\n description:\n \"Butcher cuts, fresh fish, smoked meats, sausages, seafood platters, artisanal jerky.\",\n },\n {\n id: \"dairy-eggs\",\n name: \"Dairy & Eggs\",\n description:\n \"Farm eggs, handmade cheeses, yoghurt, fresh milk, goat’s milk products.\",\n },\n {\n id: \"bakery-pastries\",\n name: \"Bakery & Pastries\",\n description:\n \"Freshly baked bread, sourdough, bagels, croissants, focaccia, traditional baked goods.\",\n },\n {\n id: \"spices-condiments\",\n name: \"Spices & Condiments\",\n description:\n \"Dried herbs, spice blends, specialty salts, hot sauces, infused oils, chutneys.\",\n },\n {\n id: \"packaged-specialty-foods\",\n name: \"Packaged & Specialty Foods\",\n description:\n \"Honey, jams, preserves, pickles, nut butters, sauces, pre-packaged snacks.\",\n },\n {\n id: \"other-fresh-food-items\",\n name: \"Other fresh food items\",\n description:\n \"Items that don’t fit above, e.g. fermented foods, plant-based substitutes.\",\n },\n ],\n },\n {\n id: \"beverages-specialty-drinks\",\n name: \"Beverages & Specialty Drinks\",\n items: [\n {\n id: \"fresh-juices-smoothies\",\n name: \"Fresh Juices & Smoothies\",\n description:\n \"Cold-pressed juices, detox blends, fruit smoothies, tropical mixes.\",\n },\n {\n id: \"coffee-teas\",\n name: \"Coffee & Teas\",\n description:\n \"Espresso, pour-over coffee, herbal teas, matcha, bubble tea, locally blended tea.\",\n },\n {\n id: \"dairy-plant-based-drinks\",\n name: \"Dairy & Plant-Based Drinks\",\n description:\n \"Milkshakes, lassis, almond/oat milk drinks, coconut water.\",\n },\n {\n id: \"alcoholic-beverages\",\n name: \"Alcoholic Beverages\",\n description:\n \"Local wines, craft beer, mead, cider, infused spirits, cocktail kits.\",\n },\n {\n id: \"other-beverages\",\n name: \"Other beverages\",\n description:\n \"Kombucha, kefir, energy drinks, non-alcoholic wines or beers.\",\n },\n ],\n },\n {\n id: \"savoury-prepared-foods-street-food\",\n name: \"Savoury Prepared Foods & Street Food\",\n items: [\n {\n id: \"local-specialties\",\n name: \"Local Specialties\",\n description:\n \"Meat pies, hangi, seafood chowder, fry bread, traditional NZ dishes.\",\n },\n {\n id: \"asian-cuisine\",\n name: \"Asian Cuisine\",\n description:\n \"Sushi, bao buns, dumplings, ramen, satay, spring rolls, fried rice.\",\n },\n {\n id: \"mediterranean-cuisine\",\n name: \"Mediterranean Cuisine\",\n description: \"Falafel, hummus wraps, souvlaki, Greek salad, dolma.\",\n },\n {\n id: \"italian-delights\",\n name: \"Italian Delights\",\n description: \"Pizza, calzone, focaccia, fresh pasta, arancini.\",\n },\n {\n id: \"bbq-grilled-foods\",\n name: \"BBQ & Grilled Foods\",\n description: \"Kebabs, grilled chicken, ribs, burgers, sausages.\",\n },\n {\n id: \"savoury-crepes-pancakes\",\n name: \"Savoury Crepes & Pancakes\",\n description: \"Filled savoury crepes, mini savoury pancakes.\",\n },\n {\n id: \"savoury-baked-goods-pastries\",\n name: \"Savoury Baked Goods & Pastries\",\n description:\n \"Quiches, savoury muffins, filled savoury pastries, empanadas.\",\n },\n {\n id: \"vegan-vegetarian-dishes\",\n name: \"Vegan & Vegetarian Dishes\",\n description:\n \"Buddha bowls, plant-based burgers, salads, vegan sushi.\",\n },\n {\n id: \"other-savoury-foods\",\n name: \"Other Savoury Foods\",\n description: \"Fusion dishes, mixed platters, savoury meal kits.\",\n },\n ],\n },\n {\n id: \"sweet-prepared-foods\",\n name: \"Sweet Prepared Foods\",\n items: [\n {\n id: \"sweet-crepes-pancakes-fried-treats\",\n name: \"Sweet Crepes, Pancakes & Fried Treats\",\n description: \"Crepes, waffles, mini pancakes, muffins, doughnuts.\",\n },\n {\n id: \"sweet-baked-goods-desserts\",\n name: \"Sweet Baked Goods & Desserts\",\n description: \"Cakes, pastries, slices, trifles, layered desserts.\",\n },\n {\n id: \"fruit-based-snacks\",\n name: \"Fruit-Based Snacks\",\n description:\n \"Fruit skewers, dried fruit packs, chocolate-dipped fruit.\",\n },\n {\n id: \"candy-confectionery\",\n name: \"Candy & Confectionery\",\n description: \"Fudge, handmade candies, toffee, nougat, brittle.\",\n },\n {\n id: \"other-sweet-foods\",\n name: \"Other Sweet Foods\",\n description: \"Fusion desserts, sweet platters, sweet meal kits.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const handmadeAndLocalProducts: Category[] = [\n {\n id: \"handmade-local-products\",\n name: \"Handmade & Local Products\",\n description: \"Unique, handmade, or locally produced artisan goods.\",\n subcategories: [\n {\n id: \"home-living\",\n name: \"Home & Living\",\n items: [\n {\n id: \"ceramics-pottery\",\n name: \"Ceramics & Pottery\",\n description:\n \"Handmade mugs, vases, bowls, decorative plates, plant pots.\",\n },\n {\n id: \"candles-home-scents\",\n name: \"Candles & Home Scents\",\n description:\n \"Soy candles, beeswax candles, wax melts, incense sticks, room sprays and herbal sachets.\",\n },\n {\n id: \"botanical-crafts\",\n name: \"Botanical Crafts\",\n description: \"Dried-flower décor and pressed-flower crafts\",\n },\n {\n id: \"textiles-embroidery\",\n name: \"Textiles & Embroidery\",\n description:\n \"Handsewn items, embroidered napkins, home linens, aprons, fabric gift wraps, handmade fabric bags, quilted goods, personalized textile gifts.\",\n },\n {\n id: \"woodcraft-metalcraft\",\n name: \"Woodcraft & Metalcraft\",\n description:\n \"Wooden boards, handmade frames, sculptures, metal signs, furniture.\",\n },\n {\n id: \"handmade-soaps-natural-body-goods\",\n name: \"Handmade Soaps & Natural Body Goods\",\n description: \"Handmade soaps, balms, oils, bath items\",\n },\n {\n id: \"seasonal-festive-crafts\",\n name: \"Seasonal & Festive Crafts\",\n description: \"Christmas, Easter and seasonal handmade decor\",\n },\n {\n id: \"other-home-living-products\",\n name: \"Other home & living products\",\n description:\n \"Items that don't fit above but serve home-related purposes.\",\n },\n ],\n },\n {\n id: \"art-personal-expression\",\n name: \"Art & Personal Expression\",\n items: [\n {\n id: \"paintings-illustrations\",\n name: \"Paintings & Illustrations\",\n description:\n \"Paintings, canvas art, hand-drawn illustrations, digital prints, graphic art and calligraphy pieces.\",\n },\n {\n id: \"sculptures-carvings\",\n name: \"Sculptures & Carvings \",\n description:\n \"Sculptures made from wood, stone, metal, clay or resin, carved decorative pieces and artistic 3D works.\",\n },\n {\n id: \"creative-handmade-alternative-art\",\n name: \"Creative Handmade & Alternative Art\",\n description:\n \"Handmade textile décor, fabric ornaments, mixed-media art, creative craft pieces and modern handmade artworks.\",\n },\n {\n id: \"handmade-mini-figures-decor\",\n name: \"Handmade Mini Figures & Décor\",\n description:\n \"Small handmade figures, tiny houses and crafted mini decorative items.\",\n },\n {\n id: \"other-artistic-expressive-products\",\n name: \"Other Artistic or Expressive Products\",\n description:\n \"Custom artworks, specialty handmade décor, unique crafts.\",\n },\n ],\n },\n {\n id: \"handmade-jewellery-accessories-cultural-crafts\",\n name: \"Handmade Jewellery, Accessories & Cultural Crafts\",\n items: [\n {\n id: \"jewellery-handmade-items-nz-traditional-materials\",\n name: \"Jewellery & Handmade Items from NZ Traditional Materials\",\n description:\n \"Handmade jewellery and decorative or functional items crafted from pounamu, bone, wood and other traditional New Zealand materials.\",\n },\n {\n id: \"maori-pasifika-cultural-crafts-clothing\",\n name: \"Māori & Pasifika Cultural Crafts and Clothing\",\n description:\n \"Culturally inspired handmade items, accessories and garments featuring Māori or Pasifika motifs, traditional patterns and regional craftsmanship.\",\n },\n {\n id: \"traditional-handmade-clothing-jewellery-crafts-global-cultures\",\n name: \"Traditional Handmade Clothing, Jewellery & Crafts from Global Cultures\",\n description:\n \"Handcrafted clothing, jewellery and cultural items from diverse traditions — including Asian, African, European, Middle Eastern, Indian, Chinese, Japanese, Pacific, and other culturally significant handmade pieces.\",\n },\n {\n id: \"other-handmade-cultural-items\",\n name: \"Other Handmade Cultural Items\",\n description:\n \"Unique or culturally inspired handmade pieces not specifically covered in the categories above.\",\n },\n ],\n },\n {\n id: \"gift-ideas-accessories\",\n name: \"Gift Ideas & Accessories\",\n items: [\n {\n id: \"handmade-pens-keychains-fridge-magnets\",\n name: \"Handmade Pens, Keychains and Fridge Magnets\",\n description: null,\n },\n {\n id: \"gift-packaging-wrapping-accessories\",\n name: \"Gift Packaging & Wrapping Accessories\",\n description: null,\n },\n {\n id: \"handmade-crochet-knitting-fibre-crafts\",\n name: \"Handmade Crochet, Knitting & Fibre Crafts\",\n description:\n \"Handmade crochet and knitted items, fabric-based crafts, small decorative pieces, creative fibre artworks and unique handcrafted accessories.\",\n },\n {\n id: \"handmade-toys-mini-play-items\",\n name: \"Handmade Toys & Mini Play Items\",\n description:\n \"small handmade toys, soft toys, wooden miniatures, crochet or felt play pieces\",\n },\n {\n id: \"other-small-handmade-gifts-accessories\",\n name: \"Other small handmade gifts or accessories\",\n description: \"Compact creative items made to surprise or delight.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const healthAndWellness: Category[] = [\n {\n id: \"health-wellness\",\n name: \"Health & Wellness\",\n description:\n \"Natural products and services that promote wellbeing, body care, and holistic health.\",\n subcategories: [\n {\n id: \"body-skincare\",\n name: \"Body & Skincare\",\n items: [\n {\n id: \"skincare-body-products\",\n name: \"Skincare & Body Products\",\n description:\n \"Soaps, creams, lip balms, bath salts, bath bombs, body oils, natural deodorants.\",\n },\n {\n id: \"other-body-care-items\",\n name: \"Other body care items\",\n description:\n \"Additional handmade or eco-conscious personal care goods.\",\n },\n ],\n },\n {\n id: \"aromatherapy-herbal-wellness\",\n name: \"Aromatherapy & Herbal Wellness\",\n items: [\n {\n id: \"aromatherapy-herbal-remedies\",\n name: \"Aromatherapy & Herbal Remedies\",\n description:\n \"Essential oils, herbal balms, massage oils, salves, natural teas, rollers.\",\n },\n {\n id: \"other-herbal-aroma-products\",\n name: \"Other herbal or aroma-based products\",\n description: \"Wellness blends, herb sachets, custom infusions.\",\n },\n ],\n },\n {\n id: \"wellness-tools-accessories\",\n name: \"Wellness Tools & Accessories\",\n items: [\n {\n id: \"wellness-accessories\",\n name: \"Wellness Accessories\",\n description:\n \"Yoga mats, meditation cushions, eye pillows, incense, smudging sticks, eco water bottles, wellness journals.\",\n },\n {\n id: \"spiritual-tools-crystals\",\n name: \"Spiritual Tools & Crystals\",\n description:\n \"Healing crystals, gemstone bracelets, pendulums, sprays, spiritual kits, altar decor.\",\n },\n {\n id: \"other-wellness-spiritual-items\",\n name: \"Other wellness or spiritual items\",\n description: \"Items that aid relaxation, focus, or inner work.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const homeGardenHousehold: Category[] = [\n {\n id: \"home-garden-household-goods\",\n name: \"Home, Garden & Household Goods\",\n description:\n \"Functional, decorative, and eco-conscious products designed for everyday use indoors and outdoors.\",\n subcategories: [\n {\n id: \"home-decor-living\",\n name: \"Home Decor & Living\",\n items: [\n {\n id: \"home-decor\",\n name: \"Home Decor\",\n description:\n \"Cushions, wall art, table runners, vases, trays, mirrors, handmade centerpieces.\",\n },\n {\n id: \"kitchenware-dining\",\n name: \"Kitchenware & Dining\",\n description:\n \"Mugs, bowls, cutting boards, utensils, jars, coasters, kitchen textiles.\",\n },\n {\n id: \"mini-figures-decor\",\n name: \"Mini Figures & Décor\",\n description:\n \"handmade or non-handmade small figures, tiny houses and miniature decorative items.\",\n },\n {\n id: \"other-indoor-home-items\",\n name: \"Other indoor home items\",\n description:\n \"Any decorative or practical household items not listed above.\",\n },\n ],\n },\n {\n id: \"cleaning-eco-essentials\",\n name: \"Cleaning & Eco Essentials\",\n items: [\n {\n id: \"cleaning-eco-supplies\",\n name: \"Cleaning & Eco Supplies\",\n description:\n \"Beeswax wraps, reusable cloths, brushes, natural soaps, detergent bars, eco sponges.\",\n },\n {\n id: \"other-eco-cleaning-items\",\n name: \"Other eco or cleaning items\",\n description: \"Environmentally friendly goods not listed above.\",\n },\n ],\n },\n {\n id: \"garden-outdoor-living\",\n name: \"Garden & Outdoor Living\",\n items: [\n {\n id: \"plants-botanical-decor\",\n name: \"Plants & Botanical Decor\",\n description:\n \"Potted herbs, succulents, dried flowers, terrariums, plant-based ornaments.\",\n },\n {\n id: \"fresh-flowers-botanical-bouquets\",\n name: \"Fresh Flowers & Botanical Bouquets\",\n description:\n \"Cut flowers, seasonal bouquets, simple floral arrangements, native flower selections, and other fresh botanical items.\",\n },\n {\n id: \"natural-decor-nature-inspired-elements\",\n name: \"Natural Decor & Nature-Inspired Elements\",\n description:\n \"Seashell décor, driftwood pieces, sand ornaments, natural wood accents, stone or mineral decorations, and other nature-based decorative items.\",\n },\n {\n id: \"garden-tools-outdoor-items\",\n name: \"Garden Tools & Outdoor Items\",\n description:\n \"Plant markers, garden signs, stakes, small tools, wind chimes, gifts.\",\n },\n {\n id: \"other-outdoor-garden-products\",\n name: \"Other outdoor or garden products\",\n description: \"Functional or decorative items for outside use.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const petProductsAndAnimalGoods: Category[] = [\n {\n id: \"pet-products-animal-goods\",\n name: \"Pet Products & Animal Goods\",\n description: \"Items for pets, pet lovers, or animal-themed market stalls.\",\n subcategories: [\n {\n id: \"products-for-pets\",\n name: \"Products for Pets\",\n items: [\n {\n id: \"pet-food-treats\",\n name: \"Pet Food & Treats\",\n description:\n \"Homemade dog biscuits, cat snacks, natural chews, pet-safe cakes, training treats.\",\n },\n {\n id: \"apparel-toys-accessories\",\n name: \"Apparel, Toys & Accessories\",\n description:\n \"Leashes, collars, harnesses, toys, grooming tools, beds, travel gear, jumpers, bandanas.\",\n },\n {\n id: \"other-pet-products\",\n name: \"Other pet products\",\n description: \"Any pet-related items not listed above.\",\n },\n ],\n },\n {\n id: \"small-pets-birds-exotic-animals\",\n name: \"Small Pets, Birds & Exotic Animals\",\n items: [\n {\n id: \"products-small-pets-birds-exotics\",\n name: \"Products for Small Pets, Birds & Exotics\",\n description:\n \"Toys, enclosures, perches, feeding bowls, bedding, habitat decor, transport gear, and care items for birds, rabbits, hamsters, reptiles, turtles, aquarium pets, and other exotic species.\",\n },\n {\n id: \"other-small-exotic-animal-items\",\n name: \"Other small or exotic animal items\",\n description: \"Unusual accessories for non-mainstream pets.\",\n },\n ],\n },\n {\n id: \"farm-working-animals\",\n name: \"Farm & Working Animals\",\n items: [\n {\n id: \"goods-for-farm-working-animals\",\n name: \"Goods for Farm & Working Animals\",\n description:\n \"Treats, care products, equipment, signage and accessories for chickens, goats, alpacas, horses, and other livestock.\",\n },\n {\n id: \"other-farm-animal-items\",\n name: \"Other farm animal-related items\",\n description:\n \"Rural, barnyard, or utility-specific gear not listed above.\",\n },\n ],\n },\n {\n id: \"animal-themed-gifts-custom-items\",\n name: \"Animal-Themed Gifts & Custom Items\",\n items: [\n {\n id: \"pet-art-custom-gifts\",\n name: \"Pet Art & Custom Gifts\",\n description:\n \"Pet portraits, name tags, personalized bowls, breed-specific items, pet-themed home decor and stationery.\",\n },\n {\n id: \"other-animal-themed-gifts\",\n name: \"Other animal-themed gifts\",\n description:\n \"Artistic or sentimental items made for animal lovers.\",\n },\n ],\n },\n ],\n },\n];\n","import { Category } from \"src/types\";\n\n/* eslint-disable sort-keys */\nexport const serviceAndExperience: Category[] = [\n {\n id: \"services-experiences\",\n name: \"Services & Experiences\",\n description:\n \"On-site offerings that provide entertainment, personal care, learning, or interactive activities beyond products.\",\n subcategories: [\n {\n id: \"personal-care-body-art\",\n name: \"Personal Care & Body Art\",\n items: [\n {\n id: \"nails-handcare\",\n name: \"Nails & Handcare\",\n description:\n \"Nail painting, decoration, quick manicures, temporary nail extensions.\",\n },\n {\n id: \"hair-styling-braiding\",\n name: \"Hair Styling & Braiding\",\n description:\n \"Hair braiding, plaits, child-friendly festival hairstyles.\",\n },\n {\n id: \"face-body-decoration\",\n name: \"Face & Body Decoration\",\n description:\n \"Henna, glitter tattoos, face painting, light makeup, eyelash styling, professional tattooing (where permitted).\",\n },\n {\n id: \"other-beauty-grooming-services\",\n name: \"Other beauty or grooming services\",\n description: \"Small-scale personal care options offered on-site.\",\n },\n ],\n },\n {\n id: \"practical-wellness-services\",\n name: \"Practical & Wellness Services\",\n items: [\n {\n id: \"mobile-practical-services\",\n name: \"Mobile & Practical Services\",\n description:\n \"Shoe repair, phone repairs, knife sharpening, key cutting, battery replacement, bike repairs, engraving.\",\n },\n {\n id: \"wellness-alternative-therapies\",\n name: \"Wellness & Alternative Therapies\",\n description:\n \"Massage, aromatherapy, reflexology, energy healing (e.g. Reiki), natural consultations.\",\n },\n {\n id: \"other-service-based-offerings\",\n name: \"Other service-based offerings\",\n description: \"Wellness or functional services not listed above.\",\n },\n ],\n },\n {\n id: \"creative-educational-experiences\",\n name: \"Creative & Educational Experiences\",\n items: [\n {\n id: \"creative-workshops-maker-services\",\n name: \"Creative Workshops & Maker Services\",\n description:\n \"Candle making, pottery, jewelry crafting, soap or balm workshops, calligraphy, seasonal crafts.\",\n },\n {\n id: \"education-awareness-stalls\",\n name: \"Education & Awareness Stalls\",\n description:\n \"Eco awareness, cultural storytelling, local history, first aid demos, health booths, sustainability education, kids’ science displays.\",\n },\n {\n id: \"other-creative-educational-services\",\n name: \"Other creative or educational services\",\n description:\n \"Informal learning, demonstrations, or community-focused sessions.\",\n },\n ],\n },\n {\n id: \"kids-activities-family-fun\",\n name: \"Kids’ Activities & Family Fun\",\n items: [\n {\n id: \"kids-activities-fun\",\n name: \"Kids’ Activities & Fun\",\n description:\n \"Face painting, glitter tattoos, pony rides, bouncy castles, small amusement rides, balloon twisting, animal petting zones.\",\n },\n {\n id: \"other-family-oriented-activities\",\n name: \"Other family-oriented activities\",\n description:\n \"On-site entertainment that engages children or family groups.\",\n },\n ],\n },\n ],\n },\n];\n","import { Category } from \"src/types\";\n\n/* eslint-disable sort-keys */\nexport const toysChildren: Category[] = [\n {\n id: \"toys-childrens-items\",\n name: \"Toys & Children’s Items\",\n description: \"Products and services made for or inspired by children.\",\n subcategories: [\n {\n id: \"toys-playthings\",\n name: \"Toys & Playthings\",\n items: [\n {\n id: \"toys-classic-electric-character\",\n name: \"Toys – Classic, Electric & Character-Based\",\n description:\n \"Building blocks, dolls, puzzles, plush animals, toy vehicles, remote-control toys, light-up gadgets, character figurines, themed playsets.\",\n },\n {\n id: \"handmade-toys-crafty-playthings\",\n name: \"Handmade Toys & Crafty Playthings\",\n description:\n \"Wooden puzzles, crocheted animals, felt toys, fabric dolls, DIY kits, nature-inspired games, sensory toys.\",\n },\n {\n id: \"other-play-items\",\n name: \"Other play items\",\n description:\n \"Toys not listed above, including limited-edition or hybrid items.\",\n },\n ],\n },\n {\n id: \"educational-developmental\",\n name: \"Educational & Developmental\",\n items: [\n {\n id: \"educational-developmental-tools\",\n name: \"Educational & Developmental Tools\",\n description:\n \"STEM kits, Montessori toys, storybooks, picture books, flashcards, early learning games, language tools.\",\n },\n {\n id: \"other-educational-experience-based-items\",\n name: \"Other educational or experience-based items\",\n description:\n \"Creative experiences or learning aids not listed above.\",\n },\n ],\n },\n {\n id: \"baby-kidswear-accessories\",\n name: \"Baby & Kidswear + Accessories\",\n items: [\n {\n id: \"baby-kidswear-accessories\",\n name: \"Baby & Kidswear + Accessories\",\n description:\n \"Handmade baby clothes, toddler outfits, bibs, hats, headbands, bags, pacifier clips, soft shoes.\",\n },\n {\n id: \"baby-developmental-soft-toys\",\n name: \"Baby Developmental Soft Toys\",\n description:\n \"Sensory toys, rattles, fabric books, teething items, high-contrast cards, and early-skill. Montessori materials designed to support infants’ cognitive and motor development.\",\n },\n {\n id: \"other-childrens-clothing-accessories\",\n name: \"Other children’s clothing or accessories\",\n description: \"Unique fashion or functional pieces for kids.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const vintageAndAntique: Category[] = [\n {\n id: \"vintage-antique\",\n name: \"Vintage & Antique\",\n description:\n \"Unique, historic, or nostalgic items with collectible or decorative value.\",\n subcategories: [\n {\n id: \"vintage-antique-clothing-accessories\",\n name: \"Vintage & Antique Clothing & Accessories\",\n items: [\n {\n id: \"clothing-vintage-fashion\",\n name: \"Clothing and wearable items from past eras\",\n description:\n \"Vintage dresses, jackets, hats, gloves, belts, bags, shoes, jewellery.\",\n },\n {\n id: \"other-clothing-accessory-items\",\n name: \"Other clothing-related items\",\n description:\n \"Hair clips, brooches, pins, scarf rings, small fashion accessories.\",\n },\n ],\n },\n {\n id: \"collectibles-memorabilia\",\n name: \"Collectibles & Memorabilia\",\n items: [\n {\n id: \"small-collectible-items\",\n name: \"Small collectible items with historical or nostalgic significance\",\n description:\n \"Coins, stamps, toys, postcards, comics, sports cards, vintage packaging.\",\n },\n {\n id: \"other-collectible-items\",\n name: \"Other collectible items\",\n description:\n \"Rare small objects, miniature figurines, special-edition items.\",\n },\n ],\n },\n {\n id: \"homewares-decor-curiosities\",\n name: \"Homewares, Decor & Curiosities\",\n items: [\n {\n id: \"decorative-functional-vintage-items\",\n name: \"Decorative or functional items with a vintage or antique aesthetic\",\n description:\n \"Teacups, plates, vases, mirrors, clocks, furniture, old tools, lanterns, typewriters, curiosities.\",\n },\n {\n id: \"handmade-vintage-art\",\n name: \"Handmade vintage art\",\n description: \"Paintings, sculptures, crafted pieces.\",\n },\n {\n id: \"other-home-decor-items\",\n name: \"Other home or decor items\",\n description:\n \"Decorative pieces not listed above, unique household objects.\",\n },\n ],\n },\n {\n id: \"vintage-media-printed-nostalgia\",\n name: \"Vintage Media & Printed Nostalgia\",\n items: [\n {\n id: \"older-media-printed-works\",\n name: \"Older media formats and printed works\",\n description:\n \"Vinyl records, cassette tapes, CDs, DVDs, books, magazines, board games, posters.\",\n },\n {\n id: \"other-media-printed-items\",\n name: \"Other media or printed items\",\n description: \"Maps, manuals, leaflets, out-of-print materials.\",\n },\n ],\n },\n {\n id: \"other-vintage-antique-items\",\n name: \"Other Vintage & Antique Items\",\n items: [\n {\n id: \"any-vintage-antique-items-not-listed\",\n name: \"Any vintage or antique items not listed above\",\n description: \"Unique, rare or uncategorised pieces.\",\n },\n ],\n },\n ],\n },\n];\n","import { Category, CategoryColorType } from \"../../types/global\";\n\nimport { clothingAndFashion } from \"./clothingAndFashion\";\nimport { electronicsAndTechnology } from \"./electronicsAndTechnology\";\nimport { foodAndBeverages } from \"./foodAndBeverages\";\nimport { handmadeAndLocalProducts } from \"./handmadeAndLocalProducts\";\nimport { healthAndWellness } from \"./healthAndWellness\";\nimport { homeGardenHousehold } from \"./homeGardenHousehold\";\nimport { petProductsAndAnimalGoods } from \"./petProductsAndAnimalGoods\";\nimport { serviceAndExperience } from \"./serviceAndExperience\";\nimport { toysChildren } from \"./toysChildren\";\nimport { vintageAndAntique } from \"./vintageAndAntique\";\n\nexport const categoryColors: Record<string, CategoryColorType> = {\n \"clothing-fashion\": {\n primary: \"#9D4EDD\",\n secondary: \"#fff\",\n },\n \"electronics-technology\": {\n primary: \"#3AF3FF\",\n secondary: \"#000\",\n },\n \"food-beverages\": {\n primary: \"#FF0D1F\",\n secondary: \"#fff\",\n },\n \"handmade-local-products\": {\n primary: \"#EE7E54\",\n secondary: \"#fff\",\n },\n \"health-wellness\": {\n primary: \"#E23794\",\n secondary: \"#fff\",\n },\n \"home-garden-household-goods\": {\n primary: \"#067325\",\n secondary: \"#fff\",\n },\n \"pet-products-animal-goods\": {\n primary: \"#68E788\",\n secondary: \"#000\",\n },\n \"services-experiences\": {\n primary: \"#2E16A5\",\n secondary: \"#fff\",\n },\n \"toys-childrens-items\": {\n primary: \"#FFF966\",\n secondary: \"#000\",\n },\n \"vintage-antique\": {\n primary: \"#8D6748\",\n secondary: \"#fff\",\n },\n};\n\nconst assignColorToCategories = (categories: Category[]): Category[] => {\n const result = categories.map((category) => ({\n ...category,\n color: categoryColors[category.id],\n }));\n return result;\n};\n\nexport const availableCategories = assignColorToCategories([\n ...foodAndBeverages,\n ...handmadeAndLocalProducts,\n ...clothingAndFashion,\n ...homeGardenHousehold,\n ...toysChildren,\n ...healthAndWellness,\n ...electronicsAndTechnology,\n ...vintageAndAntique,\n ...petProductsAndAnimalGoods,\n ...serviceAndExperience,\n]);\n","import { availableCategories } from \"../formFields/categories\";\nimport type { UnregisteredVendorType, VendorType } from \"../types/vendor\";\nimport { getUniqueStartDates } from \"../utils/date\";\n\ntype RelationType = NonNullable<VendorType[\"relations\"]>[number];\ntype RelationDateType = NonNullable<RelationType[\"relationDates\"]>[number];\n\nexport type StallholderFilterOption = {\n label: string;\n value: string;\n};\n\nexport function eventStartDatesSet(\n dateTime: Array<{ startDate?: string | null }> | undefined,\n): Set<string> {\n return new Set(\n (dateTime ?? [])\n .map((date) => date.startDate)\n .filter((date): date is string => Boolean(date)),\n );\n}\n\nexport function hasMatchingEventDate(\n vendorStartDates: string[],\n eventStartDates: Set<string>,\n): boolean {\n return vendorStartDates.some((startDate) => eventStartDates.has(startDate));\n}\n\nexport function matchesSelectedDate(\n vendorStartDates: string[],\n selectedDate: string | null,\n): boolean {\n if (!selectedDate) {\n return true;\n }\n\n return vendorStartDates.includes(selectedDate);\n}\n\nexport function matchesCategory(\n categoryNames: string[],\n selectedCategory: string | null,\n): boolean {\n if (!selectedCategory) {\n return true;\n }\n\n return categoryNames.includes(selectedCategory);\n}\n\nexport function getRegisteredVendorStartDates(vendor: VendorType): string[] {\n const relations = vendor.relations ?? [];\n\n return relations.flatMap((relation) =>\n (relation.relationDates ?? [])\n .map((relationDate: RelationDateType) => relationDate.dateTime.startDate)\n .filter((date): date is string => Boolean(date)),\n );\n}\n\nexport function getRegisteredVendorCategoryNames(vendor: VendorType): string[] {\n return (vendor.categories ?? []).map((category) => category.name);\n}\n\nexport function getUnregisteredVendorStartDates(\n vendor: UnregisteredVendorType,\n): string[] {\n return (vendor.invitations ?? []).flatMap((invitation) =>\n invitation.dateTime\n .map((date) => date.startDate)\n .filter((date): date is string => Boolean(date)),\n );\n}\n\nexport function getUnregisteredVendorCategoryNames(\n vendor: UnregisteredVendorType,\n): string[] {\n return availableCategories\n .filter(\n (category) => category.id && vendor.categoryIds.includes(category.id),\n )\n .map((category) => category.name);\n}\n\nexport function filterRegisteredVendorsForEvent(\n vendors: VendorType[] | null | undefined,\n eventStartDates: Set<string>,\n selectedDate: string | null,\n selectedCategory: string | null,\n): VendorType[] {\n if (!vendors) {\n return [];\n }\n\n return vendors.filter((vendor) => {\n const startDates = getRegisteredVendorStartDates(vendor);\n\n return (\n hasMatchingEventDate(startDates, eventStartDates) &&\n matchesSelectedDate(startDates, selectedDate) &&\n matchesCategory(\n getRegisteredVendorCategoryNames(vendor),\n selectedCategory,\n )\n );\n });\n}\n\nexport function filterUnregisteredVendorsForEvent(\n vendors: UnregisteredVendorType[],\n eventStartDates: Set<string>,\n selectedDate: string | null,\n selectedCategory: string | null,\n): UnregisteredVendorType[] {\n return vendors.filter((vendor) => {\n const startDates = getUnregisteredVendorStartDates(vendor);\n\n return (\n hasMatchingEventDate(startDates, eventStartDates) &&\n matchesSelectedDate(startDates, selectedDate) &&\n matchesCategory(\n getUnregisteredVendorCategoryNames(vendor),\n selectedCategory,\n )\n );\n });\n}\n\nexport function filterRegisteredVendorsByEventDatesOnly(\n vendors: VendorType[] | null | undefined,\n eventStartDates: Set<string>,\n): VendorType[] {\n if (!vendors) {\n return [];\n }\n\n return vendors.filter((vendor) =>\n hasMatchingEventDate(\n getRegisteredVendorStartDates(vendor),\n eventStartDates,\n ),\n );\n}\n\nexport function filterUnregisteredVendorsByEventDatesOnly(\n vendors: UnregisteredVendorType[],\n eventStartDates: Set<string>,\n): UnregisteredVendorType[] {\n return vendors.filter((vendor) =>\n hasMatchingEventDate(\n getUnregisteredVendorStartDates(vendor),\n eventStartDates,\n ),\n );\n}\n\nexport function collectStallholderDateTimes(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): Array<{ startDate?: string; startTime?: string }> {\n return [\n ...registeredVendors.flatMap((vendor) =>\n (vendor.relations ?? []).flatMap((relation) =>\n (relation.relationDates ?? []).map(\n (relationDate: RelationDateType) => relationDate.dateTime,\n ),\n ),\n ),\n ...unregisteredVendors.flatMap((vendor) =>\n (vendor.invitations ?? []).flatMap((invitation) => invitation.dateTime),\n ),\n ];\n}\n\nexport function getUniqueStallholderStartDates(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): string[] {\n return getUniqueStartDates(\n collectStallholderDateTimes(registeredVendors, unregisteredVendors),\n );\n}\n\nexport function getStallholderCategoryNames(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): string[] {\n const names = [\n ...registeredVendors.flatMap(getRegisteredVendorCategoryNames),\n ...unregisteredVendors.flatMap(getUnregisteredVendorCategoryNames),\n ];\n\n return Array.from(new Set(names));\n}\n\nexport function getStallholderCategoryOptions(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): StallholderFilterOption[] {\n return getStallholderCategoryNames(\n registeredVendors,\n unregisteredVendors,\n ).map((name) => ({\n label: name,\n value: name,\n }));\n}\n\nexport function getEventStallholderEmptyMessage(\n hasAnyStallholdersForEvent: boolean,\n selectedDate: string | null,\n): string {\n return hasAnyStallholdersForEvent && selectedDate\n ? \"No stallholders found for this event date.\"\n : \"No stallholders found for this event.\";\n}\n","import type { StallholderFilterOption } from \"../eventStallholders/eventStallholderFilters\";\nimport type { EventListItemType } from \"../types/event\";\nimport type { DateTimeType } from \"../types/global\";\nimport { getUniqueStartDates } from \"../utils/date\";\n\ntype RelationType = NonNullable<EventListItemType[\"relations\"]>[number];\ntype RelationDateType = NonNullable<RelationType[\"relationDates\"]>[number];\n\nexport function relationHasSelectedDate(\n relation: RelationType,\n selectedDate: string,\n): boolean {\n return (\n relation.relationDates?.some(\n (date: RelationDateType) => date.dateTime.startDate === selectedDate,\n ) ?? false\n );\n}\n\nexport function eventHasSelectedDate(\n event: EventListItemType,\n selectedDate: string,\n): boolean {\n return (\n event.relations?.some((relation) =>\n relationHasSelectedDate(relation, selectedDate),\n ) ?? false\n );\n}\n\nexport function filterVendorEventsBySelectedDate(\n events: EventListItemType[] | null | undefined,\n selectedDate: string | null,\n): EventListItemType[] {\n if (!events) {\n return [];\n }\n\n if (!selectedDate) {\n return events;\n }\n\n return events.filter((event) => eventHasSelectedDate(event, selectedDate));\n}\n\nexport function collectVendorEventRelationDateTimes(\n events: EventListItemType[] | null | undefined,\n): DateTimeType[] {\n if (!events?.length) {\n return [];\n }\n\n return events.flatMap((event) =>\n (event.relations ?? []).flatMap((relation) =>\n (relation.relationDates ?? []).map(\n (relationDate) => relationDate.dateTime,\n ),\n ),\n );\n}\n\nexport function getVendorEventRelationStartDates(\n events: EventListItemType[] | null | undefined,\n): string[] {\n return getUniqueStartDates(collectVendorEventRelationDateTimes(events));\n}\n\nexport function getVendorEventRelationDateOptions(\n events: EventListItemType[] | null | undefined,\n): StallholderFilterOption[] {\n return getVendorEventRelationStartDates(events).map((startDate) => ({\n label: startDate,\n value: startDate,\n }));\n}\n\nexport function getVendorEventsEmptyMessage(): string {\n return \"No events found.\";\n}\n","import {\n AffiliateRewardType,\n EnumAffiliateParticipantType,\n EnumAffiliateRewardType,\n} from \"src/types/affiliate\";\n\nexport const AFFILIATE_PARTICIPANT_TYPE_LABELS = {\n [EnumAffiliateParticipantType.INDIVIDUAL]: \"Individual\",\n [EnumAffiliateParticipantType.SOLE_TRADER]: \"Sole Trader\",\n [EnumAffiliateParticipantType.COMPANY]: \"Company\",\n} as const satisfies Record<EnumAffiliateParticipantType, string>;\n\ntype AffiliateRewardConfig = {\n description: string;\n value: number;\n};\n\nexport const AFFILIATE_REWARDS = {\n [EnumAffiliateRewardType.NEW_EVENT_REGISTRATION]: {\n description: \"10 points for new event registration (one-time reward)\",\n value: 10,\n },\n [EnumAffiliateRewardType.NEW_VENDOR_REGISTRATION]: {\n description: \"5 points for new vendor registration (one-time reward)\",\n value: 5,\n },\n [EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION]: {\n description: \"3 points for active vendor pro subscription (monthly reward)\",\n value: 3,\n },\n [EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION]: {\n description:\n \"1 point for active vendor standard subscription (monthly reward)\",\n value: 1,\n },\n [EnumAffiliateRewardType.ACTIVE_VENDOR_BONUS_REWARD]: {\n description:\n \"5 bonus points for every 10th active vendor (one-time reward)\",\n value: 5,\n },\n [EnumAffiliateRewardType.ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS]: {\n description:\n \"40 points for active event with vendor registrations (one-time reward)\",\n value: 40,\n },\n} satisfies Record<EnumAffiliateRewardType, AffiliateRewardConfig>;\n\n/**\n * Create an affiliate reward\n * @param rewardType - The type of reward\n * @param createdAt - The date the reward was received\n * @returns The affiliate reward\n * @example\n * const reward = createAffiliateReward(EnumAffiliateRewardType.NEW_EVENT_REGISTRATION, new Date());\n * console.log(reward);\n */\nexport function createAffiliateReward(\n rewardType: EnumAffiliateRewardType,\n createdAt: Date,\n): AffiliateRewardType {\n const reward = AFFILIATE_REWARDS[rewardType];\n\n return {\n createdAt,\n redeemedAt: null,\n rewardDescription: reward.description,\n rewardType,\n rewardValue: reward.value,\n };\n}\n","/**\n * NZ IRD number validation (Inland Revenue modulus-11 check digit).\n *\n * Valid range: 10,000,000 – 200,000,000 (upper limit raised Feb 2026; length stays\n * 8–9 digits). See IRD file-upload / payday filing specifications.\n */\n\nconst PRIMARY_WEIGHTS = [3, 2, 7, 6, 5, 4, 3, 2] as const;\nconst SECONDARY_WEIGHTS = [7, 4, 3, 2, 5, 2, 7, 6] as const;\n\nconst IRD_MIN = 10_000_000;\n/** Raised from 150_000_000 as of IRD's Feb 2026 annual update. */\nconst IRD_MAX = 200_000_000;\n\nfunction calculateCheckDigit(\n baseDigits: string,\n weights: readonly number[],\n): number {\n const sum = [...baseDigits].reduce(\n (acc, digit, index) => acc + Number(digit) * weights[index],\n 0,\n );\n const remainder = sum % 11;\n return remainder === 0 ? 0 : 11 - remainder;\n}\n\n/** Digits only; strips spaces/hyphens and other non-digits. */\nexport function normalizeIrdNumber(value: string): string {\n return value.replace(/\\D/g, \"\");\n}\n\n/**\n * Formats an IRD number as groups of three digits separated by hyphens\n * (e.g. `490-918-50` / `049-091-850`), capping at 9 digits.\n */\nexport function formatIrdNumber(input: string): string {\n const digitsOnly = normalizeIrdNumber(input).slice(0, 9);\n\n const parts = [];\n if (digitsOnly.length > 0) parts.push(digitsOnly.slice(0, 3));\n if (digitsOnly.length > 3) parts.push(digitsOnly.slice(3, 6));\n if (digitsOnly.length > 6) parts.push(digitsOnly.slice(6, 9));\n\n return parts.join(\"-\");\n}\n\n/**\n * Returns true when `value` is a valid NZ IRD number (8–9 digits, in issued\n * range, and modulus-11 check digit matches).\n */\nexport function isValidIrdNumber(value: string): boolean {\n const digits = normalizeIrdNumber(value);\n\n if (!/^\\d{8,9}$/.test(digits)) {\n return false;\n }\n\n const ird = Number(digits);\n if (ird < IRD_MIN || ird > IRD_MAX) {\n return false;\n }\n\n const padded = digits.padStart(9, \"0\");\n const baseDigits = padded.slice(0, -1);\n const checkDigit = Number(padded.slice(-1));\n\n let calculated = calculateCheckDigit(baseDigits, PRIMARY_WEIGHTS);\n if (calculated === 10) {\n calculated = calculateCheckDigit(baseDigits, SECONDARY_WEIGHTS);\n if (calculated === 10) {\n return false;\n }\n }\n\n return calculated === checkDigit;\n}\n","const TRANSIENT_NETWORK_PATTERNS = [\n /network connection was lost/i,\n /network request failed/i,\n /fetch failed/i,\n /failed to fetch/i,\n /internet connection appears to be offline/i,\n // Transport-layer timeouts only — avoid generic \"timeout\" (backend/query timeouts).\n /\\b(request|connection|network)\\s+timed\\s+out\\b/i,\n /\\b(connect|read|write|socket)\\s+timeout\\b/i,\n /\\bsocket\\s+timed\\s+out\\b/i,\n /\\betimedout\\b/i,\n /\\benotfound\\b/i,\n /\\beconnreset\\b/i,\n /\\beconnrefused\\b/i,\n] as const;\n\nfunction extractErrorMessage(err: unknown): string {\n if (err instanceof Error) return err.message;\n if (typeof err === \"string\") return err;\n if (err && typeof err === \"object\") {\n const obj = err as Record<string, unknown>;\n if (typeof obj.message === \"string\") return obj.message;\n if (obj.networkError) return extractErrorMessage(obj.networkError);\n try {\n return JSON.stringify(err);\n } catch {\n return \"[object]\";\n }\n }\n if (err == null) return \"\";\n if (\n typeof err === \"number\" ||\n typeof err === \"boolean\" ||\n typeof err === \"bigint\"\n ) {\n return String(err);\n }\n if (typeof err === \"symbol\") return err.toString();\n return \"\";\n}\n\n/** True for short-lived connectivity failures (e.g. resume before the stack is ready). */\nexport function isTransientNetworkError(err: unknown): boolean {\n const message = extractErrorMessage(err);\n return TRANSIENT_NETWORK_PATTERNS.some((pattern) => pattern.test(message));\n}\n","/** Client-side rotation window shared by web (admin) and mobile ad renderers. */\nexport const AD_METRIC_ROTATION_INTERVAL_MS = 8_000;\n/** Delay before a single impression retry within the same rotation slot. */\nexport const AD_METRIC_IMPRESSION_RETRY_DELAY_MS = 1_000;\n\n/** Rotation slot index for a timestamp, matching the server dedupe window. */\nexport function getAdMetricRotationSlot(epochMilliseconds: number): number {\n return Math.floor(epochMilliseconds / AD_METRIC_ROTATION_INTERVAL_MS);\n}\n\n/** Which ad of `count` is displayed at a given timestamp. */\nexport function getAdMetricRotationIndex(\n epochMilliseconds: number,\n count: number,\n): number {\n if (count <= 0) return 0;\n return getAdMetricRotationSlot(epochMilliseconds) % count;\n}\n\n/** Stable per-slot impression key used by the client to suppress duplicates. */\nexport function buildAdMetricSlotKey(\n adId: string,\n placement: string,\n slot: number,\n): string {\n return `${adId}:${placement}:${slot}`;\n}\n\n/**\n * Unique per-click id. `crypto.randomUUID` is absent or non-callable in older\n * browsers, non-secure contexts, and some React Native runtimes.\n */\nexport function generateAdClickId(): string {\n const cryptoApi = globalThis.crypto as { randomUUID?: unknown } | undefined;\n if (typeof cryptoApi?.randomUUID === \"function\") {\n return (cryptoApi.randomUUID as () => string)();\n }\n // Guard Math.random()===0: `\"0\".slice(2)` is empty, which would leave a\n // trailing dash and a weaker id.\n const randomPart = Math.random().toString(36).slice(2) || \"0\";\n return `click-${Date.now()}-${randomPart}`;\n}\n","/* eslint-disable camelcase -- Catalogue keys match persisted database identifiers. */\nimport { EnumBillingPeriod, EnumUserLicence } from \"../../enums\";\nimport type {\n BillingCatalogDefinition,\n BillingCatalogEntryType,\n BillingCatalogInitialEntry,\n BillingCatalogKey,\n} from \"../../types/billingCatalog\";\n\nexport const BILLING_CATALOG_KEYS = [\n \"pro_vendor_monthly\",\n \"pro_vendor_yearly\",\n \"pro_plus_vendor_monthly\",\n \"pro_plus_vendor_yearly\",\n] as const satisfies readonly BillingCatalogKey[];\n\nexport const BILLING_CATALOG_CURRENCY = \"nzd\" as const;\n\n/**\n * The only four licence/billing combinations that can be sold through Stripe.\n * Standard vendor access and all event licences intentionally stay outside the\n * paid billing catalogue.\n */\nexport const BILLING_CATALOG_DEFINITIONS: Record<\n BillingCatalogKey,\n BillingCatalogDefinition\n> = {\n pro_plus_vendor_monthly: {\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n },\n pro_plus_vendor_yearly: {\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n },\n pro_vendor_monthly: {\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n licenceType: EnumUserLicence.PRO_VENDOR,\n },\n pro_vendor_yearly: {\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n licenceType: EnumUserLicence.PRO_VENDOR,\n },\n};\n\n/**\n * Resolves a client selection to the single canonical billing catalogue key.\n * Returning null is intentional: GraphQL resolvers can reject every free or\n * event licence without maintaining another parallel allow-list.\n */\nexport function getBillingCatalogKeyForSelection(\n licenceType: EnumUserLicence,\n billingPeriod: EnumBillingPeriod,\n): BillingCatalogKey | null {\n const match = Object.entries(BILLING_CATALOG_DEFINITIONS).find(\n ([, definition]) =>\n definition.licenceType === licenceType &&\n definition.billingPeriod === billingPeriod,\n );\n\n return (match?.[0] as BillingCatalogKey | undefined) ?? null;\n}\n\n/**\n * Initial test prices copied from the current public pricing page. They become\n * database records during catalogue initialisation and can later be changed by\n * a Super Admin; checkout must never read these constants directly.\n */\nexport const INITIAL_BILLING_CATALOG: readonly BillingCatalogInitialEntry[] = [\n {\n active: true,\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_vendor_monthly\",\n licenceType: EnumUserLicence.PRO_VENDOR,\n taxInclusive: true,\n unitAmount: 3_999,\n },\n {\n active: true,\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_vendor_yearly\",\n licenceType: EnumUserLicence.PRO_VENDOR,\n taxInclusive: true,\n unitAmount: 40_788,\n },\n {\n active: true,\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_plus_vendor_monthly\",\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n taxInclusive: true,\n unitAmount: 6_499,\n },\n {\n active: true,\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_plus_vendor_yearly\",\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n taxInclusive: true,\n unitAmount: 62_388,\n },\n] as const;\n\nexport function billingCatalogDefinitionMatches(\n entry: Pick<BillingCatalogEntryType, \"billingPeriod\" | \"key\" | \"licenceType\">,\n): boolean {\n const definition = BILLING_CATALOG_DEFINITIONS[entry.key];\n\n if (!definition) {\n return false;\n }\n\n return (\n definition.billingPeriod === entry.billingPeriod &&\n definition.licenceType === entry.licenceType\n );\n}\n","import {\n eventStartDatesSet,\n filterRegisteredVendorsByEventDatesOnly,\n filterRegisteredVendorsForEvent,\n filterUnregisteredVendorsByEventDatesOnly,\n filterUnregisteredVendorsForEvent,\n getEventStallholderEmptyMessage,\n getStallholderCategoryOptions,\n getUniqueStallholderStartDates,\n type StallholderFilterOption,\n} from \"../../eventStallholders\";\nimport type { DateTimeType } from \"../../types/global\";\nimport type { UnregisteredVendorType, VendorType } from \"../../types/vendor\";\nimport { formatDateOptionLabel } from \"../date\";\n\nexport type EventStallholderDateOption = {\n label: string;\n value: string;\n};\n\nexport type EventStallholdersData = {\n emptyMessage: string;\n futureEventStartDates: EventStallholderDateOption[];\n hasDatePills: boolean;\n hasStallholders: boolean;\n stallholderCategories: StallholderFilterOption[];\n unregisteredVendorList: UnregisteredVendorType[];\n vendorList: VendorType[];\n};\n\nexport type GetEventStallholdersDataInput = {\n eventDateTime: DateTimeType[];\n selectedCategory: string | null;\n selectedDate: string | null;\n unregisteredVendors?: UnregisteredVendorType[];\n vendors: VendorType[] | null;\n};\n\n/**\n * Derives every stallholder-list value an event detail screen needs from the\n * event dates, registered vendors, and unregistered vendors.\n *\n * Date pills come from the relations, not the event schedule: they are the\n * `startDate`s of the stallholders' relation dates / invitations (chronological\n * and de-duplicated). `eventDateTime` is only used to decide which vendors and\n * invitations actually belong to the event, mirroring the vendor screen where\n * pills are also relation-sourced.\n *\n * Shared by the mobile event page and the admin market event page so the two\n * keep identical filtering / date-pill / empty-message behaviour.\n */\nexport function getEventStallholdersData({\n eventDateTime,\n selectedCategory,\n selectedDate,\n unregisteredVendors = [],\n vendors,\n}: GetEventStallholdersDataInput): EventStallholdersData {\n const eventStartDates = eventStartDatesSet(eventDateTime);\n\n const registeredForEvent = filterRegisteredVendorsByEventDatesOnly(\n vendors,\n eventStartDates,\n );\n const unregisteredForEvent = filterUnregisteredVendorsByEventDatesOnly(\n unregisteredVendors,\n eventStartDates,\n );\n\n const vendorList = filterRegisteredVendorsForEvent(\n vendors,\n eventStartDates,\n selectedDate,\n selectedCategory,\n );\n const unregisteredVendorList = filterUnregisteredVendorsForEvent(\n unregisteredVendors,\n eventStartDates,\n selectedDate,\n selectedCategory,\n );\n\n const registeredForSelectedDate = filterRegisteredVendorsForEvent(\n vendors,\n eventStartDates,\n selectedDate,\n null,\n );\n const unregisteredForSelectedDate = filterUnregisteredVendorsForEvent(\n unregisteredVendors,\n eventStartDates,\n selectedDate,\n null,\n );\n\n const stallholderCategories = getStallholderCategoryOptions(\n registeredForSelectedDate,\n unregisteredForSelectedDate,\n );\n\n const futureEventStartDates = getUniqueStallholderStartDates(\n registeredForEvent,\n unregisteredForEvent,\n ).map((startDate) => ({\n label: formatDateOptionLabel(startDate),\n value: startDate,\n }));\n\n const hasDatePills = futureEventStartDates.length > 0;\n const hasStallholders =\n vendorList.length > 0 || unregisteredVendorList.length > 0;\n const hasAnyStallholdersForEvent =\n registeredForEvent.length > 0 || unregisteredForEvent.length > 0;\n\n return {\n emptyMessage: getEventStallholderEmptyMessage(\n hasAnyStallholdersForEvent,\n selectedDate,\n ),\n futureEventStartDates,\n hasDatePills,\n hasStallholders,\n stallholderCategories,\n unregisteredVendorList,\n vendorList,\n };\n}\n","import type { EventListItemType } from \"../../types/event\";\nimport {\n filterVendorEventsBySelectedDate,\n getVendorEventRelationDateOptions,\n getVendorEventsEmptyMessage,\n} from \"../../vendorEvents\";\nimport { formatDateOptionLabel } from \"../date\";\n\nexport type VendorEventDateOption = {\n label: string;\n value: string;\n};\n\nexport type VendorEventsData = {\n emptyMessage: string;\n eventDateOptions: VendorEventDateOption[];\n eventsByDate: EventListItemType[];\n hasDatePills: boolean;\n};\n\nexport type GetVendorEventsDataInput = {\n events: EventListItemType[] | null;\n selectedDate: string | null;\n};\n\n/**\n * Derives every event-list value a vendor detail screen needs from the raw\n * event connections and the selected date filter.\n *\n * Shared by the mobile vendor page and the admin stallholder page so the two\n * keep identical filtering / date-pill / empty-message behaviour.\n */\nexport function getVendorEventsData({\n events,\n selectedDate,\n}: GetVendorEventsDataInput): VendorEventsData {\n const eventDateOptions = getVendorEventRelationDateOptions(events).map(\n (option) => ({\n ...option,\n label: formatDateOptionLabel(option.value),\n }),\n );\n\n return {\n emptyMessage: getVendorEventsEmptyMessage(),\n eventDateOptions,\n eventsByDate: filterVendorEventsBySelectedDate(events, selectedDate),\n hasDatePills: eventDateOptions.length > 0,\n };\n}\n","import { EnumInviteStatus } from \"../../enums\";\n\n/**\n * Relation date statuses that must survive when their event slot is removed or\n * a relation is overwritten. ACCEPTED/COMPLETED are historical or paid\n * bookings; CANCELED is kept so history can report dates the event canceled;\n * REJECTED is kept for the organizer's records. Dates with any other status\n * may be deleted once their slot disappears from the event schedule.\n */\nexport const PRESERVED_RELATION_DATE_STATUSES: ReadonlySet<EnumInviteStatus> =\n new Set([\n EnumInviteStatus.ACCEPTED,\n EnumInviteStatus.CANCELED,\n EnumInviteStatus.COMPLETED,\n EnumInviteStatus.REJECTED,\n ]);\n","import { isTransientNetworkError } from \"./isTransientNetworkError\";\n\nexport const DEFAULT_USER_FACING_ERROR =\n \"Something went wrong. Please try again.\";\n\nexport const NETWORK_USER_FACING_ERROR =\n \"Unable to connect. Please check your internet connection and try again.\";\n\n/** Backend/infra messages that must never be shown to end users. */\nconst INTERNAL_ERROR_PATTERNS = [\n /connection\\s*<monitor>/i,\n /\\bmongo/i,\n /\\b\\d{1,3}(?:\\.\\d{1,3}){3}(?::\\d+)?\\b/,\n /\\beconn(?:refused|reset|aborted)\\b/i,\n /\\betimedout\\b/i,\n /\\benotfound\\b/i,\n /\\bsocket hang up\\b/i,\n /\\binternal server error\\b/i,\n /received status code 5\\d\\d/i,\n /\\bat\\s+\\S+\\s+\\([^)]+:\\d+:\\d+\\)/,\n] as const;\n\nexport function isInternalErrorMessage(message: string): boolean {\n return INTERNAL_ERROR_PATTERNS.some((pattern) => pattern.test(message));\n}\n\n/**\n * Maps raw API/client errors to a safe message for UI surfaces.\n * Keeps intentional product copy (e.g. \"Vendor not found\"); hides infra details.\n */\nexport function toUserFacingErrorMessage(\n error: string | null | undefined,\n fallback = DEFAULT_USER_FACING_ERROR,\n): string {\n const message = (error ?? \"\").trim();\n if (!message) return fallback;\n\n if (isTransientNetworkError(message)) {\n return NETWORK_USER_FACING_ERROR;\n }\n\n if (isInternalErrorMessage(message)) {\n return fallback;\n }\n\n return message;\n}\n\n/** Extracts and sanitizes an unknown catch/Apollo error for toasts and alerts. */\nexport function getErrorMessage(\n error: unknown,\n fallback = DEFAULT_USER_FACING_ERROR,\n): string {\n let raw: string | undefined;\n if (error instanceof Error) {\n raw = error.message;\n } else if (typeof error === \"string\") {\n raw = error;\n }\n\n return toUserFacingErrorMessage(raw, fallback);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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A,EAC1C;AACF;;;ACxCO,IAAM,mCACX,oBAAI,IAAI;AAAA;AAAA;AAAA;AAAA;AAKR,CAAC;;;ACbI,IAAM,4BACX;AAEK,IAAM,4BACX;AAGF,IAAM,0BAA0B;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,uBAAuB,SAA0B;AAC/D,SAAO,wBAAwB,KAAK,CAAC,YAAY,QAAQ,KAAK,OAAO,CAAC;AACxE;AAMO,SAAS,yBACd,OACA,WAAW,2BACH;AACR,QAAM,WAAW,SAAS,IAAI,KAAK;AACnC,MAAI,CAAC,QAAS,QAAO;AAErB,MAAI,wBAAwB,OAAO,GAAG;AACpC,WAAO;AAAA,EACT;AAEA,MAAI,uBAAuB,OAAO,GAAG;AACnC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGO,SAAS,gBACd,OACA,WAAW,2BACH;AACR,MAAI;AACJ,MAAI,iBAAiB,OAAO;AAC1B,UAAM,MAAM;AAAA,EACd,WAAW,OAAO,UAAU,UAAU;AACpC,UAAM;AAAA,EACR;AAEA,SAAO,yBAAyB,KAAK,QAAQ;AAC/C;","names":["import_dayjs","import_customParseFormat","EnumInviteStatus","EnumPaymentMethod","EnumRegions","dayjs","customParseFormat","isoWeek","dayjs","customParseFormat","utc","timezone","isSameOrAfter","import_dayjs","dayjs"]}
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/types/game/dailyClue.ts","../../src/utils/date.ts","../../src/enums/index.ts","../../src/utils/dateFormats.ts","../../src/utils/eventDateStatus.ts","../../src/utils/dailyClueGame.ts","../../src/utils/distance.ts","../../src/utils/pagination.ts","../../src/utils/mapArrayToOptions.ts","../../src/sharing/relationShareTypes.ts","../../src/sharing/constants.ts","../../src/sharing/normalizeShareDescription.ts","../../src/types/global.ts","../../src/types/subscription.ts","../../src/utils/utils.ts","../../src/utils/resourceImage.ts","../../src/utils/school.ts","../../src/utils/userPoints.ts","../../src/calendar/eventCalendar.ts","../../src/formFields/categories/clothingAndFashion.ts","../../src/formFields/categories/electronicsAndTechnology.ts","../../src/formFields/categories/foodAndBeverages.ts","../../src/formFields/categories/handmadeAndLocalProducts.ts","../../src/formFields/categories/healthAndWellness.ts","../../src/formFields/categories/homeGardenHousehold.ts","../../src/formFields/categories/petProductsAndAnimalGoods.ts","../../src/formFields/categories/serviceAndExperience.ts","../../src/formFields/categories/toysChildren.ts","../../src/formFields/categories/vintageAndAntique.ts","../../src/formFields/categories/index.ts","../../src/eventStallholders/eventStallholderFilters.ts","../../src/vendorEvents/vendorEventFilters.ts","../../src/utils/affiliate.ts","../../src/utils/irdNumber.ts","../../src/utils/isTransientNetworkError.ts","../../src/utils/adMetrics.ts","../../src/utils/billingCatalog/index.ts","../../src/utils/relations/eventStallholders.ts","../../src/utils/relations/vendorEvents.ts","../../src/utils/relations/preservedRelationDateStatuses.ts","../../src/utils/toUserFacingErrorMessage.ts"],"sourcesContent":["// Re-export the daily-clue occurrence helpers so the server can apply the same\n// duplicate-letter counting logic as `computeDailyClueState`.\nexport {\n computeDailyClueState,\n countLetterOccurrences,\n countLetterOccurrencesUpTo,\n getDailyClueDayIndex,\n seededShuffle,\n} from \"./dailyClueGame\";\nexport {\n formatDistance,\n getDistanceInKilometers,\n getDistanceInMeters,\n} from \"./distance\";\nexport {\n DEFAULT_PAGE_SIZE,\n accumulateItems,\n computeHasMore,\n defaultGetId,\n} from \"./pagination\";\nexport {\n NZ_TZ,\n toNZTime,\n nzStartOfDay,\n nzDayKey,\n formatDate,\n formatDateOptionLabel,\n getCurrentAndFutureDates,\n isFutureStartDate,\n isFutureDatesBeforeThreshold,\n formatTimestamp,\n isIsoDateString,\n sortDatesChronologically,\n getUniqueStartDates,\n timeFormat,\n dateFormat,\n isoDateFormat,\n isUtcMidnight,\n futureTimePeriods,\n} from \"./date\";\n\nexport { mapArrayToOptions } from \"./mapArrayToOptions\";\nexport {\n removeTypename,\n truncateText,\n capitalizeFirstLetter,\n statusOptions,\n availableRegionTypes,\n availableRegionOptions,\n paymentMethodOptions,\n normalizeUrl,\n licenseNiceNames,\n vendorLicences,\n cluemartSocialMedia,\n IOS_URL,\n ANDROID_URL,\n DEFAULT_RESOURCES_RETURN_LIMIT,\n DEFAULT_RESOURCES_RETURN_OFFSET,\n CLUEMART_MAIN_DOMAIN_URL,\n rewardNiceNames,\n PostTypeLabels,\n CM_SCHOOL_PROMO_CODE,\n CM_AFFILIATE_PROMO_CODE,\n formatNZBankAccount,\n} from \"./utils\";\n\nexport {\n isResourceImageActive,\n normalizeResourceImage,\n resolveResourceImageActive,\n} from \"./resourceImage\";\nexport { SCHOOL_MIN_STUDENT_COUNT, SCHOOL_MAX_STUDENT_COUNT } from \"./school\";\nexport { sumUserOverallPoints } from \"./userPoints\";\nexport {\n EVENT_DATE_STATUS_PERIOD_MAP,\n EVENT_DATE_STATUS_LABELS,\n eventMatchesDateStatusPeriod,\n filterEventsByDateStatusPeriod,\n getAllowedEventDateStatuses,\n FUTURE_EVENT_DATE_STATUSES,\n MANUAL_DATE_STATUSES,\n isFutureEventDateStatus,\n filterDatesByFutureStatus,\n buildRelationEligibleEventSchedule,\n getFutureEventStatus,\n updateSingleDateTimeStatus,\n} from \"./eventDateStatus\";\nexport * from \"../calendar\";\nexport * from \"../eventStallholders\";\nexport * from \"../vendorEvents\";\nexport {\n AFFILIATE_PARTICIPANT_TYPE_LABELS,\n AFFILIATE_REWARDS,\n createAffiliateReward,\n} from \"./affiliate\";\nexport {\n isValidIrdNumber,\n normalizeIrdNumber,\n formatIrdNumber,\n} from \"./irdNumber\";\nexport { isTransientNetworkError } from \"./isTransientNetworkError\";\nexport * from \"./adMetrics\";\nexport * from \"./billingCatalog\";\nexport * from \"./relations\";\nexport {\n DEFAULT_USER_FACING_ERROR,\n NETWORK_USER_FACING_ERROR,\n getErrorMessage,\n isInternalErrorMessage,\n toUserFacingErrorMessage,\n} from \"./toUserFacingErrorMessage\";\n","import { GameDate, GlobalGameData } from \"./global\";\n\nconst OBJECT_ID_PATH_SEGMENT = \"[a-f0-9]{24}\";\nconst OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;\n\nexport const gameScreenIdentifierList = [\n {\n clue: \"Where conversations happen without speaking.\",\n id: \"chat\",\n match: \"/chat\",\n },\n {\n clue: \"Where you can find your loyalties.\",\n id: \"coupons\",\n match: \"/profile/account/coupons\",\n },\n {\n clue: \"A single moment worth showing up for.\",\n id: \"single-event\",\n match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"What’s happening around you, right now.\",\n id: \"events-near-me\",\n match: \"/events/events-near-me\",\n },\n {\n clue: \"Where events appear as pins on a map.\",\n id: \"events-map\",\n match: \"/events/events-map\",\n },\n {\n clue: \"A collection of events worth attending.\",\n id: \"events\",\n match: \"/events\",\n },\n {\n clue: \"What’s happening in a wider area — not just nearby.\",\n id: \"events-region\",\n match: /^\\/events\\/region\\/[^/]+$/,\n },\n {\n clue: \"Where fun becomes a challenge.\",\n id: \"games\",\n match: \"/profile/account/games\",\n },\n {\n clue: \"Your starting point for everything.\",\n id: \"home\",\n match: \"/home\",\n },\n {\n clue: \"Where the app whispers what you shouldn’t miss.\",\n id: \"notifications\",\n match: \"/notifications\",\n },\n {\n clue: \"An organisation or creator supporting the community.\",\n id: \"single-partner\",\n match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Organisations and creators supporting the community.\",\n id: \"partners\",\n match: \"/partners\",\n },\n {\n clue: \"Where your actions turn into a timeline.\",\n id: \"activities\",\n match: \"/profile/account/favourites\",\n },\n {\n clue: \"The place to redefine who you are.\",\n id: \"edit-profile\",\n match: \"/profile/account\",\n },\n {\n clue: \"Your identity, on display.\",\n id: \"profile\",\n match: \"/profile\",\n },\n {\n clue: \"Where you can redeem your rewards.\",\n id: \"rewards\",\n match: \"/profile/account/rewards\",\n },\n {\n clue: \"A single published post in full view.\",\n id: \"single-visitor-post\",\n match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"One stallholder offering something valuable.\",\n id: \"single-vendor\",\n match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`),\n },\n {\n clue: \"Where every stallholder waits under the right category.\",\n id: \"vendors\",\n match: \"/vendors\",\n },\n {\n clue: \"Where you browse articles and posts from around the platform.\",\n id: \"visitors\",\n match: \"/visitors\",\n },\n {\n clue: \"Where you fine-tune your experience.\",\n id: \"options\",\n match: \"/options\",\n },\n] as const;\n\nexport type GamePlacement = (typeof gameScreenIdentifierList)[number][\"id\"];\nexport type GamePlacementClue =\n (typeof gameScreenIdentifierList)[number][\"clue\"];\n\nexport type DailyClueBaseGame = {\n gameDate: GameDate;\n gameSolution: string;\n};\n\nexport type DailyClueGameData = GlobalGameData & {\n gameFields: DailyClueBaseGame;\n lastFoundDate: Date | null;\n letterInfo: {\n // Multiset of found letters: one entry per collected occurrence, so a\n // duplicate letter (e.g. two \"E\"s in \"EXPLORE\") appears twice once both\n // are found. Consumers must count occurrences, not use `includes`.\n collected: string[] | null;\n solutionShuffled: string[]; // The letters of the solution, but shuffled, e.g. [\"L\", \"C\", \"U\"]\n todaysClue: GamePlacementClue | null; // The clue for user to find the letter, e.g. related to {todaysPlacement}\n todaysLetter: string | null; // The letter the user has to find today, e.g. \"C\"\n todaysPlacement: GamePlacement | null; // The screen where the user has to find the clue, e.g. \"HomeScreen\"\n };\n};\n","import dayjs from \"dayjs\";\nimport customParseFormat from \"dayjs/plugin/customParseFormat.js\";\nimport isSameOrAfter from \"dayjs/plugin/isSameOrAfter.js\";\nimport timezone from \"dayjs/plugin/timezone.js\";\nimport utc from \"dayjs/plugin/utc.js\";\n\nimport { EnumEventDateStatus } from \"src/enums\";\n\nimport { dateFormat, timeFormat, isoDateFormat } from \"./dateFormats\";\nimport {\n FUTURE_EVENT_DATE_STATUSES,\n EVENT_DATE_STATUS_LABELS,\n} from \"./eventDateStatus\";\n\nexport { dateFormat, timeFormat, isoDateFormat };\n\n// Enable custom format parsing\ndayjs.extend(customParseFormat);\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(isSameOrAfter);\n\nexport const NZ_TZ = \"Pacific/Auckland\";\n\nexport function toNZTime(date?: Date | string) {\n return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);\n}\n\n/** Start of the calendar day in Pacific/Auckland (daily games, streaks, etc.). */\nexport function nzStartOfDay(\n input?: Date | string | number | null,\n): dayjs.Dayjs {\n if (input == null) {\n return dayjs().tz(NZ_TZ).startOf(\"day\");\n }\n return dayjs.tz(input, NZ_TZ).startOf(\"day\");\n}\n\n/**\n * UTC-midnight of the given instant's NZ calendar day (today when omitted).\n * This is the canonical \"day key\" encoding used by ad bookings and metrics:\n * stored as a UTC Date, rendered with `.toISOString().slice(0, 10)`.\n */\nexport function nzDayKey(input?: Date | string | number | null): Date {\n const day =\n input == null\n ? dayjs().tz(NZ_TZ).format(isoDateFormat)\n : dayjs.tz(input, NZ_TZ).format(isoDateFormat);\n return new Date(`${day}T00:00:00Z`);\n}\n\n/**\n * Type guard for the canonical \"day key\" encoding: a valid Date that is\n * exactly UTC midnight. Accepts `unknown` so it can validate untrusted values\n * (GraphQL/JSON inputs) without a preceding cast.\n */\nexport function isUtcMidnight(value: unknown): value is Date {\n return (\n value instanceof Date &&\n !Number.isNaN(value.getTime()) &&\n value.getUTCHours() === 0 &&\n value.getUTCMinutes() === 0 &&\n value.getUTCSeconds() === 0 &&\n value.getUTCMilliseconds() === 0\n );\n}\n\ntype DateFormat = \"date\" | \"time\" | \"datetime\";\n\n/**\n * Format a date string to a more readable format.\n * @param dateStr - the date string\n * @param timeStr - optional time string\n * @param display - 'date' | 'time' | 'datetime'\n * @returns formatted string based on display option\n */\nexport const formatDate = (\n dateStr: string,\n display: DateFormat = \"datetime\",\n timeStr?: string,\n) => {\n // Combine date and time into a single string if time is provided\n const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;\n\n // Parse with formats\n const dateTime = timeStr\n ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`)\n : dayjs(dateStr, dateFormat);\n\n // Format parts\n const formattedDate = dateTime.format(\"dddd, D MMMM, YYYY\");\n const formattedTime = dateTime.format(\"h:mm a\");\n\n // Return based on display option\n switch (display) {\n case \"date\":\n return formattedDate;\n case \"time\":\n return formattedTime;\n case \"datetime\":\n return `${formattedDate} at ${formattedTime}`;\n default:\n return formattedDate;\n }\n};\n\n/**\n * Date-filter label: the {@link formatDate} date text, marked `(Past)` when the\n * date falls before today. Used by the event/vendor date pills, which also list\n * historical relation dates.\n *\n * \"Today\" is the **runtime's local calendar day** (`dayjs()`), matching how\n * `formatDate` parses the value — not `Pacific/Auckland`, so the marker reflects\n * the day the viewer's device is on. The NZ helpers in this module (`nzDayKey`,\n * `nzStartOfDay`, …) are a separate basis and are deliberately not used here.\n *\n * Parsed once, strictly: an impossible or malformed value (`31-02-2026`) is\n * returned as-is instead of being rolled into another day, and the past check\n * uses that same parsed value so label and marker always agree.\n */\nexport function formatDateOptionLabel(dateStr: string): string {\n const parsed = dayjs(dateStr, dateFormat, true);\n\n if (!parsed.isValid()) {\n return dateStr;\n }\n\n const label = formatDate(dateStr, \"date\");\n\n return parsed.isBefore(dayjs(), \"day\") ? `${label} (Past)` : label;\n}\n\n/**\n * Formats accepted for a stored slot. The canonical writer is\n * `dayjs(...).format(`${dateFormat} ${timeFormat}`)`; the variants cover legacy\n * rows with an unpadded hour or trailing seconds. Each is parsed **strictly**, so\n * impossible values (`31-02`, `25:00`) are rejected instead of rolling over into\n * a real instant.\n */\nconst SLOT_FORMATS = [\n `${dateFormat} ${timeFormat}`,\n `${dateFormat} H:mm`,\n `${dateFormat} ${timeFormat}:ss`,\n `${dateFormat} H:mm:ss`,\n];\n\nconst parseSlot = (date: {\n startDate?: string;\n startTime?: string;\n}): dayjs.Dayjs | null => {\n if (!date.startDate || !date.startTime) {\n return null;\n }\n\n const value = `${date.startDate} ${date.startTime}`;\n\n for (const format of SLOT_FORMATS) {\n const parsed = dayjs(value, format, true);\n\n if (parsed.isValid()) {\n return parsed;\n }\n }\n\n return null;\n};\n\n/**\n * Shared \"starts now or later\" rule for `dd-mm-yyyy` + `HH:mm` slots. `now` is\n * passed in so a caller filtering a list compares every slot against the same\n * instant. A slot with a missing or unparseable date/time is never future.\n */\nconst isFutureDateTime = (\n date: { startDate?: string; startTime?: string },\n now: dayjs.Dayjs,\n): boolean => {\n const slot = parseSlot(date);\n\n return slot ? slot.isSameOrAfter(now) : false;\n};\n\nexport const getCurrentAndFutureDates = <\n T extends { startDate?: string; startTime?: string },\n>(\n dates: T[],\n): T[] => {\n const now = dayjs(); // current date and time\n\n return dates.filter((dateObj) => isFutureDateTime(dateObj, now));\n};\n\n/**\n * True when the slot starts now or later. Status-agnostic: used to hide past\n * relation dates from reads while the records stay in the database.\n */\nexport const isFutureStartDate = (date: {\n startDate?: string;\n startTime?: string;\n}): boolean => isFutureDateTime(date, dayjs());\n\nexport const isFutureDatesBeforeThreshold = (\n date: {\n startDate?: string;\n startTime?: string;\n },\n minHoursFromNow: number,\n): boolean => {\n if (!date.startDate || !date.startTime) {\n return false;\n }\n\n const threshold = minHoursFromNow\n ? dayjs().add(minHoursFromNow, \"hour\")\n : dayjs().startOf(\"day\");\n\n const dateTime = dayjs(\n `${date.startDate} ${date.startTime}`,\n `${dateFormat} ${timeFormat}`,\n );\n\n return dateTime.isSameOrAfter(threshold);\n};\n\nexport const formatTimestamp = (timestamp: string) => {\n const formattedDate = toNZTime(timestamp).format(dateFormat);\n\n return formatDate(formattedDate, \"date\");\n};\n\nexport const isIsoDateString = (value: unknown): value is string => {\n return typeof value === \"string\" && !Number.isNaN(Date.parse(value));\n};\n\n/**\n * Sort an array of date strings by their proximity to the current date.\n * @param dates - The array of date strings to sort.\n * @returns - The sorted array of date strings.\n */\nexport function sortDatesChronologically<\n T extends { startDate?: string; startTime?: string },\n>(dates: T[]): T[] {\n if (!dates?.length) {\n return [];\n }\n\n return [...dates].sort((a, b) => {\n const dateTimeFormat = `${dateFormat} ${timeFormat}`;\n const dateA =\n a.startDate && a.startTime\n ? dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat)\n : null;\n const dateB =\n b.startDate && b.startTime\n ? dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat)\n : null;\n\n if (dateA && dateB) {\n return dateA.valueOf() - dateB.valueOf();\n }\n\n if (dateA) {\n return -1;\n }\n\n if (dateB) {\n return 1;\n }\n\n return 0;\n });\n}\n\n/**\n * Start dates of the given date/time slots, chronological and de-duplicated.\n * Slots that share a `startDate` (e.g. two stall slots on the same day) collapse\n * into a single entry.\n */\nexport function getUniqueStartDates(\n dates: Array<{ startDate?: string; startTime?: string }> | null | undefined,\n): string[] {\n const seenStartDates = new Set<string>();\n const uniqueStartDates: string[] = [];\n\n for (const { startDate } of sortDatesChronologically(dates ?? [])) {\n if (!startDate || seenStartDates.has(startDate)) {\n continue;\n }\n\n seenStartDates.add(startDate);\n uniqueStartDates.push(startDate);\n }\n\n return uniqueStartDates;\n}\n\n/**\n * UI filter options for user-activity event periods. Derived from the canonical\n * {@link FUTURE_EVENT_DATE_STATUSES} list, minus `STARTING_SOON` (a presentational\n * choice: \"starting soon\" is surfaced separately rather than as a filter).\n */\nexport const futureTimePeriods = FUTURE_EVENT_DATE_STATUSES.filter(\n (status) => status !== EnumEventDateStatus.STARTING_SOON,\n).map((status) => ({\n label: EVENT_DATE_STATUS_LABELS[status],\n value: status,\n}));\n","export enum EnumInviteStatus {\n ACCEPTED = \"Accepted\",\n CANCELED = \"Canceled\",\n COMPLETED = \"Completed\",\n EXPIRED = \"Expired\",\n NO_STATUS = \"No_Status\",\n PENDING = \"Pending\",\n REJECTED = \"Rejected\",\n}\n\nexport enum EnumChatReportReason {\n INAPPROPRIATE_CONTENT = \"Inappropriate_Content\",\n HARASSMENT_OR_BULLYING = \"Harassment_or_Bullying\",\n HATE_SPEECH = \"Hate_Speech\",\n SPAM_OR_SCAM = \"Spam_or_Scam\",\n VIOLENCE_OR_DANGEROUS_BEHAVIOR = \"Violence_or_Dangerous_Behavior\",\n OTHER = \"Other\",\n}\n\nexport enum EnumChatType {\n GROUP = \"group\",\n PRIVATE = \"private\",\n}\n\nexport enum EnumPaymentMethod {\n CASH = \"cash\",\n EFTPOS = \"eftpos\",\n BANK_TRANSFER = \"bank_transfer\",\n PAYPAL = \"paypal\",\n STRIPE = \"stripe\",\n}\n\nexport enum EnumFoodFlavor {\n SALTY = \"Salty\",\n SAVOURY = \"Savoury\",\n SPICY = \"Spicy\",\n SWEET = \"Sweet\",\n OTHER = \"Not_Applicable\",\n}\n\nexport enum EnumFoodType {\n ADDITIVE_FREE = \"Additive_Free\",\n AIR_FRIED = \"Air_Fried\",\n ALLERGEN_FRIENDLY = \"Allergen_Friendly\",\n ATHLETE_FRIENDLY = \"Athlete_Friendly\",\n BAKED = \"Baked\",\n DAIRY_FREE = \"Dairy_Free\",\n DIABETIC_FRIENDLY = \"Diabetic_Friendly\",\n EGG_FREE = \"Egg_Free\",\n FRESH = \"Fresh\",\n GLUTEN_FREE = \"Gluten_Free\",\n GRILLED = \"Grilled\",\n HALAL = \"Halal\",\n HEART_HEALTHY = \"Heart_Healthy\",\n HIGH_FIBER = \"High_Fiber\",\n HIGH_PROTEIN = \"High_Protein\",\n KETO = \"Keto\",\n KOSHER = \"Kosher\",\n LACTOSE_FREE = \"Lactose_Free\",\n LOW_CALORIE = \"Low_Calorie\",\n LOW_CARB = \"Low_Carb\",\n LOW_FAT = \"Low_Fat\",\n LOW_SODIUM = \"Low_Sodium\",\n NO_ADDED_SUGAR = \"No_Added_Sugar\",\n NO_PRESERVATIVES = \"No_Preservatives\",\n NON_GMO = \"Non_GMO\",\n NUT_FREE = \"Nut_Free\",\n ORGANIC = \"Organic\",\n PALEO = \"Paleo\",\n PLANT_BASED = \"Plant_Based\",\n RAW = \"Raw\",\n SMOKED = \"Smoked\",\n SOY_FREE = \"Soy_Free\",\n SUGAR_FREE = \"Sugar_Free\",\n VEGAN = \"Vegan\",\n VEGETARIAN = \"Vegetarian\",\n}\n\nexport enum EnumResourceType {\n AFFILIATE = \"affiliate\",\n EVENT = \"event\",\n PARTNER = \"partner\",\n SCHOOL = \"school\",\n VENDOR = \"vendor\",\n VISITOR = \"visitor\",\n}\n\n/** `EnumResourceType` values that map to a stored resource — excludes the user-only `VISITOR` type. */\nexport type NonVisitorResourceType = Exclude<\n EnumResourceType,\n EnumResourceType.VISITOR\n>;\n\n/** Type guard that narrows an `EnumResourceType` to `NonVisitorResourceType`. */\nexport function isNonVisitorResourceType(\n value: EnumResourceType,\n): value is NonVisitorResourceType {\n return value !== EnumResourceType.VISITOR;\n}\n\nexport enum EnumEventType {\n MARKET = \"Market\",\n EXPO = \"Expo\",\n FAIR = \"Fair\",\n FESTIVAL = \"Festival\",\n}\n\nexport enum EnumVendorType {\n STALLHOLDER = \"Stallholder\",\n SHOP = \"Shop\",\n}\n\nexport enum EnumPartnerType {\n CHARITY_PARTNER = \"Charity_Partner\",\n MEDIA_PARTNER = \"Media_Partner\",\n SUPPORTING_PARTNER = \"Supporting_Partner\",\n}\n\nexport enum EnumOSPlatform {\n ANDROID = \"android\",\n IOS = \"ios\",\n WEB = \"web\",\n}\n\nexport enum EnumRelationResource {\n EVENT_INVITE_VENDOR = \"event_invite_vendor\",\n EVENT_UPDATE_RELATION_TO_VENDOR = \"event_update_relation_to_vendor\",\n VENDOR_UPDATE_RELATION_TO_EVENT = \"vendor_update_relation_to_event\",\n VENDOR_APPLICATION_TO_EVENT = \"vendor_application_to_event\",\n}\n\nexport enum EnumNotificationResourceType {\n AFFILIATE_REWARD_RECEIVED = \"affiliate_reward_received\",\n APPROVED_AFFILIATE = \"approved_affiliate\",\n APPROVED_EVENT = \"approved_event\",\n APPROVED_PARTNER = \"approved_partner\",\n APPROVED_SCHOOL = \"approved_school\",\n APPROVED_VENDOR = \"approved_vendor\",\n CREATED_EVENT = \"created_event\",\n CREATED_PARTNER = \"created_partner\",\n CREATED_VENDOR = \"created_vendor\",\n CREATED_COUPON = \"created_coupon\",\n DAILY_CLUE_GAME = \"daily_clue_game\",\n DEACTIVATED_EVENT = \"deactivated_event\",\n DEACTIVATED_PARTNER = \"deactivated_partner\",\n DEACTIVATED_VENDOR = \"deactivated_vendor\",\n DECLINED_EVENT = \"declined_event\",\n DECLINED_PARTNER = \"declined_partner\",\n DECLINED_VENDOR = \"declined_vendor\",\n DOWNGRADED_EVENT = \"downgraded_event\",\n DOWNGRADED_PARTNER = \"downgraded_partner\",\n DOWNGRADED_VENDOR = \"downgraded_vendor\",\n EVENT_DATE_CANCELED = \"event_date_canceled\",\n EVENT_INFO_CREATED = \"event_info_created\",\n EVENT_INVITE_VENDOR = EnumRelationResource.EVENT_INVITE_VENDOR,\n EVENT_STARTING_SOON = \"event_starting_soon\",\n EVENT_UPDATE_RELATION_TO_VENDOR = EnumRelationResource.EVENT_UPDATE_RELATION_TO_VENDOR,\n EXPIRATION_REMINDER_EVENT = \"expiration_reminder_event\",\n EXPIRATION_REMINDER_PARTNER = \"expiration_reminder_partner\",\n EXPIRATION_REMINDER_VENDOR = \"expiration_reminder_vendor\",\n NEW_CHAT_MESSAGE = \"new_chat_message\",\n NEW_POST_CREATED = \"new_post_created\",\n REGISTERED_USER_BY_SCHOOL_CODE = \"registered_user_by_school_code\",\n SYSTEM_ALERT = \"system_alert\",\n USER_COUPON_REDEEMED = \"user_coupon_redeemed\",\n VENDOR_APPLICATION_TO_EVENT = EnumRelationResource.VENDOR_APPLICATION_TO_EVENT,\n VENDOR_UPDATE_RELATION_TO_EVENT = EnumRelationResource.VENDOR_UPDATE_RELATION_TO_EVENT,\n}\n\nexport enum EnumNotificationType {\n CHAT = \"chat\",\n EVENT = EnumResourceType.EVENT,\n RELATION = \"relation\",\n SYSTEM = \"system\",\n VENDOR = EnumResourceType.VENDOR,\n}\n\nexport enum EnumRegions {\n All = \"All Regions\",\n Auckland = \"Auckland\",\n BayOfPlentyGisborne = \"Bay of Plenty & Gisborne\",\n CanterburyWestCoast = \"Canterbury & West Coast\",\n HawkesBay = \"Hawke's Bay\",\n ManawatuWanganui = \"Manawatu-Wanganui\",\n MarlboroughNelsonTasman = \"Marlborough & Nelson & Tasman\",\n Northland = \"Northland\",\n Otago = \"Otago\",\n Southland = \"Southland\",\n Taranaki = \"Taranaki\",\n Waikato = \"Waikato\",\n Wellington = \"Wellington\",\n}\n\nexport enum ImageTypeEnum {\n AVATAR = \"avatar\",\n COVER = \"cover\",\n IMAGE = \"image\",\n LOGO = \"logo\",\n}\n\nexport enum EnumUserLicence {\n PRO_EVENT = \"pro_event\",\n PRO_PLUS_EVENT = \"pro_plus_event\",\n PRO_PLUS_VENDOR = \"pro_plus_vendor\",\n PRO_VENDOR = \"pro_vendor\",\n STANDARD_EVENT = \"standard_event\",\n STANDARD_VENDOR = \"standard_vendor\",\n STANDARD_PARTNER = \"standard_partner\",\n STANDARD_AFFILIATE = \"standard_affiliate\",\n STANDARD_SCHOOL = \"standard_school\",\n}\n\nexport enum LicenceExpiryDate {\n ONE_YEAR = \"1 year\",\n ONE_MONTH = \"1 month\",\n TWO_MONTHS = \"2 months\",\n THREE_MONTHS = \"3 months\",\n SIX_MONTHS = \"6 months\",\n}\n\nexport enum EnumUserRole {\n ADMIN = \"admin\",\n AFFILIATE = \"affiliate\",\n CUSTOMER = \"customer\",\n EVENT = \"event\",\n PARTNER = \"partner\",\n SCHOOL = \"school\",\n SUPER_ADMIN = \"super_admin\",\n VENDOR = \"vendor\",\n}\n\nexport enum EnumSocialMedia {\n FACEBOOK = \"facebook\",\n INSTAGRAM = \"instagram\",\n TIKTOK = \"tiktok\",\n TWITTER = \"twitter\",\n WEBSITE = \"website\",\n YOUTUBE = \"youtube\",\n}\n\nexport enum EnumEventDateStatus {\n STARTING_SOON = \"Starting_Soon\",\n STARTED = \"Started\",\n TODAY = \"Today\",\n TOMORROW = \"Tomorrow\",\n THIS_WEEK = \"This_Week\",\n NEXT_WEEK = \"Next_Week\",\n UPCOMING = \"Upcoming\",\n ENDED = \"Ended\",\n RE_SCHEDULED = \"Rescheduled\",\n CANCELED = \"Canceled\",\n INVALID = \"Invalid\",\n}\n\nexport enum EnumSubscriptionStatus {\n ACTIVE = \"active\",\n INACTIVE = \"inactive\",\n CANCELLED = \"cancelled\",\n NO_SUBSCRIPTION = \"no_subscription\",\n PAST_DUE = \"past_due\",\n TRIALING = \"trialing\",\n}\n\nexport enum EnumBillingPeriod {\n MONTHLY_CANCEL_ANYTIME = \"monthly_cancel_anytime\",\n YEARLY_ANNUAL_BILLED = \"yearly_annual_billed\",\n}\n\nexport enum EnumReward {\n MYSTERY_JOY_BOX = \"mystery_joy_box\",\n MYSTERY_SQUEEZE_BOX = \"mystery_squeeze_box\",\n MYSTERY_DELUXE_BOX = \"mystery_deluxe_box\",\n}\n\nexport enum EnumPointType {\n DAILY_CLUE_GAME = \"daily_clue_game\",\n EVENT_CHECKIN = \"event_checkin\",\n INITIAL = \"initial\",\n MINI_QUIZ_GAME = \"mini_quiz_game\",\n ODD_ONE_OUT_GAME = \"odd_one_out_game\",\n}\n","export const dateFormat = \"DD-MM-YYYY\";\nexport const timeFormat = \"HH:mm\";\n/** ISO 8601 machine/sortable format: day keys, Date construction, strict parsing, HTML date inputs. */\nexport const isoDateFormat = \"YYYY-MM-DD\";\n","import dayjs from \"dayjs\";\nimport customParseFormat from \"dayjs/plugin/customParseFormat.js\";\nimport isoWeek from \"dayjs/plugin/isoWeek.js\";\n\nimport { EnumEventDateStatus } from \"../enums\";\nimport type { DateTimeType } from \"../types/global\";\n\nimport { dateFormat, timeFormat } from \"./dateFormats\";\n\n// Enable dayjs plugins used by event date parsing/status logic\ndayjs.extend(customParseFormat);\ndayjs.extend(isoWeek);\n\n/**\n * Display label per date status. Single source of truth instead of deriving\n * the label with `replaceAll(\"_\", \" \")` / text-transform tricks, so each\n * status maps to an explicit, correctly-cased string (e.g. \"This Week\",\n * \"Starting Soon\", \"Rescheduled\"). Lives here (not in `calendar`) so both\n * `calendar/eventCalendar` and `utils/date` can consume it without a circular\n * import.\n */\nexport const EVENT_DATE_STATUS_LABELS: Record<EnumEventDateStatus, string> = {\n [EnumEventDateStatus.STARTING_SOON]: \"Starting Soon\",\n [EnumEventDateStatus.STARTED]: \"Started\",\n [EnumEventDateStatus.TODAY]: \"Today\",\n [EnumEventDateStatus.TOMORROW]: \"Tomorrow\",\n [EnumEventDateStatus.THIS_WEEK]: \"This Week\",\n [EnumEventDateStatus.NEXT_WEEK]: \"Next Week\",\n [EnumEventDateStatus.UPCOMING]: \"Upcoming\",\n [EnumEventDateStatus.ENDED]: \"Ended\",\n [EnumEventDateStatus.RE_SCHEDULED]: \"Rescheduled\",\n [EnumEventDateStatus.CANCELED]: \"Canceled\",\n [EnumEventDateStatus.INVALID]: \"Invalid\",\n};\n\nexport const EVENT_DATE_STATUS_PERIOD_MAP: Partial<\n Record<EnumEventDateStatus, EnumEventDateStatus[]>\n> = {\n [EnumEventDateStatus.TODAY]: [\n EnumEventDateStatus.STARTED,\n EnumEventDateStatus.STARTING_SOON,\n EnumEventDateStatus.TODAY,\n ],\n [EnumEventDateStatus.THIS_WEEK]: [\n EnumEventDateStatus.STARTED,\n EnumEventDateStatus.STARTING_SOON,\n EnumEventDateStatus.THIS_WEEK,\n EnumEventDateStatus.TODAY,\n EnumEventDateStatus.TOMORROW,\n ],\n};\n\nexport function getAllowedEventDateStatuses(\n period: EnumEventDateStatus,\n): EnumEventDateStatus[] {\n return EVENT_DATE_STATUS_PERIOD_MAP[period] ?? [period];\n}\n\nexport function eventMatchesDateStatusPeriod(\n dateTime: Pick<DateTimeType, \"dateStatus\">[] | null | undefined,\n period: EnumEventDateStatus,\n): boolean {\n const allowedStatuses = getAllowedEventDateStatuses(period);\n\n return (\n dateTime?.some((dt) => allowedStatuses.includes(dt.dateStatus)) ?? false\n );\n}\n\nexport function filterEventsByDateStatusPeriod<\n T extends { dateTime?: Pick<DateTimeType, \"dateStatus\">[] | null },\n>(events: T[], period: EnumEventDateStatus): T[] {\n return events.filter((event) =>\n eventMatchesDateStatusPeriod(event.dateTime, period),\n );\n}\n\n/**\n * Canonical list of date statuses whose start date/time is still in the future\n * (i.e. the slot has not started yet). `STARTED`, `ENDED`, `INVALID`,\n * `CANCELED` and `RE_SCHEDULED` are intentionally excluded.\n *\n * This is the single source of truth for \"is this slot still in the future\".\n * `futureTimePeriods` (in `utils/date.ts`) derives from this list for UI\n * filters, additionally excluding `STARTING_SOON`.\n */\nexport const FUTURE_EVENT_DATE_STATUSES: readonly EnumEventDateStatus[] = [\n EnumEventDateStatus.STARTING_SOON,\n EnumEventDateStatus.TODAY,\n EnumEventDateStatus.TOMORROW,\n EnumEventDateStatus.THIS_WEEK,\n EnumEventDateStatus.NEXT_WEEK,\n EnumEventDateStatus.UPCOMING,\n];\n\nexport function isFutureEventDateStatus(\n dateStatus: EnumEventDateStatus | null | undefined,\n): boolean {\n return Boolean(dateStatus && FUTURE_EVENT_DATE_STATUSES.includes(dateStatus));\n}\n\nexport function filterDatesByFutureStatus<\n T extends { dateStatus?: EnumEventDateStatus | null },\n>(dates: T[]): T[] {\n return dates.filter((date) => isFutureEventDateStatus(date.dateStatus));\n}\n\n/**\n * Statuses set by an explicit user action rather than derived from the\n * schedule clock. The status recomputation below must leave them untouched,\n * otherwise a canceled/rescheduled date would silently flip back to a\n * time-derived status on the next run.\n */\nexport const MANUAL_DATE_STATUSES: ReadonlySet<EnumEventDateStatus> = new Set([\n EnumEventDateStatus.CANCELED,\n EnumEventDateStatus.RE_SCHEDULED,\n]);\n\n/**\n * Builds the event schedule that relation dates should be matched against.\n *\n * Manual statuses (`MANUAL_DATE_STATUSES`: CANCELED and RE_SCHEDULED) stay on\n * the live `Event.dateTime` for visibility, but a relation date pointing at\n * them is treated as removed. Archived (ended) slots are appended separately\n * so relation dates for archived history still match instead of being wrongly\n * marked canceled.\n *\n * Shared by the event-update relation sync and the cron orphan-date cleanup so\n * both use the same archive-aware schedule.\n */\nexport function buildRelationEligibleEventSchedule<\n T extends { dateStatus?: EnumEventDateStatus | null },\n>(liveDateTime: T[], archivedDateTime: T[] = []): T[] {\n const eligible = liveDateTime.filter(\n (slot) => !slot.dateStatus || !MANUAL_DATE_STATUSES.has(slot.dateStatus),\n );\n return [...eligible, ...archivedDateTime];\n}\n\n/**\n * Determines the dateStatus for a future event date\n * @param startDateTime The start date-time of the event\n * @param now The current date-time\n * @returns The appropriate EnumEventDateStatus\n */\nexport function getFutureEventStatus(\n startDateTime: dayjs.Dayjs,\n now: dayjs.Dayjs,\n): EnumEventDateStatus {\n const hoursUntilStart = startDateTime.diff(now, \"hour\", true);\n if (hoursUntilStart > 0 && hoursUntilStart <= 4) {\n return EnumEventDateStatus.STARTING_SOON;\n }\n\n if (startDateTime.isSame(now, \"day\")) {\n return EnumEventDateStatus.TODAY;\n }\n\n if (startDateTime.isSame(now.add(1, \"day\"), \"day\")) {\n return EnumEventDateStatus.TOMORROW;\n }\n\n if (startDateTime.isSame(now, \"isoWeek\")) {\n return EnumEventDateStatus.THIS_WEEK;\n }\n\n if (startDateTime.isSame(now.add(1, \"week\"), \"isoWeek\")) {\n return EnumEventDateStatus.NEXT_WEEK;\n }\n\n return EnumEventDateStatus.UPCOMING;\n}\n\n/**\n * Updates the dateStatus field for a single DateTimeType object based on the current date/time.\n * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.\n * @param dateTime The date-time object to update\n * @returns A new object with an updated dateStatus value, or the original\n * object when the stored status is a manual override\n */\nexport function updateSingleDateTimeStatus<T extends DateTimeType>(\n dateTime: T,\n now: dayjs.Dayjs = dayjs(),\n): T {\n if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {\n return dateTime;\n }\n\n // Parse start and end date-time\n const dateTimeFormat = `${dateFormat} ${timeFormat}`;\n const startDateTime = dayjs(\n `${dateTime.startDate} ${dateTime.startTime}`,\n dateTimeFormat,\n true,\n );\n const endDateTime = dayjs(\n `${dateTime.endDate} ${dateTime.endTime}`,\n dateTimeFormat,\n true,\n );\n\n // Skip if dates are invalid\n if (!startDateTime.isValid() || !endDateTime.isValid()) {\n return {\n ...dateTime,\n dateStatus: EnumEventDateStatus.INVALID,\n };\n }\n\n if (endDateTime.isBefore(startDateTime)) {\n return {\n ...dateTime,\n dateStatus: EnumEventDateStatus.INVALID,\n };\n }\n\n let dateStatus: EnumEventDateStatus;\n\n if (endDateTime.isAfter(now)) {\n if (startDateTime.isAfter(now)) {\n // Event has not started yet\n dateStatus = getFutureEventStatus(startDateTime, now);\n } else {\n // Event is in progress\n dateStatus = EnumEventDateStatus.STARTED;\n }\n } else {\n // Event has ended\n dateStatus = EnumEventDateStatus.ENDED;\n }\n\n return {\n ...dateTime,\n dateStatus,\n };\n}\n","import type { Dayjs } from \"dayjs\";\n\nimport {\n DailyClueGameData,\n GamePlacement,\n GamePlacementClue,\n gameScreenIdentifierList,\n} from \"../types/game/dailyClue\";\n\nimport { nzStartOfDay } from \"./date\";\n\nfunction createSeededRng(seed: number) {\n let t = seed >>> 0;\n\n return function random() {\n t += 0x6d2b79f5;\n let x = t;\n\n x = Math.imul(x ^ (x >>> 15), x | 1);\n x ^= x + Math.imul(x ^ (x >>> 7), x | 61);\n\n return ((x ^ (x >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nfunction hashStringToNumber(seed: string): number {\n let hash = 2166136261;\n\n for (let i = 0; i < seed.length; i++) {\n hash ^= seed.codePointAt(i) ?? 0;\n hash = Math.imul(hash, 16777619);\n }\n\n return hash >>> 0;\n}\n\n/** Seeded shuffle so all players see the same letter order / placements for a game. */\nexport function seededShuffle<T>(array: readonly T[], seed: string): T[] {\n const rng = createSeededRng(hashStringToNumber(seed));\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(rng() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n\nfunction getDayIndex(start: Dayjs, today: Dayjs): number {\n return today.diff(start, \"day\");\n}\n\n/**\n * Number of whole days since `dailyClue`'s start date (NZ time), i.e. today's\n * slot index into the game's day-based arrays.\n *\n * Returns `0` on the start date and a positive value on later days up to and\n * including the end date. Returns `null` outside the game window (before the\n * start date or after the end date), so callers must handle `null` instead of\n * blindly indexing arrays — an out-of-window index would silently produce\n * `undefined` or, in the occurrence helpers, wrongly report a letter as\n * already collected.\n *\n * Extracted from `computeDailyClueState` so callers (e.g. the update mutation)\n * can resolve the same index without re-implementing the day-math.\n */\nexport function getDailyClueDayIndex(\n dailyClue: DailyClueGameData,\n): number | null {\n const today = nzStartOfDay();\n const start = nzStartOfDay(dailyClue.gameFields.gameDate.startDate);\n const end = nzStartOfDay(dailyClue.gameFields.gameDate.endDate);\n\n if (today.isBefore(start) || today.isAfter(end)) {\n return null;\n }\n\n return getDayIndex(start, today);\n}\n\n/**\n * Number of times `letter` appears in `letters`.\n *\n * `collected` is a multiset (duplicate letters are stored once per found\n * occurrence), so membership checks such as `includes` are not enough — callers\n * must count how many occurrences have actually been collected.\n */\nexport function countLetterOccurrences(\n letters: readonly string[],\n letter: string,\n): number {\n return letters.reduce(\n (count, candidate) => (candidate === letter ? count + 1 : count),\n 0,\n );\n}\n\n/**\n * Number of times `letter` appears at or before `index` in `letters`.\n *\n * This is the \"required\" count for today's slot: a duplicate letter must not be\n * considered already collected until every earlier occurrence of it in\n * `solutionShuffled` has also been found.\n */\nexport function countLetterOccurrencesUpTo(\n letters: readonly string[],\n letter: string,\n index: number,\n): number {\n let count = 0;\n const end = Math.min(index, letters.length - 1);\n\n for (let i = 0; i <= end; i++) {\n if (letters[i] === letter) {\n count++;\n }\n }\n\n return count;\n}\n\nexport function computeDailyClueState(dailyClue: DailyClueGameData): {\n todaysClue: GamePlacementClue | null;\n todaysLetter: string | null;\n todaysPlacement: GamePlacement | null;\n} | null {\n const { startDate, endDate } = dailyClue.gameFields.gameDate;\n const { solutionShuffled, collected } = dailyClue.letterInfo;\n\n const today = nzStartOfDay();\n const start = nzStartOfDay(startDate);\n const end = nzStartOfDay(endDate);\n\n // Before game starts\n if (today.isBefore(start)) {\n return null;\n }\n\n const shuffledPlacements = seededShuffle(\n gameScreenIdentifierList,\n start.toISOString(),\n );\n\n const index = getDayIndex(start, today);\n\n // After game ends\n if (today.isAfter(end)) {\n return {\n todaysClue: null,\n todaysLetter: null,\n todaysPlacement: null,\n };\n }\n\n // Safety: index must exist in BOTH arrays\n if (\n index < 0 ||\n index >= solutionShuffled.length ||\n index >= shuffledPlacements.length\n ) {\n return null;\n }\n\n const letterToday = solutionShuffled[index];\n const placement = shuffledPlacements[index];\n\n if (!letterToday || !placement) return null;\n\n const collectedLetters = collected ?? [];\n\n // Compare collected occurrences against how many of today's letter have\n // appeared at or before this day's slot. This fixes solutions with duplicate\n // letters (e.g. \"EXPLORE\" has two \"E\"s): one collected \"E\" must not hide the\n // second \"E\" day. Membership checks (`includes`) can't express that.\n const alreadyCollectedToday =\n countLetterOccurrences(collectedLetters, letterToday) >=\n countLetterOccurrencesUpTo(solutionShuffled, letterToday, index);\n\n // Already completed today\n if (alreadyCollectedToday) {\n return {\n todaysClue: null,\n todaysLetter: null,\n todaysPlacement: null,\n };\n }\n\n // Active state\n return {\n todaysClue: placement.clue,\n todaysLetter: letterToday,\n todaysPlacement: placement.id,\n };\n}\n","export function getDistanceInMeters(\n coordinates1: number[],\n coordinates2: number[],\n): number {\n const [lon1, lat1] = coordinates1;\n const [lon2, lat2] = coordinates2;\n\n const values = [lon1, lat1, lon2, lat2];\n if (values.some((v) => !Number.isFinite(v))) {\n return Infinity;\n }\n\n const toRadians = (deg: number) => (deg * Math.PI) / 180;\n const R = 6371000; // Earth radius in meters\n\n const dLat = toRadians(lat2 - lat1);\n const dLon = toRadians(lon2 - lon1);\n const radLat1 = toRadians(lat1);\n const radLat2 = toRadians(lat2);\n\n const a =\n Math.sin(dLat / 2) ** 2 +\n Math.sin(dLon / 2) ** 2 * Math.cos(radLat1) * Math.cos(radLat2);\n\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return R * c;\n}\n\nexport function getDistanceInKilometers(\n coordinates1: number[],\n coordinates2: number[],\n): number {\n const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);\n\n if (!Number.isFinite(distanceInMeters)) {\n return Infinity;\n }\n\n return Math.round(distanceInMeters / 1000);\n}\n\nexport function formatDistance(\n coordinates1: number[],\n coordinates2: number[],\n): string {\n const distanceInMeters = getDistanceInMeters(coordinates1, coordinates2);\n\n if (!Number.isFinite(distanceInMeters)) {\n return \"—\";\n }\n\n const roundedMeters = Math.round(distanceInMeters);\n\n if (roundedMeters < 1000) {\n return `${roundedMeters} m`;\n }\n\n return `${Math.round(roundedMeters / 1000)} km`;\n}\n","/** Default page size shared by paginated list consumers. */\nexport const DEFAULT_PAGE_SIZE = 50;\n\n/**\n * Default identity extractor for paginated items. Assumes the item has an `_id`\n * field; callers with a different key (e.g. `userId`) should pass `getId`.\n */\nexport function defaultGetId<TItem>(item: TItem): string {\n const id = (item as { _id?: unknown } | null)?._id;\n return id != null ? String(id) : \"\";\n}\n\n/**\n * Appends `page` onto `items`, de-duplicating by `getId` (first occurrence\n * wins) and preserving order. Returns the same reference when nothing new was\n * added, so callers can rely on reference equality to avoid extra renders.\n */\nexport function accumulateItems<TItem>(\n items: TItem[],\n page: TItem[],\n getId: (item: TItem) => string,\n): TItem[] {\n if (page.length === 0) {\n return items;\n }\n\n const seen = new Set<string>();\n for (const item of items) {\n const id = getId(item);\n if (id !== \"\") {\n seen.add(id);\n }\n }\n\n const fresh = page.filter((item) => {\n const id = getId(item);\n // An empty ID carries no stable identity, so it cannot be de-duplicated;\n // keep such items rather than letting them all collide in `seen`.\n if (id === \"\") {\n return true;\n }\n if (seen.has(id)) {\n return false;\n }\n seen.add(id);\n return true;\n });\n\n return fresh.length === 0 ? items : [...items, ...fresh];\n}\n\n/** A full page means more pages may exist (offset pagination has no total count). */\nexport function computeHasMore(pageLength: number, pageSize: number): boolean {\n return pageLength === pageSize;\n}\n","import { OptionItem } from \"src/types\";\n\n/**\n * Convert an array of strings to an array of objects with label and value properties.\n */\nexport const mapArrayToOptions = (items: string[]): OptionItem[] =>\n items.map((item) => ({\n label: item,\n value: item,\n }));\n","/** Path segments for relation share URLs — must match mobile `RelationTitle` values. */\nexport const RELATION_SHARE_INVITATION = \"invitation\" as const;\nexport const RELATION_SHARE_APPLICATION = \"application\" as const;\n\n/**\n * Bump when relation overlay SVG/layout changes so og:image URLs and API ETags\n * invalidate after deploy. Facebook caches preview JPEGs by exact URL — changing\n * this value forces crawlers to fetch a fresh image after server deploy.\n */\nexport const RELATION_OVERLAY_LAYOUT_VERSION = 43;\n\nexport const RELATION_SHARE_RESOURCE_TYPES = [\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_APPLICATION,\n] as const;\n\nexport type RelationShareResourceType =\n (typeof RELATION_SHARE_RESOURCE_TYPES)[number];\n\nexport function isRelationShareResourceType(\n resourceType: string,\n): resourceType is RelationShareResourceType {\n return (RELATION_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n RELATION_OVERLAY_LAYOUT_VERSION,\n RELATION_SHARE_RESOURCE_TYPES,\n isRelationShareResourceType,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\n/** Open Graph recommended preview size (must match admin `SHARE_OG_IMAGE_*`). */\nexport const SOCIAL_IMAGE_WIDTH = 1200;\n\n/** Open Graph recommended preview size (must match admin `SHARE_OG_IMAGE_*`). */\nexport const SOCIAL_IMAGE_HEIGHT = 630;\n\n/** Keep in sync with `CLUEMART_MAIN_DOMAIN_URL` in utils (avoid utils↔sharing import cycle). */\nexport const SHARE_SITE_URL = \"https://cluemart.co.nz\";\n\n/** Calendar marker for invitation market-dates share copy (U+1F4C5 📅). */\nexport const SHARE_CALENDAR_ICON = \"\\u{1F4C5}\";\n\nexport const SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;\n\n/** Check mark for invitation requirements share copy (U+2705 ✅). */\nexport const SHARE_CHECKMARK_ICON = \"\\u{2705}\";\n\nexport const SHARE_REQUIREMENTS_SECTION_HEADING = `${SHARE_CHECKMARK_ICON} Requirements:`;\n\n/** Information marker for tags share copy (U+2139 ℹ️). */\nexport const SHARE_INFO_ICON = \"\\u{2139}\\u{FE0F}\";\n\nexport const SHARE_TAGS_SECTION_HEADING = `${SHARE_INFO_ICON} Tags:`;\n\n/** Standalone line when `rainOrShine` is true (invitation share + OG section parsing). */\nexport const SHARE_RAIN_OR_SHINE_LINE = \"Rain or Shine\";\n\n/** Standalone line when `foodTruck` is true (application share + OG section parsing). */\nexport const SHARE_FOOD_TRUCK_LINE = \"Food Truck\";\n\n/** Prefix for application compliance line (share text + OG section parsing). */\nexport const SHARE_COMPLIANCE_PREFIX = `${SHARE_CHECKMARK_ICON} Compliance:`;\n\n/** Label tag for application categories share copy (U+1F3F7 🏷️). */\nexport const SHARE_CATEGORY_ICON = \"\\u{1F3F7}\\u{FE0F}\";\n\nexport const SHARE_CATEGORIES_SECTION_HEADING = `${SHARE_CATEGORY_ICON} Categories:`;\n\n/** Straight ruler for application stall-size share copy (U+1F4CF 📏). */\nexport const SHARE_RULER_ICON = \"\\u{1F4CF}\";\n\n/** Prefix for application stall-size line (share text + OG section parsing). */\nexport const SHARE_STALL_SIZE_PREFIX = `${SHARE_RULER_ICON} Stall size:`;\n\n/** Dollar marker for price-range share copy (U+0024 $ — text, not emoji, so it stays black). */\nexport const SHARE_DOLLAR_ICON = \"$\";\n\n/** Prefix for application price-range line (share text + OG section parsing). */\nexport const SHARE_PRICE_RANGE_PREFIX = `${SHARE_DOLLAR_ICON} Price range:`;\n\n/** Alarm clock for invitation application-deadline share copy (U+23F0 ⏰). */\nexport const SHARE_CLOCK_ICON = \"\\u{23F0}\";\n\n/** Prefix for the invitation application-deadline sentence (share text + OG section parsing). */\nexport const SHARE_APPLICATION_DEADLINE_PREFIX = `${SHARE_CLOCK_ICON} Application deadline:`;\n\n/** First line of `og:description` (and legacy share-message text). */\nexport const SHARE_MORE_INFO_LINE = \"Shared from ClueMart\";\n\nexport const DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;\n\nexport const RESOURCE_SHARE_TYPES = [\n \"market\",\n \"stallholder\",\n \"partner\",\n \"affiliate\",\n \"school\",\n] as const;\n\nexport type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];\n\nexport const POST_SHARE_RESOURCE_TYPES = [\n \"market_faces\",\n \"clue_bites\",\n \"play_and_win\",\n] as const;\n\nexport type PostShareResourceType = (typeof POST_SHARE_RESOURCE_TYPES)[number];\n\nexport type ShareResourceType =\n ResourceShareType | PostShareResourceType | RelationShareResourceType;\n\nexport const SHARE_RESOURCE_LABEL: Record<ShareResourceType, string> = {\n [RELATION_SHARE_APPLICATION]: \"Application\",\n [RELATION_SHARE_INVITATION]: \"Invitation\",\n affiliate: \"Affiliate\",\n clue_bites: \"Clue Bites\",\n market_faces: \"Market Faces\",\n market: \"Market\",\n partner: \"Partner\",\n play_and_win: \"Play & Win\",\n school: \"School\",\n stallholder: \"Stallholder\",\n};\n\nexport function isPostShareResourceType(\n resourceType: ShareResourceType,\n): resourceType is PostShareResourceType {\n return (POST_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import { joinShareOgDescriptionSections } from \"./joinShareDescriptionSections\";\n\nexport {\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n} from \"./joinShareDescriptionSections\";\n\n/** Trims share text and collapses spaces per line; preserves `\\n\\n` section breaks. */\nconst LEADING_WHITESPACE = /^[ \\t]*/;\n\nexport function normalizeShareText(value: string | null | undefined): string {\n if (value == null) {\n return \"\";\n }\n return value\n .trim()\n .split(\"\\n\")\n .map((line) => {\n const leading = LEADING_WHITESPACE.exec(line)?.[0] ?? \"\";\n const rest = line\n .slice(leading.length)\n .trim()\n .replace(/[ \\t]{2,}/g, \" \");\n return leading + rest;\n })\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\nexport function splitShareDescriptionSections(value: string): string[] {\n const trimmed = normalizeShareText(value);\n if (!trimmed) {\n return [];\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => normalizeShareText(section))\n .filter((section) => section.length > 0);\n }\n\n if (/\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n+/)\n .map((section) => normalizeShareText(section))\n .filter((section) => section.length > 0);\n }\n\n return [trimmed];\n}\n\n/**\n * Formats share descriptions for Open Graph / Twitter meta tags.\n * Sections are joined with {@link OG_DESCRIPTION_LINE_BREAK} (`&#10;`).\n */\nexport function normalizeShareOgDescription(value: string): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(value));\n}\n\n/**\n * Open Graph / Twitter description from pre-built section strings.\n * Prefer {@link joinShareOgDescriptionSections} when sections are already known.\n */\nexport function buildShareOgDescriptionFromSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return joinShareOgDescriptionSections(sections);\n}\n\n/** Open Graph / Twitter description — body sections only (`og:title` is separate). */\nexport function buildShareOgDescription(\n _title: string,\n description: string,\n): string {\n return joinShareOgDescriptionSections(\n splitShareDescriptionSections(description),\n );\n}\n\n/**\n * Strips emoji and symbols that do not render reliably in overlay SVG fonts.\n * Keeps letters, numbers, whitespace, and common sentence punctuation.\n */\nexport function stripOverlaySubtitleSpecialChars(text: string): string {\n const regex = /[^\\p{L}\\p{M}\\p{N}\\s.,!?'\"&\\-():;/]/gu;\n const result = text\n .replace(/\\p{Extended_Pictographic}/gu, \"\")\n .replace(regex, \"\");\n return result.trim();\n}\n","import {\n Control,\n FieldValues,\n FormState,\n UseFormGetValues,\n UseFormHandleSubmit,\n UseFormReset,\n UseFormSetValue,\n UseFormWatch,\n} from \"react-hook-form\";\n\nimport {\n EnumEventDateStatus,\n EnumEventType,\n EnumPartnerType,\n EnumRegions,\n EnumResourceType,\n EnumSocialMedia,\n EnumUserLicence,\n EnumUserRole,\n} from \"../enums\";\n\nimport { EventListItemType } from \"./event\";\nimport { EnumPostType } from \"./post\";\nimport { VendorType } from \"./vendor\";\n\nexport const PROMO_CODE_PREFIX = \"CM-\";\n\nexport type PromoCodeType = `${typeof PROMO_CODE_PREFIX}${string}`;\n\nexport type Nullable<T> = {\n [K in keyof T]: T[K] | null | undefined;\n};\n\n/** Uniform mutation response envelope used across GraphQL mutations. */\nexport type MutationResponse<T> = {\n data: T | null;\n message: string | null;\n};\n\nexport type DeviceInfo = {\n appBuildNumber: string;\n appId: string;\n appVersion: string;\n brand: string;\n deviceName: string;\n installationId: string;\n manufacturer: string;\n modelName: string;\n osName: string;\n osVersion: string;\n timestamp: Date;\n};\n\nexport type TermsAgreement = DeviceInfo & {\n termVersion: string;\n};\n\nexport type ResourceContactDetailsType = {\n email?: string | null;\n landlinePhone?: string | null;\n mobilePhone?: string | null;\n};\n\nexport type ResourceImageType = {\n active: boolean;\n source: string;\n title: string;\n};\n\nexport type SocialMediaType = {\n name?: EnumSocialMedia;\n link?: string;\n};\n\nexport type UserLicenceType = {\n expiryDate: Date;\n issuedDate: Date;\n licenceType: EnumUserLicence;\n prevLicenceType?: EnumUserLicence | null;\n};\n\nexport type OwnerType = {\n email: string;\n userId: string;\n};\n\nexport interface BaseResourceTypeFormData {\n _id?: string;\n active: boolean;\n contactDetails: ResourceContactDetailsType | null;\n cover: ResourceImageType;\n coverUpload?: ResourceImageType | null;\n description: string;\n images?: ResourceImageType[] | null;\n imagesUpload?: ResourceImageType[] | null;\n logo?: ResourceImageType | null;\n logoUpload?: ResourceImageType | null;\n name: string;\n promoCodes?: PromoCodeType[] | null;\n region: string;\n socialMedia: SocialMediaType[] | null;\n termsAgreement?: TermsAgreement | null;\n}\n\nexport type PosterUsageType = {\n month: string;\n count: number;\n};\n\nexport type RelatedPostType = {\n postActive: boolean;\n postId: string;\n postSlug: string;\n postType: EnumPostType;\n};\n\nexport type SocialShareResourceType = {\n qrCode: ResourceImageType;\n socialImage: ResourceImageType;\n};\n\nexport type BaseResourceType = Omit<\n BaseResourceTypeFormData,\n \"_id\" | \"coverUpload\" | \"imagesUpload\" | \"logoUpload\"\n> & {\n _id: string;\n adIds?: string[] | null;\n approvedAt?: Date | null;\n createdAt: Date;\n deletedAt: Date | null;\n owner: OwnerType;\n posterUsage?: PosterUsageType | null;\n rating?: number | null;\n relatedPost?: RelatedPostType | null;\n reviewCount?: number | null;\n sharePublic?: SocialShareResourceType | null;\n slug: string;\n updatedAt: Date | null;\n};\n\nexport type LocationGeoType = {\n coordinates: number[]; // [longitude, latitude]\n type: \"Point\"; // Mongoose GeoJSON type\n};\n\nexport type LocationType = {\n city: string;\n country: string;\n fullAddress: string;\n geo: LocationGeoType;\n latitude: number;\n longitude: number;\n region: string;\n};\n\nexport type DateTimeType = {\n dateStatus: EnumEventDateStatus;\n endDate: string;\n endTime: string;\n startDate: string;\n startTime: string;\n};\n\nexport type DateTimeFormValue = {\n dateStatus: EnumEventDateStatus;\n endDate?: string;\n endTime?: string;\n startDate?: string;\n startTime?: string;\n};\n\nexport type Region = {\n latitude: number;\n latitudeDelta: number;\n longitude: number;\n longitudeDelta: number;\n};\n\nexport type ResourceDetails = {\n dateTime: DateTimeType[] | null;\n description: string | null;\n eventStatus?: EventStatusType | null;\n location: LocationType | null;\n resourceCover: ResourceImageType | null;\n resourceId: string;\n resourceLogo: ResourceImageType | null;\n resourceName: string;\n resourceType: EnumResourceType;\n};\n\nexport type GeocodeLocation = Pick<LocationType, \"latitude\" | \"longitude\">;\n\nexport type EventStatusType = {\n claimed: boolean;\n eventType: EnumEventType;\n googlePlaceId?: string | null;\n};\n\nexport interface FormField {\n disabled?: boolean;\n helperText?: string;\n isTextArea?: boolean;\n keyboardType?:\n | \"default\"\n | \"email-address\"\n | \"number-pad\"\n | \"url\"\n | \"decimal-pad\"\n | \"phone-pad\";\n name: string;\n placeholder: string;\n required?: boolean;\n secureTextEntry?: boolean;\n}\n\nexport interface FormDateField {\n dateMode: \"date\" | \"time\";\n helperText?: string;\n name: \"endDate\" | \"endTime\" | \"startDate\" | \"startTime\";\n placeholder: string;\n}\n\nexport interface SubcategoryItems {\n id: string;\n name: string;\n description?: string | null;\n}\n\nexport interface Subcategory {\n id: string;\n name: string;\n items?: SubcategoryItems[] | null;\n}\n\nexport type CategoryColorType = {\n primary: string;\n secondary: string;\n};\n\nexport interface Category {\n color?: CategoryColorType | null;\n description?: string | null;\n id: string;\n name: string;\n subcategories: Subcategory[];\n}\n\nexport type OptionItem = {\n value: string;\n label: string;\n};\n\nexport type ImageObjectType = {\n uri: string;\n type: string;\n name: string;\n};\n\nexport interface ResourceConnectionsType {\n events: EventListItemType[] | null;\n vendors: VendorType[] | null;\n}\n\nexport interface CreateFormData<T extends FieldValues> {\n control: Control<T, any>;\n fields: T;\n formState: FormState<T>;\n handleSubmit: UseFormHandleSubmit<T, any>;\n reset: UseFormReset<T>;\n setValue: UseFormSetValue<T>;\n watch: UseFormWatch<T>;\n getValues: UseFormGetValues<T>;\n}\n\n/** Offset-pagination input for plain list fields (events/vendors/partners/posts/users). */\nexport interface PaginationOptions {\n limit?: number;\n offset?: number;\n}\n\n/** Server-side filter input for the super-admin users list query. */\nexport interface UserListFilter {\n active?: boolean | null;\n hasLicences?: boolean | null;\n role?: EnumUserRole | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin partners list query. */\nexport interface PartnerListFilter {\n active?: boolean | null;\n partnerType?: EnumPartnerType | null;\n region?: EnumRegions | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin vendors list query. */\nexport interface VendorListFilter {\n active?: boolean | null;\n region?: EnumRegions | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin events list query. */\nexport interface EventListFilter {\n active?: boolean | null;\n claimed?: boolean | null;\n region?: EnumRegions | null;\n search?: string | null;\n}\n\n/** Server-side filter input for the admin posts list query. */\nexport interface PostListFilter {\n active?: boolean | null;\n postType?: EnumPostType | null;\n search?: string | null;\n}\n\nexport interface UseGetResourcesByRegionOptions extends PaginationOptions {\n onlyClaimed?: boolean;\n skip?: boolean;\n}\n","import { EnumUserLicence } from \"../enums\";\n\n/** Tier keys in descending priority (highest first) for licence resolution. */\nexport const TIERS_BY_PRIORITY = [\"pro_plus\", \"pro\", \"standard\"] as const;\n\n/** Canonical subscription tier keys — matches Stripe/server tier identifiers. */\nexport type Tier = (typeof TIERS_BY_PRIORITY)[number];\n\n/** User-facing tier labels (decoupled from the Tier discriminant). */\nexport const TIER_DISPLAY_LABELS: Record<Tier, string> = {\n pro: \"Pro\",\n // eslint-disable-next-line camelcase\n pro_plus: \"Pro+ Ads\",\n standard: \"Standard\",\n};\n\n/** Maps licence enums to their canonical tier key. */\nexport const TIER_FROM_LICENCE: Record<EnumUserLicence, Tier> = {\n [EnumUserLicence.PRO_EVENT]: \"pro\",\n [EnumUserLicence.PRO_PLUS_EVENT]: \"pro_plus\",\n [EnumUserLicence.PRO_PLUS_VENDOR]: \"pro_plus\",\n [EnumUserLicence.PRO_VENDOR]: \"pro\",\n [EnumUserLicence.STANDARD_EVENT]: \"standard\",\n [EnumUserLicence.STANDARD_PARTNER]: \"standard\",\n [EnumUserLicence.STANDARD_VENDOR]: \"standard\",\n [EnumUserLicence.STANDARD_AFFILIATE]: \"standard\",\n [EnumUserLicence.STANDARD_SCHOOL]: \"standard\",\n};\n","import {\n EnumInviteStatus,\n EnumPaymentMethod,\n EnumRegions,\n EnumReward,\n EnumSocialMedia,\n EnumUserLicence,\n} from \"src/enums\";\nimport { stripOverlaySubtitleSpecialChars } from \"src/sharing/normalizeShareDescription\";\nimport {\n EnumPostType,\n OptionItem,\n PROMO_CODE_PREFIX,\n SocialMediaType,\n} from \"src/types\";\n\nimport { isIsoDateString } from \"./date\";\nimport { mapArrayToOptions } from \"./mapArrayToOptions\";\n\nexport const removeTypename = (obj: any): any => {\n // Preserve Date objects\n if (obj instanceof Date) {\n return obj;\n }\n\n // Preserve File objects (for apollo-upload-client)\n if (obj instanceof File) {\n return obj;\n }\n\n // Preserve ISO date strings\n if (isIsoDateString(obj)) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map(removeTypename);\n }\n\n // Handle plain objects only\n if (obj !== null && typeof obj === \"object\") {\n const { __typename, ...cleanedObj } = obj;\n\n return Object.keys(cleanedObj).reduce((acc: any, key) => {\n acc[key] = removeTypename(cleanedObj[key]);\n return acc;\n }, {});\n }\n\n // Primitives\n return obj;\n};\n\n/**\n * Truncate text to a specified length and append ellipsis if necessary.\n * @param text\n * @param maxLength\n * @returns\n */\nexport const truncateText = (text: string, maxLength: number = 30): string => {\n const result = stripOverlaySubtitleSpecialChars(text);\n return result.length > maxLength\n ? result.substring(0, maxLength) + \"...\"\n : result;\n};\n\nexport const capitalizeFirstLetter = (str: string): string => {\n return str\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \");\n};\n\nexport const statusOptions = [\n ...Object.values(EnumInviteStatus)\n .map((status) => ({\n label: status,\n value: status,\n }))\n .sort((a, b) => a.label.localeCompare(b.label)), // Sort the options alphabetically\n];\n\nexport const availableRegionTypes = Object.values(EnumRegions);\nexport const availableRegionOptions: OptionItem[] =\n mapArrayToOptions(availableRegionTypes);\n\nexport const paymentMethodOptions: OptionItem[] = mapArrayToOptions(\n Object.values(EnumPaymentMethod),\n);\n\nexport function normalizeUrl(url: string): string {\n const withProtocol =\n !url.startsWith(\"http://\") && !url.startsWith(\"https://\")\n ? `https://${url}`\n : url;\n return withProtocol.replace(/\\/+$/, \"\");\n}\n\nexport const licenseNiceNames: Record<EnumUserLicence, string> = {\n [EnumUserLicence.PRO_EVENT]: \"Pro Event\",\n [EnumUserLicence.PRO_VENDOR]: \"Pro Stallholder\",\n [EnumUserLicence.STANDARD_EVENT]: \"Standard Event\",\n [EnumUserLicence.STANDARD_VENDOR]: \"Standard Stallholder\",\n [EnumUserLicence.PRO_PLUS_EVENT]: \"Pro+Ads Event\",\n [EnumUserLicence.PRO_PLUS_VENDOR]: \"Pro+Ads Stallholder\",\n [EnumUserLicence.STANDARD_PARTNER]: \"Partner\",\n [EnumUserLicence.STANDARD_AFFILIATE]: \"Affiliate\",\n [EnumUserLicence.STANDARD_SCHOOL]: \"School\",\n};\n\nexport const vendorLicences: EnumUserLicence[] = [\n EnumUserLicence.STANDARD_VENDOR,\n EnumUserLicence.PRO_VENDOR,\n EnumUserLicence.PRO_PLUS_VENDOR,\n];\n\nexport const cluemartSocialMedia: SocialMediaType[] = [\n {\n link: \"https://www.facebook.com/ClueMartApp\",\n name: EnumSocialMedia.FACEBOOK,\n },\n {\n link: \"https://www.instagram.com/cluemart_app\",\n name: EnumSocialMedia.INSTAGRAM,\n },\n {\n link: \"https://www.tiktok.com/@cluemart\",\n name: EnumSocialMedia.TIKTOK,\n },\n {\n link: \"https://www.youtube.com/@ClueMart-App-NZ\",\n name: EnumSocialMedia.YOUTUBE,\n },\n];\n\nexport const IOS_URL = \"https://apps.apple.com/nz/app/cluemart/id6747251008\";\nexport const ANDROID_URL =\n \"https://play.google.com/store/apps/details?id=com.timardex.cluemart\";\n\nexport const DEFAULT_RESOURCES_RETURN_LIMIT = 1000;\nexport const DEFAULT_RESOURCES_RETURN_OFFSET = 0;\nexport const CLUEMART_MAIN_DOMAIN_URL = \"https://cluemart.co.nz\";\n\nexport const rewardNiceNames: Record<\n EnumReward,\n { name: string; points: number }\n> = {\n [EnumReward.MYSTERY_JOY_BOX]: {\n name: \"Mystery Joy Box\",\n points: 250,\n },\n [EnumReward.MYSTERY_SQUEEZE_BOX]: {\n name: \"Mystery Squeeze Box\",\n points: 350,\n },\n [EnumReward.MYSTERY_DELUXE_BOX]: {\n name: \"Mystery Deluxe Box\",\n points: 500,\n },\n};\n\nexport const PostTypeLabels: Record<EnumPostType, string> = {\n [EnumPostType.MARKET_FACES]: \"Market Faces\",\n [EnumPostType.CLUE_BITES]: \"Clue Bites\",\n [EnumPostType.PLAY_AND_WIN]: \"Play & Win\",\n //[EnumPostType.CLUE_GUIDES_FOR_ORGANISERS]: \"Clue Guides for Organisers\",\n //[EnumPostType.CLUE_GUIDES_FOR_VENDORS]: \"Clue Guides for Stallholders\",\n};\n\n/** Hardcoded registration gateway code; only valid at sign-up (not a generated school referral code). */\nexport const CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;\n\n/** Hardcoded registration gateway code; only valid at sign-up (not a generated affiliate referral code). */\nexport const CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;\n\nexport function formatNZBankAccount(input: string): string {\n // Remove all non-digit characters\n const digitsOnly = input.replaceAll(/\\D/g, \"\");\n\n // Build the formatted string step-by-step\n const parts = [];\n if (digitsOnly.length > 0) parts.push(digitsOnly.slice(0, 2)); // bank\n if (digitsOnly.length > 2) parts.push(digitsOnly.slice(2, 6)); // branch\n if (digitsOnly.length > 6) parts.push(digitsOnly.slice(6, 13)); // account\n if (digitsOnly.length > 13) parts.push(digitsOnly.slice(13, 15)); // suffix\n\n return parts.join(\"-\");\n}\n","import { ResourceImageType } from \"../types/global\";\n\n/**\n * Loose input shape for normalization helpers. Callers often pass partial or legacy\n * data (e.g. Mongo docs without `active`, GraphQL input, empty placeholders) before\n * it becomes a strict `ResourceImageType`.\n */\ntype ResourceImageLike = {\n active?: boolean | null;\n source?: string | null;\n title?: string | null;\n};\n\n/**\n * Resolves whether a resource image is active.\n * Only an explicit `active: true` shows the image; missing `active` defaults to false\n * so licence downgrades (e.g. standard vendor gallery limit) are not overridden.\n */\nexport function resolveResourceImageActive(\n image: ResourceImageLike | null | undefined,\n): boolean {\n if (image?.active != null) {\n return image.active;\n }\n\n return false;\n}\n\nexport function normalizeResourceImage(\n image: ResourceImageLike | null | undefined,\n): ResourceImageType {\n return {\n active: resolveResourceImageActive(image),\n source: image?.source ?? \"\",\n title: image?.title ?? \"\",\n };\n}\n\nexport function isResourceImageActive(\n image: ResourceImageLike | null | undefined,\n): boolean {\n return resolveResourceImageActive(image);\n}\n","export const SCHOOL_MIN_STUDENT_COUNT = 300;\nexport const SCHOOL_MAX_STUDENT_COUNT = 0;\n","import type { UserOverallPointsEntry } from \"../types/user\";\n\n/**\n * Spendable points for a user.\n *\n * `overallPoints` is an append-only ledger (one entry per award), so the total\n * is always the sum of every entry rather than a single stored number.\n *\n * Nullish ledgers and nullish entries are skipped, so a partially written\n * document cannot throw while the total is computed.\n */\nexport function sumUserOverallPoints(\n points: (UserOverallPointsEntry | null | undefined)[] | null | undefined,\n): number {\n return (points ?? []).reduce(\n (total, entry) => total + (entry?.points ?? 0),\n 0,\n );\n}\n","import dayjs from \"dayjs\";\n\nimport { EVENT_DATE_STATUS_LABELS } from \"src/utils/eventDateStatus\";\n\nimport { EnumEventDateStatus, EnumResourceType } from \"../enums\";\nimport type { DateTimeType, LocationType } from \"../types/global\";\nimport { dateFormat, formatDate, isoDateFormat } from \"../utils/date\";\n\nexport type CalendarSheetContentData = {\n dateTime: DateTimeType;\n location: LocationType;\n resourceId: string;\n resourceType: EnumResourceType;\n};\n\nexport type EventScheduleStatusTone =\n | \"started\"\n | \"startingSoon\"\n | \"upcoming\"\n | \"ended\"\n | \"canceled\"\n | \"rescheduled\"\n | \"invalid\"\n | \"default\";\n\nexport type EventScheduleStatusPresentation = {\n status: EnumEventDateStatus;\n statusLabel: string;\n tone: EventScheduleStatusTone;\n};\n\nexport function toCalendarIsoDate(startDate: string): string | null {\n const formatted = dayjs(startDate, dateFormat).format(isoDateFormat);\n\n return dayjs(formatted, isoDateFormat, true).isValid() ? formatted : null;\n}\n\nexport function fromCalendarIsoDate(isoDate: string): string {\n return dayjs(isoDate, isoDateFormat).format(dateFormat);\n}\n\nexport function getEventCalendarIsoDates(\n dateTimes: Array<{ startDate?: string | null }> | null | undefined,\n): string[] {\n return (\n dateTimes\n ?.map((dateTime) =>\n dateTime.startDate ? toCalendarIsoDate(dateTime.startDate) : null,\n )\n .filter((date): date is string => Boolean(date)) ?? []\n );\n}\n\nexport function findEventDateTimeByIsoDate(\n dateTimes: DateTimeType[] | null | undefined,\n isoDate: string,\n): DateTimeType | null {\n const selected = fromCalendarIsoDate(isoDate);\n\n return dateTimes?.find((dateTime) => dateTime.startDate === selected) ?? null;\n}\n\nexport function buildCalendarSheetContentData(\n dateTimes: DateTimeType[],\n isoDate: string,\n location: LocationType,\n resourceId: string,\n resourceType: EnumResourceType,\n): CalendarSheetContentData | null {\n const dateTime = findEventDateTimeByIsoDate(dateTimes, isoDate);\n\n if (!dateTime) {\n return null;\n }\n\n return {\n dateTime,\n location,\n resourceId,\n resourceType,\n };\n}\n\nexport function getEventScheduleStatusTone(\n status: EnumEventDateStatus,\n): EventScheduleStatusTone {\n switch (status) {\n case EnumEventDateStatus.STARTED:\n return \"started\";\n case EnumEventDateStatus.STARTING_SOON:\n return \"startingSoon\";\n case EnumEventDateStatus.TODAY:\n case EnumEventDateStatus.TOMORROW:\n case EnumEventDateStatus.THIS_WEEK:\n case EnumEventDateStatus.NEXT_WEEK:\n case EnumEventDateStatus.UPCOMING:\n return \"upcoming\";\n case EnumEventDateStatus.ENDED:\n return \"ended\";\n case EnumEventDateStatus.CANCELED:\n return \"canceled\";\n case EnumEventDateStatus.RE_SCHEDULED:\n return \"rescheduled\";\n case EnumEventDateStatus.INVALID:\n return \"invalid\";\n default:\n return \"default\";\n }\n}\n\nexport function getEventScheduleStatusPresentation(\n dateTime: DateTimeType,\n): EventScheduleStatusPresentation {\n return {\n status: dateTime.dateStatus,\n statusLabel: EVENT_DATE_STATUS_LABELS[dateTime.dateStatus],\n tone: getEventScheduleStatusTone(dateTime.dateStatus),\n };\n}\n\nexport function getEventScheduleStatusLabel(\n dateTime: DateTimeType,\n): string | null {\n const { dateStatus: status } = dateTime;\n\n if (!status) {\n return null;\n }\n\n return EVENT_DATE_STATUS_LABELS[status];\n}\n\nexport function shouldShowEventActionsWithWeather(\n resourceType: EnumResourceType,\n dateTime: DateTimeType,\n location: LocationType | null | undefined,\n): boolean {\n return (\n resourceType === EnumResourceType.EVENT &&\n Boolean(location) &&\n Boolean(dateTime?.dateStatus) &&\n ![EnumEventDateStatus.ENDED, EnumEventDateStatus.CANCELED].includes(\n dateTime.dateStatus,\n )\n );\n}\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const clothingAndFashion: Category[] = [\n {\n id: \"clothing-fashion\",\n name: \"Clothing & Fashion\",\n description:\n \"New, handmade, or upcycled clothing and accessories with a creative twist.\",\n subcategories: [\n {\n id: \"apparel-babywear\",\n name: \"Apparel & Babywear\",\n items: [\n {\n id: \"apparel\",\n name: \"Apparel\",\n description: \"Dresses, t-shirts, jumpers, rompers, sets, kidswear.\",\n },\n {\n id: \"baby-toddler-apparel\",\n name: \"Baby & Toddler Apparel\",\n description:\n \"Handmade baby clothes, soft shoes, bibs, hats, knitted sets.\",\n },\n {\n id: \"upcycled-fashion\",\n name: \"Upcycled Fashion\",\n description:\n \"Reworked garments, patchwork pieces, restyled vintage.\",\n },\n {\n id: \"other-wearable-items\",\n name: \"Other wearable items\",\n description: \"Unique clothing not listed above.\",\n },\n ],\n },\n {\n id: \"fashion-accessories\",\n name: \"Fashion Accessories\",\n items: [\n {\n id: \"accessories\",\n name: \"Accessories\",\n description: \"Scarves, belts, gloves, hats, headbands, caps.\",\n },\n {\n id: \"shoes\",\n name: \"Shoes\",\n description: \"Handmade shoes, baby booties, sandals, slippers.\",\n },\n {\n id: \"bags-wallets\",\n name: \"Bags & Wallets\",\n description:\n \"Leather bags, fabric purses, wallets, backpacks, totes.\",\n },\n {\n id: \"other-accessories\",\n name: \"Other accessories\",\n description: \"Brooches, pins, or hybrid functional items.\",\n },\n ],\n },\n {\n id: \"jewelry-creative-wearables\",\n name: \"Jewelry & Creative Wearables\",\n items: [\n {\n id: \"jewelry\",\n name: \"Jewelry\",\n description: \"Necklaces, earrings, bracelets, rings, anklets.\",\n },\n {\n id: \"other-creative-wearables\",\n name: \"Other creative wearables\",\n description:\n \"Wearable art, statement pieces, bold handmade designs.\",\n },\n ],\n },\n {\n id: \"traditional-cultural-clothing-accessories\",\n name: \"Traditional & Cultural Clothing and Accessories\",\n items: [\n {\n id: \"traditional-clothing-accessories\",\n name: \"Traditional Clothing & Accessories \",\n description:\n \"raditional clothing, jewellery, accessories and footwear from around the world, including both handmade and non-handmade items.\",\n },\n {\n id: \"other-traditional-cultural-items\",\n name: \"Other Traditional & Cultural Items\",\n description:\n \"traditional or culturally inspired wearables and decorative cultural pieces such as plates, table linens and similar items.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const electronicsAndTechnology: Category[] = [\n {\n id: \"electronics-technology\",\n name: \"Electronics & Technology\",\n description:\n \"New, second-hand, or handmade tech and digital items commonly found at markets.\",\n subcategories: [\n {\n id: \"mobile-everyday-tech\",\n name: \"Mobile & Everyday Tech\",\n items: [\n {\n id: \"mobile-phone-accessories\",\n name: \"Mobile & Phone Accessories\",\n description:\n \"Phone cases, holders, screen protectors, charging cables, power banks, grips.\",\n },\n {\n id: \"other-mobile-gadgets\",\n name: \"Other mobile gadgets\",\n description:\n \"Stands, styluses, SIM tools, cleaning kits, wallet accessories.\",\n },\n ],\n },\n {\n id: \"audio-music-creative-tech\",\n name: \"Audio, Music & Creative Tech\",\n items: [\n {\n id: \"audio-music-tech\",\n name: \"Audio & Music Tech\",\n description:\n \"Portable speakers, headphones, mini radios, Bluetooth adapters, sound accessories.\",\n },\n {\n id: \"instruments-music-gear\",\n name: \"Instruments & Music Gear\",\n description:\n \"Small electronic instruments, DIY synth kits, drum pads, loop machines.\",\n },\n {\n id: \"recording-creative-devices\",\n name: \"Recording & Creative Devices\",\n description:\n \"USB microphones, podcast tools, voice recorders, mobile lighting, content tools.\",\n },\n {\n id: \"other-audio-music-items\",\n name: \"Other audio or music-related items\",\n description: \"Musical gadgets or creative gear not listed above.\",\n },\n ],\n },\n {\n id: \"diy-gadgets-secondhand-finds\",\n name: \"DIY, Gadgets & Second-Hand Finds\",\n items: [\n {\n id: \"diy-electronics-tools\",\n name: \"DIY Electronics & Tools\",\n description:\n \"LED lights, USB gadgets, circuit boards, repair kits, tech-themed toys, novelty items.\",\n },\n {\n id: \"other-tech-finds\",\n name: \"Other Tech Finds\",\n description:\n \"Used electronics, smart gadgets, wearable tech, calculators, tablet stands, e-waste upcycles.\",\n },\n {\n id: \"other-technology-innovation-items\",\n name: \"Other technology or innovation-related items\",\n description: \"Anything not covered but clearly tech-driven.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const foodAndBeverages: Category[] = [\n {\n id: \"food-beverages\",\n name: \"Food & Beverages\",\n description:\n \"Fresh produce, drinks, sweet and savoury street food, ready-to-eat meals, and packaged goods.\",\n subcategories: [\n {\n id: \"fresh-food-groceries\",\n name: \"Fresh Food & Groceries\",\n items: [\n {\n id: \"fruits-vegetables\",\n name: \"Fruits & Vegetables\",\n description:\n \"Fresh seasonal fruit, organic vegetables, specialty produce, berries, tropical fruit, heritage varieties.\",\n },\n {\n id: \"meat-seafood\",\n name: \"Meat & Seafood\",\n description:\n \"Butcher cuts, fresh fish, smoked meats, sausages, seafood platters, artisanal jerky.\",\n },\n {\n id: \"dairy-eggs\",\n name: \"Dairy & Eggs\",\n description:\n \"Farm eggs, handmade cheeses, yoghurt, fresh milk, goat’s milk products.\",\n },\n {\n id: \"bakery-pastries\",\n name: \"Bakery & Pastries\",\n description:\n \"Freshly baked bread, sourdough, bagels, croissants, focaccia, traditional baked goods.\",\n },\n {\n id: \"spices-condiments\",\n name: \"Spices & Condiments\",\n description:\n \"Dried herbs, spice blends, specialty salts, hot sauces, infused oils, chutneys.\",\n },\n {\n id: \"packaged-specialty-foods\",\n name: \"Packaged & Specialty Foods\",\n description:\n \"Honey, jams, preserves, pickles, nut butters, sauces, pre-packaged snacks.\",\n },\n {\n id: \"other-fresh-food-items\",\n name: \"Other fresh food items\",\n description:\n \"Items that don’t fit above, e.g. fermented foods, plant-based substitutes.\",\n },\n ],\n },\n {\n id: \"beverages-specialty-drinks\",\n name: \"Beverages & Specialty Drinks\",\n items: [\n {\n id: \"fresh-juices-smoothies\",\n name: \"Fresh Juices & Smoothies\",\n description:\n \"Cold-pressed juices, detox blends, fruit smoothies, tropical mixes.\",\n },\n {\n id: \"coffee-teas\",\n name: \"Coffee & Teas\",\n description:\n \"Espresso, pour-over coffee, herbal teas, matcha, bubble tea, locally blended tea.\",\n },\n {\n id: \"dairy-plant-based-drinks\",\n name: \"Dairy & Plant-Based Drinks\",\n description:\n \"Milkshakes, lassis, almond/oat milk drinks, coconut water.\",\n },\n {\n id: \"alcoholic-beverages\",\n name: \"Alcoholic Beverages\",\n description:\n \"Local wines, craft beer, mead, cider, infused spirits, cocktail kits.\",\n },\n {\n id: \"other-beverages\",\n name: \"Other beverages\",\n description:\n \"Kombucha, kefir, energy drinks, non-alcoholic wines or beers.\",\n },\n ],\n },\n {\n id: \"savoury-prepared-foods-street-food\",\n name: \"Savoury Prepared Foods & Street Food\",\n items: [\n {\n id: \"local-specialties\",\n name: \"Local Specialties\",\n description:\n \"Meat pies, hangi, seafood chowder, fry bread, traditional NZ dishes.\",\n },\n {\n id: \"asian-cuisine\",\n name: \"Asian Cuisine\",\n description:\n \"Sushi, bao buns, dumplings, ramen, satay, spring rolls, fried rice.\",\n },\n {\n id: \"mediterranean-cuisine\",\n name: \"Mediterranean Cuisine\",\n description: \"Falafel, hummus wraps, souvlaki, Greek salad, dolma.\",\n },\n {\n id: \"italian-delights\",\n name: \"Italian Delights\",\n description: \"Pizza, calzone, focaccia, fresh pasta, arancini.\",\n },\n {\n id: \"bbq-grilled-foods\",\n name: \"BBQ & Grilled Foods\",\n description: \"Kebabs, grilled chicken, ribs, burgers, sausages.\",\n },\n {\n id: \"savoury-crepes-pancakes\",\n name: \"Savoury Crepes & Pancakes\",\n description: \"Filled savoury crepes, mini savoury pancakes.\",\n },\n {\n id: \"savoury-baked-goods-pastries\",\n name: \"Savoury Baked Goods & Pastries\",\n description:\n \"Quiches, savoury muffins, filled savoury pastries, empanadas.\",\n },\n {\n id: \"vegan-vegetarian-dishes\",\n name: \"Vegan & Vegetarian Dishes\",\n description:\n \"Buddha bowls, plant-based burgers, salads, vegan sushi.\",\n },\n {\n id: \"other-savoury-foods\",\n name: \"Other Savoury Foods\",\n description: \"Fusion dishes, mixed platters, savoury meal kits.\",\n },\n ],\n },\n {\n id: \"sweet-prepared-foods\",\n name: \"Sweet Prepared Foods\",\n items: [\n {\n id: \"sweet-crepes-pancakes-fried-treats\",\n name: \"Sweet Crepes, Pancakes & Fried Treats\",\n description: \"Crepes, waffles, mini pancakes, muffins, doughnuts.\",\n },\n {\n id: \"sweet-baked-goods-desserts\",\n name: \"Sweet Baked Goods & Desserts\",\n description: \"Cakes, pastries, slices, trifles, layered desserts.\",\n },\n {\n id: \"fruit-based-snacks\",\n name: \"Fruit-Based Snacks\",\n description:\n \"Fruit skewers, dried fruit packs, chocolate-dipped fruit.\",\n },\n {\n id: \"candy-confectionery\",\n name: \"Candy & Confectionery\",\n description: \"Fudge, handmade candies, toffee, nougat, brittle.\",\n },\n {\n id: \"other-sweet-foods\",\n name: \"Other Sweet Foods\",\n description: \"Fusion desserts, sweet platters, sweet meal kits.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const handmadeAndLocalProducts: Category[] = [\n {\n id: \"handmade-local-products\",\n name: \"Handmade & Local Products\",\n description: \"Unique, handmade, or locally produced artisan goods.\",\n subcategories: [\n {\n id: \"home-living\",\n name: \"Home & Living\",\n items: [\n {\n id: \"ceramics-pottery\",\n name: \"Ceramics & Pottery\",\n description:\n \"Handmade mugs, vases, bowls, decorative plates, plant pots.\",\n },\n {\n id: \"candles-home-scents\",\n name: \"Candles & Home Scents\",\n description:\n \"Soy candles, beeswax candles, wax melts, incense sticks, room sprays and herbal sachets.\",\n },\n {\n id: \"botanical-crafts\",\n name: \"Botanical Crafts\",\n description: \"Dried-flower décor and pressed-flower crafts\",\n },\n {\n id: \"textiles-embroidery\",\n name: \"Textiles & Embroidery\",\n description:\n \"Handsewn items, embroidered napkins, home linens, aprons, fabric gift wraps, handmade fabric bags, quilted goods, personalized textile gifts.\",\n },\n {\n id: \"woodcraft-metalcraft\",\n name: \"Woodcraft & Metalcraft\",\n description:\n \"Wooden boards, handmade frames, sculptures, metal signs, furniture.\",\n },\n {\n id: \"handmade-soaps-natural-body-goods\",\n name: \"Handmade Soaps & Natural Body Goods\",\n description: \"Handmade soaps, balms, oils, bath items\",\n },\n {\n id: \"seasonal-festive-crafts\",\n name: \"Seasonal & Festive Crafts\",\n description: \"Christmas, Easter and seasonal handmade decor\",\n },\n {\n id: \"other-home-living-products\",\n name: \"Other home & living products\",\n description:\n \"Items that don't fit above but serve home-related purposes.\",\n },\n ],\n },\n {\n id: \"art-personal-expression\",\n name: \"Art & Personal Expression\",\n items: [\n {\n id: \"paintings-illustrations\",\n name: \"Paintings & Illustrations\",\n description:\n \"Paintings, canvas art, hand-drawn illustrations, digital prints, graphic art and calligraphy pieces.\",\n },\n {\n id: \"sculptures-carvings\",\n name: \"Sculptures & Carvings \",\n description:\n \"Sculptures made from wood, stone, metal, clay or resin, carved decorative pieces and artistic 3D works.\",\n },\n {\n id: \"creative-handmade-alternative-art\",\n name: \"Creative Handmade & Alternative Art\",\n description:\n \"Handmade textile décor, fabric ornaments, mixed-media art, creative craft pieces and modern handmade artworks.\",\n },\n {\n id: \"handmade-mini-figures-decor\",\n name: \"Handmade Mini Figures & Décor\",\n description:\n \"Small handmade figures, tiny houses and crafted mini decorative items.\",\n },\n {\n id: \"other-artistic-expressive-products\",\n name: \"Other Artistic or Expressive Products\",\n description:\n \"Custom artworks, specialty handmade décor, unique crafts.\",\n },\n ],\n },\n {\n id: \"handmade-jewellery-accessories-cultural-crafts\",\n name: \"Handmade Jewellery, Accessories & Cultural Crafts\",\n items: [\n {\n id: \"jewellery-handmade-items-nz-traditional-materials\",\n name: \"Jewellery & Handmade Items from NZ Traditional Materials\",\n description:\n \"Handmade jewellery and decorative or functional items crafted from pounamu, bone, wood and other traditional New Zealand materials.\",\n },\n {\n id: \"maori-pasifika-cultural-crafts-clothing\",\n name: \"Māori & Pasifika Cultural Crafts and Clothing\",\n description:\n \"Culturally inspired handmade items, accessories and garments featuring Māori or Pasifika motifs, traditional patterns and regional craftsmanship.\",\n },\n {\n id: \"traditional-handmade-clothing-jewellery-crafts-global-cultures\",\n name: \"Traditional Handmade Clothing, Jewellery & Crafts from Global Cultures\",\n description:\n \"Handcrafted clothing, jewellery and cultural items from diverse traditions — including Asian, African, European, Middle Eastern, Indian, Chinese, Japanese, Pacific, and other culturally significant handmade pieces.\",\n },\n {\n id: \"other-handmade-cultural-items\",\n name: \"Other Handmade Cultural Items\",\n description:\n \"Unique or culturally inspired handmade pieces not specifically covered in the categories above.\",\n },\n ],\n },\n {\n id: \"gift-ideas-accessories\",\n name: \"Gift Ideas & Accessories\",\n items: [\n {\n id: \"handmade-pens-keychains-fridge-magnets\",\n name: \"Handmade Pens, Keychains and Fridge Magnets\",\n description: null,\n },\n {\n id: \"gift-packaging-wrapping-accessories\",\n name: \"Gift Packaging & Wrapping Accessories\",\n description: null,\n },\n {\n id: \"handmade-crochet-knitting-fibre-crafts\",\n name: \"Handmade Crochet, Knitting & Fibre Crafts\",\n description:\n \"Handmade crochet and knitted items, fabric-based crafts, small decorative pieces, creative fibre artworks and unique handcrafted accessories.\",\n },\n {\n id: \"handmade-toys-mini-play-items\",\n name: \"Handmade Toys & Mini Play Items\",\n description:\n \"small handmade toys, soft toys, wooden miniatures, crochet or felt play pieces\",\n },\n {\n id: \"other-small-handmade-gifts-accessories\",\n name: \"Other small handmade gifts or accessories\",\n description: \"Compact creative items made to surprise or delight.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const healthAndWellness: Category[] = [\n {\n id: \"health-wellness\",\n name: \"Health & Wellness\",\n description:\n \"Natural products and services that promote wellbeing, body care, and holistic health.\",\n subcategories: [\n {\n id: \"body-skincare\",\n name: \"Body & Skincare\",\n items: [\n {\n id: \"skincare-body-products\",\n name: \"Skincare & Body Products\",\n description:\n \"Soaps, creams, lip balms, bath salts, bath bombs, body oils, natural deodorants.\",\n },\n {\n id: \"other-body-care-items\",\n name: \"Other body care items\",\n description:\n \"Additional handmade or eco-conscious personal care goods.\",\n },\n ],\n },\n {\n id: \"aromatherapy-herbal-wellness\",\n name: \"Aromatherapy & Herbal Wellness\",\n items: [\n {\n id: \"aromatherapy-herbal-remedies\",\n name: \"Aromatherapy & Herbal Remedies\",\n description:\n \"Essential oils, herbal balms, massage oils, salves, natural teas, rollers.\",\n },\n {\n id: \"other-herbal-aroma-products\",\n name: \"Other herbal or aroma-based products\",\n description: \"Wellness blends, herb sachets, custom infusions.\",\n },\n ],\n },\n {\n id: \"wellness-tools-accessories\",\n name: \"Wellness Tools & Accessories\",\n items: [\n {\n id: \"wellness-accessories\",\n name: \"Wellness Accessories\",\n description:\n \"Yoga mats, meditation cushions, eye pillows, incense, smudging sticks, eco water bottles, wellness journals.\",\n },\n {\n id: \"spiritual-tools-crystals\",\n name: \"Spiritual Tools & Crystals\",\n description:\n \"Healing crystals, gemstone bracelets, pendulums, sprays, spiritual kits, altar decor.\",\n },\n {\n id: \"other-wellness-spiritual-items\",\n name: \"Other wellness or spiritual items\",\n description: \"Items that aid relaxation, focus, or inner work.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const homeGardenHousehold: Category[] = [\n {\n id: \"home-garden-household-goods\",\n name: \"Home, Garden & Household Goods\",\n description:\n \"Functional, decorative, and eco-conscious products designed for everyday use indoors and outdoors.\",\n subcategories: [\n {\n id: \"home-decor-living\",\n name: \"Home Decor & Living\",\n items: [\n {\n id: \"home-decor\",\n name: \"Home Decor\",\n description:\n \"Cushions, wall art, table runners, vases, trays, mirrors, handmade centerpieces.\",\n },\n {\n id: \"kitchenware-dining\",\n name: \"Kitchenware & Dining\",\n description:\n \"Mugs, bowls, cutting boards, utensils, jars, coasters, kitchen textiles.\",\n },\n {\n id: \"mini-figures-decor\",\n name: \"Mini Figures & Décor\",\n description:\n \"handmade or non-handmade small figures, tiny houses and miniature decorative items.\",\n },\n {\n id: \"other-indoor-home-items\",\n name: \"Other indoor home items\",\n description:\n \"Any decorative or practical household items not listed above.\",\n },\n ],\n },\n {\n id: \"cleaning-eco-essentials\",\n name: \"Cleaning & Eco Essentials\",\n items: [\n {\n id: \"cleaning-eco-supplies\",\n name: \"Cleaning & Eco Supplies\",\n description:\n \"Beeswax wraps, reusable cloths, brushes, natural soaps, detergent bars, eco sponges.\",\n },\n {\n id: \"other-eco-cleaning-items\",\n name: \"Other eco or cleaning items\",\n description: \"Environmentally friendly goods not listed above.\",\n },\n ],\n },\n {\n id: \"garden-outdoor-living\",\n name: \"Garden & Outdoor Living\",\n items: [\n {\n id: \"plants-botanical-decor\",\n name: \"Plants & Botanical Decor\",\n description:\n \"Potted herbs, succulents, dried flowers, terrariums, plant-based ornaments.\",\n },\n {\n id: \"fresh-flowers-botanical-bouquets\",\n name: \"Fresh Flowers & Botanical Bouquets\",\n description:\n \"Cut flowers, seasonal bouquets, simple floral arrangements, native flower selections, and other fresh botanical items.\",\n },\n {\n id: \"natural-decor-nature-inspired-elements\",\n name: \"Natural Decor & Nature-Inspired Elements\",\n description:\n \"Seashell décor, driftwood pieces, sand ornaments, natural wood accents, stone or mineral decorations, and other nature-based decorative items.\",\n },\n {\n id: \"garden-tools-outdoor-items\",\n name: \"Garden Tools & Outdoor Items\",\n description:\n \"Plant markers, garden signs, stakes, small tools, wind chimes, gifts.\",\n },\n {\n id: \"other-outdoor-garden-products\",\n name: \"Other outdoor or garden products\",\n description: \"Functional or decorative items for outside use.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const petProductsAndAnimalGoods: Category[] = [\n {\n id: \"pet-products-animal-goods\",\n name: \"Pet Products & Animal Goods\",\n description: \"Items for pets, pet lovers, or animal-themed market stalls.\",\n subcategories: [\n {\n id: \"products-for-pets\",\n name: \"Products for Pets\",\n items: [\n {\n id: \"pet-food-treats\",\n name: \"Pet Food & Treats\",\n description:\n \"Homemade dog biscuits, cat snacks, natural chews, pet-safe cakes, training treats.\",\n },\n {\n id: \"apparel-toys-accessories\",\n name: \"Apparel, Toys & Accessories\",\n description:\n \"Leashes, collars, harnesses, toys, grooming tools, beds, travel gear, jumpers, bandanas.\",\n },\n {\n id: \"other-pet-products\",\n name: \"Other pet products\",\n description: \"Any pet-related items not listed above.\",\n },\n ],\n },\n {\n id: \"small-pets-birds-exotic-animals\",\n name: \"Small Pets, Birds & Exotic Animals\",\n items: [\n {\n id: \"products-small-pets-birds-exotics\",\n name: \"Products for Small Pets, Birds & Exotics\",\n description:\n \"Toys, enclosures, perches, feeding bowls, bedding, habitat decor, transport gear, and care items for birds, rabbits, hamsters, reptiles, turtles, aquarium pets, and other exotic species.\",\n },\n {\n id: \"other-small-exotic-animal-items\",\n name: \"Other small or exotic animal items\",\n description: \"Unusual accessories for non-mainstream pets.\",\n },\n ],\n },\n {\n id: \"farm-working-animals\",\n name: \"Farm & Working Animals\",\n items: [\n {\n id: \"goods-for-farm-working-animals\",\n name: \"Goods for Farm & Working Animals\",\n description:\n \"Treats, care products, equipment, signage and accessories for chickens, goats, alpacas, horses, and other livestock.\",\n },\n {\n id: \"other-farm-animal-items\",\n name: \"Other farm animal-related items\",\n description:\n \"Rural, barnyard, or utility-specific gear not listed above.\",\n },\n ],\n },\n {\n id: \"animal-themed-gifts-custom-items\",\n name: \"Animal-Themed Gifts & Custom Items\",\n items: [\n {\n id: \"pet-art-custom-gifts\",\n name: \"Pet Art & Custom Gifts\",\n description:\n \"Pet portraits, name tags, personalized bowls, breed-specific items, pet-themed home decor and stationery.\",\n },\n {\n id: \"other-animal-themed-gifts\",\n name: \"Other animal-themed gifts\",\n description:\n \"Artistic or sentimental items made for animal lovers.\",\n },\n ],\n },\n ],\n },\n];\n","import { Category } from \"src/types\";\n\n/* eslint-disable sort-keys */\nexport const serviceAndExperience: Category[] = [\n {\n id: \"services-experiences\",\n name: \"Services & Experiences\",\n description:\n \"On-site offerings that provide entertainment, personal care, learning, or interactive activities beyond products.\",\n subcategories: [\n {\n id: \"personal-care-body-art\",\n name: \"Personal Care & Body Art\",\n items: [\n {\n id: \"nails-handcare\",\n name: \"Nails & Handcare\",\n description:\n \"Nail painting, decoration, quick manicures, temporary nail extensions.\",\n },\n {\n id: \"hair-styling-braiding\",\n name: \"Hair Styling & Braiding\",\n description:\n \"Hair braiding, plaits, child-friendly festival hairstyles.\",\n },\n {\n id: \"face-body-decoration\",\n name: \"Face & Body Decoration\",\n description:\n \"Henna, glitter tattoos, face painting, light makeup, eyelash styling, professional tattooing (where permitted).\",\n },\n {\n id: \"other-beauty-grooming-services\",\n name: \"Other beauty or grooming services\",\n description: \"Small-scale personal care options offered on-site.\",\n },\n ],\n },\n {\n id: \"practical-wellness-services\",\n name: \"Practical & Wellness Services\",\n items: [\n {\n id: \"mobile-practical-services\",\n name: \"Mobile & Practical Services\",\n description:\n \"Shoe repair, phone repairs, knife sharpening, key cutting, battery replacement, bike repairs, engraving.\",\n },\n {\n id: \"wellness-alternative-therapies\",\n name: \"Wellness & Alternative Therapies\",\n description:\n \"Massage, aromatherapy, reflexology, energy healing (e.g. Reiki), natural consultations.\",\n },\n {\n id: \"other-service-based-offerings\",\n name: \"Other service-based offerings\",\n description: \"Wellness or functional services not listed above.\",\n },\n ],\n },\n {\n id: \"creative-educational-experiences\",\n name: \"Creative & Educational Experiences\",\n items: [\n {\n id: \"creative-workshops-maker-services\",\n name: \"Creative Workshops & Maker Services\",\n description:\n \"Candle making, pottery, jewelry crafting, soap or balm workshops, calligraphy, seasonal crafts.\",\n },\n {\n id: \"education-awareness-stalls\",\n name: \"Education & Awareness Stalls\",\n description:\n \"Eco awareness, cultural storytelling, local history, first aid demos, health booths, sustainability education, kids’ science displays.\",\n },\n {\n id: \"other-creative-educational-services\",\n name: \"Other creative or educational services\",\n description:\n \"Informal learning, demonstrations, or community-focused sessions.\",\n },\n ],\n },\n {\n id: \"kids-activities-family-fun\",\n name: \"Kids’ Activities & Family Fun\",\n items: [\n {\n id: \"kids-activities-fun\",\n name: \"Kids’ Activities & Fun\",\n description:\n \"Face painting, glitter tattoos, pony rides, bouncy castles, small amusement rides, balloon twisting, animal petting zones.\",\n },\n {\n id: \"other-family-oriented-activities\",\n name: \"Other family-oriented activities\",\n description:\n \"On-site entertainment that engages children or family groups.\",\n },\n ],\n },\n ],\n },\n];\n","import { Category } from \"src/types\";\n\n/* eslint-disable sort-keys */\nexport const toysChildren: Category[] = [\n {\n id: \"toys-childrens-items\",\n name: \"Toys & Children’s Items\",\n description: \"Products and services made for or inspired by children.\",\n subcategories: [\n {\n id: \"toys-playthings\",\n name: \"Toys & Playthings\",\n items: [\n {\n id: \"toys-classic-electric-character\",\n name: \"Toys – Classic, Electric & Character-Based\",\n description:\n \"Building blocks, dolls, puzzles, plush animals, toy vehicles, remote-control toys, light-up gadgets, character figurines, themed playsets.\",\n },\n {\n id: \"handmade-toys-crafty-playthings\",\n name: \"Handmade Toys & Crafty Playthings\",\n description:\n \"Wooden puzzles, crocheted animals, felt toys, fabric dolls, DIY kits, nature-inspired games, sensory toys.\",\n },\n {\n id: \"other-play-items\",\n name: \"Other play items\",\n description:\n \"Toys not listed above, including limited-edition or hybrid items.\",\n },\n ],\n },\n {\n id: \"educational-developmental\",\n name: \"Educational & Developmental\",\n items: [\n {\n id: \"educational-developmental-tools\",\n name: \"Educational & Developmental Tools\",\n description:\n \"STEM kits, Montessori toys, storybooks, picture books, flashcards, early learning games, language tools.\",\n },\n {\n id: \"other-educational-experience-based-items\",\n name: \"Other educational or experience-based items\",\n description:\n \"Creative experiences or learning aids not listed above.\",\n },\n ],\n },\n {\n id: \"baby-kidswear-accessories\",\n name: \"Baby & Kidswear + Accessories\",\n items: [\n {\n id: \"baby-kidswear-accessories\",\n name: \"Baby & Kidswear + Accessories\",\n description:\n \"Handmade baby clothes, toddler outfits, bibs, hats, headbands, bags, pacifier clips, soft shoes.\",\n },\n {\n id: \"baby-developmental-soft-toys\",\n name: \"Baby Developmental Soft Toys\",\n description:\n \"Sensory toys, rattles, fabric books, teething items, high-contrast cards, and early-skill. Montessori materials designed to support infants’ cognitive and motor development.\",\n },\n {\n id: \"other-childrens-clothing-accessories\",\n name: \"Other children’s clothing or accessories\",\n description: \"Unique fashion or functional pieces for kids.\",\n },\n ],\n },\n ],\n },\n];\n","/* eslint-disable sort-keys */\nimport { Category } from \"src/types\";\n\nexport const vintageAndAntique: Category[] = [\n {\n id: \"vintage-antique\",\n name: \"Vintage & Antique\",\n description:\n \"Unique, historic, or nostalgic items with collectible or decorative value.\",\n subcategories: [\n {\n id: \"vintage-antique-clothing-accessories\",\n name: \"Vintage & Antique Clothing & Accessories\",\n items: [\n {\n id: \"clothing-vintage-fashion\",\n name: \"Clothing and wearable items from past eras\",\n description:\n \"Vintage dresses, jackets, hats, gloves, belts, bags, shoes, jewellery.\",\n },\n {\n id: \"other-clothing-accessory-items\",\n name: \"Other clothing-related items\",\n description:\n \"Hair clips, brooches, pins, scarf rings, small fashion accessories.\",\n },\n ],\n },\n {\n id: \"collectibles-memorabilia\",\n name: \"Collectibles & Memorabilia\",\n items: [\n {\n id: \"small-collectible-items\",\n name: \"Small collectible items with historical or nostalgic significance\",\n description:\n \"Coins, stamps, toys, postcards, comics, sports cards, vintage packaging.\",\n },\n {\n id: \"other-collectible-items\",\n name: \"Other collectible items\",\n description:\n \"Rare small objects, miniature figurines, special-edition items.\",\n },\n ],\n },\n {\n id: \"homewares-decor-curiosities\",\n name: \"Homewares, Decor & Curiosities\",\n items: [\n {\n id: \"decorative-functional-vintage-items\",\n name: \"Decorative or functional items with a vintage or antique aesthetic\",\n description:\n \"Teacups, plates, vases, mirrors, clocks, furniture, old tools, lanterns, typewriters, curiosities.\",\n },\n {\n id: \"handmade-vintage-art\",\n name: \"Handmade vintage art\",\n description: \"Paintings, sculptures, crafted pieces.\",\n },\n {\n id: \"other-home-decor-items\",\n name: \"Other home or decor items\",\n description:\n \"Decorative pieces not listed above, unique household objects.\",\n },\n ],\n },\n {\n id: \"vintage-media-printed-nostalgia\",\n name: \"Vintage Media & Printed Nostalgia\",\n items: [\n {\n id: \"older-media-printed-works\",\n name: \"Older media formats and printed works\",\n description:\n \"Vinyl records, cassette tapes, CDs, DVDs, books, magazines, board games, posters.\",\n },\n {\n id: \"other-media-printed-items\",\n name: \"Other media or printed items\",\n description: \"Maps, manuals, leaflets, out-of-print materials.\",\n },\n ],\n },\n {\n id: \"other-vintage-antique-items\",\n name: \"Other Vintage & Antique Items\",\n items: [\n {\n id: \"any-vintage-antique-items-not-listed\",\n name: \"Any vintage or antique items not listed above\",\n description: \"Unique, rare or uncategorised pieces.\",\n },\n ],\n },\n ],\n },\n];\n","import { Category, CategoryColorType } from \"../../types/global\";\n\nimport { clothingAndFashion } from \"./clothingAndFashion\";\nimport { electronicsAndTechnology } from \"./electronicsAndTechnology\";\nimport { foodAndBeverages } from \"./foodAndBeverages\";\nimport { handmadeAndLocalProducts } from \"./handmadeAndLocalProducts\";\nimport { healthAndWellness } from \"./healthAndWellness\";\nimport { homeGardenHousehold } from \"./homeGardenHousehold\";\nimport { petProductsAndAnimalGoods } from \"./petProductsAndAnimalGoods\";\nimport { serviceAndExperience } from \"./serviceAndExperience\";\nimport { toysChildren } from \"./toysChildren\";\nimport { vintageAndAntique } from \"./vintageAndAntique\";\n\nexport const categoryColors: Record<string, CategoryColorType> = {\n \"clothing-fashion\": {\n primary: \"#9D4EDD\",\n secondary: \"#fff\",\n },\n \"electronics-technology\": {\n primary: \"#3AF3FF\",\n secondary: \"#000\",\n },\n \"food-beverages\": {\n primary: \"#FF0D1F\",\n secondary: \"#fff\",\n },\n \"handmade-local-products\": {\n primary: \"#EE7E54\",\n secondary: \"#fff\",\n },\n \"health-wellness\": {\n primary: \"#E23794\",\n secondary: \"#fff\",\n },\n \"home-garden-household-goods\": {\n primary: \"#067325\",\n secondary: \"#fff\",\n },\n \"pet-products-animal-goods\": {\n primary: \"#68E788\",\n secondary: \"#000\",\n },\n \"services-experiences\": {\n primary: \"#2E16A5\",\n secondary: \"#fff\",\n },\n \"toys-childrens-items\": {\n primary: \"#FFF966\",\n secondary: \"#000\",\n },\n \"vintage-antique\": {\n primary: \"#8D6748\",\n secondary: \"#fff\",\n },\n};\n\nconst assignColorToCategories = (categories: Category[]): Category[] => {\n const result = categories.map((category) => ({\n ...category,\n color: categoryColors[category.id],\n }));\n return result;\n};\n\nexport const availableCategories = assignColorToCategories([\n ...foodAndBeverages,\n ...handmadeAndLocalProducts,\n ...clothingAndFashion,\n ...homeGardenHousehold,\n ...toysChildren,\n ...healthAndWellness,\n ...electronicsAndTechnology,\n ...vintageAndAntique,\n ...petProductsAndAnimalGoods,\n ...serviceAndExperience,\n]);\n","import { availableCategories } from \"../formFields/categories\";\nimport type { UnregisteredVendorType, VendorType } from \"../types/vendor\";\nimport { getUniqueStartDates } from \"../utils/date\";\n\ntype RelationType = NonNullable<VendorType[\"relations\"]>[number];\ntype RelationDateType = NonNullable<RelationType[\"relationDates\"]>[number];\n\nexport type StallholderFilterOption = {\n label: string;\n value: string;\n};\n\nexport function eventStartDatesSet(\n dateTime: Array<{ startDate?: string | null }> | undefined,\n): Set<string> {\n return new Set(\n (dateTime ?? [])\n .map((date) => date.startDate)\n .filter((date): date is string => Boolean(date)),\n );\n}\n\n/**\n * True when the vendor shares a start date with the event, **or** when\n * `eventStartDates` is empty (no dates to scope against).\n *\n * An empty set means the event payload has no dates (all archived, or a response\n * that has not been merged yet). The constraint is then skipped: the stallholder\n * list is already event-scoped, and intersecting against an empty set would\n * filter every vendor out and make the screen claim the event has no\n * stallholders.\n */\nexport function hasMatchingEventDate(\n vendorStartDates: string[],\n eventStartDates: Set<string>,\n): boolean {\n if (eventStartDates.size === 0) {\n return true;\n }\n\n return vendorStartDates.some((startDate) => eventStartDates.has(startDate));\n}\n\nexport function matchesSelectedDate(\n vendorStartDates: string[],\n selectedDate: string | null,\n): boolean {\n if (!selectedDate) {\n return true;\n }\n\n return vendorStartDates.includes(selectedDate);\n}\n\nexport function matchesCategory(\n categoryNames: string[],\n selectedCategory: string | null,\n): boolean {\n if (!selectedCategory) {\n return true;\n }\n\n return categoryNames.includes(selectedCategory);\n}\n\nexport function getRegisteredVendorStartDates(vendor: VendorType): string[] {\n const relations = vendor.relations ?? [];\n\n return relations.flatMap((relation) =>\n (relation.relationDates ?? [])\n .map((relationDate: RelationDateType) => relationDate.dateTime.startDate)\n .filter((date): date is string => Boolean(date)),\n );\n}\n\nexport function getRegisteredVendorCategoryNames(vendor: VendorType): string[] {\n return (vendor.categories ?? []).map((category) => category.name);\n}\n\nexport function getUnregisteredVendorStartDates(\n vendor: UnregisteredVendorType,\n): string[] {\n return (vendor.invitations ?? []).flatMap((invitation) =>\n invitation.dateTime\n .map((date) => date.startDate)\n .filter((date): date is string => Boolean(date)),\n );\n}\n\nexport function getUnregisteredVendorCategoryNames(\n vendor: UnregisteredVendorType,\n): string[] {\n return availableCategories\n .filter(\n (category) => category.id && vendor.categoryIds.includes(category.id),\n )\n .map((category) => category.name);\n}\n\nexport function filterRegisteredVendorsForEvent(\n vendors: VendorType[] | null | undefined,\n eventStartDates: Set<string>,\n selectedDate: string | null,\n selectedCategory: string | null,\n): VendorType[] {\n if (!vendors) {\n return [];\n }\n\n return vendors.filter((vendor) => {\n const startDates = getRegisteredVendorStartDates(vendor);\n\n return (\n hasMatchingEventDate(startDates, eventStartDates) &&\n matchesSelectedDate(startDates, selectedDate) &&\n matchesCategory(\n getRegisteredVendorCategoryNames(vendor),\n selectedCategory,\n )\n );\n });\n}\n\nexport function filterUnregisteredVendorsForEvent(\n vendors: UnregisteredVendorType[],\n eventStartDates: Set<string>,\n selectedDate: string | null,\n selectedCategory: string | null,\n): UnregisteredVendorType[] {\n return vendors.filter((vendor) => {\n const startDates = getUnregisteredVendorStartDates(vendor);\n\n return (\n hasMatchingEventDate(startDates, eventStartDates) &&\n matchesSelectedDate(startDates, selectedDate) &&\n matchesCategory(\n getUnregisteredVendorCategoryNames(vendor),\n selectedCategory,\n )\n );\n });\n}\n\nexport function filterRegisteredVendorsByEventDatesOnly(\n vendors: VendorType[] | null | undefined,\n eventStartDates: Set<string>,\n): VendorType[] {\n if (!vendors) {\n return [];\n }\n\n return vendors.filter((vendor) =>\n hasMatchingEventDate(\n getRegisteredVendorStartDates(vendor),\n eventStartDates,\n ),\n );\n}\n\nexport function filterUnregisteredVendorsByEventDatesOnly(\n vendors: UnregisteredVendorType[],\n eventStartDates: Set<string>,\n): UnregisteredVendorType[] {\n return vendors.filter((vendor) =>\n hasMatchingEventDate(\n getUnregisteredVendorStartDates(vendor),\n eventStartDates,\n ),\n );\n}\n\nexport function collectStallholderDateTimes(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): Array<{ startDate?: string; startTime?: string }> {\n return [\n ...registeredVendors.flatMap((vendor) =>\n (vendor.relations ?? []).flatMap((relation) =>\n (relation.relationDates ?? []).map(\n (relationDate: RelationDateType) => relationDate.dateTime,\n ),\n ),\n ),\n ...unregisteredVendors.flatMap((vendor) =>\n (vendor.invitations ?? []).flatMap((invitation) => invitation.dateTime),\n ),\n ];\n}\n\nexport function getUniqueStallholderStartDates(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): string[] {\n return getUniqueStartDates(\n collectStallholderDateTimes(registeredVendors, unregisteredVendors),\n );\n}\n\nexport function getStallholderCategoryNames(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): string[] {\n const names = [\n ...registeredVendors.flatMap(getRegisteredVendorCategoryNames),\n ...unregisteredVendors.flatMap(getUnregisteredVendorCategoryNames),\n ];\n\n return Array.from(new Set(names));\n}\n\nexport function getStallholderCategoryOptions(\n registeredVendors: VendorType[],\n unregisteredVendors: UnregisteredVendorType[] = [],\n): StallholderFilterOption[] {\n return getStallholderCategoryNames(\n registeredVendors,\n unregisteredVendors,\n ).map((name) => ({\n label: name,\n value: name,\n }));\n}\n\nexport function getEventStallholderEmptyMessage(\n hasAnyStallholdersForEvent: boolean,\n selectedDate: string | null,\n): string {\n return hasAnyStallholdersForEvent && selectedDate\n ? \"No stallholders found for this event date.\"\n : \"No stallholders found for this event.\";\n}\n","import type { StallholderFilterOption } from \"../eventStallholders/eventStallholderFilters\";\nimport type { EventListItemType } from \"../types/event\";\nimport type { DateTimeType } from \"../types/global\";\nimport { getUniqueStartDates } from \"../utils/date\";\n\ntype RelationType = NonNullable<EventListItemType[\"relations\"]>[number];\ntype RelationDateType = NonNullable<RelationType[\"relationDates\"]>[number];\n\nexport function relationHasSelectedDate(\n relation: RelationType,\n selectedDate: string,\n): boolean {\n return (\n relation.relationDates?.some(\n (date: RelationDateType) => date.dateTime.startDate === selectedDate,\n ) ?? false\n );\n}\n\nexport function eventHasSelectedDate(\n event: EventListItemType,\n selectedDate: string,\n): boolean {\n return (\n event.relations?.some((relation) =>\n relationHasSelectedDate(relation, selectedDate),\n ) ?? false\n );\n}\n\nexport function filterVendorEventsBySelectedDate(\n events: EventListItemType[] | null | undefined,\n selectedDate: string | null,\n): EventListItemType[] {\n if (!events) {\n return [];\n }\n\n if (!selectedDate) {\n return events;\n }\n\n return events.filter((event) => eventHasSelectedDate(event, selectedDate));\n}\n\nexport function collectVendorEventRelationDateTimes(\n events: EventListItemType[] | null | undefined,\n): DateTimeType[] {\n if (!events?.length) {\n return [];\n }\n\n return events.flatMap((event) =>\n (event.relations ?? []).flatMap((relation) =>\n (relation.relationDates ?? []).map(\n (relationDate) => relationDate.dateTime,\n ),\n ),\n );\n}\n\nexport function getVendorEventRelationStartDates(\n events: EventListItemType[] | null | undefined,\n): string[] {\n return getUniqueStartDates(collectVendorEventRelationDateTimes(events));\n}\n\nexport function getVendorEventRelationDateOptions(\n events: EventListItemType[] | null | undefined,\n): StallholderFilterOption[] {\n return getVendorEventRelationStartDates(events).map((startDate) => ({\n label: startDate,\n value: startDate,\n }));\n}\n\nexport function getVendorEventsEmptyMessage(\n hasAnyEventsForVendor = false,\n selectedDate: string | null = null,\n): string {\n return hasAnyEventsForVendor && selectedDate\n ? \"No events found for this date.\"\n : \"No events found.\";\n}\n","import {\n AffiliateRewardType,\n EnumAffiliateParticipantType,\n EnumAffiliateRewardType,\n} from \"src/types/affiliate\";\n\nexport const AFFILIATE_PARTICIPANT_TYPE_LABELS = {\n [EnumAffiliateParticipantType.INDIVIDUAL]: \"Individual\",\n [EnumAffiliateParticipantType.SOLE_TRADER]: \"Sole Trader\",\n [EnumAffiliateParticipantType.COMPANY]: \"Company\",\n} as const satisfies Record<EnumAffiliateParticipantType, string>;\n\ntype AffiliateRewardConfig = {\n description: string;\n value: number;\n};\n\nexport const AFFILIATE_REWARDS = {\n [EnumAffiliateRewardType.NEW_EVENT_REGISTRATION]: {\n description: \"10 points for new event registration (one-time reward)\",\n value: 10,\n },\n [EnumAffiliateRewardType.NEW_VENDOR_REGISTRATION]: {\n description: \"5 points for new vendor registration (one-time reward)\",\n value: 5,\n },\n [EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION]: {\n description: \"3 points for active vendor pro subscription (monthly reward)\",\n value: 3,\n },\n [EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION]: {\n description:\n \"1 point for active vendor standard subscription (monthly reward)\",\n value: 1,\n },\n [EnumAffiliateRewardType.ACTIVE_VENDOR_BONUS_REWARD]: {\n description:\n \"5 bonus points for every 10th active vendor (one-time reward)\",\n value: 5,\n },\n [EnumAffiliateRewardType.ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS]: {\n description:\n \"40 points for active event with vendor registrations (one-time reward)\",\n value: 40,\n },\n} satisfies Record<EnumAffiliateRewardType, AffiliateRewardConfig>;\n\n/**\n * Create an affiliate reward\n * @param rewardType - The type of reward\n * @param createdAt - The date the reward was received\n * @returns The affiliate reward\n * @example\n * const reward = createAffiliateReward(EnumAffiliateRewardType.NEW_EVENT_REGISTRATION, new Date());\n * console.log(reward);\n */\nexport function createAffiliateReward(\n rewardType: EnumAffiliateRewardType,\n createdAt: Date,\n): AffiliateRewardType {\n const reward = AFFILIATE_REWARDS[rewardType];\n\n return {\n createdAt,\n redeemedAt: null,\n rewardDescription: reward.description,\n rewardType,\n rewardValue: reward.value,\n };\n}\n","/**\n * NZ IRD number validation (Inland Revenue modulus-11 check digit).\n *\n * Valid range: 10,000,000 – 200,000,000 (upper limit raised Feb 2026; length stays\n * 8–9 digits). See IRD file-upload / payday filing specifications.\n */\n\nconst PRIMARY_WEIGHTS = [3, 2, 7, 6, 5, 4, 3, 2] as const;\nconst SECONDARY_WEIGHTS = [7, 4, 3, 2, 5, 2, 7, 6] as const;\n\nconst IRD_MIN = 10_000_000;\n/** Raised from 150_000_000 as of IRD's Feb 2026 annual update. */\nconst IRD_MAX = 200_000_000;\n\nfunction calculateCheckDigit(\n baseDigits: string,\n weights: readonly number[],\n): number {\n const sum = [...baseDigits].reduce(\n (acc, digit, index) => acc + Number(digit) * weights[index],\n 0,\n );\n const remainder = sum % 11;\n return remainder === 0 ? 0 : 11 - remainder;\n}\n\n/** Digits only; strips spaces/hyphens and other non-digits. */\nexport function normalizeIrdNumber(value: string): string {\n return value.replace(/\\D/g, \"\");\n}\n\n/**\n * Formats an IRD number as groups of three digits separated by hyphens\n * (e.g. `490-918-50` / `049-091-850`), capping at 9 digits.\n */\nexport function formatIrdNumber(input: string): string {\n const digitsOnly = normalizeIrdNumber(input).slice(0, 9);\n\n const parts = [];\n if (digitsOnly.length > 0) parts.push(digitsOnly.slice(0, 3));\n if (digitsOnly.length > 3) parts.push(digitsOnly.slice(3, 6));\n if (digitsOnly.length > 6) parts.push(digitsOnly.slice(6, 9));\n\n return parts.join(\"-\");\n}\n\n/**\n * Returns true when `value` is a valid NZ IRD number (8–9 digits, in issued\n * range, and modulus-11 check digit matches).\n */\nexport function isValidIrdNumber(value: string): boolean {\n const digits = normalizeIrdNumber(value);\n\n if (!/^\\d{8,9}$/.test(digits)) {\n return false;\n }\n\n const ird = Number(digits);\n if (ird < IRD_MIN || ird > IRD_MAX) {\n return false;\n }\n\n const padded = digits.padStart(9, \"0\");\n const baseDigits = padded.slice(0, -1);\n const checkDigit = Number(padded.slice(-1));\n\n let calculated = calculateCheckDigit(baseDigits, PRIMARY_WEIGHTS);\n if (calculated === 10) {\n calculated = calculateCheckDigit(baseDigits, SECONDARY_WEIGHTS);\n if (calculated === 10) {\n return false;\n }\n }\n\n return calculated === checkDigit;\n}\n","const TRANSIENT_NETWORK_PATTERNS = [\n /network connection was lost/i,\n /network request failed/i,\n /fetch failed/i,\n /failed to fetch/i,\n /internet connection appears to be offline/i,\n // Transport-layer timeouts only — avoid generic \"timeout\" (backend/query timeouts).\n /\\b(request|connection|network)\\s+timed\\s+out\\b/i,\n /\\b(connect|read|write|socket)\\s+timeout\\b/i,\n /\\bsocket\\s+timed\\s+out\\b/i,\n /\\betimedout\\b/i,\n /\\benotfound\\b/i,\n /\\beconnreset\\b/i,\n /\\beconnrefused\\b/i,\n] as const;\n\nfunction extractErrorMessage(err: unknown): string {\n if (err instanceof Error) return err.message;\n if (typeof err === \"string\") return err;\n if (err && typeof err === \"object\") {\n const obj = err as Record<string, unknown>;\n if (typeof obj.message === \"string\") return obj.message;\n if (obj.networkError) return extractErrorMessage(obj.networkError);\n try {\n return JSON.stringify(err);\n } catch {\n return \"[object]\";\n }\n }\n if (err == null) return \"\";\n if (\n typeof err === \"number\" ||\n typeof err === \"boolean\" ||\n typeof err === \"bigint\"\n ) {\n return String(err);\n }\n if (typeof err === \"symbol\") return err.toString();\n return \"\";\n}\n\n/** True for short-lived connectivity failures (e.g. resume before the stack is ready). */\nexport function isTransientNetworkError(err: unknown): boolean {\n const message = extractErrorMessage(err);\n return TRANSIENT_NETWORK_PATTERNS.some((pattern) => pattern.test(message));\n}\n","/** Client-side rotation window shared by web (admin) and mobile ad renderers. */\nexport const AD_METRIC_ROTATION_INTERVAL_MS = 8_000;\n/** Delay before a single impression retry within the same rotation slot. */\nexport const AD_METRIC_IMPRESSION_RETRY_DELAY_MS = 1_000;\n\n/** Rotation slot index for a timestamp, matching the server dedupe window. */\nexport function getAdMetricRotationSlot(epochMilliseconds: number): number {\n return Math.floor(epochMilliseconds / AD_METRIC_ROTATION_INTERVAL_MS);\n}\n\n/** Which ad of `count` is displayed at a given timestamp. */\nexport function getAdMetricRotationIndex(\n epochMilliseconds: number,\n count: number,\n): number {\n if (count <= 0) return 0;\n return getAdMetricRotationSlot(epochMilliseconds) % count;\n}\n\n/** Stable per-slot impression key used by the client to suppress duplicates. */\nexport function buildAdMetricSlotKey(\n adId: string,\n placement: string,\n slot: number,\n): string {\n return `${adId}:${placement}:${slot}`;\n}\n\n/**\n * Unique per-click id. `crypto.randomUUID` is absent or non-callable in older\n * browsers, non-secure contexts, and some React Native runtimes.\n */\nexport function generateAdClickId(): string {\n const cryptoApi = globalThis.crypto as { randomUUID?: unknown } | undefined;\n if (typeof cryptoApi?.randomUUID === \"function\") {\n return (cryptoApi.randomUUID as () => string)();\n }\n // Guard Math.random()===0: `\"0\".slice(2)` is empty, which would leave a\n // trailing dash and a weaker id.\n const randomPart = Math.random().toString(36).slice(2) || \"0\";\n return `click-${Date.now()}-${randomPart}`;\n}\n","/* eslint-disable camelcase -- Catalogue keys match persisted database identifiers. */\nimport { EnumBillingPeriod, EnumUserLicence } from \"../../enums\";\nimport type {\n BillingCatalogDefinition,\n BillingCatalogEntryType,\n BillingCatalogInitialEntry,\n BillingCatalogKey,\n} from \"../../types/billingCatalog\";\n\nexport const BILLING_CATALOG_KEYS = [\n \"pro_vendor_monthly\",\n \"pro_vendor_yearly\",\n \"pro_plus_vendor_monthly\",\n \"pro_plus_vendor_yearly\",\n] as const satisfies readonly BillingCatalogKey[];\n\nexport const BILLING_CATALOG_CURRENCY = \"nzd\" as const;\n\n/**\n * The only four licence/billing combinations that can be sold through Stripe.\n * Standard vendor access and all event licences intentionally stay outside the\n * paid billing catalogue.\n */\nexport const BILLING_CATALOG_DEFINITIONS: Record<\n BillingCatalogKey,\n BillingCatalogDefinition\n> = {\n pro_plus_vendor_monthly: {\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n },\n pro_plus_vendor_yearly: {\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n },\n pro_vendor_monthly: {\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n licenceType: EnumUserLicence.PRO_VENDOR,\n },\n pro_vendor_yearly: {\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n licenceType: EnumUserLicence.PRO_VENDOR,\n },\n};\n\n/**\n * Resolves a client selection to the single canonical billing catalogue key.\n * Returning null is intentional: GraphQL resolvers can reject every free or\n * event licence without maintaining another parallel allow-list.\n */\nexport function getBillingCatalogKeyForSelection(\n licenceType: EnumUserLicence,\n billingPeriod: EnumBillingPeriod,\n): BillingCatalogKey | null {\n const match = Object.entries(BILLING_CATALOG_DEFINITIONS).find(\n ([, definition]) =>\n definition.licenceType === licenceType &&\n definition.billingPeriod === billingPeriod,\n );\n\n return (match?.[0] as BillingCatalogKey | undefined) ?? null;\n}\n\n/**\n * Initial test prices copied from the current public pricing page. They become\n * database records during catalogue initialisation and can later be changed by\n * a Super Admin; checkout must never read these constants directly.\n */\nexport const INITIAL_BILLING_CATALOG: readonly BillingCatalogInitialEntry[] = [\n {\n active: true,\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_vendor_monthly\",\n licenceType: EnumUserLicence.PRO_VENDOR,\n taxInclusive: true,\n unitAmount: 3_999,\n },\n {\n active: true,\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_vendor_yearly\",\n licenceType: EnumUserLicence.PRO_VENDOR,\n taxInclusive: true,\n unitAmount: 40_788,\n },\n {\n active: true,\n billingPeriod: EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_plus_vendor_monthly\",\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n taxInclusive: true,\n unitAmount: 6_499,\n },\n {\n active: true,\n billingPeriod: EnumBillingPeriod.YEARLY_ANNUAL_BILLED,\n currency: BILLING_CATALOG_CURRENCY,\n key: \"pro_plus_vendor_yearly\",\n licenceType: EnumUserLicence.PRO_PLUS_VENDOR,\n taxInclusive: true,\n unitAmount: 62_388,\n },\n] as const;\n\nexport function billingCatalogDefinitionMatches(\n entry: Pick<BillingCatalogEntryType, \"billingPeriod\" | \"key\" | \"licenceType\">,\n): boolean {\n const definition = BILLING_CATALOG_DEFINITIONS[entry.key];\n\n if (!definition) {\n return false;\n }\n\n return (\n definition.billingPeriod === entry.billingPeriod &&\n definition.licenceType === entry.licenceType\n );\n}\n","import {\n eventStartDatesSet,\n filterRegisteredVendorsByEventDatesOnly,\n filterRegisteredVendorsForEvent,\n filterUnregisteredVendorsByEventDatesOnly,\n filterUnregisteredVendorsForEvent,\n getEventStallholderEmptyMessage,\n getStallholderCategoryOptions,\n getUniqueStallholderStartDates,\n type StallholderFilterOption,\n} from \"../../eventStallholders\";\nimport type { DateTimeType } from \"../../types/global\";\nimport type { UnregisteredVendorType, VendorType } from \"../../types/vendor\";\nimport { formatDateOptionLabel } from \"../date\";\n\nexport type EventStallholderDateOption = {\n label: string;\n value: string;\n};\n\nexport type EventStallholdersData = {\n emptyMessage: string;\n futureEventStartDates: EventStallholderDateOption[];\n hasDatePills: boolean;\n hasStallholders: boolean;\n stallholderCategories: StallholderFilterOption[];\n unregisteredVendorList: UnregisteredVendorType[];\n vendorList: VendorType[];\n};\n\nexport type GetEventStallholdersDataInput = {\n eventDateTime: DateTimeType[];\n selectedCategory: string | null;\n selectedDate: string | null;\n unregisteredVendors?: UnregisteredVendorType[];\n vendors: VendorType[] | null;\n};\n\n/**\n * Derives every stallholder-list value an event detail screen needs from the\n * event dates, registered vendors, and unregistered vendors.\n *\n * Date pills come from the relations, not the event schedule: they are the\n * `startDate`s of the stallholders' relation dates / invitations (chronological\n * and de-duplicated). `eventDateTime` is only used to decide which vendors and\n * invitations actually belong to the event, mirroring the vendor screen where\n * pills are also relation-sourced.\n *\n * Shared by the mobile event page and the admin market event page so the two\n * keep identical filtering / date-pill / empty-message behaviour.\n */\nexport function getEventStallholdersData({\n eventDateTime,\n selectedCategory,\n selectedDate,\n unregisteredVendors = [],\n vendors,\n}: GetEventStallholdersDataInput): EventStallholdersData {\n const eventStartDates = eventStartDatesSet(eventDateTime);\n\n const registeredForEvent = filterRegisteredVendorsByEventDatesOnly(\n vendors,\n eventStartDates,\n );\n const unregisteredForEvent = filterUnregisteredVendorsByEventDatesOnly(\n unregisteredVendors,\n eventStartDates,\n );\n\n const vendorList = filterRegisteredVendorsForEvent(\n vendors,\n eventStartDates,\n selectedDate,\n selectedCategory,\n );\n const unregisteredVendorList = filterUnregisteredVendorsForEvent(\n unregisteredVendors,\n eventStartDates,\n selectedDate,\n selectedCategory,\n );\n\n const registeredForSelectedDate = filterRegisteredVendorsForEvent(\n vendors,\n eventStartDates,\n selectedDate,\n null,\n );\n const unregisteredForSelectedDate = filterUnregisteredVendorsForEvent(\n unregisteredVendors,\n eventStartDates,\n selectedDate,\n null,\n );\n\n const stallholderCategories = getStallholderCategoryOptions(\n registeredForSelectedDate,\n unregisteredForSelectedDate,\n );\n\n const futureEventStartDates = getUniqueStallholderStartDates(\n registeredForEvent,\n unregisteredForEvent,\n ).map((startDate) => ({\n label: formatDateOptionLabel(startDate),\n value: startDate,\n }));\n\n const hasDatePills = futureEventStartDates.length > 0;\n const hasStallholders =\n vendorList.length > 0 || unregisteredVendorList.length > 0;\n const hasAnyStallholdersForEvent =\n registeredForEvent.length > 0 || unregisteredForEvent.length > 0;\n\n return {\n emptyMessage: getEventStallholderEmptyMessage(\n hasAnyStallholdersForEvent,\n selectedDate,\n ),\n futureEventStartDates,\n hasDatePills,\n hasStallholders,\n stallholderCategories,\n unregisteredVendorList,\n vendorList,\n };\n}\n","import type { EventListItemType } from \"../../types/event\";\nimport {\n filterVendorEventsBySelectedDate,\n getVendorEventRelationDateOptions,\n getVendorEventsEmptyMessage,\n} from \"../../vendorEvents\";\nimport { formatDateOptionLabel } from \"../date\";\n\nexport type VendorEventDateOption = {\n label: string;\n value: string;\n};\n\nexport type VendorEventsData = {\n emptyMessage: string;\n eventDateOptions: VendorEventDateOption[];\n eventsByDate: EventListItemType[];\n hasDatePills: boolean;\n};\n\nexport type GetVendorEventsDataInput = {\n events: EventListItemType[] | null;\n selectedDate: string | null;\n};\n\n/**\n * Derives every event-list value a vendor detail screen needs from the raw\n * event connections and the selected date filter.\n *\n * Shared by the mobile vendor page and the admin stallholder page so the two\n * keep identical filtering / date-pill / empty-message behaviour.\n */\nexport function getVendorEventsData({\n events,\n selectedDate,\n}: GetVendorEventsDataInput): VendorEventsData {\n const eventDateOptions = getVendorEventRelationDateOptions(events).map(\n (option) => ({\n ...option,\n label: formatDateOptionLabel(option.value),\n }),\n );\n\n return {\n emptyMessage: getVendorEventsEmptyMessage(\n (events?.length ?? 0) > 0,\n selectedDate,\n ),\n eventDateOptions,\n eventsByDate: filterVendorEventsBySelectedDate(events, selectedDate),\n hasDatePills: eventDateOptions.length > 0,\n };\n}\n","import { EnumInviteStatus } from \"../../enums\";\n\n/**\n * Relation date statuses that must survive when their event slot is removed or\n * a relation is overwritten. ACCEPTED/COMPLETED are historical or paid\n * bookings; CANCELED is kept so history can report dates the event canceled;\n * REJECTED is kept for the organizer's records. Dates with any other status\n * may be deleted once their slot disappears from the event schedule.\n */\nexport const PRESERVED_RELATION_DATE_STATUSES: ReadonlySet<EnumInviteStatus> =\n new Set([\n EnumInviteStatus.ACCEPTED,\n EnumInviteStatus.CANCELED,\n EnumInviteStatus.COMPLETED,\n EnumInviteStatus.REJECTED,\n ]);\n","import { isTransientNetworkError } from \"./isTransientNetworkError\";\n\nexport const DEFAULT_USER_FACING_ERROR =\n \"Something went wrong. Please try again.\";\n\nexport const NETWORK_USER_FACING_ERROR =\n \"Unable to connect. Please check your internet connection and try again.\";\n\n/** Backend/infra messages that must never be shown to end users. */\nconst INTERNAL_ERROR_PATTERNS = [\n /connection\\s*<monitor>/i,\n /\\bmongo/i,\n /\\b\\d{1,3}(?:\\.\\d{1,3}){3}(?::\\d+)?\\b/,\n /\\beconn(?:refused|reset|aborted)\\b/i,\n /\\betimedout\\b/i,\n /\\benotfound\\b/i,\n /\\bsocket hang up\\b/i,\n /\\binternal server error\\b/i,\n /received status code 5\\d\\d/i,\n /\\bat\\s+\\S+\\s+\\([^)]+:\\d+:\\d+\\)/,\n] as const;\n\nexport function isInternalErrorMessage(message: string): boolean {\n return INTERNAL_ERROR_PATTERNS.some((pattern) => pattern.test(message));\n}\n\n/**\n * Maps raw API/client errors to a safe message for UI surfaces.\n * Keeps intentional product copy (e.g. \"Vendor not found\"); hides infra details.\n */\nexport function toUserFacingErrorMessage(\n error: string | null | undefined,\n fallback = DEFAULT_USER_FACING_ERROR,\n): string {\n const message = (error ?? \"\").trim();\n if (!message) return fallback;\n\n if (isTransientNetworkError(message)) {\n return NETWORK_USER_FACING_ERROR;\n }\n\n if (isInternalErrorMessage(message)) {\n return fallback;\n }\n\n return message;\n}\n\n/** Extracts and sanitizes an unknown catch/Apollo error for toasts and alerts. */\nexport function getErrorMessage(\n error: unknown,\n fallback = DEFAULT_USER_FACING_ERROR,\n): string {\n let raw: string | undefined;\n if (error instanceof Error) {\n raw = error.message;\n } else if (typeof error === \"string\") {\n raw = error;\n }\n\n return toUserFacingErrorMessage(raw, fallback);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,yBAAyB;AAC/B,IAAM,6BAA6B,GAAG,sBAAsB;AAErD,IAAM,2BAA2B;AAAA,EACtC;AAAA,IACE,MAAM;AAAA,IACN,IAAI;AAAA,IACJ,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,IAAI;AAAA,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;AACJ,MAAI,iBAAiB,OAAO;AAC1B,UAAM,MAAM;AAAA,EACd,WAAW,OAAO,UAAU,UAAU;AACpC,UAAM;AAAA,EACR;AAEA,SAAO,yBAAyB,KAAK,QAAQ;AAC/C;","names":["import_dayjs","import_customParseFormat","EnumInviteStatus","EnumPaymentMethod","EnumRegions","dayjs","customParseFormat","isoWeek","dayjs","customParseFormat","utc","timezone","isSameOrAfter","import_dayjs","dayjs"]}