@gamepark/react-client 6.38.5 → 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 (317) hide show
  1. package/dist/Actions/ActionFailed.d.ts +6 -6
  2. package/dist/Actions/ActionFailed.js +4 -8
  3. package/dist/Actions/ActionFailed.js.map +1 -1
  4. package/dist/Actions/AnimationComplete.d.ts +6 -6
  5. package/dist/Actions/AnimationComplete.js +4 -8
  6. package/dist/Actions/AnimationComplete.js.map +1 -1
  7. package/dist/Actions/AnimationPaused.d.ts +6 -6
  8. package/dist/Actions/AnimationPaused.js +4 -8
  9. package/dist/Actions/AnimationPaused.js.map +1 -1
  10. package/dist/Actions/AnimationStart.d.ts +5 -5
  11. package/dist/Actions/AnimationStart.js +1 -4
  12. package/dist/Actions/AnimationStart.js.map +1 -1
  13. package/dist/Actions/ClearFailures.d.ts +1 -5
  14. package/dist/Actions/ClearFailures.js +3 -9
  15. package/dist/Actions/ClearFailures.js.map +1 -1
  16. package/dist/Actions/GameNotificationsReceived.d.ts +8 -10
  17. package/dist/Actions/GameNotificationsReceived.js +2 -9
  18. package/dist/Actions/GameNotificationsReceived.js.map +1 -1
  19. package/dist/Actions/GameOver.d.ts +16 -16
  20. package/dist/Actions/GameOver.js +4 -8
  21. package/dist/Actions/GameOver.js.map +1 -1
  22. package/dist/Actions/GameStateLoaded.d.ts +16 -16
  23. package/dist/Actions/GameStateLoaded.js +7 -20
  24. package/dist/Actions/GameStateLoaded.js.map +1 -1
  25. package/dist/Actions/MovePlayed.d.ts +11 -11
  26. package/dist/Actions/MovePlayed.js +3 -2
  27. package/dist/Actions/MovePlayed.js.map +1 -1
  28. package/dist/Actions/MoveUndone.d.ts +7 -7
  29. package/dist/Actions/MoveUndone.js +4 -9
  30. package/dist/Actions/MoveUndone.js.map +1 -1
  31. package/dist/Actions/PlayerQuit.d.ts +5 -11
  32. package/dist/Actions/PlayerQuit.js +2 -19
  33. package/dist/Actions/PlayerQuit.js.map +1 -1
  34. package/dist/Actions/SetAnimationsSpeed.d.ts +1 -6
  35. package/dist/Actions/SetAnimationsSpeed.js +3 -9
  36. package/dist/Actions/SetAnimationsSpeed.js.map +1 -1
  37. package/dist/Actions/giveUp.d.ts +1 -0
  38. package/dist/Actions/giveUp.js +3 -0
  39. package/dist/Actions/giveUp.js.map +1 -0
  40. package/dist/Actions/index.d.ts +7 -12
  41. package/dist/Actions/index.js +7 -28
  42. package/dist/Actions/index.js.map +1 -1
  43. package/dist/Actions/loadGameState.d.ts +14 -0
  44. package/dist/Actions/loadGameState.js +3 -0
  45. package/dist/Actions/loadGameState.js.map +1 -0
  46. package/dist/Actions/playMove.d.ts +10 -0
  47. package/dist/Actions/playMove.js +3 -0
  48. package/dist/Actions/playMove.js.map +1 -0
  49. package/dist/Actions/receiveNotifications.d.ts +8 -0
  50. package/dist/Actions/receiveNotifications.js +3 -0
  51. package/dist/Actions/receiveNotifications.js.map +1 -0
  52. package/dist/Actions/removePlayer.d.ts +5 -0
  53. package/dist/Actions/removePlayer.js +3 -0
  54. package/dist/Actions/removePlayer.js.map +1 -0
  55. package/dist/Actions/reportFailure.d.ts +1 -0
  56. package/dist/Actions/reportFailure.js +3 -0
  57. package/dist/Actions/reportFailure.js.map +1 -0
  58. package/dist/Actions/setGameOver.d.ts +2 -0
  59. package/dist/Actions/setGameOver.js +3 -0
  60. package/dist/Actions/setGameOver.js.map +1 -0
  61. package/dist/Actions/startAnimation.d.ts +1 -0
  62. package/dist/Actions/startAnimation.js +3 -0
  63. package/dist/Actions/startAnimation.js.map +1 -0
  64. package/dist/Actions/undoMove.d.ts +5 -0
  65. package/dist/Actions/undoMove.js +4 -0
  66. package/dist/Actions/undoMove.js.map +1 -0
  67. package/dist/Chat/ChatChannel.d.ts +5 -5
  68. package/dist/Chat/ChatChannel.js +1 -2
  69. package/dist/Chat/Message.d.ts +6 -6
  70. package/dist/Chat/Message.js +1 -2
  71. package/dist/Chat/index.d.ts +2 -2
  72. package/dist/Chat/index.js +2 -18
  73. package/dist/Chat/index.js.map +1 -1
  74. package/dist/Deckbuilding/Deck.d.ts +5 -5
  75. package/dist/Deckbuilding/Deck.js +1 -2
  76. package/dist/Deckbuilding/index.d.ts +4 -4
  77. package/dist/Deckbuilding/index.js +4 -24
  78. package/dist/Deckbuilding/index.js.map +1 -1
  79. package/dist/Deckbuilding/useDeleteDeck.d.ts +5 -2
  80. package/dist/Deckbuilding/useDeleteDeck.js +9 -15
  81. package/dist/Deckbuilding/useDeleteDeck.js.map +1 -1
  82. package/dist/Deckbuilding/useMyDecks.d.ts +3 -2
  83. package/dist/Deckbuilding/useMyDecks.js +8 -14
  84. package/dist/Deckbuilding/useMyDecks.js.map +1 -1
  85. package/dist/Deckbuilding/useSaveDeck.d.ts +5 -2
  86. package/dist/Deckbuilding/useSaveDeck.js +9 -15
  87. package/dist/Deckbuilding/useSaveDeck.js.map +1 -1
  88. package/dist/EjectPlayer/EjectPlayer.d.ts +1 -6
  89. package/dist/EjectPlayer/EjectPlayer.js +2 -8
  90. package/dist/EjectPlayer/EjectPlayer.js.map +1 -1
  91. package/dist/EjectPlayer/index.d.ts +1 -1
  92. package/dist/EjectPlayer/index.js +1 -17
  93. package/dist/EjectPlayer/index.js.map +1 -1
  94. package/dist/Failure/Failure.d.ts +6 -6
  95. package/dist/Failure/Failure.js +6 -9
  96. package/dist/Failure/Failure.js.map +1 -1
  97. package/dist/Failure/index.d.ts +1 -1
  98. package/dist/Failure/index.js +1 -17
  99. package/dist/Failure/index.js.map +1 -1
  100. package/dist/GiveUp/GiveUp.d.ts +7 -7
  101. package/dist/GiveUp/GiveUp.js +2 -5
  102. package/dist/GiveUp/GiveUp.js.map +1 -1
  103. package/dist/GiveUp/index.d.ts +1 -1
  104. package/dist/GiveUp/index.js +1 -17
  105. package/dist/GiveUp/index.js.map +1 -1
  106. package/dist/Hooks/index.d.ts +5 -5
  107. package/dist/Hooks/index.js +5 -21
  108. package/dist/Hooks/index.js.map +1 -1
  109. package/dist/Hooks/useChatMessages.d.ts +7 -12
  110. package/dist/Hooks/useChatMessages.js +44 -51
  111. package/dist/Hooks/useChatMessages.js.map +1 -1
  112. package/dist/Hooks/useMessageAuthor.d.ts +4 -4
  113. package/dist/Hooks/useMessageAuthor.js +13 -18
  114. package/dist/Hooks/useMessageAuthor.js.map +1 -1
  115. package/dist/Hooks/useOptions.d.ts +2 -2
  116. package/dist/Hooks/useOptions.js +4 -8
  117. package/dist/Hooks/useOptions.js.map +1 -1
  118. package/dist/Hooks/useRematch.d.ts +7 -7
  119. package/dist/Hooks/useRematch.js +18 -19
  120. package/dist/Hooks/useRematch.js.map +1 -1
  121. package/dist/Hooks/useSendMessage.d.ts +4 -1
  122. package/dist/Hooks/useSendMessage.js +6 -14
  123. package/dist/Hooks/useSendMessage.js.map +1 -1
  124. package/dist/Log/StartLiveLog.d.ts +1 -4
  125. package/dist/Log/StartLiveLog.js +3 -5
  126. package/dist/Log/StartLiveLog.js.map +1 -1
  127. package/dist/Log/StopLiveLog.d.ts +2 -5
  128. package/dist/Log/StopLiveLog.js +6 -9
  129. package/dist/Log/StopLiveLog.js.map +1 -1
  130. package/dist/Log/index.d.ts +4 -4
  131. package/dist/Log/index.js +4 -20
  132. package/dist/Log/index.js.map +1 -1
  133. package/dist/Log/useLogControls.d.ts +7 -7
  134. package/dist/Log/useLogControls.js +18 -22
  135. package/dist/Log/useLogControls.js.map +1 -1
  136. package/dist/PlayerTime/PlayerTime.d.ts +11 -11
  137. package/dist/PlayerTime/PlayerTime.js +1 -2
  138. package/dist/PlayerTime/index.d.ts +1 -1
  139. package/dist/PlayerTime/index.js +1 -17
  140. package/dist/PlayerTime/index.js.map +1 -1
  141. package/dist/Rematch/RematchQueries.d.ts +19 -19
  142. package/dist/Rematch/RematchQueries.js +23 -13
  143. package/dist/Rematch/RematchQueries.js.map +1 -1
  144. package/dist/Rematch/index.d.ts +1 -1
  145. package/dist/Rematch/index.js +1 -17
  146. package/dist/Rematch/index.js.map +1 -1
  147. package/dist/Sound/MuteSounds.d.ts +2 -5
  148. package/dist/Sound/MuteSounds.js +7 -10
  149. package/dist/Sound/MuteSounds.js.map +1 -1
  150. package/dist/Sound/UnmuteSounds.d.ts +1 -4
  151. package/dist/Sound/UnmuteSounds.js +3 -5
  152. package/dist/Sound/UnmuteSounds.js.map +1 -1
  153. package/dist/Sound/index.d.ts +3 -3
  154. package/dist/Sound/index.js +3 -19
  155. package/dist/Sound/index.js.map +1 -1
  156. package/dist/Sound/useSoundControls.d.ts +7 -7
  157. package/dist/Sound/useSoundControls.js +18 -22
  158. package/dist/Sound/useSoundControls.js.map +1 -1
  159. package/dist/Store/DisplayedAction.d.ts +15 -15
  160. package/dist/Store/DisplayedAction.js +12 -19
  161. package/dist/Store/DisplayedAction.js.map +1 -1
  162. package/dist/Store/GamePageState.d.ts +27 -28
  163. package/dist/Store/GamePageState.js +1 -2
  164. package/dist/Store/PlayedMove.d.ts +5 -5
  165. package/dist/Store/PlayedMove.js +1 -2
  166. package/dist/Store/endAnimation.d.ts +1 -0
  167. package/dist/Store/endAnimation.js +3 -0
  168. package/dist/Store/endAnimation.js.map +1 -0
  169. package/dist/Store/gameMiddleware.d.ts +4 -4
  170. package/dist/Store/gameMiddleware.js +34 -41
  171. package/dist/Store/gameMiddleware.js.map +1 -1
  172. package/dist/Store/gameReducer.d.ts +14 -20
  173. package/dist/Store/gameReducer.js +462 -525
  174. package/dist/Store/gameReducer.js.map +1 -1
  175. package/dist/Store/index.d.ts +4 -3
  176. package/dist/Store/index.js +4 -19
  177. package/dist/Store/index.js.map +1 -1
  178. package/dist/Store/localMovePreviewMiddleware.d.ts +4 -4
  179. package/dist/Store/localMovePreviewMiddleware.js +19 -18
  180. package/dist/Store/localMovePreviewMiddleware.js.map +1 -1
  181. package/dist/Store/store.d.ts +13 -0
  182. package/dist/Store/store.js +27 -0
  183. package/dist/Store/store.js.map +1 -0
  184. package/dist/Tutorial/PlayTutorialMoves.d.ts +1 -9
  185. package/dist/Tutorial/PlayTutorialMoves.js +2 -6
  186. package/dist/Tutorial/PlayTutorialMoves.js.map +1 -1
  187. package/dist/Tutorial/Tutorial.d.ts +5 -5
  188. package/dist/Tutorial/Tutorial.js +1 -2
  189. package/dist/Tutorial/TutorialDescription.d.ts +7 -7
  190. package/dist/Tutorial/TutorialDescription.js +1 -2
  191. package/dist/Tutorial/index.d.ts +4 -4
  192. package/dist/Tutorial/index.js +4 -20
  193. package/dist/Tutorial/index.js.map +1 -1
  194. package/dist/Tutorial/useTutorial.d.ts +2 -2
  195. package/dist/Tutorial/useTutorial.js +12 -22
  196. package/dist/Tutorial/useTutorial.js.map +1 -1
  197. package/dist/Types/GameAI.d.ts +1 -1
  198. package/dist/Types/GameAI.js +1 -2
  199. package/dist/Types/GameData.d.ts +18 -18
  200. package/dist/Types/GameData.js +1 -2
  201. package/dist/Types/GameMessage.d.ts +8 -8
  202. package/dist/Types/GameMessage.js +1 -2
  203. package/dist/Types/GameMode.d.ts +6 -6
  204. package/dist/Types/GameMode.js +7 -10
  205. package/dist/Types/GameMode.js.map +1 -1
  206. package/dist/Types/GameNotification.d.ts +6 -6
  207. package/dist/Types/GameNotification.js +1 -2
  208. package/dist/Types/GameOptions.d.ts +9 -9
  209. package/dist/Types/GameOptions.js +5 -8
  210. package/dist/Types/GameOptions.js.map +1 -1
  211. package/dist/Types/MovePlayedNotification.d.ts +9 -9
  212. package/dist/Types/MovePlayedNotification.js +6 -12
  213. package/dist/Types/MovePlayedNotification.js.map +1 -1
  214. package/dist/Types/MoveUndoneNotification.d.ts +8 -8
  215. package/dist/Types/MoveUndoneNotification.js +6 -12
  216. package/dist/Types/MoveUndoneNotification.js.map +1 -1
  217. package/dist/Types/Player.d.ts +13 -13
  218. package/dist/Types/Player.js +1 -2
  219. package/dist/Types/PlayerQuitReason.d.ts +4 -4
  220. package/dist/Types/PlayerQuitReason.js +5 -8
  221. package/dist/Types/PlayerQuitReason.js.map +1 -1
  222. package/dist/Types/ProxyGameData.d.ts +13 -13
  223. package/dist/Types/ProxyGameData.js +1 -2
  224. package/dist/Types/Tournament.d.ts +4 -4
  225. package/dist/Types/Tournament.js +1 -2
  226. package/dist/Types/index.d.ts +12 -12
  227. package/dist/Types/index.js +12 -28
  228. package/dist/Types/index.js.map +1 -1
  229. package/dist/User/User.d.ts +6 -6
  230. package/dist/User/User.js +1 -2
  231. package/dist/User/index.d.ts +2 -2
  232. package/dist/User/index.js +2 -18
  233. package/dist/User/index.js.map +1 -1
  234. package/dist/User/useMe.d.ts +4 -4
  235. package/dist/User/useMe.js +10 -21
  236. package/dist/User/useMe.js.map +1 -1
  237. package/dist/animations/Animation.d.ts +6 -6
  238. package/dist/animations/Animation.js +1 -2
  239. package/dist/animations/AnimationContext.d.ts +8 -8
  240. package/dist/animations/AnimationContext.js +1 -2
  241. package/dist/animations/AnimationState.d.ts +6 -6
  242. package/dist/animations/AnimationState.js +1 -2
  243. package/dist/animations/AnimationStep.d.ts +6 -6
  244. package/dist/animations/AnimationStep.js +7 -10
  245. package/dist/animations/AnimationStep.js.map +1 -1
  246. package/dist/animations/Animations.d.ts +8 -8
  247. package/dist/animations/Animations.js +15 -22
  248. package/dist/animations/Animations.js.map +1 -1
  249. package/dist/animations/AnimationsListener.d.ts +6 -0
  250. package/dist/animations/AnimationsListener.js +54 -0
  251. package/dist/animations/AnimationsListener.js.map +1 -0
  252. package/dist/animations/AnimationsListenerCreator.d.ts +2 -4
  253. package/dist/animations/AnimationsListenerCreator.js +40 -50
  254. package/dist/animations/AnimationsListenerCreator.js.map +1 -1
  255. package/dist/animations/animationMiddleware.d.ts +4 -0
  256. package/dist/animations/animationMiddleware.js +50 -0
  257. package/dist/animations/animationMiddleware.js.map +1 -0
  258. package/dist/animations/index.d.ts +5 -6
  259. package/dist/animations/index.js +5 -22
  260. package/dist/animations/index.js.map +1 -1
  261. package/dist/api/Client/GameClientAPI.d.ts +24 -24
  262. package/dist/api/Client/GameClientAPI.js +116 -165
  263. package/dist/api/Client/GameClientAPI.js.map +1 -1
  264. package/dist/api/Client/GameNotificationsListener.d.ts +5 -5
  265. package/dist/api/Client/GameNotificationsListener.js +62 -113
  266. package/dist/api/Client/GameNotificationsListener.js.map +1 -1
  267. package/dist/api/Client/RemoteGameLoader.d.ts +4 -5
  268. package/dist/api/Client/RemoteGameLoader.js +66 -62
  269. package/dist/api/Client/RemoteGameLoader.js.map +1 -1
  270. package/dist/api/Client/RemoteGameProvider.d.ts +7 -7
  271. package/dist/api/Client/RemoteGameProvider.js +19 -70
  272. package/dist/api/Client/RemoteGameProvider.js.map +1 -1
  273. package/dist/api/Client/apollo-client.d.ts +2 -2
  274. package/dist/api/Client/apollo-client.js +40 -58
  275. package/dist/api/Client/apollo-client.js.map +1 -1
  276. package/dist/api/Client/index.d.ts +4 -3
  277. package/dist/api/Client/index.js +4 -19
  278. package/dist/api/Client/index.js.map +1 -1
  279. package/dist/api/Client/pusher.d.ts +2 -0
  280. package/dist/api/Client/pusher.js +9 -0
  281. package/dist/api/Client/pusher.js.map +1 -0
  282. package/dist/api/GameAPI.d.ts +10 -10
  283. package/dist/api/GameAPI.js +1 -2
  284. package/dist/api/Local/ConsoleTools.d.ts +25 -25
  285. package/dist/api/Local/ConsoleTools.js +78 -86
  286. package/dist/api/Local/ConsoleTools.js.map +1 -1
  287. package/dist/api/Local/GameLocalAPI.d.ts +44 -44
  288. package/dist/api/Local/GameLocalAPI.js +442 -540
  289. package/dist/api/Local/GameLocalAPI.js.map +1 -1
  290. package/dist/api/Local/LocalGameProvider.d.ts +15 -15
  291. package/dist/api/Local/LocalGameProvider.js +18 -58
  292. package/dist/api/Local/LocalGameProvider.js.map +1 -1
  293. package/dist/api/Local/index.d.ts +1 -1
  294. package/dist/api/Local/index.js +1 -17
  295. package/dist/api/Local/index.js.map +1 -1
  296. package/dist/api/index.d.ts +2 -2
  297. package/dist/api/index.js +2 -18
  298. package/dist/api/index.js.map +1 -1
  299. package/dist/index.d.ts +16 -18
  300. package/dist/index.js +16 -36
  301. package/dist/index.js.map +1 -1
  302. package/dist/util/ArrayUtil.d.ts +2 -2
  303. package/dist/util/ArrayUtil.js +16 -21
  304. package/dist/util/ArrayUtil.js.map +1 -1
  305. package/package.json +66 -65
  306. package/dist/Actions/ActionType.d.ts +0 -3
  307. package/dist/Actions/ActionType.js +0 -8
  308. package/dist/Actions/ActionType.js.map +0 -1
  309. package/dist/Scoring/ScoringDescription.d.ts +0 -8
  310. package/dist/Scoring/ScoringDescription.js +0 -3
  311. package/dist/Scoring/ScoringDescription.js.map +0 -1
  312. package/dist/Scoring/index.d.ts +0 -1
  313. package/dist/Scoring/index.js +0 -18
  314. package/dist/Scoring/index.js.map +0 -1
  315. package/dist/util/TimeUtil.d.ts +0 -2
  316. package/dist/util/TimeUtil.js +0 -27
  317. package/dist/util/TimeUtil.js.map +0 -1
