@dubsdotapp/expo 0.1.1 → 0.1.2
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 +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +432 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +442 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/ui/AuthGate.tsx +520 -0
- package/src/ui/index.ts +2 -0
package/dist/index.mjs
CHANGED
|
@@ -915,13 +915,16 @@ function useAuth() {
|
|
|
915
915
|
};
|
|
916
916
|
}
|
|
917
917
|
|
|
918
|
-
// src/ui/
|
|
918
|
+
// src/ui/AuthGate.tsx
|
|
919
|
+
import { useState as useState9, useEffect as useEffect5, useRef as useRef2, useCallback as useCallback9 } from "react";
|
|
919
920
|
import {
|
|
920
921
|
View,
|
|
921
922
|
Text,
|
|
923
|
+
TextInput,
|
|
922
924
|
TouchableOpacity,
|
|
923
925
|
ActivityIndicator,
|
|
924
|
-
StyleSheet
|
|
926
|
+
StyleSheet,
|
|
927
|
+
Keyboard
|
|
925
928
|
} from "react-native";
|
|
926
929
|
|
|
927
930
|
// src/ui/theme.ts
|
|
@@ -963,20 +966,206 @@ function useDubsTheme() {
|
|
|
963
966
|
return scheme === "light" ? light : dark;
|
|
964
967
|
}
|
|
965
968
|
|
|
966
|
-
// src/ui/
|
|
967
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
968
|
-
function
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
969
|
+
// src/ui/AuthGate.tsx
|
|
970
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
971
|
+
function AuthGate({
|
|
972
|
+
children,
|
|
973
|
+
onSaveToken,
|
|
974
|
+
onLoadToken,
|
|
975
|
+
renderLoading,
|
|
976
|
+
renderError,
|
|
977
|
+
renderRegistration,
|
|
972
978
|
appName = "Dubs"
|
|
979
|
+
}) {
|
|
980
|
+
const { client } = useDubs();
|
|
981
|
+
const auth = useAuth();
|
|
982
|
+
const [phase, setPhase] = useState9("init");
|
|
983
|
+
const [registrationPhase, setRegistrationPhase] = useState9(false);
|
|
984
|
+
useEffect5(() => {
|
|
985
|
+
let cancelled = false;
|
|
986
|
+
(async () => {
|
|
987
|
+
try {
|
|
988
|
+
const savedToken = await onLoadToken();
|
|
989
|
+
if (cancelled) return;
|
|
990
|
+
if (savedToken) {
|
|
991
|
+
const restored = await auth.restoreSession(savedToken);
|
|
992
|
+
if (cancelled) return;
|
|
993
|
+
if (restored) {
|
|
994
|
+
setPhase("active");
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
await onSaveToken(null);
|
|
998
|
+
}
|
|
999
|
+
if (cancelled) return;
|
|
1000
|
+
setPhase("active");
|
|
1001
|
+
await auth.authenticate();
|
|
1002
|
+
} catch {
|
|
1003
|
+
if (!cancelled) setPhase("active");
|
|
1004
|
+
}
|
|
1005
|
+
})();
|
|
1006
|
+
return () => {
|
|
1007
|
+
cancelled = true;
|
|
1008
|
+
};
|
|
1009
|
+
}, []);
|
|
1010
|
+
useEffect5(() => {
|
|
1011
|
+
if (auth.status === "needsRegistration") {
|
|
1012
|
+
setRegistrationPhase(true);
|
|
1013
|
+
}
|
|
1014
|
+
}, [auth.status]);
|
|
1015
|
+
useEffect5(() => {
|
|
1016
|
+
if (auth.token) {
|
|
1017
|
+
onSaveToken(auth.token);
|
|
1018
|
+
}
|
|
1019
|
+
}, [auth.token]);
|
|
1020
|
+
const retry = useCallback9(() => {
|
|
1021
|
+
setRegistrationPhase(false);
|
|
1022
|
+
auth.reset();
|
|
1023
|
+
auth.authenticate();
|
|
1024
|
+
}, [auth]);
|
|
1025
|
+
const handleRegister = useCallback9(
|
|
1026
|
+
(username, referralCode) => {
|
|
1027
|
+
auth.register(username, referralCode);
|
|
1028
|
+
},
|
|
1029
|
+
[auth]
|
|
1030
|
+
);
|
|
1031
|
+
if (phase === "init") {
|
|
1032
|
+
if (renderLoading) return /* @__PURE__ */ jsx2(Fragment, { children: renderLoading("authenticating") });
|
|
1033
|
+
return /* @__PURE__ */ jsx2(DefaultLoadingScreen, { status: "authenticating", appName });
|
|
1034
|
+
}
|
|
1035
|
+
if (auth.status === "authenticated") {
|
|
1036
|
+
return /* @__PURE__ */ jsx2(Fragment, { children });
|
|
1037
|
+
}
|
|
1038
|
+
if (registrationPhase) {
|
|
1039
|
+
const isRegistering = auth.status === "registering";
|
|
1040
|
+
const regError = auth.status === "error" ? auth.error : null;
|
|
1041
|
+
if (renderRegistration) {
|
|
1042
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: renderRegistration({
|
|
1043
|
+
onRegister: handleRegister,
|
|
1044
|
+
registering: isRegistering,
|
|
1045
|
+
error: regError,
|
|
1046
|
+
client
|
|
1047
|
+
}) });
|
|
1048
|
+
}
|
|
1049
|
+
return /* @__PURE__ */ jsx2(
|
|
1050
|
+
DefaultRegistrationScreen,
|
|
1051
|
+
{
|
|
1052
|
+
onRegister: handleRegister,
|
|
1053
|
+
registering: isRegistering,
|
|
1054
|
+
error: regError,
|
|
1055
|
+
client,
|
|
1056
|
+
appName
|
|
1057
|
+
}
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
if (auth.status === "error" && auth.error) {
|
|
1061
|
+
if (renderError) return /* @__PURE__ */ jsx2(Fragment, { children: renderError(auth.error, retry) });
|
|
1062
|
+
return /* @__PURE__ */ jsx2(DefaultErrorScreen, { error: auth.error, onRetry: retry, appName });
|
|
1063
|
+
}
|
|
1064
|
+
if (renderLoading) return /* @__PURE__ */ jsx2(Fragment, { children: renderLoading(auth.status) });
|
|
1065
|
+
return /* @__PURE__ */ jsx2(DefaultLoadingScreen, { status: auth.status, appName });
|
|
1066
|
+
}
|
|
1067
|
+
function DefaultLoadingScreen({
|
|
1068
|
+
status,
|
|
1069
|
+
appName
|
|
1070
|
+
}) {
|
|
1071
|
+
const t = useDubsTheme();
|
|
1072
|
+
const statusText = {
|
|
1073
|
+
idle: "Initializing...",
|
|
1074
|
+
authenticating: "Connecting...",
|
|
1075
|
+
signing: "Approve in your wallet...",
|
|
1076
|
+
verifying: "Verifying...",
|
|
1077
|
+
registering: "Creating account...",
|
|
1078
|
+
needsRegistration: "Almost there...",
|
|
1079
|
+
authenticated: "Ready!",
|
|
1080
|
+
error: "Something went wrong"
|
|
1081
|
+
};
|
|
1082
|
+
return /* @__PURE__ */ jsx2(View, { style: [styles.container, { backgroundColor: t.background }], children: /* @__PURE__ */ jsxs(View, { style: styles.centerContent, children: [
|
|
1083
|
+
/* @__PURE__ */ jsxs(View, { style: styles.brandingSection, children: [
|
|
1084
|
+
/* @__PURE__ */ jsx2(View, { style: [styles.logoCircle, { backgroundColor: t.accent }], children: /* @__PURE__ */ jsx2(Text, { style: styles.logoText, children: "D" }) }),
|
|
1085
|
+
/* @__PURE__ */ jsx2(Text, { style: [styles.appName, { color: t.text }], children: appName })
|
|
1086
|
+
] }),
|
|
1087
|
+
/* @__PURE__ */ jsxs(View, { style: styles.loadingSection, children: [
|
|
1088
|
+
/* @__PURE__ */ jsx2(ActivityIndicator, { size: "large", color: t.accent }),
|
|
1089
|
+
/* @__PURE__ */ jsx2(Text, { style: [styles.statusText, { color: t.textMuted }], children: statusText[status] || "Loading..." })
|
|
1090
|
+
] })
|
|
1091
|
+
] }) });
|
|
1092
|
+
}
|
|
1093
|
+
function DefaultErrorScreen({
|
|
1094
|
+
error,
|
|
1095
|
+
onRetry,
|
|
1096
|
+
appName
|
|
1097
|
+
}) {
|
|
1098
|
+
const t = useDubsTheme();
|
|
1099
|
+
return /* @__PURE__ */ jsx2(View, { style: [styles.container, { backgroundColor: t.background }], children: /* @__PURE__ */ jsxs(View, { style: styles.spreadContent, children: [
|
|
1100
|
+
/* @__PURE__ */ jsxs(View, { style: styles.brandingSection, children: [
|
|
1101
|
+
/* @__PURE__ */ jsx2(View, { style: [styles.logoCircle, { backgroundColor: t.accent }], children: /* @__PURE__ */ jsx2(Text, { style: styles.logoText, children: "D" }) }),
|
|
1102
|
+
/* @__PURE__ */ jsx2(Text, { style: [styles.appName, { color: t.text }], children: appName })
|
|
1103
|
+
] }),
|
|
1104
|
+
/* @__PURE__ */ jsxs(View, { style: styles.actionSection, children: [
|
|
1105
|
+
/* @__PURE__ */ jsx2(
|
|
1106
|
+
View,
|
|
1107
|
+
{
|
|
1108
|
+
style: [
|
|
1109
|
+
styles.errorBox,
|
|
1110
|
+
{ backgroundColor: t.errorBg, borderColor: t.errorBorder }
|
|
1111
|
+
],
|
|
1112
|
+
children: /* @__PURE__ */ jsx2(Text, { style: [styles.errorText, { color: t.errorText }], children: error.message })
|
|
1113
|
+
}
|
|
1114
|
+
),
|
|
1115
|
+
/* @__PURE__ */ jsx2(
|
|
1116
|
+
TouchableOpacity,
|
|
1117
|
+
{
|
|
1118
|
+
style: [styles.button, { backgroundColor: t.accent }],
|
|
1119
|
+
onPress: onRetry,
|
|
1120
|
+
activeOpacity: 0.8,
|
|
1121
|
+
children: /* @__PURE__ */ jsx2(Text, { style: styles.buttonText, children: "Try Again" })
|
|
1122
|
+
}
|
|
1123
|
+
)
|
|
1124
|
+
] })
|
|
1125
|
+
] }) });
|
|
1126
|
+
}
|
|
1127
|
+
function DefaultRegistrationScreen({
|
|
1128
|
+
onRegister,
|
|
1129
|
+
registering,
|
|
1130
|
+
error,
|
|
1131
|
+
client,
|
|
1132
|
+
appName
|
|
973
1133
|
}) {
|
|
974
1134
|
const t = useDubsTheme();
|
|
975
|
-
|
|
1135
|
+
const [username, setUsername] = useState9("");
|
|
1136
|
+
const [referralCode, setReferralCode] = useState9("");
|
|
1137
|
+
const [checking, setChecking] = useState9(false);
|
|
1138
|
+
const [availability, setAvailability] = useState9(null);
|
|
1139
|
+
const debounceRef = useRef2(null);
|
|
1140
|
+
useEffect5(() => {
|
|
1141
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
1142
|
+
const trimmed = username.trim();
|
|
1143
|
+
if (trimmed.length < 3) {
|
|
1144
|
+
setAvailability(null);
|
|
1145
|
+
setChecking(false);
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
setChecking(true);
|
|
1149
|
+
debounceRef.current = setTimeout(async () => {
|
|
1150
|
+
try {
|
|
1151
|
+
const result = await client.checkUsername(trimmed);
|
|
1152
|
+
setAvailability(result);
|
|
1153
|
+
} catch {
|
|
1154
|
+
setAvailability(null);
|
|
1155
|
+
} finally {
|
|
1156
|
+
setChecking(false);
|
|
1157
|
+
}
|
|
1158
|
+
}, 500);
|
|
1159
|
+
return () => {
|
|
1160
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
1161
|
+
};
|
|
1162
|
+
}, [username, client]);
|
|
1163
|
+
const canSubmit = username.trim().length >= 3 && availability?.available === true && !registering && !checking;
|
|
1164
|
+
return /* @__PURE__ */ jsx2(View, { style: [styles.container, { backgroundColor: t.background }], children: /* @__PURE__ */ jsxs(View, { style: styles.spreadContent, children: [
|
|
976
1165
|
/* @__PURE__ */ jsxs(View, { style: styles.brandingSection, children: [
|
|
977
1166
|
/* @__PURE__ */ jsx2(View, { style: [styles.logoCircle, { backgroundColor: t.accent }], children: /* @__PURE__ */ jsx2(Text, { style: styles.logoText, children: "D" }) }),
|
|
978
1167
|
/* @__PURE__ */ jsx2(Text, { style: [styles.appName, { color: t.text }], children: appName }),
|
|
979
|
-
/* @__PURE__ */ jsx2(Text, { style: [styles.subtitle, { color: t.textMuted }], children: "
|
|
1168
|
+
/* @__PURE__ */ jsx2(Text, { style: [styles.subtitle, { color: t.textMuted }], children: "Choose a username to get started" })
|
|
980
1169
|
] }),
|
|
981
1170
|
/* @__PURE__ */ jsxs(View, { style: styles.actionSection, children: [
|
|
982
1171
|
error ? /* @__PURE__ */ jsx2(
|
|
@@ -986,24 +1175,221 @@ function ConnectWalletScreen({
|
|
|
986
1175
|
styles.errorBox,
|
|
987
1176
|
{ backgroundColor: t.errorBg, borderColor: t.errorBorder }
|
|
988
1177
|
],
|
|
989
|
-
children: /* @__PURE__ */ jsx2(Text, { style: [styles.errorText, { color: t.errorText }], children: error })
|
|
1178
|
+
children: /* @__PURE__ */ jsx2(Text, { style: [styles.errorText, { color: t.errorText }], children: error.message })
|
|
990
1179
|
}
|
|
991
1180
|
) : null,
|
|
1181
|
+
/* @__PURE__ */ jsxs(View, { children: [
|
|
1182
|
+
/* @__PURE__ */ jsx2(
|
|
1183
|
+
TextInput,
|
|
1184
|
+
{
|
|
1185
|
+
style: [
|
|
1186
|
+
styles.input,
|
|
1187
|
+
{
|
|
1188
|
+
backgroundColor: t.surface,
|
|
1189
|
+
color: t.text,
|
|
1190
|
+
borderColor: t.border
|
|
1191
|
+
}
|
|
1192
|
+
],
|
|
1193
|
+
placeholder: "Username",
|
|
1194
|
+
placeholderTextColor: t.textDim,
|
|
1195
|
+
value: username,
|
|
1196
|
+
onChangeText: setUsername,
|
|
1197
|
+
autoCapitalize: "none",
|
|
1198
|
+
autoCorrect: false,
|
|
1199
|
+
editable: !registering
|
|
1200
|
+
}
|
|
1201
|
+
),
|
|
1202
|
+
checking ? /* @__PURE__ */ jsx2(Text, { style: [styles.availabilityHint, { color: t.textDim }], children: "Checking..." }) : availability ? /* @__PURE__ */ jsx2(
|
|
1203
|
+
Text,
|
|
1204
|
+
{
|
|
1205
|
+
style: [
|
|
1206
|
+
styles.availabilityHint,
|
|
1207
|
+
{
|
|
1208
|
+
color: availability.available ? t.success : t.errorText
|
|
1209
|
+
}
|
|
1210
|
+
],
|
|
1211
|
+
children: availability.available ? "Available!" : availability.reason || "Username taken"
|
|
1212
|
+
}
|
|
1213
|
+
) : username.trim().length > 0 && username.trim().length < 3 ? /* @__PURE__ */ jsx2(Text, { style: [styles.availabilityHint, { color: t.textDim }], children: "At least 3 characters" }) : null
|
|
1214
|
+
] }),
|
|
1215
|
+
/* @__PURE__ */ jsx2(
|
|
1216
|
+
TextInput,
|
|
1217
|
+
{
|
|
1218
|
+
style: [
|
|
1219
|
+
styles.input,
|
|
1220
|
+
{
|
|
1221
|
+
backgroundColor: t.surface,
|
|
1222
|
+
color: t.text,
|
|
1223
|
+
borderColor: t.border
|
|
1224
|
+
}
|
|
1225
|
+
],
|
|
1226
|
+
placeholder: "Referral code (optional)",
|
|
1227
|
+
placeholderTextColor: t.textDim,
|
|
1228
|
+
value: referralCode,
|
|
1229
|
+
onChangeText: setReferralCode,
|
|
1230
|
+
autoCapitalize: "none",
|
|
1231
|
+
autoCorrect: false,
|
|
1232
|
+
editable: !registering
|
|
1233
|
+
}
|
|
1234
|
+
),
|
|
992
1235
|
/* @__PURE__ */ jsx2(
|
|
993
1236
|
TouchableOpacity,
|
|
994
1237
|
{
|
|
995
|
-
style: [
|
|
1238
|
+
style: [
|
|
1239
|
+
styles.button,
|
|
1240
|
+
{ backgroundColor: t.accent, opacity: canSubmit ? 1 : 0.5 }
|
|
1241
|
+
],
|
|
1242
|
+
onPress: () => {
|
|
1243
|
+
Keyboard.dismiss();
|
|
1244
|
+
onRegister(username.trim(), referralCode.trim() || void 0);
|
|
1245
|
+
},
|
|
1246
|
+
disabled: !canSubmit,
|
|
1247
|
+
activeOpacity: 0.8,
|
|
1248
|
+
children: registering ? /* @__PURE__ */ jsx2(ActivityIndicator, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ jsx2(Text, { style: styles.buttonText, children: "Create Account" })
|
|
1249
|
+
}
|
|
1250
|
+
)
|
|
1251
|
+
] })
|
|
1252
|
+
] }) });
|
|
1253
|
+
}
|
|
1254
|
+
var styles = StyleSheet.create({
|
|
1255
|
+
container: {
|
|
1256
|
+
flex: 1,
|
|
1257
|
+
justifyContent: "center"
|
|
1258
|
+
},
|
|
1259
|
+
centerContent: {
|
|
1260
|
+
flex: 1,
|
|
1261
|
+
justifyContent: "center",
|
|
1262
|
+
alignItems: "center",
|
|
1263
|
+
paddingHorizontal: 32,
|
|
1264
|
+
gap: 48
|
|
1265
|
+
},
|
|
1266
|
+
spreadContent: {
|
|
1267
|
+
flex: 1,
|
|
1268
|
+
justifyContent: "space-between",
|
|
1269
|
+
paddingHorizontal: 32,
|
|
1270
|
+
paddingTop: 120,
|
|
1271
|
+
paddingBottom: 80
|
|
1272
|
+
},
|
|
1273
|
+
brandingSection: {
|
|
1274
|
+
alignItems: "center",
|
|
1275
|
+
gap: 12
|
|
1276
|
+
},
|
|
1277
|
+
logoCircle: {
|
|
1278
|
+
width: 80,
|
|
1279
|
+
height: 80,
|
|
1280
|
+
borderRadius: 40,
|
|
1281
|
+
justifyContent: "center",
|
|
1282
|
+
alignItems: "center",
|
|
1283
|
+
marginBottom: 8
|
|
1284
|
+
},
|
|
1285
|
+
logoText: {
|
|
1286
|
+
fontSize: 36,
|
|
1287
|
+
fontWeight: "800",
|
|
1288
|
+
color: "#FFFFFF"
|
|
1289
|
+
},
|
|
1290
|
+
appName: {
|
|
1291
|
+
fontSize: 32,
|
|
1292
|
+
fontWeight: "800"
|
|
1293
|
+
},
|
|
1294
|
+
subtitle: {
|
|
1295
|
+
fontSize: 16,
|
|
1296
|
+
textAlign: "center",
|
|
1297
|
+
lineHeight: 22
|
|
1298
|
+
},
|
|
1299
|
+
loadingSection: {
|
|
1300
|
+
alignItems: "center",
|
|
1301
|
+
gap: 16
|
|
1302
|
+
},
|
|
1303
|
+
statusText: {
|
|
1304
|
+
fontSize: 16,
|
|
1305
|
+
textAlign: "center"
|
|
1306
|
+
},
|
|
1307
|
+
actionSection: {
|
|
1308
|
+
gap: 16
|
|
1309
|
+
},
|
|
1310
|
+
errorBox: {
|
|
1311
|
+
borderWidth: 1,
|
|
1312
|
+
borderRadius: 12,
|
|
1313
|
+
paddingHorizontal: 16,
|
|
1314
|
+
paddingVertical: 12
|
|
1315
|
+
},
|
|
1316
|
+
errorText: {
|
|
1317
|
+
fontSize: 14,
|
|
1318
|
+
textAlign: "center"
|
|
1319
|
+
},
|
|
1320
|
+
input: {
|
|
1321
|
+
height: 56,
|
|
1322
|
+
borderRadius: 16,
|
|
1323
|
+
borderWidth: 1,
|
|
1324
|
+
paddingHorizontal: 16,
|
|
1325
|
+
fontSize: 16
|
|
1326
|
+
},
|
|
1327
|
+
availabilityHint: {
|
|
1328
|
+
fontSize: 13,
|
|
1329
|
+
marginTop: 6,
|
|
1330
|
+
paddingLeft: 4
|
|
1331
|
+
},
|
|
1332
|
+
button: {
|
|
1333
|
+
height: 56,
|
|
1334
|
+
borderRadius: 16,
|
|
1335
|
+
justifyContent: "center",
|
|
1336
|
+
alignItems: "center"
|
|
1337
|
+
},
|
|
1338
|
+
buttonText: {
|
|
1339
|
+
color: "#FFFFFF",
|
|
1340
|
+
fontSize: 18,
|
|
1341
|
+
fontWeight: "700"
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1345
|
+
// src/ui/ConnectWalletScreen.tsx
|
|
1346
|
+
import {
|
|
1347
|
+
View as View2,
|
|
1348
|
+
Text as Text2,
|
|
1349
|
+
TouchableOpacity as TouchableOpacity2,
|
|
1350
|
+
ActivityIndicator as ActivityIndicator2,
|
|
1351
|
+
StyleSheet as StyleSheet2
|
|
1352
|
+
} from "react-native";
|
|
1353
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1354
|
+
function ConnectWalletScreen({
|
|
1355
|
+
onConnect,
|
|
1356
|
+
connecting = false,
|
|
1357
|
+
error = null,
|
|
1358
|
+
appName = "Dubs"
|
|
1359
|
+
}) {
|
|
1360
|
+
const t = useDubsTheme();
|
|
1361
|
+
return /* @__PURE__ */ jsx3(View2, { style: [styles2.container, { backgroundColor: t.background }], children: /* @__PURE__ */ jsxs2(View2, { style: styles2.content, children: [
|
|
1362
|
+
/* @__PURE__ */ jsxs2(View2, { style: styles2.brandingSection, children: [
|
|
1363
|
+
/* @__PURE__ */ jsx3(View2, { style: [styles2.logoCircle, { backgroundColor: t.accent }], children: /* @__PURE__ */ jsx3(Text2, { style: styles2.logoText, children: "D" }) }),
|
|
1364
|
+
/* @__PURE__ */ jsx3(Text2, { style: [styles2.appName, { color: t.text }], children: appName }),
|
|
1365
|
+
/* @__PURE__ */ jsx3(Text2, { style: [styles2.subtitle, { color: t.textMuted }], children: "Connect your Solana wallet to get started" })
|
|
1366
|
+
] }),
|
|
1367
|
+
/* @__PURE__ */ jsxs2(View2, { style: styles2.actionSection, children: [
|
|
1368
|
+
error ? /* @__PURE__ */ jsx3(
|
|
1369
|
+
View2,
|
|
1370
|
+
{
|
|
1371
|
+
style: [
|
|
1372
|
+
styles2.errorBox,
|
|
1373
|
+
{ backgroundColor: t.errorBg, borderColor: t.errorBorder }
|
|
1374
|
+
],
|
|
1375
|
+
children: /* @__PURE__ */ jsx3(Text2, { style: [styles2.errorText, { color: t.errorText }], children: error })
|
|
1376
|
+
}
|
|
1377
|
+
) : null,
|
|
1378
|
+
/* @__PURE__ */ jsx3(
|
|
1379
|
+
TouchableOpacity2,
|
|
1380
|
+
{
|
|
1381
|
+
style: [styles2.connectButton, { backgroundColor: t.accent }],
|
|
996
1382
|
onPress: onConnect,
|
|
997
1383
|
disabled: connecting,
|
|
998
1384
|
activeOpacity: 0.8,
|
|
999
|
-
children: connecting ? /* @__PURE__ */
|
|
1385
|
+
children: connecting ? /* @__PURE__ */ jsx3(ActivityIndicator2, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ jsx3(Text2, { style: styles2.connectButtonText, children: "Connect Wallet" })
|
|
1000
1386
|
}
|
|
1001
1387
|
),
|
|
1002
|
-
/* @__PURE__ */
|
|
1388
|
+
/* @__PURE__ */ jsx3(Text2, { style: [styles2.hint, { color: t.textDim }], children: "Phantom, Solflare, or any Solana wallet" })
|
|
1003
1389
|
] })
|
|
1004
1390
|
] }) });
|
|
1005
1391
|
}
|
|
1006
|
-
var
|
|
1392
|
+
var styles2 = StyleSheet2.create({
|
|
1007
1393
|
container: {
|
|
1008
1394
|
flex: 1,
|
|
1009
1395
|
justifyContent: "center"
|
|
@@ -1073,8 +1459,8 @@ var styles = StyleSheet.create({
|
|
|
1073
1459
|
|
|
1074
1460
|
// src/ui/UserProfileCard.tsx
|
|
1075
1461
|
import { useMemo as useMemo2 } from "react";
|
|
1076
|
-
import { View as
|
|
1077
|
-
import { jsx as
|
|
1462
|
+
import { View as View3, Text as Text3, Image, StyleSheet as StyleSheet3 } from "react-native";
|
|
1463
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1078
1464
|
function truncateAddress(address, chars = 4) {
|
|
1079
1465
|
if (address.length <= chars * 2 + 3) return address;
|
|
1080
1466
|
return `${address.slice(0, chars)}...${address.slice(-chars)}`;
|
|
@@ -1096,16 +1482,16 @@ function UserProfileCard({
|
|
|
1096
1482
|
() => avatarUrl || `https://api.dicebear.com/9.x/avataaars/png?seed=${walletAddress}&size=128`,
|
|
1097
1483
|
[avatarUrl, walletAddress]
|
|
1098
1484
|
);
|
|
1099
|
-
return /* @__PURE__ */
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
username ? /* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
memberSince ? /* @__PURE__ */
|
|
1485
|
+
return /* @__PURE__ */ jsxs3(View3, { style: [styles3.card, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
1486
|
+
/* @__PURE__ */ jsx4(Image, { source: { uri: imageUri }, style: styles3.avatar }),
|
|
1487
|
+
/* @__PURE__ */ jsxs3(View3, { style: styles3.info, children: [
|
|
1488
|
+
username ? /* @__PURE__ */ jsx4(Text3, { style: [styles3.username, { color: t.text }], children: username }) : null,
|
|
1489
|
+
/* @__PURE__ */ jsx4(Text3, { style: [styles3.address, { color: t.textMuted }], children: truncateAddress(walletAddress) }),
|
|
1490
|
+
memberSince ? /* @__PURE__ */ jsx4(Text3, { style: [styles3.memberSince, { color: t.textDim }], children: formatMemberSince(memberSince) }) : null
|
|
1105
1491
|
] })
|
|
1106
1492
|
] });
|
|
1107
1493
|
}
|
|
1108
|
-
var
|
|
1494
|
+
var styles3 = StyleSheet3.create({
|
|
1109
1495
|
card: {
|
|
1110
1496
|
flexDirection: "row",
|
|
1111
1497
|
alignItems: "center",
|
|
@@ -1140,14 +1526,14 @@ var styles2 = StyleSheet2.create({
|
|
|
1140
1526
|
|
|
1141
1527
|
// src/ui/SettingsSheet.tsx
|
|
1142
1528
|
import {
|
|
1143
|
-
View as
|
|
1144
|
-
Text as
|
|
1529
|
+
View as View4,
|
|
1530
|
+
Text as Text4,
|
|
1145
1531
|
ScrollView,
|
|
1146
|
-
TouchableOpacity as
|
|
1147
|
-
ActivityIndicator as
|
|
1148
|
-
StyleSheet as
|
|
1532
|
+
TouchableOpacity as TouchableOpacity3,
|
|
1533
|
+
ActivityIndicator as ActivityIndicator3,
|
|
1534
|
+
StyleSheet as StyleSheet4
|
|
1149
1535
|
} from "react-native";
|
|
1150
|
-
import { Fragment, jsx as
|
|
1536
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1151
1537
|
function truncateAddress2(address, chars = 4) {
|
|
1152
1538
|
if (address.length <= chars * 2 + 3) return address;
|
|
1153
1539
|
return `${address.slice(0, chars)}...${address.slice(-chars)}`;
|
|
@@ -1164,13 +1550,13 @@ function SettingsSheet({
|
|
|
1164
1550
|
loggingOut = false
|
|
1165
1551
|
}) {
|
|
1166
1552
|
const t = useDubsTheme();
|
|
1167
|
-
return /* @__PURE__ */
|
|
1553
|
+
return /* @__PURE__ */ jsxs4(
|
|
1168
1554
|
ScrollView,
|
|
1169
1555
|
{
|
|
1170
|
-
style: [
|
|
1171
|
-
contentContainerStyle:
|
|
1556
|
+
style: [styles4.container, { backgroundColor: t.background }],
|
|
1557
|
+
contentContainerStyle: styles4.content,
|
|
1172
1558
|
children: [
|
|
1173
|
-
/* @__PURE__ */
|
|
1559
|
+
/* @__PURE__ */ jsx5(
|
|
1174
1560
|
UserProfileCard,
|
|
1175
1561
|
{
|
|
1176
1562
|
walletAddress,
|
|
@@ -1179,49 +1565,49 @@ function SettingsSheet({
|
|
|
1179
1565
|
memberSince
|
|
1180
1566
|
}
|
|
1181
1567
|
),
|
|
1182
|
-
/* @__PURE__ */
|
|
1183
|
-
onCopyAddress ? /* @__PURE__ */
|
|
1184
|
-
|
|
1568
|
+
/* @__PURE__ */ jsxs4(View4, { style: [styles4.actionsCard, { backgroundColor: t.surface, borderColor: t.border }], children: [
|
|
1569
|
+
onCopyAddress ? /* @__PURE__ */ jsxs4(
|
|
1570
|
+
TouchableOpacity3,
|
|
1185
1571
|
{
|
|
1186
|
-
style:
|
|
1572
|
+
style: styles4.actionRow,
|
|
1187
1573
|
onPress: onCopyAddress,
|
|
1188
1574
|
activeOpacity: 0.7,
|
|
1189
1575
|
children: [
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1576
|
+
/* @__PURE__ */ jsxs4(View4, { style: styles4.actionRowLeft, children: [
|
|
1577
|
+
/* @__PURE__ */ jsx5(Text4, { style: [styles4.actionLabel, { color: t.text }], children: "Wallet Address" }),
|
|
1578
|
+
/* @__PURE__ */ jsx5(Text4, { style: [styles4.actionValue, { color: t.textMuted }], children: truncateAddress2(walletAddress) })
|
|
1193
1579
|
] }),
|
|
1194
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ jsx5(Text4, { style: [styles4.copyLabel, { color: t.accent }], children: "Copy" })
|
|
1195
1581
|
]
|
|
1196
1582
|
}
|
|
1197
1583
|
) : null,
|
|
1198
|
-
onSupport ? /* @__PURE__ */
|
|
1199
|
-
onCopyAddress ? /* @__PURE__ */
|
|
1200
|
-
/* @__PURE__ */
|
|
1201
|
-
|
|
1584
|
+
onSupport ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1585
|
+
onCopyAddress ? /* @__PURE__ */ jsx5(View4, { style: [styles4.separator, { backgroundColor: t.border }] }) : null,
|
|
1586
|
+
/* @__PURE__ */ jsxs4(
|
|
1587
|
+
TouchableOpacity3,
|
|
1202
1588
|
{
|
|
1203
|
-
style:
|
|
1589
|
+
style: styles4.actionRow,
|
|
1204
1590
|
onPress: onSupport,
|
|
1205
1591
|
activeOpacity: 0.7,
|
|
1206
1592
|
children: [
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ jsx5(Text4, { style: [styles4.actionLabel, { color: t.text }], children: "Help & Support" }),
|
|
1594
|
+
/* @__PURE__ */ jsx5(Text4, { style: [styles4.chevron, { color: t.textMuted }], children: "\u203A" })
|
|
1209
1595
|
]
|
|
1210
1596
|
}
|
|
1211
1597
|
)
|
|
1212
1598
|
] }) : null
|
|
1213
1599
|
] }),
|
|
1214
|
-
/* @__PURE__ */
|
|
1215
|
-
|
|
1600
|
+
/* @__PURE__ */ jsx5(
|
|
1601
|
+
TouchableOpacity3,
|
|
1216
1602
|
{
|
|
1217
|
-
style: [
|
|
1603
|
+
style: [styles4.logoutButton, { borderColor: t.live }],
|
|
1218
1604
|
onPress: onLogout,
|
|
1219
1605
|
disabled: loggingOut,
|
|
1220
1606
|
activeOpacity: 0.7,
|
|
1221
|
-
children: loggingOut ? /* @__PURE__ */
|
|
1607
|
+
children: loggingOut ? /* @__PURE__ */ jsx5(ActivityIndicator3, { color: t.live, size: "small" }) : /* @__PURE__ */ jsx5(Text4, { style: [styles4.logoutText, { color: t.live }], children: "Log Out" })
|
|
1222
1608
|
}
|
|
1223
1609
|
),
|
|
1224
|
-
appVersion ? /* @__PURE__ */
|
|
1610
|
+
appVersion ? /* @__PURE__ */ jsxs4(Text4, { style: [styles4.version, { color: t.textDim }], children: [
|
|
1225
1611
|
"v",
|
|
1226
1612
|
appVersion
|
|
1227
1613
|
] }) : null
|
|
@@ -1229,7 +1615,7 @@ function SettingsSheet({
|
|
|
1229
1615
|
}
|
|
1230
1616
|
);
|
|
1231
1617
|
}
|
|
1232
|
-
var
|
|
1618
|
+
var styles4 = StyleSheet4.create({
|
|
1233
1619
|
container: {
|
|
1234
1620
|
flex: 1
|
|
1235
1621
|
},
|
|
@@ -1291,6 +1677,7 @@ var styles3 = StyleSheet3.create({
|
|
|
1291
1677
|
}
|
|
1292
1678
|
});
|
|
1293
1679
|
export {
|
|
1680
|
+
AuthGate,
|
|
1294
1681
|
ConnectWalletScreen,
|
|
1295
1682
|
DEFAULT_BASE_URL,
|
|
1296
1683
|
DEFAULT_RPC_URL,
|