@devrongx/games 0.4.9 → 0.4.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrongx/games",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "Game UI components for sports prediction markets",
5
5
  "license": "MIT",
6
6
  "main": "./src/index.ts",
@@ -158,35 +158,7 @@ export const PreMatchBetsPopup = ({ poolId, matchId: _matchId, match: matchProp
158
158
  draftRestoredRef.current = true;
159
159
  }, [poolId, config, entryData]);
160
160
 
161
- // ── Debounced draft save: persists bets to backend 1s after last change ───
162
161
  const saveDraftTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
163
- useEffect(() => {
164
- if (!poolId || Object.keys(bets).length === 0 || !config) return;
165
- if (saveDraftTimerRef.current) clearTimeout(saveDraftTimerRef.current);
166
- saveDraftTimerRef.current = setTimeout(async () => {
167
- try {
168
- const selections = config.markets
169
- .map((m, mIdx) => {
170
- const b = bets[mIdx];
171
- if (!b || !m.backendChallengeId) return null;
172
- const option = m.options[b.optionIdx];
173
- if (!option) return null;
174
- return {
175
- challenge_id: m.backendChallengeId,
176
- selected_option: option.label.toLowerCase().replace(/\s+/g, "_"),
177
- coin_amount: b.amount,
178
- };
179
- })
180
- .filter((b): b is NonNullable<typeof b> => b !== null);
181
- if (selections.length > 0) {
182
- await saveTDDraftBetsApi(poolId, selections);
183
- }
184
- } catch {
185
- // Silent — draft save is best-effort
186
- }
187
- }, 1000);
188
- return () => { if (saveDraftTimerRef.current) clearTimeout(saveDraftTimerRef.current); };
189
- }, [bets, poolId, config]);
190
162
 
191
163
  // Debounced save triggered from PreMatchQuestions on each option pick
192
164
  const handleQuestionSelectionChange = useCallback((selections: IUserBets) => {