@gamepark/react-client 7.0.0-beta.0 → 7.0.0-beta.2
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/Actions/ActionFailed.js +3 -7
- package/dist/Actions/ActionFailed.js.map +1 -1
- package/dist/Actions/AnimationComplete.js +3 -7
- package/dist/Actions/AnimationComplete.js.map +1 -1
- package/dist/Actions/AnimationPaused.js +3 -7
- package/dist/Actions/AnimationPaused.js.map +1 -1
- package/dist/Actions/AnimationStart.js +1 -4
- package/dist/Actions/AnimationStart.js.map +1 -1
- package/dist/Actions/ClearFailures.d.ts +1 -5
- package/dist/Actions/ClearFailures.js +3 -9
- package/dist/Actions/ClearFailures.js.map +1 -1
- package/dist/Actions/GameNotificationsReceived.d.ts +2 -4
- package/dist/Actions/GameNotificationsReceived.js +2 -9
- package/dist/Actions/GameNotificationsReceived.js.map +1 -1
- package/dist/Actions/GameOver.js +3 -7
- package/dist/Actions/GameOver.js.map +1 -1
- package/dist/Actions/GameStateLoaded.js +5 -18
- package/dist/Actions/GameStateLoaded.js.map +1 -1
- package/dist/Actions/MovePlayed.d.ts +4 -4
- package/dist/Actions/MovePlayed.js +3 -4
- package/dist/Actions/MovePlayed.js.map +1 -1
- package/dist/Actions/MoveUndone.js +3 -8
- package/dist/Actions/MoveUndone.js.map +1 -1
- package/dist/Actions/PlayerQuit.d.ts +3 -9
- package/dist/Actions/PlayerQuit.js +2 -19
- package/dist/Actions/PlayerQuit.js.map +1 -1
- package/dist/Actions/SetAnimationsSpeed.d.ts +1 -6
- package/dist/Actions/SetAnimationsSpeed.js +3 -9
- package/dist/Actions/SetAnimationsSpeed.js.map +1 -1
- package/dist/Actions/giveUp.d.ts +1 -0
- package/dist/Actions/giveUp.js +3 -0
- package/dist/Actions/giveUp.js.map +1 -0
- package/dist/Actions/index.d.ts +7 -11
- package/dist/Actions/index.js +7 -27
- package/dist/Actions/index.js.map +1 -1
- package/dist/Actions/loadGameState.d.ts +14 -0
- package/dist/Actions/loadGameState.js +3 -0
- package/dist/Actions/loadGameState.js.map +1 -0
- package/dist/Actions/playMove.d.ts +10 -0
- package/dist/Actions/playMove.js +3 -0
- package/dist/Actions/playMove.js.map +1 -0
- package/dist/Actions/receiveNotifications.d.ts +8 -0
- package/dist/Actions/receiveNotifications.js +3 -0
- package/dist/Actions/receiveNotifications.js.map +1 -0
- package/dist/Actions/removePlayer.d.ts +5 -0
- package/dist/Actions/removePlayer.js +3 -0
- package/dist/Actions/removePlayer.js.map +1 -0
- package/dist/Actions/reportFailure.d.ts +1 -0
- package/dist/Actions/reportFailure.js +3 -0
- package/dist/Actions/reportFailure.js.map +1 -0
- package/dist/Actions/setGameOver.d.ts +2 -0
- package/dist/Actions/setGameOver.js +3 -0
- package/dist/Actions/setGameOver.js.map +1 -0
- package/dist/Actions/startAnimation.d.ts +1 -0
- package/dist/Actions/startAnimation.js +3 -0
- package/dist/Actions/startAnimation.js.map +1 -0
- package/dist/Actions/undoMove.d.ts +5 -0
- package/dist/Actions/undoMove.js +4 -0
- package/dist/Actions/undoMove.js.map +1 -0
- package/dist/Chat/ChatChannel.js +1 -2
- package/dist/Chat/Message.js +1 -2
- package/dist/Chat/index.js +2 -18
- package/dist/Chat/index.js.map +1 -1
- package/dist/Deckbuilding/Deck.js +1 -2
- package/dist/Deckbuilding/index.js +4 -24
- package/dist/Deckbuilding/index.js.map +1 -1
- package/dist/Deckbuilding/useDeleteDeck.d.ts +4 -1
- package/dist/Deckbuilding/useDeleteDeck.js +8 -14
- package/dist/Deckbuilding/useDeleteDeck.js.map +1 -1
- package/dist/Deckbuilding/useMyDecks.d.ts +2 -1
- package/dist/Deckbuilding/useMyDecks.js +7 -13
- package/dist/Deckbuilding/useMyDecks.js.map +1 -1
- package/dist/Deckbuilding/useSaveDeck.d.ts +4 -1
- package/dist/Deckbuilding/useSaveDeck.js +8 -14
- package/dist/Deckbuilding/useSaveDeck.js.map +1 -1
- package/dist/EjectPlayer/EjectPlayer.d.ts +1 -6
- package/dist/EjectPlayer/EjectPlayer.js +2 -8
- package/dist/EjectPlayer/EjectPlayer.js.map +1 -1
- package/dist/EjectPlayer/index.js +1 -17
- package/dist/EjectPlayer/index.js.map +1 -1
- package/dist/Failure/Failure.js +1 -4
- package/dist/Failure/Failure.js.map +1 -1
- package/dist/Failure/index.js +1 -17
- package/dist/Failure/index.js.map +1 -1
- package/dist/GiveUp/GiveUp.js +2 -5
- package/dist/GiveUp/GiveUp.js.map +1 -1
- package/dist/GiveUp/index.js +1 -17
- package/dist/GiveUp/index.js.map +1 -1
- package/dist/Hooks/index.js +5 -21
- package/dist/Hooks/index.js.map +1 -1
- package/dist/Hooks/useChatMessages.d.ts +1 -6
- package/dist/Hooks/useChatMessages.js +35 -44
- package/dist/Hooks/useChatMessages.js.map +1 -1
- package/dist/Hooks/useMessageAuthor.js +12 -16
- package/dist/Hooks/useMessageAuthor.js.map +1 -1
- package/dist/Hooks/useOptions.js +3 -6
- package/dist/Hooks/useOptions.js.map +1 -1
- package/dist/Hooks/useRematch.d.ts +1 -1
- package/dist/Hooks/useRematch.js +16 -20
- package/dist/Hooks/useRematch.js.map +1 -1
- package/dist/Hooks/useSendMessage.d.ts +4 -1
- package/dist/Hooks/useSendMessage.js +5 -12
- package/dist/Hooks/useSendMessage.js.map +1 -1
- package/dist/Log/StartLiveLog.d.ts +1 -4
- package/dist/Log/StartLiveLog.js +3 -5
- package/dist/Log/StartLiveLog.js.map +1 -1
- package/dist/Log/StopLiveLog.d.ts +1 -4
- package/dist/Log/StopLiveLog.js +4 -7
- package/dist/Log/StopLiveLog.js.map +1 -1
- package/dist/Log/index.d.ts +2 -2
- package/dist/Log/index.js +4 -20
- package/dist/Log/index.js.map +1 -1
- package/dist/Log/useLogControls.js +11 -14
- package/dist/Log/useLogControls.js.map +1 -1
- package/dist/PlayerTime/PlayerTime.js +1 -2
- package/dist/PlayerTime/index.js +1 -17
- package/dist/PlayerTime/index.js.map +1 -1
- package/dist/Rematch/RematchQueries.js +23 -13
- package/dist/Rematch/RematchQueries.js.map +1 -1
- package/dist/Rematch/index.js +1 -17
- package/dist/Rematch/index.js.map +1 -1
- package/dist/Sound/MuteSounds.d.ts +1 -4
- package/dist/Sound/MuteSounds.js +5 -8
- package/dist/Sound/MuteSounds.js.map +1 -1
- package/dist/Sound/UnmuteSounds.d.ts +1 -4
- package/dist/Sound/UnmuteSounds.js +3 -5
- package/dist/Sound/UnmuteSounds.js.map +1 -1
- package/dist/Sound/index.d.ts +2 -2
- package/dist/Sound/index.js +3 -19
- package/dist/Sound/index.js.map +1 -1
- package/dist/Sound/useSoundControls.js +11 -14
- package/dist/Sound/useSoundControls.js.map +1 -1
- package/dist/Store/DisplayedAction.js +4 -10
- package/dist/Store/DisplayedAction.js.map +1 -1
- package/dist/Store/GamePageState.d.ts +0 -1
- package/dist/Store/GamePageState.js +1 -2
- package/dist/Store/PlayedMove.js +1 -2
- package/dist/Store/endAnimation.d.ts +1 -0
- package/dist/Store/endAnimation.js +3 -0
- package/dist/Store/endAnimation.js.map +1 -0
- package/dist/Store/gameMiddleware.js +30 -41
- package/dist/Store/gameMiddleware.js.map +1 -1
- package/dist/Store/gameReducer.d.ts +2 -11
- package/dist/Store/gameReducer.js +301 -377
- package/dist/Store/gameReducer.js.map +1 -1
- package/dist/Store/index.d.ts +1 -0
- package/dist/Store/index.js +4 -19
- package/dist/Store/index.js.map +1 -1
- package/dist/Store/localMovePreviewMiddleware.js +15 -13
- package/dist/Store/localMovePreviewMiddleware.js.map +1 -1
- package/dist/Store/store.d.ts +13 -0
- package/dist/Store/store.js +27 -0
- package/dist/Store/store.js.map +1 -0
- package/dist/Tutorial/PlayTutorialMoves.d.ts +1 -9
- package/dist/Tutorial/PlayTutorialMoves.js +2 -6
- package/dist/Tutorial/PlayTutorialMoves.js.map +1 -1
- package/dist/Tutorial/Tutorial.js +1 -2
- package/dist/Tutorial/TutorialDescription.d.ts +1 -1
- package/dist/Tutorial/TutorialDescription.js +1 -2
- package/dist/Tutorial/index.js +4 -20
- package/dist/Tutorial/index.js.map +1 -1
- package/dist/Tutorial/useTutorial.js +11 -20
- package/dist/Tutorial/useTutorial.js.map +1 -1
- package/dist/Types/GameAI.js +1 -2
- package/dist/Types/GameData.js +1 -2
- package/dist/Types/GameMessage.js +1 -2
- package/dist/Types/GameMode.js +2 -5
- package/dist/Types/GameMode.js.map +1 -1
- package/dist/Types/GameNotification.js +1 -2
- package/dist/Types/GameOptions.js +2 -5
- package/dist/Types/GameOptions.js.map +1 -1
- package/dist/Types/MovePlayedNotification.d.ts +1 -1
- package/dist/Types/MovePlayedNotification.js +3 -8
- package/dist/Types/MovePlayedNotification.js.map +1 -1
- package/dist/Types/MoveUndoneNotification.d.ts +1 -1
- package/dist/Types/MoveUndoneNotification.js +3 -8
- package/dist/Types/MoveUndoneNotification.js.map +1 -1
- package/dist/Types/Player.js +1 -2
- package/dist/Types/PlayerQuitReason.js +2 -5
- package/dist/Types/PlayerQuitReason.js.map +1 -1
- package/dist/Types/ProxyGameData.js +1 -2
- package/dist/Types/Tournament.js +1 -2
- package/dist/Types/index.js +12 -28
- package/dist/Types/index.js.map +1 -1
- package/dist/User/User.js +1 -2
- package/dist/User/index.js +2 -18
- package/dist/User/index.js.map +1 -1
- package/dist/User/useMe.js +9 -19
- package/dist/User/useMe.js.map +1 -1
- package/dist/animations/Animation.js +1 -2
- package/dist/animations/AnimationContext.d.ts +1 -1
- package/dist/animations/AnimationContext.js +1 -2
- package/dist/animations/AnimationState.js +1 -2
- package/dist/animations/AnimationStep.js +2 -5
- package/dist/animations/AnimationStep.js.map +1 -1
- package/dist/animations/Animations.js +9 -16
- package/dist/animations/Animations.js.map +1 -1
- package/dist/animations/AnimationsListener.d.ts +6 -0
- package/dist/animations/AnimationsListener.js +54 -0
- package/dist/animations/AnimationsListener.js.map +1 -0
- package/dist/animations/AnimationsListenerCreator.d.ts +1 -4
- package/dist/animations/AnimationsListenerCreator.js +24 -30
- package/dist/animations/AnimationsListenerCreator.js.map +1 -1
- package/dist/animations/animationMiddleware.d.ts +4 -0
- package/dist/animations/animationMiddleware.js +50 -0
- package/dist/animations/animationMiddleware.js.map +1 -0
- package/dist/animations/index.d.ts +0 -1
- package/dist/animations/index.js +5 -22
- package/dist/animations/index.js.map +1 -1
- package/dist/api/Client/GameClientAPI.d.ts +5 -6
- package/dist/api/Client/GameClientAPI.js +70 -119
- package/dist/api/Client/GameClientAPI.js.map +1 -1
- package/dist/api/Client/GameNotificationsListener.js +51 -104
- package/dist/api/Client/GameNotificationsListener.js.map +1 -1
- package/dist/api/Client/RemoteGameLoader.js +50 -45
- package/dist/api/Client/RemoteGameLoader.js.map +1 -1
- package/dist/api/Client/RemoteGameProvider.js +15 -51
- package/dist/api/Client/RemoteGameProvider.js.map +1 -1
- package/dist/api/Client/apollo-client.d.ts +1 -1
- package/dist/api/Client/apollo-client.js +14 -31
- package/dist/api/Client/apollo-client.js.map +1 -1
- package/dist/api/Client/index.js +4 -20
- package/dist/api/Client/index.js.map +1 -1
- package/dist/api/Client/pusher.js +5 -12
- package/dist/api/Client/pusher.js.map +1 -1
- package/dist/api/GameAPI.d.ts +2 -3
- package/dist/api/GameAPI.js +1 -2
- package/dist/api/Local/ConsoleTools.d.ts +1 -2
- package/dist/api/Local/ConsoleTools.js +15 -22
- package/dist/api/Local/ConsoleTools.js.map +1 -1
- package/dist/api/Local/GameLocalAPI.d.ts +4 -5
- package/dist/api/Local/GameLocalAPI.js +264 -363
- package/dist/api/Local/GameLocalAPI.js.map +1 -1
- package/dist/api/Local/LocalGameProvider.d.ts +1 -1
- package/dist/api/Local/LocalGameProvider.js +17 -48
- package/dist/api/Local/LocalGameProvider.js.map +1 -1
- package/dist/api/Local/index.js +1 -17
- package/dist/api/Local/index.js.map +1 -1
- package/dist/api/index.js +2 -18
- package/dist/api/index.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +16 -36
- package/dist/index.js.map +1 -1
- package/dist/util/ArrayUtil.js +4 -8
- package/dist/util/ArrayUtil.js.map +1 -1
- package/package.json +66 -62
- package/dist/Actions/ActionType.d.ts +0 -3
- package/dist/Actions/ActionType.js +0 -8
- package/dist/Actions/ActionType.js.map +0 -1
- package/dist/Scoring/ScoringDescription.d.ts +0 -8
- package/dist/Scoring/ScoringDescription.js +0 -3
- package/dist/Scoring/ScoringDescription.js.map +0 -1
- package/dist/Scoring/index.d.ts +0 -1
- package/dist/Scoring/index.js +0 -18
- package/dist/Scoring/index.js.map +0 -1
- package/dist/util/TimeUtil.d.ts +0 -2
- package/dist/util/TimeUtil.js +0 -27
- package/dist/util/TimeUtil.js.map +0 -1
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.useSaveDeck = exports.useMyDecks = exports.useDeleteDeck = void 0;
|
|
18
|
-
__exportStar(require("./Deck"), exports);
|
|
19
|
-
var useDeleteDeck_1 = require("./useDeleteDeck");
|
|
20
|
-
Object.defineProperty(exports, "useDeleteDeck", { enumerable: true, get: function () { return useDeleteDeck_1.useDeleteDeck; } });
|
|
21
|
-
var useMyDecks_1 = require("./useMyDecks");
|
|
22
|
-
Object.defineProperty(exports, "useMyDecks", { enumerable: true, get: function () { return useMyDecks_1.useMyDecks; } });
|
|
23
|
-
var useSaveDeck_1 = require("./useSaveDeck");
|
|
24
|
-
Object.defineProperty(exports, "useSaveDeck", { enumerable: true, get: function () { return useSaveDeck_1.useSaveDeck; } });
|
|
1
|
+
export * from './Deck';
|
|
2
|
+
export { useDeleteDeck } from './useDeleteDeck';
|
|
3
|
+
export { useMyDecks } from './useMyDecks';
|
|
4
|
+
export { useSaveDeck } from './useSaveDeck';
|
|
25
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Deckbuilding/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Deckbuilding/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { useMutation } from '@apollo/client/react';
|
|
1
2
|
export declare const DELETE_DECK: import("@apollo/client").DocumentNode;
|
|
2
|
-
export declare function useDeleteDeck():
|
|
3
|
+
export declare function useDeleteDeck(): useMutation.ResultTuple<unknown, {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
}, import("@apollo/client").ApolloCache>;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var client_1 = require("@apollo/client");
|
|
10
|
-
var useMyDecks_1 = require("./useMyDecks");
|
|
11
|
-
exports.DELETE_DECK = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["mutation SaveDeck($id: String) {\n deleteDeck(id: $id)\n}"], ["mutation SaveDeck($id: String) {\n deleteDeck(id: $id)\n}"])));
|
|
12
|
-
function useDeleteDeck() {
|
|
13
|
-
return (0, client_1.useMutation)(exports.DELETE_DECK, { refetchQueries: [useMyDecks_1.MY_DECKS] });
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { useMutation } from '@apollo/client/react';
|
|
3
|
+
import { MY_DECKS } from './useMyDecks';
|
|
4
|
+
export const DELETE_DECK = gql `mutation SaveDeck($id: String) {
|
|
5
|
+
deleteDeck(id: $id)
|
|
6
|
+
}`;
|
|
7
|
+
export function useDeleteDeck() {
|
|
8
|
+
return useMutation(DELETE_DECK, { refetchQueries: [MY_DECKS] });
|
|
14
9
|
}
|
|
15
|
-
var templateObject_1;
|
|
16
10
|
//# sourceMappingURL=useDeleteDeck.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeleteDeck.js","sourceRoot":"","sources":["../../src/Deckbuilding/useDeleteDeck.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDeleteDeck.js","sourceRoot":"","sources":["../../src/Deckbuilding/useDeleteDeck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;;EAE5B,CAAA;AAEF,MAAM,UAAU,aAAa;IAC3B,OAAO,WAAW,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client/react';
|
|
1
2
|
export declare const MY_DECKS: import("@apollo/client").DocumentNode;
|
|
2
|
-
export declare function useMyDecks(boardGame: string): import("@apollo/client").
|
|
3
|
+
export declare function useMyDecks(boardGame: string): useQuery.Result<unknown, import("@apollo/client").OperationVariables, "complete" | "empty" | "streaming", import("@apollo/client").OperationVariables>;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.useMyDecks = useMyDecks;
|
|
9
|
-
var client_1 = require("@apollo/client");
|
|
10
|
-
exports.MY_DECKS = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["query MyDecks($boardGame: String!) {\n myDecks(boardGame: $boardGame) { id name cards }\n}"], ["query MyDecks($boardGame: String!) {\n myDecks(boardGame: $boardGame) { id name cards }\n}"])));
|
|
11
|
-
function useMyDecks(boardGame) {
|
|
12
|
-
return (0, client_1.useQuery)(exports.MY_DECKS, { variables: { boardGame: boardGame } });
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { useQuery } from '@apollo/client/react';
|
|
3
|
+
export const MY_DECKS = gql `query MyDecks($boardGame: String!) {
|
|
4
|
+
myDecks(boardGame: $boardGame) { id name cards }
|
|
5
|
+
}`;
|
|
6
|
+
export function useMyDecks(boardGame) {
|
|
7
|
+
return useQuery(MY_DECKS, { variables: { boardGame } });
|
|
13
8
|
}
|
|
14
|
-
var templateObject_1;
|
|
15
9
|
//# sourceMappingURL=useMyDecks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMyDecks.js","sourceRoot":"","sources":["../../src/Deckbuilding/useMyDecks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMyDecks.js","sourceRoot":"","sources":["../../src/Deckbuilding/useMyDecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAA;;EAEzB,CAAA;AAEF,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,QAAQ,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAA;AACzD,CAAC"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import { useMutation } from '@apollo/client/react';
|
|
1
2
|
export declare const SAVE_DECK: import("@apollo/client").DocumentNode;
|
|
2
|
-
export declare function useSaveDeck():
|
|
3
|
+
export declare function useSaveDeck(): useMutation.ResultTuple<unknown, {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
}, import("@apollo/client").ApolloCache>;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var client_1 = require("@apollo/client");
|
|
10
|
-
var useMyDecks_1 = require("./useMyDecks");
|
|
11
|
-
exports.SAVE_DECK = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["mutation SaveDeck($id: String, $boardGame: String!, $name: String!, $cards: [Int!]!) {\n saveDeck(id: $id, boardGame: $boardGame, name: $name, cards: $cards) { id name cards }\n}"], ["mutation SaveDeck($id: String, $boardGame: String!, $name: String!, $cards: [Int!]!) {\n saveDeck(id: $id, boardGame: $boardGame, name: $name, cards: $cards) { id name cards }\n}"])));
|
|
12
|
-
function useSaveDeck() {
|
|
13
|
-
return (0, client_1.useMutation)(exports.SAVE_DECK, { refetchQueries: [useMyDecks_1.MY_DECKS] });
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { useMutation } from '@apollo/client/react';
|
|
3
|
+
import { MY_DECKS } from './useMyDecks';
|
|
4
|
+
export const SAVE_DECK = gql `mutation SaveDeck($id: String, $boardGame: String!, $name: String!, $cards: [Int!]!) {
|
|
5
|
+
saveDeck(id: $id, boardGame: $boardGame, name: $name, cards: $cards) { id name cards }
|
|
6
|
+
}`;
|
|
7
|
+
export function useSaveDeck() {
|
|
8
|
+
return useMutation(SAVE_DECK, { refetchQueries: [MY_DECKS] });
|
|
14
9
|
}
|
|
15
|
-
var templateObject_1;
|
|
16
10
|
//# sourceMappingURL=useSaveDeck.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSaveDeck.js","sourceRoot":"","sources":["../../src/Deckbuilding/useSaveDeck.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSaveDeck.js","sourceRoot":"","sources":["../../src/Deckbuilding/useSaveDeck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;EAE1B,CAAA;AAEF,MAAM,UAAU,WAAW;IACzB,OAAO,WAAW,CAAC,SAAS,EAAE,EAAE,cAAc,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export interface EjectPlayer<PlayerId = any> {
|
|
3
|
-
type: typeof EJECT_PLAYER;
|
|
4
|
-
playerId: PlayerId;
|
|
5
|
-
}
|
|
6
|
-
export declare function ejectPlayerAction<PlayerId>(playerId: PlayerId): EjectPlayer<PlayerId>;
|
|
1
|
+
export declare const ejectPlayer: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EJECT_PLAYER = void 0;
|
|
4
|
-
exports.ejectPlayerAction = ejectPlayerAction;
|
|
5
|
-
exports.EJECT_PLAYER = 'EJECT_PLAYER';
|
|
6
|
-
function ejectPlayerAction(playerId) {
|
|
7
|
-
return { type: exports.EJECT_PLAYER, playerId: playerId };
|
|
8
|
-
}
|
|
1
|
+
import { createAction } from '@reduxjs/toolkit';
|
|
2
|
+
export const ejectPlayer = createAction('ejectPlayer');
|
|
9
3
|
//# sourceMappingURL=EjectPlayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EjectPlayer.js","sourceRoot":"","sources":["../../src/EjectPlayer/EjectPlayer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EjectPlayer.js","sourceRoot":"","sources":["../../src/EjectPlayer/EjectPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAS,aAAa,CAAC,CAAA"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./EjectPlayer"), exports);
|
|
1
|
+
export * from './EjectPlayer';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/EjectPlayer/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/EjectPlayer/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
package/dist/Failure/Failure.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Failure = void 0;
|
|
4
|
-
exports.Failure = {
|
|
1
|
+
export const Failure = {
|
|
5
2
|
NETWORK: 'Network error',
|
|
6
3
|
MOVE_FORBIDDEN: 'You are not allowed to play this move',
|
|
7
4
|
UNDO_FORBIDDEN: 'This move cannot be undone',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Failure.js","sourceRoot":"","sources":["../../src/Failure/Failure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Failure.js","sourceRoot":"","sources":["../../src/Failure/Failure.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE,eAAe;IACxB,cAAc,EAAE,uCAAuC;IACvD,cAAc,EAAE,4BAA4B;IAC5C,sBAAsB,EAAE,iDAAiD;CAC1E,CAAA"}
|
package/dist/Failure/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Failure"), exports);
|
|
1
|
+
export * from './Failure';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Failure/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Failure/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
|
package/dist/GiveUp/GiveUp.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.giveUpAction = exports.GIVE_UP = void 0;
|
|
4
|
-
exports.GIVE_UP = 'GIVE_UP';
|
|
5
|
-
exports.giveUpAction = { type: exports.GIVE_UP };
|
|
1
|
+
export const GIVE_UP = 'GIVE_UP';
|
|
2
|
+
export const giveUpAction = { type: GIVE_UP };
|
|
6
3
|
//# sourceMappingURL=GiveUp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiveUp.js","sourceRoot":"","sources":["../../src/GiveUp/GiveUp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GiveUp.js","sourceRoot":"","sources":["../../src/GiveUp/GiveUp.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAA;AAIhC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/GiveUp/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./GiveUp"), exports);
|
|
1
|
+
export * from './GiveUp';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/GiveUp/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/GiveUp/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/GiveUp/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
package/dist/Hooks/index.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./useChatMessages"), exports);
|
|
18
|
-
__exportStar(require("./useMessageAuthor"), exports);
|
|
19
|
-
__exportStar(require("./useOptions"), exports);
|
|
20
|
-
__exportStar(require("./useRematch"), exports);
|
|
21
|
-
__exportStar(require("./useSendMessage"), exports);
|
|
1
|
+
export * from './useChatMessages';
|
|
2
|
+
export * from './useMessageAuthor';
|
|
3
|
+
export * from './useOptions';
|
|
4
|
+
export * from './useRematch';
|
|
5
|
+
export * from './useSendMessage';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
package/dist/Hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA"}
|
|
@@ -3,10 +3,5 @@ export declare function useChatMessages(gameId: string, onMessageReceived?: (mes
|
|
|
3
3
|
messages: Message[];
|
|
4
4
|
hasMoreMessages: boolean;
|
|
5
5
|
loading: boolean;
|
|
6
|
-
fetchMore:
|
|
7
|
-
updateQuery?: ((previousQueryResult: any, options: {
|
|
8
|
-
fetchMoreResult: TFetchData;
|
|
9
|
-
variables: TFetchVars;
|
|
10
|
-
}) => any) | undefined;
|
|
11
|
-
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>;
|
|
6
|
+
fetchMore: () => Promise<void>;
|
|
12
7
|
};
|
|
@@ -1,54 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var _a;
|
|
25
|
-
var _b = (0, react_1.useState)(false), subscribed = _b[0], setSubscribed = _b[1];
|
|
26
|
-
var _c = (0, react_1.useState)(false), hasMoreMessages = _c[0], setHasMoreMessages = _c[1];
|
|
27
|
-
var _d = (0, client_1.useQuery)(GET_CHAT_MESSAGES, {
|
|
28
|
-
variables: { channel: "game=".concat(gameId) }, skip: !subscribed,
|
|
29
|
-
onCompleted: function (_a) {
|
|
30
|
-
var messages = _a.chatChannel.messages;
|
|
31
|
-
return setHasMoreMessages(messages.length === 10);
|
|
32
|
-
}
|
|
33
|
-
}), data = _d.data, loading = _d.loading, fetchMore = _d.fetchMore, client = _d.client;
|
|
34
|
-
var messages = (_a = data === null || data === void 0 ? void 0 : data.chatChannel.messages) !== null && _a !== void 0 ? _a : [];
|
|
35
|
-
(0, react_1.useEffect)(function () {
|
|
36
|
-
var channel = api_1.pusherClient.subscribe("game=".concat(gameId));
|
|
37
|
-
channel.bind('pusher:subscription_succeeded', function () { return setSubscribed(true); });
|
|
38
|
-
channel.bind('message', function (message) {
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
import { useQuery } from '@apollo/client/react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { pusherClient } from '../api';
|
|
5
|
+
const GET_CHAT_MESSAGES = gql `query ChatMessages($channel: String!, $limit: Int, $maxDate: DateTime) {
|
|
6
|
+
chatChannel(name: $channel) {
|
|
7
|
+
name
|
|
8
|
+
messages(limit: $limit, maxDate: $maxDate) {
|
|
9
|
+
id userId text date
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}`;
|
|
13
|
+
export function useChatMessages(gameId, onMessageReceived) {
|
|
14
|
+
const [subscribed, setSubscribed] = useState(false);
|
|
15
|
+
const [hasMoreMessages, setHasMoreMessages] = useState(true);
|
|
16
|
+
const { data, loading, fetchMore, client } = useQuery(GET_CHAT_MESSAGES, {
|
|
17
|
+
variables: { channel: `game=${gameId}`, limit: 50 }, skip: !subscribed
|
|
18
|
+
});
|
|
19
|
+
const messages = (data?.chatChannel?.messages ?? []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const channel = pusherClient.subscribe(`game=${gameId}`);
|
|
22
|
+
channel.bind('pusher:subscription_succeeded', () => setSubscribed(true));
|
|
23
|
+
channel.bind('message', (message) => {
|
|
39
24
|
if (message) {
|
|
40
25
|
client.writeFragment({
|
|
41
|
-
id:
|
|
42
|
-
fragment:
|
|
43
|
-
data: { messages: [
|
|
26
|
+
id: `ChatChannel:{"name":"game=${gameId}"}`,
|
|
27
|
+
fragment: gql `fragment ChatMessages on ChatChannel { messages { id userId text date } }`,
|
|
28
|
+
data: { messages: [{ __typename: 'Message', ...message }] }
|
|
44
29
|
});
|
|
45
30
|
if (onMessageReceived)
|
|
46
31
|
onMessageReceived(message);
|
|
47
32
|
}
|
|
48
33
|
});
|
|
49
|
-
return
|
|
34
|
+
return () => pusherClient.unsubscribe(`game=${gameId}`);
|
|
50
35
|
}, []);
|
|
51
|
-
return {
|
|
36
|
+
return {
|
|
37
|
+
messages,
|
|
38
|
+
hasMoreMessages,
|
|
39
|
+
loading,
|
|
40
|
+
fetchMore: () => fetchMore({ variables: { limit: 10, maxDate: messages[messages.length - 1].date } }).then((result) => {
|
|
41
|
+
setHasMoreMessages(result.data !== undefined && result.data.chatChannel.messages.length === 10);
|
|
42
|
+
})
|
|
43
|
+
};
|
|
52
44
|
}
|
|
53
|
-
var templateObject_1, templateObject_2;
|
|
54
45
|
//# sourceMappingURL=useChatMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatMessages.js","sourceRoot":"","sources":["../../src/Hooks/useChatMessages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useChatMessages.js","sourceRoot":"","sources":["../../src/Hooks/useChatMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAGrC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;EAO3B,CAAA;AAEF,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,iBAA8C;IAC5F,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACnD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC5D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,QAAQ,CAA+B,iBAAiB,EAAE;QACrG,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,UAAU;KACvE,CAAC,CAAA;IACF,MAAM,QAAQ,GAAc,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,IAAI,EAAE,CAAc,CAAA;IAE5E,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAA;QAExD,OAAO,CAAC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAA;QACxE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,OAAgB,EAAE,EAAE;YAC3C,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,aAAa,CAAC;oBACnB,EAAE,EAAE,6BAA6B,MAAM,IAAI;oBAC3C,QAAQ,EAAE,GAAG,CAAA,4EAA4E;oBACzF,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE;iBAC5D,CAAC,CAAA;gBACF,IAAI,iBAAiB;oBAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;YACnD,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAA;IACzD,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO;QACL,QAAQ;QACR,eAAe;QACf,OAAO;QACP,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACpH,kBAAkB,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,KAAK,EAAE,CAAC,CAAA;QACjG,CAAC,CAAC;KACH,CAAA;AACH,CAAC"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var data = (0, client_1.useQuery)(GameClientAPI_1.GET_MESSAGE_AUTHOR, { variables: { id: author }, skip: skip }).data;
|
|
14
|
-
var avatar = (_a = player === null || player === void 0 ? void 0 : player.avatar) !== null && _a !== void 0 ? _a : data === null || data === void 0 ? void 0 : data.user.avatar;
|
|
15
|
-
var name = (_b = player === null || player === void 0 ? void 0 : player.name) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data.user.name;
|
|
16
|
-
return { avatar: avatar, name: name };
|
|
1
|
+
import { useQuery } from '@apollo/client/react';
|
|
2
|
+
import { GET_MESSAGE_AUTHOR } from '../api';
|
|
3
|
+
import { useGameSelector } from '../Store';
|
|
4
|
+
const query = new URLSearchParams(window.location.search);
|
|
5
|
+
export function useMessageAuthor(author) {
|
|
6
|
+
const players = useGameSelector(state => state.players);
|
|
7
|
+
const player = players.find(p => p.userId === author);
|
|
8
|
+
const skip = !!player || query.get('game') === null;
|
|
9
|
+
const { data } = useQuery(GET_MESSAGE_AUTHOR, { variables: { id: author }, skip: skip });
|
|
10
|
+
const avatar = player?.avatar ?? data?.user.avatar;
|
|
11
|
+
const name = player?.name ?? data?.user.name;
|
|
12
|
+
return { avatar, name };
|
|
17
13
|
}
|
|
18
14
|
//# sourceMappingURL=useMessageAuthor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageAuthor.js","sourceRoot":"","sources":["../../src/Hooks/useMessageAuthor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMessageAuthor.js","sourceRoot":"","sources":["../../src/Hooks/useMessageAuthor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1C,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAEzD,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;IACrD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAiB,kBAAkB,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IACxG,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAA;IAClD,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,CAAC,IAAI,CAAA;IAC5C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACzB,CAAC"}
|
package/dist/Hooks/useOptions.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var react_redux_1 = require("react-redux");
|
|
5
|
-
function useOptions() {
|
|
6
|
-
return (0, react_redux_1.useSelector)(function (state) { return state.options; });
|
|
1
|
+
import { useGameSelector } from '../Store';
|
|
2
|
+
export function useOptions() {
|
|
3
|
+
return useGameSelector(state => state.options);
|
|
7
4
|
}
|
|
8
5
|
//# sourceMappingURL=useOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOptions.js","sourceRoot":"","sources":["../../src/Hooks/useOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOptions.js","sourceRoot":"","sources":["../../src/Hooks/useOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1C,MAAM,UAAU,UAAU;IACxB,OAAO,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CanRematchData } from '../Rematch';
|
|
2
2
|
export declare function useRematch(): {
|
|
3
3
|
game: CanRematchData | undefined;
|
|
4
|
-
rematch: () => Promise<import("@apollo/client").
|
|
4
|
+
rematch: () => Promise<import("@apollo/client").ApolloClient.MutateResult<unknown> | import("@apollo/client").ApolloClient.QueryResult<{
|
|
5
5
|
game: CanRematchData;
|
|
6
6
|
}>>;
|
|
7
7
|
};
|
package/dist/Hooks/useRematch.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var channel = api_1.pusherClient.subscribe('rematch=' + gameId);
|
|
17
|
-
channel.bind('rematch', function () { return canRematchResult.refetch(); });
|
|
18
|
-
channel.bind('pusher:subscription_succeeded', function () { return canRematchResult.refetch(); });
|
|
19
|
-
return function () { return api_1.pusherClient.unsubscribe('rematch=' + gameId); };
|
|
1
|
+
import { useMutation, useQuery } from '@apollo/client/react';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { pusherClient } from '../api';
|
|
4
|
+
import { CAN_REMATCH, REMATCH } from '../Rematch';
|
|
5
|
+
export function useRematch() {
|
|
6
|
+
const query = new URLSearchParams(window.location.search);
|
|
7
|
+
const gameId = query.get('game');
|
|
8
|
+
const canRematchResult = useQuery(CAN_REMATCH, { variables: { id: gameId } });
|
|
9
|
+
const game = canRematchResult.data?.game;
|
|
10
|
+
const [rematch] = useMutation(REMATCH);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const channel = pusherClient.subscribe('rematch=' + gameId);
|
|
13
|
+
channel.bind('rematch', () => canRematchResult.refetch());
|
|
14
|
+
channel.bind('pusher:subscription_succeeded', () => canRematchResult.refetch());
|
|
15
|
+
return () => pusherClient.unsubscribe('rematch=' + gameId);
|
|
20
16
|
}, []);
|
|
21
|
-
return { game
|
|
17
|
+
return { game, rematch: () => rematch({ variables: { gameId } }).catch(() => canRematchResult.refetch()) };
|
|
22
18
|
}
|
|
23
19
|
//# sourceMappingURL=useRematch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRematch.js","sourceRoot":"","sources":["../../src/Hooks/useRematch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRematch.js","sourceRoot":"","sources":["../../src/Hooks/useRematch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,WAAW,EAAkB,OAAO,EAAE,MAAM,YAAY,CAAA;AAEjE,MAAM,UAAU,UAAU;IACxB,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAChC,MAAM,gBAAgB,GAAG,QAAQ,CAA2B,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;IACvG,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAA;IACxC,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACtC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,UAAU,GAAG,MAAM,CAAC,CAAA;QAC3D,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAA;QACzD,OAAO,CAAC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAA;QAC/E,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,UAAU,GAAG,MAAM,CAAC,CAAA;IAC5D,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAA;AAC5G,CAAC"}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { useMutation } from '@apollo/client/react';
|
|
2
|
+
export declare function useSendMessage(): useMutation.ResultTuple<unknown, {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
}, import("@apollo/client").ApolloCache>;
|