@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.
package/dist/index.d.mts CHANGED
@@ -1654,7 +1654,7 @@ declare const useGetEventsByRegion: (region: string, options?: UseGetEventsByReg
1654
1654
  eventsByRegion: EventListItemType[];
1655
1655
  }>>;
1656
1656
  };
1657
- declare const useSearchEvents: (search: string, region: string) => {
1657
+ declare const useSearchEvents: (region: string, search?: string, tags?: string[]) => {
1658
1658
  error: _apollo_client.ApolloError | undefined;
1659
1659
  eventsSearch: EventListItemType[];
1660
1660
  loading: boolean;
package/dist/index.d.ts CHANGED
@@ -1654,7 +1654,7 @@ declare const useGetEventsByRegion: (region: string, options?: UseGetEventsByReg
1654
1654
  eventsByRegion: EventListItemType[];
1655
1655
  }>>;
1656
1656
  };
1657
- declare const useSearchEvents: (search: string, region: string) => {
1657
+ declare const useSearchEvents: (region: string, search?: string, tags?: string[]) => {
1658
1658
  error: _apollo_client.ApolloError | undefined;
1659
1659
  eventsSearch: EventListItemType[];
1660
1660
  loading: boolean;
package/dist/index.mjs CHANGED
@@ -657,13 +657,14 @@ function computeDailyClueState(dailyClue) {
657
657
  const today = nzStartOfDay();
658
658
  const start = nzStartOfDay(startDate);
659
659
  const end = nzStartOfDay(endDate);
660
+ if (today.isBefore(start)) {
661
+ return null;
662
+ }
660
663
  const shuffledPlacements = seededShuffle(
661
664
  gameScreenIdentifierList,
662
665
  start.toISOString()
663
666
  );
664
- if (today.isBefore(start)) {
665
- return null;
666
- }
667
+ const index = getDayIndex(start, today);
667
668
  if (today.isAfter(end)) {
668
669
  return {
669
670
  todaysClue: null,
@@ -671,31 +672,24 @@ function computeDailyClueState(dailyClue) {
671
672
  todaysPlacement: null
672
673
  };
673
674
  }
674
- const index = getDayIndex(start, today);
675
- console.log("DEBUG", {
676
- collected,
677
- end: end.format(),
678
- index,
679
- shuffled,
680
- shuffledPlacements,
681
- start: start.format(),
682
- today: today.format()
683
- });
684
- if (index < 0 || index >= shuffled.length) return null;
685
- const collectedCount = (collected ?? []).length;
686
- if (collectedCount > index) {
675
+ if (index < 0 || index >= shuffled.length || index >= shuffledPlacements.length) {
676
+ return null;
677
+ }
678
+ const letterToday = shuffled[index];
679
+ const placement = shuffledPlacements[index];
680
+ if (!letterToday || !placement) return null;
681
+ const alreadyCollectedToday = (collected ?? []).includes(letterToday);
682
+ if (alreadyCollectedToday) {
687
683
  return {
688
684
  todaysClue: null,
689
685
  todaysLetter: null,
690
686
  todaysPlacement: null
691
687
  };
692
688
  }
693
- const letterToday = shuffled[index];
694
- if (!letterToday) return null;
695
689
  return {
696
- todaysClue: shuffledPlacements[index].clue,
690
+ todaysClue: placement.clue,
697
691
  todaysLetter: letterToday,
698
- todaysPlacement: shuffledPlacements[index].id
692
+ todaysPlacement: placement.id
699
693
  };
700
694
  }
701
695
 
@@ -2917,8 +2911,8 @@ var GET_EVENTS_BY_REGION = gql3`
2917
2911
  ${EVENT_LIST_ITEM}
2918
2912
  `;
2919
2913
  var SEARCH_EVENTS = gql3`
2920
- query searchEvents($search: String!, $region: String) {
2921
- eventsSearch(search: $search, region: $region) {
2914
+ query searchEvents($region: String, $search: String,$tags: [String]) {
2915
+ eventsSearch(region: $region, search: $search, tags: $tags) {
2922
2916
  ...EventListItemFields
2923
2917
  }
2924
2918
  }
@@ -4031,11 +4025,11 @@ var useGetEventsByRegion = (region, options) => {
4031
4025
  refetch
4032
4026
  };
4033
4027
  };
4034
- var useSearchEvents = (search, region) => {
4028
+ var useSearchEvents = (region, search, tags) => {
4035
4029
  const { loading, error, data, refetch } = useQuery2(SEARCH_EVENTS, {
4036
4030
  fetchPolicy: "network-only",
4037
- skip: search.length < 3 || !region || region === "",
4038
- variables: { region, search }
4031
+ skip: !search || search.length < 3 || !region || region === "",
4032
+ variables: { region, search, tags }
4039
4033
  });
4040
4034
  const eventsSearch = data?.eventsSearch || [];
4041
4035
  return { error, eventsSearch, loading, refetch };