@timardex/cluemart-shared 2.2.40 → 2.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapArrayToOptions
3
- } from "./chunk-BCMBTEGJ.mjs";
3
+ } from "./chunk-VHNCSCQU.mjs";
4
4
  import {
5
5
  EnumFoodFlavor
6
6
  } from "./chunk-XGGFB7HY.mjs";
@@ -987,4 +987,4 @@ export {
987
987
  contactUsFields,
988
988
  partnerBasicInfoFields
989
989
  };
990
- //# sourceMappingURL=chunk-VL275KFW.mjs.map
990
+ //# sourceMappingURL=chunk-2GUAD63W.mjs.map
@@ -220,6 +220,18 @@ function sortDatesChronologically(dates) {
220
220
  return 0;
221
221
  });
222
222
  }
223
+ function getUniqueStartDates(dates) {
224
+ const seenStartDates = /* @__PURE__ */ new Set();
225
+ const uniqueStartDates = [];
226
+ for (const { startDate } of sortDatesChronologically(dates ?? [])) {
227
+ if (!startDate || seenStartDates.has(startDate)) {
228
+ continue;
229
+ }
230
+ seenStartDates.add(startDate);
231
+ uniqueStartDates.push(startDate);
232
+ }
233
+ return uniqueStartDates;
234
+ }
223
235
  var futureTimePeriods = FUTURE_EVENT_DATE_STATUSES.filter(
224
236
  (status) => status !== "Starting_Soon" /* STARTING_SOON */
225
237
  ).map((status) => ({
@@ -379,6 +391,7 @@ export {
379
391
  formatTimestamp,
380
392
  isIsoDateString,
381
393
  sortDatesChronologically,
394
+ getUniqueStartDates,
382
395
  futureTimePeriods,
383
396
  RELATION_SHARE_INVITATION,
384
397
  RELATION_SHARE_APPLICATION,
@@ -423,4 +436,4 @@ export {
423
436
  buildShareOgDescription,
424
437
  stripOverlaySubtitleSpecialChars
425
438
  };
426
- //# sourceMappingURL=chunk-T5ZOYS3L.mjs.map
439
+ //# sourceMappingURL=chunk-PJY7OAQ2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/dateFormats.ts","../src/utils/eventDateStatus.ts","../src/utils/date.ts","../src/sharing/relationShareTypes.ts","../src/sharing/constants.ts","../src/sharing/joinShareDescriptionSections.ts","../src/sharing/normalizeShareDescription.ts"],"sourcesContent":["export const dateFormat = \"DD-MM-YYYY\";\nexport const timeFormat = \"HH:mm\";\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 unavailable.\n *\n * Shared by the server's `processUnavailableRelations` sync and the cron\n * orphan-date cleanup so 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 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 } from \"./dateFormats\";\nimport {\n FUTURE_EVENT_DATE_STATUSES,\n EVENT_DATE_STATUS_LABELS,\n} from \"./eventDateStatus\";\n\nexport { dateFormat, timeFormat };\n\n// Enable custom format parsing\ndayjs.extend(customParseFormat);\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(isSameOrAfter);\n\nconst 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\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\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) => {\n if (!dateObj.startDate || !dateObj.startTime) {\n return false;\n }\n\n const dateTime = dayjs(\n `${dateObj.startDate} ${dateObj.startTime}`,\n `${dateFormat} ${timeFormat}`,\n );\n return dateTime.isSameOrAfter(now);\n });\n};\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","/** 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 { SHARE_MORE_INFO_LINE } from \"./constants\";\n\n/** Blank line between share sections — title, address, dates, URL, etc. */\nexport const SHARE_DESCRIPTION_SECTION_BREAK = \"\\n\\n\";\n\n/**\n * Line break for `og:description` meta content. Use instead of `\\n` — Next.js\n * HTML serialisation collapses literal newlines to spaces; Facebook reads `&#10;`.\n */\nexport const OG_DESCRIPTION_LINE_BREAK = \"&#10;\";\n\n/** Joins OG description sections for Facebook link cards (and Twitter). */\nexport function joinShareOgDescriptionSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return sections\n .map((section) => (typeof section === \"string\" ? section.trim() : \"\"))\n .filter((section): section is string => section.length > 0)\n .map((section) => section.replace(/\\n/g, OG_DESCRIPTION_LINE_BREAK))\n .join(OG_DESCRIPTION_LINE_BREAK);\n}\n\nexport function joinShareDescriptionSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return sections\n .filter((section): section is string => Boolean(section))\n .join(SHARE_DESCRIPTION_SECTION_BREAK);\n}\n\n/** Prepends the standard share branding line when assembling display text. */\nexport function appendShareMoreInfoLine(description: string): string {\n const trimmed = description.trim();\n if (trimmed.startsWith(SHARE_MORE_INFO_LINE)) {\n return trimmed;\n }\n if (trimmed.length === 0) {\n return SHARE_MORE_INFO_LINE;\n }\n return joinShareDescriptionSections([SHARE_MORE_INFO_LINE, trimmed]);\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"],"mappings":";AAAO,IAAM,aAAa;AACnB,IAAM,aAAa;;;ACD1B,OAAO,WAAW;AAClB,OAAO,uBAAuB;AAC9B,OA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ACrB;","names":["dayjs","customParseFormat","dayjs","customParseFormat"]}
@@ -16,7 +16,7 @@ import {
16
16
  SHARE_TAGS_SECTION_HEADING,
17
17
  formatDate,
18
18
  joinShareDescriptionSections
19
- } from "./chunk-T5ZOYS3L.mjs";
19
+ } from "./chunk-PJY7OAQ2.mjs";
20
20
 
21
21
  // src/sharing/formatCategoryLabel.ts
22
22
  function formatCategoryLabel(category) {
@@ -221,4 +221,4 @@ export {
221
221
  shareSlugResourceId,
222
222
  toShareSocialImageCacheVersion
223
223
  };
224
- //# sourceMappingURL=chunk-NMJ2CR2F.mjs.map
224
+ //# sourceMappingURL=chunk-QIF4ZGMY.mjs.map
@@ -2,11 +2,11 @@ import {
2
2
  EVENT_DATE_STATUS_LABELS,
3
3
  dateFormat,
4
4
  formatDate,
5
+ getUniqueStartDates,
5
6
  isIsoDateString,
6
7
  nzStartOfDay,
7
- sortDatesChronologically,
8
8
  stripOverlaySubtitleSpecialChars
9
- } from "./chunk-T5ZOYS3L.mjs";
9
+ } from "./chunk-PJY7OAQ2.mjs";
10
10
  import {
11
11
  PROMO_CODE_PREFIX,
12
12
  gameScreenIdentifierList
@@ -1452,21 +1452,23 @@ function filterUnregisteredVendorsByEventDatesOnly(vendors, eventStartDates) {
1452
1452
  )
1453
1453
  );
1454
1454
  }
1455
- function collectStallholderStartDates(registeredVendors, unregisteredVendors = []) {
1455
+ function collectStallholderDateTimes(registeredVendors, unregisteredVendors = []) {
1456
1456
  return [
1457
- ...registeredVendors.flatMap(getRegisteredVendorStartDates),
1458
- ...unregisteredVendors.flatMap(getUnregisteredVendorStartDates)
1457
+ ...registeredVendors.flatMap(
1458
+ (vendor) => (vendor.relations ?? []).flatMap(
1459
+ (relation) => (relation.relationDates ?? []).map(
1460
+ (relationDate) => relationDate.dateTime
1461
+ )
1462
+ )
1463
+ ),
1464
+ ...unregisteredVendors.flatMap(
1465
+ (vendor) => (vendor.invitations ?? []).flatMap((invitation) => invitation.dateTime)
1466
+ )
1459
1467
  ];
1460
1468
  }
1461
- function getEventDatesWithStallholders(eventDateTime, stallholderStartDates) {
1462
- if (!eventDateTime?.length) {
1463
- return [];
1464
- }
1465
- const startDates = new Set(stallholderStartDates);
1466
- return sortDatesChronologically(
1467
- eventDateTime.filter(
1468
- (date) => Boolean(date.startDate) && startDates.has(date.startDate)
1469
- )
1469
+ function getUniqueStallholderStartDates(registeredVendors, unregisteredVendors = []) {
1470
+ return getUniqueStartDates(
1471
+ collectStallholderDateTimes(registeredVendors, unregisteredVendors)
1470
1472
  );
1471
1473
  }
1472
1474
  function getStallholderCategoryNames(registeredVendors, unregisteredVendors = []) {
@@ -1522,16 +1524,7 @@ function collectVendorEventRelationDateTimes(events) {
1522
1524
  );
1523
1525
  }
1524
1526
  function getVendorEventRelationStartDates(events) {
1525
- const sortedDates = sortDatesChronologically(
1526
- collectVendorEventRelationDateTimes(events)
1527
- );
1528
- const uniqueStartDates = [];
1529
- for (const dateTime of sortedDates) {
1530
- if (dateTime.startDate && !uniqueStartDates.includes(dateTime.startDate)) {
1531
- uniqueStartDates.push(dateTime.startDate);
1532
- }
1533
- }
1534
- return uniqueStartDates;
1527
+ return getUniqueStartDates(collectVendorEventRelationDateTimes(events));
1535
1528
  }
1536
1529
  function getVendorEventRelationDateOptions(events) {
1537
1530
  return getVendorEventRelationStartDates(events).map((startDate) => ({
@@ -1755,12 +1748,12 @@ function getEventStallholdersData({
1755
1748
  registeredForSelectedDate,
1756
1749
  unregisteredForSelectedDate
1757
1750
  );
1758
- const futureEventStartDates = getEventDatesWithStallholders(
1759
- eventDateTime,
1760
- collectStallholderStartDates(registeredForEvent, unregisteredForEvent)
1761
- ).map((date) => ({
1762
- label: formatDate(date.startDate, "date"),
1763
- value: date.startDate
1751
+ const futureEventStartDates = getUniqueStallholderStartDates(
1752
+ registeredForEvent,
1753
+ unregisteredForEvent
1754
+ ).map((startDate) => ({
1755
+ label: formatDate(startDate, "date"),
1756
+ value: startDate
1764
1757
  }));
1765
1758
  const hasDatePills = futureEventStartDates.length > 0;
1766
1759
  const hasStallholders = vendorList.length > 0 || unregisteredVendorList.length > 0;
@@ -1901,8 +1894,8 @@ export {
1901
1894
  filterUnregisteredVendorsForEvent,
1902
1895
  filterRegisteredVendorsByEventDatesOnly,
1903
1896
  filterUnregisteredVendorsByEventDatesOnly,
1904
- collectStallholderStartDates,
1905
- getEventDatesWithStallholders,
1897
+ collectStallholderDateTimes,
1898
+ getUniqueStallholderStartDates,
1906
1899
  getStallholderCategoryNames,
1907
1900
  getStallholderCategoryOptions,
1908
1901
  getEventStallholderEmptyMessage,
@@ -1934,4 +1927,4 @@ export {
1934
1927
  toUserFacingErrorMessage,
1935
1928
  getErrorMessage
1936
1929
  };
1937
- //# sourceMappingURL=chunk-BCMBTEGJ.mjs.map
1930
+ //# sourceMappingURL=chunk-VHNCSCQU.mjs.map