@freegamestore/games 0.15.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -8
- package/TOKENS.md +132 -0
- package/dist/Confetti.d.ts +20 -0
- package/dist/Confetti.d.ts.map +1 -0
- package/dist/Confetti.js +76 -0
- package/dist/Confetti.js.map +1 -0
- package/dist/GameConfirm.d.ts +1 -1
- package/dist/GameConfirm.d.ts.map +1 -1
- package/dist/GameModal.d.ts +1 -1
- package/dist/GameModal.d.ts.map +1 -1
- package/dist/GameOverScreen.d.ts +1 -1
- package/dist/GameOverScreen.d.ts.map +1 -1
- package/dist/GameResultScreen.d.ts +46 -0
- package/dist/GameResultScreen.d.ts.map +1 -0
- package/dist/GameResultScreen.js +157 -0
- package/dist/GameResultScreen.js.map +1 -0
- package/dist/GameTextSizeToggle.d.ts +1 -1
- package/dist/GameTextSizeToggle.d.ts.map +1 -1
- package/dist/GameThemeToggle.d.ts +1 -1
- package/dist/GameThemeToggle.d.ts.map +1 -1
- package/dist/GameThemeToggle.js +43 -7
- package/dist/GameThemeToggle.js.map +1 -1
- package/dist/GameTopbar.d.ts +19 -7
- package/dist/GameTopbar.d.ts.map +1 -1
- package/dist/GameTopbar.js +113 -168
- package/dist/GameTopbar.js.map +1 -1
- package/dist/GameTopbar.module.css +201 -0
- package/dist/StartScreen.d.ts +48 -0
- package/dist/StartScreen.d.ts.map +1 -0
- package/dist/StartScreen.js +159 -0
- package/dist/StartScreen.js.map +1 -0
- package/dist/feel/ScorePopup.d.ts +25 -0
- package/dist/feel/ScorePopup.d.ts.map +1 -0
- package/dist/feel/ScorePopup.js +67 -0
- package/dist/feel/ScorePopup.js.map +1 -0
- package/dist/feel/easing.d.ts +14 -0
- package/dist/feel/easing.d.ts.map +1 -0
- package/dist/feel/easing.js +12 -0
- package/dist/feel/easing.js.map +1 -0
- package/dist/feel/haptics.d.ts +19 -0
- package/dist/feel/haptics.d.ts.map +1 -0
- package/dist/feel/haptics.js +24 -0
- package/dist/feel/haptics.js.map +1 -0
- package/dist/feel/index.d.ts +17 -0
- package/dist/feel/index.d.ts.map +1 -0
- package/dist/feel/index.js +17 -0
- package/dist/feel/index.js.map +1 -0
- package/dist/feel/particles.d.ts +46 -0
- package/dist/feel/particles.d.ts.map +1 -0
- package/dist/feel/particles.js +61 -0
- package/dist/feel/particles.js.map +1 -0
- package/dist/feel/reducedMotion.d.ts +6 -0
- package/dist/feel/reducedMotion.d.ts.map +1 -0
- package/dist/feel/reducedMotion.js +10 -0
- package/dist/feel/reducedMotion.js.map +1 -0
- package/dist/feel/shake.d.ts +6 -0
- package/dist/feel/shake.d.ts.map +1 -0
- package/dist/feel/shake.js +17 -0
- package/dist/feel/shake.js.map +1 -0
- package/dist/feel/tween.d.ts +9 -0
- package/dist/feel/tween.d.ts.map +1 -0
- package/dist/feel/tween.js +15 -0
- package/dist/feel/tween.js.map +1 -0
- package/dist/feel/useHaptics.d.ts +12 -0
- package/dist/feel/useHaptics.d.ts.map +1 -0
- package/dist/feel/useHaptics.js +16 -0
- package/dist/feel/useHaptics.js.map +1 -0
- package/dist/feel/useParticles.d.ts +18 -0
- package/dist/feel/useParticles.d.ts.map +1 -0
- package/dist/feel/useParticles.js +79 -0
- package/dist/feel/useParticles.js.map +1 -0
- package/dist/feel/useShake.d.ts +14 -0
- package/dist/feel/useShake.d.ts.map +1 -0
- package/dist/feel/useShake.js +17 -0
- package/dist/feel/useShake.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/tokens.d.ts +112 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +106 -0
- package/dist/tokens.js.map +1 -0
- package/dist/useGameSounds.d.ts.map +1 -1
- package/dist/useGameSounds.js +37 -15
- package/dist/useGameSounds.js.map +1 -1
- package/dist/useLeaderboard.d.ts +8 -1
- package/dist/useLeaderboard.d.ts.map +1 -1
- package/dist/useLeaderboard.js +21 -11
- package/dist/useLeaderboard.js.map +1 -1
- package/package.json +21 -6
package/dist/tokens.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brand, typography and motion design tokens for FreeGameStore games.
|
|
3
|
+
*
|
|
4
|
+
* These values are lifted from the Mosaic Rush pilot (`web/src/index.css`),
|
|
5
|
+
* which is the first game to be built on them. They are the single definition
|
|
6
|
+
* the SDK documents. See TOKENS.md for the full reference.
|
|
7
|
+
*
|
|
8
|
+
* The SDK components read these as CSS custom properties (`var(--paper)` and
|
|
9
|
+
* so on), with their own fallbacks. This module does not inject anything on
|
|
10
|
+
* import (the package is `sideEffects: false`). A game that wants the tokens
|
|
11
|
+
* adds GAME_TOKENS_CSS to its stylesheet, or copies it into index.css.
|
|
12
|
+
*
|
|
13
|
+
* Changing a value here changes every game that adopts the tokens, so treat
|
|
14
|
+
* it as a platform-wide decision.
|
|
15
|
+
*/
|
|
16
|
+
/** Light theme. The default when `data-theme` is absent. */
|
|
17
|
+
export const LIGHT_COLOURS = {
|
|
18
|
+
paper: '#ffffff',
|
|
19
|
+
ink: '#1a1a1a',
|
|
20
|
+
muted: '#6b7280',
|
|
21
|
+
line: '#e5e7eb',
|
|
22
|
+
lineStrong: '#d1d5db',
|
|
23
|
+
panel: '#f9fafb',
|
|
24
|
+
glass: 'rgba(255, 255, 255, 0.8)',
|
|
25
|
+
dock: '#ffffff',
|
|
26
|
+
success: '#16a34a',
|
|
27
|
+
warning: '#d97706',
|
|
28
|
+
error: '#dc2626',
|
|
29
|
+
accent: '#2563eb',
|
|
30
|
+
accentSoft: '#eff6ff',
|
|
31
|
+
accentInk: '#2563eb',
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Only the tokens that differ in dark mode. Applied under `:root[data-theme="dark"]`.
|
|
35
|
+
* `accent` is not listed: it is the same in both themes.
|
|
36
|
+
*/
|
|
37
|
+
export const DARK_COLOUR_OVERRIDES = {
|
|
38
|
+
paper: '#0f0f0f',
|
|
39
|
+
ink: '#f5f5f5',
|
|
40
|
+
muted: '#9ca3af',
|
|
41
|
+
line: '#2d2d2d',
|
|
42
|
+
lineStrong: '#404040',
|
|
43
|
+
panel: '#1a1a1a',
|
|
44
|
+
glass: 'rgba(15, 15, 15, 0.8)',
|
|
45
|
+
dock: '#1a1a1a',
|
|
46
|
+
success: '#22c55e',
|
|
47
|
+
warning: '#fbbf24',
|
|
48
|
+
error: '#ef4444',
|
|
49
|
+
accentSoft: '#1a2e26',
|
|
50
|
+
accentInk: '#60a5fa',
|
|
51
|
+
};
|
|
52
|
+
/** Dark theme, resolved: the light values with the dark overrides applied. */
|
|
53
|
+
export const DARK_COLOURS = { ...LIGHT_COLOURS, ...DARK_COLOUR_OVERRIDES };
|
|
54
|
+
export const TYPOGRAPHY_TOKENS = {
|
|
55
|
+
fontDisplay: '"Fraunces", Georgia, serif',
|
|
56
|
+
fontBody: '"Manrope", system-ui, sans-serif',
|
|
57
|
+
textStat: '1.25rem',
|
|
58
|
+
textTitle: 'clamp(2rem, 9vw, 2.6rem)',
|
|
59
|
+
textDisplay: 'clamp(2.25rem, 11vw, 3.25rem)',
|
|
60
|
+
};
|
|
61
|
+
export const SHAPE_TOKENS = {
|
|
62
|
+
radius: '1.25rem',
|
|
63
|
+
};
|
|
64
|
+
export const MOTION_TOKENS = {
|
|
65
|
+
fast: '120ms',
|
|
66
|
+
base: '240ms',
|
|
67
|
+
slow: '420ms',
|
|
68
|
+
easeOut: 'cubic-bezier(0.2, 0.9, 0.3, 1)',
|
|
69
|
+
easeSpring: 'cubic-bezier(0.2, 0.9, 0.3, 1.3)',
|
|
70
|
+
duration: 'var(--motion-fast)',
|
|
71
|
+
easing: 'var(--motion-ease-out)',
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Durations under `prefers-reduced-motion: reduce`. The animations finish at
|
|
75
|
+
* once and only the final state is shown. Easings are unchanged.
|
|
76
|
+
*/
|
|
77
|
+
export const REDUCED_MOTION_DURATIONS = {
|
|
78
|
+
fast: '0ms',
|
|
79
|
+
base: '0ms',
|
|
80
|
+
slow: '0ms',
|
|
81
|
+
duration: '0ms',
|
|
82
|
+
};
|
|
83
|
+
const toKebab = (name) => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
84
|
+
const declarations = (entries, prefix = '', indent = ' ') => Object.entries(entries)
|
|
85
|
+
.map(([key, value]) => `${indent}--${prefix}${toKebab(key)}: ${value};`)
|
|
86
|
+
.join('\n');
|
|
87
|
+
/**
|
|
88
|
+
* A stylesheet that defines every token. It has three blocks:
|
|
89
|
+
* - `:root`, the light values and the type, shape and motion tokens;
|
|
90
|
+
* - `:root[data-theme="dark"]`, the dark colour overrides;
|
|
91
|
+
* - `prefers-reduced-motion: reduce`, which zeroes the durations.
|
|
92
|
+
*
|
|
93
|
+
* Add it to a game's stylesheet, for example `<style>{GAME_TOKENS_CSS}</style>`
|
|
94
|
+
* or the top of `index.css`.
|
|
95
|
+
*/
|
|
96
|
+
export const GAME_TOKENS_CSS = [
|
|
97
|
+
`:root {\n${[
|
|
98
|
+
declarations(LIGHT_COLOURS),
|
|
99
|
+
declarations(TYPOGRAPHY_TOKENS),
|
|
100
|
+
declarations(SHAPE_TOKENS),
|
|
101
|
+
declarations(MOTION_TOKENS, 'motion-'),
|
|
102
|
+
].join('\n')}\n}`,
|
|
103
|
+
`:root[data-theme="dark"] {\n${declarations(DARK_COLOUR_OVERRIDES)}\n}`,
|
|
104
|
+
`@media (prefers-reduced-motion: reduce) {\n :root {\n${declarations(REDUCED_MOTION_DURATIONS, 'motion-', ' ')}\n }\n}`,
|
|
105
|
+
].join('\n\n');
|
|
106
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAkCH,4DAA4D;A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":3,"file":"useGameSounds.d.ts","sourceRoot":"","sources":["../src/useGameSounds.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,aAAa;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useGameSounds.d.ts","sourceRoot":"","sources":["../src/useGameSounds.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,aAAa;;;;;;;;;EA6I5B"}
|
package/dist/useGameSounds.js
CHANGED
|
@@ -8,16 +8,30 @@ import { useSound } from './SoundContext.js';
|
|
|
8
8
|
export function useGameSounds() {
|
|
9
9
|
const { muted } = useSound();
|
|
10
10
|
const ctxRef = useRef(null);
|
|
11
|
+
// Set once the game unmounts: no new AudioContext may be created after that.
|
|
12
|
+
const disposedRef = useRef(false);
|
|
13
|
+
// Delayed notes of multi-tone sounds (score, game over, level up, …).
|
|
14
|
+
const timersRef = useRef(new Set());
|
|
11
15
|
// Release the AudioContext when the game unmounts so it isn't leaked
|
|
12
|
-
// (browsers cap concurrent contexts).
|
|
16
|
+
// (browsers cap concurrent contexts). Pending delayed notes are cancelled
|
|
17
|
+
// first: one firing after unmount used to create a NEW context that nothing
|
|
18
|
+
// ever closed — one leak per game swapped out mid-sound, until browsers stop
|
|
19
|
+
// allowing new contexts and sound dies (#99). Reset on (re)mount so
|
|
20
|
+
// StrictMode's simulated remount doesn't leave sounds permanently disabled.
|
|
13
21
|
useEffect(() => {
|
|
22
|
+
disposedRef.current = false;
|
|
23
|
+
const timers = timersRef.current;
|
|
14
24
|
return () => {
|
|
15
|
-
|
|
25
|
+
disposedRef.current = true;
|
|
26
|
+
for (const t of timers)
|
|
27
|
+
clearTimeout(t);
|
|
28
|
+
timers.clear();
|
|
29
|
+
void ctxRef.current?.close().catch(() => { });
|
|
16
30
|
ctxRef.current = null;
|
|
17
31
|
};
|
|
18
32
|
}, []);
|
|
19
33
|
const getCtx = useCallback(() => {
|
|
20
|
-
if (muted)
|
|
34
|
+
if (muted || disposedRef.current)
|
|
21
35
|
return null;
|
|
22
36
|
if (!ctxRef.current) {
|
|
23
37
|
try {
|
|
@@ -59,6 +73,14 @@ export function useGameSounds() {
|
|
|
59
73
|
osc.start(ctx.currentTime);
|
|
60
74
|
osc.stop(ctx.currentTime + duration);
|
|
61
75
|
}, [getCtx]);
|
|
76
|
+
/** Play a note after `ms`, cancelled if the game unmounts first. */
|
|
77
|
+
const later = useCallback((ms, ...args) => {
|
|
78
|
+
const timer = setTimeout(() => {
|
|
79
|
+
timersRef.current.delete(timer);
|
|
80
|
+
tone(...args);
|
|
81
|
+
}, ms);
|
|
82
|
+
timersRef.current.add(timer);
|
|
83
|
+
}, [tone]);
|
|
62
84
|
/** Short click/tap — piece moved, card flipped, button pressed */
|
|
63
85
|
const playMove = useCallback(() => {
|
|
64
86
|
tone(600, 0.06, 'square', 0.08);
|
|
@@ -66,8 +88,8 @@ export function useGameSounds() {
|
|
|
66
88
|
/** Positive ding — scored a point, matched, correct answer */
|
|
67
89
|
const playScore = useCallback(() => {
|
|
68
90
|
tone(880, 0.12, 'sine', 0.15);
|
|
69
|
-
|
|
70
|
-
}, [tone]);
|
|
91
|
+
later(60, 1100, 0.15, 'sine', 0.12);
|
|
92
|
+
}, [tone, later]);
|
|
71
93
|
/** Negative buzz — wrong answer, hit obstacle, lost life */
|
|
72
94
|
const playError = useCallback(() => {
|
|
73
95
|
tone(200, 0.2, 'sawtooth', 0.1);
|
|
@@ -75,16 +97,16 @@ export function useGameSounds() {
|
|
|
75
97
|
/** Game over — descending tones */
|
|
76
98
|
const playGameOver = useCallback(() => {
|
|
77
99
|
tone(440, 0.15, 'sine', 0.12);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, [tone]);
|
|
100
|
+
later(100, 350, 0.15, 'sine', 0.1);
|
|
101
|
+
later(200, 260, 0.3, 'sine', 0.08);
|
|
102
|
+
}, [tone, later]);
|
|
81
103
|
/** Level up / achievement — ascending arpeggio */
|
|
82
104
|
const playLevelUp = useCallback(() => {
|
|
83
105
|
tone(523, 0.1, 'sine', 0.12);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, [tone]);
|
|
106
|
+
later(80, 659, 0.1, 'sine', 0.12);
|
|
107
|
+
later(160, 784, 0.1, 'sine', 0.12);
|
|
108
|
+
later(240, 1047, 0.2, 'sine', 0.15);
|
|
109
|
+
}, [tone, later]);
|
|
88
110
|
/** Hard drop / thud — Tetris block landing, bowling throw */
|
|
89
111
|
const playDrop = useCallback(() => {
|
|
90
112
|
tone(150, 0.12, 'triangle', 0.2);
|
|
@@ -92,9 +114,9 @@ export function useGameSounds() {
|
|
|
92
114
|
/** Line clear / combo — satisfying sweep */
|
|
93
115
|
const playClear = useCallback(() => {
|
|
94
116
|
tone(700, 0.08, 'sine', 0.1);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}, [tone]);
|
|
117
|
+
later(50, 900, 0.08, 'sine', 0.1);
|
|
118
|
+
later(100, 1200, 0.12, 'sine', 0.12);
|
|
119
|
+
}, [tone, later]);
|
|
98
120
|
/** Countdown tick — timer warning */
|
|
99
121
|
const playTick = useCallback(() => {
|
|
100
122
|
tone(1000, 0.03, 'square', 0.06);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGameSounds.js","sourceRoot":"","sources":["../src/useGameSounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"useGameSounds.js","sourceRoot":"","sources":["../src/useGameSounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,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AAC;QAClC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAElB,qCAAqC;IACrC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO;QACL,QAAQ;QACR,SAAS;QACT,SAAS;QACT,YAAY;QACZ,WAAW;QACX,QAAQ;QACR,SAAS;QACT,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/dist/useLeaderboard.d.ts
CHANGED
|
@@ -5,7 +5,14 @@ export interface LeaderboardEntry {
|
|
|
5
5
|
avatar_url?: string;
|
|
6
6
|
created_at: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export interface UseLeaderboardOptions {
|
|
9
|
+
/**
|
|
10
|
+
* A day key (YYYY-MM-DD, UTC) for a per-day board, such as a daily puzzle.
|
|
11
|
+
* Omit it for the all-time board.
|
|
12
|
+
*/
|
|
13
|
+
period?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function useLeaderboard(gameId: string, options?: UseLeaderboardOptions): {
|
|
9
16
|
topScores: LeaderboardEntry[];
|
|
10
17
|
recentScores: LeaderboardEntry[];
|
|
11
18
|
submitScore: (score: number) => Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLeaderboard.d.ts","sourceRoot":"","sources":["../src/useLeaderboard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLeaderboard.d.ts","sourceRoot":"","sources":["../src/useLeaderboard.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAoBD,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,qBAA0B,GAClC;IACD,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CA2FA"}
|
package/dist/useLeaderboard.js
CHANGED
|
@@ -3,7 +3,10 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
// The worker also serves the unversioned paths, so games built against older
|
|
4
4
|
// SDK releases keep working.
|
|
5
5
|
const API_BASE = 'https://leaderboard.freegamestore.online/v1';
|
|
6
|
-
|
|
6
|
+
const AUTH_BASE = 'https://auth.freegamestore.online/v1';
|
|
7
|
+
export function useLeaderboard(gameId, options = {}) {
|
|
8
|
+
const period = options.period;
|
|
9
|
+
const periodQuery = period ? `&period=${encodeURIComponent(period)}` : '';
|
|
7
10
|
const [topScores, setTopScores] = useState([]);
|
|
8
11
|
const [recentScores, setRecentScores] = useState([]);
|
|
9
12
|
const [loading, setLoading] = useState(true);
|
|
@@ -24,7 +27,9 @@ export function useLeaderboard(gameId) {
|
|
|
24
27
|
// Fire-and-forget: inner fetches each .catch() to [], so this never
|
|
25
28
|
// rejects; `void` marks the intentional non-await.
|
|
26
29
|
void Promise.all([
|
|
27
|
-
fetch(`${API_BASE}/api/leaderboard/${gameId}?limit=50`, {
|
|
30
|
+
fetch(`${API_BASE}/api/leaderboard/${gameId}?limit=50${periodQuery}`, {
|
|
31
|
+
credentials: 'include',
|
|
32
|
+
})
|
|
28
33
|
.then(async (r) => {
|
|
29
34
|
if (!r.ok)
|
|
30
35
|
return [];
|
|
@@ -32,7 +37,7 @@ export function useLeaderboard(gameId) {
|
|
|
32
37
|
return data.scores ?? [];
|
|
33
38
|
})
|
|
34
39
|
.catch(() => []),
|
|
35
|
-
fetch(`${API_BASE}/api/leaderboard/${gameId}/recent?limit=50`, {
|
|
40
|
+
fetch(`${API_BASE}/api/leaderboard/${gameId}/recent?limit=50${periodQuery}`, {
|
|
36
41
|
credentials: 'include',
|
|
37
42
|
})
|
|
38
43
|
.then(async (r) => {
|
|
@@ -50,20 +55,25 @@ export function useLeaderboard(gameId) {
|
|
|
50
55
|
setRecentScores(recent);
|
|
51
56
|
setLoading(false);
|
|
52
57
|
});
|
|
53
|
-
}, [gameId]);
|
|
58
|
+
}, [gameId, periodQuery]);
|
|
54
59
|
useEffect(() => {
|
|
55
60
|
load();
|
|
56
61
|
}, [load]);
|
|
57
62
|
const submitScore = useCallback(async (score) => {
|
|
58
63
|
try {
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
64
|
+
// Exchange the auth-origin cookie for a five-minute bearer token bound
|
|
65
|
+
// to THIS game. Untrusted game JS never receives a store-wide session,
|
|
66
|
+
// and leaderboard rejects the token for every other game id.
|
|
67
|
+
const handoffRes = await fetch(`${AUTH_BASE}/handoff/issue?target=${encodeURIComponent('https://leaderboard.freegamestore.online')}&game=${encodeURIComponent(gameId)}`, { method: 'POST', credentials: 'include' });
|
|
68
|
+
if (!handoffRes.ok)
|
|
69
|
+
return { ok: false };
|
|
70
|
+
const handoff = (await handoffRes.json());
|
|
71
|
+
if (!handoff.token)
|
|
72
|
+
return { ok: false };
|
|
62
73
|
const res = await fetch(`${API_BASE}/api/scores`, {
|
|
63
74
|
method: 'POST',
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
body: JSON.stringify({ game: gameId, score }),
|
|
75
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${handoff.token}` },
|
|
76
|
+
body: JSON.stringify(period ? { game: gameId, score, period } : { game: gameId, score }),
|
|
67
77
|
});
|
|
68
78
|
if (!res.ok)
|
|
69
79
|
return { ok: false };
|
|
@@ -78,7 +88,7 @@ export function useLeaderboard(gameId) {
|
|
|
78
88
|
catch {
|
|
79
89
|
return { ok: false };
|
|
80
90
|
}
|
|
81
|
-
}, [gameId, load]);
|
|
91
|
+
}, [gameId, period, load]);
|
|
82
92
|
return { topScores, recentScores, submitScore, loading, refresh: load };
|
|
83
93
|
}
|
|
84
94
|
//# sourceMappingURL=useLeaderboard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLeaderboard.js","sourceRoot":"","sources":["../src/useLeaderboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,mFAAmF;AACnF,6EAA6E;AAC7E,6BAA6B;AAC7B,MAAM,QAAQ,GAAG,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"useLeaderboard.js","sourceRoot":"","sources":["../src/useLeaderboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,mFAAmF;AACnF,6EAA6E;AAC7E,6BAA6B;AAC7B,MAAM,QAAQ,GAAG,6CAA6C,CAAC;AAC/D,MAAM,SAAS,GAAG,sCAAsC,CAAC;AAoCzD,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,UAAiC,EAAE;IAQnC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,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OAAO,EAAE,IAAI,EAAE,CAAC;AAC1E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@freegamestore/games",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Shared React UI primitives for games on FreeGameStore — GameShell, GameTopbar, etc. Brand-consistent, scroll-free.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./feel": {
|
|
15
|
+
"types": "./dist/feel/index.d.ts",
|
|
16
|
+
"import": "./dist/feel/index.js"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"homepage": "https://github.com/freegamestore-online/platform#readme",
|
|
@@ -31,7 +35,8 @@
|
|
|
31
35
|
],
|
|
32
36
|
"files": [
|
|
33
37
|
"dist",
|
|
34
|
-
"README.md"
|
|
38
|
+
"README.md",
|
|
39
|
+
"TOKENS.md"
|
|
35
40
|
],
|
|
36
41
|
"engines": {
|
|
37
42
|
"node": ">=22"
|
|
@@ -40,13 +45,23 @@
|
|
|
40
45
|
"react": "^19.0.0"
|
|
41
46
|
},
|
|
42
47
|
"devDependencies": {
|
|
48
|
+
"@testing-library/dom": "^10.4.1",
|
|
49
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
50
|
+
"@testing-library/react": "^16.3.0",
|
|
43
51
|
"@types/react": "^19.2.14",
|
|
44
|
-
"react": "^19.2.
|
|
45
|
-
"
|
|
52
|
+
"@types/react-dom": "^19.2.3",
|
|
53
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
54
|
+
"jsdom": "^26",
|
|
55
|
+
"react": "19.2.6",
|
|
56
|
+
"react-dom": "19.2.6",
|
|
57
|
+
"typescript": "^5.7.0",
|
|
58
|
+
"vite": "^6",
|
|
59
|
+
"vitest": "^2.1.0"
|
|
46
60
|
},
|
|
47
61
|
"sideEffects": false,
|
|
48
62
|
"scripts": {
|
|
49
|
-
"build": "tsc",
|
|
50
|
-
"typecheck": "tsc --noEmit"
|
|
63
|
+
"build": "tsc && cp src/GameTopbar.module.css dist/",
|
|
64
|
+
"typecheck": "tsc --noEmit",
|
|
65
|
+
"test": "vitest run"
|
|
51
66
|
}
|
|
52
67
|
}
|