@dubsdotapp/expo 0.2.3 → 0.2.5

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
@@ -468,6 +468,7 @@ interface DubsContextValue {
468
468
  appName: string;
469
469
  network: DubsNetwork;
470
470
  disconnect: () => Promise<void>;
471
+ uiConfig: UiConfig;
471
472
  }
472
473
  interface DubsProviderProps {
473
474
  apiKey: string;
@@ -495,6 +496,7 @@ interface DubsProviderProps {
495
496
  }
496
497
  declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, }: DubsProviderProps): react_jsx_runtime.JSX.Element | null;
497
498
  declare function useDubs(): DubsContextValue;
499
+ declare function useAppConfig(): UiConfig;
498
500
 
499
501
  /** The `transact` function signature from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
500
502
  type MwaTransactFn = (callback: (wallet: any) => Promise<any>) => Promise<any>;
@@ -753,4 +755,4 @@ declare function JoinGameButton({ game, walletAddress, selectedTeam, status, onJ
753
755
  */
754
756
  declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
755
757
 
756
- export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type Opponent, type Pagination, type ParsedError, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
758
+ export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type Opponent, type Pagination, type ParsedError, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
package/dist/index.d.ts CHANGED
@@ -468,6 +468,7 @@ interface DubsContextValue {
468
468
  appName: string;
469
469
  network: DubsNetwork;
470
470
  disconnect: () => Promise<void>;
471
+ uiConfig: UiConfig;
471
472
  }
472
473
  interface DubsProviderProps {
473
474
  apiKey: string;
@@ -495,6 +496,7 @@ interface DubsProviderProps {
495
496
  }
496
497
  declare function DubsProvider({ apiKey, children, appName, network, wallet: externalWallet, tokenStorage, baseUrl: baseUrlOverride, rpcUrl: rpcUrlOverride, renderConnectScreen, renderLoading, renderError, renderRegistration, managed, }: DubsProviderProps): react_jsx_runtime.JSX.Element | null;
497
498
  declare function useDubs(): DubsContextValue;
499
+ declare function useAppConfig(): UiConfig;
498
500
 
499
501
  /** The `transact` function signature from @solana-mobile/mobile-wallet-adapter-protocol-web3js */
500
502
  type MwaTransactFn = (callback: (wallet: any) => Promise<any>) => Promise<any>;
@@ -753,4 +755,4 @@ declare function JoinGameButton({ game, walletAddress, selectedTeam, status, onJ
753
755
  */
754
756
  declare function signAndSendBase64Transaction(base64Tx: string, wallet: WalletAdapter): Promise<string>;
755
757
 
756
- export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type Opponent, type Pagination, type ParsedError, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
758
+ export { AuthGate, type AuthGateProps, type AuthStatus, type AuthenticateParams, type AuthenticateResult, type Bettor, type BuildClaimParams, type BuildClaimResult, type CheckUsernameResult, type ClaimMutationResult, type ConfirmGameParams, type ConfirmGameResult, ConnectWalletScreen, type ConnectWalletScreenProps, type CreateGameMutationResult, type CreateGameParams, type CreateGameResult, DEFAULT_BASE_URL, DEFAULT_RPC_URL, DubsApiError, type DubsAppUser, DubsClient, type DubsClientConfig, type DubsContextValue, type DubsNetwork, DubsProvider, type DubsProviderProps, type DubsPublicUser, type DubsTheme, type DubsUser, type EsportsMatchDetail, type EsportsMatchOpponent, type EsportsMatchResult, type EventMedia, type EventMeta, type EventStream, type GameDetail, type GameListItem, type GameListOpponent, type GameMedia, GamePoster, type GamePosterProps, type GetGamesParams, type GetNetworkGamesParams, type GetUpcomingEventsParams, JoinGameButton, type JoinGameButtonProps, type JoinGameMutationResult, type JoinGameParams, type JoinGameResult, LivePoolsCard, type LivePoolsCardProps, type LiveScore, type LiveScoreCompetitor, type MutationResult, type MutationStatus, type MwaAdapterConfig, type MwaTransactFn, MwaWalletAdapter, NETWORK_CONFIG, type NonceResult, type Opponent, type Pagination, type ParsedError, PickWinnerCard, type PickWinnerCardProps, PlayersCard, type PlayersCardProps, type QueryResult, type RegisterParams, type RegisterResult, type RegistrationScreenProps, SOLANA_PROGRAM_ERRORS, STORAGE_KEYS, SettingsSheet, type SettingsSheetProps, type SolanaErrorCode, type TokenStorage, type UiConfig, type UnifiedEvent, type UseAuthResult, UserProfileCard, type UserProfileCardProps, type ValidateEventResult, type WalletAdapter, createSecureStoreStorage, mergeTheme, parseSolanaError, signAndSendBase64Transaction, useAppConfig, useAuth, useClaim, useCreateGame, useDubs, useDubsTheme, useEvents, useGame, useGames, useJoinGame, useNetworkGames };
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  mergeTheme: () => mergeTheme,
53
53
  parseSolanaError: () => parseSolanaError,
54
54
  signAndSendBase64Transaction: () => signAndSendBase64Transaction,
55
+ useAppConfig: () => useAppConfig,
55
56
  useAuth: () => useAuth,
56
57
  useClaim: () => useClaim,
57
58
  useCreateGame: () => useCreateGame,
@@ -481,7 +482,7 @@ var DubsClient = class {
481
482
  /** Fetch the app's UI customization config (accent color, icon, tagline) */
482
483
  async getAppConfig() {
483
484
  const res = await this.request("GET", "/apps/config");
484
- return res.uiConfig || {};
485
+ return res.data?.uiConfig || {};
485
486
  }
486
487
  };
487
488
 
@@ -1404,7 +1405,7 @@ function AuthGate({
1404
1405
  );
1405
1406
  if (phase === "init") {
1406
1407
  if (renderLoading) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: renderLoading("authenticating") });
1407
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultLoadingScreen, { status: "authenticating", appName });
1408
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultLoadingScreen, { status: "authenticating", appName, accentColor });
1408
1409
  }