@@ -1,52 +1,45 @@
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.useChatMessages = void 0;
19
- var client_1 = require("@apollo/client");
20
- var use_pusher_1 = require("@harelpls/use-pusher");
21
- var react_1 = require("react");
22
- var GET_CHAT_MESSAGES = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["query ChatMessages($channel: String!, $limit: Int, $maxDate: DateTime) {\n chatChannel(name: $channel) {\n name\n messages(limit: $limit, maxDate: $maxDate) {\n id userId text date\n }\n }\n}"], ["query ChatMessages($channel: String!, $limit: Int, $maxDate: DateTime) {\n chatChannel(name: $channel) {\n name\n messages(limit: $limit, maxDate: $maxDate) {\n id userId text date\n }\n }\n}"])));
23
- function useChatMessages(gameId, onMessageReceived) {
24
- var _a;
25
- var channel = (0, use_pusher_1.useChannel)("game=".concat(gameId));
26
- var _b = (0, react_1.useState)(false), subscribed = _b[0], setSubscribed = _b[1];
27
- var _c = (0, react_1.useState)(false), hasMoreMessages = _c[0], setHasMoreMessages = _c[1];
28
- var _d = (0, client_1.useQuery)(GET_CHAT_MESSAGES, {
29
- variables: { channel: "game=".concat(gameId) }, skip: !subscribed,
30
- onCompleted: function (_a) {
31
- var messages = _a.chatChannel.messages;
32
- return setHasMoreMessages(messages.length === 10);
33
- }
34
- }), data = _d.data, loading = _d.loading, fetchMore = _d.fetchMore, client = _d.client;
35
- var messages = (_a = data === null || data === void 0 ? void 0 : data.chatChannel.messages) !== null && _a !== void 0 ? _a : [];
36
- (0, use_pusher_1.useEvent)(channel, 'pusher:subscription_succeeded', function () { return setSubscribed(true); });
37
- (0, use_pusher_1.useEvent)(channel, 'message', function (message) {
38
- if (message) {
39
- client.writeFragment({
40
- id: "ChatChannel:{\"name\":\"game=".concat(gameId, "\"}"),
41
- fragment: (0, client_1.gql)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["fragment ChatMessages on ChatChannel { messages { id userId text date } }"], ["fragment ChatMessages on ChatChannel { messages { id userId text date } }"]))),
42
- data: { messages: [__assign({ __typename: 'Message' }, message)] }
43
- });
44
- if (onMessageReceived)
45
- onMessageReceived(message);
46
- }
47
- });
48
- return { messages: messages, hasMoreMessages: hasMoreMessages, loading: loading, fetchMore: fetchMore };
49
- }
50
- exports.useChatMessages = useChatMessages;
51
- var templateObject_1, templateObject_2;
1
+ import { gql } from '@apollo/client';
2
+ import { useQuery } from '@apollo/client/react';
3
+ import { useEffect, useState } from 'react';
4
+ import { pusherClient } from '../api';
5
+ const GET_CHAT_MESSAGES = gql `query ChatMessages($channel: String!, $limit: Int, $maxDate: DateTime) {
6
+ chatChannel(name: $channel) {
7
+ name
8
+ messages(limit: $limit, maxDate: $maxDate) {
9
+ id userId text date
10
+ }
11
+ }
12
+ }`;
13
+ export function useChatMessages(gameId, onMessageReceived) {
14
+ const [subscribed, setSubscribed] = useState(false);
15
+ const [hasMoreMessages, setHasMoreMessages] = useState(true);
16
+ const { data, loading, fetchMore, client } = useQuery(GET_CHAT_MESSAGES, {
17
+ variables: { channel: `game=${gameId}`, limit: 50 }, skip: !subscribed
18
+ });
19
+ const messages = (data?.chatChannel?.messages ?? []);
20
+ useEffect(() => {
21
+ const channel = pusherClient.subscribe(`game=${gameId}`);
22
+ channel.bind('pusher:subscription_succeeded', () => setSubscribed(true));
23
+ channel.bind('message', (message) => {
24
+ if (message) {
25
+ client.writeFragment({
26
+ id: `ChatChannel:{"name":"game=${gameId}"}`,
27
+ fragment: gql `fragment ChatMessages on ChatChannel { messages { id userId text date } }`,
28
+ data: { messages: [{ __typename: 'Message', ...message }] }
29
+ });
30
+ if (onMessageReceived)
31
+ onMessageReceived(message);
32
+ }
33
+ });
34
+ return () => pusherClient.unsubscribe(`game=${gameId}`);
35
+ }, []);
36
+ return {
37
+ messages,
38
+ hasMoreMessages,
39
+ loading,
40
+ fetchMore: () => fetchMore({ variables: { limit: 10, maxDate: messages[messages.length - 1].date } }).then((result) => {
41
+ setHasMoreMessages(result.data !== undefined && result.data.chatChannel.messages.length === 10);
42
+ })
43
+ };
44
+ }
52
45
  //# sourceMappingURL=useChatMessages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useChatMessages.js","sourceRoot":"","sources":["../../src/Hooks/useChatMessages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAA8C;AAC9C,mDAA2D;AAC3D,+BAAgC;AAGhC,IAAM,iBAAiB,OAAG,YAAG,qRAAA,iNAO3B,IAAA,CAAA;AAEF,SAAgB,eAAe,CAAC,MAAc,EAAE,iBAA8C;;IAC5F,IAAM,OAAO,GAAG,IAAA,uBAAU,EAAC,eAAQ,MAAM,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AC,SAAS,EAAE,CAAC,OAAgB,EAAE,EAAE;YAC3C,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,CAAC,aAAa,CAAC;oBACnB,EAAE,EAAE,6BAA6B,MAAM,IAAI;oBAC3C,QAAQ,EAAE,GAAG,CAAA,4EAA4E;oBACzF,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE;iBAC5D,CAAC,CAAA;gBACF,IAAI,iBAAiB;oBAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;YACnD,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAA;IACzD,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO;QACL,QAAQ;QACR,eAAe;QACf,OAAO;QACP,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACpH,kBAAkB,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,KAAK,EAAE,CAAC,CAAA;QACjG,CAAC,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare function useMessageAuthor(author: string): {
