@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,56 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.RemoteGameProvider = RemoteGameProvider;
|
|
18
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
var toolkit_1 = require("@reduxjs/toolkit");
|
|
20
|
-
var pusher_js_1 = __importDefault(require("pusher-js"));
|
|
21
|
-
var react_1 = require("react");
|
|
22
|
-
var react_redux_1 = require("react-redux");
|
|
23
|
-
var rules_api_1 = require("../../../../rules-api");
|
|
24
|
-
var animations_1 = require("../../animations");
|
|
25
|
-
var gameMiddleware_1 = require("../../Store/gameMiddleware");
|
|
26
|
-
var gameReducer_1 = require("../../Store/gameReducer");
|
|
27
|
-
var localMovePreviewMiddleware_1 = require("../../Store/localMovePreviewMiddleware");
|
|
28
|
-
var GameClientAPI_1 = require("./GameClientAPI");
|
|
29
|
-
var RemoteGameLoader_1 = require("./RemoteGameLoader");
|
|
30
|
-
pusher_js_1.default.logToConsole = true;
|
|
31
|
-
pusher_js_1.default.Runtime.createXHR = function () {
|
|
32
|
-
var xhr = new XMLHttpRequest();
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Pusher from 'pusher-js';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { Provider } from 'react-redux';
|
|
5
|
+
import { initStore, store } from '../../Store';
|
|
6
|
+
import { GameClientAPI } from './GameClientAPI';
|
|
7
|
+
import { RemoteGameLoader } from './RemoteGameLoader';
|
|
8
|
+
Pusher.logToConsole = true;
|
|
9
|
+
Pusher.Runtime.createXHR = function () {
|
|
10
|
+
const xhr = new XMLHttpRequest();
|
|
33
11
|
xhr.withCredentials = true;
|
|
34
12
|
return xhr;
|
|
35
13
|
};
|
|
36
|
-
function RemoteGameProvider(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
function createRemoteApiStore(gameId, context) {
|
|
42
|
-
var api = new GameClientAPI_1.GameClientAPI(gameId);
|
|
43
|
-
var reducer = (0, gameReducer_1.gameReducer)(context);
|
|
44
|
-
var middlewares = [(0, gameMiddleware_1.gameMiddleware)(api)];
|
|
45
|
-
if ((0, rules_api_1.hasLocalMovePreview)(new context.Rules({}))) {
|
|
46
|
-
middlewares.unshift((0, localMovePreviewMiddleware_1.localMovePreviewMiddleware)(context));
|
|
47
|
-
}
|
|
48
|
-
var store = (0, toolkit_1.configureStore)({ reducer: reducer, middleware: function (getDefaultMiddleware) {
|
|
49
|
-
var _a;
|
|
50
|
-
return (_a = getDefaultMiddleware()).concat.apply(_a, middlewares);
|
|
51
|
-
} });
|
|
52
|
-
store.subscribe((0, animations_1.createAnimationsListener)(store, context.Rules));
|
|
53
|
-
void api.init(store.dispatch);
|
|
54
|
-
return store;
|
|
14
|
+
export function RemoteGameProvider({ gameId, children, ...context }) {
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
initStore(context, () => new GameClientAPI(gameId));
|
|
17
|
+
}, []);
|
|
18
|
+
return (_jsxs(Provider, { store: store, children: [_jsx(RemoteGameLoader, { gameId: gameId, version: context.version }), children] }));
|
|
55
19
|
}
|
|
56
20
|
//# sourceMappingURL=RemoteGameProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteGameProvider.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RemoteGameProvider.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,WAAW,CAAA;AAE9B,OAAO,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,CAAC,YAAY,GAAG,IAAI,CAAA;AAE1B,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG;IACzB,MAAM,GAAG,GAAG,IAAI,cAAc,EAAU,CAAA;IACxC,GAAG,CAAC,eAAe,GAAG,IAAI,CAAA;IAC1B,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAMD,MAAM,UAAU,kBAAkB,CAChC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAoE;IAElG,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;IACrD,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO,CACL,MAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,aACpB,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,EAC5D,QAAQ,IACA,CACZ,CAAA;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ApolloClient } from '@apollo/client';
|
|
2
|
-
export declare function getApolloClient(): ApolloClient
|
|
2
|
+
export declare function getApolloClient(): ApolloClient;
|
|
@@ -1,46 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getApolloClient = getApolloClient;
|
|
16
|
-
var client_1 = require("@apollo/client");
|
|
17
|
-
var retry_1 = require("@apollo/client/link/retry");
|
|
18
|
-
var dayjs_1 = __importDefault(require("dayjs"));
|
|
19
|
-
var index_1 = require("../../index");
|
|
20
|
-
var apolloClient;
|
|
21
|
-
function getApolloClient() {
|
|
1
|
+
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache } from '@apollo/client';
|
|
2
|
+
import { RetryLink } from '@apollo/client/link/retry';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import { PLATFORM_URI } from './GameClientAPI';
|
|
5
|
+
let apolloClient;
|
|
6
|
+
export function getApolloClient() {
|
|
22
7
|
if (!apolloClient) {
|
|
23
8
|
apolloClient = initApolloClient();
|
|
24
9
|
}
|
|
25
10
|
return apolloClient;
|
|
26
11
|
}
|
|
27
12
|
function initApolloClient() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cache: new client_1.InMemoryCache({
|
|
13
|
+
const httpLink = new HttpLink({ uri: PLATFORM_URI + (process.env.GRAPHQL_ENDPOINT ?? '/api/graphql'), fetch, credentials: 'include' });
|
|
14
|
+
return new ApolloClient({
|
|
15
|
+
link: ApolloLink.from([new RetryLink(), httpLink]),
|
|
16
|
+
cache: new InMemoryCache({
|
|
33
17
|
typePolicies: {
|
|
34
18
|
ChatChannel: {
|
|
35
19
|
keyFields: ['name'],
|
|
36
20
|
fields: {
|
|
37
21
|
messages: {
|
|
38
22
|
keyArgs: false,
|
|
39
|
-
merge
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.filter(function (message, index, messages) { return index === 0 || message.id !== messages[index - 1].id; });
|
|
23
|
+
merge(existing = [], incoming = []) {
|
|
24
|
+
return [...incoming, ...existing]
|
|
25
|
+
.sort((m1, m2) => dayjs(m2.date).unix() - dayjs(m1.date).unix())
|
|
26
|
+
.filter((message, index, messages) => index === 0 || message.id !== messages[index - 1].id);
|
|
44
27
|
}
|
|
45
28
|
}
|
|
46
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-client.js","sourceRoot":"","sources":["../../../src/api/Client/apollo-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apollo-client.js","sourceRoot":"","sources":["../../../src/api/Client/apollo-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,IAAI,YAAsC,CAAA;AAE1C,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,gBAAgB,EAAE,CAAA;IACnC,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,SAAS,gBAAg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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
|
-
__exportStar(require("./apollo-client"), exports);
|
|
18
|
-
__exportStar(require("./GameClientAPI"), exports);
|
|
19
|
-
__exportStar(require("./pusher"), exports);
|
|
20
|
-
__exportStar(require("./RemoteGameProvider"), exports);
|
|
1
|
+
export * from './apollo-client';
|
|
2
|
+
export * from './GameClientAPI';
|
|
3
|
+
export * from './pusher';
|
|
4
|
+
export * from './RemoteGameProvider';
|
|
21
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/Client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/Client/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA;AACxB,cAAc,sBAAsB,CAAA"}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.pusherClient = void 0;
|
|
8
|
-
var pusher_js_1 = __importDefault(require("pusher-js"));
|
|
9
|
-
var index_1 = require("../../index");
|
|
10
|
-
exports.pusherClient = new pusher_js_1.default((_a = process.env.REACT_APP_PUSHER_KEY) !== null && _a !== void 0 ? _a : '747557f1e8edf7fc2816', {
|
|
11
|
-
cluster: (_b = process.env.REACT_APP_PUSHER_CLUSTER) !== null && _b !== void 0 ? _b : 'eu',
|
|
12
|
-
authEndpoint: index_1.PLATFORM_URI + ((_c = process.env.REACT_APP_PUSHER_ENDPOINT) !== null && _c !== void 0 ? _c : '/api/pusher/auth'),
|
|
1
|
+
import Pusher from 'pusher-js';
|
|
2
|
+
import { PLATFORM_URI } from './GameClientAPI';
|
|
3
|
+
export const pusherClient = new Pusher(process.env.PUSHER_KEY ?? '747557f1e8edf7fc2816', {
|
|
4
|
+
cluster: process.env.PUSHER_CLUSTER ?? 'eu',
|
|
5
|
+
authEndpoint: PLATFORM_URI + (process.env.PUSHER_ENDPOINT ?? '/api/pusher/auth'),
|
|
13
6
|
forceTLS: true,
|
|
14
7
|
disableStats: true
|
|
15
8
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pusher.js","sourceRoot":"","sources":["../../../src/api/Client/pusher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pusher.js","sourceRoot":"","sources":["../../../src/api/Client/pusher.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,sBAAsB,EAAE;IACvF,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI;IAC3C,YAAY,EAAE,YAAY,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,kBAAkB,CAAC;IAChF,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACnB,CAAC,CAAA"}
|
package/dist/api/GameAPI.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Dispatch } from 'redux';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
init(dispatch: Dispatch<GameActions<Game, Move, PlayerId>>): void;
|
|
2
|
+
export interface GameAPI<Move = any, PlayerId = any> {
|
|
3
|
+
init(dispatch: Dispatch): void;
|
|
5
4
|
play(move: Move): void;
|
|
6
5
|
undo(playerActionIndex: number): void;
|
|
7
6
|
undo(actionId: string): void;
|
package/dist/api/GameAPI.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Action } from '@gamepark/rules-api';
|
|
2
2
|
import { Store } from 'redux';
|
|
3
3
|
import { GamePageState } from '../../Store';
|
|
4
|
-
import { GameActions } from '../../Store/gameReducer';
|
|
5
4
|
import { GameLocalAPI } from './GameLocalAPI';
|
|
6
5
|
declare global {
|
|
7
6
|
interface Window {
|
|
@@ -22,5 +21,5 @@ type ConsoleTools<Game = any, Move = any, PlayerId = any> = {
|
|
|
22
21
|
changePlayer: (playerId?: PlayerId) => void;
|
|
23
22
|
timer: (seconds: number, playerId?: PlayerId) => void;
|
|
24
23
|
};
|
|
25
|
-
export declare function consoleTools<Game, Move, PlayerId, View, MoveView>(gameServerProxy: GameLocalAPI<Game, Move, PlayerId, View, MoveView>, store: Store<GamePageState<Game, Move, PlayerId
|
|
24
|
+
export declare function consoleTools<Game, Move, PlayerId, View, MoveView>(gameServerProxy: GameLocalAPI<Game, Move, PlayerId, View, MoveView>, store: Store<GamePageState<Game, Move, PlayerId>>): ConsoleTools<Game, Move, PlayerId>;
|
|
26
25
|
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.consoleTools = consoleTools;
|
|
4
|
-
var Types_1 = require("../../Types");
|
|
5
|
-
function consoleTools(gameServerProxy, store) {
|
|
1
|
+
import { GameSpeed } from '../../Types';
|
|
2
|
+
export function consoleTools(gameServerProxy, store) {
|
|
6
3
|
return {
|
|
7
4
|
get state() {
|
|
8
5
|
return gameServerProxy.getLocalStore().state;
|
|
@@ -13,16 +10,14 @@ function consoleTools(gameServerProxy, store) {
|
|
|
13
10
|
get moves() {
|
|
14
11
|
return gameServerProxy.getLocalStore().actions;
|
|
15
12
|
},
|
|
16
|
-
new:
|
|
13
|
+
new: (options) => {
|
|
17
14
|
gameServerProxy.newGame(options);
|
|
18
15
|
window.location.reload();
|
|
19
16
|
},
|
|
20
|
-
undo:
|
|
21
|
-
if (quantity === void 0) { quantity = 1; }
|
|
17
|
+
undo: (quantity = 1) => {
|
|
22
18
|
gameServerProxy.undo(quantity);
|
|
23
19
|
},
|
|
24
|
-
monkeyOpponents:
|
|
25
|
-
if (start === void 0) { start = true; }
|
|
20
|
+
monkeyOpponents: (start = true) => {
|
|
26
21
|
if (start) {
|
|
27
22
|
gameServerProxy.startBots();
|
|
28
23
|
}
|
|
@@ -30,8 +25,7 @@ function consoleTools(gameServerProxy, store) {
|
|
|
30
25
|
gameServerProxy.stopBots();
|
|
31
26
|
}
|
|
32
27
|
},
|
|
33
|
-
bot:
|
|
34
|
-
if (start === void 0) { start = true; }
|
|
28
|
+
bot: (start = true) => {
|
|
35
29
|
if (start) {
|
|
36
30
|
gameServerProxy.startBots();
|
|
37
31
|
}
|
|
@@ -39,34 +33,33 @@ function consoleTools(gameServerProxy, store) {
|
|
|
39
33
|
gameServerProxy.stopBots();
|
|
40
34
|
}
|
|
41
35
|
},
|
|
42
|
-
setPlayerName:
|
|
36
|
+
setPlayerName: (name, playerId) => {
|
|
43
37
|
gameServerProxy.setPlayerName(name, playerId);
|
|
44
38
|
window.location.reload();
|
|
45
39
|
},
|
|
46
|
-
setAnimationsSpeed:
|
|
47
|
-
if (speed === void 0) { speed = 1; }
|
|
40
|
+
setAnimationsSpeed: (speed = 1) => {
|
|
48
41
|
gameServerProxy.setAnimationsSpeed(speed);
|
|
49
42
|
},
|
|
50
|
-
tutorial:
|
|
43
|
+
tutorial: () => {
|
|
51
44
|
gameServerProxy.newTutorial();
|
|
52
45
|
window.location.reload();
|
|
53
46
|
},
|
|
54
|
-
changePlayer:
|
|
55
|
-
|
|
47
|
+
changePlayer: (playerId) => {
|
|
48
|
+
const localStore = gameServerProxy.getLocalStore();
|
|
56
49
|
localStore.playerId = playerId;
|
|
57
50
|
localStorage.setItem(gameServerProxy.storage, JSON.stringify(localStore));
|
|
58
51
|
window.location.reload();
|
|
59
52
|
},
|
|
60
|
-
timer:
|
|
61
|
-
|
|
53
|
+
timer: (seconds, playerId) => {
|
|
54
|
+
const localStore = gameServerProxy.getLocalStore();
|
|
62
55
|
localStore.options = {
|
|
63
|
-
speed:
|
|
56
|
+
speed: GameSpeed.RealTime,
|
|
64
57
|
maxExceedTime: 60,
|
|
65
58
|
maxSpareTime: 180
|
|
66
59
|
};
|
|
67
60
|
if (playerId === undefined)
|
|
68
61
|
playerId = localStore.playerId;
|
|
69
|
-
|
|
62
|
+
const player = localStore.players.find(player => player.id === playerId);
|
|
70
63
|
player.time = {
|
|
71
64
|
playing: true,
|
|
72
65
|
lastChange: new Date().toISOString(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConsoleTools.js","sourceRoot":"","sources":["../../../src/api/Local/ConsoleTools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConsoleTools.js","sourceRoot":"","sources":["../../../src/api/Local/ConsoleTools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAyBvC,MAAM,UAAU,YAAY,CAC1B,eAAmE,EAAE,KAAiD;IAEtH,OAAO;QACL,IAAI,KAAK;YACP,OAAO,eAAe,CAAC,aAAa,EAAE,CAAC,KAAK,CAAA;QAC9C,CAAC;QAED,IAAI,KAAK;YACP,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;QACzB,CAAC;QAED,IAAI,KAAK;YACP,OAAO,eAAe,CAAC,aAAa,EAAE,CA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ark/rules-api';
|
|
2
2
|
import { Dispatch } from 'redux';
|
|
3
|
-
import { GameActions } from '../../Store/gameReducer';
|
|
4
3
|
import { GameAI, GameNotification, Player, ProxyGameData } from '../../Types';
|
|
5
4
|
import { GameAPI } from '../GameAPI';
|
|
6
5
|
import { LocalGameProviderProps } from './LocalGameProvider';
|
|
7
|
-
export declare class GameLocalAPI<Game, Move = string, PlayerId =
|
|
6
|
+
export declare class GameLocalAPI<Game, Move = string, PlayerId = any, GameView = Game, MoveView = Move, Options extends {
|
|
8
7
|
players: any;
|
|
9
|
-
} | undefined = undefined> implements GameAPI<
|
|
8
|
+
} | undefined = undefined> implements GameAPI<Move, PlayerId> {
|
|
10
9
|
storage: string;
|
|
11
10
|
gameSetup: GameSetup<Game, Options>;
|
|
12
11
|
Rules: RulesCreator<Game, Move, PlayerId>;
|
|
@@ -14,14 +13,14 @@ export declare class GameLocalAPI<Game, Move = string, PlayerId = number, GameVi
|
|
|
14
13
|
optionsSpec?: OptionsSpec<Options>;
|
|
15
14
|
private readonly ai?;
|
|
16
15
|
private readonly tutorial?;
|
|
17
|
-
dispatch?: Dispatch
|
|
16
|
+
dispatch?: Dispatch;
|
|
18
17
|
private lastActionId;
|
|
19
18
|
private notificationsCount;
|
|
20
19
|
private autoPlayersCounter;
|
|
21
20
|
private aiProcessing;
|
|
22
21
|
private tutorialMovesToPlay;
|
|
23
22
|
constructor({ Rules, ServerRules, GameSetup, ai, game, storage, optionsSpec, tutorial }: LocalGameProviderProps<Game, GameView, Move, MoveView, PlayerId>);
|
|
24
|
-
init(dispatch: Dispatch
|
|
23
|
+
init(dispatch: Dispatch): void;
|
|
25
24
|
initLocalStore(): ProxyGameData;
|
|
26
25
|
getNotifications(data: ProxyGameData<Game, MoveView, PlayerId>): GameNotification<PlayerId>[];
|
|
27
26
|
newTutorial(): ProxyGameData;
|