@beta-gamer/react-native 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -50,9 +50,10 @@ interface BetaGamerContextValue {
50
50
  interface BetaGamerProviderProps {
51
51
  token: string;
52
52
  serverUrl?: string;
53
+ socketPath?: string;
53
54
  children: React.ReactNode;
54
55
  }
55
- declare function BetaGamerProvider({ token, serverUrl, children }: BetaGamerProviderProps): react_jsx_runtime.JSX.Element;
56
+ declare function BetaGamerProvider({ token, serverUrl, socketPath, children }: BetaGamerProviderProps): react_jsx_runtime.JSX.Element;
56
57
  declare function useBetaGamer(): BetaGamerContextValue;
57
58
 
58
59
  /** Returns the current game state (status, players, winner, etc.) */
package/dist/index.d.ts CHANGED
@@ -50,9 +50,10 @@ interface BetaGamerContextValue {
50
50
  interface BetaGamerProviderProps {
51
51
  token: string;
52
52
  serverUrl?: string;
53
+ socketPath?: string;
53
54
  children: React.ReactNode;
54
55
  }
55
- declare function BetaGamerProvider({ token, serverUrl, children }: BetaGamerProviderProps): react_jsx_runtime.JSX.Element;
56
+ declare function BetaGamerProvider({ token, serverUrl, socketPath, children }: BetaGamerProviderProps): react_jsx_runtime.JSX.Element;
56
57
  declare function useBetaGamer(): BetaGamerContextValue;
57
58
 
58
59
  /** Returns the current game state (status, players, winner, etc.) */
package/dist/index.js CHANGED
@@ -87,7 +87,7 @@ function decodeToken(token) {
87
87
  return JSON.parse(base64Decode(parts[1]));
88
88
  }
89
89
  var BetaGamerContext = (0, import_react.createContext)(null);
90
- function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", children }) {
90
+ function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", socketPath = "/socket.io", children }) {
91
91
  const session = decodeToken(token);
92
92
  const [socket, setSocket] = (0, import_react.useState)(null);
93
93
  const [gameState, setGameState] = (0, import_react.useState)({
@@ -97,6 +97,7 @@ function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", ch
97
97
  (0, import_react.useEffect)(() => {
98
98
  const s = (0, import_socket.io)(`${serverUrl}/${session.game}`, {
99
99
  auth: { token },
100
+ path: socketPath,
100
101
  transports: ["websocket", "polling"]
101
102
  });
102
103
  setSocket(s);
@@ -110,7 +111,7 @@ function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", ch
110
111
  s.disconnect();
111
112
  setSocket(null);
112
113
  };
113
- }, [token, serverUrl, session.game]);
114
+ }, [token, serverUrl, socketPath, session.game]);
114
115
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BetaGamerContext.Provider, { value: { token, session, socket, gameState, theme: session.theme ?? {} }, children });
115
116
  }
116
117
  function useBetaGamer() {
package/dist/index.mjs CHANGED
@@ -46,7 +46,7 @@ function decodeToken(token) {
46
46
  return JSON.parse(base64Decode(parts[1]));
47
47
  }
48
48
  var BetaGamerContext = createContext(null);
49
- function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", children }) {
49
+ function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", socketPath = "/socket.io", children }) {
50
50
  const session = decodeToken(token);
51
51
  const [socket, setSocket] = useState(null);
52
52
  const [gameState, setGameState] = useState({
@@ -56,6 +56,7 @@ function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", ch
56
56
  useEffect(() => {
57
57
  const s = io(`${serverUrl}/${session.game}`, {
58
58
  auth: { token },
59
+ path: socketPath,
59
60
  transports: ["websocket", "polling"]
60
61
  });
61
62
  setSocket(s);
@@ -69,7 +70,7 @@ function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", ch
69
70
  s.disconnect();
70
71
  setSocket(null);
71
72
  };
72
- }, [token, serverUrl, session.game]);
73
+ }, [token, serverUrl, socketPath, session.game]);
73
74
  return /* @__PURE__ */ jsx(BetaGamerContext.Provider, { value: { token, session, socket, gameState, theme: session.theme ?? {} }, children });
74
75
  }
75
76
  function useBetaGamer() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beta-gamer/react-native",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "React Native SDK for Beta Gamer GaaS — composable game components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",