2
- avatar: any;
3
- name: string | undefined;
4
- };
1
+ export declare function useMessageAuthor(author: string): {
2
+ avatar: any;
3
+ name: string | undefined;
4
+ };
@@ -1,19 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useMessageAuthor = void 0;
4
- var client_1 = require("@apollo/client");
5
- var react_redux_1 = require("react-redux");
6
- var GameClientAPI_1 = require("../api/Client/GameClientAPI");
7
- var query = new URLSearchParams(window.location.search);
8
- function useMessageAuthor(author) {
9
- var _a, _b;
10
- var players = (0, react_redux_1.useSelector)(function (state) { return state.players; });
11
- var player = players.find(function (p) { return p.userId === author; });
12
- var skip = !!player || query.get('game') === null;
13
- var data = (0, client_1.useQuery)(GameClientAPI_1.GET_MESSAGE_AUTHOR, { variables: { id: author }, skip: skip }).data;
14
- var avatar = (_a = player === null || player === void 0 ? void 0 : player.avatar) !== null && _a !== void 0 ? _a : data === null || data === void 0 ? void 0 : data.user.avatar;
15
- var name = (_b = player === null || player === void 0 ? void 0 : player.name) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data.user.name;
16
- return { avatar: avatar, name: name };
17
- }
18
- exports.useMessageAuthor = useMessageAuthor;
1
+ import { useQuery } from '@apollo/client/react';
2
+ import { GET_MESSAGE_AUTHOR } from '../api';
3
+ import { useGameSelector } from '../Store';
4
+ const query = new URLSearchParams(window.location.search);
5
+ export function useMessageAuthor(author) {
6
+ const players = useGameSelector(state => state.players);
7
+ const player = players.find(p => p.userId === author);
8
+ const skip = !!player || query.get('game') === null;
9
+ const { data } = useQuery(GET_MESSAGE_AUTHOR, { variables: { id: author }, skip: skip });
10
+ const avatar = player?.avatar ?? data?.user.avatar;
11
+ const name = player?.name ?? data?.user.name;
12
+ return { avatar, name };
13
+ }
19
14
  //# sourceMappingURL=useMessageAuthor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMessageAuthor.js","sourceRoot":"","sources":["../../src/Hooks/useMessageAuthor.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,2CAAyC;AACzC,6DAAgE;AAIhE,IAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACzD,SAAgB,gBAAgB,CAAC,MAAc;;IAE7C,IAAM,OAAO,GAAG,IAAA,yBAAW,EA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e,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;IACrD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAiB,kBAAkB,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;IACxG,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAA;IAClD,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,CAAC,IAAI,CAAA;IAC5C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACzB,CAAC"}