1409
1410
  if (auth.status === "authenticated") {
1410
1411
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AuthContext.Provider, { value: auth, children });
@@ -1429,13 +1430,14 @@ function AuthGate({
1429
1430
  }
1430
1431
  if (auth.status === "error" && auth.error) {
1431
1432
  if (renderError) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: renderError(auth.error, retry) });
1432
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultErrorScreen, { error: auth.error, onRetry: retry, appName });
1433
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultErrorScreen, { error: auth.error, onRetry: retry, appName, accentColor });
1433
1434
  }
1434
1435
  if (renderLoading) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: renderLoading(auth.status) });
1435
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultLoadingScreen, { status: auth.status, appName });
1436
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultLoadingScreen, { status: auth.status, appName, accentColor });
1436
1437
  }
1437
- function DefaultLoadingScreen({ status, appName }) {
1438
+ function DefaultLoadingScreen({ status, appName, accentColor }) {
1438
1439
  const t = useDubsTheme();
1440
+ const accent = accentColor || t.accent;
1439
1441
  const statusText = {
1440
1442
  idle: "Initializing...",
1441
1443
  authenticating: "Connecting...",
@@ -1448,25 +1450,26 @@ function DefaultLoadingScreen({ status, appName }) {
1448
1450
  };
1449
1451
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native3.View, { style: s.centerContent, children: [
1450
1452
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native3.View, { style: s.brandingSection, children: [
1451
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [s.logoCircle, { backgroundColor: t.accent }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: s.logoText, children: "D" }) }),
1453
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [s.logoCircle, { backgroundColor: accent }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: s.logoText, children: "D" }) }),
1452
1454
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: [s.appNameText, { color: t.text }], children: appName })
1453
1455
  ] }),
1454
1456
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native3.View, { style: s.loadingSection, children: [
1455
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.ActivityIndicator, { size: "large", color: t.accent }),
1457
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.ActivityIndicator, { size: "large", color: accent }),
1456
1458
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: [s.statusText, { color: t.textMuted }], children: statusText[status] || "Loading..." })
1457
1459
  ] })
1458
1460
  ] }) });
1459
1461
  }
1460
- function DefaultErrorScreen({ error, onRetry, appName }) {
1462
+ function DefaultErrorScreen({ error, onRetry, appName, accentColor }) {
1461
1463
  const t = useDubsTheme();
1464
+ const accent = accentColor || t.accent;
1462
1465
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native3.View, { style: s.spreadContent, children: [
1463
1466
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native3.View, { style: s.brandingSection, children: [
1464
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [s.logoCircle, { backgroundColor: t.accent }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: s.logoText, children: "D" }) }),
1467
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [s.logoCircle, { backgroundColor: accent }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: s.logoText, children: "D" }) }),
1465
1468
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: [s.appNameText, { color: t.text }], children: appName })
1466
1469
  ] }),
