@timardex/cluemart-shared 1.5.602 → 1.5.605
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-Z2A5VC6X.mjs → chunk-A5HI7DTW.mjs} +25 -37
- package/dist/chunk-A5HI7DTW.mjs.map +1 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.cjs +27 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +8 -17
- package/dist/index.d.ts +8 -17
- package/dist/index.mjs +24 -36
- package/dist/index.mjs.map +1 -1
- package/dist/sharing/index.cjs +27 -40
- package/dist/sharing/index.cjs.map +1 -1
- package/dist/sharing/index.d.mts +8 -17
- package/dist/sharing/index.d.ts +8 -17
- package/dist/sharing/index.mjs +7 -9
- package/package.json +1 -1
- package/dist/chunk-Z2A5VC6X.mjs.map +0 -1
package/dist/sharing/index.cjs
CHANGED
|
@@ -38,18 +38,18 @@ __export(sharing_exports, {
|
|
|
38
38
|
RELATION_SHARE_INVITATION: () => RELATION_SHARE_INVITATION,
|
|
39
39
|
RELATION_SHARE_RESOURCE_TYPES: () => RELATION_SHARE_RESOURCE_TYPES,
|
|
40
40
|
RESOURCE_SHARE_TYPES: () => RESOURCE_SHARE_TYPES,
|
|
41
|
-
RESOURCE_SHARE_TYPES_FOR_URL: () => RESOURCE_SHARE_TYPES_FOR_URL,
|
|
42
41
|
SHARE_CALENDAR_ICON: () => SHARE_CALENDAR_ICON,
|
|
43
42
|
SHARE_CATEGORIES_SECTION_HEADING: () => SHARE_CATEGORIES_SECTION_HEADING,
|
|
44
43
|
SHARE_CATEGORY_ICON: () => SHARE_CATEGORY_ICON,
|
|
45
44
|
SHARE_CHECKMARK_ICON: () => SHARE_CHECKMARK_ICON,
|
|
46
45
|
SHARE_DESCRIPTION_SECTION_BREAK: () => SHARE_DESCRIPTION_SECTION_BREAK,
|
|
47
|
-
SHARE_DESCRIPTION_SECTION_SEPARATOR: () => SHARE_DESCRIPTION_SECTION_SEPARATOR,
|
|
48
46
|
SHARE_MARKET_DATES_SECTION_HEADING: () => SHARE_MARKET_DATES_SECTION_HEADING,
|
|
47
|
+
SHARE_MORE_INFO_LINE: () => SHARE_MORE_INFO_LINE,
|
|
49
48
|
SHARE_REQUIREMENTS_SECTION_HEADING: () => SHARE_REQUIREMENTS_SECTION_HEADING,
|
|
50
49
|
SHARE_RESOURCE_LABEL: () => SHARE_RESOURCE_LABEL,
|
|
51
50
|
SHARE_SITE_URL: () => SHARE_SITE_URL,
|
|
52
51
|
SHARE_TYPE_PATH_REGEX: () => SHARE_TYPE_PATH_REGEX,
|
|
52
|
+
appendShareMoreInfoLine: () => appendShareMoreInfoLine,
|
|
53
53
|
buildApplicationShareDescription: () => buildApplicationShareDescription,
|
|
54
54
|
buildFacebookShareQuote: () => buildFacebookShareQuote,
|
|
55
55
|
buildInvitationShareDescription: () => buildInvitationShareDescription,
|
|
@@ -62,8 +62,6 @@ __export(sharing_exports, {
|
|
|
62
62
|
formatShareInvitationMarketDatesSection: () => formatShareInvitationMarketDatesSection,
|
|
63
63
|
formatShareInvitationRequirementsSection: () => formatShareInvitationRequirementsSection,
|
|
64
64
|
formatShareMarketDate: () => formatShareMarketDate,
|
|
65
|
-
formatShareSectionsForCompactDisplay: () => formatShareSectionsForCompactDisplay,
|
|
66
|
-
formatShareSectionsForMultilineDisplay: () => formatShareSectionsForMultilineDisplay,
|
|
67
65
|
formatStallCapacityLabel: () => formatStallCapacityLabel,
|
|
68
66
|
isPostShareResourceType: () => isPostShareResourceType,
|
|
69
67
|
isRelationShareResourceType: () => isRelationShareResourceType,
|
|
@@ -71,6 +69,7 @@ __export(sharing_exports, {
|
|
|
71
69
|
joinShareOgDescriptionSections: () => joinShareOgDescriptionSections,
|
|
72
70
|
normalizeShareOgDescription: () => normalizeShareOgDescription,
|
|
73
71
|
normalizeShareRouteId: () => normalizeShareRouteId,
|
|
72
|
+
normalizeShareText: () => normalizeShareText,
|
|
74
73
|
splitShareDescriptionSections: () => splitShareDescriptionSections
|
|
75
74
|
});
|
|
76
75
|
module.exports = __toCommonJS(sharing_exports);
|
|
@@ -125,6 +124,7 @@ var SHARE_CHECKMARK_ICON = "\u2705";
|
|
|
125
124
|
var SHARE_REQUIREMENTS_SECTION_HEADING = `${SHARE_CHECKMARK_ICON} Requirements:`;
|
|
126
125
|
var SHARE_CATEGORY_ICON = "\u{1F3F7}\uFE0F";
|
|
127
126
|
var SHARE_CATEGORIES_SECTION_HEADING = `${SHARE_CATEGORY_ICON} Categories:`;
|
|
127
|
+
var SHARE_MORE_INFO_LINE = "More info in the ClueMart app";
|
|
128
128
|
var DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;
|
|
129
129
|
var RESOURCE_SHARE_TYPES = [
|
|
130
130
|
"market",
|
|
@@ -162,7 +162,6 @@ function formatCategoryLabel(category) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// src/sharing/joinShareDescriptionSections.ts
|
|
165
|
-
var SHARE_DESCRIPTION_SECTION_SEPARATOR = " \xB7 ";
|
|
166
165
|
var SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
|
|
167
166
|
var OG_DESCRIPTION_LINE_BREAK = " ";
|
|
168
167
|
function joinShareOgDescriptionSections(sections) {
|
|
@@ -171,6 +170,16 @@ function joinShareOgDescriptionSections(sections) {
|
|
|
171
170
|
function joinShareDescriptionSections(sections) {
|
|
172
171
|
return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_BREAK);
|
|
173
172
|
}
|
|
173
|
+
function appendShareMoreInfoLine(description) {
|
|
174
|
+
const trimmed = description.trim();
|
|
175
|
+
if (trimmed.endsWith(SHARE_MORE_INFO_LINE)) {
|
|
176
|
+
return trimmed;
|
|
177
|
+
}
|
|
178
|
+
if (trimmed.length === 0) {
|
|
179
|
+
return SHARE_MORE_INFO_LINE;
|
|
180
|
+
}
|
|
181
|
+
return joinShareDescriptionSections([trimmed, SHARE_MORE_INFO_LINE]);
|
|
182
|
+
}
|
|
174
183
|
|
|
175
184
|
// src/sharing/buildRelationShareDescription.ts
|
|
176
185
|
function formatShareMarketDate(dateStr) {
|
|
@@ -243,7 +252,6 @@ var PUBLIC_SHARE_PATH_TYPES = [
|
|
|
243
252
|
...RESOURCE_SHARE_TYPES,
|
|
244
253
|
...POST_SHARE_RESOURCE_TYPES
|
|
245
254
|
];
|
|
246
|
-
var RESOURCE_SHARE_TYPES_FOR_URL = PUBLIC_SHARE_PATH_TYPES;
|
|
247
255
|
var SHARE_TYPE_PATH_REGEX = [
|
|
248
256
|
...PUBLIC_SHARE_PATH_TYPES,
|
|
249
257
|
RELATION_SHARE_APPLICATION,
|
|
@@ -254,8 +262,7 @@ function buildShareUrl(type, id) {
|
|
|
254
262
|
}
|
|
255
263
|
|
|
256
264
|
// src/sharing/normalizeShareDescription.ts
|
|
257
|
-
|
|
258
|
-
function normalizeShareSection(value) {
|
|
265
|
+
function normalizeShareText(value) {
|
|
259
266
|
if (value == null) {
|
|
260
267
|
return "";
|
|
261
268
|
}
|
|
@@ -268,46 +275,25 @@ function normalizeShareSection(value) {
|
|
|
268
275
|
return leading + rest.trim().replace(/[ \t]{2,}/g, " ");
|
|
269
276
|
}).join("\n").replace(/\n{3,}/g, "\n\n");
|
|
270
277
|
}
|
|
271
|
-
function stripLegacyBulletPrefix(section) {
|
|
272
|
-
return section.startsWith(LEGACY_BULLET_PREFIX) ? section.slice(LEGACY_BULLET_PREFIX.length) : section;
|
|
273
|
-
}
|
|
274
278
|
function splitShareDescriptionSections(value) {
|
|
275
|
-
const trimmed = value
|
|
279
|
+
const trimmed = normalizeShareText(value);
|
|
276
280
|
if (!trimmed) {
|
|
277
281
|
return [];
|
|
278
282
|
}
|
|
279
|
-
if (trimmed.includes(SHARE_DESCRIPTION_SECTION_SEPARATOR)) {
|
|
280
|
-
return trimmed.split(SHARE_DESCRIPTION_SECTION_SEPARATOR).map((section) => stripLegacyBulletPrefix(normalizeShareSection(section))).filter((section) => section.length > 0);
|
|
281
|
-
}
|
|
282
283
|
if (/\n\n/.test(trimmed)) {
|
|
283
|
-
return trimmed.split(/\n\n+/).map((section) =>
|
|
284
|
+
return trimmed.split(/\n\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
|
|
284
285
|
}
|
|
285
286
|
if (/\n/.test(trimmed)) {
|
|
286
|
-
return trimmed.split(/\n+/).map((section) =>
|
|
287
|
+
return trimmed.split(/\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
|
|
287
288
|
}
|
|
288
|
-
return [
|
|
289
|
-
}
|
|
290
|
-
function collapseExcessiveBlankLines(value) {
|
|
291
|
-
return value.replace(/\n{4,}/g, "\n\n\n").trim();
|
|
292
|
-
}
|
|
293
|
-
function formatShareSectionsForMultilineDisplay(value) {
|
|
294
|
-
return collapseExcessiveBlankLines(
|
|
295
|
-
splitShareDescriptionSections(value).join(SHARE_DESCRIPTION_SECTION_BREAK)
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
function formatShareSectionsForCompactDisplay(value) {
|
|
299
|
-
return splitShareDescriptionSections(value).join(
|
|
300
|
-
SHARE_DESCRIPTION_SECTION_SEPARATOR
|
|
301
|
-
);
|
|
289
|
+
return [trimmed];
|
|
302
290
|
}
|
|
303
291
|
function normalizeShareOgDescription(value) {
|
|
304
292
|
return joinShareOgDescriptionSections(splitShareDescriptionSections(value));
|
|
305
293
|
}
|
|
306
294
|
function buildFacebookShareQuote(title, description) {
|
|
307
|
-
const titleSection =
|
|
308
|
-
const body =
|
|
309
|
-
normalizeShareSection(description)
|
|
310
|
-
);
|
|
295
|
+
const titleSection = normalizeShareText(title);
|
|
296
|
+
const body = appendShareMoreInfoLine(normalizeShareText(description));
|
|
311
297
|
const sections = [titleSection, body].filter((section) => section.length > 0);
|
|
312
298
|
const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();
|
|
313
299
|
return quote.length > 0 ? quote : void 0;
|
|
@@ -316,7 +302,9 @@ function buildShareOgDescriptionFromSections(sections) {
|
|
|
316
302
|
return joinShareOgDescriptionSections(sections);
|
|
317
303
|
}
|
|
318
304
|
function buildShareOgDescription(_title, description) {
|
|
319
|
-
return joinShareOgDescriptionSections(
|
|
305
|
+
return joinShareOgDescriptionSections(
|
|
306
|
+
splitShareDescriptionSections(description)
|
|
307
|
+
);
|
|
320
308
|
}
|
|
321
309
|
|
|
322
310
|
// src/sharing/normalizeShareRouteId.ts
|
|
@@ -340,18 +328,18 @@ function buildSharePagePath(resourceType, rawId) {
|
|
|
340
328
|
RELATION_SHARE_INVITATION,
|
|
341
329
|
RELATION_SHARE_RESOURCE_TYPES,
|
|
342
330
|
RESOURCE_SHARE_TYPES,
|
|
343
|
-
RESOURCE_SHARE_TYPES_FOR_URL,
|
|
344
331
|
SHARE_CALENDAR_ICON,
|
|
345
332
|
SHARE_CATEGORIES_SECTION_HEADING,
|
|
346
333
|
SHARE_CATEGORY_ICON,
|
|
347
334
|
SHARE_CHECKMARK_ICON,
|
|
348
335
|
SHARE_DESCRIPTION_SECTION_BREAK,
|
|
349
|
-
SHARE_DESCRIPTION_SECTION_SEPARATOR,
|
|
350
336
|
SHARE_MARKET_DATES_SECTION_HEADING,
|
|
337
|
+
SHARE_MORE_INFO_LINE,
|
|
351
338
|
SHARE_REQUIREMENTS_SECTION_HEADING,
|
|
352
339
|
SHARE_RESOURCE_LABEL,
|
|
353
340
|
SHARE_SITE_URL,
|
|
354
341
|
SHARE_TYPE_PATH_REGEX,
|
|
342
|
+
appendShareMoreInfoLine,
|
|
355
343
|
buildApplicationShareDescription,
|
|
356
344
|
buildFacebookShareQuote,
|
|
357
345
|
buildInvitationShareDescription,
|
|
@@ -364,8 +352,6 @@ function buildSharePagePath(resourceType, rawId) {
|
|
|
364
352
|
formatShareInvitationMarketDatesSection,
|
|
365
353
|
formatShareInvitationRequirementsSection,
|
|
366
354
|
formatShareMarketDate,
|
|
367
|
-
formatShareSectionsForCompactDisplay,
|
|
368
|
-
formatShareSectionsForMultilineDisplay,
|
|
369
355
|
formatStallCapacityLabel,
|
|
370
356
|
isPostShareResourceType,
|
|
371
357
|
isRelationShareResourceType,
|
|
@@ -373,6 +359,7 @@ function buildSharePagePath(resourceType, rawId) {
|
|
|
373
359
|
joinShareOgDescriptionSections,
|
|
374
360
|
normalizeShareOgDescription,
|
|
375
361
|
normalizeShareRouteId,
|
|
362
|
+
normalizeShareText,
|
|
376
363
|
splitShareDescriptionSections
|
|
377
364
|
});
|
|
378
365
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sharing/index.ts","../../src/utils/date.ts","../../src/sharing/relationShareTypes.ts","../../src/sharing/constants.ts","../../src/sharing/formatCategoryLabel.ts","../../src/sharing/joinShareDescriptionSections.ts","../../src/sharing/buildRelationShareDescription.ts","../../src/sharing/buildShareUrl.ts","../../src/sharing/normalizeShareDescription.ts","../../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["export * from \"./buildRelationShareDescription\";\nexport * from \"./shareRelationTypes\";\nexport * from \"./buildShareUrl\";\nexport * from \"./constants\";\nexport * from \"./formatCategoryLabel\";\nexport * from \"./joinShareDescriptionSections\";\nexport * from \"./normalizeShareDescription\";\nexport * from \"./normalizeShareRouteId\";\nexport * from \"./relationShareTypes\";\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\nexport const dateFormat = \"DD-MM-YYYY\";\nexport const timeFormat = \"HH:mm\";\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 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 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\" && !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 || !dates.length) {\n return [];\n }\n\n return [...dates].sort((a, b) => {\n const dateTimeFormat = `${dateFormat} ${timeFormat}`;\n const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);\n const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);\n return dateA.valueOf() - dateB.valueOf(); // chronological order\n });\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\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/** 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\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 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\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 ` `.\n */\nexport const OG_DESCRIPTION_LINE_BREAK = \" \";\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","import { formatDate } from \"../utils/date\";\n\nimport {\n SHARE_CATEGORIES_SECTION_HEADING,\n SHARE_MARKET_DATES_SECTION_HEADING,\n SHARE_REQUIREMENTS_SECTION_HEADING,\n} from \"./constants\";\nimport { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareStallType,\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\n/** Formats event `startDate` (`DD-MM-YYYY`) for share copy — same as share preview UI. */\nexport function formatShareMarketDate(dateStr: string): string {\n return formatDate(dateStr, \"date\");\n}\n\nexport function formatStallCapacityLabel(stallCapacity: number): string {\n return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : \" - Full\";\n}\n\nfunction formatShareStallLine(stall: ShareStallType): string {\n return ` - ${stall.label} — $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`;\n}\n\n/** Nested market dates + per-date stall lines for invitation share copy. */\nexport function formatShareInvitationMarketDatesSection(\n dateTime: ShareEventInfoForInvitation[\"dateTime\"],\n): string {\n const dateBlocks = dateTime.map((date) => {\n const formattedDate = formatShareMarketDate(date.startDate);\n const stallLines = date.stallTypes.map(formatShareStallLine);\n return [`- ${formattedDate}`, ...stallLines].join(\"\\n\");\n });\n\n return `${SHARE_MARKET_DATES_SECTION_HEADING}\\n${dateBlocks.join(\"\\n\")}`;\n}\n\n/** Bulleted requirements list for invitation share copy. */\nexport function formatShareInvitationRequirementsSection(\n requirementLabels: string[],\n): string {\n const bullets = requirementLabels.map((label) => `- ${label}`);\n return `${SHARE_REQUIREMENTS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Bulleted categories list for application share copy. */\nexport function formatShareApplicationCategoriesSection(\n categoryLabels: string[],\n): string {\n const bullets = categoryLabels.map((label) => `- ${label}`);\n return `${SHARE_CATEGORIES_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\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 formatShareInvitationMarketDatesSection(eventInfo.dateTime),\n `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,\n requirementLabels.length > 0 &&\n formatShareInvitationRequirementsSection(requirementLabels),\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 &&\n formatShareApplicationCategoriesSection(categoryLabels),\n `Stall size: ${vendorInfo.stallInfo.size.width}m × ${vendorInfo.stallInfo.size.depth}m`,\n complianceLabels.length > 0 && `Compliance: ${complianceLabels.join(\", \")}`,\n `Price range: $${vendorInfo.product.priceRange.min} – $${vendorInfo.product.priceRange.max}`,\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\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 joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n} from \"./joinShareDescriptionSections\";\n\nexport {\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n};\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) => {\n const match = line.match(/^([ \\t]*)(.*)$/);\n if (!match) {\n return line;\n }\n const [, leading, rest] = match;\n return leading + rest.trim().replace(/[ \\t]{2,}/g, \" \");\n })\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\nexport function 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 (share sheet message, previews).\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.\n * Sections are joined with {@link OG_DESCRIPTION_LINE_BREAK} (` `).\n */\nexport function normalizeShareOgDescription(value: string): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(value));\n}\n\n/**\n * Quote text for Facebook ShareDialog on iOS (`ShareLinkContent.quote`).\n *\n * Title + blank lines + body sections. URL is omitted — `contentUrl` supplies\n * the link card (OG on `/share/*` controls card title/image).\n */\nexport function buildFacebookShareQuote(\n title: string,\n description: string,\n): string | undefined {\n const titleSection = normalizeShareSection(title);\n const body = formatShareSectionsForMultilineDisplay(\n normalizeShareSection(description),\n );\n const sections = [titleSection, body].filter((section) => section.length > 0);\n const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();\n return quote.length > 0 ? quote : undefined;\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/**\n * Open Graph / Twitter description — body sections only (`og:title` is separate).\n * Multiline / legacy ` · ` input is split into sections, then joined with ` `.\n */\nexport function buildShareOgDescription(\n _title: string,\n description: string,\n): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;ACAA,mBAAkB;AAClB,+BAA8B;AAC9B,2BAA0B;AAC1B,sBAAqB;AACrB,iBAAgB;AAET,IAAM,aAAa;AACnB,IAAM,aAAa;AAG1B,aAAAA,QAAM,OAAO,yBAAAC,OAAiB;AAC9B,aAAAD,QAAM,OAAO,WAAAE,OAAG;AAChB,aAAAF,QAAM,OAAO,gBAAAG,OAAQ;AACrB,aAAAH,QAAM,OAAO,qBAAAI,OAAa;AA2BnB,IAAM,aAAa,CACxB,SACA,UAAsB,YACtB,YACG;AAEH,QAAM,cAAc,UAAU,GAAG,OAAO,IAAI,OAAO,KAAK;AAGxD,QAAM,WAAW,cACb,aAAAC,SAAM,aAAa,GAAG,UAAU,IAAI,UA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BAAmB,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":["dayjs","customParseFormat","utc","timezone","isSameOrAfter","dayjs"]}
|
|
1
|
+
{"version":3,"sources":["../../src/sharing/index.ts","../../src/utils/date.ts","../../src/sharing/relationShareTypes.ts","../../src/sharing/constants.ts","../../src/sharing/formatCategoryLabel.ts","../../src/sharing/joinShareDescriptionSections.ts","../../src/sharing/buildRelationShareDescription.ts","../../src/sharing/buildShareUrl.ts","../../src/sharing/normalizeShareDescription.ts","../../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["export * from \"./buildRelationShareDescription\";\nexport * from \"./shareRelationTypes\";\nexport * from \"./buildShareUrl\";\nexport * from \"./constants\";\nexport * from \"./formatCategoryLabel\";\nexport * from \"./joinShareDescriptionSections\";\nexport * from \"./normalizeShareDescription\";\nexport * from \"./normalizeShareRouteId\";\nexport * from \"./relationShareTypes\";\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\nexport const dateFormat = \"DD-MM-YYYY\";\nexport const timeFormat = \"HH:mm\";\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 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 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\" && !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 || !dates.length) {\n return [];\n }\n\n return [...dates].sort((a, b) => {\n const dateTimeFormat = `${dateFormat} ${timeFormat}`;\n const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);\n const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);\n return dateA.valueOf() - dateB.valueOf(); // chronological order\n });\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\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/** 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/** Footer on share sheet messages, Facebook SDK quote, and `og:description`. */\nexport const SHARE_MORE_INFO_LINE = \"More info in the ClueMart app\";\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 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","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 ` `.\n */\nexport const OG_DESCRIPTION_LINE_BREAK = \" \";\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/** Appends the standard share footer when assembling sheet / SDK quote text. */\nexport function appendShareMoreInfoLine(description: string): string {\n const trimmed = description.trim();\n if (trimmed.endsWith(SHARE_MORE_INFO_LINE)) {\n return trimmed;\n }\n if (trimmed.length === 0) {\n return SHARE_MORE_INFO_LINE;\n }\n return joinShareDescriptionSections([trimmed, SHARE_MORE_INFO_LINE]);\n}\n","import { formatDate } from \"../utils/date\";\n\nimport {\n SHARE_CATEGORIES_SECTION_HEADING,\n SHARE_MARKET_DATES_SECTION_HEADING,\n SHARE_REQUIREMENTS_SECTION_HEADING,\n} from \"./constants\";\nimport { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareStallType,\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\n/** Formats event `startDate` (`DD-MM-YYYY`) for share copy — same as share preview UI. */\nexport function formatShareMarketDate(dateStr: string): string {\n return formatDate(dateStr, \"date\");\n}\n\nexport function formatStallCapacityLabel(stallCapacity: number): string {\n return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : \" - Full\";\n}\n\nfunction formatShareStallLine(stall: ShareStallType): string {\n return ` - ${stall.label} — $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`;\n}\n\n/** Nested market dates + per-date stall lines for invitation share copy. */\nexport function formatShareInvitationMarketDatesSection(\n dateTime: ShareEventInfoForInvitation[\"dateTime\"],\n): string {\n const dateBlocks = dateTime.map((date) => {\n const formattedDate = formatShareMarketDate(date.startDate);\n const stallLines = date.stallTypes.map(formatShareStallLine);\n return [`- ${formattedDate}`, ...stallLines].join(\"\\n\");\n });\n\n return `${SHARE_MARKET_DATES_SECTION_HEADING}\\n${dateBlocks.join(\"\\n\")}`;\n}\n\n/** Bulleted requirements list for invitation share copy. */\nexport function formatShareInvitationRequirementsSection(\n requirementLabels: string[],\n): string {\n const bullets = requirementLabels.map((label) => `- ${label}`);\n return `${SHARE_REQUIREMENTS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Bulleted categories list for application share copy. */\nexport function formatShareApplicationCategoriesSection(\n categoryLabels: string[],\n): string {\n const bullets = categoryLabels.map((label) => `- ${label}`);\n return `${SHARE_CATEGORIES_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\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 formatShareInvitationMarketDatesSection(eventInfo.dateTime),\n `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,\n requirementLabels.length > 0 &&\n formatShareInvitationRequirementsSection(requirementLabels),\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 &&\n formatShareApplicationCategoriesSection(categoryLabels),\n `Stall size: ${vendorInfo.stallInfo.size.width}m × ${vendorInfo.stallInfo.size.depth}m`,\n complianceLabels.length > 0 && `Compliance: ${complianceLabels.join(\", \")}`,\n `Price range: $${vendorInfo.product.priceRange.min} – $${vendorInfo.product.priceRange.max}`,\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\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\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 appendShareMoreInfoLine,\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n} from \"./joinShareDescriptionSections\";\n\nexport {\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n};\n\n/** Trims share text and collapses spaces per line; preserves `\\n\\n` section breaks. */\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 match = line.match(/^([ \\t]*)(.*)$/);\n if (!match) {\n return line;\n }\n const [, leading, rest] = match;\n return leading + rest.trim().replace(/[ \\t]{2,}/g, \" \");\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} (` `).\n */\nexport function normalizeShareOgDescription(value: string): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(value));\n}\n\n/**\n * Quote text for Facebook ShareDialog on iOS (`ShareLinkContent.quote`).\n *\n * Title + blank lines + body sections. URL is omitted — `contentUrl` supplies\n * the link card (OG on `/share/*` controls card title/image).\n */\nexport function buildFacebookShareQuote(\n title: string,\n description: string,\n): string | undefined {\n const titleSection = normalizeShareText(title);\n const body = appendShareMoreInfoLine(normalizeShareText(description));\n const sections = [titleSection, body].filter((section) => section.length > 0);\n const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();\n return quote.length > 0 ? quote : undefined;\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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;ACAA,mBAAkB;AAClB,+BAA8B;AAC9B,2BAA0B;AAC1B,sBAAqB;AACrB,iBAAgB;AAET,IAAM,aAAa;AACnB,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UAAU,YAAY,IAAI,mBAAmB,sBAAsB,KAAK,CAAC,CAAC;AACnF;","names":["dayjs","customParseFormat","utc","timezone","isSameOrAfter","dayjs"]}
|
package/dist/sharing/index.d.mts
CHANGED
|
@@ -80,8 +80,6 @@ declare function isRelationShareResourceType(resourceType: string): resourceType
|
|
|
80
80
|
/** Path segments for public resource share URLs (markets, posts, etc.). */
|
|
81
81
|
declare const PUBLIC_SHARE_PATH_TYPES: readonly ["market", "stallholder", "partner", "daily_meets", "daily_tips", "daily_games"];
|
|
82
82
|
type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];
|
|
83
|
-
/** @deprecated Use {@link PUBLIC_SHARE_PATH_TYPES} — kept for mobile deep-link helpers. */
|
|
84
|
-
declare const RESOURCE_SHARE_TYPES_FOR_URL: readonly ["market", "stallholder", "partner", "daily_meets", "daily_tips", "daily_games"];
|
|
85
83
|
type RelationSharePathType = typeof RELATION_SHARE_INVITATION | typeof RELATION_SHARE_APPLICATION;
|
|
86
84
|
type ShareType = PublicSharePathType | RelationSharePathType;
|
|
87
85
|
/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */
|
|
@@ -98,6 +96,8 @@ declare const SHARE_REQUIREMENTS_SECTION_HEADING = "\u2705 Requirements:";
|
|
|
98
96
|
/** Label tag for application categories share copy (U+1F3F7 🏷️). */
|
|
99
97
|
declare const SHARE_CATEGORY_ICON = "\uD83C\uDFF7\uFE0F";
|
|
100
98
|
declare const SHARE_CATEGORIES_SECTION_HEADING = "\uD83C\uDFF7\uFE0F Categories:";
|
|
99
|
+
/** Footer on share sheet messages, Facebook SDK quote, and `og:description`. */
|
|
100
|
+
declare const SHARE_MORE_INFO_LINE = "More info in the ClueMart app";
|
|
101
101
|
declare const DEFAULT_SHARE_OG_IMAGE = "https://cluemart.co.nz/assets/logo.webp";
|
|
102
102
|
declare const RESOURCE_SHARE_TYPES: readonly ["market", "stallholder", "partner"];
|
|
103
103
|
type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];
|
|
@@ -109,8 +109,6 @@ declare function isPostShareResourceType(resourceType: ShareResourceType): resou
|
|
|
109
109
|
|
|
110
110
|
declare function formatCategoryLabel(category: ShareVendorCategory): string;
|
|
111
111
|
|
|
112
|
-
/** Visible separator for multi-block share text when line breaks are stripped (legacy OG). */
|
|
113
|
-
declare const SHARE_DESCRIPTION_SECTION_SEPARATOR = " \u00B7 ";
|
|
114
112
|
/** Blank line between share sections — title, address, dates, URL, etc. */
|
|
115
113
|
declare const SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
|
|
116
114
|
/**
|
|
@@ -121,16 +119,12 @@ declare const OG_DESCRIPTION_LINE_BREAK = " ";
|
|
|
121
119
|
/** Joins OG description sections for Facebook link cards (and Twitter). */
|
|
122
120
|
declare function joinShareOgDescriptionSections(sections: ReadonlyArray<string | false | null | undefined>): string;
|
|
123
121
|
declare function joinShareDescriptionSections(sections: ReadonlyArray<string | false | null | undefined>): string;
|
|
122
|
+
/** Appends the standard share footer when assembling sheet / SDK quote text. */
|
|
123
|
+
declare function appendShareMoreInfoLine(description: string): string;
|
|
124
124
|
|
|
125
|
+
/** Trims share text and collapses spaces per line; preserves `\n\n` section breaks. */
|
|
126
|
+
declare function normalizeShareText(value: string | null | undefined): string;
|
|
125
127
|
declare function splitShareDescriptionSections(value: string): string[];
|
|
126
|
-
/**
|
|
127
|
-
* Share copy with a blank line between each section (share sheet message, previews).
|
|
128
|
-
*/
|
|
129
|
-
declare function formatShareSectionsForMultilineDisplay(value: string): string;
|
|
130
|
-
/**
|
|
131
|
-
* Formats multiline share copy for UIs that strip line breaks (legacy OG one-liners).
|
|
132
|
-
*/
|
|
133
|
-
declare function formatShareSectionsForCompactDisplay(value: string): string;
|
|
134
128
|
/**
|
|
135
129
|
* Formats share descriptions for Open Graph / Twitter meta tags.
|
|
136
130
|
* Sections are joined with {@link OG_DESCRIPTION_LINE_BREAK} (` `).
|
|
@@ -148,13 +142,10 @@ declare function buildFacebookShareQuote(title: string, description: string): st
|
|
|
148
142
|
* Prefer {@link joinShareOgDescriptionSections} when sections are already known.
|
|
149
143
|
*/
|
|
150
144
|
declare function buildShareOgDescriptionFromSections(sections: ReadonlyArray<string | false | null | undefined>): string;
|
|
151
|
-
/**
|
|
152
|
-
* Open Graph / Twitter description — body sections only (`og:title` is separate).
|
|
153
|
-
* Multiline / legacy ` · ` input is split into sections, then joined with ` `.
|
|
154
|
-
*/
|
|
145
|
+
/** Open Graph / Twitter description — body sections only (`og:title` is separate). */
|
|
155
146
|
declare function buildShareOgDescription(_title: string, description: string): string;
|
|
156
147
|
|
|
157
148
|
declare function normalizeShareRouteId(id: string): string;
|
|
158
149
|
declare function buildSharePagePath(resourceType: ShareResourceType, rawId: string): string;
|
|
159
150
|
|
|
160
|
-
export { DEFAULT_SHARE_OG_IMAGE, OG_DESCRIPTION_LINE_BREAK, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES,
|
|
151
|
+
export { DEFAULT_SHARE_OG_IMAGE, OG_DESCRIPTION_LINE_BREAK, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES, type RelationSharePathType, type RelationShareResourceType, type ResourceShareType, SHARE_CALENDAR_ICON, SHARE_CATEGORIES_SECTION_HEADING, SHARE_CATEGORY_ICON, SHARE_CHECKMARK_ICON, SHARE_DESCRIPTION_SECTION_BREAK, SHARE_MARKET_DATES_SECTION_HEADING, SHARE_MORE_INFO_LINE, SHARE_REQUIREMENTS_SECTION_HEADING, SHARE_RESOURCE_LABEL, SHARE_SITE_URL, SHARE_TYPE_PATH_REGEX, type ShareEventDateTime, type ShareEventForInvitation, type ShareEventInfoForInvitation, type ShareResourceType, type ShareStallType, type ShareType, type ShareVendorCategory, type ShareVendorForApplication, type ShareVendorInfoForApplication, appendShareMoreInfoLine, buildApplicationShareDescription, buildFacebookShareQuote, buildInvitationShareDescription, buildShareOgDescription, buildShareOgDescriptionFromSections, buildSharePagePath, buildShareUrl, formatCategoryLabel, formatShareApplicationCategoriesSection, formatShareInvitationMarketDatesSection, formatShareInvitationRequirementsSection, formatShareMarketDate, formatStallCapacityLabel, isPostShareResourceType, isRelationShareResourceType, joinShareDescriptionSections, joinShareOgDescriptionSections, normalizeShareOgDescription, normalizeShareRouteId, normalizeShareText, splitShareDescriptionSections };
|
package/dist/sharing/index.d.ts
CHANGED
|
@@ -80,8 +80,6 @@ declare function isRelationShareResourceType(resourceType: string): resourceType
|
|
|
80
80
|
/** Path segments for public resource share URLs (markets, posts, etc.). */
|
|
81
81
|
declare const PUBLIC_SHARE_PATH_TYPES: readonly ["market", "stallholder", "partner", "daily_meets", "daily_tips", "daily_games"];
|
|
82
82
|
type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];
|
|
83
|
-
/** @deprecated Use {@link PUBLIC_SHARE_PATH_TYPES} — kept for mobile deep-link helpers. */
|
|
84
|
-
declare const RESOURCE_SHARE_TYPES_FOR_URL: readonly ["market", "stallholder", "partner", "daily_meets", "daily_tips", "daily_games"];
|
|
85
83
|
type RelationSharePathType = typeof RELATION_SHARE_INVITATION | typeof RELATION_SHARE_APPLICATION;
|
|
86
84
|
type ShareType = PublicSharePathType | RelationSharePathType;
|
|
87
85
|
/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */
|
|
@@ -98,6 +96,8 @@ declare const SHARE_REQUIREMENTS_SECTION_HEADING = "\u2705 Requirements:";
|
|
|
98
96
|
/** Label tag for application categories share copy (U+1F3F7 🏷️). */
|
|
99
97
|
declare const SHARE_CATEGORY_ICON = "\uD83C\uDFF7\uFE0F";
|
|
100
98
|
declare const SHARE_CATEGORIES_SECTION_HEADING = "\uD83C\uDFF7\uFE0F Categories:";
|
|
99
|
+
/** Footer on share sheet messages, Facebook SDK quote, and `og:description`. */
|
|
100
|
+
declare const SHARE_MORE_INFO_LINE = "More info in the ClueMart app";
|
|
101
101
|
declare const DEFAULT_SHARE_OG_IMAGE = "https://cluemart.co.nz/assets/logo.webp";
|
|
102
102
|
declare const RESOURCE_SHARE_TYPES: readonly ["market", "stallholder", "partner"];
|
|
103
103
|
type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];
|
|
@@ -109,8 +109,6 @@ declare function isPostShareResourceType(resourceType: ShareResourceType): resou
|
|
|
109
109
|
|
|
110
110
|
declare function formatCategoryLabel(category: ShareVendorCategory): string;
|
|
111
111
|
|
|
112
|
-
/** Visible separator for multi-block share text when line breaks are stripped (legacy OG). */
|
|
113
|
-
declare const SHARE_DESCRIPTION_SECTION_SEPARATOR = " \u00B7 ";
|
|
114
112
|
/** Blank line between share sections — title, address, dates, URL, etc. */
|
|
115
113
|
declare const SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
|
|
116
114
|
/**
|
|
@@ -121,16 +119,12 @@ declare const OG_DESCRIPTION_LINE_BREAK = " ";
|
|
|
121
119
|
/** Joins OG description sections for Facebook link cards (and Twitter). */
|
|
122
120
|
declare function joinShareOgDescriptionSections(sections: ReadonlyArray<string | false | null | undefined>): string;
|
|
123
121
|
declare function joinShareDescriptionSections(sections: ReadonlyArray<string | false | null | undefined>): string;
|
|
122
|
+
/** Appends the standard share footer when assembling sheet / SDK quote text. */
|
|
123
|
+
declare function appendShareMoreInfoLine(description: string): string;
|
|
124
124
|
|
|
125
|
+
/** Trims share text and collapses spaces per line; preserves `\n\n` section breaks. */
|
|
126
|
+
declare function normalizeShareText(value: string | null | undefined): string;
|
|
125
127
|
declare function splitShareDescriptionSections(value: string): string[];
|
|
126
|
-
/**
|
|
127
|
-
* Share copy with a blank line between each section (share sheet message, previews).
|
|
128
|
-
*/
|
|
129
|
-
declare function formatShareSectionsForMultilineDisplay(value: string): string;
|
|
130
|
-
/**
|
|
131
|
-
* Formats multiline share copy for UIs that strip line breaks (legacy OG one-liners).
|
|
132
|
-
*/
|
|
133
|
-
declare function formatShareSectionsForCompactDisplay(value: string): string;
|
|
134
128
|
/**
|
|
135
129
|
* Formats share descriptions for Open Graph / Twitter meta tags.
|
|
136
130
|
* Sections are joined with {@link OG_DESCRIPTION_LINE_BREAK} (` `).
|
|
@@ -148,13 +142,10 @@ declare function buildFacebookShareQuote(title: string, description: string): st
|
|
|
148
142
|
* Prefer {@link joinShareOgDescriptionSections} when sections are already known.
|
|
149
143
|
*/
|
|
150
144
|
declare function buildShareOgDescriptionFromSections(sections: ReadonlyArray<string | false | null | undefined>): string;
|
|
151
|
-
/**
|
|
152
|
-
* Open Graph / Twitter description — body sections only (`og:title` is separate).
|
|
153
|
-
* Multiline / legacy ` · ` input is split into sections, then joined with ` `.
|
|
154
|
-
*/
|
|
145
|
+
/** Open Graph / Twitter description — body sections only (`og:title` is separate). */
|
|
155
146
|
declare function buildShareOgDescription(_title: string, description: string): string;
|
|
156
147
|
|
|
157
148
|
declare function normalizeShareRouteId(id: string): string;
|
|
158
149
|
declare function buildSharePagePath(resourceType: ShareResourceType, rawId: string): string;
|
|
159
150
|
|
|
160
|
-
export { DEFAULT_SHARE_OG_IMAGE, OG_DESCRIPTION_LINE_BREAK, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES,
|
|
151
|
+
export { DEFAULT_SHARE_OG_IMAGE, OG_DESCRIPTION_LINE_BREAK, POST_SHARE_RESOURCE_TYPES, PUBLIC_SHARE_PATH_TYPES, type PostShareResourceType, type PublicSharePathType, RELATION_SHARE_APPLICATION, RELATION_SHARE_INVITATION, RELATION_SHARE_RESOURCE_TYPES, RESOURCE_SHARE_TYPES, type RelationSharePathType, type RelationShareResourceType, type ResourceShareType, SHARE_CALENDAR_ICON, SHARE_CATEGORIES_SECTION_HEADING, SHARE_CATEGORY_ICON, SHARE_CHECKMARK_ICON, SHARE_DESCRIPTION_SECTION_BREAK, SHARE_MARKET_DATES_SECTION_HEADING, SHARE_MORE_INFO_LINE, SHARE_REQUIREMENTS_SECTION_HEADING, SHARE_RESOURCE_LABEL, SHARE_SITE_URL, SHARE_TYPE_PATH_REGEX, type ShareEventDateTime, type ShareEventForInvitation, type ShareEventInfoForInvitation, type ShareResourceType, type ShareStallType, type ShareType, type ShareVendorCategory, type ShareVendorForApplication, type ShareVendorInfoForApplication, appendShareMoreInfoLine, buildApplicationShareDescription, buildFacebookShareQuote, buildInvitationShareDescription, buildShareOgDescription, buildShareOgDescriptionFromSections, buildSharePagePath, buildShareUrl, formatCategoryLabel, formatShareApplicationCategoriesSection, formatShareInvitationMarketDatesSection, formatShareInvitationRequirementsSection, formatShareMarketDate, formatStallCapacityLabel, isPostShareResourceType, isRelationShareResourceType, joinShareDescriptionSections, joinShareOgDescriptionSections, normalizeShareOgDescription, normalizeShareRouteId, normalizeShareText, splitShareDescriptionSections };
|
package/dist/sharing/index.mjs
CHANGED
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
RELATION_SHARE_INVITATION,
|
|
8
8
|
RELATION_SHARE_RESOURCE_TYPES,
|
|
9
9
|
RESOURCE_SHARE_TYPES,
|
|
10
|
-
RESOURCE_SHARE_TYPES_FOR_URL,
|
|
11
10
|
SHARE_CALENDAR_ICON,
|
|
12
11
|
SHARE_CATEGORIES_SECTION_HEADING,
|
|
13
12
|
SHARE_CATEGORY_ICON,
|
|
14
13
|
SHARE_CHECKMARK_ICON,
|
|
15
14
|
SHARE_DESCRIPTION_SECTION_BREAK,
|
|
16
|
-
SHARE_DESCRIPTION_SECTION_SEPARATOR,
|
|
17
15
|
SHARE_MARKET_DATES_SECTION_HEADING,
|
|
16
|
+
SHARE_MORE_INFO_LINE,
|
|
18
17
|
SHARE_REQUIREMENTS_SECTION_HEADING,
|
|
19
18
|
SHARE_RESOURCE_LABEL,
|
|
20
19
|
SHARE_SITE_URL,
|
|
21
20
|
SHARE_TYPE_PATH_REGEX,
|
|
21
|
+
appendShareMoreInfoLine,
|
|
22
22
|
buildApplicationShareDescription,
|
|
23
23
|
buildFacebookShareQuote,
|
|
24
24
|
buildInvitationShareDescription,
|
|
@@ -31,8 +31,6 @@ import {
|
|
|
31
31
|
formatShareInvitationMarketDatesSection,
|
|
32
32
|
formatShareInvitationRequirementsSection,
|
|
33
33
|
formatShareMarketDate,
|
|
34
|
-
formatShareSectionsForCompactDisplay,
|
|
35
|
-
formatShareSectionsForMultilineDisplay,
|
|
36
34
|
formatStallCapacityLabel,
|
|
37
35
|
isPostShareResourceType,
|
|
38
36
|
isRelationShareResourceType,
|
|
@@ -40,8 +38,9 @@ import {
|
|
|
40
38
|
joinShareOgDescriptionSections,
|
|
41
39
|
normalizeShareOgDescription,
|
|
42
40
|
normalizeShareRouteId,
|
|
41
|
+
normalizeShareText,
|
|
43
42
|
splitShareDescriptionSections
|
|
44
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-A5HI7DTW.mjs";
|
|
45
44
|
import "../chunk-X4VPNOHX.mjs";
|
|
46
45
|
export {
|
|
47
46
|
DEFAULT_SHARE_OG_IMAGE,
|
|
@@ -52,18 +51,18 @@ export {
|
|
|
52
51
|
RELATION_SHARE_INVITATION,
|
|
53
52
|
RELATION_SHARE_RESOURCE_TYPES,
|
|
54
53
|
RESOURCE_SHARE_TYPES,
|
|
55
|
-
RESOURCE_SHARE_TYPES_FOR_URL,
|
|
56
54
|
SHARE_CALENDAR_ICON,
|
|
57
55
|
SHARE_CATEGORIES_SECTION_HEADING,
|
|
58
56
|
SHARE_CATEGORY_ICON,
|
|
59
57
|
SHARE_CHECKMARK_ICON,
|
|
60
58
|
SHARE_DESCRIPTION_SECTION_BREAK,
|
|
61
|
-
SHARE_DESCRIPTION_SECTION_SEPARATOR,
|
|
62
59
|
SHARE_MARKET_DATES_SECTION_HEADING,
|
|
60
|
+
SHARE_MORE_INFO_LINE,
|
|
63
61
|
SHARE_REQUIREMENTS_SECTION_HEADING,
|
|
64
62
|
SHARE_RESOURCE_LABEL,
|
|
65
63
|
SHARE_SITE_URL,
|
|
66
64
|
SHARE_TYPE_PATH_REGEX,
|
|
65
|
+
appendShareMoreInfoLine,
|
|
67
66
|
buildApplicationShareDescription,
|
|
68
67
|
buildFacebookShareQuote,
|
|
69
68
|
buildInvitationShareDescription,
|
|
@@ -76,8 +75,6 @@ export {
|
|
|
76
75
|
formatShareInvitationMarketDatesSection,
|
|
77
76
|
formatShareInvitationRequirementsSection,
|
|
78
77
|
formatShareMarketDate,
|
|
79
|
-
formatShareSectionsForCompactDisplay,
|
|
80
|
-
formatShareSectionsForMultilineDisplay,
|
|
81
78
|
formatStallCapacityLabel,
|
|
82
79
|
isPostShareResourceType,
|
|
83
80
|
isRelationShareResourceType,
|
|
@@ -85,6 +82,7 @@ export {
|
|
|
85
82
|
joinShareOgDescriptionSections,
|
|
86
83
|
normalizeShareOgDescription,
|
|
87
84
|
normalizeShareRouteId,
|
|
85
|
+
normalizeShareText,
|
|
88
86
|
splitShareDescriptionSections
|
|
89
87
|
};
|
|
90
88
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sharing/relationShareTypes.ts","../src/sharing/constants.ts","../src/sharing/formatCategoryLabel.ts","../src/sharing/joinShareDescriptionSections.ts","../src/sharing/buildRelationShareDescription.ts","../src/sharing/buildShareUrl.ts","../src/sharing/normalizeShareDescription.ts","../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["/** 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\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/** 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\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 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\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 ` `.\n */\nexport const OG_DESCRIPTION_LINE_BREAK = \" \";\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","import { formatDate } from \"../utils/date\";\n\nimport {\n SHARE_CATEGORIES_SECTION_HEADING,\n SHARE_MARKET_DATES_SECTION_HEADING,\n SHARE_REQUIREMENTS_SECTION_HEADING,\n} from \"./constants\";\nimport { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareStallType,\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\n/** Formats event `startDate` (`DD-MM-YYYY`) for share copy — same as share preview UI. */\nexport function formatShareMarketDate(dateStr: string): string {\n return formatDate(dateStr, \"date\");\n}\n\nexport function formatStallCapacityLabel(stallCapacity: number): string {\n return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : \" - Full\";\n}\n\nfunction formatShareStallLine(stall: ShareStallType): string {\n return ` - ${stall.label} — $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`;\n}\n\n/** Nested market dates + per-date stall lines for invitation share copy. */\nexport function formatShareInvitationMarketDatesSection(\n dateTime: ShareEventInfoForInvitation[\"dateTime\"],\n): string {\n const dateBlocks = dateTime.map((date) => {\n const formattedDate = formatShareMarketDate(date.startDate);\n const stallLines = date.stallTypes.map(formatShareStallLine);\n return [`- ${formattedDate}`, ...stallLines].join(\"\\n\");\n });\n\n return `${SHARE_MARKET_DATES_SECTION_HEADING}\\n${dateBlocks.join(\"\\n\")}`;\n}\n\n/** Bulleted requirements list for invitation share copy. */\nexport function formatShareInvitationRequirementsSection(\n requirementLabels: string[],\n): string {\n const bullets = requirementLabels.map((label) => `- ${label}`);\n return `${SHARE_REQUIREMENTS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Bulleted categories list for application share copy. */\nexport function formatShareApplicationCategoriesSection(\n categoryLabels: string[],\n): string {\n const bullets = categoryLabels.map((label) => `- ${label}`);\n return `${SHARE_CATEGORIES_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\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 formatShareInvitationMarketDatesSection(eventInfo.dateTime),\n `Application deadline: vendors must apply at least ${eventInfo.applicationDeadlineHours} hours before each market date.`,\n requirementLabels.length > 0 &&\n formatShareInvitationRequirementsSection(requirementLabels),\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 &&\n formatShareApplicationCategoriesSection(categoryLabels),\n `Stall size: ${vendorInfo.stallInfo.size.width}m × ${vendorInfo.stallInfo.size.depth}m`,\n complianceLabels.length > 0 && `Compliance: ${complianceLabels.join(\", \")}`,\n `Price range: $${vendorInfo.product.priceRange.min} – $${vendorInfo.product.priceRange.max}`,\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\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 joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n} from \"./joinShareDescriptionSections\";\n\nexport {\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n SHARE_DESCRIPTION_SECTION_SEPARATOR,\n};\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) => {\n const match = line.match(/^([ \\t]*)(.*)$/);\n if (!match) {\n return line;\n }\n const [, leading, rest] = match;\n return leading + rest.trim().replace(/[ \\t]{2,}/g, \" \");\n })\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\nexport function 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 (share sheet message, previews).\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.\n * Sections are joined with {@link OG_DESCRIPTION_LINE_BREAK} (` `).\n */\nexport function normalizeShareOgDescription(value: string): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(value));\n}\n\n/**\n * Quote text for Facebook ShareDialog on iOS (`ShareLinkContent.quote`).\n *\n * Title + blank lines + body sections. URL is omitted — `contentUrl` supplies\n * the link card (OG on `/share/*` controls card title/image).\n */\nexport function buildFacebookShareQuote(\n title: string,\n description: string,\n): string | undefined {\n const titleSection = normalizeShareSection(title);\n const body = formatShareSectionsForMultilineDisplay(\n normalizeShareSection(description),\n );\n const sections = [titleSection, body].filter((section) => section.length > 0);\n const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();\n return quote.length > 0 ? quote : undefined;\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/**\n * Open Graph / Twitter description — body sections only (`og:title` is separate).\n * Multiline / legacy ` · ` input is split into sections, then joined with ` `.\n */\nexport function buildShareOgDescription(\n _title: string,\n description: string,\n): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(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":";;;;;AACO,IAAM,4BAA4B;AAClC,IAAM,6BAA6B;AAEnC,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;AAKO,SAAS,4BACd,cAC2C;AAC3C,SAAQ,8BAAoD;AAAA,IAC1D;AAAA,EACF;AACF;;;ACJO,IAAM,iBAAiB;AAGvB,IAAM,sBAAsB;AAE5B,IAAM,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