@articles-media/articles-dev-box 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -63,6 +63,7 @@ npm run dev
|
|
|
63
63
|
| useFullscreen | Hook for going fullscreen on the body or provided element | |
|
|
64
64
|
| typicalZustandStoreExcludes | Array of strings that every game published by Articles Media would want to normally exclude from persisting in base game store. | Catching Game and School Run |
|
|
65
65
|
| typicalZustandStoreStateSlice | Slice of zustand states that every game normally uses | Catching Game and School Run |
|
|
66
|
+
| zustandSocketStoreSlice | Slice of zustand states that every game normally uses for sockets | School Run
|
|
66
67
|
| getSignOutRedirectUrl | Handles signout redirect api logic | Catching Game |
|
|
67
68
|
| GlobalClientModals | Imports all global client modals like FriendsList, CreditsModal, SettingsModal, InfoModal, and so on | USA Tycoon |
|
|
68
69
|
| generateRandomNickname | Reusable way of doing random nicknames from package | USA Tycoon |
|
package/dist/GlobalBody.js
CHANGED
|
@@ -8,8 +8,8 @@ var import_classnames = /* @__PURE__ */ __toESM(require_classnames(), 1);
|
|
|
8
8
|
var StatusModal = lazy(() => import("./StatusModal-DkHAimHp.js"));
|
|
9
9
|
function GlobalBody({ fontawesome = true }) {
|
|
10
10
|
const [statusModal, setStatusModal] = useState(false);
|
|
11
|
-
const { data: mainSiteStatus, error: mainSiteStatusError, isLoading: mainSiteStatusLoading, mutate: mainSiteStatusMutate } = useMainSiteStatus({ disable: process.env.NODE_ENV !== "development" });
|
|
12
|
-
const { data: authSiteStatus, error: authSiteStatusError, isLoading: authSiteStatusLoading, mutate: authSiteStatusMutate } = useAuthSiteStatus({ disable: process.env.NODE_ENV !== "development" });
|
|
11
|
+
const { data: mainSiteStatus, error: mainSiteStatusError, isLoading: mainSiteStatusLoading, mutate: mainSiteStatusMutate } = useMainSiteStatus({ disable: process.env.NODE_ENV !== "development" || process.env.NEXT_PUBLIC_ENABLE_ARTICLES === "false" });
|
|
12
|
+
const { data: authSiteStatus, error: authSiteStatusError, isLoading: authSiteStatusLoading, mutate: authSiteStatusMutate } = useAuthSiteStatus({ disable: process.env.NODE_ENV !== "development" || process.env.NEXT_PUBLIC_ENABLE_ARTICLES === "false" });
|
|
13
13
|
return /* @__PURE__ */ jsxs(Fragment, { children: [fontawesome && /* @__PURE__ */ jsx("link", {
|
|
14
14
|
rel: "stylesheet",
|
|
15
15
|
href: `https://cdn.articles.media/fonts/fontawesome/css/all.min.css`
|
|
@@ -246,7 +246,7 @@ function OtherTab({ useStore, config }) {
|
|
|
246
246
|
var package_default = {
|
|
247
247
|
name: "@articles-media/articles-dev-box",
|
|
248
248
|
description: "Shared code, functions, and components for different Articles Media projects.",
|
|
249
|
-
version: "1.3.
|
|
249
|
+
version: "1.3.3",
|
|
250
250
|
type: "module",
|
|
251
251
|
sideEffects: false,
|
|
252
252
|
imports: { "#root/src/*": "./src/*" },
|
|
@@ -289,6 +289,8 @@ var package_default = {
|
|
|
289
289
|
"./useFullscreen": "./dist/useFullscreen.js",
|
|
290
290
|
"./typicalZustandStoreExcludes": "./dist/typicalZustandStoreExcludes.js",
|
|
291
291
|
"./typicalZustandStoreStateSlice": "./dist/typicalZustandStoreStateSlice.js",
|
|
292
|
+
"./zustandSocketStoreSlice": "./dist/zustandSocketStoreSlice.js",
|
|
293
|
+
"./useSocketStoreSlice": "./dist/useSocketStoreSlice.js",
|
|
292
294
|
"./defaultGameNextConfig": "./dist/defaultGameNextConfig.js",
|
|
293
295
|
"./defaultGameThemeConfig": "./dist/defaultGameThemeConfig.js",
|
|
294
296
|
"./getSignOutRedirectUrl": "./dist/getSignOutRedirectUrl.js",
|
package/dist/SettingsModal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
1
|
+
import { t as SettingsModal } from "./SettingsModal-Bud-D-3m.js";
|
|
2
2
|
export { SettingsModal as default };
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { t as GameScoreboard } from "./GameScoreboard-BvE_sIDW.js";
|
|
|
16
16
|
import PageTemplateLandingPage from "./PageTemplateLandingPage.js";
|
|
17
17
|
import GlobalHead from "./GlobalHead.js";
|
|
18
18
|
import GlobalBody_default from "./GlobalBody.js";
|
|
19
|
-
import { t as SettingsModal } from "./SettingsModal-
|
|
19
|
+
import { t as SettingsModal } from "./SettingsModal-Bud-D-3m.js";
|
|
20
20
|
import CreditsModal from "./CreditsModal.js";
|
|
21
21
|
import InfoModal from "./InfoModal.js";
|
|
22
22
|
import DarkModeHandler from "./DarkModeHandler.js";
|
|
@@ -27,8 +27,9 @@ import InviteModal from "./InviteModal.js";
|
|
|
27
27
|
import ReusedSocketLogicHandler from "./ReusedSocketLogicHandler.js";
|
|
28
28
|
import typicalZustandStoreExcludes from "./typicalZustandStoreExcludes.js";
|
|
29
29
|
import typicalZustandStoreStateSlice from "./typicalZustandStoreStateSlice.js";
|
|
30
|
+
import zustandSocketStoreSlice from "./zustandSocketStoreSlice.js";
|
|
30
31
|
import defaultGameNextConfig from "./defaultGameNextConfig.js";
|
|
31
32
|
import getTheme from "./defaultGameThemeConfig.js";
|
|
32
33
|
import getSignOutRedirectUrl from "./getSignOutRedirectUrl.js";
|
|
33
34
|
import generateRandomNickname from "./generateRandomNickname.js";
|
|
34
|
-
export { Ad_default as Ad, ArticlesAd, CreditsModal, DarkModeHandler, FriendsList, GameMenu, PrimaryButtonGroup as GameMenuPrimaryButtonGroup, GameScoreboard, GlobalBody_default as GlobalBody, GlobalHead, HasNoMouseHandler, InfoModal, InviteModal, NicknameInput, PageTemplateLandingPage, ReturnToLauncherButton, ReusedSocketLogicHandler, SessionButton, SettingsModal, SignInButton, SocketServerUrlHandler, ToontownModeHandler, ViewUserModal, defaultGameNextConfig, getTheme as defaultGameThemeConfig, generateRandomNickname, getSignOutRedirectUrl, typicalZustandStoreExcludes, typicalZustandStoreStateSlice, useFullscreen, useUserDetails, useUserFriends, useUserToken };
|
|
35
|
+
export { Ad_default as Ad, ArticlesAd, CreditsModal, DarkModeHandler, FriendsList, GameMenu, PrimaryButtonGroup as GameMenuPrimaryButtonGroup, GameScoreboard, GlobalBody_default as GlobalBody, GlobalHead, HasNoMouseHandler, InfoModal, InviteModal, NicknameInput, PageTemplateLandingPage, ReturnToLauncherButton, ReusedSocketLogicHandler, SessionButton, SettingsModal, SignInButton, SocketServerUrlHandler, ToontownModeHandler, ViewUserModal, defaultGameNextConfig, getTheme as defaultGameThemeConfig, generateRandomNickname, getSignOutRedirectUrl, typicalZustandStoreExcludes, typicalZustandStoreStateSlice, useFullscreen, useUserDetails, useUserFriends, useUserToken, zustandSocketStoreSlice };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//#region src/constants/zustandSocketStoreSlice.js
|
|
2
|
+
var game_name_key = process.env.NEXT_PUBLIC_GAME_KEY;
|
|
3
|
+
function zustandSocketStoreSlice(set, get, io) {
|
|
4
|
+
return {
|
|
5
|
+
socket: io({ autoConnect: false }),
|
|
6
|
+
serverUrl: process.env.NEXT_PUBLIC_NODE_SERVER,
|
|
7
|
+
connectSocket: (url) => {
|
|
8
|
+
const newSocket = io(url || process.env.NEXT_PUBLIC_NODE_SERVER, {
|
|
9
|
+
transports: ["websocket"],
|
|
10
|
+
autoConnect: false,
|
|
11
|
+
reconnection: true,
|
|
12
|
+
reconnectionDelay: 5e3,
|
|
13
|
+
reconnectionDelayMax: 1e4,
|
|
14
|
+
query: { client: process.env.NEXT_PUBLIC_GAME_KEY }
|
|
15
|
+
});
|
|
16
|
+
newSocket.connect();
|
|
17
|
+
set({ socket: newSocket });
|
|
18
|
+
},
|
|
19
|
+
setServerUrl: (url) => set({ serverUrl: url }),
|
|
20
|
+
disconnectSocket: () => set((state) => {
|
|
21
|
+
state.socket?.disconnect();
|
|
22
|
+
return {};
|
|
23
|
+
}),
|
|
24
|
+
startGame: (gameId, status) => {
|
|
25
|
+
set((state) => {
|
|
26
|
+
state.socket.emit(`game:${game_name_key}:start`, {
|
|
27
|
+
game_id: gameId,
|
|
28
|
+
status
|
|
29
|
+
});
|
|
30
|
+
return {};
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
totalUsers: 0,
|
|
34
|
+
setTotalUsers: (total) => set({ totalUsers: total }),
|
|
35
|
+
connected: false,
|
|
36
|
+
setConnected: (total) => set({ connected: total }),
|
|
37
|
+
authenticated: false,
|
|
38
|
+
setAuthenticated: (value) => set({ authenticated: value }),
|
|
39
|
+
loginSocket: (data) => {
|
|
40
|
+
set((state) => {
|
|
41
|
+
state.socket.emit("login-socket", {
|
|
42
|
+
...data,
|
|
43
|
+
game_name: process.env.NEXT_PUBLIC_GAME_NAME
|
|
44
|
+
});
|
|
45
|
+
return {};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { zustandSocketStoreSlice as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@articles-media/articles-dev-box",
|
|
3
3
|
"description": "Shared code, functions, and components for different Articles Media projects.",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"imports": {
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
"./useFullscreen": "./dist/useFullscreen.js",
|
|
49
49
|
"./typicalZustandStoreExcludes": "./dist/typicalZustandStoreExcludes.js",
|
|
50
50
|
"./typicalZustandStoreStateSlice": "./dist/typicalZustandStoreStateSlice.js",
|
|
51
|
+
"./zustandSocketStoreSlice": "./dist/zustandSocketStoreSlice.js",
|
|
52
|
+
"./useSocketStoreSlice": "./dist/useSocketStoreSlice.js",
|
|
51
53
|
"./defaultGameNextConfig": "./dist/defaultGameNextConfig.js",
|
|
52
54
|
"./defaultGameThemeConfig": "./dist/defaultGameThemeConfig.js",
|
|
53
55
|
"./getSignOutRedirectUrl": "./dist/getSignOutRedirectUrl.js",
|