@timardex/cluemart-shared 1.4.96 → 1.4.98

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.
@@ -133,6 +133,7 @@ __export(graphql_exports, {
133
133
  useToggleChatMessageLike: () => useToggleChatMessageLike,
134
134
  useUpdateAd: () => useUpdateAd,
135
135
  useUpdateAppSettings: () => useUpdateAppSettings,
136
+ useUpdateDailyClueGame: () => useUpdateDailyClueGame,
136
137
  useUpdateEvent: () => useUpdateEvent,
137
138
  useUpdateEventInfo: () => useUpdateEventInfo,
138
139
  useUpdateGoogleImportedMarkets: () => useUpdateGoogleImportedMarkets,
@@ -3388,8 +3389,8 @@ var GAME_FIELDS_FRAGMENT = import_client55.gql`
3388
3389
  ${OWNER_FIELDS_FRAGMENT}
3389
3390
  `;
3390
3391
  var GET_GAMES = import_client55.gql`
3391
- query getGames($userId: ID) {
3392
- games(userId: $userId) {
3392
+ query getGames {
3393
+ games {
3393
3394
  ...GameFields
3394
3395
  }
3395
3396
  }
@@ -3653,10 +3654,16 @@ var START_GAME_MUTATION = import_client64.gql`
3653
3654
  `;
3654
3655
  var LEAVE_GAME_MUTATION = import_client64.gql`
3655
3656
  mutation leaveGame($_id: ID!, $gameType: GameTypeEnumType!) {
3656
- leaveGame(_id: $_id, gameType: $gameType) {
3657
- userId
3657
+ leaveGame(_id: $_id, gameType: $gameType)
3658
+ }
3659
+ `;
3660
+ var UPDATE_DAILY_CLUE_MUTATION = import_client64.gql`
3661
+ mutation updateDailyClueGame($_id: ID!, $foundLetter: String!) {
3662
+ updateDailyClueGame(_id: $_id, foundLetter: $foundLetter) {
3663
+ ...GameFields
3658
3664
  }
3659
3665
  }
3666
+ ${GAME_FIELDS_FRAGMENT}
3660
3667
  `;
3661
3668
 
3662
3669
  // src/graphql/hooks/game/hooksMutation.ts
@@ -3665,12 +3672,18 @@ var useStartGame = () => {
3665
3672
  awaitRefetchQueries: true,
3666
3673
  refetchQueries: (mutationResult) => {
3667
3674
  const gameId = mutationResult?.data?.startGame?._id;
3668
- if (!gameId) return [];
3675
+ const userId = mutationResult?.data?.startGame?.owner?.userId;
3676
+ if (!gameId || !userId) return [];
3669
3677
  return [
3670
3678
  {
3671
3679
  query: GET_GAME,
3672
3680
  variables: { _id: gameId }
3673
3681
  // Pass the gameId for refetching
3682
+ },
3683
+ {
3684
+ query: GET_USER,
3685
+ variables: { _id: userId }
3686
+ // Pass the userId for refetching
3674
3687
  }
3675
3688
  ];
3676
3689
  }
@@ -3679,28 +3692,38 @@ var useStartGame = () => {
3679
3692
  };
3680
3693
  var useLeaveGame = () => {
3681
3694
  const [leaveGame, { loading, error }] = (0, import_client65.useMutation)(LEAVE_GAME_MUTATION, {
3695
+ awaitRefetchQueries: true,
3696
+ refetchQueries: [
3697
+ {
3698
+ query: GET_GAMES
3699
+ }
3700
+ ]
3701
+ });
3702
+ return { error, leaveGame, loading };
3703
+ };
3704
+ var useUpdateDailyClueGame = () => {
3705
+ const [updateDailyClueGame, { loading, error }] = (0, import_client65.useMutation)(UPDATE_DAILY_CLUE_MUTATION, {
3682
3706
  awaitRefetchQueries: true,
3683
3707
  refetchQueries: (mutationResult) => {
3684
- const userId = mutationResult?.data?.leaveGame?.userId;
3685
- if (!userId) return [];
3708
+ const gameId = mutationResult?.data?.updateDailyClueGame?._id;
3709
+ if (!gameId) return [];
3686
3710
  return [
3687
3711
  {
3688
- query: GET_GAMES,
3689
- variables: { userId }
3690
- // Pass the userId for refetching
3712
+ query: GET_GAME,
3713
+ variables: { _id: gameId }
3714
+ // Pass the gameId for refetching
3691
3715
  }
3692
3716
  ];
3693
3717
  }
3694
3718
  });
3695
- return { error, leaveGame, loading };
3719
+ return { error, loading, updateDailyClueGame };
3696
3720
  };
3697
3721
 
3698
3722
  // src/graphql/hooks/game/hooksQuery.ts
3699
3723
  var import_client66 = require("@apollo/client");
3700
- var useGetGames = (userId) => {
3724
+ var useGetGames = () => {
3701
3725
  const { loading, error, data, refetch } = (0, import_client66.useQuery)(GET_GAMES, {
3702
- fetchPolicy: "network-only",
3703
- variables: { userId }
3726
+ fetchPolicy: "network-only"
3704
3727
  });
3705
3728
  const games = data?.games || [];
3706
3729
  return { error, games, loading, refetch };
@@ -3829,6 +3852,7 @@ var useGetGame = (_id) => {
3829
3852
  useToggleChatMessageLike,
3830
3853
  useUpdateAd,
3831
3854
  useUpdateAppSettings,
3855
+ useUpdateDailyClueGame,
3832
3856
  useUpdateEvent,
3833
3857
  useUpdateEventInfo,
3834
3858
  useUpdateGoogleImportedMarkets,