@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.
Files changed (258) hide show
  1. package/dist/Actions/ActionFailed.js +3 -7
  2. package/dist/Actions/ActionFailed.js.map +1 -1
  3. package/dist/Actions/AnimationComplete.js +3 -7
  4. package/dist/Actions/AnimationComplete.js.map +1 -1
  5. package/dist/Actions/AnimationPaused.js +3 -7
  6. package/dist/Actions/AnimationPaused.js.map +1 -1
  7. package/dist/Actions/AnimationStart.js +1 -4
  8. package/dist/Actions/AnimationStart.js.map +1 -1
  9. package/dist/Actions/ClearFailures.d.ts +1 -5
  10. package/dist/Actions/ClearFailures.js +3 -9
  11. package/dist/Actions/ClearFailures.js.map +1 -1
  12. package/dist/Actions/GameNotificationsReceived.d.ts +2 -4
  13. package/dist/Actions/GameNotificationsReceived.js +2 -9
  14. package/dist/Actions/GameNotificationsReceived.js.map +1 -1
  15. package/dist/Actions/GameOver.js +3 -7
  16. package/dist/Actions/GameOver.js.map +1 -1
  17. package/dist/Actions/GameStateLoaded.js +5 -18
  18. package/dist/Actions/GameStateLoaded.js.map +1 -1
  19. package/dist/Actions/MovePlayed.d.ts +4 -4
  20. package/dist/Actions/MovePlayed.js +3 -4
  21. package/dist/Actions/MovePlayed.js.map +1 -1
  22. package/dist/Actions/MoveUndone.js +3 -8
  23. package/dist/Actions/MoveUndone.js.map +1 -1
  24. package/dist/Actions/PlayerQuit.d.ts +3 -9
  25. package/dist/Actions/PlayerQuit.js +2 -19
  26. package/dist/Actions/PlayerQuit.js.map +1 -1
  27. package/dist/Actions/SetAnimationsSpeed.d.ts +1 -6
  28. package/dist/Actions/SetAnimationsSpeed.js +3 -9
  29. package/dist/Actions/SetAnimationsSpeed.js.map +1 -1
  30. package/dist/Actions/giveUp.d.ts +1 -0
  31. package/dist/Actions/giveUp.js +3 -0
  32. package/dist/Actions/giveUp.js.map +1 -0
  33. package/dist/Actions/index.d.ts +7 -11
  34. package/dist/Actions/index.js +7 -27
  35. package/dist/Actions/index.js.map +1 -1
  36. package/dist/Actions/loadGameState.d.ts +14 -0
  37. package/dist/Actions/loadGameState.js +3 -0
  38. package/dist/Actions/loadGameState.js.map +1 -0
  39. package/dist/Actions/playMove.d.ts +10 -0
  40. package/dist/Actions/playMove.js +3 -0
  41. package/dist/Actions/playMove.js.map +1 -0
  42. package/dist/Actions/receiveNotifications.d.ts +8 -0
  43. package/dist/Actions/receiveNotifications.js +3 -0
  44. package/dist/Actions/receiveNotifications.js.map +1 -0
  45. package/dist/Actions/removePlayer.d.ts +5 -0
  46. package/dist/Actions/removePlayer.js +3 -0
  47. package/dist/Actions/removePlayer.js.map +1 -0
  48. package/dist/Actions/reportFailure.d.ts +1 -0
  49. package/dist/Actions/reportFailure.js +3 -0
  50. package/dist/Actions/reportFailure.js.map +1 -0
  51. package/dist/Actions/setGameOver.d.ts +2 -0
  52. package/dist/Actions/setGameOver.js +3 -0
  53. package/dist/Actions/setGameOver.js.map +1 -0
  54. package/dist/Actions/startAnimation.d.ts +1 -0
  55. package/dist/Actions/startAnimation.js +3 -0
  56. package/dist/Actions/startAnimation.js.map +1 -0
  57. package/dist/Actions/undoMove.d.ts +5 -0
  58. package/dist/Actions/undoMove.js +4 -0
  59. package/dist/Actions/undoMove.js.map +1 -0
  60. package/dist/Chat/ChatChannel.js +1 -2
  61. package/dist/Chat/Message.js +1 -2
  62. package/dist/Chat/index.js +2 -18
  63. package/dist/Chat/index.js.map +1 -1
  64. package/dist/Deckbuilding/Deck.js +1 -2
  65. package/dist/Deckbuilding/index.js +4 -24
  66. package/dist/Deckbuilding/index.js.map +1 -1
  67. package/dist/Deckbuilding/useDeleteDeck.d.ts +4 -1
  68. package/dist/Deckbuilding/useDeleteDeck.js +8 -14
  69. package/dist/Deckbuilding/useDeleteDeck.js.map +1 -1
  70. package/dist/Deckbuilding/useMyDecks.d.ts +2 -1
  71. package/dist/Deckbuilding/useMyDecks.js +7 -13
  72. package/dist/Deckbuilding/useMyDecks.js.map +1 -1
  73. package/dist/Deckbuilding/useSaveDeck.d.ts +4 -1
  74. package/dist/Deckbuilding/useSaveDeck.js +8 -14
  75. package/dist/Deckbuilding/useSaveDeck.js.map +1 -1
  76. package/dist/EjectPlayer/EjectPlayer.d.ts +1 -6
  77. package/dist/EjectPlayer/EjectPlayer.js +2 -8
  78. package/dist/EjectPlayer/EjectPlayer.js.map +1 -1
  79. package/dist/EjectPlayer/index.js +1 -17
  80. package/dist/EjectPlayer/index.js.map +1 -1
  81. package/dist/Failure/Failure.js +1 -4
  82. package/dist/Failure/Failure.js.map +1 -1
  83. package/dist/Failure/index.js +1 -17
  84. package/dist/Failure/index.js.map +1 -1
  85. package/dist/GiveUp/GiveUp.js +2 -5
  86. package/dist/GiveUp/GiveUp.js.map +1 -1
  87. package/dist/GiveUp/index.js +1 -17
  88. package/dist/GiveUp/index.js.map +1 -1
  89. package/dist/Hooks/index.js +5 -21
  90. package/dist/Hooks/index.js.map +1 -1
  91. package/dist/Hooks/useChatMessages.d.ts +1 -6
  92. package/dist/Hooks/useChatMessages.js +35 -44
  93. package/dist/Hooks/useChatMessages.js.map +1 -1
  94. package/dist/Hooks/useMessageAuthor.js +12 -16
  95. package/dist/Hooks/useMessageAuthor.js.map +1 -1
  96. package/dist/Hooks/useOptions.js +3 -6
  97. package/dist/Hooks/useOptions.js.map +1 -1
  98. package/dist/Hooks/useRematch.d.ts +1 -1
  99. package/dist/Hooks/useRematch.js +16 -20
  100. package/dist/Hooks/useRematch.js.map +1 -1
  101. package/dist/Hooks/useSendMessage.d.ts +4 -1
  102. package/dist/Hooks/useSendMessage.js +5 -12
  103. package/dist/Hooks/useSendMessage.js.map +1 -1
  104. package/dist/Log/StartLiveLog.d.ts +1 -4
  105. package/dist/Log/StartLiveLog.js +3 -5
  106. package/dist/Log/StartLiveLog.js.map +1 -1
  107. package/dist/Log/StopLiveLog.d.ts +1 -4
  108. package/dist/Log/StopLiveLog.js +4 -7
  109. package/dist/Log/StopLiveLog.js.map +1 -1
  110. package/dist/Log/index.d.ts +2 -2
  111. package/dist/Log/index.js +4 -20
  112. package/dist/Log/index.js.map +1 -1
  113. package/dist/Log/useLogControls.js +11 -14
  114. package/dist/Log/useLogControls.js.map +1 -1
  115. package/dist/PlayerTime/PlayerTime.js +1 -2
  116. package/dist/PlayerTime/index.js +1 -17
  117. package/dist/PlayerTime/index.js.map +1 -1
  118. package/dist/Rematch/RematchQueries.js +23 -13
  119. package/dist/Rematch/RematchQueries.js.map +1 -1
  120. package/dist/Rematch/index.js +1 -17
  121. package/dist/Rematch/index.js.map +1 -1
  122. package/dist/Sound/MuteSounds.d.ts +1 -4
  123. package/dist/Sound/MuteSounds.js +5 -8
  124. package/dist/Sound/MuteSounds.js.map +1 -1
  125. package/dist/Sound/UnmuteSounds.d.ts +1 -4
  126. package/dist/Sound/UnmuteSounds.js +3 -5
  127. package/dist/Sound/UnmuteSounds.js.map +1 -1
  128. package/dist/Sound/index.d.ts +2 -2
  129. package/dist/Sound/index.js +3 -19
  130. package/dist/Sound/index.js.map +1 -1
  131. package/dist/Sound/useSoundControls.js +11 -14
  132. package/dist/Sound/useSoundControls.js.map +1 -1
  133. package/dist/Store/DisplayedAction.js +4 -10
  134. package/dist/Store/DisplayedAction.js.map +1 -1
  135. package/dist/Store/GamePageState.d.ts +0 -1
  136. package/dist/Store/GamePageState.js +1 -2
  137. package/dist/Store/PlayedMove.js +1 -2
  138. package/dist/Store/endAnimation.d.ts +1 -0
  139. package/dist/Store/endAnimation.js +3 -0
  140. package/dist/Store/endAnimation.js.map +1 -0
  141. package/dist/Store/gameMiddleware.js +30 -41
  142. package/dist/Store/gameMiddleware.js.map +1 -1
  143. package/dist/Store/gameReducer.d.ts +2 -11
  144. package/dist/Store/gameReducer.js +301 -377
  145. package/dist/Store/gameReducer.js.map +1 -1
  146. package/dist/Store/index.d.ts +1 -0
  147. package/dist/Store/index.js +4 -19
  148. package/dist/Store/index.js.map +1 -1
  149. package/dist/Store/localMovePreviewMiddleware.js +15 -13
  150. package/dist/Store/localMovePreviewMiddleware.js.map +1 -1
  151. package/dist/Store/store.d.ts +13 -0
  152. package/dist/Store/store.js +27 -0
  153. package/dist/Store/store.js.map +1 -0
  154. package/dist/Tutorial/PlayTutorialMoves.d.ts +1 -9
  155. package/dist/Tutorial/PlayTutorialMoves.js +2 -6
  156. package/dist/Tutorial/PlayTutorialMoves.js.map +1 -1
  157. package/dist/Tutorial/Tutorial.js +1 -2
  158. package/dist/Tutorial/TutorialDescription.d.ts +1 -1
  159. package/dist/Tutorial/TutorialDescription.js +1 -2
  160. package/dist/Tutorial/index.js +4 -20
  161. package/dist/Tutorial/index.js.map +1 -1
  162. package/dist/Tutorial/useTutorial.js +11 -20
  163. package/dist/Tutorial/useTutorial.js.map +1 -1
  164. package/dist/Types/GameAI.js +1 -2
  165. package/dist/Types/GameData.js +1 -2
  166. package/dist/Types/GameMessage.js +1 -2
  167. package/dist/Types/GameMode.js +2 -5
  168. package/dist/Types/GameMode.js.map +1 -1
  169. package/dist/Types/GameNotification.js +1 -2
  170. package/dist/Types/GameOptions.js +2 -5
  171. package/dist/Types/GameOptions.js.map +1 -1
  172. package/dist/Types/MovePlayedNotification.d.ts +1 -1
  173. package/dist/Types/MovePlayedNotification.js +3 -8
  174. package/dist/Types/MovePlayedNotification.js.map +1 -1
  175. package/dist/Types/MoveUndoneNotification.d.ts +1 -1
  176. package/dist/Types/MoveUndoneNotification.js +3 -8
  177. package/dist/Types/MoveUndoneNotification.js.map +1 -1
  178. package/dist/Types/Player.js +1 -2
  179. package/dist/Types/PlayerQuitReason.js +2 -5
  180. package/dist/Types/PlayerQuitReason.js.map +1 -1
  181. package/dist/Types/ProxyGameData.js +1 -2
  182. package/dist/Types/Tournament.js +1 -2
  183. package/dist/Types/index.js +12 -28
  184. package/dist/Types/index.js.map +1 -1
  185. package/dist/User/User.js +1 -2
  186. package/dist/User/index.js +2 -18
  187. package/dist/User/index.js.map +1 -1
  188. package/dist/User/useMe.js +9 -19
  189. package/dist/User/useMe.js.map +1 -1
  190. package/dist/animations/Animation.js +1 -2
  191. package/dist/animations/AnimationContext.d.ts +1 -1
  192. package/dist/animations/AnimationContext.js +1 -2
  193. package/dist/animations/AnimationState.js +1 -2
  194. package/dist/animations/AnimationStep.js +2 -5
  195. package/dist/animations/AnimationStep.js.map +1 -1
  196. package/dist/animations/Animations.js +9 -16
  197. package/dist/animations/Animations.js.map +1 -1
  198. package/dist/animations/AnimationsListener.d.ts +6 -0
  199. package/dist/animations/AnimationsListener.js +54 -0
  200. package/dist/animations/AnimationsListener.js.map +1 -0
  201. package/dist/animations/AnimationsListenerCreator.d.ts +1 -4
  202. package/dist/animations/AnimationsListenerCreator.js +24 -30
  203. package/dist/animations/AnimationsListenerCreator.js.map +1 -1
  204. package/dist/animations/animationMiddleware.d.ts +4 -0
  205. package/dist/animations/animationMiddleware.js +50 -0
  206. package/dist/animations/animationMiddleware.js.map +1 -0
  207. package/dist/animations/index.d.ts +0 -1
  208. package/dist/animations/index.js +5 -22
  209. package/dist/animations/index.js.map +1 -1
  210. package/dist/api/Client/GameClientAPI.d.ts +5 -6
  211. package/dist/api/Client/GameClientAPI.js +70 -119
  212. package/dist/api/Client/GameClientAPI.js.map +1 -1
  213. package/dist/api/Client/GameNotificationsListener.js +51 -104
  214. package/dist/api/Client/GameNotificationsListener.js.map +1 -1
  215. package/dist/api/Client/RemoteGameLoader.js +50 -45
  216. package/dist/api/Client/RemoteGameLoader.js.map +1 -1
  217. package/dist/api/Client/RemoteGameProvider.js +15 -51
  218. package/dist/api/Client/RemoteGameProvider.js.map +1 -1
  219. package/dist/api/Client/apollo-client.d.ts +1 -1
  220. package/dist/api/Client/apollo-client.js +14 -31
  221. package/dist/api/Client/apollo-client.js.map +1 -1
  222. package/dist/api/Client/index.js +4 -20
  223. package/dist/api/Client/index.js.map +1 -1
  224. package/dist/api/Client/pusher.js +5 -12
  225. package/dist/api/Client/pusher.js.map +1 -1
  226. package/dist/api/GameAPI.d.ts +2 -3
  227. package/dist/api/GameAPI.js +1 -2
  228. package/dist/api/Local/ConsoleTools.d.ts +1 -2
  229. package/dist/api/Local/ConsoleTools.js +15 -22
  230. package/dist/api/Local/ConsoleTools.js.map +1 -1
  231. package/dist/api/Local/GameLocalAPI.d.ts +4 -5
  232. package/dist/api/Local/GameLocalAPI.js +264 -363
  233. package/dist/api/Local/GameLocalAPI.js.map +1 -1
  234. package/dist/api/Local/LocalGameProvider.d.ts +1 -1
  235. package/dist/api/Local/LocalGameProvider.js +17 -48
  236. package/dist/api/Local/LocalGameProvider.js.map +1 -1
  237. package/dist/api/Local/index.js +1 -17
  238. package/dist/api/Local/index.js.map +1 -1
  239. package/dist/api/index.js +2 -18
  240. package/dist/api/index.js.map +1 -1
  241. package/dist/index.d.ts +0 -2
  242. package/dist/index.js +16 -36
  243. package/dist/index.js.map +1 -1
  244. package/dist/util/ArrayUtil.js +4 -8
  245. package/dist/util/ArrayUtil.js.map +1 -1
  246. package/package.json +66 -62
  247. package/dist/Actions/ActionType.d.ts +0 -3
  248. package/dist/Actions/ActionType.js +0 -8
  249. package/dist/Actions/ActionType.js.map +0 -1
  250. package/dist/Scoring/ScoringDescription.d.ts +0 -8
  251. package/dist/Scoring/ScoringDescription.js +0 -3
  252. package/dist/Scoring/ScoringDescription.js.map +0 -1
  253. package/dist/Scoring/index.d.ts +0 -1
  254. package/dist/Scoring/index.js +0 -18
  255. package/dist/Scoring/index.js.map +0 -1
  256. package/dist/util/TimeUtil.d.ts +0 -2
  257. package/dist/util/TimeUtil.js +0 -27
  258. package/dist/util/TimeUtil.js.map +0 -1