@@ -1,2 +1,2 @@
1
- import { GameOptions } from '../Types';
2
- export declare function useOptions(): GameOptions | undefined;
1
+ import { GameOptions } from '../Types';
2
+ export declare function useOptions(): GameOptions | undefined;
@@ -1,9 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useOptions = void 0;
4
- var react_redux_1 = require("react-redux");
5
- function useOptions() {
6
- return (0, react_redux_1.useSelector)(function (state) { return state.options; });
7
- }
8
- exports.useOptions = useOptions;
1
+ import { useGameSelector } from '../Store';
2
+ export function useOptions() {
3
+ return useGameSelector(state => state.options);
4
+ }
9
5
  //# sourceMappingURL=useOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOptions.js","sourceRoot":"","sources":["../../src/Hooks/useOptions.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAIzC,SAAgB,UAAU;IACxB,OAAO,IAAA,yBAAW,EAAC,UAAC,KAAoB,IAAK,OAAA,KAAK,CAAC,OAAO,EAAb,CAAa,CAAC,CAAA;AAC7D,CAAC;AAFD,gCAEC"}
1
+ {"version":3,"file":"useOptions.js","sourceRoot":"","sources":["../../src/Hooks/useOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1C,MAAM,UAAU,UAAU;IACxB,OAAO,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChD,CAAC"}
@@ -1,7 +1,7 @@
1
- import { CanRematchData } from '../Rematch';
2
- export declare function useRematch(): {
3
- game: CanRematchData | undefined;
4
- rematch: () => Promise<import("@apollo/client").FetchResult<any, Record<string, any>, Record<string, any>> | import("@apollo/client").ApolloQueryResult<{
5
- game: CanRematchData;
6
- }>>;
7
- };
1
+ import { CanRematchData } from '../Rematch';
2
+ export declare function useRematch(): {
3
+ game: CanRematchData | undefined;
4
+ rematch: () => Promise<import("@apollo/client").ApolloClient.MutateResult<unknown> | import("@apollo/client").ApolloClient.QueryResult<{
5
+ game: CanRematchData;
6
+ }>>;
7
+ };
@@ -1,20 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useRematch = void 0;
4
- var client_1 = require("@apollo/client");
5
- var Rematch_1 = require("../Rematch");
6
- var use_pusher_1 = require("@harelpls/use-pusher");
7
- function useRematch() {
8
- var _a;
9
- var query = new URLSearchParams(window.location.search);
10
- var gameId = query.get('game');
11
- var canRematchResult = (0, client_1.useQuery)(Rematch_1.CAN_REMATCH, { variables: { id: gameId } });
12
- var game = (_a = canRematchResult.data) === null || _a === void 0 ? void 0 : _a.game;
13
- var rematch = (0, client_1.useMutation)(Rematch_1.REMATCH)[0];
14
- var channel = (0, use_pusher_1.useChannel)('rematch=' + gameId);
15
- (0, use_pusher_1.useEvent)(channel, 'rematch', function () { return canRematchResult.refetch(); });
16
- (0, use_pusher_1.useEvent)(channel, 'pusher:subscription_succeeded', function () { return canRematchResult.refetch(); });
17
- return { game: game, rematch: function () { return rematch({ variables: { gameId: gameId } }).catch(function () { return canRematchResult.refetch(); }); } };
18
- }
19
- exports.useRematch = useRematch;
1
+ import { useMutation, useQuery } from '@apollo/client/react';
2
+ import { useEffect } from 'react';
3
+ import { pusherClient } from '../api';
4
+ import { CAN_REMATCH, REMATCH } from '../Rematch';
5
+ export function useRematch() {
6
+ const query = new URLSearchParams(window.location.search);
7
+ const gameId = query.get('game');
8
+ const canRematchResult = useQuery(CAN_REMATCH, { variables: { id: gameId } });
9
+ const game = canRematchResult.data?.game;
10
+ const [rematch] = useMutation(REMATCH);
11
+ useEffect(() => {
12
+ const channel = pusherClient.subscribe('rematch=' + gameId);
13
+ channel.bind('rematch', () => canRematchResult.refetch());
14
+ channel.bind('pusher:subscription_succeeded', () => canRematchResult.refetch());
15
+ return () => pusherClient.unsubscribe('rematch=' + gameId);
16
+ }, []);
17
+ return { game, rematch: () => rematch({ variables: { gameId } }).catch(() => canRematchResult.refetch()) };
18
+ }
20
19
  //# sourceMappingURL=useRematch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRematch.js","sourceRoot":"","sources":["../../src/Hooks/useRematch.ts"],"names":[],"mappings":";;;AAAA,yCAAsD;AACtD,sCAAiE;AACjE,mDAA2D;AAE3D,SAAgB,UAAU;;IACxB,IAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzD,IAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAChC,IAAM,gBAAgB,GAAG,IAAA,iBAAQ,EAA2B,qBAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;IACvG,IAAM,IAAI,GAAG,MAAA,gBAAgB,CAAC,IAAI,0CAAE,IAAI,CAAA;IACjC,IAAA,OAAO,GAAI,IAAA,oBAAW,EA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,IAAI,EAAE,IAAI,CAAA;IACxC,MAAM,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACtC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,UAAU,GAAG,MAAM,CAAC,CAAA;QAC3D,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAA;QACzD,OAAO,CAAC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAA;QAC/E,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,UAAU,GAAG,MAAM,CAAC,CAAA;IAC5D,CAAC,EAAE,EAAE,CAAC,CAAA;IACN,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAA;AAC5G,CAAC"}
@@ -1 +1,4 @@
1
- export declare function useSendMessage(): import("@apollo/client").MutationTuple<any, import("@apollo/client").OperationVariables, import("@apollo/client").DefaultContext, import("@apollo/client").ApolloCache<any>>;
1
+ import { useMutation } from '@apollo/client/react';
2
+ export declare function useSendMessage(): useMutation.ResultTuple<unknown, {
3
+ [x: string]: any;
4
+ }, import("@apollo/client").ApolloCache>;
@@ -1,15 +1,7 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.useSendMessage = void 0;
8
- var client_1 = require("@apollo/client");
9
- var SEND_MESSAGE = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["mutation SendMessage($channel: String!, $text: String!) { sendMessage(channel: $channel, text: $text) { date } }"], ["mutation SendMessage($channel: String!, $text: String!) { sendMessage(channel: $channel, text: $text) { date } }"])));
10
- function useSendMessage() {
11
- return (0, client_1.useMutation)(SEND_MESSAGE);
12
- }
13
- exports.useSendMessage = useSendMessage;
14
- var templateObject_1;
1
+ import { gql } from '@apollo/client';
2
+ import { useMutation } from '@apollo/client/react';
3
+ const SEND_MESSAGE = gql `mutation SendMessage($channel: String!, $text: String!) { sendMessage(channel: $channel, text: $text) { date } }`;
4
+ export function useSendMessage() {
5
+ return useMutation(SEND_MESSAGE);
6
+ }
15
7
  //# sourceMappingURL=useSendMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSendMessage.js","sourceRoot":"","sources":["../../src/Hooks/useSendMessage.ts"],"names":[],"mappings":";;;;;;;AAAA,yCAAiD;AAEjD,IAAM,YAAY,OAAG,YAAG,sLAAA,kHAAkH,IAAA,CAAA;AAE1I,SAAgB,cAAc;IAC5B,OAAO,IAAA,oBAAW,EAAC,YAAY,CAAC,CAAA;AAClC,CAAC;AAFD,wCAEC"}