1467
1470
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native3.View, { style: { gap: 16 }, children: [
1468
1471
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.View, { style: [s.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: [s.errorText, { color: t.errorText }], children: error.message }) }),
1469
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.TouchableOpacity, { style: [s.primaryBtn, { backgroundColor: t.accent }], onPress: onRetry, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: s.primaryBtnText, children: "Try Again" }) })
1472
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.TouchableOpacity, { style: [s.primaryBtn, { backgroundColor: accent }], onPress: onRetry, activeOpacity: 0.8, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native3.Text, { style: s.primaryBtnText, children: "Try Again" }) })
1470
1473
  ] })
1471
1474
  ] }) });
1472
1475
  }
@@ -1856,7 +1859,13 @@ function DubsProvider({
1856
1859
  const storage = (0, import_react12.useMemo)(() => tokenStorage || createSecureStoreStorage(), [tokenStorage]);
1857
1860
  const [uiConfig, setUiConfig] = (0, import_react12.useState)(null);
1858
1861
  (0, import_react12.useEffect)(() => {
1859
- client.getAppConfig().then(setUiConfig).catch(() => setUiConfig({}));
1862
+ client.getAppConfig().then((config2) => {
1863
+ console.log("[DubsProvider] UI config loaded:", JSON.stringify(config2));
1864
+ setUiConfig(config2);
1865
+ }).catch((err) => {
1866
+ console.log("[DubsProvider] UI config fetch failed, using defaults:", err?.message);
1867
+ setUiConfig({});
1868
+ });
1860
1869
  }, [client]);
1861
1870
  if (uiConfig === null) return null;
1862
1871
  if (externalWallet) {
@@ -1874,6 +1883,7 @@ function DubsProvider({
1874
1883
  renderError,
1875
1884
  renderRegistration,
1876
1885
  accentColor: uiConfig.accentColor,
1886
+ uiConfig,
1877
1887
  children
1878
1888
  }
1879
1889
  );
@@ -1901,6 +1911,7 @@ function DubsProvider({
1901
1911
  renderError,
1902
1912
  renderRegistration,
1903
1913
  accentColor: uiConfig.accentColor,
1914
+ uiConfig,
1904
1915
  children
1905
1916
  }
1906
1917
  )
@@ -1918,6 +1929,7 @@ function ManagedInner({
1918
1929
  renderError,
1919
1930
  renderRegistration,
1920
1931
  accentColor,
1932
+ uiConfig,
1921
1933
  children
1922
1934
  }) {
1923
1935
  const managedDisconnect = useDisconnect();
@@ -1926,8 +1938,8 @@ function ManagedInner({
1926
1938
  await managedDisconnect?.();
1927
1939
  }, [client, managedDisconnect]);
1928
1940
  const value = (0, import_react12.useMemo)(
1929
- () => ({ client, wallet, connection, appName, network, disconnect }),
1930
- [client, wallet, connection, appName, network, disconnect]
1941
+ () => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
1942
+ [client, wallet, connection, appName, network, disconnect, uiConfig]
1931
1943
  );
1932
1944
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DubsContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1933
1945
  AuthGate,
@@ -1958,6 +1970,7 @@ function ExternalWalletProvider({
1958
1970
  renderError,
1959
1971
  renderRegistration,
1960
1972
  accentColor,
1973
+ uiConfig,
1961
1974
  children
1962
1975
  }) {
1963
1976
  const disconnect = (0, import_react12.useCallback)(async () => {
@@ -1967,8 +1980,8 @@ function ExternalWalletProvider({
1967
1980
  await wallet.disconnect?.();
1968
1981
  }, [client, storage, wallet]);
1969
1982
  const value = (0, import_react12.useMemo)(
1970
- () => ({ client, wallet, connection, appName, network, disconnect }),
1971
- [client, wallet, connection, appName, network, disconnect]
1983
+ () => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
1984
+ [client, wallet, connection, appName, network, disconnect, uiConfig]
1972
1985
  );
1973
1986
  if (!managed) {
1974
1987
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DubsContext.Provider, { value, children });
@@ -1997,6 +2010,10 @@ function useDubs() {
1997
2010
  }
1998
2011
  return ctx;
1999
2012
  }
2013
+ function useAppConfig() {
2014
+ const ctx = (0, import_react12.useContext)(DubsContext);
2015
+ return ctx?.uiConfig || {};
2016
+ }
2000
2017
 
2001
2018
  // src/ui/UserProfileCard.tsx
2002
2019
  var import_react13 = require("react");
@@ -2704,6 +2721,7 @@ var styles8 = import_react_native10.StyleSheet.create({
2704
2721
  mergeTheme,
2705
2722
  parseSolanaError,
2706
2723
  signAndSendBase64Transaction,
2724
+ useAppConfig,
2707
2725
  useAuth,
2708
2726
  useClaim,
2709
2727
  useCreateGame,