@dubsdotapp/expo 0.2.44 → 0.2.46

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.mjs CHANGED
@@ -220,6 +220,13 @@ var DubsClient = class {
220
220
  );
221
221
  return res.events;
222
222
  }
223
+ async getUFCFighterDetail(athleteId) {
224
+ const res = await this.request(
225
+ "GET",
226
+ `/ufc/fighters/${encodeURIComponent(athleteId)}`
227
+ );
228
+ return res.fighter;
229
+ }
223
230
  // ── Game Lifecycle ──
224
231
  async validateEvent(id) {
225
232
  const res = await this.request(
@@ -512,7 +519,7 @@ function createSecureStoreStorage() {
512
519
  }
513
520
 
514
521
  // src/provider.tsx
515
- import { createContext as createContext4, useContext as useContext4, useMemo, useCallback as useCallback13, useState as useState14, useEffect as useEffect9 } from "react";
522
+ import { createContext as createContext4, useContext as useContext4, useMemo, useCallback as useCallback14, useState as useState15, useEffect as useEffect10 } from "react";
516
523
 
517
524
  // src/ui/theme.ts
518
525
  import { createContext, useContext } from "react";
@@ -1553,7 +1560,7 @@ function ManagedWalletProvider({
1553
1560
  }
1554
1561
 
1555
1562
  // src/ui/AuthGate.tsx
1556
- import React2, { useState as useState13, useEffect as useEffect8, useRef as useRef3, useCallback as useCallback12 } from "react";
1563
+ import React2, { useState as useState14, useEffect as useEffect9, useRef as useRef3, useCallback as useCallback13 } from "react";
1557
1564
  import {
1558
1565
  View as View2,
1559
1566
  Text as Text2,
@@ -2202,6 +2209,36 @@ function useUFCFightCard() {
2202
2209
  return { data, loading, error, refetch: fetchData };
2203
2210
  }
2204
2211
 
2212
+ // src/hooks/useUFCFighterDetail.ts
2213
+ import { useState as useState13, useEffect as useEffect8, useCallback as useCallback12 } from "react";
2214
+ function useUFCFighterDetail(athleteId) {
2215
+ const { client } = useDubs();
2216
+ const [data, setData] = useState13(null);
2217
+ const [loading, setLoading] = useState13(false);
2218
+ const [error, setError] = useState13(null);
2219
+ const fetchData = useCallback12(async () => {
2220
+ if (!athleteId) {
2221
+ setData(null);
2222
+ setLoading(false);
2223
+ return;
2224
+ }
2225
+ setLoading(true);
2226
+ setError(null);
2227
+ try {
2228
+ const result = await client.getUFCFighterDetail(athleteId);
2229
+ setData(result);
2230
+ } catch (err) {
2231
+ setError(err instanceof Error ? err : new Error(String(err)));
2232
+ } finally {
2233
+ setLoading(false);
2234
+ }
2235
+ }, [client, athleteId]);
2236
+ useEffect8(() => {
2237
+ fetchData();
2238
+ }, [fetchData]);
2239
+ return { data, loading, error, refetch: fetchData };
2240
+ }
2241
+
2205
2242
  // src/ui/AuthGate.tsx
2206
2243
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
2207
2244
  var DICEBEAR_STYLES = [
@@ -2230,9 +2267,9 @@ function AuthGate({
2230
2267
  }) {
2231
2268
  const { client } = useDubs();
2232
2269
  const auth = useAuth();
2233
- const [phase, setPhase] = useState13("init");
2234
- const [registrationPhase, setRegistrationPhase] = useState13(false);
2235
- useEffect8(() => {
2270
+ const [phase, setPhase] = useState14("init");
2271
+ const [registrationPhase, setRegistrationPhase] = useState14(false);
2272
+ useEffect9(() => {
2236
2273
  let cancelled = false;
2237
2274
  (async () => {
2238
2275
  try {
@@ -2258,18 +2295,18 @@ function AuthGate({
2258
2295
  cancelled = true;
2259
2296
  };
2260
2297
  }, []);
2261
- useEffect8(() => {
2298
+ useEffect9(() => {
2262
2299
  if (auth.status === "needsRegistration") setRegistrationPhase(true);
2263
2300
  }, [auth.status]);
2264
- useEffect8(() => {
2301
+ useEffect9(() => {
2265
2302
  if (auth.token) onSaveToken(auth.token);
2266
2303
  }, [auth.token]);
2267
- const retry = useCallback12(() => {
2304
+ const retry = useCallback13(() => {
2268
2305
  setRegistrationPhase(false);
2269
2306
  auth.reset();
2270
2307
  auth.authenticate();
2271
2308
  }, [auth]);
2272
- const handleRegister = useCallback12(
2309
+ const handleRegister = useCallback13(
2273
2310
  (username, referralCode, avatarUrl) => {
2274
2311
  auth.register(username, referralCode, avatarUrl);
2275
2312
  },
@@ -2372,19 +2409,19 @@ function DefaultRegistrationScreen({
2372
2409
  }) {
2373
2410
  const t = useDubsTheme();
2374
2411
  const accent = accentColor || t.accent;
2375
- const [step, setStep] = useState13(0);
2376
- const [avatarSeed, setAvatarSeed] = useState13(generateSeed);
2377
- const [avatarStyle, setAvatarStyle] = useState13("adventurer");
2378
- const [showStyles, setShowStyles] = useState13(false);
2379
- const [username, setUsername] = useState13("");
2380
- const [referralCode, setReferralCode] = useState13("");
2381
- const [checking, setChecking] = useState13(false);
2382
- const [availability, setAvailability] = useState13(null);
2412
+ const [step, setStep] = useState14(0);
2413
+ const [avatarSeed, setAvatarSeed] = useState14(generateSeed);
2414
+ const [avatarStyle, setAvatarStyle] = useState14("adventurer");
2415
+ const [showStyles, setShowStyles] = useState14(false);
2416
+ const [username, setUsername] = useState14("");
2417
+ const [referralCode, setReferralCode] = useState14("");
2418
+ const [checking, setChecking] = useState14(false);
2419
+ const [availability, setAvailability] = useState14(null);
2383
2420
  const debounceRef = useRef3(null);
2384
2421
  const fadeAnim = useRef3(new Animated.Value(1)).current;
2385
2422
  const slideAnim = useRef3(new Animated.Value(0)).current;
2386
2423
  const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed);
2387
- useEffect8(() => {
2424
+ useEffect9(() => {
2388
2425
  if (debounceRef.current) clearTimeout(debounceRef.current);
2389
2426
  const trimmed = username.trim();
2390
2427
  if (trimmed.length < 3) {
@@ -2407,7 +2444,7 @@ function DefaultRegistrationScreen({
2407
2444
  if (debounceRef.current) clearTimeout(debounceRef.current);
2408
2445
  };
2409
2446
  }, [username, client]);
2410
- const animateToStep = useCallback12((newStep) => {
2447
+ const animateToStep = useCallback13((newStep) => {
2411
2448
  const dir = newStep > step ? 1 : -1;
2412
2449
  Keyboard.dismiss();
2413
2450
  Animated.parallel([
@@ -2731,8 +2768,8 @@ function DubsProvider({
2731
2768
  const client = useMemo(() => new DubsClient({ apiKey, baseUrl }), [apiKey, baseUrl]);
2732
2769
  const connection = useMemo(() => new Connection2(rpcUrl, { commitment: "confirmed" }), [rpcUrl]);
2733
2770
  const storage = useMemo(() => tokenStorage || createSecureStoreStorage(), [tokenStorage]);
2734
- const [uiConfig, setUiConfig] = useState14(null);
2735
- useEffect9(() => {
2771
+ const [uiConfig, setUiConfig] = useState15(null);
2772
+ useEffect10(() => {
2736
2773
  client.getAppConfig().then((config2) => {
2737
2774
  console.log("[DubsProvider] UI config loaded:", JSON.stringify(config2));
2738
2775
  setUiConfig(config2);
@@ -2813,7 +2850,7 @@ function ManagedInner({
2813
2850
  children
2814
2851
  }) {
2815
2852
  const managedDisconnect = useDisconnect();
2816
- const disconnect = useCallback13(async () => {
2853
+ const disconnect = useCallback14(async () => {
2817
2854
  client.setToken(null);
2818
2855
  await managedDisconnect?.();
2819
2856
  }, [client, managedDisconnect]);
@@ -2853,7 +2890,7 @@ function ExternalWalletProvider({
2853
2890
  uiConfig,
2854
2891
  children
2855
2892
  }) {
2856
- const disconnect = useCallback13(async () => {
2893
+ const disconnect = useCallback14(async () => {
2857
2894
  client.setToken(null);
2858
2895
  await storage.deleteItem(STORAGE_KEYS.JWT_TOKEN).catch(() => {
2859
2896
  });
@@ -3116,7 +3153,7 @@ var styles3 = StyleSheet4.create({
3116
3153
  });
3117
3154
 
3118
3155
  // src/ui/game/GamePoster.tsx
3119
- import { useState as useState15 } from "react";
3156
+ import { useState as useState16 } from "react";
3120
3157
  import { StyleSheet as StyleSheet5, View as View5, Text as Text5 } from "react-native";
3121
3158
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
3122
3159
  function computeCountdown(lockTimestamp) {
@@ -3166,7 +3203,7 @@ function GamePoster({ game, ImageComponent }) {
3166
3203
  ] });
3167
3204
  }
3168
3205
  function TeamLogoInternal({ url, size, Img }) {
3169
- const [failed, setFailed] = useState15(false);
3206
+ const [failed, setFailed] = useState16(false);
3170
3207
  if (!url || failed) {
3171
3208
  return /* @__PURE__ */ jsx7(View5, { style: [styles4.logoPlaceholder, { width: size, height: size, borderRadius: size / 2 }] });
3172
3209
  }
@@ -3346,7 +3383,7 @@ var styles5 = StyleSheet6.create({
3346
3383
  });
3347
3384
 
3348
3385
  // src/ui/game/PickWinnerCard.tsx
3349
- import { useState as useState16, useMemo as useMemo4 } from "react";
3386
+ import { useState as useState17, useMemo as useMemo4 } from "react";
3350
3387
  import { StyleSheet as StyleSheet7, View as View7, Text as Text7, TouchableOpacity as TouchableOpacity4 } from "react-native";
3351
3388
  import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
3352
3389
  function PickWinnerCard({
@@ -3417,7 +3454,7 @@ function TeamOption({
3417
3454
  ImageComponent,
3418
3455
  t
3419
3456
  }) {
3420
- const [imgFailed, setImgFailed] = useState16(false);
3457
+ const [imgFailed, setImgFailed] = useState17(false);
3421
3458
  const Img = ImageComponent || __require("react-native").Image;
3422
3459
  const showImage = imageUrl && !imgFailed;
3423
3460
  return /* @__PURE__ */ jsxs7(
@@ -3458,7 +3495,7 @@ var styles6 = StyleSheet7.create({
3458
3495
  });
3459
3496
 
3460
3497
  // src/ui/game/PlayersCard.tsx
3461
- import { useState as useState17 } from "react";
3498
+ import { useState as useState18 } from "react";
3462
3499
  import { StyleSheet as StyleSheet8, View as View8, Text as Text8 } from "react-native";
3463
3500
  import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3464
3501
  function truncateWallet(addr, chars) {
@@ -3507,7 +3544,7 @@ function BettorRow({
3507
3544
  ImageComponent,
3508
3545
  t
3509
3546
  }) {
3510
- const [imgFailed, setImgFailed] = useState17(false);
3547
+ const [imgFailed, setImgFailed] = useState18(false);
3511
3548
  const Img = ImageComponent || __require("react-native").Image;
3512
3549
  const showAvatar = bettor.avatar && !imgFailed;
3513
3550
  return /* @__PURE__ */ jsxs8(View8, { style: [styles7.row, !isFirst && { borderTopColor: t.border, borderTopWidth: 1 }], children: [
@@ -3586,7 +3623,7 @@ var styles8 = StyleSheet9.create({
3586
3623
  });
3587
3624
 
3588
3625
  // src/ui/game/CreateCustomGameSheet.tsx
3589
- import { useState as useState18, useEffect as useEffect10, useRef as useRef4, useCallback as useCallback14 } from "react";
3626
+ import { useState as useState19, useEffect as useEffect11, useRef as useRef4, useCallback as useCallback15 } from "react";
3590
3627
  import {
3591
3628
  View as View10,
3592
3629
  Text as Text10,
@@ -3617,23 +3654,24 @@ function CreateCustomGameSheet({
3617
3654
  metadata,
3618
3655
  onAmountChange,
3619
3656
  onSuccess,
3620
- onError
3657
+ onError,
3658
+ isPoolModeEnabled = false
3621
3659
  }) {
3622
3660
  const t = useDubsTheme();
3623
3661
  const { wallet } = useDubs();
3624
3662
  const mutation = useCreateCustomGame();
3625
- const [selectedAmount, setSelectedAmount] = useState18(null);
3626
- const [customAmount, setCustomAmount] = useState18("");
3627
- const [isCustom, setIsCustom] = useState18(false);
3663
+ const [selectedAmount, setSelectedAmount] = useState19(null);
3664
+ const [customAmount, setCustomAmount] = useState19("");
3665
+ const [isCustom, setIsCustom] = useState19(false);
3628
3666
  const overlayOpacity = useRef4(new Animated2.Value(0)).current;
3629
- useEffect10(() => {
3667
+ useEffect11(() => {
3630
3668
  Animated2.timing(overlayOpacity, {
3631
3669
  toValue: visible ? 1 : 0,
3632
3670
  duration: 250,
3633
3671
  useNativeDriver: true
3634
3672
  }).start();
3635
3673
  }, [visible, overlayOpacity]);
3636
- useEffect10(() => {
3674
+ useEffect11(() => {
3637
3675
  if (visible) {
3638
3676
  setSelectedAmount(defaultAmount ?? null);
3639
3677
  setCustomAmount("");
@@ -3641,7 +3679,7 @@ function CreateCustomGameSheet({
3641
3679
  mutation.reset();
3642
3680
  }
3643
3681
  }, [visible]);
3644
- useEffect10(() => {
3682
+ useEffect11(() => {
3645
3683
  if (mutation.status === "success" && mutation.data) {
3646
3684
  onSuccess?.(mutation.data);
3647
3685
  const timer = setTimeout(() => {
@@ -3650,23 +3688,23 @@ function CreateCustomGameSheet({
3650
3688
  return () => clearTimeout(timer);
3651
3689
  }
3652
3690
  }, [mutation.status, mutation.data]);
3653
- useEffect10(() => {
3691
+ useEffect11(() => {
3654
3692
  if (mutation.status === "error" && mutation.error) {
3655
3693
  onError?.(mutation.error);
3656
3694
  }
3657
3695
  }, [mutation.status, mutation.error]);
3658
- const handlePresetSelect = useCallback14((amount) => {
3696
+ const handlePresetSelect = useCallback15((amount) => {
3659
3697
  setSelectedAmount(amount);
3660
3698
  setIsCustom(false);
3661
3699
  setCustomAmount("");
3662
3700
  onAmountChange?.(amount);
3663
3701
  }, [onAmountChange]);
3664
- const handleCustomSelect = useCallback14(() => {
3702
+ const handleCustomSelect = useCallback15(() => {
3665
3703
  setIsCustom(true);
3666
3704
  setSelectedAmount(null);
3667
3705
  onAmountChange?.(null);
3668
3706
  }, [onAmountChange]);
3669
- const handleCustomAmountChange = useCallback14((text) => {
3707
+ const handleCustomAmountChange = useCallback15((text) => {
3670
3708
  const cleaned = text.replace(/[^0-9.]/g, "").replace(/(\..*?)\..*/g, "$1");
3671
3709
  setCustomAmount(cleaned);
3672
3710
  const parsed = parseFloat(cleaned);
@@ -3676,24 +3714,25 @@ function CreateCustomGameSheet({
3676
3714
  }, [onAmountChange]);
3677
3715
  const effectiveAmount = selectedAmount;
3678
3716
  const playerCount = maxPlayers || 2;
3679
- const pot = effectiveAmount ? effectiveAmount * playerCount : 0;
3717
+ const finalAmount = isPoolModeEnabled ? defaultAmount ?? 0.1 : effectiveAmount;
3718
+ const pot = finalAmount ? finalAmount * playerCount : 0;
3680
3719
  const winnerTakes = pot * (1 - fee / 100);
3681
3720
  const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
3682
- const canCreate = effectiveAmount !== null && effectiveAmount > 0 && !isMutating && mutation.status !== "success";
3683
- const handleCreate = useCallback14(async () => {
3684
- if (!effectiveAmount || !wallet.publicKey) return;
3721
+ const canCreate = finalAmount !== null && finalAmount > 0 && !isMutating && mutation.status !== "success";
3722
+ const handleCreate = useCallback15(async () => {
3723
+ if (!finalAmount || !wallet.publicKey) return;
3685
3724
  try {
3686
3725
  await mutation.execute({
3687
3726
  playerWallet: wallet.publicKey.toBase58(),
3688
3727
  teamChoice: "home",
3689
- wagerAmount: effectiveAmount,
3728
+ wagerAmount: finalAmount,
3690
3729
  title,
3691
3730
  maxPlayers,
3692
3731
  metadata
3693
3732
  });
3694
3733
  } catch {
3695
3734
  }
3696
- }, [effectiveAmount, wallet.publicKey, mutation.execute, title, maxPlayers, metadata]);
3735
+ }, [finalAmount, wallet.publicKey, mutation.execute, title, maxPlayers, metadata]);
3697
3736
  const statusLabel = STATUS_LABELS2[mutation.status] || "";
3698
3737
  const playersLabel = playerCount === 2 ? "2 (1v1)" : `${playerCount} players`;
3699
3738
  return /* @__PURE__ */ jsxs10(
@@ -3713,10 +3752,10 @@ function CreateCustomGameSheet({
3713
3752
  children: /* @__PURE__ */ jsx12(View10, { style: styles9.sheetPositioner, children: /* @__PURE__ */ jsxs10(View10, { style: [styles9.sheet, { backgroundColor: t.background }], children: [
3714
3753
  /* @__PURE__ */ jsx12(View10, { style: styles9.handleRow, children: /* @__PURE__ */ jsx12(View10, { style: [styles9.handle, { backgroundColor: t.textMuted }] }) }),
3715
3754
  /* @__PURE__ */ jsxs10(View10, { style: styles9.header, children: [
3716
- /* @__PURE__ */ jsx12(Text10, { style: [styles9.headerTitle, { color: t.text }], children: "New Game" }),
3755
+ /* @__PURE__ */ jsx12(Text10, { style: [styles9.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Create Pool" : "New Game" }),
3717
3756
  /* @__PURE__ */ jsx12(TouchableOpacity6, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx12(Text10, { style: [styles9.closeButton, { color: t.textMuted }], children: "\u2715" }) })
3718
3757
  ] }),
3719
- /* @__PURE__ */ jsxs10(View10, { style: styles9.section, children: [
3758
+ !isPoolModeEnabled && /* @__PURE__ */ jsxs10(View10, { style: styles9.section, children: [
3720
3759
  /* @__PURE__ */ jsx12(Text10, { style: [styles9.sectionLabel, { color: t.textSecondary }], children: "Buy-In Amount" }),
3721
3760
  /* @__PURE__ */ jsxs10(View10, { style: styles9.chipsRow, children: [
3722
3761
  presetAmounts.map((amount) => {
@@ -3768,20 +3807,20 @@ function CreateCustomGameSheet({
3768
3807
  ] }),
3769
3808
  /* @__PURE__ */ jsxs10(View10, { style: [styles9.summaryCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
3770
3809
  /* @__PURE__ */ jsxs10(View10, { style: styles9.summaryRow, children: [
3771
- /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryLabel, { color: t.textMuted }], children: "Your buy-in" }),
3772
- /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryValue, { color: t.text }], children: effectiveAmount ? `${effectiveAmount} SOL` : "\u2014" })
3810
+ /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryLabel, { color: t.textMuted }], children: "Buy-in" }),
3811
+ /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryValue, { color: t.text }], children: finalAmount ? `${finalAmount} SOL` : "\u2014" })
3773
3812
  ] }),
3774
3813
  /* @__PURE__ */ jsx12(View10, { style: [styles9.summarySep, { backgroundColor: t.border }] }),
3775
3814
  /* @__PURE__ */ jsxs10(View10, { style: styles9.summaryRow, children: [
3776
- /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryLabel, { color: t.textMuted }], children: "Players" }),
3777
- /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryValue, { color: t.text }], children: playersLabel })
3815
+ /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max players" : "Players" }),
3816
+ /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryValue, { color: t.text }], children: isPoolModeEnabled ? playerCount : playersLabel })
3778
3817
  ] }),
3779
3818
  /* @__PURE__ */ jsx12(View10, { style: [styles9.summarySep, { backgroundColor: t.border }] }),
3780
3819
  /* @__PURE__ */ jsxs10(View10, { style: styles9.summaryRow, children: [
3781
- /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryLabel, { color: t.textMuted }], children: "Winner Takes" }),
3820
+ /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryLabel, { color: t.textMuted }], children: isPoolModeEnabled ? "Max pot" : "Winner Takes" }),
3782
3821
  /* @__PURE__ */ jsxs10(View10, { style: styles9.winnerCol, children: [
3783
- /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryValue, { color: t.success }], children: effectiveAmount ? `${winnerTakes.toFixed(4)} SOL` : "\u2014" }),
3784
- effectiveAmount ? /* @__PURE__ */ jsxs10(Text10, { style: [styles9.feeNote, { color: t.textDim }], children: [
3822
+ /* @__PURE__ */ jsx12(Text10, { style: [styles9.summaryValue, { color: t.success }], children: finalAmount ? `${(finalAmount * playerCount * (1 - fee / 100)).toFixed(4)} SOL` : "\u2014" }),
3823
+ finalAmount ? /* @__PURE__ */ jsxs10(Text10, { style: [styles9.feeNote, { color: t.textDim }], children: [
3785
3824
  fee,
3786
3825
  "% platform fee"
3787
3826
  ] }) : null
@@ -3802,7 +3841,7 @@ function CreateCustomGameSheet({
3802
3841
  children: isMutating ? /* @__PURE__ */ jsxs10(View10, { style: styles9.ctaLoading, children: [
3803
3842
  /* @__PURE__ */ jsx12(ActivityIndicator5, { size: "small", color: "#FFFFFF" }),
3804
3843
  /* @__PURE__ */ jsx12(Text10, { style: styles9.ctaText, children: statusLabel })
3805
- ] }) : mutation.status === "success" ? /* @__PURE__ */ jsx12(Text10, { style: styles9.ctaText, children: STATUS_LABELS2.success }) : /* @__PURE__ */ jsx12(Text10, { style: [styles9.ctaText, !canCreate && { opacity: 0.5 }], children: effectiveAmount ? `Create Game \u2014 ${effectiveAmount} SOL` : "Select buy-in amount" })
3844
+ ] }) : mutation.status === "success" ? /* @__PURE__ */ jsx12(Text10, { style: styles9.ctaText, children: isPoolModeEnabled ? "Pool Created!" : STATUS_LABELS2.success }) : /* @__PURE__ */ jsx12(Text10, { style: [styles9.ctaText, !canCreate && { opacity: 0.5 }], children: isPoolModeEnabled ? `Create Pool \u2014 ${finalAmount} SOL` : effectiveAmount ? `Create Game \u2014 ${effectiveAmount} SOL` : "Select buy-in amount" })
3806
3845
  }
3807
3846
  )
3808
3847
  ] }) })
@@ -3949,7 +3988,7 @@ var styles9 = StyleSheet10.create({
3949
3988
  });
3950
3989
 
3951
3990
  // src/ui/game/JoinGameSheet.tsx
3952
- import { useState as useState19, useEffect as useEffect11, useRef as useRef5, useCallback as useCallback15, useMemo as useMemo6 } from "react";
3991
+ import { useState as useState20, useEffect as useEffect12, useRef as useRef5, useCallback as useCallback16, useMemo as useMemo6 } from "react";
3953
3992
  import {
3954
3993
  View as View11,
3955
3994
  Text as Text11,
@@ -3961,7 +4000,7 @@ import {
3961
4000
  KeyboardAvoidingView as KeyboardAvoidingView3,
3962
4001
  Platform as Platform5
3963
4002
  } from "react-native";
3964
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
4003
+ import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3965
4004
  var STATUS_LABELS3 = {
3966
4005
  building: "Building transaction...",
3967
4006
  signing: "Approve in wallet...",
@@ -3978,28 +4017,29 @@ function JoinGameSheet({
3978
4017
  homeColor = "#3B82F6",
3979
4018
  awayColor = "#EF4444",
3980
4019
  onSuccess,
3981
- onError
4020
+ onError,
4021
+ isPoolModeEnabled = false
3982
4022
  }) {
3983
4023
  const t = useDubsTheme();
3984
4024
  const { wallet } = useDubs();
3985
4025
  const mutation = useJoinGame();
3986
4026
  const isCustomGame = game.gameMode === CUSTOM_GAME_MODE;
3987
- const [selectedTeam, setSelectedTeam] = useState19(null);
4027
+ const [selectedTeam, setSelectedTeam] = useState20(null);
3988
4028
  const overlayOpacity = useRef5(new Animated3.Value(0)).current;
3989
- useEffect11(() => {
4029
+ useEffect12(() => {
3990
4030
  Animated3.timing(overlayOpacity, {
3991
4031
  toValue: visible ? 1 : 0,
3992
4032
  duration: 250,
3993
4033
  useNativeDriver: true
3994
4034
  }).start();
3995
4035
  }, [visible, overlayOpacity]);
3996
- useEffect11(() => {
4036
+ useEffect12(() => {
3997
4037
  if (visible) {
3998
- setSelectedTeam(isCustomGame ? "away" : null);
4038
+ setSelectedTeam(isPoolModeEnabled ? "home" : isCustomGame ? "away" : null);
3999
4039
  mutation.reset();
4000
4040
  }
4001
4041
  }, [visible]);
4002
- useEffect11(() => {
4042
+ useEffect12(() => {
4003
4043
  if (mutation.status === "success" && mutation.data) {
4004
4044
  onSuccess?.(mutation.data);
4005
4045
  const timer = setTimeout(() => {
@@ -4008,7 +4048,7 @@ function JoinGameSheet({
4008
4048
  return () => clearTimeout(timer);
4009
4049
  }
4010
4050
  }, [mutation.status, mutation.data]);
4011
- useEffect11(() => {
4051
+ useEffect12(() => {
4012
4052
  if (mutation.status === "error" && mutation.error) {
4013
4053
  onError?.(mutation.error);
4014
4054
  }
@@ -4038,7 +4078,7 @@ function JoinGameSheet({
4038
4078
  }, [bettors, wallet.publicKey]);
4039
4079
  const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
4040
4080
  const canJoin = selectedTeam !== null && !isMutating && mutation.status !== "success" && !alreadyJoined;
4041
- const handleJoin = useCallback15(async () => {
4081
+ const handleJoin = useCallback16(async () => {
4042
4082
  if (!selectedTeam || !wallet.publicKey) return;
4043
4083
  try {
4044
4084
  await mutation.execute({
@@ -4068,10 +4108,10 @@ function JoinGameSheet({
4068
4108
  children: /* @__PURE__ */ jsx13(View11, { style: styles10.sheetPositioner, children: /* @__PURE__ */ jsxs11(View11, { style: [styles10.sheet, { backgroundColor: t.background }], children: [
4069
4109
  /* @__PURE__ */ jsx13(View11, { style: styles10.handleRow, children: /* @__PURE__ */ jsx13(View11, { style: [styles10.handle, { backgroundColor: t.textMuted }] }) }),
4070
4110
  /* @__PURE__ */ jsxs11(View11, { style: styles10.header, children: [
4071
- /* @__PURE__ */ jsx13(Text11, { style: [styles10.headerTitle, { color: t.text }], children: "Join Game" }),
4111
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.headerTitle, { color: t.text }], children: isPoolModeEnabled ? "Join Pool" : "Join Game" }),
4072
4112
  /* @__PURE__ */ jsx13(TouchableOpacity7, { onPress: onDismiss, activeOpacity: 0.8, children: /* @__PURE__ */ jsx13(Text11, { style: [styles10.closeButton, { color: t.textMuted }], children: "\u2715" }) })
4073
4113
  ] }),
4074
- !isCustomGame && /* @__PURE__ */ jsxs11(View11, { style: styles10.section, children: [
4114
+ !isCustomGame && !isPoolModeEnabled && /* @__PURE__ */ jsxs11(View11, { style: styles10.section, children: [
4075
4115
  /* @__PURE__ */ jsx13(Text11, { style: [styles10.sectionLabel, { color: t.textSecondary }], children: "Pick Your Side" }),
4076
4116
  /* @__PURE__ */ jsxs11(View11, { style: styles10.teamsRow, children: [
4077
4117
  /* @__PURE__ */ jsx13(
@@ -4113,25 +4153,40 @@ function JoinGameSheet({
4113
4153
  ] })
4114
4154
  ] }),
4115
4155
  /* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
4116
- /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4117
- /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Your side" }),
4118
- /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.text }], children: selectedName })
4119
- ] }),
4120
- /* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
4121
- /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4122
- /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
4123
- /* @__PURE__ */ jsxs11(Text11, { style: [styles10.summaryValue, { color: t.text }], children: [
4124
- poolAfterJoin,
4125
- " SOL"
4156
+ isPoolModeEnabled ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
4157
+ /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4158
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Players in" }),
4159
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.text }], children: bettors.length })
4160
+ ] }),
4161
+ /* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
4162
+ /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4163
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Current pot" }),
4164
+ /* @__PURE__ */ jsxs11(Text11, { style: [styles10.summaryValue, { color: t.success }], children: [
4165
+ totalPool,
4166
+ " SOL"
4167
+ ] })
4168
+ ] })
4169
+ ] }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
4170
+ /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4171
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Your side" }),
4172
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.text }], children: selectedName })
4173
+ ] }),
4174
+ /* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
4175
+ /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4176
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Total pool" }),
4177
+ /* @__PURE__ */ jsxs11(Text11, { style: [styles10.summaryValue, { color: t.text }], children: [
4178
+ poolAfterJoin,
4179
+ " SOL"
4180
+ ] })
4181
+ ] }),
4182
+ /* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
4183
+ /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4184
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Potential winnings" }),
4185
+ /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.success }], children: potentialWinnings !== "\u2014" ? `${potentialWinnings} SOL` : "\u2014" })
4126
4186
  ] })
4127
- ] }),
4128
- /* @__PURE__ */ jsx13(View11, { style: [styles10.summarySep, { backgroundColor: t.border }] }),
4129
- /* @__PURE__ */ jsxs11(View11, { style: styles10.summaryRow, children: [
4130
- /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryLabel, { color: t.textMuted }], children: "Potential winnings" }),
4131
- /* @__PURE__ */ jsx13(Text11, { style: [styles10.summaryValue, { color: t.success }], children: potentialWinnings !== "\u2014" ? `${potentialWinnings} SOL` : "\u2014" })
4132
4187
  ] })
4133
4188
  ] }),
4134
- alreadyJoined && /* @__PURE__ */ jsx13(View11, { style: [styles10.errorBox, { backgroundColor: t.surface, borderColor: t.border }], children: /* @__PURE__ */ jsx13(Text11, { style: [styles10.errorText, { color: t.textMuted }], children: "You've already joined this game." }) }),
4189
+ alreadyJoined && /* @__PURE__ */ jsx13(View11, { style: [styles10.errorBox, { backgroundColor: t.surface, borderColor: t.border }], children: /* @__PURE__ */ jsx13(Text11, { style: [styles10.errorText, { color: t.textMuted }], children: isPoolModeEnabled ? "You've already joined this pool." : "You've already joined this game." }) }),
4135
4190
  mutation.error && /* @__PURE__ */ jsx13(View11, { style: [styles10.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx13(Text11, { style: [styles10.errorText, { color: t.errorText }], children: mutation.error.message }) }),
4136
4191
  /* @__PURE__ */ jsx13(
4137
4192
  TouchableOpacity7,
@@ -4146,7 +4201,7 @@ function JoinGameSheet({
4146
4201
  children: isMutating ? /* @__PURE__ */ jsxs11(View11, { style: styles10.ctaLoading, children: [
4147
4202
  /* @__PURE__ */ jsx13(ActivityIndicator6, { size: "small", color: "#FFFFFF" }),
4148
4203
  /* @__PURE__ */ jsx13(Text11, { style: styles10.ctaText, children: statusLabel })
4149
- ] }) : mutation.status === "success" ? /* @__PURE__ */ jsx13(Text11, { style: styles10.ctaText, children: STATUS_LABELS3.success }) : /* @__PURE__ */ jsx13(Text11, { style: [styles10.ctaText, !canJoin && { opacity: 0.5 }], children: alreadyJoined ? "Already Joined" : selectedTeam ? `Join Game \u2014 ${buyIn} SOL` : "Pick a side to join" })
4204
+ ] }) : mutation.status === "success" ? /* @__PURE__ */ jsx13(Text11, { style: styles10.ctaText, children: isPoolModeEnabled ? "Joined!" : STATUS_LABELS3.success }) : /* @__PURE__ */ jsx13(Text11, { style: [styles10.ctaText, !canJoin && { opacity: 0.5 }], children: alreadyJoined ? "Already Joined" : isPoolModeEnabled ? `Join Pool \u2014 ${buyIn} SOL` : selectedTeam ? `Join Game \u2014 ${buyIn} SOL` : "Pick a side to join" })
4150
4205
  }
4151
4206
  )
4152
4207
  ] }) })
@@ -4167,7 +4222,7 @@ function TeamButton({
4167
4222
  ImageComponent,
4168
4223
  t
4169
4224
  }) {
4170
- const [imgFailed, setImgFailed] = useState19(false);
4225
+ const [imgFailed, setImgFailed] = useState20(false);
4171
4226
  const Img = ImageComponent || __require("react-native").Image;
4172
4227
  const showImage = imageUrl && !imgFailed;
4173
4228
  return /* @__PURE__ */ jsxs11(
@@ -4344,7 +4399,7 @@ var styles10 = StyleSheet11.create({
4344
4399
  });
4345
4400
 
4346
4401
  // src/ui/game/ClaimPrizeSheet.tsx
4347
- import { useState as useState20, useEffect as useEffect12, useRef as useRef6, useCallback as useCallback16 } from "react";
4402
+ import { useState as useState21, useEffect as useEffect13, useRef as useRef6, useCallback as useCallback17 } from "react";
4348
4403
  import {
4349
4404
  View as View12,
4350
4405
  Text as Text12,
@@ -4378,15 +4433,15 @@ function ClaimPrizeSheet({
4378
4433
  const overlayOpacity = useRef6(new Animated4.Value(0)).current;
4379
4434
  const celebrationScale = useRef6(new Animated4.Value(0)).current;
4380
4435
  const celebrationOpacity = useRef6(new Animated4.Value(0)).current;
4381
- const [showCelebration, setShowCelebration] = useState20(false);
4382
- useEffect12(() => {
4436
+ const [showCelebration, setShowCelebration] = useState21(false);
4437
+ useEffect13(() => {
4383
4438
  Animated4.timing(overlayOpacity, {
4384
4439
  toValue: visible ? 1 : 0,
4385
4440
  duration: 250,
4386
4441
  useNativeDriver: true
4387
4442
  }).start();
4388
4443
  }, [visible, overlayOpacity]);
4389
- useEffect12(() => {
4444
+ useEffect13(() => {
4390
4445
  if (visible) {
4391
4446
  mutation.reset();
4392
4447
  setShowCelebration(false);
@@ -4394,7 +4449,7 @@ function ClaimPrizeSheet({
4394
4449
  celebrationOpacity.setValue(0);
4395
4450
  }
4396
4451
  }, [visible]);
4397
- useEffect12(() => {
4452
+ useEffect13(() => {
4398
4453
  if (mutation.status === "success" && mutation.data) {
4399
4454
  setShowCelebration(true);
4400
4455
  Animated4.parallel([
@@ -4417,14 +4472,14 @@ function ClaimPrizeSheet({
4417
4472
  return () => clearTimeout(timer);
4418
4473
  }
4419
4474
  }, [mutation.status, mutation.data]);
4420
- useEffect12(() => {
4475
+ useEffect13(() => {
4421
4476
  if (mutation.status === "error" && mutation.error) {
4422
4477
  onError?.(mutation.error);
4423
4478
  }
4424
4479
  }, [mutation.status, mutation.error]);
4425
4480
  const isMutating = mutation.status !== "idle" && mutation.status !== "success" && mutation.status !== "error";
4426
4481
  const canClaim = !isMutating && mutation.status !== "success" && !!wallet.publicKey;
4427
- const handleClaim = useCallback16(async () => {
4482
+ const handleClaim = useCallback17(async () => {
4428
4483
  if (!wallet.publicKey) return;
4429
4484
  try {
4430
4485
  await mutation.execute({
@@ -4657,15 +4712,15 @@ var styles11 = StyleSheet12.create({
4657
4712
  });
4658
4713
 
4659
4714
  // src/ui/game/ClaimButton.tsx
4660
- import { useState as useState21, useMemo as useMemo7, useCallback as useCallback17 } from "react";
4715
+ import { useState as useState22, useMemo as useMemo7, useCallback as useCallback18 } from "react";
4661
4716
  import { StyleSheet as StyleSheet13, Text as Text13, TouchableOpacity as TouchableOpacity9 } from "react-native";
4662
- import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
4717
+ import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
4663
4718
  function ClaimButton({ gameId, style, onSuccess, onError }) {
4664
4719
  const t = useDubsTheme();
4665
4720
  const { wallet } = useDubs();
4666
4721
  const game = useGame(gameId);
4667
4722
  const claimStatus = useHasClaimed(gameId);
4668
- const [sheetVisible, setSheetVisible] = useState21(false);
4723
+ const [sheetVisible, setSheetVisible] = useState22(false);
4669
4724
  const walletAddress = wallet.publicKey?.toBase58() ?? null;
4670
4725
  const myBet = useMemo7(() => {
4671
4726
  if (!walletAddress || !game.data?.bettors) return null;
@@ -4676,7 +4731,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
4676
4731
  const isWinner = isResolved && myBet != null && myBet.team === game.data?.winnerSide;
4677
4732
  const isEligible = myBet != null && isResolved && (isWinner || isRefund);
4678
4733
  const prizeAmount = isRefund ? myBet?.amount ?? 0 : game.data?.totalPool ?? 0;
4679
- const handleSuccess = useCallback17(
4734
+ const handleSuccess = useCallback18(
4680
4735
  (result) => {
4681
4736
  claimStatus.refetch();
4682
4737
  onSuccess?.(result);
@@ -4705,7 +4760,7 @@ function ClaimButton({ gameId, style, onSuccess, onError }) {
4705
4760
  if (!isEligible) {
4706
4761
  return null;
4707
4762
  }
4708
- return /* @__PURE__ */ jsxs13(Fragment4, { children: [
4763
+ return /* @__PURE__ */ jsxs13(Fragment5, { children: [
4709
4764
  /* @__PURE__ */ jsx15(
4710
4765
  TouchableOpacity9,
4711
4766
  {
@@ -4804,6 +4859,7 @@ export {
4804
4859
  useHasClaimed,
4805
4860
  useJoinGame,
4806
4861
  useNetworkGames,
4807
- useUFCFightCard
4862
+ useUFCFightCard,
4863
+ useUFCFighterDetail
4808
4864
  };
4809
4865
  //# sourceMappingURL=index.mjs.map