@timardex/cluemart-shared 1.5.502 → 1.5.503

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,4 +1,4 @@
1
- import "../chunk-6JRXEOO3.mjs";
1
+ import "../chunk-KEUG6IHV.mjs";
2
2
  import "../chunk-RQDZX76B.mjs";
3
3
  import "../chunk-DWO35OY4.mjs";
4
4
  import "../chunk-I7WE3EBR.mjs";
@@ -14,7 +14,7 @@ import {
14
14
  dateFormat,
15
15
  normalizeUrl,
16
16
  timeFormat
17
- } from "../chunk-PZZKQ3IV.mjs";
17
+ } from "../chunk-P7FGPPWG.mjs";
18
18
  import {
19
19
  EnumEventDateStatus,
20
20
  EnumEventType,
package/dist/index.cjs CHANGED
@@ -730,7 +730,6 @@ var priceUnits = [
730
730
 
731
731
  // src/utils/dailyClueGame.ts
732
732
  var import_dayjs = __toESM(require("dayjs"));
733
- var import_utc = __toESM(require("dayjs/plugin/utc"));
734
733
 
735
734
  // src/types/game.ts
736
735
  var gameScreenIdentifierList = [
@@ -845,7 +844,6 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
845
844
  })(EnumGameStatus || {});
846
845
 
847
846
  // src/utils/dailyClueGame.ts
848
- import_dayjs.default.extend(import_utc.default);
849
847
  function createSeededRng(seed) {
850
848
  let t = seed >>> 0;
851
849
  return function random() {
@@ -873,15 +871,15 @@ function seededShuffle(array6, seed) {
873
871
  }
874
872
  return result;
875
873
  }
876
- function getDayIndex(startDate) {
877
- return (0, import_dayjs.default)().utc().startOf("day").diff((0, import_dayjs.default)(startDate).utc().startOf("day"), "day");
874
+ function getDayIndex(start, today) {
875
+ return today.diff(start, "day");
878
876
  }
879
877
  function computeDailyClueState(dailyClue) {
880
878
  const { startDate, endDate } = dailyClue.gameFields.gameDate;
881
879
  const { shuffled, collected } = dailyClue.letterInfo;
882
- const today = (0, import_dayjs.default)().utc().startOf("day");
883
- const start = (0, import_dayjs.default)(startDate).utc().startOf("day");
884
- const end = (0, import_dayjs.default)(endDate).utc().startOf("day");
880
+ const today = (0, import_dayjs.default)().startOf("day");
881
+ const start = (0, import_dayjs.default)(startDate).startOf("day");
882
+ const end = (0, import_dayjs.default)(endDate).startOf("day");
885
883
  const shuffledPlacements = seededShuffle(
886
884
  gameScreenIdentifierList,
887
885
  start.toISOString()
@@ -889,14 +887,6 @@ function computeDailyClueState(dailyClue) {
889
887
  if (today.isBefore(start)) {
890
888
  return null;
891
889
  }
892
- if (today.isAfter(end)) {
893
- return null;
894
- }
895
- const index = getDayIndex(startDate);
896
- if (index < 0 || index >= shuffled.length) return null;
897
- if (collected?.includes(shuffled[index])) {
898
- return null;
899
- }
900
890
  if (today.isAfter(end)) {
901
891
  return {
902
892
  gameHistory: {
@@ -910,6 +900,11 @@ function computeDailyClueState(dailyClue) {
910
900
  todaysPlacement: null
911
901
  };
912
902
  }
903
+ const index = getDayIndex(start, today);
904
+ if (index < 0 || index >= shuffled.length) return null;
905
+ if (collected?.includes(shuffled[index])) {
906
+ return null;
907
+ }
913
908
  return {
914
909
  gameHistory: null,
915
910
  todaysClue: shuffledPlacements[index].clue,
@@ -923,11 +918,11 @@ var import_dayjs2 = __toESM(require("dayjs"));
923
918
  var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
924
919
  var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter.js"));
925
920
  var import_timezone = __toESM(require("dayjs/plugin/timezone.js"));
926
- var import_utc2 = __toESM(require("dayjs/plugin/utc.js"));
921
+ var import_utc = __toESM(require("dayjs/plugin/utc.js"));
927
922
  var dateFormat = "DD-MM-YYYY";
928
923
  var timeFormat = "HH:mm";
929
924
  import_dayjs2.default.extend(import_customParseFormat.default);
930
- import_dayjs2.default.extend(import_utc2.default);
925
+ import_dayjs2.default.extend(import_utc.default);
931
926
  import_dayjs2.default.extend(import_timezone.default);
932
927
  import_dayjs2.default.extend(import_isSameOrAfter.default);
933
928
  var NZ_TZ = "Pacific/Auckland";