@timardex/cluemart-shared 1.5.794 → 1.5.796

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.
Files changed (64) hide show
  1. package/dist/{ad-kAjUceeE.d.mts → ad-CnXQqP4h.d.mts} +1 -1
  2. package/dist/{ad-BmDOVKmE.d.ts → ad-jTYE2A1Z.d.ts} +1 -1
  3. package/dist/{affiliate-ISt4ujwI.d.mts → affiliate-BDoo69JY.d.mts} +1 -1
  4. package/dist/{affiliate-C09PnHJx.d.ts → affiliate-BY-BlC9i.d.ts} +1 -1
  5. package/dist/{chunk-XY5XRXR3.mjs → chunk-6UP53CPG.mjs} +1 -1
  6. package/dist/chunk-6UP53CPG.mjs.map +1 -0
  7. package/dist/{chunk-S7C3MFZF.mjs → chunk-E7ZEBZ3O.mjs} +104 -241
  8. package/dist/chunk-E7ZEBZ3O.mjs.map +1 -0
  9. package/dist/{chunk-CID7QC75.mjs → chunk-JD7CKX4S.mjs} +2 -2
  10. package/dist/{chunk-KKPVTN4B.mjs → chunk-KSFDYCSS.mjs} +2 -2
  11. package/dist/{chunk-HO7KOQ6F.mjs → chunk-LHT6WAM2.mjs} +147 -5
  12. package/dist/chunk-LHT6WAM2.mjs.map +1 -0
  13. package/dist/{chunk-2US6BYNF.mjs → chunk-R2XNULRY.mjs} +2 -1
  14. package/dist/chunk-R2XNULRY.mjs.map +1 -0
  15. package/dist/{contactUs-DGrDzJaM.d.mts → contactUs-Dr-IbmG5.d.mts} +1 -1
  16. package/dist/{contactUs-H7799pWe.d.ts → contactUs-RKkIL-nI.d.ts} +1 -1
  17. package/dist/formFields/index.cjs +20 -18
  18. package/dist/formFields/index.cjs.map +1 -1
  19. package/dist/formFields/index.d.mts +1 -1
  20. package/dist/formFields/index.d.ts +1 -1
  21. package/dist/formFields/index.mjs +4 -4
  22. package/dist/{global-fKbMmluy.d.ts → global-BeBuHWbg.d.ts} +1 -0
  23. package/dist/{global-BUUfmCo7.d.mts → global-C8npu_7P.d.mts} +1 -0
  24. package/dist/graphql/index.cjs +1 -0
  25. package/dist/graphql/index.cjs.map +1 -1
  26. package/dist/graphql/index.d.mts +4 -4
  27. package/dist/graphql/index.d.ts +4 -4
  28. package/dist/graphql/index.mjs +1 -1
  29. package/dist/hooks/index.cjs +23 -20
  30. package/dist/hooks/index.cjs.map +1 -1
  31. package/dist/hooks/index.d.mts +4 -4
  32. package/dist/hooks/index.d.ts +4 -4
  33. package/dist/hooks/index.mjs +12 -12
  34. package/dist/index.cjs +158 -155
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.mts +6 -6
  37. package/dist/index.d.ts +6 -6
  38. package/dist/index.mjs +158 -155
  39. package/dist/index.mjs.map +1 -1
  40. package/dist/map/index.d.mts +1 -1
  41. package/dist/map/index.d.ts +1 -1
  42. package/dist/{resourceActivities-BL_12IAo.d.ts → resourceActivities-CJrM2qDC.d.ts} +1 -1
  43. package/dist/{resourceActivities-zczOntNk.d.mts → resourceActivities-lFB7B-Y9.d.mts} +1 -1
  44. package/dist/sharing/index.cjs +104 -317
  45. package/dist/sharing/index.cjs.map +1 -1
  46. package/dist/sharing/index.d.mts +1 -1
  47. package/dist/sharing/index.d.ts +1 -1
  48. package/dist/sharing/index.mjs +2 -3
  49. package/dist/types/index.cjs.map +1 -1
  50. package/dist/types/index.d.mts +6 -6
  51. package/dist/types/index.d.ts +6 -6
  52. package/dist/types/index.mjs +1 -1
  53. package/dist/utils/index.cjs +157 -155
  54. package/dist/utils/index.cjs.map +1 -1
  55. package/dist/utils/index.d.mts +7 -8
  56. package/dist/utils/index.d.ts +7 -8
  57. package/dist/utils/index.mjs +25 -25
  58. package/package.json +1 -1
  59. package/dist/chunk-2US6BYNF.mjs.map +0 -1
  60. package/dist/chunk-HO7KOQ6F.mjs.map +0 -1
  61. package/dist/chunk-S7C3MFZF.mjs.map +0 -1
  62. package/dist/chunk-XY5XRXR3.mjs.map +0 -1
  63. /package/dist/{chunk-CID7QC75.mjs.map → chunk-JD7CKX4S.mjs.map} +0 -0
  64. /package/dist/{chunk-KKPVTN4B.mjs.map → chunk-KSFDYCSS.mjs.map} +0 -0
