@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.
@@ -3238,8 +3238,8 @@ var GAME_FIELDS_FRAGMENT = gql29`
3238
3238
  ${OWNER_FIELDS_FRAGMENT}
3239
3239
  `;
3240
3240
  var GET_GAMES = gql29`
3241
- query getGames($userId: ID) {
3242
- games(userId: $userId) {
3241
+ query getGames {
3242
+ games {
3243
3243
  ...GameFields
3244
3244
  }
3245
3245
  }
@@ -3503,10 +3503,16 @@ var START_GAME_MUTATION = gql34`
3503
3503
  `;
3504
3504
  var LEAVE_GAME_MUTATION = gql34`
3505
3505
  mutation leaveGame($_id: ID!, $gameType: GameTypeEnumType!) {
3506
- leaveGame(_id: $_id, gameType: $gameType) {
3507
- userId
3506
+ leaveGame(_id: $_id, gameType: $gameType)
3507
+ }
3508
+ `;
3509
+ var UPDATE_DAILY_CLUE_MUTATION = gql34`
3510
+ mutation updateDailyClueGame($_id: ID!, $foundLetter: String!) {
3511
+ updateDailyClueGame(_id: $_id, foundLetter: $foundLetter) {
3512
+ ...GameFields
3508
3513
  }
3509
3514
  }
3515
+ ${GAME_FIELDS_FRAGMENT}
3510
3516
  `;
3511
3517
 
3512
3518
  // src/graphql/hooks/game/hooksMutation.ts
@@ -3515,12 +3521,18 @@ var useStartGame = () => {
3515
3521
  awaitRefetchQueries: true,
3516
3522
  refetchQueries: (mutationResult) => {
3517
3523
  const gameId = mutationResult?.data?.startGame?._id;
3518
- if (!gameId) return [];
3524
+ const userId = mutationResult?.data?.startGame?.owner?.userId;
3525
+ if (!gameId || !userId) return [];
3519
3526
  return [
3520
3527
  {
3521
3528
  query: GET_GAME,
3522
3529
  variables: { _id: gameId }
3523
3530
  // Pass the gameId for refetching
3531
+ },
3532
+ {
3533
+ query: GET_USER,
3534
+ variables: { _id: userId }
3535
+ // Pass the userId for refetching
3524
3536
  }
3525
3537
  ];
3526
3538
  }
@@ -3529,28 +3541,38 @@ var useStartGame = () => {
3529
3541
  };
3530
3542
  var useLeaveGame = () => {
3531
3543
  const [leaveGame, { loading, error }] = useMutation18(LEAVE_GAME_MUTATION, {
3544
+ awaitRefetchQueries: true,
3545
+ refetchQueries: [
3546
+ {
3547
+ query: GET_GAMES
3548
+ }
3549
+ ]
3550
+ });
3551
+ return { error, leaveGame, loading };
3552
+ };
3553
+ var useUpdateDailyClueGame = () => {
3554
+ const [updateDailyClueGame, { loading, error }] = useMutation18(UPDATE_DAILY_CLUE_MUTATION, {
3532
3555
  awaitRefetchQueries: true,
3533
3556
  refetchQueries: (mutationResult) => {
3534
- const userId = mutationResult?.data?.leaveGame?.userId;
3535
- if (!userId) return [];
3557
+ const gameId = mutationResult?.data?.updateDailyClueGame?._id;
3558
+ if (!gameId) return [];
3536
3559
  return [
3537
3560
  {
3538
- query: GET_GAMES,
3539
- variables: { userId }
3540
- // Pass the userId for refetching
3561
+ query: GET_GAME,
3562
+ variables: { _id: gameId }
3563
+ // Pass the gameId for refetching
3541
3564
  }
3542
3565
  ];
3543
3566
  }
3544
3567
  });
3545
- return { error, leaveGame, loading };
3568
+ return { error, loading, updateDailyClueGame };
3546
3569
  };
3547
3570
 
3548
3571
  // src/graphql/hooks/game/hooksQuery.ts
3549
3572
  import { useQuery as useQuery13 } from "@apollo/client";
3550
- var useGetGames = (userId) => {
3573
+ var useGetGames = () => {
3551
3574
  const { loading, error, data, refetch } = useQuery13(GET_GAMES, {
3552
- fetchPolicy: "network-only",
3553
- variables: { userId }
3575
+ fetchPolicy: "network-only"
3554
3576
  });
3555
3577
  const games = data?.games || [];
3556
3578
  return { error, games, loading, refetch };
@@ -3689,7 +3711,8 @@ export {
3689
3711
  useGetAppSettings,
3690
3712
  useStartGame,
3691
3713
  useLeaveGame,
3714
+ useUpdateDailyClueGame,
3692
3715
  useGetGames,
3693
3716
  useGetGame
3694
3717
  };
3695
- //# sourceMappingURL=chunk-DMP4JF4Q.mjs.map
3718
+ //# sourceMappingURL=chunk-STGIPJMO.mjs.map