@timardex/cluemart-shared 1.5.591 → 1.5.596

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.
@@ -9,9 +9,9 @@ function formatCategoryLabel(category) {
9
9
 
10
10
  // src/sharing/joinShareDescriptionSections.ts
11
11
  var SHARE_DESCRIPTION_SECTION_SEPARATOR = " \xB7 ";
12
- var SHARE_COMPACT_SECTION_SEPARATOR = SHARE_DESCRIPTION_SECTION_SEPARATOR;
12
+ var SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
13
13
  function joinShareDescriptionSections(sections) {
14
- return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
14
+ return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_BREAK);
15
15
  }
16
16
 
17
17
  // src/sharing/buildRelationShareDescription.ts
@@ -26,6 +26,9 @@ function formatShareDate(isoDate) {
26
26
  return isoDate;
27
27
  }
28
28
  }
29
+ function formatStallCapacityLabel(stallCapacity) {
30
+ return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : " - Full";
31
+ }
29
32
  function buildInvitationShareDescription(event, eventInfo) {
30
33
  const stallTypes = eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];
31
34
  if (!eventInfo || stallTypes.length === 0) {
@@ -36,12 +39,11 @@ function buildInvitationShareDescription(event, eventInfo) {
36
39
  event.location.fullAddress,
37
40
  ...event.dateTime.map((date) => {
38
41
  const start = formatShareDate(date.startDate);
39
- const end = date.endDate ? ` \u2013 ${formatShareDate(date.endDate)}` : "";
40
- return `Market date: ${start}${end}`;
42
+ return `Market date: ${start}`;
41
43
  }),
42
44
  `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,
43
45
  ...stallTypes.map(
44
- (stall) => `Stall: ${stall.label} \u2014 $${stall.price} (${stall.stallCapacity} spaces)`
46
+ (stall) => `Stall: ${stall.label} \u2014 $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`
45
47
  ),
46
48
  requirementLabels.length > 0 && `Requirements: ${requirementLabels.join(", ")}`
47
49
  ];
@@ -128,49 +130,63 @@ function buildShareUrl(type, id) {
128
130
  }
129
131
 
130
132
  // src/sharing/normalizeShareDescription.ts
133
+ var LEGACY_BULLET_PREFIX = "\u2022 ";
131
134
  function normalizeShareSection(value) {
132
135
  if (value == null) {
133
136
  return "";
134
137
  }
135
138
  return value.trim().split("\n").map((line) => line.trim().replace(/[ \t]+/g, " ")).join("\n").replace(/\n{3,}/g, "\n\n");
136
139
  }
137
- function normalizeShareOgDescription(value) {
140
+ function stripLegacyBulletPrefix(section) {
141
+ return section.startsWith(LEGACY_BULLET_PREFIX) ? section.slice(LEGACY_BULLET_PREFIX.length) : section;
142
+ }
143
+ function splitShareDescriptionSections(value) {
138
144
  const trimmed = value.trim();
139
145
  if (!trimmed) {
140
- return "";
146
+ return [];
147
+ }
148
+ if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
149
+ return trimmed.split(SHARE_DESCRIPTION_SECTION_SEPARATOR).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
141
150
  }
142
151
  if (/\n\n/.test(trimmed)) {
143
- return trimmed.split(/\n\n+/).map((section) => section.replace(/\s+/g, " ").trim()).filter(Boolean).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
152
+ return trimmed.split(/\n\n+/).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
144
153
  }
145
- return trimmed.replace(/\s+/g, " ").trim();
154
+ if (/\n/.test(trimmed)) {
155
+ return trimmed.split(/\n+/).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
156
+ }
157
+ return [stripLegacyBulletPrefix(normalizeShareSection(trimmed))];
158
+ }
159
+ function collapseExcessiveBlankLines(value) {
160
+ return value.replace(/\n{4,}/g, "\n\n\n").trim();
161
+ }
162
+ function formatShareSectionsForMultilineDisplay(value) {
163
+ return collapseExcessiveBlankLines(
164
+ splitShareDescriptionSections(value).join(SHARE_DESCRIPTION_SECTION_BREAK)
165
+ );
146
166
  }
147
167
  function formatShareSectionsForCompactDisplay(value) {
168
+ return splitShareDescriptionSections(value).join(
169
+ SHARE_DESCRIPTION_SECTION_SEPARATOR
170
+ );
171
+ }
172
+ function normalizeShareOgDescription(value) {
148
173
  const trimmed = value.trim();
149
174
  if (!trimmed) {
150
175
  return "";
151
176
  }
152
- if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
153
- return normalizeShareSection(trimmed);
154
- }
155
- if (/\n\n/.test(trimmed)) {
156
- return trimmed.split(/\n\n+/).map((section) => normalizeShareSection(section)).filter((section) => section.length > 0).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
157
- }
158
- if (/\n/.test(trimmed)) {
159
- return trimmed.split(/\n+/).map((section) => normalizeShareSection(section)).filter((section) => section.length > 0).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
177
+ if (/\n\n/.test(trimmed) || trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
178
+ return formatShareSectionsForCompactDisplay(trimmed);
160
179
  }
161
- return normalizeShareSection(trimmed);
162
- }
163
- function buildFacebookShareQuote(title, description) {
164
- const titlePart = normalizeShareSection(title);
165
- const descriptionPart = normalizeShareSection(description);
166
- const bodyPart = descriptionPart ? formatShareSectionsForCompactDisplay(descriptionPart) : "";
167
- const parts = [titlePart, bodyPart].filter((part) => part.length > 0);
168
- return parts.length > 0 ? parts.join(SHARE_DESCRIPTION_SECTION_SEPARATOR) : void 0;
169
- }
170
- function buildShareOgDescription(title, description) {
171
- const quote = buildFacebookShareQuote(title, description);
172
- if (quote) {
173
- return quote;
180
+ return trimmed.replace(/\s+/g, " ").trim();
181
+ }
182
+ function buildFacebookShareQuote(_title, description) {
183
+ const body = formatShareSectionsForMultilineDisplay(description);
184
+ return body.length > 0 ? body : void 0;
185
+ }
186
+ function buildShareOgDescription(_title, description) {
187
+ const multiline = formatShareSectionsForMultilineDisplay(description);
188
+ if (multiline) {
189
+ return multiline;
174
190
  }
175
191
  return normalizeShareOgDescription(description);
176
192
  }
@@ -190,8 +206,9 @@ function buildSharePagePath(resourceType, rawId) {
190
206
  export {
191
207
  formatCategoryLabel,
192
208
  SHARE_DESCRIPTION_SECTION_SEPARATOR,
193
- SHARE_COMPACT_SECTION_SEPARATOR,
209
+ SHARE_DESCRIPTION_SECTION_BREAK,
194
210
  joinShareDescriptionSections,
211
+ formatStallCapacityLabel,
195
212
  buildInvitationShareDescription,
196
213
  buildApplicationShareDescription,
197
214
  RELATION_SHARE_INVITATION,
@@ -208,11 +225,12 @@ export {
208
225
  RESOURCE_SHARE_TYPES_FOR_URL,
209
226
  SHARE_TYPE_PATH_REGEX,
210
227
  buildShareUrl,
211
- normalizeShareOgDescription,
228
+ formatShareSectionsForMultilineDisplay,
212
229
  formatShareSectionsForCompactDisplay,
230
+ normalizeShareOgDescription,
213
231
  buildFacebookShareQuote,
214
232
  buildShareOgDescription,
215
233
  normalizeShareRouteId,
216
234
  buildSharePagePath
217
235
  };
218
- //# sourceMappingURL=chunk-EHSQWIQV.mjs.map
236
+ //# sourceMappingURL=chunk-5TWV6IFM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sharing/formatCategoryLabel.ts","../src/sharing/joinShareDescriptionSections.ts","../src/sharing/buildRelationShareDescription.ts","../src/sharing/relationShareTypes.ts","../src/sharing/constants.ts","../src/sharing/buildShareUrl.ts","../src/sharing/normalizeShareDescription.ts","../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["import type { ShareVendorCategory } from \"./shareRelationTypes\";\n\nexport function formatCategoryLabel(category: ShareVendorCategory): string {\n const subcategoryNames = category.subcategories\n .map((subcategory) => subcategory.name)\n .filter(Boolean);\n\n if (subcategoryNames.length === 0) {\n return category.name;\n }\n\n return `${category.name} (${subcategoryNames.join(\", \")})`;\n}\n","/** Visible separator for multi-block share text when line breaks are stripped (legacy OG). */\nexport const SHARE_DESCRIPTION_SECTION_SEPARATOR = \" · \";\n\n/** Blank line between share sections — title, address, dates, URL, etc. */\nexport const SHARE_DESCRIPTION_SECTION_BREAK = \"\\n\\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","import { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nexport type {\n ShareEventDateTime,\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareStallType,\n ShareVendorCategory,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nfunction formatShareDate(isoDate: string): string {\n try {\n return new Intl.DateTimeFormat(\"en-NZ\", {\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n }).format(new Date(isoDate));\n } catch {\n return isoDate;\n }\n}\n\nexport function formatStallCapacityLabel(stallCapacity: number): string {\n return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : \" - Full\";\n}\n\nexport function buildInvitationShareDescription(\n event: ShareEventForInvitation,\n eventInfo: ShareEventInfoForInvitation | null | undefined,\n): string {\n const stallTypes =\n eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];\n\n if (!eventInfo || stallTypes.length === 0) {\n return event.description?.trim() || \"\";\n }\n\n const requirementLabels = (eventInfo.requirements ?? [])\n .filter((item) => item.value)\n .map((item) => item.label);\n\n const sections = [\n event.location.fullAddress,\n ...event.dateTime.map((date) => {\n const start = formatShareDate(date.startDate);\n // DO NOT share end date for now, we will add it later if needed\n return `Market date: ${start}`;\n }),\n `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,\n ...stallTypes.map(\n (stall) =>\n `Stall: ${stall.label} — $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`,\n ),\n requirementLabels.length > 0 &&\n `Requirements: ${requirementLabels.join(\", \")}`,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n\nexport function buildApplicationShareDescription(\n vendor: ShareVendorForApplication,\n vendorInfo: ShareVendorInfoForApplication | null | undefined,\n): string {\n const categoryLabels = vendor.categories.map((category) =>\n formatCategoryLabel(category),\n );\n\n if (!vendorInfo) {\n return vendor.description?.trim() || \"\";\n }\n\n const compliance = vendorInfo.compliance;\n const complianceLabels = [\n compliance?.liabilityInsurance && \"Liability insurance\",\n compliance?.foodBeverageLicense && \"Food & beverage licence\",\n ].filter(Boolean);\n\n const profileDescription = vendor.description?.trim();\n\n const sections = [\n categoryLabels.length > 0 && `Categories: ${categoryLabels.join(\", \")}`,\n `Stall size: ${vendorInfo.stallInfo.size.width}m × ${vendorInfo.stallInfo.size.depth}m`,\n `Compliance: ${complianceLabels.length > 0 ? complianceLabels.join(\", \") : \"Not specified\"}`,\n `Price range: $${vendorInfo.product.priceRange.min} – $${vendorInfo.product.priceRange.max}`,\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\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\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_SHARE_RESOURCE_TYPES,\n isRelationShareResourceType,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport const SHARE_SITE_URL = \"https://cluemart.co.nz\";\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] as const;\n\nexport type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];\n\nexport const POST_SHARE_RESOURCE_TYPES = [\n \"daily_meets\",\n \"daily_tips\",\n \"daily_games\",\n] as const;\n\nexport type PostShareResourceType = (typeof POST_SHARE_RESOURCE_TYPES)[number];\n\nexport type ShareResourceType =\n | ResourceShareType\n | PostShareResourceType\n | RelationShareResourceType;\n\nexport const SHARE_RESOURCE_LABEL: Record<ShareResourceType, string> = {\n [RELATION_SHARE_APPLICATION]: \"Application\",\n [RELATION_SHARE_INVITATION]: \"Invitation\",\n daily_games: \"Daily Game\",\n daily_meets: \"Daily Meet\",\n daily_tips: \"Daily Tip\",\n market: \"Market\",\n partner: \"Partner\",\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 {\n POST_SHARE_RESOURCE_TYPES,\n RESOURCE_SHARE_TYPES,\n SHARE_SITE_URL,\n} from \"./constants\";\nimport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n} from \"./relationShareTypes\";\n\n/** Path segments for public resource share URLs (markets, posts, etc.). */\nexport const PUBLIC_SHARE_PATH_TYPES = [\n ...RESOURCE_SHARE_TYPES,\n ...POST_SHARE_RESOURCE_TYPES,\n] as const;\n\nexport type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];\n\n/** @deprecated Use {@link PUBLIC_SHARE_PATH_TYPES} — kept for mobile deep-link helpers. */\nexport const RESOURCE_SHARE_TYPES_FOR_URL = PUBLIC_SHARE_PATH_TYPES;\n\nexport type RelationSharePathType =\n | typeof RELATION_SHARE_INVITATION\n | typeof RELATION_SHARE_APPLICATION;\n\nexport type ShareType = PublicSharePathType | RelationSharePathType;\n\n/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */\nexport const SHARE_TYPE_PATH_REGEX = [\n ...PUBLIC_SHARE_PATH_TYPES,\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n].join(\"|\");\n\nexport function buildShareUrl(type: ShareType, id: string): string {\n return `${SHARE_SITE_URL}/share/${type}/${encodeURIComponent(id)}`;\n}\n","import {\n SHARE_DESCRIPTION_SECTION_BREAK,\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n} from \"./joinShareDescriptionSections\";\n\nconst LEGACY_BULLET_PREFIX = \"• \";\n\n/** Trims a share section and collapses spaces per line; preserves line breaks. */\nfunction normalizeShareSection(value: string | null | undefined): string {\n if (value == null) {\n return \"\";\n }\n return value\n .trim()\n .split(\"\\n\")\n .map((line) => line.trim().replace(/[ \\t]+/g, \" \"))\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\nfunction stripLegacyBulletPrefix(section: string): string {\n return section.startsWith(LEGACY_BULLET_PREFIX)\n ? section.slice(LEGACY_BULLET_PREFIX.length)\n : section;\n}\n\nfunction splitShareDescriptionSections(value: string): string[] {\n const trimmed = value.trim();\n if (!trimmed) {\n return [];\n }\n\n if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {\n return trimmed\n .split(SHARE_DESCRIPTION_SECTION_SEPARATOR)\n .map((section) => stripLegacyBulletPrefix(normalizeShareSection(section)))\n .filter((section) => section.length > 0);\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => stripLegacyBulletPrefix(normalizeShareSection(section)))\n .filter((section) => section.length > 0);\n }\n\n if (/\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n+/)\n .map((section) => stripLegacyBulletPrefix(normalizeShareSection(section)))\n .filter((section) => section.length > 0);\n }\n\n return [stripLegacyBulletPrefix(normalizeShareSection(trimmed))];\n}\n\nfunction collapseExcessiveBlankLines(value: string): string {\n return value.replace(/\\n{4,}/g, \"\\n\\n\\n\").trim();\n}\n\n/**\n * Share copy with a blank line between each section (all apps, Facebook quote, OG body).\n */\nexport function formatShareSectionsForMultilineDisplay(value: string): string {\n return collapseExcessiveBlankLines(\n splitShareDescriptionSections(value).join(SHARE_DESCRIPTION_SECTION_BREAK),\n );\n}\n\n/**\n * Formats multiline share copy for UIs that strip line breaks (legacy OG one-liners).\n */\nexport function formatShareSectionsForCompactDisplay(value: string): string {\n return splitShareDescriptionSections(value).join(\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n );\n}\n\n/**\n * Formats share descriptions for Open Graph / Twitter meta tags when crawlers\n * collapse line breaks.\n */\nexport function normalizeShareOgDescription(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) {\n return \"\";\n }\n\n if (/\\n\\n/.test(trimmed) || trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {\n return formatShareSectionsForCompactDisplay(trimmed);\n }\n\n return trimmed.replace(/\\s+/g, \" \").trim();\n}\n\n/**\n * Quote text for Facebook ShareDialog. Body only — the link card shows the title.\n */\nexport function buildFacebookShareQuote(\n _title: string,\n description: string,\n): string | undefined {\n const body = formatShareSectionsForMultilineDisplay(description);\n return body.length > 0 ? body : undefined;\n}\n\n/**\n * Open Graph / Twitter description — multiline body without repeating `og:title`.\n */\nexport function buildShareOgDescription(\n _title: string,\n description: string,\n): string {\n const multiline = formatShareSectionsForMultilineDisplay(description);\n if (multiline) {\n return multiline;\n }\n return normalizeShareOgDescription(description);\n}\n","import type { ShareResourceType } from \"./constants\";\n\nexport function normalizeShareRouteId(id: string): string {\n try {\n return decodeURIComponent(id);\n } catch {\n return id;\n }\n}\n\nexport function buildSharePagePath(\n resourceType: ShareResourceType,\n rawId: string,\n): string {\n return `/share/${resourceType}/${encodeURIComponent(normalizeShareRouteId(rawId))}`;\n}\n"],"mappings":";AAEO,SAAS,oBAAoB,UAAuC;AACzE,QAAM,mBAAmB,SAAS,cAC/B,IAAI,CAAC,gBAAgB,YAAY,IAAI,EACrC,OAAO,OAAO;AAEjB,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO,SAAS;AAAA,EAClB;AAEA,SAAO,GAAG,SAAS,IAAI,KAAK,iBAAiB,KAAK,IAAI,CAAC;AACzD;;;ACXO,IAAM,sCAAsC;AAG5C,IAAM,kCAAkC;AAExC,SAAS,6BACd,UACQ;AACR,SAAO,SACJ,OAAO,CAAC,YAA+B,QAAQ,OAAO,CAAC,EACvD,KAAK,+BAA+B;AACzC;;;ACOA,SAAS,gBAAgB,SAAyB;AAChD,MAAI;AACF,WAAO,IAAI,KAAK,eAAe,SAAS;AAAA,MACtC,KAAK;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,IACR,CAAC,EAAE,OAAO,IAAI,KAAK,OAAO,CAAC;AAAA,EAC7B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,yBAAyB,eAA+B;AACtE,SAAO,gBAAgB,IAAI,KAAK,aAAa,uBAAuB;AACtE;AAEO,SAAS,gCACd,OACA,WACQ;AACR,QAAM,aACJ,WAAW,UAAU,QAAQ,CAAC,SAAS,KAAK,UAAU,KAAK,CAAC;AAE9D,MAAI,CAAC,aAAa,WAAW,WAAW,GAAG;AACzC,WAAO,MAAM,aAAa,KAAK,KAAK;AAAA,EACtC;AAEA,QAAM,qBAAqB,UAAU,gBAAgB,CAAC,GACnD,OAAO,CAAC,SAAS,KAAK,KAAK,EAC3B,IAAI,CAAC,SAAS,KAAK,KAAK;AAE3B,QAAM,WAAW;AAAA,IACf,MAAM,SAAS;AAAA,IACf,GAAG,MAAM,SA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AS,IAAI,OAAO;AAClC;AAKO,SAAS,wBACd,QACA,aACQ;AACR,QAAM,YAAY,uCAAuC,WAAW;AACpE,MAAI,WAAW;AACb,WAAO;AAAA,EACT;AACA,SAAO,4BAA4B,WAAW;AAChD;;;ACpHO,SAAS,sBAAsB,IAAoB;AACxD,MAAI;AACF,WAAO,mBAAmB,EAAE;AAAA,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,mBACd,cACA,OACQ;AACR,SAAO,UAAU,YAAY,IAAI,mBAAmB,sBAAsB,KAAK,CAAC,CAAC;AACnF;","names":[]}
@@ -28,7 +28,7 @@ import {
28
28
  EnumVendorType
29
29
  } from "../chunk-ZR4TGWTS.mjs";
30
30
  import "../chunk-S2VBOUOO.mjs";
31
- import "../chunk-EHSQWIQV.mjs";
31
+ import "../chunk-5TWV6IFM.mjs";
32
32
  import "../chunk-DWO35OY4.mjs";
33
33
  import "../chunk-VA5YN2K3.mjs";
34
34
 
package/dist/index.cjs CHANGED
@@ -80,7 +80,7 @@ __export(index_exports, {
80
80
  SAVED_TOKEN_KEY: () => SAVED_TOKEN_KEY,
81
81
  SCHOOL_MAX_STUDENT_COUNT: () => SCHOOL_MAX_STUDENT_COUNT,
82
82
  SCHOOL_MIN_STUDENT_COUNT: () => SCHOOL_MIN_STUDENT_COUNT,
83
- SHARE_COMPACT_SECTION_SEPARATOR: () => SHARE_COMPACT_SECTION_SEPARATOR,
83
+ SHARE_DESCRIPTION_SECTION_BREAK: () => SHARE_DESCRIPTION_SECTION_BREAK,
84
84
  SHARE_DESCRIPTION_SECTION_SEPARATOR: () => SHARE_DESCRIPTION_SECTION_SEPARATOR,
85
85
  SHARE_RESOURCE_LABEL: () => SHARE_RESOURCE_LABEL,
86
86
  SHARE_SITE_URL: () => SHARE_SITE_URL,
@@ -128,6 +128,8 @@ __export(index_exports, {
128
128
  formatCategoryLabel: () => formatCategoryLabel,
129
129
  formatDate: () => formatDate,
130
130
  formatShareSectionsForCompactDisplay: () => formatShareSectionsForCompactDisplay,
131
+ formatShareSectionsForMultilineDisplay: () => formatShareSectionsForMultilineDisplay,
132
+ formatStallCapacityLabel: () => formatStallCapacityLabel,
131
133
  formatTimestamp: () => formatTimestamp,
132
134
  gameScreenIdentifierList: () => gameScreenIdentifierList,
133
135
  gameTypeToDisplayName: () => gameTypeToDisplayName,
@@ -8838,9 +8840,9 @@ function formatCategoryLabel(category) {
8838
8840
 
8839
8841
  // src/sharing/joinShareDescriptionSections.ts
8840
8842
  var SHARE_DESCRIPTION_SECTION_SEPARATOR = " \xB7 ";
8841
- var SHARE_COMPACT_SECTION_SEPARATOR = SHARE_DESCRIPTION_SECTION_SEPARATOR;
8843
+ var SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
8842
8844
  function joinShareDescriptionSections(sections) {
8843
- return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
8845
+ return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_BREAK);
8844
8846
  }
8845
8847
 
8846
8848
  // src/sharing/buildRelationShareDescription.ts
@@ -8855,6 +8857,9 @@ function formatShareDate(isoDate) {
8855
8857
  return isoDate;
8856
8858
  }
8857
8859
  }
8860
+ function formatStallCapacityLabel(stallCapacity) {
8861
+ return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : " - Full";
8862
+ }
8858
8863
  function buildInvitationShareDescription(event, eventInfo2) {
8859
8864
  const stallTypes2 = eventInfo2?.dateTime?.flatMap((date3) => date3.stallTypes) ?? [];
8860
8865
  if (!eventInfo2 || stallTypes2.length === 0) {
@@ -8865,12 +8870,11 @@ function buildInvitationShareDescription(event, eventInfo2) {
8865
8870
  event.location.fullAddress,
8866
8871
  ...event.dateTime.map((date3) => {
8867
8872
  const start = formatShareDate(date3.startDate);
8868
- const end = date3.endDate ? ` \u2013 ${formatShareDate(date3.endDate)}` : "";
8869
- return `Market date: ${start}${end}`;
8873
+ return `Market date: ${start}`;
8870
8874
  }),
8871
8875
  `Application deadline: vendors must apply at least ${eventInfo2.applicationDeadlineHours} hours before each market date.`,
8872
8876
  ...stallTypes2.map(
8873
- (stall) => `Stall: ${stall.label} \u2014 $${stall.price} (${stall.stallCapacity} spaces)`
8877
+ (stall) => `Stall: ${stall.label} \u2014 $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`
8874
8878
  ),
8875
8879
  requirementLabels.length > 0 && `Requirements: ${requirementLabels.join(", ")}`
8876
8880
  ];
@@ -8957,49 +8961,63 @@ function buildShareUrl(type, id) {
8957
8961
  }
8958
8962
 
8959
8963
  // src/sharing/normalizeShareDescription.ts
8964
+ var LEGACY_BULLET_PREFIX = "\u2022 ";
8960
8965
  function normalizeShareSection(value) {
8961
8966
  if (value == null) {
8962
8967
  return "";
8963
8968
  }
8964
8969
  return value.trim().split("\n").map((line) => line.trim().replace(/[ \t]+/g, " ")).join("\n").replace(/\n{3,}/g, "\n\n");
8965
8970
  }
8966
- function normalizeShareOgDescription(value) {
8971
+ function stripLegacyBulletPrefix(section) {
8972
+ return section.startsWith(LEGACY_BULLET_PREFIX) ? section.slice(LEGACY_BULLET_PREFIX.length) : section;
8973
+ }
8974
+ function splitShareDescriptionSections(value) {
8967
8975
  const trimmed = value.trim();
8968
8976
  if (!trimmed) {
8969
- return "";
8977
+ return [];
8978
+ }
8979
+ if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
8980
+ return trimmed.split(SHARE_DESCRIPTION_SECTION_SEPARATOR).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
8970
8981
  }
8971
8982
  if (/\n\n/.test(trimmed)) {
8972
- return trimmed.split(/\n\n+/).map((section) => section.replace(/\s+/g, " ").trim()).filter(Boolean).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
8983
+ return trimmed.split(/\n\n+/).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
8973
8984
  }
8974
- return trimmed.replace(/\s+/g, " ").trim();
8985
+ if (/\n/.test(trimmed)) {
8986
+ return trimmed.split(/\n+/).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
8987
+ }
8988
+ return [stripLegacyBulletPrefix(normalizeShareSection(trimmed))];
8989
+ }
8990
+ function collapseExcessiveBlankLines(value) {
8991
+ return value.replace(/\n{4,}/g, "\n\n\n").trim();
8992
+ }
8993
+ function formatShareSectionsForMultilineDisplay(value) {
8994
+ return collapseExcessiveBlankLines(
8995
+ splitShareDescriptionSections(value).join(SHARE_DESCRIPTION_SECTION_BREAK)
8996
+ );
8975
8997
  }
8976
8998
  function formatShareSectionsForCompactDisplay(value) {
8999
+ return splitShareDescriptionSections(value).join(
9000
+ SHARE_DESCRIPTION_SECTION_SEPARATOR
9001
+ );
9002
+ }
9003
+ function normalizeShareOgDescription(value) {
8977
9004
  const trimmed = value.trim();
8978
9005
  if (!trimmed) {
8979
9006
  return "";
8980
9007
  }
8981
- if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
8982
- return normalizeShareSection(trimmed);
9008
+ if (/\n\n/.test(trimmed) || trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
9009
+ return formatShareSectionsForCompactDisplay(trimmed);
8983
9010
  }
8984
- if (/\n\n/.test(trimmed)) {
8985
- return trimmed.split(/\n\n+/).map((section) => normalizeShareSection(section)).filter((section) => section.length > 0).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
8986
- }
8987
- if (/\n/.test(trimmed)) {
8988
- return trimmed.split(/\n+/).map((section) => normalizeShareSection(section)).filter((section) => section.length > 0).join(SHARE_DESCRIPTION_SECTION_SEPARATOR);
8989
- }
8990
- return normalizeShareSection(trimmed);
9011
+ return trimmed.replace(/\s+/g, " ").trim();
8991
9012
  }
8992
- function buildFacebookShareQuote(title, description) {
8993
- const titlePart = normalizeShareSection(title);
8994
- const descriptionPart = normalizeShareSection(description);
8995
- const bodyPart = descriptionPart ? formatShareSectionsForCompactDisplay(descriptionPart) : "";
8996
- const parts = [titlePart, bodyPart].filter((part) => part.length > 0);
8997
- return parts.length > 0 ? parts.join(SHARE_DESCRIPTION_SECTION_SEPARATOR) : void 0;
9013
+ function buildFacebookShareQuote(_title, description) {
9014
+ const body = formatShareSectionsForMultilineDisplay(description);
9015
+ return body.length > 0 ? body : void 0;
8998
9016
  }
8999
- function buildShareOgDescription(title, description) {
9000
- const quote = buildFacebookShareQuote(title, description);
9001
- if (quote) {
9002
- return quote;
9017
+ function buildShareOgDescription(_title, description) {
9018
+ const multiline = formatShareSectionsForMultilineDisplay(description);
9019
+ if (multiline) {
9020
+ return multiline;
9003
9021
  }
9004
9022
  return normalizeShareOgDescription(description);
9005
9023
  }
@@ -9156,7 +9174,7 @@ var gameTypeToDisplayName = {
9156
9174
  SAVED_TOKEN_KEY,
9157
9175
  SCHOOL_MAX_STUDENT_COUNT,
9158
9176
  SCHOOL_MIN_STUDENT_COUNT,
9159
- SHARE_COMPACT_SECTION_SEPARATOR,
9177
+ SHARE_DESCRIPTION_SECTION_BREAK,
9160
9178
  SHARE_DESCRIPTION_SECTION_SEPARATOR,
9161
9179
  SHARE_RESOURCE_LABEL,
9162
9180
  SHARE_SITE_URL,
@@ -9204,6 +9222,8 @@ var gameTypeToDisplayName = {
9204
9222
  formatCategoryLabel,
9205
9223
  formatDate,
9206
9224
  formatShareSectionsForCompactDisplay,
9225
+ formatShareSectionsForMultilineDisplay,
9226
+ formatStallCapacityLabel,
9207
9227
  formatTimestamp,
9208
9228
  gameScreenIdentifierList,
9209
9229
  gameTypeToDisplayName,