@reverbia/sdk 1.0.0-next.20260111202106 → 1.0.0-next.20260114030517
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/expo/index.cjs +36 -131
- package/dist/expo/index.d.mts +1 -131
- package/dist/expo/index.d.ts +1 -131
- package/dist/expo/index.mjs +33 -127
- package/dist/index.cjs +12 -28
- package/dist/index.d.mts +54 -254
- package/dist/index.d.ts +54 -254
- package/dist/index.mjs +12 -26
- package/dist/react/index.cjs +82 -273
- package/dist/react/index.d.mts +1 -245
- package/dist/react/index.d.ts +1 -245
- package/dist/react/index.mjs +72 -261
- package/package.json +2 -2
package/dist/react/index.cjs
CHANGED
|
@@ -136,12 +136,10 @@ __export(index_exports, {
|
|
|
136
136
|
useGoogleDriveBackup: () => useGoogleDriveBackup,
|
|
137
137
|
useICloudAuth: () => useICloudAuth,
|
|
138
138
|
useICloudBackup: () => useICloudBackup,
|
|
139
|
-
useImageGeneration: () => useImageGeneration,
|
|
140
139
|
useMemoryStorage: () => useMemoryStorage,
|
|
141
140
|
useModels: () => useModels,
|
|
142
141
|
useOCR: () => useOCR,
|
|
143
142
|
usePdf: () => usePdf,
|
|
144
|
-
useSearch: () => useSearch,
|
|
145
143
|
useSettings: () => useSettings,
|
|
146
144
|
userPreferencesStorageSchema: () => userPreferencesStorageSchema,
|
|
147
145
|
writeEncryptedFile: () => writeEncryptedFile
|
|
@@ -5075,7 +5073,7 @@ async function updateMemoryEmbeddingOp(ctx, id, embedding, embeddingModel) {
|
|
|
5075
5073
|
// src/lib/memory/service.ts
|
|
5076
5074
|
var FACT_EXTRACTION_PROMPT = `You are a memory extraction system. Extract durable user memories from chat messages.
|
|
5077
5075
|
|
|
5078
|
-
CRITICAL: You MUST respond with ONLY valid JSON. No explanations, no markdown, no code blocks, just pure JSON.
|
|
5076
|
+
CRITICAL: You MUST respond with ONLY valid JSON. No explanations, no markdown, no code blocks, just pure JSON. Every field must have a value, no null or undefined or empty values.
|
|
5079
5077
|
|
|
5080
5078
|
Only store clear, factual statements that might be relevant for future context or reference. Extract facts that will be useful in future conversations, such as identity, stable preferences, ongoing projects, skills, locations, favorites, and constraints.
|
|
5081
5079
|
|
|
@@ -5212,32 +5210,12 @@ var postApiV1Embeddings = (options) => {
|
|
|
5212
5210
|
}
|
|
5213
5211
|
});
|
|
5214
5212
|
};
|
|
5215
|
-
var postApiV1ImagesGenerations = (options) => {
|
|
5216
|
-
return (options.client ?? client).post({
|
|
5217
|
-
url: "/api/v1/images/generations",
|
|
5218
|
-
...options,
|
|
5219
|
-
headers: {
|
|
5220
|
-
"Content-Type": "application/json",
|
|
5221
|
-
...options.headers
|
|
5222
|
-
}
|
|
5223
|
-
});
|
|
5224
|
-
};
|
|
5225
5213
|
var getApiV1Models = (options) => {
|
|
5226
5214
|
return (options?.client ?? client).get({
|
|
5227
5215
|
url: "/api/v1/models",
|
|
5228
5216
|
...options
|
|
5229
5217
|
});
|
|
5230
5218
|
};
|
|
5231
|
-
var postApiV1Search = (options) => {
|
|
5232
|
-
return (options.client ?? client).post({
|
|
5233
|
-
url: "/api/v1/search",
|
|
5234
|
-
...options,
|
|
5235
|
-
headers: {
|
|
5236
|
-
"Content-Type": "application/json",
|
|
5237
|
-
...options.headers
|
|
5238
|
-
}
|
|
5239
|
-
});
|
|
5240
|
-
};
|
|
5241
5219
|
var postAuthOauthByProviderExchange = (options) => {
|
|
5242
5220
|
return (options.client ?? client).post({
|
|
5243
5221
|
url: "/auth/oauth/{provider}/exchange",
|
|
@@ -5384,8 +5362,7 @@ function useMemoryStorage(options) {
|
|
|
5384
5362
|
content: [{ type: "text", text: m.content }]
|
|
5385
5363
|
}))
|
|
5386
5364
|
],
|
|
5387
|
-
model: model || completionsModel
|
|
5388
|
-
tool_choice: "none"
|
|
5365
|
+
model: model || completionsModel
|
|
5389
5366
|
},
|
|
5390
5367
|
headers: {
|
|
5391
5368
|
Authorization: `Bearer ${token}`
|
|
@@ -6710,172 +6687,6 @@ function useModels(options = {}) {
|
|
|
6710
6687
|
};
|
|
6711
6688
|
}
|
|
6712
6689
|
|
|
6713
|
-
// src/react/useSearch.ts
|
|
6714
|
-
var import_react8 = require("react");
|
|
6715
|
-
function useSearch(options = {}) {
|
|
6716
|
-
const { getToken, baseUrl = BASE_URL, onError } = options;
|
|
6717
|
-
const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
|
|
6718
|
-
const [results, setResults] = (0, import_react8.useState)(null);
|
|
6719
|
-
const [response, setResponse] = (0, import_react8.useState)(null);
|
|
6720
|
-
const [error, setError] = (0, import_react8.useState)(null);
|
|
6721
|
-
const abortControllerRef = (0, import_react8.useRef)(null);
|
|
6722
|
-
(0, import_react8.useEffect)(() => {
|
|
6723
|
-
return () => {
|
|
6724
|
-
if (abortControllerRef.current) {
|
|
6725
|
-
abortControllerRef.current.abort();
|
|
6726
|
-
abortControllerRef.current = null;
|
|
6727
|
-
}
|
|
6728
|
-
};
|
|
6729
|
-
}, []);
|
|
6730
|
-
const search = (0, import_react8.useCallback)(
|
|
6731
|
-
async (query, searchOptions = {}) => {
|
|
6732
|
-
if (abortControllerRef.current) {
|
|
6733
|
-
abortControllerRef.current.abort();
|
|
6734
|
-
}
|
|
6735
|
-
const abortController = new AbortController();
|
|
6736
|
-
abortControllerRef.current = abortController;
|
|
6737
|
-
setIsLoading(true);
|
|
6738
|
-
setError(null);
|
|
6739
|
-
setResults(null);
|
|
6740
|
-
setResponse(null);
|
|
6741
|
-
try {
|
|
6742
|
-
let token;
|
|
6743
|
-
if (getToken) {
|
|
6744
|
-
token = await getToken() ?? void 0;
|
|
6745
|
-
}
|
|
6746
|
-
if (abortController.signal.aborted) return null;
|
|
6747
|
-
const queryArray = Array.isArray(query) ? query : [query];
|
|
6748
|
-
const res = await postApiV1Search({
|
|
6749
|
-
baseUrl,
|
|
6750
|
-
body: {
|
|
6751
|
-
query: queryArray,
|
|
6752
|
-
...searchOptions
|
|
6753
|
-
},
|
|
6754
|
-
headers: token ? {
|
|
6755
|
-
Authorization: `Bearer ${token}`
|
|
6756
|
-
} : void 0,
|
|
6757
|
-
signal: abortController.signal
|
|
6758
|
-
});
|
|
6759
|
-
if (res.error) {
|
|
6760
|
-
const errorMsg = res.error.error || res.error.message || "Failed to perform search";
|
|
6761
|
-
throw new Error(errorMsg);
|
|
6762
|
-
}
|
|
6763
|
-
if (res.data) {
|
|
6764
|
-
setResponse(res.data);
|
|
6765
|
-
setResults(res.data.results || []);
|
|
6766
|
-
return res.data;
|
|
6767
|
-
}
|
|
6768
|
-
return null;
|
|
6769
|
-
} catch (err) {
|
|
6770
|
-
if (err instanceof Error && err.name === "AbortError") {
|
|
6771
|
-
return null;
|
|
6772
|
-
}
|
|
6773
|
-
const errorObj = err instanceof Error ? err : new Error(String(err));
|
|
6774
|
-
setError(errorObj);
|
|
6775
|
-
if (onError) {
|
|
6776
|
-
onError(errorObj);
|
|
6777
|
-
}
|
|
6778
|
-
return null;
|
|
6779
|
-
} finally {
|
|
6780
|
-
if (abortControllerRef.current === abortController) {
|
|
6781
|
-
setIsLoading(false);
|
|
6782
|
-
abortControllerRef.current = null;
|
|
6783
|
-
}
|
|
6784
|
-
}
|
|
6785
|
-
},
|
|
6786
|
-
[baseUrl, getToken, onError]
|
|
6787
|
-
);
|
|
6788
|
-
return {
|
|
6789
|
-
isLoading,
|
|
6790
|
-
search,
|
|
6791
|
-
results,
|
|
6792
|
-
response,
|
|
6793
|
-
error
|
|
6794
|
-
};
|
|
6795
|
-
}
|
|
6796
|
-
|
|
6797
|
-
// src/react/useImageGeneration.ts
|
|
6798
|
-
var import_react9 = require("react");
|
|
6799
|
-
function useImageGeneration(options = {}) {
|
|
6800
|
-
const { getToken, baseUrl = BASE_URL, onFinish, onError } = options;
|
|
6801
|
-
const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
|
|
6802
|
-
const abortControllerRef = (0, import_react9.useRef)(null);
|
|
6803
|
-
(0, import_react9.useEffect)(() => {
|
|
6804
|
-
return () => {
|
|
6805
|
-
if (abortControllerRef.current) {
|
|
6806
|
-
abortControllerRef.current.abort();
|
|
6807
|
-
abortControllerRef.current = null;
|
|
6808
|
-
}
|
|
6809
|
-
};
|
|
6810
|
-
}, []);
|
|
6811
|
-
const stop = (0, import_react9.useCallback)(() => {
|
|
6812
|
-
if (abortControllerRef.current) {
|
|
6813
|
-
abortControllerRef.current.abort();
|
|
6814
|
-
abortControllerRef.current = null;
|
|
6815
|
-
}
|
|
6816
|
-
}, []);
|
|
6817
|
-
const generateImage = (0, import_react9.useCallback)(
|
|
6818
|
-
async (args) => {
|
|
6819
|
-
if (abortControllerRef.current) {
|
|
6820
|
-
abortControllerRef.current.abort();
|
|
6821
|
-
}
|
|
6822
|
-
const abortController = new AbortController();
|
|
6823
|
-
abortControllerRef.current = abortController;
|
|
6824
|
-
setIsLoading(true);
|
|
6825
|
-
try {
|
|
6826
|
-
if (!getToken) {
|
|
6827
|
-
throw new Error("Token getter function is required.");
|
|
6828
|
-
}
|
|
6829
|
-
const token = await getToken();
|
|
6830
|
-
if (!token) {
|
|
6831
|
-
throw new Error("No access token available.");
|
|
6832
|
-
}
|
|
6833
|
-
const response = await postApiV1ImagesGenerations({
|
|
6834
|
-
baseUrl,
|
|
6835
|
-
body: args,
|
|
6836
|
-
headers: {
|
|
6837
|
-
Authorization: `Bearer ${token}`
|
|
6838
|
-
},
|
|
6839
|
-
signal: abortController.signal
|
|
6840
|
-
});
|
|
6841
|
-
if (response.error) {
|
|
6842
|
-
const errorMsg = response.error.error || "Failed to generate image";
|
|
6843
|
-
throw new Error(errorMsg);
|
|
6844
|
-
}
|
|
6845
|
-
if (!response.data) {
|
|
6846
|
-
throw new Error("No data received from image generation API");
|
|
6847
|
-
}
|
|
6848
|
-
const result = response.data;
|
|
6849
|
-
if (onFinish) {
|
|
6850
|
-
onFinish(result);
|
|
6851
|
-
}
|
|
6852
|
-
return { data: result, error: null };
|
|
6853
|
-
} catch (err) {
|
|
6854
|
-
if (err instanceof Error && err.name === "AbortError") {
|
|
6855
|
-
return { data: null, error: "Request aborted" };
|
|
6856
|
-
}
|
|
6857
|
-
const errorMsg = err instanceof Error ? err.message : "Failed to generate image.";
|
|
6858
|
-
const errorObj = err instanceof Error ? err : new Error(errorMsg);
|
|
6859
|
-
if (onError) {
|
|
6860
|
-
onError(errorObj);
|
|
6861
|
-
}
|
|
6862
|
-
return { data: null, error: errorMsg };
|
|
6863
|
-
} finally {
|
|
6864
|
-
if (abortControllerRef.current === abortController) {
|
|
6865
|
-
setIsLoading(false);
|
|
6866
|
-
abortControllerRef.current = null;
|
|
6867
|
-
}
|
|
6868
|
-
}
|
|
6869
|
-
},
|
|
6870
|
-
[getToken, baseUrl, onFinish, onError]
|
|
6871
|
-
);
|
|
6872
|
-
return {
|
|
6873
|
-
isLoading,
|
|
6874
|
-
generateImage,
|
|
6875
|
-
stop
|
|
6876
|
-
};
|
|
6877
|
-
}
|
|
6878
|
-
|
|
6879
6690
|
// src/lib/memory/chat.ts
|
|
6880
6691
|
var formatMemoriesForChat = (memories, format = "compact") => {
|
|
6881
6692
|
if (memories.length === 0) {
|
|
@@ -6932,7 +6743,7 @@ var extractConversationContext = (messages, maxMessages = 3) => {
|
|
|
6932
6743
|
};
|
|
6933
6744
|
|
|
6934
6745
|
// src/react/useDropboxBackup.ts
|
|
6935
|
-
var
|
|
6746
|
+
var import_react9 = require("react");
|
|
6936
6747
|
|
|
6937
6748
|
// src/lib/backup/dropbox/api.ts
|
|
6938
6749
|
var DROPBOX_API_URL = "https://api.dropboxapi.com/2";
|
|
@@ -7177,7 +6988,7 @@ async function performDropboxImport(userAddress, token, deps, onProgress, backup
|
|
|
7177
6988
|
}
|
|
7178
6989
|
|
|
7179
6990
|
// src/react/useDropboxAuth.ts
|
|
7180
|
-
var
|
|
6991
|
+
var import_react8 = require("react");
|
|
7181
6992
|
|
|
7182
6993
|
// src/lib/backup/oauth/storage.ts
|
|
7183
6994
|
var STORAGE_KEY_PREFIX = "oauth_token_";
|
|
@@ -7496,7 +7307,7 @@ async function hasDropboxCredentials(walletAddress) {
|
|
|
7496
7307
|
}
|
|
7497
7308
|
|
|
7498
7309
|
// src/react/useDropboxAuth.ts
|
|
7499
|
-
var DropboxAuthContext = (0,
|
|
7310
|
+
var DropboxAuthContext = (0, import_react8.createContext)(null);
|
|
7500
7311
|
function DropboxAuthProvider({
|
|
7501
7312
|
appKey,
|
|
7502
7313
|
callbackPath = "/auth/dropbox/callback",
|
|
@@ -7504,9 +7315,9 @@ function DropboxAuthProvider({
|
|
|
7504
7315
|
walletAddress,
|
|
7505
7316
|
children
|
|
7506
7317
|
}) {
|
|
7507
|
-
const [accessToken, setAccessToken] = (0,
|
|
7318
|
+
const [accessToken, setAccessToken] = (0, import_react8.useState)(null);
|
|
7508
7319
|
const isConfigured = !!appKey;
|
|
7509
|
-
(0,
|
|
7320
|
+
(0, import_react8.useEffect)(() => {
|
|
7510
7321
|
const checkStoredToken = async () => {
|
|
7511
7322
|
if (walletAddress) {
|
|
7512
7323
|
await migrateUnencryptedTokens("dropbox", walletAddress);
|
|
@@ -7520,7 +7331,7 @@ function DropboxAuthProvider({
|
|
|
7520
7331
|
};
|
|
7521
7332
|
checkStoredToken();
|
|
7522
7333
|
}, [apiClient, walletAddress]);
|
|
7523
|
-
(0,
|
|
7334
|
+
(0, import_react8.useEffect)(() => {
|
|
7524
7335
|
if (!isConfigured) return;
|
|
7525
7336
|
const handleCallback = async () => {
|
|
7526
7337
|
if (isDropboxCallback()) {
|
|
@@ -7540,14 +7351,14 @@ function DropboxAuthProvider({
|
|
|
7540
7351
|
};
|
|
7541
7352
|
handleCallback();
|
|
7542
7353
|
}, [callbackPath, isConfigured, apiClient, walletAddress]);
|
|
7543
|
-
const refreshTokenFn = (0,
|
|
7354
|
+
const refreshTokenFn = (0, import_react8.useCallback)(async () => {
|
|
7544
7355
|
const token = await getDropboxAccessToken(apiClient, walletAddress);
|
|
7545
7356
|
if (token) {
|
|
7546
7357
|
setAccessToken(token);
|
|
7547
7358
|
}
|
|
7548
7359
|
return token;
|
|
7549
7360
|
}, [apiClient, walletAddress]);
|
|
7550
|
-
const requestAccess = (0,
|
|
7361
|
+
const requestAccess = (0, import_react8.useCallback)(async () => {
|
|
7551
7362
|
if (!isConfigured || !appKey) {
|
|
7552
7363
|
throw new Error("Dropbox is not configured");
|
|
7553
7364
|
}
|
|
@@ -7568,11 +7379,11 @@ function DropboxAuthProvider({
|
|
|
7568
7379
|
apiClient,
|
|
7569
7380
|
walletAddress
|
|
7570
7381
|
]);
|
|
7571
|
-
const logout = (0,
|
|
7382
|
+
const logout = (0, import_react8.useCallback)(async () => {
|
|
7572
7383
|
await revokeDropboxToken(apiClient, walletAddress);
|
|
7573
7384
|
setAccessToken(null);
|
|
7574
7385
|
}, [apiClient, walletAddress]);
|
|
7575
|
-
return (0,
|
|
7386
|
+
return (0, import_react8.createElement)(
|
|
7576
7387
|
DropboxAuthContext.Provider,
|
|
7577
7388
|
{
|
|
7578
7389
|
value: {
|
|
@@ -7588,7 +7399,7 @@ function DropboxAuthProvider({
|
|
|
7588
7399
|
);
|
|
7589
7400
|
}
|
|
7590
7401
|
function useDropboxAuth() {
|
|
7591
|
-
const context = (0,
|
|
7402
|
+
const context = (0, import_react8.useContext)(DropboxAuthContext);
|
|
7592
7403
|
if (!context) {
|
|
7593
7404
|
throw new Error("useDropboxAuth must be used within DropboxAuthProvider");
|
|
7594
7405
|
}
|
|
@@ -7610,7 +7421,7 @@ function useDropboxBackup(options) {
|
|
|
7610
7421
|
isConfigured: isDropboxConfigured,
|
|
7611
7422
|
requestAccess: requestDropboxAccess
|
|
7612
7423
|
} = useDropboxAuth();
|
|
7613
|
-
const deps = (0,
|
|
7424
|
+
const deps = (0, import_react9.useMemo)(
|
|
7614
7425
|
() => ({
|
|
7615
7426
|
requestDropboxAccess,
|
|
7616
7427
|
requestEncryptionKey: requestEncryptionKey2,
|
|
@@ -7619,7 +7430,7 @@ function useDropboxBackup(options) {
|
|
|
7619
7430
|
}),
|
|
7620
7431
|
[requestDropboxAccess, requestEncryptionKey2, exportConversation, importConversation]
|
|
7621
7432
|
);
|
|
7622
|
-
const ensureToken = (0,
|
|
7433
|
+
const ensureToken = (0, import_react9.useCallback)(async () => {
|
|
7623
7434
|
if (dropboxToken) return dropboxToken;
|
|
7624
7435
|
try {
|
|
7625
7436
|
return await requestDropboxAccess();
|
|
@@ -7627,7 +7438,7 @@ function useDropboxBackup(options) {
|
|
|
7627
7438
|
return null;
|
|
7628
7439
|
}
|
|
7629
7440
|
}, [dropboxToken, requestDropboxAccess]);
|
|
7630
|
-
const backup = (0,
|
|
7441
|
+
const backup = (0, import_react9.useCallback)(
|
|
7631
7442
|
async (backupOptions) => {
|
|
7632
7443
|
if (!userAddress) {
|
|
7633
7444
|
return { error: "Please sign in to backup to Dropbox" };
|
|
@@ -7653,7 +7464,7 @@ function useDropboxBackup(options) {
|
|
|
7653
7464
|
},
|
|
7654
7465
|
[database, userAddress, ensureToken, deps, backupFolder]
|
|
7655
7466
|
);
|
|
7656
|
-
const restore = (0,
|
|
7467
|
+
const restore = (0, import_react9.useCallback)(
|
|
7657
7468
|
async (restoreOptions) => {
|
|
7658
7469
|
if (!userAddress) {
|
|
7659
7470
|
return { error: "Please sign in to restore from Dropbox" };
|
|
@@ -7687,7 +7498,7 @@ function useDropboxBackup(options) {
|
|
|
7687
7498
|
}
|
|
7688
7499
|
|
|
7689
7500
|
// src/react/useGoogleDriveAuth.ts
|
|
7690
|
-
var
|
|
7501
|
+
var import_react10 = require("react");
|
|
7691
7502
|
|
|
7692
7503
|
// src/lib/backup/google/auth.ts
|
|
7693
7504
|
var PROVIDER2 = "google-drive";
|
|
@@ -7909,7 +7720,7 @@ async function hasGoogleDriveCredentials(walletAddress) {
|
|
|
7909
7720
|
}
|
|
7910
7721
|
|
|
7911
7722
|
// src/react/useGoogleDriveAuth.ts
|
|
7912
|
-
var GoogleDriveAuthContext = (0,
|
|
7723
|
+
var GoogleDriveAuthContext = (0, import_react10.createContext)(null);
|
|
7913
7724
|
function GoogleDriveAuthProvider({
|
|
7914
7725
|
clientId,
|
|
7915
7726
|
callbackPath = "/auth/google/callback",
|
|
@@ -7917,9 +7728,9 @@ function GoogleDriveAuthProvider({
|
|
|
7917
7728
|
walletAddress,
|
|
7918
7729
|
children
|
|
7919
7730
|
}) {
|
|
7920
|
-
const [accessToken, setAccessToken] = (0,
|
|
7731
|
+
const [accessToken, setAccessToken] = (0, import_react10.useState)(null);
|
|
7921
7732
|
const isConfigured = !!clientId;
|
|
7922
|
-
(0,
|
|
7733
|
+
(0, import_react10.useEffect)(() => {
|
|
7923
7734
|
const checkStoredToken = async () => {
|
|
7924
7735
|
if (walletAddress) {
|
|
7925
7736
|
await migrateUnencryptedTokens("google-drive", walletAddress);
|
|
@@ -7933,7 +7744,7 @@ function GoogleDriveAuthProvider({
|
|
|
7933
7744
|
};
|
|
7934
7745
|
checkStoredToken();
|
|
7935
7746
|
}, [apiClient, walletAddress]);
|
|
7936
|
-
(0,
|
|
7747
|
+
(0, import_react10.useEffect)(() => {
|
|
7937
7748
|
if (!isConfigured) return;
|
|
7938
7749
|
const handleCallback = async () => {
|
|
7939
7750
|
if (isGoogleDriveCallback()) {
|
|
@@ -7953,14 +7764,14 @@ function GoogleDriveAuthProvider({
|
|
|
7953
7764
|
};
|
|
7954
7765
|
handleCallback();
|
|
7955
7766
|
}, [callbackPath, isConfigured, apiClient, walletAddress]);
|
|
7956
|
-
const refreshTokenFn = (0,
|
|
7767
|
+
const refreshTokenFn = (0, import_react10.useCallback)(async () => {
|
|
7957
7768
|
const token = await getGoogleDriveAccessToken(apiClient, walletAddress);
|
|
7958
7769
|
if (token) {
|
|
7959
7770
|
setAccessToken(token);
|
|
7960
7771
|
}
|
|
7961
7772
|
return token;
|
|
7962
7773
|
}, [apiClient, walletAddress]);
|
|
7963
|
-
const requestAccess = (0,
|
|
7774
|
+
const requestAccess = (0, import_react10.useCallback)(async () => {
|
|
7964
7775
|
if (!isConfigured || !clientId) {
|
|
7965
7776
|
throw new Error("Google Drive is not configured");
|
|
7966
7777
|
}
|
|
@@ -7984,11 +7795,11 @@ function GoogleDriveAuthProvider({
|
|
|
7984
7795
|
apiClient,
|
|
7985
7796
|
walletAddress
|
|
7986
7797
|
]);
|
|
7987
|
-
const logout = (0,
|
|
7798
|
+
const logout = (0, import_react10.useCallback)(async () => {
|
|
7988
7799
|
await revokeGoogleDriveToken(apiClient, walletAddress);
|
|
7989
7800
|
setAccessToken(null);
|
|
7990
7801
|
}, [apiClient, walletAddress]);
|
|
7991
|
-
return (0,
|
|
7802
|
+
return (0, import_react10.createElement)(
|
|
7992
7803
|
GoogleDriveAuthContext.Provider,
|
|
7993
7804
|
{
|
|
7994
7805
|
value: {
|
|
@@ -8004,7 +7815,7 @@ function GoogleDriveAuthProvider({
|
|
|
8004
7815
|
);
|
|
8005
7816
|
}
|
|
8006
7817
|
function useGoogleDriveAuth() {
|
|
8007
|
-
const context = (0,
|
|
7818
|
+
const context = (0, import_react10.useContext)(GoogleDriveAuthContext);
|
|
8008
7819
|
if (!context) {
|
|
8009
7820
|
throw new Error(
|
|
8010
7821
|
"useGoogleDriveAuth must be used within GoogleDriveAuthProvider"
|
|
@@ -8014,7 +7825,7 @@ function useGoogleDriveAuth() {
|
|
|
8014
7825
|
}
|
|
8015
7826
|
|
|
8016
7827
|
// src/react/useGoogleDriveBackup.ts
|
|
8017
|
-
var
|
|
7828
|
+
var import_react11 = require("react");
|
|
8018
7829
|
|
|
8019
7830
|
// src/lib/backup/google/api.ts
|
|
8020
7831
|
var DRIVE_API_URL = "https://www.googleapis.com/drive/v3";
|
|
@@ -8332,7 +8143,7 @@ function useGoogleDriveBackup(options) {
|
|
|
8332
8143
|
isConfigured: isDriveConfigured,
|
|
8333
8144
|
requestAccess: requestDriveAccess
|
|
8334
8145
|
} = useGoogleDriveAuth();
|
|
8335
|
-
const deps = (0,
|
|
8146
|
+
const deps = (0, import_react11.useMemo)(
|
|
8336
8147
|
() => ({
|
|
8337
8148
|
requestDriveAccess,
|
|
8338
8149
|
requestEncryptionKey: requestEncryptionKey2,
|
|
@@ -8341,7 +8152,7 @@ function useGoogleDriveBackup(options) {
|
|
|
8341
8152
|
}),
|
|
8342
8153
|
[requestDriveAccess, requestEncryptionKey2, exportConversation, importConversation]
|
|
8343
8154
|
);
|
|
8344
|
-
const ensureToken = (0,
|
|
8155
|
+
const ensureToken = (0, import_react11.useCallback)(async () => {
|
|
8345
8156
|
if (driveToken) return driveToken;
|
|
8346
8157
|
try {
|
|
8347
8158
|
return await requestDriveAccess();
|
|
@@ -8349,7 +8160,7 @@ function useGoogleDriveBackup(options) {
|
|
|
8349
8160
|
return null;
|
|
8350
8161
|
}
|
|
8351
8162
|
}, [driveToken, requestDriveAccess]);
|
|
8352
|
-
const backup = (0,
|
|
8163
|
+
const backup = (0, import_react11.useCallback)(
|
|
8353
8164
|
async (backupOptions) => {
|
|
8354
8165
|
if (!userAddress) {
|
|
8355
8166
|
return { error: "Please sign in to backup to Google Drive" };
|
|
@@ -8376,7 +8187,7 @@ function useGoogleDriveBackup(options) {
|
|
|
8376
8187
|
},
|
|
8377
8188
|
[database, userAddress, ensureToken, deps, rootFolder, conversationsFolder]
|
|
8378
8189
|
);
|
|
8379
|
-
const restore = (0,
|
|
8190
|
+
const restore = (0, import_react11.useCallback)(
|
|
8380
8191
|
async (restoreOptions) => {
|
|
8381
8192
|
if (!userAddress) {
|
|
8382
8193
|
return { error: "Please sign in to restore from Google Drive" };
|
|
@@ -8411,7 +8222,7 @@ function useGoogleDriveBackup(options) {
|
|
|
8411
8222
|
}
|
|
8412
8223
|
|
|
8413
8224
|
// src/react/useICloudAuth.ts
|
|
8414
|
-
var
|
|
8225
|
+
var import_react12 = require("react");
|
|
8415
8226
|
|
|
8416
8227
|
// src/lib/backup/icloud/api.ts
|
|
8417
8228
|
var CLOUDKIT_JS_URL = "https://cdn.apple-cloudkit.com/ck/2/cloudkit.js";
|
|
@@ -8647,19 +8458,19 @@ async function findICloudFile(filename) {
|
|
|
8647
8458
|
}
|
|
8648
8459
|
|
|
8649
8460
|
// src/react/useICloudAuth.ts
|
|
8650
|
-
var ICloudAuthContext = (0,
|
|
8461
|
+
var ICloudAuthContext = (0, import_react12.createContext)(null);
|
|
8651
8462
|
function ICloudAuthProvider({
|
|
8652
8463
|
apiToken,
|
|
8653
8464
|
containerIdentifier = DEFAULT_CONTAINER_ID,
|
|
8654
8465
|
environment = "production",
|
|
8655
8466
|
children
|
|
8656
8467
|
}) {
|
|
8657
|
-
const [isAuthenticated, setIsAuthenticated] = (0,
|
|
8658
|
-
const [userRecordName, setUserRecordName] = (0,
|
|
8659
|
-
const [isAvailable, setIsAvailable] = (0,
|
|
8660
|
-
const [isConfigured, setIsConfigured] = (0,
|
|
8661
|
-
const [isLoading, setIsLoading] = (0,
|
|
8662
|
-
(0,
|
|
8468
|
+
const [isAuthenticated, setIsAuthenticated] = (0, import_react12.useState)(false);
|
|
8469
|
+
const [userRecordName, setUserRecordName] = (0, import_react12.useState)(null);
|
|
8470
|
+
const [isAvailable, setIsAvailable] = (0, import_react12.useState)(false);
|
|
8471
|
+
const [isConfigured, setIsConfigured] = (0, import_react12.useState)(false);
|
|
8472
|
+
const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
|
|
8473
|
+
(0, import_react12.useEffect)(() => {
|
|
8663
8474
|
if (!apiToken || typeof window === "undefined") {
|
|
8664
8475
|
return;
|
|
8665
8476
|
}
|
|
@@ -8692,7 +8503,7 @@ function ICloudAuthProvider({
|
|
|
8692
8503
|
};
|
|
8693
8504
|
initCloudKit();
|
|
8694
8505
|
}, [apiToken, containerIdentifier, environment]);
|
|
8695
|
-
const requestAccess = (0,
|
|
8506
|
+
const requestAccess = (0, import_react12.useCallback)(async () => {
|
|
8696
8507
|
if (!isConfigured) {
|
|
8697
8508
|
throw new Error("iCloud is not configured");
|
|
8698
8509
|
}
|
|
@@ -8709,11 +8520,11 @@ function ICloudAuthProvider({
|
|
|
8709
8520
|
);
|
|
8710
8521
|
}
|
|
8711
8522
|
}, [isAuthenticated, isConfigured]);
|
|
8712
|
-
const logout = (0,
|
|
8523
|
+
const logout = (0, import_react12.useCallback)(() => {
|
|
8713
8524
|
setIsAuthenticated(false);
|
|
8714
8525
|
setUserRecordName(null);
|
|
8715
8526
|
}, []);
|
|
8716
|
-
return (0,
|
|
8527
|
+
return (0, import_react12.createElement)(
|
|
8717
8528
|
ICloudAuthContext.Provider,
|
|
8718
8529
|
{
|
|
8719
8530
|
value: {
|
|
@@ -8729,7 +8540,7 @@ function ICloudAuthProvider({
|
|
|
8729
8540
|
);
|
|
8730
8541
|
}
|
|
8731
8542
|
function useICloudAuth() {
|
|
8732
|
-
const context = (0,
|
|
8543
|
+
const context = (0, import_react12.useContext)(ICloudAuthContext);
|
|
8733
8544
|
if (!context) {
|
|
8734
8545
|
throw new Error("useICloudAuth must be used within ICloudAuthProvider");
|
|
8735
8546
|
}
|
|
@@ -8742,7 +8553,7 @@ function clearICloudAuth() {
|
|
|
8742
8553
|
}
|
|
8743
8554
|
|
|
8744
8555
|
// src/react/useICloudBackup.ts
|
|
8745
|
-
var
|
|
8556
|
+
var import_react13 = require("react");
|
|
8746
8557
|
|
|
8747
8558
|
// src/lib/backup/icloud/backup.ts
|
|
8748
8559
|
var isAuthError3 = (err) => err instanceof Error && (err.message.includes("AUTHENTICATION") || err.message.includes("NOT_AUTHENTICATED") || err.message.includes("sign in"));
|
|
@@ -8883,7 +8694,7 @@ function useICloudBackup(options) {
|
|
|
8883
8694
|
isAvailable,
|
|
8884
8695
|
requestAccess
|
|
8885
8696
|
} = useICloudAuth();
|
|
8886
|
-
const deps = (0,
|
|
8697
|
+
const deps = (0, import_react13.useMemo)(
|
|
8887
8698
|
() => ({
|
|
8888
8699
|
requestICloudAccess: requestAccess,
|
|
8889
8700
|
requestEncryptionKey: requestEncryptionKey2,
|
|
@@ -8892,7 +8703,7 @@ function useICloudBackup(options) {
|
|
|
8892
8703
|
}),
|
|
8893
8704
|
[requestAccess, requestEncryptionKey2, exportConversation, importConversation]
|
|
8894
8705
|
);
|
|
8895
|
-
const ensureAuthenticated = (0,
|
|
8706
|
+
const ensureAuthenticated = (0, import_react13.useCallback)(async () => {
|
|
8896
8707
|
if (isAuthenticated) return true;
|
|
8897
8708
|
try {
|
|
8898
8709
|
await requestAccess();
|
|
@@ -8901,7 +8712,7 @@ function useICloudBackup(options) {
|
|
|
8901
8712
|
return false;
|
|
8902
8713
|
}
|
|
8903
8714
|
}, [isAuthenticated, requestAccess]);
|
|
8904
|
-
const backup = (0,
|
|
8715
|
+
const backup = (0, import_react13.useCallback)(
|
|
8905
8716
|
async (backupOptions) => {
|
|
8906
8717
|
if (!userAddress) {
|
|
8907
8718
|
return { error: "Please sign in to backup to iCloud" };
|
|
@@ -8931,7 +8742,7 @@ function useICloudBackup(options) {
|
|
|
8931
8742
|
},
|
|
8932
8743
|
[database, userAddress, isAvailable, isConfigured, ensureAuthenticated, deps]
|
|
8933
8744
|
);
|
|
8934
|
-
const restore = (0,
|
|
8745
|
+
const restore = (0, import_react13.useCallback)(
|
|
8935
8746
|
async (restoreOptions) => {
|
|
8936
8747
|
if (!userAddress) {
|
|
8937
8748
|
return { error: "Please sign in to restore from iCloud" };
|
|
@@ -8970,8 +8781,8 @@ function useICloudBackup(options) {
|
|
|
8970
8781
|
}
|
|
8971
8782
|
|
|
8972
8783
|
// src/react/useBackupAuth.ts
|
|
8973
|
-
var
|
|
8974
|
-
var BackupAuthContext = (0,
|
|
8784
|
+
var import_react14 = require("react");
|
|
8785
|
+
var BackupAuthContext = (0, import_react14.createContext)(null);
|
|
8975
8786
|
function BackupAuthProvider({
|
|
8976
8787
|
dropboxAppKey,
|
|
8977
8788
|
dropboxCallbackPath = "/auth/dropbox/callback",
|
|
@@ -8984,15 +8795,15 @@ function BackupAuthProvider({
|
|
|
8984
8795
|
walletAddress,
|
|
8985
8796
|
children
|
|
8986
8797
|
}) {
|
|
8987
|
-
const [dropboxToken, setDropboxToken] = (0,
|
|
8798
|
+
const [dropboxToken, setDropboxToken] = (0, import_react14.useState)(null);
|
|
8988
8799
|
const isDropboxConfigured = !!dropboxAppKey;
|
|
8989
|
-
const [googleToken, setGoogleToken] = (0,
|
|
8800
|
+
const [googleToken, setGoogleToken] = (0, import_react14.useState)(null);
|
|
8990
8801
|
const isGoogleConfigured = !!googleClientId;
|
|
8991
|
-
const [icloudAuthenticated, setIcloudAuthenticated] = (0,
|
|
8992
|
-
const [icloudUserRecordName, setIcloudUserRecordName] = (0,
|
|
8993
|
-
const [isIcloudAvailable, setIsIcloudAvailable] = (0,
|
|
8802
|
+
const [icloudAuthenticated, setIcloudAuthenticated] = (0, import_react14.useState)(false);
|
|
8803
|
+
const [icloudUserRecordName, setIcloudUserRecordName] = (0, import_react14.useState)(null);
|
|
8804
|
+
const [isIcloudAvailable, setIsIcloudAvailable] = (0, import_react14.useState)(false);
|
|
8994
8805
|
const isIcloudConfigured = isIcloudAvailable && !!icloudApiToken;
|
|
8995
|
-
(0,
|
|
8806
|
+
(0, import_react14.useEffect)(() => {
|
|
8996
8807
|
const checkStoredTokens = async () => {
|
|
8997
8808
|
if (walletAddress) {
|
|
8998
8809
|
await Promise.all([
|
|
@@ -9015,7 +8826,7 @@ function BackupAuthProvider({
|
|
|
9015
8826
|
};
|
|
9016
8827
|
checkStoredTokens();
|
|
9017
8828
|
}, [apiClient, walletAddress]);
|
|
9018
|
-
(0,
|
|
8829
|
+
(0, import_react14.useEffect)(() => {
|
|
9019
8830
|
if (!icloudApiToken || typeof window === "undefined") {
|
|
9020
8831
|
return;
|
|
9021
8832
|
}
|
|
@@ -9043,7 +8854,7 @@ function BackupAuthProvider({
|
|
|
9043
8854
|
};
|
|
9044
8855
|
initCloudKit();
|
|
9045
8856
|
}, [icloudApiToken, icloudContainerIdentifier, icloudEnvironment]);
|
|
9046
|
-
(0,
|
|
8857
|
+
(0, import_react14.useEffect)(() => {
|
|
9047
8858
|
if (!isDropboxConfigured) return;
|
|
9048
8859
|
const handleCallback = async () => {
|
|
9049
8860
|
if (isDropboxCallback()) {
|
|
@@ -9063,7 +8874,7 @@ function BackupAuthProvider({
|
|
|
9063
8874
|
};
|
|
9064
8875
|
handleCallback();
|
|
9065
8876
|
}, [dropboxCallbackPath, isDropboxConfigured, apiClient, walletAddress]);
|
|
9066
|
-
(0,
|
|
8877
|
+
(0, import_react14.useEffect)(() => {
|
|
9067
8878
|
if (!isGoogleConfigured) return;
|
|
9068
8879
|
const handleCallback = async () => {
|
|
9069
8880
|
if (isGoogleDriveCallback()) {
|
|
@@ -9083,14 +8894,14 @@ function BackupAuthProvider({
|
|
|
9083
8894
|
};
|
|
9084
8895
|
handleCallback();
|
|
9085
8896
|
}, [googleCallbackPath, isGoogleConfigured, apiClient, walletAddress]);
|
|
9086
|
-
const refreshDropboxTokenFn = (0,
|
|
8897
|
+
const refreshDropboxTokenFn = (0, import_react14.useCallback)(async () => {
|
|
9087
8898
|
const token = await getDropboxAccessToken(apiClient, walletAddress);
|
|
9088
8899
|
if (token) {
|
|
9089
8900
|
setDropboxToken(token);
|
|
9090
8901
|
}
|
|
9091
8902
|
return token;
|
|
9092
8903
|
}, [apiClient, walletAddress]);
|
|
9093
|
-
const requestDropboxAccess = (0,
|
|
8904
|
+
const requestDropboxAccess = (0, import_react14.useCallback)(async () => {
|
|
9094
8905
|
if (!isDropboxConfigured || !dropboxAppKey) {
|
|
9095
8906
|
throw new Error("Dropbox is not configured");
|
|
9096
8907
|
}
|
|
@@ -9107,18 +8918,18 @@ function BackupAuthProvider({
|
|
|
9107
8918
|
apiClient,
|
|
9108
8919
|
walletAddress
|
|
9109
8920
|
]);
|
|
9110
|
-
const logoutDropbox = (0,
|
|
8921
|
+
const logoutDropbox = (0, import_react14.useCallback)(async () => {
|
|
9111
8922
|
await revokeDropboxToken(apiClient, walletAddress);
|
|
9112
8923
|
setDropboxToken(null);
|
|
9113
8924
|
}, [apiClient, walletAddress]);
|
|
9114
|
-
const refreshGoogleTokenFn = (0,
|
|
8925
|
+
const refreshGoogleTokenFn = (0, import_react14.useCallback)(async () => {
|
|
9115
8926
|
const token = await getGoogleDriveAccessToken(apiClient, walletAddress);
|
|
9116
8927
|
if (token) {
|
|
9117
8928
|
setGoogleToken(token);
|
|
9118
8929
|
}
|
|
9119
8930
|
return token;
|
|
9120
8931
|
}, [apiClient, walletAddress]);
|
|
9121
|
-
const requestGoogleAccess = (0,
|
|
8932
|
+
const requestGoogleAccess = (0, import_react14.useCallback)(async () => {
|
|
9122
8933
|
if (!isGoogleConfigured || !googleClientId) {
|
|
9123
8934
|
throw new Error("Google Drive is not configured");
|
|
9124
8935
|
}
|
|
@@ -9138,11 +8949,11 @@ function BackupAuthProvider({
|
|
|
9138
8949
|
apiClient,
|
|
9139
8950
|
walletAddress
|
|
9140
8951
|
]);
|
|
9141
|
-
const logoutGoogle = (0,
|
|
8952
|
+
const logoutGoogle = (0, import_react14.useCallback)(async () => {
|
|
9142
8953
|
await revokeGoogleDriveToken(apiClient, walletAddress);
|
|
9143
8954
|
setGoogleToken(null);
|
|
9144
8955
|
}, [apiClient, walletAddress]);
|
|
9145
|
-
const refreshIcloudTokenFn = (0,
|
|
8956
|
+
const refreshIcloudTokenFn = (0, import_react14.useCallback)(async () => {
|
|
9146
8957
|
try {
|
|
9147
8958
|
const userIdentity = await authenticateICloud();
|
|
9148
8959
|
if (userIdentity) {
|
|
@@ -9154,7 +8965,7 @@ function BackupAuthProvider({
|
|
|
9154
8965
|
}
|
|
9155
8966
|
return null;
|
|
9156
8967
|
}, []);
|
|
9157
|
-
const requestIcloudAccess = (0,
|
|
8968
|
+
const requestIcloudAccess = (0, import_react14.useCallback)(async () => {
|
|
9158
8969
|
if (!isIcloudConfigured) {
|
|
9159
8970
|
throw new Error("iCloud is not configured");
|
|
9160
8971
|
}
|
|
@@ -9172,11 +8983,11 @@ function BackupAuthProvider({
|
|
|
9172
8983
|
);
|
|
9173
8984
|
}
|
|
9174
8985
|
}, [icloudAuthenticated, icloudUserRecordName, isIcloudConfigured]);
|
|
9175
|
-
const logoutIcloud = (0,
|
|
8986
|
+
const logoutIcloud = (0, import_react14.useCallback)(async () => {
|
|
9176
8987
|
setIcloudAuthenticated(false);
|
|
9177
8988
|
setIcloudUserRecordName(null);
|
|
9178
8989
|
}, []);
|
|
9179
|
-
const logoutAll = (0,
|
|
8990
|
+
const logoutAll = (0, import_react14.useCallback)(async () => {
|
|
9180
8991
|
await Promise.all([
|
|
9181
8992
|
isDropboxConfigured ? logoutDropbox() : Promise.resolve(),
|
|
9182
8993
|
isGoogleConfigured ? logoutGoogle() : Promise.resolve(),
|
|
@@ -9215,7 +9026,7 @@ function BackupAuthProvider({
|
|
|
9215
9026
|
logout: logoutIcloud,
|
|
9216
9027
|
refreshToken: refreshIcloudTokenFn
|
|
9217
9028
|
};
|
|
9218
|
-
return (0,
|
|
9029
|
+
return (0, import_react14.createElement)(
|
|
9219
9030
|
BackupAuthContext.Provider,
|
|
9220
9031
|
{
|
|
9221
9032
|
value: {
|
|
@@ -9231,7 +9042,7 @@ function BackupAuthProvider({
|
|
|
9231
9042
|
);
|
|
9232
9043
|
}
|
|
9233
9044
|
function useBackupAuth() {
|
|
9234
|
-
const context = (0,
|
|
9045
|
+
const context = (0, import_react14.useContext)(BackupAuthContext);
|
|
9235
9046
|
if (!context) {
|
|
9236
9047
|
throw new Error("useBackupAuth must be used within BackupAuthProvider");
|
|
9237
9048
|
}
|
|
@@ -9239,7 +9050,7 @@ function useBackupAuth() {
|
|
|
9239
9050
|
}
|
|
9240
9051
|
|
|
9241
9052
|
// src/react/useBackup.ts
|
|
9242
|
-
var
|
|
9053
|
+
var import_react15 = require("react");
|
|
9243
9054
|
function useBackup(options) {
|
|
9244
9055
|
const {
|
|
9245
9056
|
database,
|
|
@@ -9259,7 +9070,7 @@ function useBackup(options) {
|
|
|
9259
9070
|
hasAnyAuthentication,
|
|
9260
9071
|
logoutAll
|
|
9261
9072
|
} = useBackupAuth();
|
|
9262
|
-
const dropboxDeps = (0,
|
|
9073
|
+
const dropboxDeps = (0, import_react15.useMemo)(
|
|
9263
9074
|
() => ({
|
|
9264
9075
|
requestDropboxAccess: dropboxAuth.requestAccess,
|
|
9265
9076
|
requestEncryptionKey: requestEncryptionKey2,
|
|
@@ -9268,7 +9079,7 @@ function useBackup(options) {
|
|
|
9268
9079
|
}),
|
|
9269
9080
|
[dropboxAuth.requestAccess, requestEncryptionKey2, exportConversation, importConversation]
|
|
9270
9081
|
);
|
|
9271
|
-
const googleDriveDeps = (0,
|
|
9082
|
+
const googleDriveDeps = (0, import_react15.useMemo)(
|
|
9272
9083
|
() => ({
|
|
9273
9084
|
requestDriveAccess: googleDriveAuth.requestAccess,
|
|
9274
9085
|
requestEncryptionKey: requestEncryptionKey2,
|
|
@@ -9277,7 +9088,7 @@ function useBackup(options) {
|
|
|
9277
9088
|
}),
|
|
9278
9089
|
[googleDriveAuth.requestAccess, requestEncryptionKey2, exportConversation, importConversation]
|
|
9279
9090
|
);
|
|
9280
|
-
const icloudDeps = (0,
|
|
9091
|
+
const icloudDeps = (0, import_react15.useMemo)(
|
|
9281
9092
|
() => ({
|
|
9282
9093
|
requestICloudAccess: async () => {
|
|
9283
9094
|
await icloudAuth.requestAccess();
|
|
@@ -9288,7 +9099,7 @@ function useBackup(options) {
|
|
|
9288
9099
|
}),
|
|
9289
9100
|
[icloudAuth.requestAccess, requestEncryptionKey2, exportConversation, importConversation]
|
|
9290
9101
|
);
|
|
9291
|
-
const dropboxBackup = (0,
|
|
9102
|
+
const dropboxBackup = (0, import_react15.useCallback)(
|
|
9292
9103
|
async (backupOptions) => {
|
|
9293
9104
|
if (!userAddress) {
|
|
9294
9105
|
return { error: "Please sign in to backup to Dropbox" };
|
|
@@ -9316,7 +9127,7 @@ function useBackup(options) {
|
|
|
9316
9127
|
},
|
|
9317
9128
|
[database, userAddress, dropboxAuth, dropboxDeps, dropboxFolder]
|
|
9318
9129
|
);
|
|
9319
|
-
const dropboxRestore = (0,
|
|
9130
|
+
const dropboxRestore = (0, import_react15.useCallback)(
|
|
9320
9131
|
async (restoreOptions) => {
|
|
9321
9132
|
if (!userAddress) {
|
|
9322
9133
|
return { error: "Please sign in to restore from Dropbox" };
|
|
@@ -9343,7 +9154,7 @@ function useBackup(options) {
|
|
|
9343
9154
|
},
|
|
9344
9155
|
[userAddress, dropboxAuth, dropboxDeps, dropboxFolder]
|
|
9345
9156
|
);
|
|
9346
|
-
const googleDriveBackup = (0,
|
|
9157
|
+
const googleDriveBackup = (0, import_react15.useCallback)(
|
|
9347
9158
|
async (backupOptions) => {
|
|
9348
9159
|
if (!userAddress) {
|
|
9349
9160
|
return { error: "Please sign in to backup to Google Drive" };
|
|
@@ -9379,7 +9190,7 @@ function useBackup(options) {
|
|
|
9379
9190
|
googleConversationsFolder
|
|
9380
9191
|
]
|
|
9381
9192
|
);
|
|
9382
|
-
const googleDriveRestore = (0,
|
|
9193
|
+
const googleDriveRestore = (0, import_react15.useCallback)(
|
|
9383
9194
|
async (restoreOptions) => {
|
|
9384
9195
|
if (!userAddress) {
|
|
9385
9196
|
return { error: "Please sign in to restore from Google Drive" };
|
|
@@ -9429,7 +9240,7 @@ function useBackup(options) {
|
|
|
9429
9240
|
connect: googleDriveAuth.requestAccess,
|
|
9430
9241
|
disconnect: googleDriveAuth.logout
|
|
9431
9242
|
};
|
|
9432
|
-
const icloudBackup = (0,
|
|
9243
|
+
const icloudBackup = (0, import_react15.useCallback)(
|
|
9433
9244
|
async (backupOptions) => {
|
|
9434
9245
|
if (!userAddress) {
|
|
9435
9246
|
return { error: "Please sign in to backup to iCloud" };
|
|
@@ -9459,7 +9270,7 @@ function useBackup(options) {
|
|
|
9459
9270
|
},
|
|
9460
9271
|
[database, userAddress, icloudAuth, icloudDeps]
|
|
9461
9272
|
);
|
|
9462
|
-
const icloudRestore = (0,
|
|
9273
|
+
const icloudRestore = (0, import_react15.useCallback)(
|
|
9463
9274
|
async (restoreOptions) => {
|
|
9464
9275
|
if (!userAddress) {
|
|
9465
9276
|
return { error: "Please sign in to restore from iCloud" };
|
|
@@ -10086,12 +9897,10 @@ function hasDriveCredentials() {
|
|
|
10086
9897
|
useGoogleDriveBackup,
|
|
10087
9898
|
useICloudAuth,
|
|
10088
9899
|
useICloudBackup,
|
|
10089
|
-
useImageGeneration,
|
|
10090
9900
|
useMemoryStorage,
|
|
10091
9901
|
useModels,
|
|
10092
9902
|
useOCR,
|
|
10093
9903
|
usePdf,
|
|
10094
|
-
useSearch,
|
|
10095
9904
|
useSettings,
|
|
10096
9905
|
userPreferencesStorageSchema,
|
|
10097
9906
|
writeEncryptedFile
|