@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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +33 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +2 -2
- package/src/index.ts +1 -1
- package/src/provider.tsx +26 -6
- package/src/ui/AuthGate.tsx +11 -9
package/dist/index.mjs
CHANGED
|
@@ -421,7 +421,7 @@ var DubsClient = class {
|
|
|
421
421
|
/** Fetch the app's UI customization config (accent color, icon, tagline) */
|
|
422
422
|
async getAppConfig() {
|
|
423
423
|
const res = await this.request("GET", "/apps/config");
|
|
424
|
-
return res.uiConfig || {};
|
|
424
|
+
return res.data?.uiConfig || {};
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
|
|
@@ -1364,7 +1364,7 @@ function AuthGate({
|
|
|
1364
1364
|
);
|
|
1365
1365
|
if (phase === "init") {
|
|
1366
1366
|
if (renderLoading) return /* @__PURE__ */ jsx3(Fragment2, { children: renderLoading("authenticating") });
|
|
1367
|
-
return /* @__PURE__ */ jsx3(DefaultLoadingScreen, { status: "authenticating", appName });
|
|
1367
|
+
return /* @__PURE__ */ jsx3(DefaultLoadingScreen, { status: "authenticating", appName, accentColor });
|
|
1368
1368
|
}
|
|
1369
1369
|
if (auth.status === "authenticated") {
|
|
1370
1370
|
return /* @__PURE__ */ jsx3(AuthContext.Provider, { value: auth, children });
|
|
@@ -1389,13 +1389,14 @@ function AuthGate({
|
|
|
1389
1389
|
}
|
|
1390
1390
|
if (auth.status === "error" && auth.error) {
|
|
1391
1391
|
if (renderError) return /* @__PURE__ */ jsx3(Fragment2, { children: renderError(auth.error, retry) });
|
|
1392
|
-
return /* @__PURE__ */ jsx3(DefaultErrorScreen, { error: auth.error, onRetry: retry, appName });
|
|
1392
|
+
return /* @__PURE__ */ jsx3(DefaultErrorScreen, { error: auth.error, onRetry: retry, appName, accentColor });
|
|
1393
1393
|
}
|
|
1394
1394
|
if (renderLoading) return /* @__PURE__ */ jsx3(Fragment2, { children: renderLoading(auth.status) });
|
|
1395
|
-
return /* @__PURE__ */ jsx3(DefaultLoadingScreen, { status: auth.status, appName });
|
|
1395
|
+
return /* @__PURE__ */ jsx3(DefaultLoadingScreen, { status: auth.status, appName, accentColor });
|
|
1396
1396
|
}
|
|
1397
|
-
function DefaultLoadingScreen({ status, appName }) {
|
|
1397
|
+
function DefaultLoadingScreen({ status, appName, accentColor }) {
|
|
1398
1398
|
const t = useDubsTheme();
|
|
1399
|
+
const accent = accentColor || t.accent;
|
|
1399
1400
|
const statusText = {
|
|
1400
1401
|
idle: "Initializing...",
|
|
1401
1402
|
authenticating: "Connecting...",
|
|
@@ -1408,25 +1409,26 @@ function DefaultLoadingScreen({ status, appName }) {
|
|
|
1408
1409
|
};
|
|
1409
1410
|
return /* @__PURE__ */ jsx3(View2, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ jsxs2(View2, { style: s.centerContent, children: [
|
|
1410
1411
|
/* @__PURE__ */ jsxs2(View2, { style: s.brandingSection, children: [
|
|
1411
|
-
/* @__PURE__ */ jsx3(View2, { style: [s.logoCircle, { backgroundColor:
|
|
1412
|
+
/* @__PURE__ */ jsx3(View2, { style: [s.logoCircle, { backgroundColor: accent }], children: /* @__PURE__ */ jsx3(Text2, { style: s.logoText, children: "D" }) }),
|
|
1412
1413
|
/* @__PURE__ */ jsx3(Text2, { style: [s.appNameText, { color: t.text }], children: appName })
|
|
1413
1414
|
] }),
|
|
1414
1415
|
/* @__PURE__ */ jsxs2(View2, { style: s.loadingSection, children: [
|
|
1415
|
-
/* @__PURE__ */ jsx3(ActivityIndicator2, { size: "large", color:
|
|
1416
|
+
/* @__PURE__ */ jsx3(ActivityIndicator2, { size: "large", color: accent }),
|
|
1416
1417
|
/* @__PURE__ */ jsx3(Text2, { style: [s.statusText, { color: t.textMuted }], children: statusText[status] || "Loading..." })
|
|
1417
1418
|
] })
|
|
1418
1419
|
] }) });
|
|
1419
1420
|
}
|
|
1420
|
-
function DefaultErrorScreen({ error, onRetry, appName }) {
|
|
1421
|
+
function DefaultErrorScreen({ error, onRetry, appName, accentColor }) {
|
|
1421
1422
|
const t = useDubsTheme();
|
|
1423
|
+
const accent = accentColor || t.accent;
|
|
1422
1424
|
return /* @__PURE__ */ jsx3(View2, { style: [s.container, { backgroundColor: t.background }], children: /* @__PURE__ */ jsxs2(View2, { style: s.spreadContent, children: [
|
|
1423
1425
|
/* @__PURE__ */ jsxs2(View2, { style: s.brandingSection, children: [
|
|
1424
|
-
/* @__PURE__ */ jsx3(View2, { style: [s.logoCircle, { backgroundColor:
|
|
1426
|
+
/* @__PURE__ */ jsx3(View2, { style: [s.logoCircle, { backgroundColor: accent }], children: /* @__PURE__ */ jsx3(Text2, { style: s.logoText, children: "D" }) }),
|
|
1425
1427
|
/* @__PURE__ */ jsx3(Text2, { style: [s.appNameText, { color: t.text }], children: appName })
|
|
1426
1428
|
] }),
|
|
1427
1429
|
/* @__PURE__ */ jsxs2(View2, { style: { gap: 16 }, children: [
|
|
1428
1430
|
/* @__PURE__ */ jsx3(View2, { style: [s.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx3(Text2, { style: [s.errorText, { color: t.errorText }], children: error.message }) }),
|
|
1429
|
-
/* @__PURE__ */ jsx3(TouchableOpacity2, { style: [s.primaryBtn, { backgroundColor:
|
|
1431
|
+
/* @__PURE__ */ jsx3(TouchableOpacity2, { style: [s.primaryBtn, { backgroundColor: accent }], onPress: onRetry, activeOpacity: 0.8, children: /* @__PURE__ */ jsx3(Text2, { style: s.primaryBtnText, children: "Try Again" }) })
|
|
1430
1432
|
] })
|
|
1431
1433
|
] }) });
|
|
1432
1434
|
}
|
|
@@ -1816,7 +1818,13 @@ function DubsProvider({
|
|
|
1816
1818
|
const storage = useMemo(() => tokenStorage || createSecureStoreStorage(), [tokenStorage]);
|
|
1817
1819
|
const [uiConfig, setUiConfig] = useState11(null);
|
|
1818
1820
|
useEffect7(() => {
|
|
1819
|
-
client.getAppConfig().then(
|
|
1821
|
+
client.getAppConfig().then((config2) => {
|
|
1822
|
+
console.log("[DubsProvider] UI config loaded:", JSON.stringify(config2));
|
|
1823
|
+
setUiConfig(config2);
|
|
1824
|
+
}).catch((err) => {
|
|
1825
|
+
console.log("[DubsProvider] UI config fetch failed, using defaults:", err?.message);
|
|
1826
|
+
setUiConfig({});
|
|
1827
|
+
});
|
|
1820
1828
|
}, [client]);
|
|
1821
1829
|
if (uiConfig === null) return null;
|
|
1822
1830
|
if (externalWallet) {
|
|
@@ -1834,6 +1842,7 @@ function DubsProvider({
|
|
|
1834
1842
|
renderError,
|
|
1835
1843
|
renderRegistration,
|
|
1836
1844
|
accentColor: uiConfig.accentColor,
|
|
1845
|
+
uiConfig,
|
|
1837
1846
|
children
|
|
1838
1847
|
}
|
|
1839
1848
|
);
|
|
@@ -1861,6 +1870,7 @@ function DubsProvider({
|
|
|
1861
1870
|
renderError,
|
|
1862
1871
|
renderRegistration,
|
|
1863
1872
|
accentColor: uiConfig.accentColor,
|
|
1873
|
+
uiConfig,
|
|
1864
1874
|
children
|
|
1865
1875
|
}
|
|
1866
1876
|
)
|
|
@@ -1878,6 +1888,7 @@ function ManagedInner({
|
|
|
1878
1888
|
renderError,
|
|
1879
1889
|
renderRegistration,
|
|
1880
1890
|
accentColor,
|
|
1891
|
+
uiConfig,
|
|
1881
1892
|
children
|
|
1882
1893
|
}) {
|
|
1883
1894
|
const managedDisconnect = useDisconnect();
|
|
@@ -1886,8 +1897,8 @@ function ManagedInner({
|
|
|
1886
1897
|
await managedDisconnect?.();
|
|
1887
1898
|
}, [client, managedDisconnect]);
|
|
1888
1899
|
const value = useMemo(
|
|
1889
|
-
() => ({ client, wallet, connection, appName, network, disconnect }),
|
|
1890
|
-
[client, wallet, connection, appName, network, disconnect]
|
|
1900
|
+
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
1901
|
+
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
1891
1902
|
);
|
|
1892
1903
|
return /* @__PURE__ */ jsx4(DubsContext.Provider, { value, children: /* @__PURE__ */ jsx4(
|
|
1893
1904
|
AuthGate,
|
|
@@ -1918,6 +1929,7 @@ function ExternalWalletProvider({
|
|
|
1918
1929
|
renderError,
|
|
1919
1930
|
renderRegistration,
|
|
1920
1931
|
accentColor,
|
|
1932
|
+
uiConfig,
|
|
1921
1933
|
children
|
|
1922
1934
|
}) {
|
|
1923
1935
|
const disconnect = useCallback11(async () => {
|
|
@@ -1927,8 +1939,8 @@ function ExternalWalletProvider({
|
|
|
1927
1939
|
await wallet.disconnect?.();
|
|
1928
1940
|
}, [client, storage, wallet]);
|
|
1929
1941
|
const value = useMemo(
|
|
1930
|
-
() => ({ client, wallet, connection, appName, network, disconnect }),
|
|
1931
|
-
[client, wallet, connection, appName, network, disconnect]
|
|
1942
|
+
() => ({ client, wallet, connection, appName, network, disconnect, uiConfig }),
|
|
1943
|
+
[client, wallet, connection, appName, network, disconnect, uiConfig]
|
|
1932
1944
|
);
|
|
1933
1945
|
if (!managed) {
|
|
1934
1946
|
return /* @__PURE__ */ jsx4(DubsContext.Provider, { value, children });
|
|
@@ -1957,6 +1969,10 @@ function useDubs() {
|
|
|
1957
1969
|
}
|
|
1958
1970
|
return ctx;
|
|
1959
1971
|
}
|
|
1972
|
+
function useAppConfig() {
|
|
1973
|
+
const ctx = useContext3(DubsContext);
|
|
1974
|
+
return ctx?.uiConfig || {};
|
|
1975
|
+
}
|
|
1960
1976
|
|
|
1961
1977
|
// src/ui/UserProfileCard.tsx
|
|
1962
1978
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -2670,6 +2686,7 @@ export {
|
|
|
2670
2686
|
mergeTheme,
|
|
2671
2687
|
parseSolanaError,
|
|
2672
2688
|
signAndSendBase64Transaction,
|
|
2689
|
+
useAppConfig,
|
|
2673
2690
|
useAuth,
|
|
2674
2691
|
useClaim,
|
|
2675
2692
|
useCreateGame,
|