@@ -1,79 +1,41 @@
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.GameClientAPI = exports.GET_MESSAGE_AUTHOR = exports.NOTIFICATIONS = exports.PLAYERS_TIME = exports.AVATAR_INFO = void 0;
44
- var client_1 = require("@apollo/client");
45
- var Actions_1 = require("../../Actions");
46
- var Failure_1 = require("../../Failure");
47
- var apollo_client_1 = require("./apollo-client");
48
- exports.AVATAR_INFO = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["fragment AvatarInfo on Avataaar {accessoriesType clotheColor clotheType eyeType eyebrowType facialHairType facialHairColor graphicType hairColor mouthType skinColor topType}"], ["fragment AvatarInfo on Avataaar {accessoriesType clotheColor clotheType eyeType eyebrowType facialHairType facialHairColor graphicType hairColor mouthType skinColor topType}"])));
49
- exports.PLAYERS_TIME = (0, client_1.gql)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["fragment PlayerTime on Player { time { availableTime cumulatedDownTime cumulatedPlayTime cumulatedWaitForMeTime highestDownTime highestPlayTime lastChange playing weightedWaitForMeTime } }"], ["fragment PlayerTime on Player { time { availableTime cumulatedDownTime cumulatedPlayTime cumulatedWaitForMeTime highestDownTime highestPlayTime lastChange playing weightedWaitForMeTime } }"])));
50
- exports.NOTIFICATIONS = (0, client_1.gql)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["fragment Notifications on GameNotification { playerId ... on MovePlayedNotification { actionId moveView consequences } ... on MoveUndoneNotification { actionId moveUndone } }"], ["fragment Notifications on GameNotification { playerId ... on MovePlayedNotification { actionId moveView consequences } ... on MoveUndoneNotification { actionId moveUndone } }"])));
51
- var PLAY = (0, client_1.gql)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["mutation PlayMoves($gameId: String!, $moves: [JSON!]!) { playMoves(gameId: $gameId, moves: $moves) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""], ["mutation PlayMoves($gameId: String!, $moves: [JSON!]!) { playMoves(gameId: $gameId, moves: $moves) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""])), exports.NOTIFICATIONS, exports.PLAYERS_TIME);
52
- var UNDO = (0, client_1.gql)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["mutation UndoMoves($gameId: String!, $actions: [String!]!) { undoMoves(gameId: $gameId, actions: $actions) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""], ["mutation UndoMoves($gameId: String!, $actions: [String!]!) { undoMoves(gameId: $gameId, actions: $actions) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""])), exports.NOTIFICATIONS, exports.PLAYERS_TIME);
53
- var EJECT_PLAYER = (0, client_1.gql)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["mutation EjectPlayer($gameId: String!, $playerId: JSON!) { ejectPlayer(gameId: $gameId, playerId: $playerId) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""], ["mutation EjectPlayer($gameId: String!, $playerId: JSON!) { ejectPlayer(gameId: $gameId, playerId: $playerId) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""])), exports.NOTIFICATIONS, exports.PLAYERS_TIME);
54
- var GIVE_UP = (0, client_1.gql)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["mutation GiveUp($gameId: String!) { giveUp(gameId: $gameId) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""], ["mutation GiveUp($gameId: String!) { giveUp(gameId: $gameId) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ", " ", ""])), exports.NOTIFICATIONS, exports.PLAYERS_TIME);
55
- var CLAIM_VICTORY = (0, client_1.gql)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["mutation ClaimVictory($gameId: String!) { claimVictory(gameId: $gameId) { id endDate } }"], ["mutation ClaimVictory($gameId: String!) { claimVictory(gameId: $gameId) { id endDate } }"])));
56
- exports.GET_MESSAGE_AUTHOR = (0, client_1.gql)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n query GetMessageAuthor($id: String!) {\n user(id: $id) {\n id name avatar {...AvatarInfo}\n }\n } ", "\n"], ["\n query GetMessageAuthor($id: String!) {\n user(id: $id) {\n id name avatar {...AvatarInfo}\n }\n } ", "\n"])), exports.AVATAR_INFO);
57
- var GameClientAPI = (function () {
58
- function GameClientAPI(gameId) {
59
- this.pendingActions = [];
1
+ import { CombinedGraphQLErrors, gql } from '@apollo/client';
2
+ import { receiveNotifications } from '../../Actions';
3
+ import { reportFailure } from '../../Actions/reportFailure';
4
+ import { Failure } from '../../Failure';
5
+ import { getApolloClient } from './apollo-client';
6
+ export const PLATFORM_URI = process.env.PLATFORM_URI ?? 'https://game-park.com';
7
+ export const AVATAR_INFO = gql `fragment AvatarInfo on Avataaar {accessoriesType clotheColor clotheType eyeType eyebrowType facialHairType facialHairColor graphicType hairColor mouthType skinColor topType}`;
8
+ export const PLAYERS_TIME = gql `fragment PlayerTime on Player { time { availableTime cumulatedDownTime cumulatedPlayTime cumulatedWaitForMeTime highestDownTime highestPlayTime lastChange playing weightedWaitForMeTime } }`;
9
+ export const NOTIFICATIONS = gql `fragment Notifications on GameNotification { playerId ... on MovePlayedNotification { actionId moveView consequences } ... on MoveUndoneNotification { actionId moveUndone } }`;
10
+ const PLAY = gql `mutation PlayMoves($gameId: String!, $moves: [JSON!]!) { playMoves(gameId: $gameId, moves: $moves) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ${NOTIFICATIONS} ${PLAYERS_TIME}`;
11
+ const UNDO = gql `mutation UndoMoves($gameId: String!, $actions: [String!]!) { undoMoves(gameId: $gameId, actions: $actions) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ${NOTIFICATIONS} ${PLAYERS_TIME}`;
12
+ const EJECT_PLAYER = gql `mutation EjectPlayer($gameId: String!, $playerId: JSON!) { ejectPlayer(gameId: $gameId, playerId: $playerId) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ${NOTIFICATIONS} ${PLAYERS_TIME}`;
13
+ const GIVE_UP = gql `mutation GiveUp($gameId: String!) { giveUp(gameId: $gameId) { notifications { ...Notifications } index players { id ...PlayerTime } date } } ${NOTIFICATIONS} ${PLAYERS_TIME}`;
14
+ const CLAIM_VICTORY = gql `mutation ClaimVictory($gameId: String!) { claimVictory(gameId: $gameId) { id endDate } }`;
15
+ export const GET_MESSAGE_AUTHOR = gql `
16
+ query GetMessageAuthor($id: String!) {
17
+ user(id: $id) {
18
+ id name avatar {...AvatarInfo}
19
+ }
20
+ } ${AVATAR_INFO}
21
+ `;
22
+ export class GameClientAPI {
23
+ dispatch;
24
+ gameId;
25
+ ongoingAction;
26
+ pendingActions = [];
27
+ constructor(gameId) {
60
28
  this.gameId = gameId;
61
29
  }
62
- GameClientAPI.prototype.init = function (dispatch) {
63
- return __awaiter(this, void 0, void 0, function () {
64
- return __generator(this, function (_a) {
65
- this.dispatch = dispatch;
66
- return [2];
67
- });
68
- });
69
- };
70
- GameClientAPI.prototype.play = function (move) {
71
- var _this = this;
30
+ async init(dispatch) {
31
+ this.dispatch = dispatch;
32
+ }
33
+ play(move) {
72
34
  if (this.pendingActions.length === 0) {
73
35
  this.pendingActions.push({ type: 'PLAY', moves: [move] });
74
36
  }
75
37
  else {
76
- var lastPendingAction = this.pendingActions[this.pendingActions.length - 1];
38
+ const lastPendingAction = this.pendingActions[this.pendingActions.length - 1];
77
39
  if (lastPendingAction.type === 'PLAY') {
78
40
  lastPendingAction.moves.push(move);
79
41
  }
@@ -82,17 +44,17 @@ var GameClientAPI = (function () {
82
44
  }
83
45
  }
84
46
  if (!this.ongoingAction) {
85
- this.ongoingAction = new Promise(function (resolve) { return setTimeout(resolve, 50); }).then(function () { return _this.executePendingActions(); });
47
+ this.ongoingAction = new Promise(resolve => setTimeout(resolve, 50)).then(() => this.executePendingActions());
86
48
  }
87
- };
88
- GameClientAPI.prototype.undo = function (action) {
49
+ }
50
+ undo(action) {
89
51
  if (typeof action === 'number')
90
52
  return console.error('GameClientAPI can no longer undo without an action ID');
91
53
  if (this.pendingActions.length === 0) {
92
54
  this.pendingActions.push({ type: 'UNDO', actions: [action] });
93
55
  }
94
56
  else {
95
- var lastPendingAction = this.pendingActions[this.pendingActions.length - 1];
57
+ const lastPendingAction = this.pendingActions[this.pendingActions.length - 1];
96
58
  if (lastPendingAction.type === 'UNDO') {
97
59
  lastPendingAction.actions.push(action);
98
60
  }
@@ -103,65 +65,54 @@ var GameClientAPI = (function () {
103
65
  if (!this.ongoingAction) {
104
66
  this.executePendingActions();
105
67
  }
106
- };
107
- GameClientAPI.prototype.executePendingActions = function () {
108
- var _this = this;
68
+ }
69
+ executePendingActions() {
109
70
  if (this.pendingActions.length > 0) {
110
- var pendingAction = this.pendingActions.shift();
71
+ const pendingAction = this.pendingActions.shift();
111
72
  if (pendingAction.type == 'PLAY') {
112
- this.ongoingAction = (0, apollo_client_1.getApolloClient)().mutate({
73
+ this.ongoingAction = getApolloClient().mutate({
113
74
  mutation: PLAY, variables: { gameId: this.gameId, moves: pendingAction.moves }
114
- }).then(function (result) { return result.data && _this.handleGameMessageResult(result.data.playMoves); });
75
+ }).then(result => result.data && this.handleGameMessageResult(result.data.playMoves));
115
76
  }
116
77
  else if (pendingAction.type === 'UNDO') {
117
- this.ongoingAction = (0, apollo_client_1.getApolloClient)().mutate({
78
+ this.ongoingAction = getApolloClient().mutate({
118
79
  mutation: UNDO, variables: { gameId: this.gameId, actions: pendingAction.actions }
119
- }).then(function (result) { return result.data && _this.handleGameMessageResult(result.data.undoMoves); });
80
+ }).then(result => result.data && this.handleGameMessageResult(result.data.undoMoves));
120
81
  }
121
82
  if (this.ongoingAction) {
122
- this.ongoingAction = this.ongoingAction.catch(function (error) { return _this.onError(error); }).finally(function () { return _this.executePendingActions(); });
83
+ this.ongoingAction = this.ongoingAction.catch(error => this.onError(error)).finally(() => this.executePendingActions());
123
84
  }
124
85
  }
125
86
  else {
126
87
  delete this.ongoingAction;
127
88
  }
128
- };
129
- GameClientAPI.prototype.handleGameMessageResult = function (_a) {
130
- var date = _a.date, index = _a.index, notifications = _a.notifications, players = _a.players;
131
- this.dispatch((0, Actions_1.gameNotificationsReceived)(notifications, index, players, Date.parse(date)));
132
- };
133
- GameClientAPI.prototype.eject = function (playerId) {
134
- var _this = this;
135
- (0, apollo_client_1.getApolloClient)().mutate({ mutation: EJECT_PLAYER, variables: { gameId: this.gameId, playerId: playerId } })
136
- .then(function (result) { return result.data && _this.handleGameMessageResult(result.data.ejectPlayer); });
137
- };
138
- GameClientAPI.prototype.giveUp = function () {
139
- var _this = this;
140
- (0, apollo_client_1.getApolloClient)().mutate({ mutation: GIVE_UP, variables: { gameId: this.gameId } })
141
- .then(function (result) { return result.data && _this.handleGameMessageResult(result.data.giveUp); });
142
- };
143
- GameClientAPI.prototype.onError = function (_a) {
144
- var _this = this;
145
- var graphQLErrors = _a.graphQLErrors, networkError = _a.networkError;
146
- if (graphQLErrors) {
147
- graphQLErrors.map(function (_a) {
148
- var message = _a.message;
149
- return _this.dispatch((0, Actions_1.actionFailed)(message));
150
- });
89
+ }
90
+ handleGameMessageResult({ date, index, notifications, players }) {
91
+ this.dispatch(receiveNotifications({ notifications, notificationsIndex: index, players, serverTime: Date.parse(date) }));
92
+ }
93
+ eject(playerId) {
94
+ getApolloClient().mutate({ mutation: EJECT_PLAYER, variables: { gameId: this.gameId, playerId } })
95
+ .then(result => result.data && this.handleGameMessageResult(result.data.ejectPlayer));
96
+ }
97
+ giveUp() {
98
+ getApolloClient().mutate({ mutation: GIVE_UP, variables: { gameId: this.gameId } })
99
+ .then(result => result.data && this.handleGameMessageResult(result.data.giveUp));
100
+ }
101
+ onError(error) {
102
+ if (CombinedGraphQLErrors.is(error)) {
103
+ for (const graphqlFormattedError of error.errors) {
104
+ this.dispatch(reportFailure(graphqlFormattedError.message));
105
+ }
151
106
  }
152
- if (networkError) {
153
- console.error(networkError);
154
- this.dispatch((0, Actions_1.actionFailed)(Failure_1.Failure.NETWORK));
107
+ else {
108
+ this.dispatch(reportFailure(Failure.NETWORK));
155
109
  }
156
- };
157
- GameClientAPI.prototype.playTutorialMoves = function () {
110
+ }
111
+ playTutorialMoves() {
158
112
  console.error('Tutorial should only be played with local API');
159
- };
160
- GameClientAPI.prototype.claimVictory = function () {
161
- return (0, apollo_client_1.getApolloClient)().mutate({ mutation: CLAIM_VICTORY, variables: { gameId: this.gameId } });
162
- };
163
- return GameClientAPI;
164
- }());
165
- exports.GameClientAPI = GameClientAPI;
166
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
113
+ }
114
+ claimVictory() {
115
+ return getApolloClient().mutate({ mutation: CLAIM_VICTORY, variables: { gameId: this.gameId } });
116
+ }
117
+ }
167
118
  //# sourceMappingURL=GameClientAPI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GameClientAPI.js","sourceRoot":"","sources":["../../../src/api/Client/GameClientAPI.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiD;AAEjD,yCAAuE;AACvE,yCAAuC;AAIvC,iDAAiD;AAEpC,QAAA,WAAW,OAAG,YAAG,mPAAA,+KAA+K,KAAA;AAChM,QAAA,YAAY,OAAG,YAAG,kQAAA,8LAA8L,KAAA;AAChN,QAAA,aAAa,OAAG,YAAG,oPAAA,gLAAgL,KAAA;AAChN,IAAM,IAAI,OAAG,YAAG,mQAAA,sLAAuL,EAAa,GAAI,EAAY,EAAE,KAA/B,qBAAa,EAAI,oBAAY,CAAE,CAAA;AACtO,IAAM,IAAI,OAAG,YAAG,2QAAA,8LAA+L,EAAa,GAAI,EAAY,EAAE,KAA/B,qBAAa,EAAI,oBAAY,CAAE,CAAA;AAC9O,IAAM,YAAY,OAAG,YAAG,6QAAA,gMAAiM,EAAa,GAAI,EAAY,EAAE,KAA/B,qBAAa,EAAI,oBAAY,CAAE,CAAA;AACxP,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ED,YAAY;QACV,OAAO,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAClG,CAAC;CACF"}
@@ -1,117 +1,64 @@
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;
1
+ import { gql } from '@apollo/client';
2
+ import { useApolloClient } from '@apollo/client/react';
3
+ import { useEffect, useRef } from 'react';
4
+ import { receiveNotifications, setGameOver } from '../../Actions';
5
+ import { removePlayer } from '../../Actions/removePlayer';
6
+ import { useGameDispatch } from '../../Store';
7
+ import { NOTIFICATIONS, PLAYERS_TIME } from './GameClientAPI';
8
+ import { pusherClient } from './pusher';
9
+ const GET_NOTIFICATIONS = gql `
10
+ query GameNotifications($gameId: String!, $start: Int) {
11
+ time
12
+ gameNotifications(gameId: $gameId, start: $start) { ...Notifications }
13
+ game(id: $gameId) {
14
+ id players { id ...PlayerTime }
15
+ }
16
+ } ${NOTIFICATIONS} ${PLAYERS_TIME}
17
+ `;
18
+ export function GameNotificationsListener({ gameId, channelName, notificationsCount }) {
19
+ const client = useApolloClient();
20
+ const dispatch = useGameDispatch();
21
+ const notificationsCountRef = useRef(notificationsCount);
22
+ const getNotifications = async (start) => {
23
+ const { data } = await client.query({
24
+ query: GET_NOTIFICATIONS,
25
+ variables: { gameId, start }
26
+ });
27
+ if (!data)
28
+ return console.error('Failed to collect game data');
29
+ dispatch(receiveNotifications({ notifications: data.gameNotifications, notificationsIndex: start, players: data.game.players, serverTime: data.time }));
30
+ if (data.gameNotifications.length > 0) {
31
+ notificationsCountRef.current = Math.max(notificationsCountRef.current, start + data.gameNotifications.length);
32
+ }
33
+ };
34
+ useEffect(() => {
35
+ const channel = pusherClient.subscribe(channelName);
36
+ channel.bind('pusher:subscription_error', (error) => console.error('pusher subscription failed', error));
37
+ channel.bind('pusher:subscription_succeeded', () => getNotifications(notificationsCountRef.current));
38
+ channel.bind('moves-played', async (message) => {
39
+ if (!message)
40
+ return;
41
+ const { index, notifications, players, date } = message;
42
+ dispatch(receiveNotifications({ notifications, notificationsIndex: index, players, serverTime: Date.parse(date) }));
43
+ if (notifications.length) {
44
+ notificationsCountRef.current = Math.max(notificationsCountRef.current, index + notifications.length);
36
45
  }
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];
46
+ else {
47
+ await getNotifications(index);
75
48
  }
76
49
  });
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) {
50
+ channel.bind('game-over', (players) => {
103
51
  if (players) {
104
- dispatch((0, Actions_1.gameOver)(players));
52
+ dispatch(setGameOver(players));
105
53
  }
106
54
  });
107
- channel.bind('player-quit', function (data) {
55
+ channel.bind('player-quit', (data) => {
108
56
  if (data) {
109
- dispatch((0, PlayerQuit_1.playerQuit)(data));
57
+ dispatch(removePlayer(data));
110
58
  }
111
59
  });
112
- return function () { return pusher_1.pusherClient.unsubscribe(channelName); };
60
+ return () => pusherClient.unsubscribe(channelName);
113
61
  }, []);
114
62
  return null;
115
63
  }
116
- var templateObject_1;
117
64
  //# sourceMappingURL=GameNotificationsListener.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GameNotificationsListener.js","sourceRoot":"","sources":["../../../src/api/Client/GameNotificationsListener.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,8DAmDC;AAtED,yCAAqD;AACrD,+BAAyC;AACzC,2CAAyC;AACzC,yCAAmE;AACnE,uDAAqD;AAErD,iDAA6D;AAC7D,mCAAuC;AAEvC,IAAM,iBAAiB,OAAG,YAAG,gTAAA,iOAOvB,EAAa,GAAI,EAAY,IAClC,KADK,6BAAa,EAAI,4BAAY,CAClC,CAAA;AAED,SAAgB,yBAAyB,CAAC,EAAgH;IAA1J,iBAmDC;QAnD2C,MAAM,YAAA,EAAE,WAAW,iBAAA,EAAE,kBAAkB,wBAAA;IACjF,IAAM,MAAM,GAAG,IAAA,wBAAe,GAAE,CAAA;IAChC,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAO,CAAA;IACnC,IAAM,qBAAqB,GAAG,IAAA,cAAM,EAAC,kBAAkB,CAAC,CAAA;IAExD,IAAM,gBAAgB,GAAG,UAAO,KAAa;;;;wBAC1B,WAAM,MAAM,CAAC,KAAK,CAA0E;wBAC3G,KAAK,EAAE,iBAAiB;wBACxB,SAAS,EAAE,EAAE,MAAM,QAAA,EAAE,KAAK,OAAA,EAAE;qBAC7B,CAAC,EAAA;;oBAHM,IAAI,GAAK,CAAA,SAGf,CAAA,KAHU;oBAIZ,IAAI,CAAC,IAAI;wBAAE,WAAO,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,EAAA;oBAC9D,QAAS,CAAC,IAAA,mCAAyB,EAAC,IAA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AC"}
@@ -1,54 +1,60 @@
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 () {
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { gql } from '@apollo/client';
3
+ import { useLazyQuery } from '@apollo/client/react';
4
+ import { useEffect, useState } from 'react';
5
+ import { loadGameState } from '../../Actions/loadGameState';
6
+ import { useGameDispatch, useGameSelector } from '../../Store';
7
+ import { AVATAR_INFO, NOTIFICATIONS, PLAYERS_TIME } from './GameClientAPI';
8
+ import { GameNotificationsListener } from './GameNotificationsListener';
9
+ const GET_GAME = gql `
10
+ query Game($id: String!) {
11
+ time
12
+ gameNotifications(gameId: $id, start: 0) { ...Notifications }
13
+ game(id: $id) {
14
+ id
15
+ players {
16
+ id userId name avatar {...AvatarInfo} quit quitReason gamePointsDelta tournamentPoints ...PlayerTime
17
+ }
18
+ options {
19
+ speed maxSpareTime maxExceedTime
20
+ }
21
+ notificationsChannel mode setup state myPlayerId endDate
22
+ tournament {
23
+ number signedUp
24
+ }
25
+ version
26
+ }
27
+ } ${PLAYERS_TIME} ${AVATAR_INFO} ${NOTIFICATIONS}
28
+ `;
29
+ export function RemoteGameLoader({ gameId, version = 1 }) {
30
+ const dispatch = useGameDispatch();
31
+ const isOver = useGameSelector(state => state.gameOver);
32
+ const [isOverForLongEnough, setIsOverForLongEnough] = useState(isOver);
33
+ useEffect(() => {
34
34
  if (isOver) {
35
- setTimeout(function () { return setIsOverForLongEnough(isOver); }, 10000);
35
+ setTimeout(() => setIsOverForLongEnough(isOver), 10000);
36
36
  }
37
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) {
38
+ const [getGame, { data }] = useLazyQuery(GET_GAME);
39
+ useEffect(() => {
40
+ getGame({ variables: { id: gameId } }).then(result => {
41
41
  if (result.data) {
42
- var _a = result.data, game = _a.game, time = _a.time, gameNotifications = _a.gameNotifications;
43
- var remoteVersion = game.version;
42
+ const { game, time, gameNotifications } = result.data;
43
+ const remoteVersion = game.version;
44
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]);
45
+ const url = new URL(window.location.href);
46
+ const path = url.hostname.split('.');
47
+ url.hostname = `${path[0]}.v${remoteVersion}.${path[path.length - 2]}.${path[path.length - 1]}`;
48
48
  window.location.href = url.href;
49
49
  }
50
50
  else {
51
- dispatch((0, Actions_1.gameStateLoaded)(__assign(__assign({}, game), { notifications: gameNotifications }), time));
51
+ dispatch(loadGameState({
52
+ ...({ ...game, notifications: gameNotifications }),
53
+ playerId: { ...game, notifications: gameNotifications }.myPlayerId ?? undefined,
54
+ serverTime: time,
55
+ endDate: { ...game, notifications: gameNotifications }.endDate ?? undefined,
56
+ tournament: { ...game, notifications: gameNotifications }.tournament ?? undefined
57
+ }));
52
58
  }
53
59
  }
54
60
  });
@@ -56,7 +62,6 @@ function RemoteGameLoader(_a) {
56
62
  if (!data || data.game.endDate || isOverForLongEnough)
57
63
  return null;
58
64
  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 });
65
+ return _jsx(GameNotificationsListener, { channelName: data?.game?.notificationsChannel ?? `game=${gameId}`, gameId: gameId, notificationsCount: data.gameNotifications.length });
60
66
  }
61
- var templateObject_1;
62
67
  //# sourceMappingURL=RemoteGameLoader.js.map
@@ -1 +1 @@
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,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