@timardex/cluemart-shared 1.5.544 → 1.5.546

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,10 +1,10 @@
1
- import "../chunk-7435FNA7.mjs";
1
+ import "../chunk-L47NQHZ6.mjs";
2
2
  import {
3
3
  dateFormat,
4
4
  normalizeUrl,
5
5
  timeFormat
6
- } from "../chunk-TERE6URA.mjs";
7
- import "../chunk-G2YFRN6A.mjs";
6
+ } from "../chunk-Z3JWNX2U.mjs";
7
+ import "../chunk-EZO7FVLV.mjs";
8
8
  import {
9
9
  EnumEventDateStatus,
10
10
  EnumEventType,
package/dist/index.cjs CHANGED
@@ -982,13 +982,14 @@ function computeDailyClueState(dailyClue) {
982
982
  const today = nzStartOfDay();
983
983
  const start = nzStartOfDay(startDate);
984
984
  const end = nzStartOfDay(endDate);
985
+ if (today.isBefore(start)) {
986
+ return null;
987
+ }
985
988
  const shuffledPlacements = seededShuffle(
986
989
  gameScreenIdentifierList,
987
990
  start.toISOString()
988
991
  );
989
- if (today.isBefore(start)) {
990
- return null;
991
- }
992
+ const index = getDayIndex(start, today);
992
993
  if (today.isAfter(end)) {
993
994
  return {
994
995
  todaysClue: null,
@@ -996,31 +997,24 @@ function computeDailyClueState(dailyClue) {
996
997
  todaysPlacement: null
997
998
  };
998
999
  }
999
- const index = getDayIndex(start, today);
1000
- console.log("DEBUG", {
1001
- collected,
1002
- end: end.format(),
1003
- index,
1004
- shuffled,
1005
- shuffledPlacements,
1006
- start: start.format(),
1007
- today: today.format()
1008
- });
1009
- if (index < 0 || index >= shuffled.length) return null;
1010
- const collectedCount = (collected ?? []).length;
1011
- if (collectedCount > index) {
1000
+ if (index < 0 || index >= shuffled.length || index >= shuffledPlacements.length) {
1001
+ return null;
1002
+ }
1003
+ const letterToday = shuffled[index];
1004
+ const placement = shuffledPlacements[index];
1005
+ if (!letterToday || !placement) return null;
1006
+ const alreadyCollectedToday = (collected ?? []).includes(letterToday);
1007
+ if (alreadyCollectedToday) {
1012
1008
  return {
1013
1009
  todaysClue: null,
1014
1010
  todaysLetter: null,
1015
1011
  todaysPlacement: null
1016
1012
  };
1017
1013
  }
1018
- const letterToday = shuffled[index];
1019
- if (!letterToday) return null;
1020
1014
  return {
1021
- todaysClue: shuffledPlacements[index].clue,
1015
+ todaysClue: placement.clue,
1022
1016
  todaysLetter: letterToday,
1023
- todaysPlacement: shuffledPlacements[index].id
1017
+ todaysPlacement: placement.id
1024
1018
  };
1025
1019
  }
1026
1020
 
@@ -3242,8 +3236,8 @@ var GET_EVENTS_BY_REGION = import_client3.gql`
3242
3236
  ${EVENT_LIST_ITEM}
3243
3237
  `;
3244
3238
  var SEARCH_EVENTS = import_client3.gql`
3245
- query searchEvents($search: String!, $region: String) {
3246
- eventsSearch(search: $search, region: $region) {
3239
+ query searchEvents($region: String, $search: String,$tags: [String]) {
3240
+ eventsSearch(region: $region, search: $search, tags: $tags) {
3247
3241
  ...EventListItemFields
3248
3242
  }
3249
3243
  }
@@ -4356,11 +4350,11 @@ var useGetEventsByRegion = (region, options) => {
4356
4350
  refetch
4357
4351
  };
4358
4352
  };
4359
- var useSearchEvents = (search, region) => {
4353
+ var useSearchEvents = (region, search, tags) => {
4360
4354
  const { loading, error, data, refetch } = (0, import_client19.useQuery)(SEARCH_EVENTS, {
4361
4355
  fetchPolicy: "network-only",
4362
- skip: search.length < 3 || !region || region === "",
4363
- variables: { region, search }
4356
+ skip: !search || search.length < 3 || !region || region === "",
4357
+ variables: { region, search, tags }
4364
4358
  });
4365
4359
  const eventsSearch = data?.eventsSearch || [];
4366
4360
  return { error, eventsSearch, loading, refetch };