@timardex/cluemart-shared 1.5.803 → 1.5.805

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.
@@ -64,7 +64,7 @@ import {
64
64
  statusOptions,
65
65
  toCalendarIsoDate,
66
66
  truncateText
67
- } from "../chunk-6633VMDB.mjs";
67
+ } from "../chunk-RITKFYRI.mjs";
68
68
  import "../chunk-YVIZ4AWF.mjs";
69
69
  import {
70
70
  dateFormat,
@@ -79,7 +79,7 @@ import {
79
79
  sortDatesChronologically,
80
80
  timeFormat,
81
81
  toNZTime
82
- } from "../chunk-E7ZEBZ3O.mjs";
82
+ } from "../chunk-4TP57ZL7.mjs";
83
83
  import "../chunk-LETM2YHF.mjs";
84
84
  export {
85
85
  ANDROID_URL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timardex/cluemart-shared",
3
- "version": "1.5.803",
3
+ "version": "1.5.805",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sharing/formatCategoryLabel.ts","../src/sharing/buildRelationShareDescription.ts","../src/sharing/buildPublicShareDescription.ts","../src/sharing/buildShareUrl.ts","../src/sharing/normalizeShareRouteId.ts","../src/sharing/shareSlugResource.ts"],"sourcesContent":["import type { Category } from \"../types/global\";\n\nexport function formatCategoryLabel(category: Category): 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 type { StallType } from \"../types/event\";\nimport { formatDate } from \"../utils/date\";\n\nimport {\n SHARE_APPLICATION_DEADLINE_PREFIX,\n SHARE_CATEGORIES_SECTION_HEADING,\n SHARE_FOOD_TRUCK_LINE,\n SHARE_MARKET_DATES_SECTION_HEADING,\n SHARE_RAIN_OR_SHINE_LINE,\n SHARE_REQUIREMENTS_SECTION_HEADING,\n SHARE_COMPLIANCE_PREFIX,\n SHARE_PRICE_RANGE_PREFIX,\n SHARE_STALL_SIZE_PREFIX,\n SHARE_TAGS_SECTION_HEADING,\n} from \"./constants\";\nimport { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nexport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\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\nexport function formatShareStallLine(stall: StallType): 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\nexport function formatShareRainOrShineLine(\n rainOrShine: boolean,\n): string | null {\n return rainOrShine ? SHARE_RAIN_OR_SHINE_LINE : null;\n}\n\nexport function formatShareIsFoodTrueLine(foodTruck: boolean): string | null {\n return foodTruck ? SHARE_FOOD_TRUCK_LINE : null;\n}\n\n/** Bulleted requirements list for invitation share copy. */\nexport function formatShareInvitationRequirementsSection(\n requirements: ShareEventInfoForInvitation[\"requirements\"] | null,\n): string | null {\n const bullets = (requirements ?? [])\n .filter((item) => item.value)\n .map((item) => item.label.trim())\n .filter((label) => label.length > 0)\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_REQUIREMENTS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\nexport function formatShareTagsSection(tags: string[]): string | null {\n const bullets = tags\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0)\n .map((tag) => `- ${tag}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_TAGS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Bulleted categories list for application share copy. */\nexport function formatShareApplicationCategoriesSection(\n categories: ShareVendorForApplication[\"categories\"],\n): string | null {\n const bullets = categories\n .map((category) => formatCategoryLabel(category).trim())\n .filter((label) => label.length > 0)\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_CATEGORIES_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Stall dimensions line for application share copy. */\nexport function formatShareApplicationStallSizeLine(size: {\n width: string;\n depth: string;\n}): string {\n return `${SHARE_STALL_SIZE_PREFIX} ${size.width}m × ${size.depth}m`;\n}\n\n/** Bulleted compliance list for application share copy. */\nexport function formatShareApplicationComplianceSection(\n compliance: ShareVendorInfoForApplication[\"compliance\"],\n): string | null {\n const bullets = [\n compliance?.liabilityInsurance && \"Liability insurance\",\n compliance?.foodBeverageLicense && \"Food & beverage licence\",\n ]\n .filter((label): label is string => Boolean(label))\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_COMPLIANCE_PREFIX}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Price range line for application share copy. */\nexport function formatShareApplicationPriceRangeLine(priceRange: {\n min: string;\n max: string;\n}): string {\n return `${SHARE_PRICE_RANGE_PREFIX} $${priceRange.min} – $${priceRange.max}`;\n}\n\n/** Application-deadline sentence for invitation share copy. */\nexport function formatShareInvitationApplicationDeadlineLine(\n applicationDeadlineHours: number,\n): string {\n return `${SHARE_APPLICATION_DEADLINE_PREFIX} vendors must apply at least ${applicationDeadlineHours} hours before each market date.`;\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 sections = [\n event.location.fullAddress,\n formatShareRainOrShineLine(event.rainOrShine),\n formatShareTagsSection(event.tags),\n formatShareInvitationMarketDatesSection(eventInfo.dateTime),\n formatShareInvitationApplicationDeadlineLine(\n eventInfo.applicationDeadlineHours,\n ),\n formatShareInvitationRequirementsSection(eventInfo.requirements),\n ];\n\n return joinShareDescriptionSections(sections);\n}\n\nexport function buildApplicationShareDescription(\n vendor: ShareVendorForApplication,\n vendorInfo: ShareVendorInfoForApplication | null | undefined,\n): string {\n if (!vendorInfo) {\n return vendor.description?.trim() || \"\";\n }\n\n const profileDescription = vendor.description?.trim();\n\n const sections = [\n formatShareIsFoodTrueLine(vendor.foodTruck),\n formatShareApplicationCategoriesSection(vendor.categories),\n formatShareApplicationStallSizeLine(vendorInfo.stallInfo.size),\n formatShareApplicationComplianceSection(vendorInfo.compliance),\n formatShareApplicationPriceRangeLine(vendorInfo.product.priceRange),\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n","import {\n formatShareIsFoodTrueLine,\n formatShareRainOrShineLine,\n formatShareTagsSection,\n} from \"./buildRelationShareDescription\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\n\n/** Minimal event fields for public (market) share copy — matches in-app preview. */\nexport type ShareEventForPublic = {\n description?: string | null;\n rainOrShine: boolean;\n tags: string[];\n};\n\n/** Minimal vendor fields for public (stallholder) share copy — matches in-app preview. */\nexport type ShareVendorForPublic = {\n description?: string | null;\n foodTruck: boolean;\n};\n\nexport function buildPublicEventShareDescription(\n event: ShareEventForPublic,\n): string {\n return joinShareDescriptionSections([\n formatShareRainOrShineLine(event.rainOrShine),\n formatShareTagsSection(event.tags),\n event.description?.trim(),\n ]);\n}\n\nexport function buildPublicVendorShareDescription(\n vendor: ShareVendorForPublic,\n): string {\n return joinShareDescriptionSections([\n formatShareIsFoodTrueLine(vendor.foodTruck),\n vendor.description?.trim(),\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\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(\n type: ShareType,\n slug: string,\n utmMedium: string = \"app\",\n): string {\n return `${SHARE_SITE_URL}/${type}/${encodeURIComponent(slug)}?utm_source=share&utm_medium=${utmMedium}&utm_campaign=${type}`;\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\n/** Relative path for a public share landing page (`/market/demo-market`). */\nexport function buildSharePagePath(\n resourceType: ShareResourceType,\n slug: string,\n): string {\n return `/${resourceType}/${encodeURIComponent(normalizeShareRouteId(slug))}`;\n}\n","export type ShareSlugResource = {\n _id: string;\n};\n\nexport function shareSlugResourceId(\n resource: ShareSlugResource | null | undefined,\n): string | null {\n return resource?._id ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEO,SAAS,oBAAoB,UAA4B;AAC9D,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;;;ACoBO,SAAS,sBAAsB,SAAyB;AAC7D,SAAO,WAAW,SAAS,MAAM;AACnC;AAEO,SAAS,yBAAyB,eAA+B;AACtE,SAAO,gBAAgB,IAAI,KAAK,aAAa,uBAAuB;AACtE;AAEO,SAAS,qBAAqB,OAA0B;AAC7D,SAAO,QAAQ,MAAM,KAAK,YAAO,MAAM,KAAK,GAAG,yBAAyB,MAAM,aAAa,CAAC;AAC9F;AAGO,SAAS,wCACd,UACQ;AACR,QAAM,aAAa,SAAS,IAAI,CAAC,SAAS;AACxC,UAAM,gBAAgB,sBAAsB,KAAK,SAAS;AAC1D,UAAM,aAAa,KAAK,WAAW,IAAI,oBAAoB;AAC3D,WAAO,CAAC,KAAK,aAAa,IAAI,GAAG,UAAU,EAAE,KAAK,IAAI;AAAA,EACxD,CAAC;AAED,SAAO,GAAG,kCAAkC;AAAA,EAAK,WAAW,KAAK,IAAI,CAAC;AACxE;AAEO,SAAS,2BACd,aACe;AACf,SAAO,cAAc,2BAA2B;AAClD;AAEO,SAAS,0BAA0B,WAAmC;AAC3E,SAAO,YAAY,wBAAwB;AAC7C;AAGO,SAAS,yCACd,cACe;AACf,QAAM,WAAW,gBAAgB,CAAC,GAC/B,OAAO,CAAC,SAAS,KAAK,KAAK,E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