@timardex/cluemart-shared 1.5.792 → 1.5.794

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +1,22 @@
1
1
  import {
2
- CLUEMART_MAIN_DOMAIN_URL,
3
- formatDate
4
- } from "./chunk-G4HKDB7T.mjs";
5
-
6
- // src/sharing/relationShareTypes.ts
7
- var RELATION_SHARE_INVITATION = "invitation";
8
- var RELATION_SHARE_APPLICATION = "application";
9
- var RELATION_OVERLAY_LAYOUT_VERSION = 36;
10
- var RELATION_SHARE_RESOURCE_TYPES = [
2
+ POST_SHARE_RESOURCE_TYPES,
3
+ RELATION_SHARE_APPLICATION,
11
4
  RELATION_SHARE_INVITATION,
12
- RELATION_SHARE_APPLICATION
13
- ];
14
- function isRelationShareResourceType(resourceType) {
15
- return RELATION_SHARE_RESOURCE_TYPES.includes(
16
- resourceType
17
- );
18
- }
19
-
20
- // src/sharing/constants.ts
21
- var SOCIAL_IMAGE_WIDTH = 1200;
22
- var SOCIAL_IMAGE_HEIGHT = 630;
23
- var SHARE_SITE_URL = CLUEMART_MAIN_DOMAIN_URL;
24
- var SHARE_CALENDAR_ICON = "\u{1F4C5}";
25
- var SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;
26
- var SHARE_CHECKMARK_ICON = "\u2705";
27
- var SHARE_REQUIREMENTS_SECTION_HEADING = `${SHARE_CHECKMARK_ICON} Requirements:`;
28
- var SHARE_INFO_ICON = "\u2139\uFE0F";
29
- var SHARE_TAGS_SECTION_HEADING = `${SHARE_INFO_ICON} Tags:`;
30
- var SHARE_RAIN_OR_SHINE_LINE = "Rain or Shine";
31
- var SHARE_FOOD_TRUCK_LINE = "Food Truck";
32
- var SHARE_COMPLIANCE_PREFIX = `${SHARE_CHECKMARK_ICON} Compliance:`;
33
- var SHARE_CATEGORY_ICON = "\u{1F3F7}\uFE0F";
34
- var SHARE_CATEGORIES_SECTION_HEADING = `${SHARE_CATEGORY_ICON} Categories:`;
35
- var SHARE_RULER_ICON = "\u{1F4CF}";
36
- var SHARE_STALL_SIZE_PREFIX = `${SHARE_RULER_ICON} Stall size:`;
37
- var SHARE_DOLLAR_ICON = "$";
38
- var SHARE_PRICE_RANGE_PREFIX = `${SHARE_DOLLAR_ICON} Price range:`;
39
- var SHARE_CLOCK_ICON = "\u23F0";
40
- var SHARE_APPLICATION_DEADLINE_PREFIX = `${SHARE_CLOCK_ICON} Application deadline:`;
41
- var SHARE_MORE_INFO_LINE = "Shared from ClueMart";
42
- var DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;
43
- var RESOURCE_SHARE_TYPES = [
44
- "market",
45
- "stallholder",
46
- "partner",
47
- "affiliate",
48
- "school"
49
- ];
50
- var POST_SHARE_RESOURCE_TYPES = [
51
- "market_faces",
52
- "clue_bites",
53
- "play_and_win"
54
- ];
55
- var SHARE_RESOURCE_LABEL = {
56
- [RELATION_SHARE_APPLICATION]: "Application",
57
- [RELATION_SHARE_INVITATION]: "Invitation",
58
- clue_bites: "Clue Bites",
59
- market_faces: "Market Faces",
60
- play_and_win: "Play & Win",
61
- market: "Market",
62
- partner: "Partner",
63
- stallholder: "Stallholder",
64
- affiliate: "Affiliate",
65
- school: "School"
66
- };
67
- function isPostShareResourceType(resourceType) {
68
- return POST_SHARE_RESOURCE_TYPES.includes(
69
- resourceType
70
- );
71
- }
5
+ RESOURCE_SHARE_TYPES,
6
+ SHARE_APPLICATION_DEADLINE_PREFIX,
7
+ SHARE_CATEGORIES_SECTION_HEADING,
8
+ SHARE_COMPLIANCE_PREFIX,
9
+ SHARE_FOOD_TRUCK_LINE,
10
+ SHARE_MARKET_DATES_SECTION_HEADING,
11
+ SHARE_PRICE_RANGE_PREFIX,
12
+ SHARE_RAIN_OR_SHINE_LINE,
13
+ SHARE_REQUIREMENTS_SECTION_HEADING,
14
+ SHARE_SITE_URL,
15
+ SHARE_STALL_SIZE_PREFIX,
16
+ SHARE_TAGS_SECTION_HEADING,
17
+ formatDate,
18
+ joinShareDescriptionSections
19
+ } from "./chunk-S7C3MFZF.mjs";
72
20
 