@@ -270,6 +270,163 @@ var EnumEventDateStatus = /* @__PURE__ */ ((EnumEventDateStatus2) => {
270
270
  return EnumEventDateStatus2;
271
271
  })(EnumEventDateStatus || {});
272
272
 
273
+ // src/utils/mapArrayToOptions.ts
274
+ var mapArrayToOptions = (items) => items.map((item) => ({
275
+ label: item,
276
+ value: item
277
+ }));
278
+
279
+ // src/utils/date.ts
280
+ var dateFormat = "DD-MM-YYYY";
281
+ var timeFormat = "HH:mm";
282
+ import_dayjs.default.extend(import_customParseFormat.default);
283
+ import_dayjs.default.extend(import_utc.default);
284
+ import_dayjs.default.extend(import_timezone.default);
285
+ import_dayjs.default.extend(import_isSameOrAfter.default);
286
+ var NZ_TZ = "Pacific/Auckland";
287
+ function toNZTime(date) {
288
+ return date ? (0, import_dayjs.default)(date).tz(NZ_TZ) : (0, import_dayjs.default)().tz(NZ_TZ);
289
+ }
290
+ function nzStartOfDay(input) {
291
+ if (input == null) {
292
+ return (0, import_dayjs.default)().tz(NZ_TZ).startOf("day");
293
+ }
294
+ return import_dayjs.default.tz(input, NZ_TZ).startOf("day");
295
+ }
296
+ var formatDate = (dateStr, display = "datetime", timeStr) => {
297
+ const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
298
+ const dateTime = timeStr ? (0, import_dayjs.default)(dateTimeStr, `${dateFormat} ${timeFormat}`) : (0, import_dayjs.default)(dateStr, dateFormat);
299
+ const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
300
+ const formattedTime = dateTime.format("h:mm a");
301
+ switch (display) {
302
+ case "date":
303
+ return formattedDate;
304
+ case "time":
305
+ return formattedTime;
306
+ case "datetime":
307
+ return `${formattedDate} at ${formattedTime}`;
308
+ default:
309
+ return formattedDate;
310
+ }
311
+ };
312
+ var getCurrentAndFutureDates = (dates) => {
313
+ const now = (0, import_dayjs.default)();
314
+ return dates.filter((dateObj) => {
315
+ const dateTime = (0, import_dayjs.default)(
316
+ `${dateObj.startDate} ${dateObj.startTime}`,
317
+ `${dateFormat} ${timeFormat}`
318
+ );
319
+ return dateTime.isSameOrAfter(now);
320
+ });
321
+ };
322
+ var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
323
+ const threshold = minHoursFromNow ? (0, import_dayjs.default)().add(minHoursFromNow, "hour") : (0, import_dayjs.default)().startOf("day");
324
+ const dateTime = (0, import_dayjs.default)(
325
+ `${date.startDate} ${date.startTime}`,
326
+ `${dateFormat} ${timeFormat}`
327
+ );
328
+ return dateTime.isSameOrAfter(threshold);
329
+ };
330
+ var formatTimestamp = (timestamp) => {
331
+ const formattedDate = toNZTime(timestamp).format(dateFormat);
332
+ return formatDate(formattedDate, "date");
333
+ };
334
+ var isIsoDateString = (value) => {
335
+ return typeof value === "string" && !Number.isNaN(Date.parse(value));
336
+ };
337
+ function sortDatesChronologically(dates) {
338
+ if (!dates?.length) {
339
+ return [];
340
+ }
341
+ return [...dates].sort((a, b) => {
342
+ const dateTimeFormat = `${dateFormat} ${timeFormat}`;
343
+ const dateA = (0, import_dayjs.default)(`${a.startDate} ${a.startTime}`, dateTimeFormat);
344
+ const dateB = (0, import_dayjs.default)(`${b.startDate} ${b.startTime}`, dateTimeFormat);
345
+ return dateA.valueOf() - dateB.valueOf();
346
+ });
347
+ }
348
+ var futureTimePeriods = mapArrayToOptions(
349
+ Object.values(EnumEventDateStatus)
350
+ ).filter(
351
+ (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 */
352
+ ).map((period) => ({
353
+ label: period.value.replaceAll("_", " "),
354
+ value: period.value
355
+ }));
356
+
357
+ // src/utils/dailyClueGame.ts
358
+ function createSeededRng(seed) {
359
+ let t = seed >>> 0;
360
+ return function random() {
361
+ t += 1831565813;
362
+ let x = t;
363
+ x = Math.imul(x ^ x >>> 15, x | 1);
364
+ x ^= x + Math.imul(x ^ x >>> 7, x | 61);
365
+ return ((x ^ x >>> 14) >>> 0) / 4294967296;
366
+ };
367
+ }
368
+ function hashStringToNumber(seed) {
369
+ let hash = 2166136261;
370
+ for (let i = 0; i < seed.length; i++) {
371
+ hash ^= seed.codePointAt(i) ?? 0;
372
+ hash = Math.imul(hash, 16777619);
373
+ }
374
+ return hash >>> 0;
375
+ }
376
+ function seededShuffle(array, seed) {
377
+ const rng = createSeededRng(hashStringToNumber(seed));
378
+ const result = [...array];
379
+ for (let i = result.length - 1; i > 0; i--) {
380
+ const j = Math.floor(rng() * (i + 1));
381
+ [result[i], result[j]] = [result[j], result[i]];
382
+ }
383
+ return result;
384
+ }
385
+ function getDayIndex(start, today) {
386
+ return today.diff(start, "day");
387
+ }
388
+ function computeDailyClueState(dailyClue) {
389
+ const { startDate, endDate } = dailyClue.gameFields.gameDate;
390
+ const { solutionShuffled, collected } = dailyClue.letterInfo;
391
+ const today = nzStartOfDay();
392
+ const start = nzStartOfDay(startDate);
393
+ const end = nzStartOfDay(endDate);
394
+ if (today.isBefore(start)) {
395
+ return null;
396
+ }
397
+ const shuffledPlacements = seededShuffle(
398
+ gameScreenIdentifierList,
399
+ start.toISOString()
400
+ );
401
+ const index = getDayIndex(start, today);
402
+ if (today.isAfter(end)) {
403
+ return {
404
+ todaysClue: null,
405
+ todaysLetter: null,
406
+ todaysPlacement: null
407
+ };
408
+ }
409
+ if (index < 0 || index >= solutionShuffled.length || index >= shuffledPlacements.length) {
410
+ return null;
411
+ }
412
+ const letterToday = solutionShuffled[index];
413
+ const placement = shuffledPlacements[index];
414
+ if (!letterToday || !placement) return null;
415
+ const alreadyCollectedToday = (collected ?? []).includes(letterToday);
416
+ if (alreadyCollectedToday) {
417
+ return {
418
+ todaysClue: null,
419
+ todaysLetter: null,
420
+ todaysPlacement: null
421
+ };
422
+ }
423
+ return {
424
+ todaysClue: placement.clue,
425
+ todaysLetter: letterToday,
426
+ todaysPlacement: placement.id
427
+ };
428
+ }
429
+
273
430
  // src/sharing/relationShareTypes.ts
274
431
  var RELATION_SHARE_INVITATION = "invitation";
275
432
  var RELATION_SHARE_APPLICATION = "application";
@@ -355,10 +512,6 @@ var truncateText = (text, maxLength = 30) => {
355
512
  const result = stripOverlaySubtitleSpecialChars(text);
356
513
  return result.length > maxLength ? result.substring(0, maxLength) + "..." : result;
357
514
  };
358
- var mapArrayToOptions = (items) => items.map((item) => ({
359
- label: item,
360
- value: item
361
- }));
362
515
  var capitalizeFirstLetter = (str) => {
363
516
  return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
364
517
  };
@@ -445,157 +598,6 @@ function formatNZBankAccount(input) {
445
598
  return parts.join("-");
446
599
  }
447
600
 
448
- // src/utils/date.ts
449
- var dateFormat = "DD-MM-YYYY";
450
- var timeFormat = "HH:mm";
451
- import_dayjs.default.extend(import_customParseFormat.default);
452
- import_dayjs.default.extend(import_utc.default);
453
- import_dayjs.default.extend(import_timezone.default);
454
- import_dayjs.default.extend(import_isSameOrAfter.default);
455
- var NZ_TZ = "Pacific/Auckland";
456
- function toNZTime(date) {
457
- return date ? (0, import_dayjs.default)(date).tz(NZ_TZ) : (0, import_dayjs.default)().tz(NZ_TZ);
458
- }
459
- function nzStartOfDay(input) {
460
- if (input == null) {
461
- return (0, import_dayjs.default)().tz(NZ_TZ).startOf("day");
462
- }
463
- return import_dayjs.default.tz(input, NZ_TZ).startOf("day");
464
- }
465
- var formatDate = (dateStr, display = "datetime", timeStr) => {
466
- const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
467
- const dateTime = timeStr ? (0, import_dayjs.default)(dateTimeStr, `${dateFormat} ${timeFormat}`) : (0, import_dayjs.default)(dateStr, dateFormat);
468
- const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
469
- const formattedTime = dateTime.format("h:mm a");
470
- switch (display) {
471
- case "date":
472
- return formattedDate;
473
- case "time":
474
- return formattedTime;
475
- case "datetime":
476
- return `${formattedDate} at ${formattedTime}`;
477
- default:
478
- return formattedDate;
479
- }
480
- };
481
- var getCurrentAndFutureDates = (dates) => {
482
- const now = (0, import_dayjs.default)();
483
- return dates.filter((dateObj) => {
484
- const dateTime = (0, import_dayjs.default)(
485
- `${dateObj.startDate} ${dateObj.startTime}`,
486
- `${dateFormat} ${timeFormat}`
487
- );
488
- return dateTime.isSameOrAfter(now);
489
- });
490
- };
491
- var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
492
- const threshold = minHoursFromNow ? (0, import_dayjs.default)().add(minHoursFromNow, "hour") : (0, import_dayjs.default)().startOf("day");
493
- const dateTime = (0, import_dayjs.default)(
494
- `${date.startDate} ${date.startTime}`,
495
- `${dateFormat} ${timeFormat}`
496
- );
497
- return dateTime.isSameOrAfter(threshold);
498
- };
499
- var formatTimestamp = (timestamp) => {
500
- const formattedDate = toNZTime(timestamp).format(dateFormat);
501
- return formatDate(formattedDate, "date");
502
- };
503
- var isIsoDateString = (value) => {
504
- return typeof value === "string" && !Number.isNaN(Date.parse(value));
505
- };
506
- function sortDatesChronologically(dates) {
507
- if (!dates?.length) {
508
- return [];
509
- }
510
- return [...dates].sort((a, b) => {
511
- const dateTimeFormat = `${dateFormat} ${timeFormat}`;
512
- const dateA = (0, import_dayjs.default)(`${a.startDate} ${a.startTime}`, dateTimeFormat);
513
- const dateB = (0, import_dayjs.default)(`${b.startDate} ${b.startTime}`, dateTimeFormat);
514
- return dateA.valueOf() - dateB.valueOf();
515
- });
516
- }
517
- var futureTimePeriods = mapArrayToOptions(
518
- Object.values(EnumEventDateStatus)
519
- ).filter(
520
- (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 */
521
- ).map((period) => ({
522
- label: period.value.replaceAll("_", " "),
523
- value: period.value
524
- }));
525
-
526
- // src/utils/dailyClueGame.ts
527
- function createSeededRng(seed) {
528
- let t = seed >>> 0;
529
- return function random() {
530
- t += 1831565813;
531
- let x = t;
532
- x = Math.imul(x ^ x >>> 15, x | 1);
533
- x ^= x + Math.imul(x ^ x >>> 7, x | 61);
534
- return ((x ^ x >>> 14) >>> 0) / 4294967296;
535
- };
536
- }
537
- function hashStringToNumber(seed) {
538
- let hash = 2166136261;
539
- for (let i = 0; i < seed.length; i++) {
540
- hash ^= seed.codePointAt(i) ?? 0;
541
- hash = Math.imul(hash, 16777619);
542
- }
543
- return hash >>> 0;
544
- }
545
- function seededShuffle(array, seed) {
546
- const rng = createSeededRng(hashStringToNumber(seed));
547
- const result = [...array];
548
- for (let i = result.length - 1; i > 0; i--) {
549
- const j = Math.floor(rng() * (i + 1));
550
- [result[i], result[j]] = [result[j], result[i]];
551
- }
552
- return result;
553
- }
554
- function getDayIndex(start, today) {
555
- return today.diff(start, "day");
556
- }
557
- function computeDailyClueState(dailyClue) {
558
- const { startDate, endDate } = dailyClue.gameFields.gameDate;
559
- const { solutionShuffled, collected } = dailyClue.letterInfo;
560
- const today = nzStartOfDay();
561
- const start = nzStartOfDay(startDate);
562
- const end = nzStartOfDay(endDate);
563
- if (today.isBefore(start)) {
564
- return null;
565
- }
566
- const shuffledPlacements = seededShuffle(
567
- gameScreenIdentifierList,
568
- start.toISOString()
569
- );
570
- const index = getDayIndex(start, today);
571
- if (today.isAfter(end)) {
572
- return {
573
- todaysClue: null,
574
- todaysLetter: null,
575
- todaysPlacement: null
576
- };
577
- }
578
- if (index < 0 || index >= solutionShuffled.length || index >= shuffledPlacements.length) {
579
- return null;
580
- }
581
- const letterToday = solutionShuffled[index];
582
- const placement = shuffledPlacements[index];
583
- if (!letterToday || !placement) return null;
584
- const alreadyCollectedToday = (collected ?? []).includes(letterToday);
585
- if (alreadyCollectedToday) {
586
- return {
587
- todaysClue: null,
588
- todaysLetter: null,
589
- todaysPlacement: null
590
- };
591
- }
592
- return {
593
- todaysClue: placement.clue,
594
- todaysLetter: letterToday,
595
- todaysPlacement: placement.id
596
- };
597
- }
598
-
599
601
  // src/utils/affiliate.ts
600
602
  var AFFILIATE_REWARDS = {
601
603
  ["NEW_EVENT_REGISTRATION" /* NEW_EVENT_REGISTRATION */]: {