1
+ {"version":3,"file":"useSendMessage.js","sourceRoot":"","sources":["../../src/Hooks/useSendMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,MAAM,YAAY,GAAG,GAAG,CAAA,kHAAkH,CAAA;AAE1I,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC,YAAY,CAAC,CAAA;AAClC,CAAC"}
@@ -1,4 +1 @@
1
- export declare const START_LIVE_LOG = "START_LIVE_LOG";
2
- export interface StartLiveLog {
3
- type: typeof START_LIVE_LOG;
4
- }
1
+ export declare const startLiveLog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"startLiveLog">;
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.START_LIVE_LOG = void 0;
4
- exports.START_LIVE_LOG = 'START_LIVE_LOG';
5
- //# sourceMappingURL=StartLiveLog.js.map
1
+ import { createAction } from '@reduxjs/toolkit';
2
+ export const startLiveLog = createAction('startLiveLog');
3
+ //# sourceMappingURL=startLiveLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StartLiveLog.js","sourceRoot":"","sources":["../../src/Log/StartLiveLog.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,gBAAgB,CAAA"}
1
+ {"version":3,"file":"startLiveLog.js","sourceRoot":"","sources":["../../src/Log/startLiveLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC,CAAA"}
@@ -1,5 +1,2 @@
1
- export declare const STOP_LIVE_LOG = "STOP_LIVE_LOG";
2
- export interface StopLiveLog {
3
- type: typeof STOP_LIVE_LOG;
4
- }
5
- export declare function liveLogStopped(): boolean;
1
+ export declare function liveLogStopped(): boolean;
2
+ export declare const stopLiveLog: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"stopLiveLog">;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.liveLogStopped = exports.STOP_LIVE_LOG = void 0;
4
- exports.STOP_LIVE_LOG = 'STOP_LIVE_LOG';
5
- function liveLogStopped() {
6
- return !!localStorage.getItem('liveLogStopped');
7
- }
8
- exports.liveLogStopped = liveLogStopped;
9
- //# sourceMappingURL=StopLiveLog.js.map
1
+ import { createAction } from '@reduxjs/toolkit';
2
+ export function liveLogStopped() {
3
+ return !!localStorage.getItem('liveLogStopped');
4
+ }
5
+ export const stopLiveLog = createAction('stopLiveLog');
6
+ //# sourceMappingURL=stopLiveLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StopLiveLog.js","sourceRoot":"","sources":["../../src/Log/StopLiveLog.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,eAAe,CAAA;AAM5C,SAAgB,cAAc;IAC5B,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;AACjD,CAAC;AAFD,wCAEC"}
1
+ {"version":3,"file":"stopLiveLog.js","sourceRoot":"","sources":["../../src/Log/stopLiveLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;AACjD,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- export * from './useLogControls';
2
- export * from './StartLiveLog';
3
- export * from './StopLiveLog';
4
- export * from './useLogControls';
1
+ export * from './useLogControls';
2
+ export * from './startLiveLog';
3
+ export * from './stopLiveLog';
4
+ export * from './useLogControls';
package/dist/Log/index.js CHANGED
@@ -1,21 +1,5 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./useLogControls"), exports);
18
- __exportStar(require("./StartLiveLog"), exports);
19
- __exportStar(require("./StopLiveLog"), exports);
20
- __exportStar(require("./useLogControls"), exports);
1
+ export * from './useLogControls';
2
+ export * from './startLiveLog';
3
+ export * from './stopLiveLog';
4
+ export * from './useLogControls';
21
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Log/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC;AAChC,iDAA8B;AAC9B,gDAA6B;AAC7B,mDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Log/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
@@ -1,7 +1,7 @@
1
- type UseLogControls = {
2
- start: () => void;
3
- stop: () => void;
4
- stopped: boolean;
5
- };
6
- export declare function useLogControls(): UseLogControls;
7
- export {};
1
+ type UseLogControls = {
2
+ start: () => void;
3
+ stop: () => void;
4
+ stopped: boolean;
5
+ };
6
+ export declare function useLogControls(): UseLogControls;
7
+ export {};
@@ -1,23 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useLogControls = void 0;
4
- var react_redux_1 = require("react-redux");
5
- var StartLiveLog_1 = require("./StartLiveLog");
6
- var StopLiveLog_1 = require("./StopLiveLog");
7
- function useLogControls() {
8
- var stopped = (0, react_redux_1.useSelector)(function (state) { return state.liveLogStopped; });
9
- var dispatch = (0, react_redux_1.useDispatch)();
10
- return {
11
- stop: function () {
12
- dispatch({ type: StopLiveLog_1.STOP_LIVE_LOG });
13
- localStorage.setItem('liveLogStopped', 'true');
14
- },
15
- start: function () {
16
- dispatch({ type: StartLiveLog_1.START_LIVE_LOG });
17
- localStorage.removeItem('liveLogStopped');
18
- },
19
- stopped: stopped
20
- };
21
- }
22
- exports.useLogControls = useLogControls;
1
+ import { useGameDispatch, useGameSelector } from '../Store';
2
+ import { startLiveLog } from './startLiveLog';
3
+ import { stopLiveLog } from './stopLiveLog';
4
+ export function useLogControls() {
5
+ const stopped = useGameSelector(state => state.liveLogStopped);
6
+ const dispatch = useGameDispatch();
7
+ return {
8
+ stop: () => {
9
+ dispatch(stopLiveLog());
10
+ localStorage.setItem('liveLogStopped', 'true');
11
+ },
12
+ start: () => {
13
+ dispatch(startLiveLog());
14
+ localStorage.removeItem('liveLogStopped');
15
+ },
16
+ stopped
17
+ };
18
+ }
23
19
  //# sourceMappingURL=useLogControls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLogControls.js","sourceRoot":"","sources":["../../src/Log/useLogControls.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AAEtD,+CAA+C;AAC/C,6CAA6C;AAQ7C,SAAgB,cAAc;IAC5B,IAAM,OAAO,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAoB,IAAK,OAAA,KAAK,CAAC,cAAc,EAApB,CAAoB,CAAC,CAAA;IAC3E,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAA;IAC9B,OAAO;QACL,IAAI,EAAE;YACJ,QAAQ,CAAC,EAAE,IAAI,EAAE,2BAAa,EAAE,CAAC,CAAA;YACjC,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;QAChD,CAAC;QACD,KAAK,EAAE;YACL,QAAQ,CAAC,EAAE,IAAI,EAAE,6BAAc,EAAE,CAAC,CAAA;YAClC,YAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAA;QAC3C,CAAC;QACD,OAAO,SAAA;KACR,CAAA;AACH,CAAC;AAdD,wCAcC"}
1
+ {"version":3,"file":"useLogControls.js","sourceRoot":"","sources":["../../src/Log/useLogControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAQ3C,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAC9D,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAA;IAClC,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;YACvB,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;QAChD,CAAC;QACD,KAAK,EAAE,GAAG,EAAE;YACV,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAA;YACxB,YAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAA;QAC3C,CAAC;QACD,OAAO;KACR,CAAA;AACH,CAAC"}
@@ -1,11 +1,11 @@
1
- export type PlayerTime = {
2
- playing: boolean;
3
- lastChange: string;
4
- availableTime: number | null;
5
- highestPlayTime: number;
6
- highestDownTime: number;
7
- cumulatedPlayTime: number;
8
- cumulatedDownTime: number;
9
- cumulatedWaitForMeTime: number;
10
- weightedWaitForMeTime: number;
11
- };
1
+ export type PlayerTime = {
2
+ playing: boolean;
3
+ lastChange: string;
4
+ availableTime: number | null;
5
+ highestPlayTime: number;
6
+ highestDownTime: number;
7
+ cumulatedPlayTime: number;
8
+ cumulatedDownTime: number;
9
+ cumulatedWaitForMeTime: number;
10
+ weightedWaitForMeTime: number;
11
+ };
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=PlayerTime.js.map
@@ -1 +1 @@
1
- export * from './PlayerTime';
1
+ export * from './PlayerTime';
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./PlayerTime"), exports);
1
+ export * from './PlayerTime';
18
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/PlayerTime/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/PlayerTime/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -1,19 +1,19 @@
1
- export declare const CAN_REMATCH: import("@apollo/client").DocumentNode;
2
- export interface CanRematchData {
3
- id: string;
4
- canRematch: boolean;
5
- rematch: RematchData;
6
- }
7
- export interface RematchData {
8
- id: string;
9
- startDate: string | null;
10
- players: RematchPlayerData[];
11
- }
12
- export interface RematchPlayerData {
13
- name: string;
14
- userId: string;
15
- ready: boolean;
16
- }
17
- export declare const REMATCH: import("@apollo/client").DocumentNode;
18
- export declare const ACCEPT_REMATCH: import("@apollo/client").DocumentNode;
19
- export declare const REFUSE_REMATCH: import("@apollo/client").DocumentNode;
1
+ export declare const CAN_REMATCH: import("@apollo/client").DocumentNode;
2
+ export interface CanRematchData {
3
+ id: string;
4
+ canRematch: boolean;
5
+ rematch: RematchData;
6
+ }
7
+ export interface RematchData {
8
+ id: string;
9
+ startDate: string | null;
10
+ players: RematchPlayerData[];
11
+ }
12
+ export interface RematchPlayerData {
13
+ name: string;
14
+ userId: string;
15
+ ready: boolean;
16
+ }
17
+ export declare const REMATCH: import("@apollo/client").DocumentNode;
18
+ export declare const ACCEPT_REMATCH: import("@apollo/client").DocumentNode;
19
+ export declare const REFUSE_REMATCH: import("@apollo/client").DocumentNode;