@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
package/dist/index.d.mts CHANGED
@@ -801,6 +801,7 @@ type PosterUsageType = {
801
801
  count: number;
802
802
  };
803
803
  type RelatedPostType = {
804
+ postActive: boolean;
804
805
  postId: string;
805
806
  postSlug: string;
806
807
  postType: EnumPostType;
@@ -3035,6 +3036,11 @@ declare const futureTimePeriods: {
3035
3036
  value: string;
3036
3037
  }[];
3037
3038
 
3039
+ /**
3040
+ * Convert an array of strings to an array of objects with label and value properties.
3041
+ */
3042
+ declare const mapArrayToOptions: (items: string[]) => OptionItem[];
3043
+
3038
3044
  declare const removeTypename: (obj: any) => any;
3039
3045
  /**
3040
3046
  * Truncate text to a specified length and append ellipsis if necessary.
@@ -3043,12 +3049,6 @@ declare const removeTypename: (obj: any) => any;
3043
3049
  * @returns
3044
3050
  */
3045
3051
  declare const truncateText: (text: string, maxLength?: number) => string;
3046
- /**
3047
- * Convert an array of strings to an array of objects with label and value properties.
3048
- * @param items - The array of strings to convert.
3049
- * @returns - The converted array of objects.
3050
- */
3051
- declare const mapArrayToOptions: (items: string[]) => OptionItem[];
3052
3052
  declare const capitalizeFirstLetter: (str: string) => string;
3053
3053
  declare const statusOptions: {
3054
3054
  label: EnumInviteStatus;
package/dist/index.d.ts CHANGED
@@ -801,6 +801,7 @@ type PosterUsageType = {
801
801
  count: number;
802
802
  };
803
803
  type RelatedPostType = {
804
+ postActive: boolean;
804
805
  postId: string;
805
806
  postSlug: string;
806
807
  postType: EnumPostType;
@@ -3035,6 +3036,11 @@ declare const futureTimePeriods: {
3035
3036
  value: string;
3036
3037
  }[];
3037
3038
 
3039
+ /**
3040
+ * Convert an array of strings to an array of objects with label and value properties.
3041
+ */
3042
+ declare const mapArrayToOptions: (items: string[]) => OptionItem[];
3043
+
3038
3044
  declare const removeTypename: (obj: any) => any;
3039
3045
  /**
3040
3046
  * Truncate text to a specified length and append ellipsis if necessary.
@@ -3043,12 +3049,6 @@ declare const removeTypename: (obj: any) => any;
3043
3049
  * @returns
3044
3050
  */
3045
3051
  declare const truncateText: (text: string, maxLength?: number) => string;
3046
- /**
3047
- * Convert an array of strings to an array of objects with label and value properties.
3048
- * @param items - The array of strings to convert.
3049
- * @returns - The converted array of objects.
3050
- */
3051
- declare const mapArrayToOptions: (items: string[]) => OptionItem[];
3052
3052
  declare const capitalizeFirstLetter: (str: string) => string;
3053
3053
  declare const statusOptions: {
3054
3054
  label: EnumInviteStatus;
package/dist/index.mjs CHANGED
@@ -562,6 +562,163 @@ import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
562
562
  import timezone from "dayjs/plugin/timezone.js";
563
563
  import utc from "dayjs/plugin/utc.js";
564
564
 
565
+ // src/utils/mapArrayToOptions.ts
566
+ var mapArrayToOptions = (items) => items.map((item) => ({
567
+ label: item,
568
+ value: item
569
+ }));
570
+
571
+ // src/utils/date.ts
572
+ var dateFormat = "DD-MM-YYYY";
573
+ var timeFormat = "HH:mm";
574
+ dayjs.extend(customParseFormat);
575
+ dayjs.extend(utc);
576
+ dayjs.extend(timezone);
577
+ dayjs.extend(isSameOrAfter);
578
+ var NZ_TZ = "Pacific/Auckland";
579
+ function toNZTime(date) {
580
+ return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
581
+ }
582
+ function nzStartOfDay(input) {
583
+ if (input == null) {
584
+ return dayjs().tz(NZ_TZ).startOf("day");
585
+ }
586
+ return dayjs.tz(input, NZ_TZ).startOf("day");
587
+ }
588
+ var formatDate = (dateStr, display = "datetime", timeStr) => {
589
+ const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
590
+ const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
591
+ const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
592
+ const formattedTime = dateTime.format("h:mm a");
593
+ switch (display) {
594
+ case "date":
595
+ return formattedDate;
596
+ case "time":
597
+ return formattedTime;
598
+ case "datetime":
599
+ return `${formattedDate} at ${formattedTime}`;
600
+ default:
601
+ return formattedDate;
602
+ }
603
+ };
604
+ var getCurrentAndFutureDates = (dates) => {
605
+ const now = dayjs();
606
+ return dates.filter((dateObj) => {
607
+ const dateTime = dayjs(
608
+ `${dateObj.startDate} ${dateObj.startTime}`,
609
+ `${dateFormat} ${timeFormat}`
610
+ );
611
+ return dateTime.isSameOrAfter(now);
612
+ });
613
+ };
614
+ var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
615
+ const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
616
+ const dateTime = dayjs(
617
+ `${date.startDate} ${date.startTime}`,
618
+ `${dateFormat} ${timeFormat}`
619
+ );
620
+ return dateTime.isSameOrAfter(threshold);
621
+ };
622
+ var formatTimestamp = (timestamp) => {
623
+ const formattedDate = toNZTime(timestamp).format(dateFormat);
624
+ return formatDate(formattedDate, "date");
625
+ };
626
+ var isIsoDateString = (value) => {
627
+ return typeof value === "string" && !Number.isNaN(Date.parse(value));
628
+ };
629
+ function sortDatesChronologically(dates) {
630
+ if (!dates?.length) {
631
+ return [];
632
+ }
633
+ return [...dates].sort((a, b) => {
634
+ const dateTimeFormat = `${dateFormat} ${timeFormat}`;
635
+ const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
636
+ const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
637
+ return dateA.valueOf() - dateB.valueOf();
638
+ });
639
+ }
640
+ var futureTimePeriods = mapArrayToOptions(
641
+ Object.values(EnumEventDateStatus)
642
+ ).filter(
643
+ (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 */
644
+ ).map((period) => ({
645
+ label: period.value.replaceAll("_", " "),
646
+ value: period.value
647
+ }));
648
+
649
+ // src/utils/dailyClueGame.ts
650
+ function createSeededRng(seed) {
651
+ let t = seed >>> 0;
652
+ return function random() {
653
+ t += 1831565813;
654
+ let x = t;
655
+ x = Math.imul(x ^ x >>> 15, x | 1);
656
+ x ^= x + Math.imul(x ^ x >>> 7, x | 61);
657
+ return ((x ^ x >>> 14) >>> 0) / 4294967296;
658
+ };
659
+ }
660
+ function hashStringToNumber(seed) {
661
+ let hash = 2166136261;
662
+ for (let i = 0; i < seed.length; i++) {
663
+ hash ^= seed.codePointAt(i) ?? 0;
664
+ hash = Math.imul(hash, 16777619);
665
+ }
666
+ return hash >>> 0;
667
+ }
668
+ function seededShuffle(array, seed) {
669
+ const rng = createSeededRng(hashStringToNumber(seed));
670
+ const result = [...array];
671
+ for (let i = result.length - 1; i > 0; i--) {
672
+ const j = Math.floor(rng() * (i + 1));
673
+ [result[i], result[j]] = [result[j], result[i]];
674
+ }
675
+ return result;
676
+ }
677
+ function getDayIndex(start, today) {
678
+ return today.diff(start, "day");
679
+ }
680
+ function computeDailyClueState(dailyClue) {
681
+ const { startDate, endDate } = dailyClue.gameFields.gameDate;
682
+ const { solutionShuffled, collected } = dailyClue.letterInfo;
683
+ const today = nzStartOfDay();
684
+ const start = nzStartOfDay(startDate);
685
+ const end = nzStartOfDay(endDate);
686
+ if (today.isBefore(start)) {
687
+ return null;
688
+ }
689
+ const shuffledPlacements = seededShuffle(
690
+ gameScreenIdentifierList,
691
+ start.toISOString()
692
+ );
693
+ const index = getDayIndex(start, today);
694
+ if (today.isAfter(end)) {
695
+ return {
696
+ todaysClue: null,
697
+ todaysLetter: null,
698
+ todaysPlacement: null
699
+ };
700
+ }
701
+ if (index < 0 || index >= solutionShuffled.length || index >= shuffledPlacements.length) {
702
+ return null;
703
+ }
704
+ const letterToday = solutionShuffled[index];
705
+ const placement = shuffledPlacements[index];
706
+ if (!letterToday || !placement) return null;
707
+ const alreadyCollectedToday = (collected ?? []).includes(letterToday);
708
+ if (alreadyCollectedToday) {
709
+ return {
710
+ todaysClue: null,
711
+ todaysLetter: null,
712
+ todaysPlacement: null
713
+ };
714
+ }
715
+ return {
716
+ todaysClue: placement.clue,
717
+ todaysLetter: letterToday,
718
+ todaysPlacement: placement.id
719
+ };
720
+ }
721
+
565
722
  // src/sharing/relationShareTypes.ts
566
723
  var RELATION_SHARE_INVITATION = "invitation";
567
724
  var RELATION_SHARE_APPLICATION = "application";
@@ -846,10 +1003,6 @@ var truncateText = (text, maxLength = 30) => {
846
1003
  const result = stripOverlaySubtitleSpecialChars(text);
847
1004
  return result.length > maxLength ? result.substring(0, maxLength) + "..." : result;
848
1005
  };
849
- var mapArrayToOptions = (items) => items.map((item) => ({
850
- label: item,
851
- value: item
852
- }));
853
1006
  var capitalizeFirstLetter = (str) => {
854
1007
  return str.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
855
1008
  };
@@ -936,157 +1089,6 @@ function formatNZBankAccount(input) {
936
1089
  return parts.join("-");
937
1090
  }
938
1091
 
939
- // src/utils/date.ts
940
- var dateFormat = "DD-MM-YYYY";
941
- var timeFormat = "HH:mm";
942
- dayjs.extend(customParseFormat);
943
- dayjs.extend(utc);
944
- dayjs.extend(timezone);
945
- dayjs.extend(isSameOrAfter);
946
- var NZ_TZ = "Pacific/Auckland";
947
- function toNZTime(date) {
948
- return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
949
- }
950
- function nzStartOfDay(input) {
951
- if (input == null) {
952
- return dayjs().tz(NZ_TZ).startOf("day");
953
- }
954
- return dayjs.tz(input, NZ_TZ).startOf("day");
955
- }
956
- var formatDate = (dateStr, display = "datetime", timeStr) => {
957
- const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
958
- const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
959
- const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
960
- const formattedTime = dateTime.format("h:mm a");
961
- switch (display) {
962
- case "date":
963
- return formattedDate;
964
- case "time":
965
- return formattedTime;
966
- case "datetime":
967
- return `${formattedDate} at ${formattedTime}`;
968
- default:
969
- return formattedDate;
970
- }
971
- };
972
- var getCurrentAndFutureDates = (dates) => {
973
- const now = dayjs();
974
- return dates.filter((dateObj) => {
975
- const dateTime = dayjs(
976
- `${dateObj.startDate} ${dateObj.startTime}`,
977
- `${dateFormat} ${timeFormat}`
978
- );
979
- return dateTime.isSameOrAfter(now);
980
- });
981
- };
982
- var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
983
- const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
984
- const dateTime = dayjs(
985
- `${date.startDate} ${date.startTime}`,
986
- `${dateFormat} ${timeFormat}`
987
- );
988
- return dateTime.isSameOrAfter(threshold);
989
- };
990
- var formatTimestamp = (timestamp) => {
991
- const formattedDate = toNZTime(timestamp).format(dateFormat);
992
- return formatDate(formattedDate, "date");
993
- };
994
- var isIsoDateString = (value) => {
995
- return typeof value === "string" && !Number.isNaN(Date.parse(value));
996
- };
997
- function sortDatesChronologically(dates) {
998
- if (!dates?.length) {
999
- return [];
1000
- }
1001
- return [...dates].sort((a, b) => {
1002
- const dateTimeFormat = `${dateFormat} ${timeFormat}`;
1003
- const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
1004
- const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
1005
- return dateA.valueOf() - dateB.valueOf();
1006
- });
1007
- }
1008
- var futureTimePeriods = mapArrayToOptions(
1009
- Object.values(EnumEventDateStatus)
1010
- ).filter(
1011
- (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 */
1012
- ).map((period) => ({
1013
- label: period.value.replaceAll("_", " "),
1014
- value: period.value
1015
- }));
1016
-
1017
- // src/utils/dailyClueGame.ts
1018
- function createSeededRng(seed) {
1019
- let t = seed >>> 0;
1020
- return function random() {
1021
- t += 1831565813;
1022
- let x = t;
1023
- x = Math.imul(x ^ x >>> 15, x | 1);
1024
- x ^= x + Math.imul(x ^ x >>> 7, x | 61);
1025
- return ((x ^ x >>> 14) >>> 0) / 4294967296;
1026
- };
1027
- }
1028
- function hashStringToNumber(seed) {
1029
- let hash = 2166136261;
1030
- for (let i = 0; i < seed.length; i++) {
1031
- hash ^= seed.codePointAt(i) ?? 0;
1032
- hash = Math.imul(hash, 16777619);
1033
- }
1034
- return hash >>> 0;
1035
- }
1036
- function seededShuffle(array, seed) {
1037
- const rng = createSeededRng(hashStringToNumber(seed));
1038
- const result = [...array];
1039
- for (let i = result.length - 1; i > 0; i--) {
1040
- const j = Math.floor(rng() * (i + 1));
1041
- [result[i], result[j]] = [result[j], result[i]];
1042
- }
1043
- return result;
1044
- }
1045
- function getDayIndex(start, today) {
1046
- return today.diff(start, "day");
1047
- }
1048
- function computeDailyClueState(dailyClue) {
1049
- const { startDate, endDate } = dailyClue.gameFields.gameDate;
1050
- const { solutionShuffled, collected } = dailyClue.letterInfo;
1051
- const today = nzStartOfDay();
1052
- const start = nzStartOfDay(startDate);
1053
- const end = nzStartOfDay(endDate);
1054
- if (today.isBefore(start)) {
1055
- return null;
1056
- }
1057
- const shuffledPlacements = seededShuffle(
1058
- gameScreenIdentifierList,
1059
- start.toISOString()
1060
- );
1061
- const index = getDayIndex(start, today);
1062
- if (today.isAfter(end)) {
1063
- return {
1064
- todaysClue: null,
1065
- todaysLetter: null,
1066
- todaysPlacement: null
1067
- };
1068
- }
1069
- if (index < 0 || index >= solutionShuffled.length || index >= shuffledPlacements.length) {
1070
- return null;
1071
- }
1072
- const letterToday = solutionShuffled[index];
1073
- const placement = shuffledPlacements[index];
1074
- if (!letterToday || !placement) return null;
1075
- const alreadyCollectedToday = (collected ?? []).includes(letterToday);
1076
- if (alreadyCollectedToday) {
1077
- return {
1078
- todaysClue: null,
1079
- todaysLetter: null,
1080
- todaysPlacement: null
1081
- };
1082
- }
1083
- return {
1084
- todaysClue: placement.clue,
1085
- todaysLetter: letterToday,
1086
- todaysPlacement: placement.id
1087
- };
1088
- }
1089
-
1090
1092
  // src/utils/affiliate.ts
1091
1093
  var AFFILIATE_REWARDS = {
1092
1094
  ["NEW_EVENT_REGISTRATION" /* NEW_EVENT_REGISTRATION */]: {
@@ -3390,6 +3392,7 @@ var EVENT_LIST_ITEM = gql`
3390
3392
  `;
3391
3393
  var RELATED_POST_FIELDS_FRAGMENT = gql`
3392
3394
  fragment RelatedPostFields on RelatedPostType {
3395
+ postActive
3393
3396
  postId
3394
3397
  postSlug
3395
3398
  postType