@gamepark/react-client 6.38.5 → 7.0.0-beta.0
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.d.ts +6 -6
- package/dist/Actions/ActionFailed.js +8 -8
- package/dist/Actions/ActionFailed.js.map +1 -1
- package/dist/Actions/ActionType.d.ts +3 -3
- package/dist/Actions/ActionType.js +7 -7
- package/dist/Actions/ActionType.js.map +1 -1
- package/dist/Actions/AnimationComplete.d.ts +6 -6
- package/dist/Actions/AnimationComplete.js +8 -8
- package/dist/Actions/AnimationComplete.js.map +1 -1
- package/dist/Actions/AnimationPaused.d.ts +6 -6
- package/dist/Actions/AnimationPaused.js +8 -8
- package/dist/Actions/AnimationPaused.js.map +1 -1
- package/dist/Actions/AnimationStart.d.ts +5 -5
- package/dist/Actions/AnimationStart.js +4 -4
- package/dist/Actions/ClearFailures.d.ts +5 -5
- package/dist/Actions/ClearFailures.js +8 -8
- package/dist/Actions/ClearFailures.js.map +1 -1
- package/dist/Actions/GameNotificationsReceived.d.ts +10 -10
- package/dist/Actions/GameNotificationsReceived.js +9 -9
- package/dist/Actions/GameNotificationsReceived.js.map +1 -1
- package/dist/Actions/GameOver.d.ts +16 -16
- package/dist/Actions/GameOver.js +8 -8
- package/dist/Actions/GameOver.js.map +1 -1
- package/dist/Actions/GameStateLoaded.d.ts +16 -16
- package/dist/Actions/GameStateLoaded.js +20 -20
- package/dist/Actions/GameStateLoaded.js.map +1 -1
- package/dist/Actions/MovePlayed.d.ts +11 -11
- package/dist/Actions/MovePlayed.js +4 -2
- package/dist/Actions/MovePlayed.js.map +1 -1
- package/dist/Actions/MoveUndone.d.ts +7 -7
- package/dist/Actions/MoveUndone.js +9 -9
- package/dist/Actions/MoveUndone.js.map +1 -1
- package/dist/Actions/PlayerQuit.d.ts +11 -11
- package/dist/Actions/PlayerQuit.js +19 -19
- package/dist/Actions/PlayerQuit.js.map +1 -1
- package/dist/Actions/SetAnimationsSpeed.d.ts +6 -6
- package/dist/Actions/SetAnimationsSpeed.js +8 -8
- package/dist/Actions/SetAnimationsSpeed.js.map +1 -1
- package/dist/Actions/index.d.ts +11 -12
- package/dist/Actions/index.js +27 -28
- package/dist/Actions/index.js.map +1 -1
- package/dist/Chat/ChatChannel.d.ts +5 -5
- package/dist/Chat/ChatChannel.js +2 -2
- package/dist/Chat/Message.d.ts +6 -6
- package/dist/Chat/Message.js +2 -2
- package/dist/Chat/index.d.ts +2 -2
- package/dist/Chat/index.js +18 -18
- package/dist/Deckbuilding/Deck.d.ts +5 -5
- package/dist/Deckbuilding/Deck.js +2 -2
- package/dist/Deckbuilding/index.d.ts +4 -4
- package/dist/Deckbuilding/index.js +24 -24
- package/dist/Deckbuilding/useDeleteDeck.d.ts +2 -2
- package/dist/Deckbuilding/useDeleteDeck.js +15 -15
- package/dist/Deckbuilding/useDeleteDeck.js.map +1 -1
- package/dist/Deckbuilding/useMyDecks.d.ts +2 -2
- package/dist/Deckbuilding/useMyDecks.js +14 -14
- package/dist/Deckbuilding/useMyDecks.js.map +1 -1
- package/dist/Deckbuilding/useSaveDeck.d.ts +2 -2
- package/dist/Deckbuilding/useSaveDeck.js +15 -15
- package/dist/Deckbuilding/useSaveDeck.js.map +1 -1
- package/dist/EjectPlayer/EjectPlayer.d.ts +6 -6
- package/dist/EjectPlayer/EjectPlayer.js +8 -8
- package/dist/EjectPlayer/EjectPlayer.js.map +1 -1
- package/dist/EjectPlayer/index.d.ts +1 -1
- package/dist/EjectPlayer/index.js +17 -17
- package/dist/Failure/Failure.d.ts +6 -6
- package/dist/Failure/Failure.js +9 -9
- package/dist/Failure/index.d.ts +1 -1
- package/dist/Failure/index.js +17 -17
- package/dist/GiveUp/GiveUp.d.ts +7 -7
- package/dist/GiveUp/GiveUp.js +5 -5
- package/dist/GiveUp/index.d.ts +1 -1
- package/dist/GiveUp/index.js +17 -17
- package/dist/Hooks/index.d.ts +5 -5
- package/dist/Hooks/index.js +21 -21
- package/dist/Hooks/useChatMessages.d.ts +12 -12
- package/dist/Hooks/useChatMessages.js +53 -51
- package/dist/Hooks/useChatMessages.js.map +1 -1
- package/dist/Hooks/useMessageAuthor.d.ts +4 -4
- package/dist/Hooks/useMessageAuthor.js +17 -18
- package/dist/Hooks/useMessageAuthor.js.map +1 -1
- package/dist/Hooks/useOptions.d.ts +2 -2
- package/dist/Hooks/useOptions.js +7 -8
- package/dist/Hooks/useOptions.js.map +1 -1
- package/dist/Hooks/useRematch.d.ts +7 -7
- package/dist/Hooks/useRematch.js +22 -19
- package/dist/Hooks/useRematch.js.map +1 -1
- package/dist/Hooks/useSendMessage.d.ts +1 -1
- package/dist/Hooks/useSendMessage.js +13 -14
- package/dist/Hooks/useSendMessage.js.map +1 -1
- package/dist/Log/StartLiveLog.d.ts +4 -4
- package/dist/Log/StartLiveLog.js +4 -4
- package/dist/Log/StopLiveLog.d.ts +5 -5
- package/dist/Log/StopLiveLog.js +8 -8
- package/dist/Log/StopLiveLog.js.map +1 -1
- package/dist/Log/index.d.ts +4 -4
- package/dist/Log/index.js +20 -20
- package/dist/Log/useLogControls.d.ts +7 -7
- package/dist/Log/useLogControls.js +21 -22
- package/dist/Log/useLogControls.js.map +1 -1
- package/dist/PlayerTime/PlayerTime.d.ts +11 -11
- package/dist/PlayerTime/PlayerTime.js +2 -2
- package/dist/PlayerTime/index.d.ts +1 -1
- package/dist/PlayerTime/index.js +17 -17
- package/dist/Rematch/RematchQueries.d.ts +19 -19
- package/dist/Rematch/RematchQueries.js +13 -13
- package/dist/Rematch/index.d.ts +1 -1
- package/dist/Rematch/index.js +17 -17
- package/dist/Sound/MuteSounds.d.ts +5 -5
- package/dist/Sound/MuteSounds.js +9 -9
- package/dist/Sound/MuteSounds.js.map +1 -1
- package/dist/Sound/UnmuteSounds.d.ts +4 -4
- package/dist/Sound/UnmuteSounds.js +4 -4
- package/dist/Sound/index.d.ts +3 -3
- package/dist/Sound/index.js +19 -19
- package/dist/Sound/useSoundControls.d.ts +7 -7
- package/dist/Sound/useSoundControls.js +21 -22
- package/dist/Sound/useSoundControls.js.map +1 -1
- package/dist/Store/DisplayedAction.d.ts +15 -15
- package/dist/Store/DisplayedAction.js +18 -19
- package/dist/Store/DisplayedAction.js.map +1 -1
- package/dist/Store/GamePageState.d.ts +28 -28
- package/dist/Store/GamePageState.js +2 -2
- package/dist/Store/PlayedMove.d.ts +5 -5
- package/dist/Store/PlayedMove.js +2 -2
- package/dist/Store/gameMiddleware.d.ts +4 -4
- package/dist/Store/gameMiddleware.js +45 -41
- package/dist/Store/gameMiddleware.js.map +1 -1
- package/dist/Store/gameReducer.d.ts +23 -20
- package/dist/Store/gameReducer.js +538 -525
- package/dist/Store/gameReducer.js.map +1 -1
- package/dist/Store/index.d.ts +3 -3
- package/dist/Store/index.js +19 -19
- package/dist/Store/localMovePreviewMiddleware.d.ts +4 -4
- package/dist/Store/localMovePreviewMiddleware.js +17 -18
- package/dist/Store/localMovePreviewMiddleware.js.map +1 -1
- package/dist/Tutorial/PlayTutorialMoves.d.ts +9 -9
- package/dist/Tutorial/PlayTutorialMoves.js +6 -6
- package/dist/Tutorial/Tutorial.d.ts +5 -5
- package/dist/Tutorial/Tutorial.js +2 -2
- package/dist/Tutorial/TutorialDescription.d.ts +7 -7
- package/dist/Tutorial/TutorialDescription.js +2 -2
- package/dist/Tutorial/index.d.ts +4 -4
- package/dist/Tutorial/index.js +20 -20
- package/dist/Tutorial/useTutorial.d.ts +2 -2
- package/dist/Tutorial/useTutorial.js +21 -22
- package/dist/Tutorial/useTutorial.js.map +1 -1
- package/dist/Types/GameAI.d.ts +1 -1
- package/dist/Types/GameAI.js +2 -2
- package/dist/Types/GameData.d.ts +18 -18
- package/dist/Types/GameData.js +2 -2
- package/dist/Types/GameMessage.d.ts +8 -8
- package/dist/Types/GameMessage.js +2 -2
- package/dist/Types/GameMode.d.ts +6 -6
- package/dist/Types/GameMode.js +10 -10
- package/dist/Types/GameMode.js.map +1 -1
- package/dist/Types/GameNotification.d.ts +6 -6
- package/dist/Types/GameNotification.js +2 -2
- package/dist/Types/GameOptions.d.ts +9 -9
- package/dist/Types/GameOptions.js +8 -8
- package/dist/Types/GameOptions.js.map +1 -1
- package/dist/Types/MovePlayedNotification.d.ts +9 -9
- package/dist/Types/MovePlayedNotification.js +11 -12
- package/dist/Types/MovePlayedNotification.js.map +1 -1
- package/dist/Types/MoveUndoneNotification.d.ts +8 -8
- package/dist/Types/MoveUndoneNotification.js +11 -12
- package/dist/Types/MoveUndoneNotification.js.map +1 -1
- package/dist/Types/Player.d.ts +13 -13
- package/dist/Types/Player.js +2 -2
- package/dist/Types/PlayerQuitReason.d.ts +4 -4
- package/dist/Types/PlayerQuitReason.js +8 -8
- package/dist/Types/PlayerQuitReason.js.map +1 -1
- package/dist/Types/ProxyGameData.d.ts +13 -13
- package/dist/Types/ProxyGameData.js +2 -2
- package/dist/Types/Tournament.d.ts +4 -4
- package/dist/Types/Tournament.js +2 -2
- package/dist/Types/index.d.ts +12 -12
- package/dist/Types/index.js +28 -28
- package/dist/User/User.d.ts +6 -6
- package/dist/User/User.js +2 -2
- package/dist/User/index.d.ts +2 -2
- package/dist/User/index.js +18 -18
- package/dist/User/useMe.d.ts +4 -4
- package/dist/User/useMe.js +20 -21
- package/dist/User/useMe.js.map +1 -1
- package/dist/animations/Animation.d.ts +6 -6
- package/dist/animations/Animation.js +2 -2
- package/dist/animations/AnimationContext.d.ts +8 -8
- package/dist/animations/AnimationContext.js +2 -2
- package/dist/animations/AnimationState.d.ts +6 -6
- package/dist/animations/AnimationState.js +2 -2
- package/dist/animations/AnimationStep.d.ts +6 -6
- package/dist/animations/AnimationStep.js +10 -10
- package/dist/animations/AnimationStep.js.map +1 -1
- package/dist/animations/Animations.d.ts +8 -8
- package/dist/animations/Animations.js +22 -22
- package/dist/animations/Animations.js.map +1 -1
- package/dist/animations/AnimationsListenerCreator.d.ts +5 -4
- package/dist/animations/AnimationsListenerCreator.js +46 -50
- package/dist/animations/AnimationsListenerCreator.js.map +1 -1
- package/dist/animations/index.d.ts +6 -6
- package/dist/animations/index.js +22 -22
- package/dist/api/Client/GameClientAPI.d.ts +25 -24
- package/dist/api/Client/GameClientAPI.js +166 -166
- package/dist/api/Client/GameClientAPI.js.map +1 -1
- package/dist/api/Client/GameNotificationsListener.d.ts +5 -5
- package/dist/api/Client/GameNotificationsListener.js +116 -114
- package/dist/api/Client/GameNotificationsListener.js.map +1 -1
- package/dist/api/Client/RemoteGameLoader.d.ts +4 -5
- package/dist/api/Client/RemoteGameLoader.js +61 -62
- package/dist/api/Client/RemoteGameLoader.js.map +1 -1
- package/dist/api/Client/RemoteGameProvider.d.ts +7 -7
- package/dist/api/Client/RemoteGameProvider.js +55 -70
- package/dist/api/Client/RemoteGameProvider.js.map +1 -1
- package/dist/api/Client/apollo-client.d.ts +2 -2
- package/dist/api/Client/apollo-client.js +57 -58
- package/dist/api/Client/apollo-client.js.map +1 -1
- package/dist/api/Client/index.d.ts +4 -3
- package/dist/api/Client/index.js +20 -19
- package/dist/api/Client/index.js.map +1 -1
- package/dist/api/Client/pusher.d.ts +2 -0
- package/dist/api/Client/pusher.js +16 -0
- package/dist/api/Client/pusher.js.map +1 -0
- package/dist/api/GameAPI.d.ts +11 -10
- package/dist/api/GameAPI.js +2 -2
- package/dist/api/Local/ConsoleTools.d.ts +26 -25
- package/dist/api/Local/ConsoleTools.js +85 -86
- package/dist/api/Local/ConsoleTools.js.map +1 -1
- package/dist/api/Local/GameLocalAPI.d.ts +45 -44
- package/dist/api/Local/GameLocalAPI.js +541 -540
- package/dist/api/Local/GameLocalAPI.js.map +1 -1
- package/dist/api/Local/LocalGameProvider.d.ts +15 -15
- package/dist/api/Local/LocalGameProvider.js +49 -58
- package/dist/api/Local/LocalGameProvider.js.map +1 -1
- package/dist/api/Local/index.d.ts +1 -1
- package/dist/api/Local/index.js +17 -17
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +36 -36
- package/dist/util/ArrayUtil.d.ts +2 -2
- package/dist/util/ArrayUtil.js +20 -21
- package/dist/util/ArrayUtil.js.map +1 -1
- package/package.json +19 -22
|
@@ -1,115 +1,117 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
16
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
17
|
-
return g =
|
|
18
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19
|
-
function step(op) {
|
|
20
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
21
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
22
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
23
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
24
|
-
switch (op[0]) {
|
|
25
|
-
case 0: case 1: t = op; break;
|
|
26
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
27
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
28
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
29
|
-
default:
|
|
30
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
31
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
32
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
33
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
34
|
-
if (t[2]) _.ops.pop();
|
|
35
|
-
_.trys.pop(); continue;
|
|
36
|
-
}
|
|
37
|
-
op = body.call(thisArg, _);
|
|
38
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
39
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.GameNotificationsListener =
|
|
44
|
-
var client_1 = require("@apollo/client");
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var GET_NOTIFICATIONS = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query GameNotifications($gameId: String!, $start: Int) {\n time\n gameNotifications(gameId: $gameId, start: $start) { ...Notifications }\n game(id: $gameId) {\n id players { id ...PlayerTime }\n }\n } ", " ", "\n"], ["\n query GameNotifications($gameId: String!, $start: Int) {\n time\n gameNotifications(gameId: $gameId, start: $start) { ...Notifications }\n game(id: $gameId) {\n id players { id ...PlayerTime }\n }\n } ", " ", "\n"])), GameClientAPI_1.NOTIFICATIONS, GameClientAPI_1.PLAYERS_TIME);
|
|
52
|
-
function GameNotificationsListener(_a) {
|
|
53
|
-
var _this = this;
|
|
54
|
-
var gameId = _a.gameId, channelName = _a.channelName, notificationsCount = _a.notificationsCount;
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
16
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
17
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
18
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19
|
+
function step(op) {
|
|
20
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
21
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
22
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
23
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
24
|
+
switch (op[0]) {
|
|
25
|
+
case 0: case 1: t = op; break;
|
|
26
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
27
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
28
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
29
|
+
default:
|
|
30
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
31
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
32
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
33
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
34
|
+
if (t[2]) _.ops.pop();
|
|
35
|
+
_.trys.pop(); continue;
|
|
36
|
+
}
|
|
37
|
+
op = body.call(thisArg, _);
|
|
38
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
39
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.GameNotificationsListener = GameNotificationsListener;
|
|
44
|
+
var client_1 = require("@apollo/client");
|
|
45
|
+
var react_1 = require("react");
|
|
46
|
+
var react_redux_1 = require("react-redux");
|
|
47
|
+
var Actions_1 = require("../../Actions");
|
|
48
|
+
var PlayerQuit_1 = require("../../Actions/PlayerQuit");
|
|
49
|
+
var GameClientAPI_1 = require("./GameClientAPI");
|
|
50
|
+
var pusher_1 = require("./pusher");
|
|
51
|
+
var GET_NOTIFICATIONS = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query GameNotifications($gameId: String!, $start: Int) {\n time\n gameNotifications(gameId: $gameId, start: $start) { ...Notifications }\n game(id: $gameId) {\n id players { id ...PlayerTime }\n }\n } ", " ", "\n"], ["\n query GameNotifications($gameId: String!, $start: Int) {\n time\n gameNotifications(gameId: $gameId, start: $start) { ...Notifications }\n game(id: $gameId) {\n id players { id ...PlayerTime }\n }\n } ", " ", "\n"])), GameClientAPI_1.NOTIFICATIONS, GameClientAPI_1.PLAYERS_TIME);
|
|
52
|
+
function GameNotificationsListener(_a) {
|
|
53
|
+
var _this = this;
|
|
54
|
+
var gameId = _a.gameId, channelName = _a.channelName, notificationsCount = _a.notificationsCount;
|
|
55
|
+
var client = (0, client_1.useApolloClient)();
|
|
56
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
|
57
|
+
var notificationsCountRef = (0, react_1.useRef)(notificationsCount);
|
|
58
|
+
var getNotifications = function (start) { return __awaiter(_this, void 0, void 0, function () {
|
|
59
|
+
var data;
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
switch (_a.label) {
|
|
62
|
+
case 0: return [4, client.query({
|
|
63
|
+
query: GET_NOTIFICATIONS,
|
|
64
|
+
variables: { gameId: gameId, start: start }
|
|
65
|
+
})];
|
|
66
|
+
case 1:
|
|
67
|
+
data = (_a.sent()).data;
|
|
68
|
+
if (!data)
|
|
69
|
+
return [2, console.error('Failed to collect game data')];
|
|
70
|
+
dispatch((0, Actions_1.gameNotificationsReceived)(data.gameNotifications, start, data.game.players, data.time));
|
|
71
|
+
if (data.gameNotifications.length > 0) {
|
|
72
|
+
notificationsCountRef.current = Math.max(notificationsCountRef.current, start + data.gameNotifications.length);
|
|
73
|
+
}
|
|
74
|
+
return [2];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
(0, react_1.useEffect)(function () {
|
|
79
|
+
var channel = pusher_1.pusherClient.subscribe(channelName);
|
|
80
|
+
channel.bind('pusher:subscription_error', function (error) { return console.error('pusher subscription failed', error); });
|
|
81
|
+
channel.bind('pusher:subscription_succeeded', function () { return getNotifications(notificationsCountRef.current); });
|
|
82
|
+
channel.bind('moves-played', function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
83
|
+
var index, notifications, players, date;
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
switch (_a.label) {
|
|
86
|
+
case 0:
|
|
87
|
+
if (!message)
|
|
88
|
+
return [2];
|
|
89
|
+
index = message.index, notifications = message.notifications, players = message.players, date = message.date;
|
|
90
|
+
dispatch((0, Actions_1.gameNotificationsReceived)(notifications, index, players, Date.parse(date)));
|
|
91
|
+
if (!notifications.length) return [3, 1];
|
|
92
|
+
notificationsCountRef.current = Math.max(notificationsCountRef.current, index + notifications.length);
|
|
93
|
+
return [3, 3];
|
|
94
|
+
case 1: return [4, getNotifications(index)];
|
|
95
|
+
case 2:
|
|
96
|
+
_a.sent();
|
|
97
|
+
_a.label = 3;
|
|
98
|
+
case 3: return [2];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); });
|
|
102
|
+
channel.bind('game-over', function (players) {
|
|
103
|
+
if (players) {
|
|
104
|
+
dispatch((0, Actions_1.gameOver)(players));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
channel.bind('player-quit', function (data) {
|
|
108
|
+
if (data) {
|
|
109
|
+
dispatch((0, PlayerQuit_1.playerQuit)(data));
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return function () { return pusher_1.pusherClient.unsubscribe(channelName); };
|
|
113
|
+
}, []);
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
var templateObject_1;
|
|
115
117
|
//# sourceMappingURL=GameNotificationsListener.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameNotificationsListener.js","sourceRoot":"","sources":["../../../src/api/Client/GameNotificationsListener.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GameNotificationsListener.js","sourceRoot":"","sources":["../../../src/api/Client/GameNotificationsListener.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}): JSX.Element | null;
|
|
1
|
+
export declare function RemoteGameLoader({ gameId, version }: {
|
|
2
|
+
gameId: string;
|
|
3
|
+
version?: number;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,63 +1,62 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __assign = (this && this.__assign) || function () {
|
|
7
|
-
__assign = Object.assign || function(t) {
|
|
8
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
-
s = arguments[i];
|
|
10
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
-
t[p] = s[p];
|
|
12
|
-
}
|
|
13
|
-
return t;
|
|
14
|
-
};
|
|
15
|
-
return __assign.apply(this, arguments);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.RemoteGameLoader =
|
|
19
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
20
|
-
var client_1 = require("@apollo/client");
|
|
21
|
-
var react_1 = require("react");
|
|
22
|
-
var react_redux_1 = require("react-redux");
|
|
23
|
-
var Actions_1 = require("../../Actions");
|
|
24
|
-
var GameClientAPI_1 = require("./GameClientAPI");
|
|
25
|
-
var GameNotificationsListener_1 = require("./GameNotificationsListener");
|
|
26
|
-
var GET_GAME = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query Game($id: String!) {\n time\n gameNotifications(gameId: $id, start: 0) { ...Notifications }\n game(id: $id) {\n id\n players {\n id userId name avatar {...AvatarInfo} quit quitReason gamePointsDelta tournamentPoints ...PlayerTime\n }\n options {\n speed maxSpareTime maxExceedTime\n }\n notificationsChannel mode setup state myPlayerId endDate\n tournament {\n number signedUp\n }\n version\n }\n } ", " ", " ", "\n"], ["\n query Game($id: String!) {\n time\n gameNotifications(gameId: $id, start: 0) { ...Notifications }\n game(id: $id) {\n id\n players {\n id userId name avatar {...AvatarInfo} quit quitReason gamePointsDelta tournamentPoints ...PlayerTime\n }\n options {\n speed maxSpareTime maxExceedTime\n }\n notificationsChannel mode setup state myPlayerId endDate\n tournament {\n number signedUp\n }\n version\n }\n } ", " ", " ", "\n"])), GameClientAPI_1.PLAYERS_TIME, GameClientAPI_1.AVATAR_INFO, GameClientAPI_1.NOTIFICATIONS);
|
|
27
|
-
function RemoteGameLoader(_a) {
|
|
28
|
-
var _b, _c;
|
|
29
|
-
var gameId = _a.gameId, _d = _a.version, version = _d === void 0 ? 1 : _d;
|
|
30
|
-
var dispatch = (0, react_redux_1.useDispatch)();
|
|
31
|
-
var isOver = (0, react_redux_1.useSelector)(function (state) { return state.gameOver; });
|
|
32
|
-
var _e = (0, react_1.useState)(isOver), isOverForLongEnough = _e[0], setIsOverForLongEnough = _e[1];
|
|
33
|
-
(0, react_1.useEffect)(function () {
|
|
34
|
-
if (isOver) {
|
|
35
|
-
setTimeout(function () { return setIsOverForLongEnough(isOver); }, 10000);
|
|
36
|
-
}
|
|
37
|
-
}, [isOver]);
|
|
38
|
-
var _f = (0, client_1.useLazyQuery)(GET_GAME), getGame = _f[0], data = _f[1].data;
|
|
39
|
-
(0, react_1.useEffect)(function () {
|
|
40
|
-
getGame({ variables: { id: gameId } }).then(function (result) {
|
|
41
|
-
if (result.data) {
|
|
42
|
-
var _a = result.data, game = _a.game, time = _a.time, gameNotifications = _a.gameNotifications;
|
|
43
|
-
var remoteVersion = game.version;
|
|
44
|
-
if (remoteVersion && remoteVersion !== version) {
|
|
45
|
-
var url = new URL(window.location.href);
|
|
46
|
-
var path = url.hostname.split('.');
|
|
47
|
-
url.hostname = "".concat(path[0], ".v").concat(remoteVersion, ".").concat(path[path.length - 2], ".").concat(path[path.length - 1]);
|
|
48
|
-
window.location.href = url.href;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
dispatch((0, Actions_1.gameStateLoaded)(__assign(__assign({}, game), { notifications: gameNotifications }), time));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}, []);
|
|
56
|
-
if (!data || data.game.endDate || isOverForLongEnough)
|
|
57
|
-
return null;
|
|
58
|
-
else
|
|
59
|
-
return (0, jsx_runtime_1.jsx)(GameNotificationsListener_1.GameNotificationsListener, { channelName: (_c = (_b = data === null || data === void 0 ? void 0 : data.game) === null || _b === void 0 ? void 0 : _b.notificationsChannel) !== null && _c !== void 0 ? _c : "game=".concat(gameId), gameId: gameId, notificationsCount: data.gameNotifications.length });
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var templateObject_1;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RemoteGameLoader = RemoteGameLoader;
|
|
19
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
20
|
+
var client_1 = require("@apollo/client");
|
|
21
|
+
var react_1 = require("react");
|
|
22
|
+
var react_redux_1 = require("react-redux");
|
|
23
|
+
var Actions_1 = require("../../Actions");
|
|
24
|
+
var GameClientAPI_1 = require("./GameClientAPI");
|
|
25
|
+
var GameNotificationsListener_1 = require("./GameNotificationsListener");
|
|
26
|
+
var GET_GAME = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query Game($id: String!) {\n time\n gameNotifications(gameId: $id, start: 0) { ...Notifications }\n game(id: $id) {\n id\n players {\n id userId name avatar {...AvatarInfo} quit quitReason gamePointsDelta tournamentPoints ...PlayerTime\n }\n options {\n speed maxSpareTime maxExceedTime\n }\n notificationsChannel mode setup state myPlayerId endDate\n tournament {\n number signedUp\n }\n version\n }\n } ", " ", " ", "\n"], ["\n query Game($id: String!) {\n time\n gameNotifications(gameId: $id, start: 0) { ...Notifications }\n game(id: $id) {\n id\n players {\n id userId name avatar {...AvatarInfo} quit quitReason gamePointsDelta tournamentPoints ...PlayerTime\n }\n options {\n speed maxSpareTime maxExceedTime\n }\n notificationsChannel mode setup state myPlayerId endDate\n tournament {\n number signedUp\n }\n version\n }\n } ", " ", " ", "\n"])), GameClientAPI_1.PLAYERS_TIME, GameClientAPI_1.AVATAR_INFO, GameClientAPI_1.NOTIFICATIONS);
|
|
27
|
+
function RemoteGameLoader(_a) {
|
|
28
|
+
var _b, _c;
|
|
29
|
+
var gameId = _a.gameId, _d = _a.version, version = _d === void 0 ? 1 : _d;
|
|
30
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
|
31
|
+
var isOver = (0, react_redux_1.useSelector)(function (state) { return state.gameOver; });
|
|
32
|
+
var _e = (0, react_1.useState)(isOver), isOverForLongEnough = _e[0], setIsOverForLongEnough = _e[1];
|
|
33
|
+
(0, react_1.useEffect)(function () {
|
|
34
|
+
if (isOver) {
|
|
35
|
+
setTimeout(function () { return setIsOverForLongEnough(isOver); }, 10000);
|
|
36
|
+
}
|
|
37
|
+
}, [isOver]);
|
|
38
|
+
var _f = (0, client_1.useLazyQuery)(GET_GAME), getGame = _f[0], data = _f[1].data;
|
|
39
|
+
(0, react_1.useEffect)(function () {
|
|
40
|
+
getGame({ variables: { id: gameId } }).then(function (result) {
|
|
41
|
+
if (result.data) {
|
|
42
|
+
var _a = result.data, game = _a.game, time = _a.time, gameNotifications = _a.gameNotifications;
|
|
43
|
+
var remoteVersion = game.version;
|
|
44
|
+
if (remoteVersion && remoteVersion !== version) {
|
|
45
|
+
var url = new URL(window.location.href);
|
|
46
|
+
var path = url.hostname.split('.');
|
|
47
|
+
url.hostname = "".concat(path[0], ".v").concat(remoteVersion, ".").concat(path[path.length - 2], ".").concat(path[path.length - 1]);
|
|
48
|
+
window.location.href = url.href;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
dispatch((0, Actions_1.gameStateLoaded)(__assign(__assign({}, game), { notifications: gameNotifications }), time));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}, []);
|
|
56
|
+
if (!data || data.game.endDate || isOverForLongEnough)
|
|
57
|
+
return null;
|
|
58
|
+
else
|
|
59
|
+
return (0, jsx_runtime_1.jsx)(GameNotificationsListener_1.GameNotificationsListener, { channelName: (_c = (_b = data === null || data === void 0 ? void 0 : data.game) === null || _b === void 0 ? void 0 : _b.notificationsChannel) !== null && _c !== void 0 ? _c : "game=".concat(gameId), gameId: gameId, notificationsCount: data.gameNotifications.length });
|
|
60
|
+
}
|
|
61
|
+
var templateObject_1;
|
|
63
62
|
//# sourceMappingURL=RemoteGameLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteGameLoader.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameLoader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RemoteGameLoader.js","sourceRoot":"","sources":["../../../src/api/Client/RemoteGameLoader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8BA,4CA6BC;;AA3DD,yCAAkD;AAClD,+BAA2C;AAC3C,2CAAsD;AACtD,yCAA+C;AAG/C,iDAA0E;AAC1E,yEAAuE;AAEvE,IAAM,QAAQ,OAAG,YAAG,8jBAAA,0eAkBd,EAAY,GAAI,EAAW,GAAI,EAAa,IACjD,KADK,4BAAY,EAAI,2BAAW,EAAI,6BAAa,CACjD,CAAA;AAED,SAAgB,gBAAgB,CAAC,EAA6D;;QAA3D,MAAM,YAAA,EAAE,eAAW,EAAX,OAAO,mBAAG,CAAC,KAAA;IACpD,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAO,CAAA;IACnC,IAAM,MAAM,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAoB,IAAK,OAAA,KAAK,CAAC,QAAQ,EAAd,CAAc,CAAC,CAAA;IAC9D,IAAA,KAAgD,IAAA,gBAAQ,EAAC,MAAM,CAAC,EAA/D,mBAAmB,QAAA,EAAE,sBAAsB,QAAoB,CAAA;IACtE,IAAA,iBAAS,EAAC;QACR,IAAI,MAAM,EAAE,CAAC;YACX,UAAU,CAAC,cAAM,OAAA,sBAAsB,CAAC,MAAM,CAAC,EAA9B,CAA8B,EAAE,KAAK,CAAC,CAAA;QACzD,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IACN,IAAA,KAAsB,IAAA,qBAAY,EAA0E,QAAQ,CAAC,EAApH,OAAO,QAAA,EAAI,IAAI,aAAqG,CAAA;IAC3H,IAAA,iBAAS,EAAC;QACR,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,MAAM;YAChD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBACV,IAAA,KAAoC,MAAM,CAAC,IAAI,EAA7C,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,iBAAiB,uBAAgB,CAAA;gBACrD,IAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAA;gBAClC,IAAI,aAAa,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;oBAC/C,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;oBACzC,IAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;oBACpC,GAAG,CAAC,QAAQ,GAAG,UAAG,IAAI,CAAC,CAAC,CAAC,eAAK,aAAa,cAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,cAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAE,CAAA;oBAC/F,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;gBACjC,CAAC;qBAAM,CAAC;oBACN,QAAQ,CAAC,IAAA,yBAAe,wBAAM,IAAI,KAAE,aAAa,EAAE,iBAAiB,KAAI,IAAI,CAAC,CAAC,CAAA;gBAChF,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,mBAAmB;QAAE,OAAO,IAAI,CAAA;;QAC7D,OAAO,uBAAC,qDAAyB,IAAC,WAAW,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,0CAAE,oBAAoB,mCAAI,eAAQ,MAAM,CAAE,EAAE,MAAM,EAAE,MAAM,EACjF,kBAAkB,EAAE,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAA;AAC7F,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { GameReducerContext } from '../../Store/gameReducer';
|
|
3
|
-
type RemoveGameProviderProps<Game = any, Move = any, PlayerId = any> = {
|
|
4
|
-
gameId: string;
|
|
5
|
-
} & GameReducerContext<Game, Move, PlayerId>;
|
|
6
|
-
export declare function RemoteGameProvider<Game = any, Move = any, PlayerId = any>({ gameId, children, ...context }: PropsWithChildren<RemoveGameProviderProps<Game, Move, PlayerId>>): JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { GameReducerContext } from '../../Store/gameReducer';
|
|
3
|
+
type RemoveGameProviderProps<Game = any, Move = any, PlayerId = any> = {
|
|
4
|
+
gameId: string;
|
|
5
|
+
} & GameReducerContext<Game, Move, PlayerId>;
|
|
6
|
+
export declare function RemoteGameProvider<Game = any, Move = any, PlayerId = any>({ gameId, children, ...context }: PropsWithChildren<RemoveGameProviderProps<Game, Move, PlayerId>>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,71 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
};
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(use_pusher_1.PusherProvider, __assign({ authEndpoint: authEndpoint, clientKey: clientKey, cluster: cluster }, { children: (0, jsx_runtime_1.jsxs)(react_redux_1.Provider, __assign({ store: store }, { children: [(0, jsx_runtime_1.jsx)(RemoteGameLoader_1.RemoteGameLoader, { gameId: gameId, version: context.version }), children] })) })));
|
|
57
|
-
}
|
|
58
|
-
exports.RemoteGameProvider = RemoteGameProvider;
|
|
59
|
-
function createRemoteApiStore(gameId, context) {
|
|
60
|
-
var api = new GameClientAPI_1.GameClientAPI(gameId);
|
|
61
|
-
var reducer = (0, gameReducer_1.gameReducer)(context);
|
|
62
|
-
var middlewares = [(0, gameMiddleware_1.gameMiddleware)(api)];
|
|
63
|
-
if ((0, rules_api_1.hasLocalMovePreview)(new context.Rules({}))) {
|
|
64
|
-
middlewares.unshift((0, localMovePreviewMiddleware_1.localMovePreviewMiddleware)(context));
|
|
65
|
-
}
|
|
66
|
-
var store = (0, redux_1.createStore)(reducer, redux_1.applyMiddleware.apply(void 0, middlewares));
|
|
67
|
-
store.subscribe((0, animations_1.createAnimationsListener)(store, context.Rules));
|
|
68
|
-
api.init(store.dispatch);
|
|
69
|
-
return store;
|
|
70
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
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();
|
|
33
|
+
xhr.withCredentials = true;
|
|
34
|
+
return xhr;
|
|
35
|
+
};
|
|
36
|
+
function RemoteGameProvider(_a) {
|
|
37
|
+
var gameId = _a.gameId, children = _a.children, context = __rest(_a, ["gameId", "children"]);
|
|
38
|
+
var store = (0, react_1.useMemo)(function () { return createRemoteApiStore(gameId, context); }, []);
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(react_redux_1.Provider, { store: store, children: [(0, jsx_runtime_1.jsx)(RemoteGameLoader_1.RemoteGameLoader, { gameId: gameId, version: context.version }), children] }));
|
|
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;
|
|
55
|
+
}
|
|
71
56
|
//# 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":";;;;;;;;;;;;;;;;AAyBA,gDAUC;;AAnCD,4CAAiD;AACjD,wDAA8B;AAE9B,+BAAkD;AAClD,2CAAsC;AACtC,mDAA2D;AAC3D,+CAA2D;AAC3D,6DAA2D;AAC3D,uDAAyE;AACzE,qFAAmF;AACnF,iDAA+C;AAC/C,uDAAqD;AAErD,mBAAM,CAAC,YAAY,GAAG,IAAI,CAAA;AAE1B,mBAAM,CAAC,OAAO,CAAC,SAAS,GAAG;IACzB,IAAM,GAAG,GAAG,IAAI,cAAc,EAAU,CAAA;IACxC,GAAG,CAAC,eAAe,GAAG,IAAI,CAAA;IAC1B,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAMD,SAAgB,kBAAkB,CAChC,EAAkG;IAAhG,IAAA,MAAM,YAAA,EAAE,QAAQ,cAAA,EAAK,OAAO,cAA9B,sBAAgC,CAAF;IAE9B,IAAM,KAAK,GAAG,IAAA,eAAO,EAAC,cAAM,OAAA,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,EAArC,CAAqC,EAAE,EAAE,CAAC,CAAA;IACtE,OAAO,CACL,wBAAC,sBAAQ,IAAC,KAAK,EAAE,KAAK,aACpB,uBAAC,mCAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,EAC5D,QAAQ,IACA,CACZ,CAAA;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAc,EAAE,OAAiD;IAEjE,IAAM,GAAG,GAAG,IAAI,6BAAa,CAAiB,MAAM,CAAC,CAAA;IACrD,IAAM,OAAO,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAA;IACpC,IAAM,WAAW,GAAG,CAAC,IAAA,+BAAc,EAAuB,GAAG,CAAC,CAAC,CAAA;IAC/D,IAAI,IAAA,+BAAmB,EAAC,IAAI,OAAO,CAAC,KAAK,CAAC,EAAU,CAAC,CAAC,EAAE,CAAC;QACvD,WAAW,CAAC,OAAO,CAAC,IAAA,uDAA0B,EAAC,OAAO,CAAC,CAAC,CAAA;IAC1D,CAAC;IACD,IAAM,KAAK,GAAG,IAAA,wBAAc,EAAC,EAAE,OAAO,SAAA,EAAE,UAAU,EAAE,UAAA,oBAAoB;;YAAI,OAAA,CAAA,KAAA,oBAAoB,EAAE,CAAA,CAAC,MAAM,WAAI,WAAW;QAA5C,CAA6C,EAAE,CAAC,CAAA;IAC5H,KAAK,CAAC,SAAS,CAAC,IAAA,qCAAwB,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAC/D,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAC7B,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ApolloClient } from '@apollo/client';
|
|
2
|
-
export declare function getApolloClient(): ApolloClient<any>;
|
|
1
|
+
import { ApolloClient } from '@apollo/client';
|
|
2
|
+
export declare function getApolloClient(): ApolloClient<any>;
|