@timardex/cluemart-shared 1.5.793 → 1.5.795

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.
@@ -110,40 +110,6 @@ var import_timezone = __toESM(require("dayjs/plugin/timezone.js"));
110
110
  var import_utc = __toESM(require("dayjs/plugin/utc.js"));
111
111
 
112
112
  // src/enums/index.ts
113
- var EnumInviteStatus = /* @__PURE__ */ ((EnumInviteStatus2) => {
114
- EnumInviteStatus2["ACCEPTED"] = "Accepted";
115
- EnumInviteStatus2["COMPLETED"] = "Completed";
116
- EnumInviteStatus2["EXPIRED"] = "Expired";
117
- EnumInviteStatus2["NO_STATUS"] = "No_Status";
118
- EnumInviteStatus2["PENDING"] = "Pending";
119
- EnumInviteStatus2["REJECTED"] = "Rejected";
120
- EnumInviteStatus2["UNAVAILABLE"] = "Unavailable";
121
- return EnumInviteStatus2;
122
- })(EnumInviteStatus || {});
123
- var EnumPaymentMethod = /* @__PURE__ */ ((EnumPaymentMethod2) => {
124
- EnumPaymentMethod2["CASH"] = "cash";
125
- EnumPaymentMethod2["EFTPOS"] = "eftpos";
126
- EnumPaymentMethod2["BANK_TRANSFER"] = "bank_transfer";
127
- EnumPaymentMethod2["PAYPAL"] = "paypal";
128
- EnumPaymentMethod2["STRIPE"] = "stripe";
129
- return EnumPaymentMethod2;
130
- })(EnumPaymentMethod || {});
131
- var EnumRegions = /* @__PURE__ */ ((EnumRegions2) => {
132
- EnumRegions2["All"] = "All Regions";
133
- EnumRegions2["Auckland"] = "Auckland";
134
- EnumRegions2["BayOfPlentyGisborne"] = "Bay of Plenty & Gisborne";
135
- EnumRegions2["CanterburyWestCoast"] = "Canterbury & West Coast";
136
- EnumRegions2["HawkesBay"] = "Hawke's Bay";
137
- EnumRegions2["ManawatuWanganui"] = "Manawatu-Wanganui";
138
- EnumRegions2["MarlboroughNelsonTasman"] = "Marlborough & Nelson & Tasman";
139
- EnumRegions2["Northland"] = "Northland";
140
- EnumRegions2["Otago"] = "Otago";
141
- EnumRegions2["Southland"] = "Southland";
142
- EnumRegions2["Taranaki"] = "Taranaki";
143
- EnumRegions2["Waikato"] = "Waikato";
144
- EnumRegions2["Wellington"] = "Wellington";
145
- return EnumRegions2;
146
- })(EnumRegions || {});
147
113
  var EnumEventDateStatus = /* @__PURE__ */ ((EnumEventDateStatus2) => {
148
114
  EnumEventDateStatus2["STARTING_SOON"] = "Starting_Soon";
149
115
  EnumEventDateStatus2["STARTED"] = "Started";
@@ -159,6 +125,44 @@ var EnumEventDateStatus = /* @__PURE__ */ ((EnumEventDateStatus2) => {
159
125
  return EnumEventDateStatus2;
160
126
  })(EnumEventDateStatus || {});
161
127
 
128
+ // src/utils/mapArrayToOptions.ts
129
+ var mapArrayToOptions = (items) => items.map((item) => ({
130
+ label: item,
131
+ value: item
132
+ }));
133
+
134
+ // src/utils/date.ts
135
+ var dateFormat = "DD-MM-YYYY";
136
+ var timeFormat = "HH:mm";
137
+ import_dayjs.default.extend(import_customParseFormat.default);
138
+ import_dayjs.default.extend(import_utc.default);
139
+ import_dayjs.default.extend(import_timezone.default);
140
+ import_dayjs.default.extend(import_isSameOrAfter.default);
141
+ var formatDate = (dateStr, display = "datetime", timeStr) => {
142
+ const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
143
+ const dateTime = timeStr ? (0, import_dayjs.default)(dateTimeStr, `${dateFormat} ${timeFormat}`) : (0, import_dayjs.default)(dateStr, dateFormat);
144
+ const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
145
+ const formattedTime = dateTime.format("h:mm a");
146
+ switch (display) {
147
+ case "date":
148
+ return formattedDate;
149
+ case "time":
150
+ return formattedTime;
151
+ case "datetime":
152
+ return `${formattedDate} at ${formattedTime}`;
153
+ default:
154
+ return formattedDate;
155
+ }
156
+ };
157
+ var futureTimePeriods = mapArrayToOptions(
158
+ Object.values(EnumEventDateStatus)
159
+ ).filter(
160
+ (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 */
161
+ ).map((period) => ({
162
+ label: period.value.replaceAll("_", " "),
163
+ value: period.value
164
+ }));
165
+
162
166
  // src/sharing/relationShareTypes.ts
163
167
  var RELATION_SHARE_INVITATION = "invitation";
164
168
  var RELATION_SHARE_APPLICATION = "application";
@@ -226,6 +230,15 @@ function isPostShareResourceType(resourceType) {
226
230
  );
227
231
  }
228
232
 
233
+ // src/sharing/formatCategoryLabel.ts
234
+ function formatCategoryLabel(category) {
235
+ const subcategoryNames = category.subcategories.map((subcategory) => subcategory.name).filter(Boolean);
236
+ if (subcategoryNames.length === 0) {
237
+ return category.name;
238
+ }
239
+ return `${category.name} (${subcategoryNames.join(", ")})`;
240
+ }
241
+
229
242
  // src/sharing/joinShareDescriptionSections.ts
230
243
  var SHARE_DESCRIPTION_SECTION_BREAK = "\n\n";
231
244
  var OG_DESCRIPTION_LINE_BREAK = "
";
@@ -246,289 +259,6 @@ function appendShareMoreInfoLine(description) {
246
259
  return joinShareDescriptionSections([SHARE_MORE_INFO_LINE, trimmed]);
247
260
  }
248
261
 
249
- // src/sharing/normalizeShareDescription.ts
250
- var LEADING_WHITESPACE = /^[ \t]*/;
251
- function normalizeShareText(value) {
252
- if (value == null) {
253
- return "";
254
- }
255
- return value.trim().split("\n").map((line) => {
256
- const leading = LEADING_WHITESPACE.exec(line)?.[0] ?? "";
257
- const rest = line.slice(leading.length).trim().replace(/[ \t]{2,}/g, " ");
258
- return leading + rest;
259
- }).join("\n").replace(/\n{3,}/g, "\n\n");
260
- }
261
- function shareMessageFooterPlacementForType(_shareType) {
262
- return "before-body";
263
- }
264
- function buildShareMessageSections(input) {
265
- const title = normalizeShareText(input.title);
266
- const description = normalizeShareText(input.description);
267
- return [SHARE_MORE_INFO_LINE, title, description].filter(
268
- (section) => section.length > 0
269
- );
270
- }
271
- function splitShareDescriptionSections(value) {
272
- const trimmed = normalizeShareText(value);
273
- if (!trimmed) {
274
- return [];
275
- }
276
- if (/\n\n/.test(trimmed)) {
277
- return trimmed.split(/\n\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
278
- }
279
- if (/\n/.test(trimmed)) {
280
- return trimmed.split(/\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
281
- }
282
- return [trimmed];
283
- }
284
- function normalizeShareOgDescription(value) {
285
- return joinShareOgDescriptionSections(splitShareDescriptionSections(value));
286
- }
287
- function buildFacebookShareQuote(title, description, shareType) {
288
- const sections = buildShareMessageSections({ description, shareType, title });
289
- const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();
290
- return quote.length > 0 ? quote : void 0;
291
- }
292
- function buildShareOgDescriptionFromSections(sections) {
293
- return joinShareOgDescriptionSections(sections);
294
- }
295
- function buildShareOgDescription(_title, description) {
296
- return joinShareOgDescriptionSections(
297
- splitShareDescriptionSections(description)
298
- );
299
- }
300
- function stripOverlaySubtitleSpecialChars(text) {
301
- const regex = /[^\p{L}\p{M}\p{N}\s.,!?'"&\-():;/]/gu;
302
- const result = text.replace(/\p{Extended_Pictographic}/gu, "").replace(regex, "");
303
- return result.trim();
304
- }
305
-
306
- // src/types/global.ts
307
- var PROMO_CODE_PREFIX = "CM-";
308
-
309
- // src/types/game/dailyClue.ts
310
- var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
311
- var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
312
- var gameScreenIdentifierList = [
313
- {
314
- clue: "Where your actions turn into a timeline.",
315
- id: "activities",
316
- match: "/profile/activities"
317
- },
318
- {
319
- clue: "Where conversations happen without speaking.",
320
- id: "chat",
321
- match: "/profile/chat"
322
- },
323
- {
324
- clue: "The place to redefine who you are.",
325
- id: "edit-profile",
326
- match: "/profile/edit-profile"
327
- },
328
- {
329
- clue: "A single moment worth showing up for.",
330
- id: "single-event",
331
- match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`)
332
- },
333
- {
334
- clue: "What\u2019s happening around you, right now.",
335
- id: "events-near-me",
336
- match: "/events/events-near-me"
337
- },
338
- {
339
- clue: "Where events appear as pins on a map.",
340
- id: "events-map",
341
- match: "/events/events-map"
342
- },
343
- {
344
- clue: "A collection of events worth attending.",
345
- id: "events",
346
- match: "/events"
347
- },
348
- {
349
- clue: "What\u2019s happening in a wider area \u2014 not just nearby.",
350
- id: "events-region",
351
- match: /^\/events\/region\/[^/]+$/
352
- },
353
- {
354
- clue: "Where fun becomes a challenge.",
355
- id: "games",
356
- match: "/games"
357
- },
358
- {
359
- clue: "Your starting point for everything.",
360
- id: "home",
361
- match: "/"
362
- },
363
- {
364
- clue: "Where the app whispers what you shouldn\u2019t miss.",
365
- id: "notifications",
366
- match: "/notifications"
367
- },
368
- {
369
- clue: "Where you fine-tune your experience.",
370
- id: "options",
371
- match: "/options"
372
- },
373
- {
374
- clue: "An organisation or creator supporting the community.",
375
- id: "single-partner",
376
- match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`)
377
- },
378
- {
379
- clue: "Organisations and creators supporting the community.",
380
- id: "partners",
381
- match: "/partners"
382
- },
383
- {
384
- clue: "A single published post in full view.",
385
- id: "single-visitor-post",
386
- match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`)
387
- },
388
- {
389
- clue: "Your identity, on display.",
390
- id: "profile",
391
- match: "/profile"
392
- },
393
- {
394
- clue: "One stallholder offering something valuable.",
395
- id: "single-vendor",
396
- match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`)
397
- },
398
- {
399
- clue: "Where every stallholder waits under the right category.",
400
- id: "vendors",
401
- match: "/vendors"
402
- },
403
- {
404
- clue: "Where you browse articles and posts from around the platform.",
405
- id: "visitors",
406
- match: "/visitors"
407
- }
408
- ];
409
-
410
- // src/types/subscription.ts
411
- var TIER_FROM_LICENCE = {
412
- ["pro_event" /* PRO_EVENT */]: "pro",
413
- ["pro_plus_event" /* PRO_PLUS_EVENT */]: "pro_plus",
414
- ["pro_plus_vendor" /* PRO_PLUS_VENDOR */]: "pro_plus",
415
- ["pro_vendor" /* PRO_VENDOR */]: "pro",
416
- ["standard_event" /* STANDARD_EVENT */]: "standard",
417
- ["standard_partner" /* STANDARD_PARTNER */]: "standard",
418
- ["standard_vendor" /* STANDARD_VENDOR */]: "standard",
419
- ["standard_affiliate" /* STANDARD_AFFILIATE */]: "standard",
420
- ["standard_school" /* STANDARD_SCHOOL */]: "standard"
421
- };
422
-
423
- // src/utils/utils.ts
424
- var mapArrayToOptions = (items) => items.map((item) => ({
425
- label: item,
426
- value: item
427
- }));
428
- var statusOptions = [
429
- ...Object.values(EnumInviteStatus).map((status) => ({
430
- label: status,
431
- value: status
432
- })).sort((a, b) => a.label.localeCompare(b.label))
433
- // Sort the options alphabetically
434
- ];
435
- var availableRegionTypes = Object.values(EnumRegions);
436
- var availableRegionOptions = mapArrayToOptions(availableRegionTypes);
437
- var paymentMethodOptions = mapArrayToOptions(
438
- Object.values(EnumPaymentMethod)
439
- );
440
- var licenseNiceNames = {
441
- ["pro_event" /* PRO_EVENT */]: "Pro Event",
442
- ["pro_vendor" /* PRO_VENDOR */]: "Pro Stallholder",
443
- ["standard_event" /* STANDARD_EVENT */]: "Standard Event",
444
- ["standard_vendor" /* STANDARD_VENDOR */]: "Standard Stallholder",
445
- ["pro_plus_event" /* PRO_PLUS_EVENT */]: "Pro+Ads Event",
446
- ["pro_plus_vendor" /* PRO_PLUS_VENDOR */]: "Pro+Ads Stallholder",
447
- ["standard_partner" /* STANDARD_PARTNER */]: "Partner",
448
- ["standard_affiliate" /* STANDARD_AFFILIATE */]: "Affiliate",
449
- ["standard_school" /* STANDARD_SCHOOL */]: "School"
450
- };
451
- var cluemartSocialMedia = [
452
- {
453
- link: "https://www.facebook.com/ClueMartApp",
454
- name: "facebook" /* FACEBOOK */
455
- },
456
- {
457
- link: "https://www.instagram.com/cluemart_app",
458
- name: "instagram" /* INSTAGRAM */
459
- },
460
- {
461
- link: "https://www.tiktok.com/@cluemart",
462
- name: "tiktok" /* TIKTOK */
463
- },
464
- {
465
- link: "https://www.youtube.com/@ClueMart-App-NZ",
466
- name: "youtube" /* YOUTUBE */
467
- }
468
- ];
469
- var rewardNiceNames = {
470
- ["mystery_joy_box" /* MYSTERY_JOY_BOX */]: {
471
- name: "Mystery Joy Box",
472
- points: 250
473
- },
474
- ["mystery_squeeze_box" /* MYSTERY_SQUEEZE_BOX */]: {
475
- name: "Mystery Squeeze Box",
476
- points: 350
477
- },
478
- ["mystery_deluxe_box" /* MYSTERY_DELUXE_BOX */]: {
479
- name: "Mystery Deluxe Box",
480
- points: 500
481
- }
482
- };
483
- var PostTypeLabels = {
484
- ["market_faces" /* MARKET_FACES */]: "Market Faces",
485
- ["clue_bites" /* CLUE_BITES */]: "Clue Bites",
486
- ["play_and_win" /* PLAY_AND_WIN */]: "Play & Win"
487
- };
488
- var CM_SCHOOL_PROMO_CODE = `${PROMO_CODE_PREFIX}SCHOOL`;
489
- var CM_AFFILIATE_PROMO_CODE = `${PROMO_CODE_PREFIX}AFFILIATE`;
490
-
491
- // src/utils/date.ts
492
- var dateFormat = "DD-MM-YYYY";
493
- var timeFormat = "HH:mm";
494
- import_dayjs.default.extend(import_customParseFormat.default);
495
- import_dayjs.default.extend(import_utc.default);
496
- import_dayjs.default.extend(import_timezone.default);
497
- import_dayjs.default.extend(import_isSameOrAfter.default);
498
- var formatDate = (dateStr, display = "datetime", timeStr) => {
499
- const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
500
- const dateTime = timeStr ? (0, import_dayjs.default)(dateTimeStr, `${dateFormat} ${timeFormat}`) : (0, import_dayjs.default)(dateStr, dateFormat);
501
- const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
502
- const formattedTime = dateTime.format("h:mm a");
503
- switch (display) {
504
- case "date":
505
- return formattedDate;
506
- case "time":
507
- return formattedTime;
508
- case "datetime":
509
- return `${formattedDate} at ${formattedTime}`;
510
- default:
511
- return formattedDate;
512
- }
513
- };
514
- var futureTimePeriods = mapArrayToOptions(
515
- Object.values(EnumEventDateStatus)
516
- ).filter(
517
- (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 */
518
- ).map((period) => ({
519
- label: period.value.replaceAll("_", " "),
520
- value: period.value
521
- }));
522
-
523
- // src/sharing/formatCategoryLabel.ts
524
- function formatCategoryLabel(category) {
525
- const subcategoryNames = category.subcategories.map((subcategory) => subcategory.name).filter(Boolean);
526
- if (subcategoryNames.length === 0) {
527
- return category.name;
528
- }
529
- return `${category.name} (${subcategoryNames.join(", ")})`;
530
- }
531
-
532
262
  // src/sharing/buildRelationShareDescription.ts
533
263
  function formatShareMarketDate(dateStr) {
534
264
  return formatDate(dateStr, "date");
@@ -660,6 +390,63 @@ function buildShareUrl(type, slug, utmMedium = "app") {
660
390
  return `${SHARE_SITE_URL}/${type}/${encodeURIComponent(slug)}?utm_source=share&utm_medium=${utmMedium}&utm_campaign=${type}`;
661
391
  }
662
392
 
393
+ // src/sharing/normalizeShareDescription.ts
394
+ var LEADING_WHITESPACE = /^[ \t]*/;
395
+ function normalizeShareText(value) {
396
+ if (value == null) {
397
+ return "";
398
+ }
399
+ return value.trim().split("\n").map((line) => {
400
+ const leading = LEADING_WHITESPACE.exec(line)?.[0] ?? "";
401
+ const rest = line.slice(leading.length).trim().replace(/[ \t]{2,}/g, " ");
402
+ return leading + rest;
403
+ }).join("\n").replace(/\n{3,}/g, "\n\n");
404
+ }
405
+ function shareMessageFooterPlacementForType(_shareType) {
406
+ return "before-body";
407
+ }
408
+ function buildShareMessageSections(input) {
409
+ const title = normalizeShareText(input.title);
410
+ const description = normalizeShareText(input.description);
411
+ return [SHARE_MORE_INFO_LINE, title, description].filter(
412
+ (section) => section.length > 0
413
+ );
414
+ }
415
+ function splitShareDescriptionSections(value) {
416
+ const trimmed = normalizeShareText(value);
417
+ if (!trimmed) {
418
+ return [];
419
+ }
420
+ if (/\n\n/.test(trimmed)) {
421
+ return trimmed.split(/\n\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
422
+ }
423
+ if (/\n/.test(trimmed)) {
424
+ return trimmed.split(/\n+/).map((section) => normalizeShareText(section)).filter((section) => section.length > 0);
425
+ }
426
+ return [trimmed];
427
+ }
428
+ function normalizeShareOgDescription(value) {
429
+ return joinShareOgDescriptionSections(splitShareDescriptionSections(value));
430
+ }
431
+ function buildFacebookShareQuote(title, description, shareType) {
432
+ const sections = buildShareMessageSections({ description, shareType, title });
433
+ const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();
434
+ return quote.length > 0 ? quote : void 0;
435
+ }
436
+ function buildShareOgDescriptionFromSections(sections) {
437
+ return joinShareOgDescriptionSections(sections);
438
+ }
439
+ function buildShareOgDescription(_title, description) {
440
+ return joinShareOgDescriptionSections(
441
+ splitShareDescriptionSections(description)
442
+ );
443
+ }
444
+ function stripOverlaySubtitleSpecialChars(text) {
445
+ const regex = /[^\p{L}\p{M}\p{N}\s.,!?'"&\-():;/]/gu;
446
+ const result = text.replace(/\p{Extended_Pictographic}/gu, "").replace(regex, "");
447
+ return result.trim();
448
+ }
449
+
663
450
  // src/sharing/normalizeShareRouteId.ts
664
451
  function normalizeShareRouteId(id) {
665
452
  try {