@timardex/cluemart-shared 1.5.501 → 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.
- package/dist/{chunk-6JRXEOO3.mjs → chunk-KEUG6IHV.mjs} +2 -2
- package/dist/{chunk-PZZKQ3IV.mjs → chunk-P7FGPPWG.mjs} +13 -18
- package/dist/chunk-P7FGPPWG.mjs.map +1 -0
- package/dist/formFields/index.cjs +2 -4
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.mjs +2 -2
- package/dist/hooks/index.cjs +2 -4
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/index.cjs +12 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +12 -17
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.cjs +12 -17
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-PZZKQ3IV.mjs.map +0 -1
- /package/dist/{chunk-6JRXEOO3.mjs.map → chunk-KEUG6IHV.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -435,7 +435,6 @@ var priceUnits = [
|
|
|
435
435
|
|
|
436
436
|
// src/utils/dailyClueGame.ts
|
|
437
437
|
import dayjs from "dayjs";
|
|
438
|
-
import utc from "dayjs/plugin/utc";
|
|
439
438
|
|
|
440
439
|
// src/types/game.ts
|
|
441
440
|
var gameScreenIdentifierList = [
|
|
@@ -550,7 +549,6 @@ var EnumGameStatus = /* @__PURE__ */ ((EnumGameStatus2) => {
|
|
|
550
549
|
})(EnumGameStatus || {});
|
|
551
550
|
|
|
552
551
|
// src/utils/dailyClueGame.ts
|
|
553
|
-
dayjs.extend(utc);
|
|
554
552
|
function createSeededRng(seed) {
|
|
555
553
|
let t = seed >>> 0;
|
|
556
554
|
return function random() {
|
|
@@ -578,15 +576,15 @@ function seededShuffle(array6, seed) {
|
|
|
578
576
|
}
|
|
579
577
|
return result;
|
|
580
578
|
}
|
|
581
|
-
function getDayIndex(
|
|
582
|
-
return
|
|
579
|
+
function getDayIndex(start, today) {
|
|
580
|
+
return today.diff(start, "day");
|
|
583
581
|
}
|
|
584
582
|
function computeDailyClueState(dailyClue) {
|
|
585
583
|
const { startDate, endDate } = dailyClue.gameFields.gameDate;
|
|
586
584
|
const { shuffled, collected } = dailyClue.letterInfo;
|
|
587
|
-
const today = dayjs().
|
|
588
|
-
const start = dayjs(startDate).
|
|
589
|
-
const end = dayjs(endDate).
|
|
585
|
+
const today = dayjs().startOf("day");
|
|
586
|
+
const start = dayjs(startDate).startOf("day");
|
|
587
|
+
const end = dayjs(endDate).startOf("day");
|
|
590
588
|
const shuffledPlacements = seededShuffle(
|
|
591
589
|
gameScreenIdentifierList,
|
|
592
590
|
start.toISOString()
|
|
@@ -594,14 +592,6 @@ function computeDailyClueState(dailyClue) {
|
|
|
594
592
|
if (today.isBefore(start)) {
|
|
595
593
|
return null;
|
|
596
594
|
}
|
|
597
|
-
if (today.isAfter(end)) {
|
|
598
|
-
return null;
|
|
599
|
-
}
|
|
600
|
-
const index = getDayIndex(startDate);
|
|
601
|
-
if (index < 0 || index >= shuffled.length) return null;
|
|
602
|
-
if (collected?.includes(shuffled[index])) {
|
|
603
|
-
return null;
|
|
604
|
-
}
|
|
605
595
|
if (today.isAfter(end)) {
|
|
606
596
|
return {
|
|
607
597
|
gameHistory: {
|
|
@@ -615,6 +605,11 @@ function computeDailyClueState(dailyClue) {
|
|
|
615
605
|
todaysPlacement: null
|
|
616
606
|
};
|
|
617
607
|
}
|
|
608
|
+
const index = getDayIndex(start, today);
|
|
609
|
+
if (index < 0 || index >= shuffled.length) return null;
|
|
610
|
+
if (collected?.includes(shuffled[index])) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
618
613
|
return {
|
|
619
614
|
gameHistory: null,
|
|
620
615
|
todaysClue: shuffledPlacements[index].clue,
|
|
@@ -628,11 +623,11 @@ import dayjs2 from "dayjs";
|
|
|
628
623
|
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
629
624
|
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
|
630
625
|
import timezone from "dayjs/plugin/timezone.js";
|
|
631
|
-
import
|
|
626
|
+
import utc from "dayjs/plugin/utc.js";
|
|
632
627
|
var dateFormat = "DD-MM-YYYY";
|
|
633
628
|
var timeFormat = "HH:mm";
|
|
634
629
|
dayjs2.extend(customParseFormat);
|
|
635
|
-
dayjs2.extend(
|
|
630
|
+
dayjs2.extend(utc);
|
|
636
631
|
dayjs2.extend(timezone);
|
|
637
632
|
dayjs2.extend(isSameOrAfter);
|
|
638
633
|
var NZ_TZ = "Pacific/Auckland";
|