73
21
  // src/sharing/formatCategoryLabel.ts
74
22
  function formatCategoryLabel(category) {
@@ -79,26 +27,6 @@ function formatCategoryLabel(category) {
79
27
  return `${category.name} (${subcategoryNames.join(", ")})`;
80
28
  }
81
29
 
82
- // src/sharing/joinShareDescriptionSections.ts
83
- var SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
84
- var OG_DESCRIPTION_LINE_BREAK = "
";
85
- function joinShareOgDescriptionSections(sections) {
86
- return sections.map((section) => typeof section === "string" ? section.trim() : "").filter((section) => section.length > 0).map((section) => section.replace(/\n/g, OG_DESCRIPTION_LINE_BREAK)).join(OG_DESCRIPTION_LINE_BREAK);
87
- }
88
- function joinShareDescriptionSections(sections) {
89
- return sections.filter((section) => Boolean(section)).join(SHARE_DESCRIPTION_SECTION_BREAK);
90
- }
91
- function appendShareMoreInfoLine(description) {
92
- const trimmed = description.trim();
93
- if (trimmed.startsWith(SHARE_MORE_INFO_LINE)) {
94
- return trimmed;
95
- }
96
- if (trimmed.length === 0) {
97
- return SHARE_MORE_INFO_LINE;
98
- }
99
- return joinShareDescriptionSections([SHARE_MORE_INFO_LINE, trimmed]);
100
- }
101
-
102
30
  // src/sharing/buildRelationShareDescription.ts
103
31
  function formatShareMarketDate(dateStr) {
104
32
  return formatDate(dateStr, "date");
@@ -230,61 +158,6 @@ function buildShareUrl(type, slug, utmMedium = "app") {
230
158
  return `${SHARE_SITE_URL}/${type}/${encodeURIComponent(slug)}?utm_source=share&utm_medium=${utmMedium}&utm_campaign=${type}`;
231
159
  }
232
160
 
233
- // src/sharing/normalizeShareDescription.ts
234
- var LEADING_WHITESPACE = /^[ \t]*/;
235
- function normalizeShareText(value) {
236
- if (value == null) {
237
- return "";
238
- }
239
- return value.trim().split("\n").map((line) => {
240
- const leading = LEADING_WHITESPACE.exec(line)?.[0] ?? "";
241
- const rest = line.slice(leading.length).trim().replace(/[ \t]{2,}/g, " ");
242
- return leading + rest;
243
- }).join("\n").replace(/\n{3,}/g, "\n\n");
244
- }
245
- function shareMessageFooterPlacementForType(_shareType) {
246
- return "before-body";
247
- }
248
- function buildShareMessageSections(input) {
249
- const title = normalizeShareText(input.title);
250
- const description = normalizeShareText(input.description);
251
- return [SHARE_MORE_INFO_LINE, title, description].filter(
252
- (section) => section.length > 0
253
- );
254
- }
255
- function splitShareDescriptionSections(value) {
256
- const trimmed = normalizeShareText(value);
257
- if (!trimmed) {
258
- return [];
259
- }
260
- if (/\n\n/.test(trimmed)) {
261
- return trimmed.split(/\n\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
262
- }
263
- if (/\n/.test(trimmed)) {
264
- return trimmed.split(/\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
265
- }
266
- return [trimmed];
267
- }
268
- function normalizeShareOgDescription(value) {
269
- return joinShareOgDescriptionSections(splitShareDescriptionSections(value));
270
- }
271
- function buildFacebookShareQuote(title, description, shareType) {
272
- const sections = buildShareMessageSections({ description, shareType, title });
273
- const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();
274
- return quote.length > 0 ? quote : void 0;
275
- }
276
- function buildShareOgDescriptionFromSections(sections) {
277
- return joinShareOgDescriptionSections(sections);
278
- }
279
- function buildShareOgDescription(_title, description) {
280
- return joinShareOgDescriptionSections(
281
- splitShareDescriptionSections(description)
282
- );
283
- }
284
- function stripOverlaySubtitleSpecialChars(text) {
285
- return text.replace(/\p{Extended_Pictographic}/gu, "").replace(/[^\p{L}\p{M}\p{N}\s.,!?'"&\-():;/]/gu, "");
286
- }
287
-
288
161
  // src/sharing/normalizeShareRouteId.ts
289
162
  function normalizeShareRouteId(id) {
290
163
  try {
@@ -303,43 +176,7 @@ function shareSlugResourceId(resource) {
303
176
  }
304
177
 
305
178
  export {
306
- RELATION_SHARE_INVITATION,
307
- RELATION_SHARE_APPLICATION,
308
- RELATION_OVERLAY_LAYOUT_VERSION,
309
- RELATION_SHARE_RESOURCE_TYPES,
310
- isRelationShareResourceType,
311
- SOCIAL_IMAGE_WIDTH,
312
- SOCIAL_IMAGE_HEIGHT,
313
- SHARE_SITE_URL,
314
- SHARE_CALENDAR_ICON,
315
- SHARE_MARKET_DATES_SECTION_HEADING,
316
- SHARE_CHECKMARK_ICON,
317
- SHARE_REQUIREMENTS_SECTION_HEADING,
318
- SHARE_INFO_ICON,
319
- SHARE_TAGS_SECTION_HEADING,
320
- SHARE_RAIN_OR_SHINE_LINE,
321
- SHARE_FOOD_TRUCK_LINE,
322
- SHARE_COMPLIANCE_PREFIX,
323
- SHARE_CATEGORY_ICON,
324
- SHARE_CATEGORIES_SECTION_HEADING,
325
- SHARE_RULER_ICON,
326
- SHARE_STALL_SIZE_PREFIX,
327
- SHARE_DOLLAR_ICON,
328
- SHARE_PRICE_RANGE_PREFIX,
329
- SHARE_CLOCK_ICON,
330
- SHARE_APPLICATION_DEADLINE_PREFIX,
331
- SHARE_MORE_INFO_LINE,
332
- DEFAULT_SHARE_OG_IMAGE,
333
- RESOURCE_SHARE_TYPES,
334
- POST_SHARE_RESOURCE_TYPES,
335
- SHARE_RESOURCE_LABEL,
336
- isPostShareResourceType,
337
179
  formatCategoryLabel,
338
- SHARE_DESCRIPTION_SECTION_BREAK,
339
- OG_DESCRIPTION_LINE_BREAK,
340
- joinShareOgDescriptionSections,
341
- joinShareDescriptionSections,
342
- appendShareMoreInfoLine,
343
180
  formatShareMarketDate,
344
181
  formatStallCapacityLabel,
345
182
  formatShareStallLine,
@@ -360,17 +197,8 @@ export {
360
197
  PUBLIC_SHARE_PATH_TYPES,
361
198
  SHARE_TYPE_PATH_REGEX,
362
199
  buildShareUrl,
363
- normalizeShareText,
364
- shareMessageFooterPlacementForType,
365
- buildShareMessageSections,
366
- splitShareDescriptionSections,
367
- normalizeShareOgDescription,
368
- buildFacebookShareQuote,
369
- buildShareOgDescriptionFromSections,
370
- buildShareOgDescription,
371
- stripOverlaySubtitleSpecialChars,
372
200
  normalizeShareRouteId,
373
201
  buildSharePagePath,
374
202
  shareSlugResourceId
375
203
  };
376
- //# sourceMappingURL=chunk-5DA4KGDS.mjs.map
204
+ //# sourceMappingURL=chunk-CID7QC75.mjs.map
@@ -0,0 +1 @@
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,SA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,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,mBACd,cACA,MACQ;AACR,SAAO,IAAI,YAAY,IAAI,mBAAmB,sBAAsB,IAAI,CAAC,CAAC;AAC5E;;;ACZO,SAAS,oBACd,UACe;AACf,SAAO,UAAU,OAAO;AAC1B;","names":[]}
@@ -1,205 +1,12 @@
1
1
  import {
2
- PROMO_CODE_PREFIX,
2
+ dateFormat,
3
+ formatDate,
4
+ nzStartOfDay,
5
+ sortDatesChronologically
6
+ } from "./chunk-S7C3MFZF.mjs";
7
+ import {
3
8
  gameScreenIdentifierList
4
9
  } from "./chunk-XY5XRXR3.mjs";
5
- import {
6
- EnumEventDateStatus,
7
- EnumInviteStatus,
8
- EnumPaymentMethod,
9
- EnumRegions
10
- } from "./chunk-LETM2YHF.mjs";
11
-
12
- // src/utils/date.ts
13
- import dayjs from "dayjs";
14
- import customParseFormat from "dayjs/plugin/customParseFormat.js";
15
- import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
16
- import timezone from "dayjs/plugin/timezone.js";
17
- import utc from "dayjs/plugin/utc.js";
18
-
19
- // src/utils/utils.ts
20
- var removeTypename = (obj) => {
21
- if (obj instanceof Date) {
22
- return obj;
23
- }
24
- if (obj instanceof File) {
25
- return obj;
26
- }
27
- if (isIsoDateString(obj)) {
28
- return obj;
29
- }
30
- if (Array.isArray(obj)) {
31
- return obj.map(removeTypename);
32
- }
33
- if (obj !== null && typeof obj === "object") {
34
- const { __typename, ...cleanedObj } = obj;
35
- return Object.keys(cleanedObj).reduce((acc, key) => {
36
- acc[key] = removeTypename(cleanedObj[key]);
37
- return acc;
38
- }, {});
39
- }
40
- return obj;
41
- };
42
- var truncateText = (text, maxLength = 30) => {
43
- return text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
44
- };
45
- var mapArrayToOptions = (items) => items.map((item) => ({
46
- label: item,
47
- value: item
48
- }));
49
- var capitalizeFirstLetter = (str) => {
50
- return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
51
- };
52
- var statusOptions = [
53
- ...Object.values(EnumInviteStatus).map((status) => ({
54
- label: status,
55
- value: status
56
- })).sort((a, b) => a.label.localeCompare(b.label))
57
- // Sort the options alphabetically
58
- ];
59
- var availableRegionTypes = Object.values(EnumRegions);
60
- var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
61
- var paymentMethodOptions = mapArrayToOptions(
62
- Object.values(EnumPaymentMethod)
63
- );
64
- function normalizeUrl(url) {
65
- if (!url.startsWith("http://") && !url.startsWith("https://")) {
66
- return `https://${url}`;
67
- }
68
- return url;
69
- }
70
- var licenseNiceNames = {
71
- ["pro_event" /* PRO_EVENT */]: "Pro Event",
72
- ["pro_vendor" /* PRO_VENDOR */]: "Pro Stallholder",
73
- ["standard_event" /* STANDARD_EVENT */]: "Standard Event",
74
- ["standard_vendor" /* STANDARD_VENDOR */]: "Standard Stallholder",
75
- ["pro_plus_event" /* PRO_PLUS_EVENT */]: "Pro+Ads Event",
76
- ["pro_plus_vendor" /* PRO_PLUS_VENDOR */]: "Pro+Ads Stallholder",
77
- ["standard_partner" /* STANDARD_PARTNER */]: "Partner",
78
- ["standard_affiliate" /* STANDARD_AFFILIATE */]: "Affiliate",
79
- ["standard_school" /* STANDARD_SCHOOL */]: "School"
80
- };
81
- var cluemartSocialMedia = [
82
- {
83
- link: "https://www.facebook.com/ClueMartApp",
84
- name: "facebook" /* FACEBOOK */
85
- },
86
- {
87
- link: "https://www.instagram.com/cluemart_app",
88
- name: "instagram" /* INSTAGRAM */
89
- },
90
- {
91
- link: "https://www.tiktok.com/@cluemart",
92
- name: "tiktok" /* TIKTOK */
93
- },
94
- {
95
- link: "https://www.youtube.com/@ClueMart-App-NZ",
96
- name: "youtube" /* YOUTUBE */
97
- }
98
- ];
99
- var IOS_URL = "https://apps.apple.com/nz/app/cluemart/id6747251008";
100
- var ANDROID_URL = "https://play.google.com/store/apps/details?id=com.timardex.cluemart";
101
- var DEFAULT_RESOURCES_RETURN_LIMIT = 1e3;
102
- var DEFAULT_RESOURCES_RETURN_OFFSET = 0;
103
- var CLUEMART_MAIN_DOMAIN_URL = "https://cluemart.co.nz";
104
- var rewardNiceNames = {
105
- ["mystery_joy_box" /* MYSTERY_JOY_BOX */]: {
106
- name: "Mystery Joy Box",
107
- points: 250
108
- },
109
- ["mystery_squeeze_box" /* MYSTERY_SQUEEZE_BOX */]: {
110
- name: "Mystery Squeeze Box",
111
- points: 350
112
- },
113
- ["mystery_deluxe_box" /* MYSTERY_DELUXE_BOX */]: {
114
- name: "Mystery Deluxe Box",
115
- points: 500
116
- }
117
- };
118
- var PostTypeLabels = {
119
- ["market_faces" /* MARKET_FACES */]: "Market Faces",
120
- ["clue_bites" /* CLUE_BITES */]: "Clue Bites",
121
- ["play_and_win" /* PLAY_AND_WIN */]: "Play & Win"
122
- };
123
- var CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;
124
- var CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;
125
-
126
- // src/utils/date.ts
127
- var dateFormat = "DD-MM-YYYY";
128
- var timeFormat = "HH:mm";
129
- dayjs.extend(customParseFormat);
130
- dayjs.extend(utc);
131
- dayjs.extend(timezone);
132
- dayjs.extend(isSameOrAfter);
133
- var NZ_TZ = "Pacific/Auckland";
134
- function toNZTime(date) {
135
- return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
136
- }
137
- function nzStartOfDay(input) {
138
- if (input == null) {
139
- return dayjs().tz(NZ_TZ).startOf("day");
140
- }
141
- return dayjs.tz(input, NZ_TZ).startOf("day");
142
- }
143
- var formatDate = (dateStr, display = "datetime", timeStr) => {
144
- const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
145
- const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
146
- const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
147
- const formattedTime = dateTime.format("h:mm a");
148
- switch (display) {
149
- case "date":
150
- return formattedDate;
151
- case "time":
152
- return formattedTime;
153
- case "datetime":
154
- return `${formattedDate} at ${formattedTime}`;
155
- default:
156
- return formattedDate;
157
- }
158
- };
159
- var getCurrentAndFutureDates = (dates) => {
160
- const now = dayjs();
161
- return dates.filter((dateObj) => {
162
- const dateTime = dayjs(
163
- `${dateObj.startDate} ${dateObj.startTime}`,
164
- `${dateFormat} ${timeFormat}`
165
- );
166
- return dateTime.isSameOrAfter(now);
167
- });
168
- };
169
- var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
170
- const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
171
- const dateTime = dayjs(
172
- `${date.startDate} ${date.startTime}`,
173
- `${dateFormat} ${timeFormat}`
174
- );
175
- return dateTime.isSameOrAfter(threshold);
176
- };
177
- var formatTimestamp = (timestamp) => {
178
- const formattedDate = toNZTime(timestamp).format(dateFormat);
179
- return formatDate(formattedDate, "date");
180
- };
181
- var isIsoDateString = (value) => {
182
- return typeof value === "string" && !Number.isNaN(Date.parse(value));
183
- };
184
- function sortDatesChronologically(dates) {
185
- if (!dates?.length) {
186
- return [];
187
- }
188
- return [...dates].sort((a, b) => {
189
- const dateTimeFormat = `${dateFormat} ${timeFormat}`;
190
- const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
191
- const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
192
- return dateA.valueOf() - dateB.valueOf();
193
- });
194
- }
195
- var futureTimePeriods = mapArrayToOptions(
196
- Object.values(EnumEventDateStatus)
197
- ).filter(
198
- (period) => period.value !== "Starting_Soon" /* STARTING_SOON */ && period.value !== "Canceled" /* CANCELED */ && period.value !== "Rescheduled" /* RE_SCHEDULED */ && period.value !== "Started" /* STARTED */ && period.value !== "Ended" /* ENDED */ && period.value !== "Invalid" /* INVALID */
199
- ).map((period) => ({
200
- label: period.value.replaceAll("_", " "),
201
- value: period.value
202
- }));
203
10
 
204
11
  // src/utils/dailyClueGame.ts
205
12
  function createSeededRng(seed) {
@@ -359,18 +166,18 @@ function filterEventsByDateStatusPeriod(events, period) {
359
166
  }
360
167
 
361
168
  // src/calendar/eventCalendar.ts
362
- import dayjs2 from "dayjs";
169
+ import dayjs from "dayjs";
363
170
  var KNOWN_EVENT_SCHEDULE_STATUSES = /* @__PURE__ */ new Set([
364
171
  "Started" /* STARTED */,
365
172
  "Starting_Soon" /* STARTING_SOON */,
366
173
  "Ended" /* ENDED */
367
174
  ]);
368
175
  function toCalendarIsoDate(startDate) {
369
- const formatted = dayjs2(startDate, dateFormat).format("YYYY-MM-DD");
370
- return dayjs2(formatted, "YYYY-MM-DD", true).isValid() ? formatted : null;
176
+ const formatted = dayjs(startDate, dateFormat).format("YYYY-MM-DD");
177
+ return dayjs(formatted, "YYYY-MM-DD", true).isValid() ? formatted : null;
371
178
  }
372
179
  function fromCalendarIsoDate(isoDate) {
373
- return dayjs2(isoDate, "YYYY-MM-DD").format(dateFormat);
180
+ return dayjs(isoDate, "YYYY-MM-DD").format(dateFormat);
374
181
  }
375
182
  function getEventCalendarIsoDates(dateTimes) {
376
183
  return dateTimes?.map((dateTime) => toCalendarIsoDate(dateTime.startDate)).filter((date) => Boolean(date)) ?? [];
@@ -1593,37 +1400,6 @@ function getVendorEventsEmptyMessage() {
1593
1400
  }
1594
1401
 
1595
1402
  export {
1596
- removeTypename,
1597
- truncateText,
1598
- mapArrayToOptions,
1599
- capitalizeFirstLetter,
1600
- statusOptions,
1601
- availableRegionTypes,
1602
- availableRegionOptions,
1603
- paymentMethodOptions,
1604
- normalizeUrl,
1605
- licenseNiceNames,
1606
- cluemartSocialMedia,
1607
- IOS_URL,
1608
- ANDROID_URL,
1609
- DEFAULT_RESOURCES_RETURN_LIMIT,
1610
- DEFAULT_RESOURCES_RETURN_OFFSET,
1611
- CLUEMART_MAIN_DOMAIN_URL,
1612
- rewardNiceNames,
1613
- PostTypeLabels,
1614
- CM_SCHOOL_PROMO_CODE,
1615
- CM_AFFILIATE_PROMO_CODE,
1616
- dateFormat,
1617
- timeFormat,
1618
- toNZTime,
1619
- nzStartOfDay,
1620
- formatDate,
1621
- getCurrentAndFutureDates,
1622
- isFutureDatesBeforeThreshold,
1623
- formatTimestamp,
1624
- isIsoDateString,
1625
- sortDatesChronologically,
1626
- futureTimePeriods,
1627
1403
  seededShuffle,
1628
1404
  computeDailyClueState,
1629
1405
  AFFILIATE_REWARDS,
@@ -1674,4 +1450,4 @@ export {
1674
1450
  getVendorEventRelationDateOptions,
1675
1451
  getVendorEventsEmptyMessage
1676
1452
  };
1677
- //# sourceMappingURL=chunk-G4HKDB7T.mjs.map
1453
+ //# sourceMappingURL=chunk-HO7KOQ6F.mjs.map