@chrryai/chrry 1.5.8 → 1.5.9

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
@@ -671,7 +671,7 @@ declare const getHourlyLimit: ({ member, guest, app, }: {
671
671
  app?: app;
672
672
  member?: user;
673
673
  guest?: guest;
674
- }) => 30 | 100 | 5000 | 500 | 200 | 10;
674
+ }) => 500 | 30 | 100 | 5000 | 200 | 10;
675
675
 
676
676
  /**
677
677
  * Generate dynamic metadata for an app page
@@ -760,7 +760,7 @@ declare const FREE_DAYS = 5;
760
760
  declare const PLUS_PRICE = 9.99;
761
761
  declare const PRO_PRICE = 19.99;
762
762
  declare const CREDITS_PRICE = 5;
763
- declare const ADDITIONAL_CREDITS = 600;
763
+ declare const ADDITIONAL_CREDITS = 500;
764
764
  declare function isValidUuidV4(uuid: string): boolean;
765
765
  declare function getThreadId(pathname?: string): string | undefined;
766
766
  declare const MAX_TOOL_CALLS_PER_MESSAGE = 7;
package/dist/index.d.ts CHANGED
@@ -671,7 +671,7 @@ declare const getHourlyLimit: ({ member, guest, app, }: {
671
671
  app?: app;
672
672
  member?: user;
673
673
  guest?: guest;
674
- }) => 30 | 100 | 5000 | 500 | 200 | 10;
674
+ }) => 500 | 30 | 100 | 5000 | 200 | 10;
675
675
 
676
676
  /**
677
677
  * Generate dynamic metadata for an app page
@@ -760,7 +760,7 @@ declare const FREE_DAYS = 5;
760
760
  declare const PLUS_PRICE = 9.99;
761
761
  declare const PRO_PRICE = 19.99;
762
762
  declare const CREDITS_PRICE = 5;
763
- declare const ADDITIONAL_CREDITS = 600;
763
+ declare const ADDITIONAL_CREDITS = 500;
764
764
  declare function isValidUuidV4(uuid: string): boolean;
765
765
  declare function getThreadId(pathname?: string): string | undefined;
766
766
  declare const MAX_TOOL_CALLS_PER_MESSAGE = 7;
package/dist/index.js CHANGED
@@ -1706,7 +1706,7 @@ var init_utils = __esm({
1706
1706
  PLUS_PRICE = 9.99;
1707
1707
  PRO_PRICE = 19.99;
1708
1708
  CREDITS_PRICE = 5;
1709
- ADDITIONAL_CREDITS = 600;
1709
+ ADDITIONAL_CREDITS = 500;
1710
1710
  MAX_TOOL_CALLS_PER_MESSAGE = 7;
1711
1711
  WS_URL = isTestingDevice ? "ws://192.168.2.27:5001" : isDevelopment ? "ws://localhost:5001" : "wss://ws.chrry.dev";
1712
1712
  addParam = (key, value) => {
@@ -1902,7 +1902,7 @@ var init_utils = __esm({
1902
1902
  };
1903
1903
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
1904
1904
  config = getSiteConfig(getClientHostname());
1905
- VERSION = config.version || "1.5.8";
1905
+ VERSION = config.version || "1.5.9";
1906
1906
  getSlugFromPathname = (path) => {
1907
1907
  return getAppAndStoreSlugs(path, {
1908
1908
  defaultAppSlug: config.slug,
@@ -22902,6 +22902,25 @@ var init_i18n = __esm({
22902
22902
  }
22903
22903
  });
22904
22904
 
22905
+ // hooks/useCache.ts
22906
+ function useCache() {
22907
+ const { cache } = (0, import_swr.useSWRConfig)();
22908
+ return {
22909
+ clear: () => {
22910
+ for (const key of cache.keys()) {
22911
+ cache.delete(key);
22912
+ }
22913
+ }
22914
+ };
22915
+ }
22916
+ var import_swr;
22917
+ var init_useCache = __esm({
22918
+ "hooks/useCache.ts"() {
22919
+ "use strict";
22920
+ import_swr = require("swr");
22921
+ }
22922
+ });
22923
+
22905
22924
  // context/providers/AuthProvider.tsx
22906
22925
  function AuthProvider({
22907
22926
  apiKey,
@@ -22949,7 +22968,7 @@ function AuthProvider({
22949
22968
  }
22950
22969
  }, [deviceId, setDeviceId, isStorageReady]);
22951
22970
  const [enableNotifications, setEnableNotifications] = useLocalStorage2("enableNotifications", true);
22952
- const [shouldFetchSession, setShouldFetchSession] = (0, import_react19.useState)(!session2);
22971
+ const [shouldFetchSession, setShouldFetchSession] = (0, import_react19.useState)(true);
22953
22972
  const [fingerprint, setFingerprint] = useCookieOrLocalStorage(
22954
22973
  "fingerprint",
22955
22974
  session2?.guest?.fingerprint || session2?.user?.fingerprint || fingerprintParam
@@ -23060,7 +23079,7 @@ function AuthProvider({
23060
23079
  mutate: refetchSession,
23061
23080
  isLoading: isSessionLoading,
23062
23081
  error: sessionError
23063
- } = (0, import_swr.default)(
23082
+ } = (0, import_swr2.default)(
23064
23083
  (isExtension2 ? isStorageReady && isCookieReady : true) && (fingerprint || token) && deviceId && shouldFetchSession ? ["session", env] : null,
23065
23084
  async () => {
23066
23085
  try {
@@ -23107,6 +23126,10 @@ function AuthProvider({
23107
23126
  if (gift) {
23108
23127
  removeParams("gift");
23109
23128
  }
23129
+ console.log(
23130
+ `\u{1F680} ~ file: AuthProvider.tsx:566 ~ sessionResult:`,
23131
+ sessionResult
23132
+ );
23110
23133
  return sessionResult;
23111
23134
  } catch (error2) {
23112
23135
  import_react_hot_toast.default.error("Something went wrong");
@@ -23359,14 +23382,23 @@ function AuthProvider({
23359
23382
  return Array.from(existingAppsMap.values());
23360
23383
  });
23361
23384
  }, []);
23385
+ console.log(
23386
+ `\u{1F680} ~ file: AuthProvider.tsx:960 ~ fetchSession ~ newApp:`,
23387
+ shouldFetchSession
23388
+ );
23362
23389
  const fetchSession = async (newApp2) => {
23390
+ console.log(`\u{1F680} ~ file: AuthProvider.tsx:958 ~ newApp:`, newApp2);
23363
23391
  if (newApp2) {
23364
23392
  await refetchApps();
23365
23393
  setNewApp(newApp2);
23366
23394
  }
23367
23395
  setIsLoading(true);
23368
23396
  setShouldFetchSession(true);
23369
- await refetchSession();
23397
+ shouldFetchSession && console.log(
23398
+ `\u{1F680} ~ file: AuthProvider.tssssssx:960 ~ fetchSession ~ newApp:`,
23399
+ shouldFetchSession
23400
+ );
23401
+ shouldFetchSession && await refetchSession(void 0, { revalidate: true });
23370
23402
  };
23371
23403
  const [isSplash, setIsSplash] = (0, import_react19.useState)(true);
23372
23404
  const [loadingApp, setLoadingApp] = (0, import_react19.useState)(
@@ -23383,7 +23415,7 @@ function AuthProvider({
23383
23415
  data: allAppsSwr,
23384
23416
  mutate: refetchApps,
23385
23417
  isLoading: isLoadingApps
23386
- } = (0, import_swr.default)(
23418
+ } = (0, import_swr2.default)(
23387
23419
  token && (loadingApp?.id || app?.id) ? ["allApps", token] : null,
23388
23420
  async () => {
23389
23421
  if (!token) return null;
@@ -23455,7 +23487,7 @@ function AuthProvider({
23455
23487
  const [isLoadingMood, setIsLoadingMood] = (0, import_react19.useState)(true);
23456
23488
  const [mood, setMood] = (0, import_react19.useState)(null);
23457
23489
  const [shouldFetchMood, setShouldFetchMood] = (0, import_react19.useState)(true);
23458
- const { data: moodData, mutate: refetchMood } = (0, import_swr.default)(
23490
+ const { data: moodData, mutate: refetchMood } = (0, import_swr2.default)(
23459
23491
  shouldFetchMood && token ? ["mood", token] : null,
23460
23492
  // Disabled by default, fetch manually with refetchMood()
23461
23493
  async () => {
@@ -23480,7 +23512,7 @@ function AuthProvider({
23480
23512
  data: moodsData,
23481
23513
  isLoading: isLoadingMoods,
23482
23514
  mutate: refetchMoods
23483
- } = (0, import_swr.default)(shouldFetchMoods && token ? ["moods", token] : null, async () => {
23515
+ } = (0, import_swr2.default)(shouldFetchMoods && token ? ["moods", token] : null, async () => {
23484
23516
  const response = await apiFetch(`${API_URL}/moods`, {
23485
23517
  headers: {
23486
23518
  Authorization: `Bearer ${token}`
@@ -23673,7 +23705,7 @@ function AuthProvider({
23673
23705
  }, [track]);
23674
23706
  const [isSavingApp, setIsSavingApp] = (0, import_react19.useState)(false);
23675
23707
  const [shouldFetchTasks, setShouldFetchTasks] = (0, import_react19.useState)(false);
23676
- const { data: tasksData, mutate: refetchTasks } = (0, import_swr.default)(
23708
+ const { data: tasksData, mutate: refetchTasks } = (0, import_swr2.default)(
23677
23709
  token && shouldFetchTasks ? ["tasks"] : null,
23678
23710
  // Disabled by default, fetch manually with refetchTasks()
23679
23711
  async () => {
@@ -23745,6 +23777,7 @@ function AuthProvider({
23745
23777
  }
23746
23778
  }
23747
23779
  }, [sessionError]);
23780
+ const { clear: clear2 } = useCache();
23748
23781
  const popcorn = allApps.find((app2) => app2.slug === "popcorn");
23749
23782
  const atlas = allApps.find((app2) => app2.slug === "atlas");
23750
23783
  const bloom = allApps.find((app2) => app2.slug === "bloom");
@@ -23754,6 +23787,7 @@ function AuthProvider({
23754
23787
  setUser(void 0);
23755
23788
  setGuest(void 0);
23756
23789
  setToken(fingerprint);
23790
+ clear2();
23757
23791
  };
23758
23792
  const isExtensionRedirect = searchParams.get("extension") === "true";
23759
23793
  const isLoggedOut = searchParams.get("loggedOut") === "true" || void 0;
@@ -23914,13 +23948,13 @@ function useAuth() {
23914
23948
  }
23915
23949
  return context;
23916
23950
  }
23917
- var import_react19, import_swr, import_uuid2, import_react_hot_toast, import_i18next2, VERSION2, AuthContext;
23951
+ var import_react19, import_swr2, import_uuid2, import_react_hot_toast, import_i18next2, VERSION2, AuthContext;
23918
23952
  var init_AuthProvider = __esm({
23919
23953
  "context/providers/AuthProvider.tsx"() {
23920
23954
  "use strict";
23921
23955
  "use client";
23922
23956
  import_react19 = __toESM(require("react"));
23923
- import_swr = __toESM(require("swr"));
23957
+ import_swr2 = __toESM(require("swr"));
23924
23958
  import_uuid2 = require("uuid");
23925
23959
  init_platform();
23926
23960
  init_timeAgo();
@@ -23934,6 +23968,7 @@ var init_AuthProvider = __esm({
23934
23968
  init_siteConfig();
23935
23969
  init_url();
23936
23970
  init_utils();
23971
+ init_useCache();
23937
23972
  VERSION2 = "1.1.63";
23938
23973
  AuthContext = (0, import_react19.createContext)(void 0);
23939
23974
  }
@@ -23995,7 +24030,7 @@ function DataProvider({ children, ...rest }) {
23995
24030
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
23996
24031
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
23997
24032
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
23998
- const VERSION4 = "1.5.8";
24033
+ const VERSION4 = "1.5.9";
23999
24034
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24000
24035
  const {
24001
24036
  API_URL: API_URL2,
@@ -24016,7 +24051,7 @@ function DataProvider({ children, ...rest }) {
24016
24051
  data: weatherData,
24017
24052
  error,
24018
24053
  mutate: refetchWeather
24019
- } = (0, import_swr2.default)(
24054
+ } = (0, import_swr3.default)(
24020
24055
  siteConfig.mode !== "chrryDev" && token && deviceId ? ["weather"] : null,
24021
24056
  async () => {
24022
24057
  if (!token) return null;
@@ -24044,7 +24079,6 @@ function DataProvider({ children, ...rest }) {
24044
24079
  shouldRetryOnError: false
24045
24080
  }
24046
24081
  );
24047
- const ADDITIONAL_CREDITS2 = 2500;
24048
24082
  const [versions, setVersions] = (0, import_react21.useState)(session2?.versions);
24049
24083
  const pageSizes3 = {
24050
24084
  threads: 20,
@@ -24073,7 +24107,7 @@ function DataProvider({ children, ...rest }) {
24073
24107
  );
24074
24108
  const { isStandalone: isStandalone2, isExtension: isExtension2, isFirefox: isFirefox2 } = usePlatform();
24075
24109
  const { searchParams, pathname } = useNavigation();
24076
- const { data: affiliateData, mutate: refetchAffiliateData } = (0, import_swr2.default)(
24110
+ const { data: affiliateData, mutate: refetchAffiliateData } = (0, import_swr3.default)(
24077
24111
  user && token && pathname.startsWith("/affiliate") ? ["affiliate"] : null,
24078
24112
  async () => {
24079
24113
  if (!token) {
@@ -24204,7 +24238,7 @@ function DataProvider({ children, ...rest }) {
24204
24238
  }, [weatherData]);
24205
24239
  const isE2E2 = process.env.NEXT_PUBLIC_TESTING_ENV === "e2e";
24206
24240
  const [aiAgents, setAiAgents] = (0, import_react21.useState)(session2?.aiAgents || []);
24207
- const { data: aiAgentsData } = (0, import_swr2.default)(
24241
+ const { data: aiAgentsData } = (0, import_swr3.default)(
24208
24242
  token && siteConfig.mode !== "chrryDev" && aiAgents?.length > 0 ? null : ["aiAgents", token, app?.id],
24209
24243
  async () => {
24210
24244
  const url = new URL(`${API_URL2}/aiAgents`);
@@ -24242,7 +24276,7 @@ function DataProvider({ children, ...rest }) {
24242
24276
  FREE_DAYS: FREE_DAYS2,
24243
24277
  PLUS_PRICE: PLUS_PRICE2,
24244
24278
  PRO_PRICE: PRO_PRICE2,
24245
- ADDITIONAL_CREDITS: ADDITIONAL_CREDITS2,
24279
+ ADDITIONAL_CREDITS,
24246
24280
  weather,
24247
24281
  aiAgents,
24248
24282
  setAiAgents,
@@ -24288,7 +24322,7 @@ function useData() {
24288
24322
  }
24289
24323
  return context;
24290
24324
  }
24291
- var import_react21, import_swr2, DataContext, isProduction3, isExtension, extensionId, isDevelopment2, MONTHLY_GUEST_CREDITS;
24325
+ var import_react21, import_swr3, DataContext, isProduction3, isExtension, extensionId, isDevelopment2, MONTHLY_GUEST_CREDITS;
24292
24326
  var init_DataProvider = __esm({
24293
24327
  "context/providers/DataProvider.tsx"() {
24294
24328
  "use strict";
@@ -24298,7 +24332,7 @@ var init_DataProvider = __esm({
24298
24332
  init_lib();
24299
24333
  init_AuthProvider();
24300
24334
  init_platform();
24301
- import_swr2 = __toESM(require("swr"));
24335
+ import_swr3 = __toESM(require("swr"));
24302
24336
  init_getWeatherCacheTime();
24303
24337
  init_ErrorProvider();
24304
24338
  init_siteConfig();
@@ -26041,13 +26075,9 @@ function ChatProvider({
26041
26075
  mutate: refetchThreads,
26042
26076
  isLoading: isLoadingThreadsSwr,
26043
26077
  error: threadsError
26044
- } = (0, import_swr3.default)(
26078
+ } = (0, import_swr4.default)(
26045
26079
  shouldFetchThreads ? ["contextThreads", thread2?.id, app?.id, token] : null,
26046
26080
  async () => {
26047
- console.log(
26048
- `\u{1F680} ~ file: ChatProvider.tsx:251 ~ shouldFetchThreads:`,
26049
- shouldFetchThreads
26050
- );
26051
26081
  try {
26052
26082
  const threads2 = await actions.getThreads({
26053
26083
  onError: (status2) => {
@@ -26437,7 +26467,7 @@ function ChatProvider({
26437
26467
  setSelectedAgent(sushiAgent);
26438
26468
  }
26439
26469
  }, [appStatus?.part]);
26440
- const [shouldFetchThread, setShouldFetchThread] = (0, import_react31.useState)(!thread2);
26470
+ const [shouldFetchThread, setShouldFetchThread] = (0, import_react31.useState)(true);
26441
26471
  const [until, setUntil] = (0, import_react31.useState)(1);
26442
26472
  const [liked, setLiked] = (0, import_react31.useState)(void 0);
26443
26473
  const [isLoading, setIsLoading] = (0, import_react31.useState)(!!threadId);
@@ -26449,7 +26479,7 @@ function ChatProvider({
26449
26479
  data: threadSWR,
26450
26480
  mutate,
26451
26481
  error
26452
- } = (0, import_swr3.default)(
26482
+ } = (0, import_swr4.default)(
26453
26483
  shouldFetchThread && token && threadId ? ["thread", threadId, liked, until, token] : null,
26454
26484
  async () => {
26455
26485
  if (!threadId) return;
@@ -26466,7 +26496,7 @@ function ChatProvider({
26466
26496
  return threadData2;
26467
26497
  },
26468
26498
  {
26469
- // revalidateOnMount: true,
26499
+ revalidateOnMount: true
26470
26500
  }
26471
26501
  );
26472
26502
  const [agentName, setAgentName] = (0, import_react31.useState)(session2?.aiAgent?.name || "");
@@ -26736,7 +26766,7 @@ function useChat() {
26736
26766
  }
26737
26767
  return context;
26738
26768
  }
26739
- var import_react31, import_swr3, ChatContext;
26769
+ var import_react31, import_swr4, ChatContext;
26740
26770
  var init_ChatProvider = __esm({
26741
26771
  "context/providers/ChatProvider.tsx"() {
26742
26772
  "use strict";
@@ -26749,7 +26779,7 @@ var init_ChatProvider = __esm({
26749
26779
  init_platform();
26750
26780
  init_AppProvider();
26751
26781
  init_getHourlyLimit();
26752
- import_swr3 = __toESM(require("swr"));
26782
+ import_swr4 = __toESM(require("swr"));
26753
26783
  init_useWebSocket();
26754
26784
  ChatContext = (0, import_react31.createContext)(void 0);
26755
26785
  }
@@ -28159,7 +28189,7 @@ function TimerContextProvider({
28159
28189
  data: timerData,
28160
28190
  mutate: refetchTimer,
28161
28191
  isLoading: isLoadingTimer
28162
- } = (0, import_swr4.default)(
28192
+ } = (0, import_swr5.default)(
28163
28193
  deviceId && token && shouldFetchTimer ? ["timer"] : null,
28164
28194
  // Disabled by default, fetch manually with refetchTimer()
28165
28195
  async () => {
@@ -28807,14 +28837,14 @@ function TimerContextProvider({
28807
28837
  }
28808
28838
  ), children);
28809
28839
  }
28810
- var import_react36, import_swr4, STORAGE_SELECTED_TASKS_KEY, TimerContext, useTimerContext;
28840
+ var import_react36, import_swr5, STORAGE_SELECTED_TASKS_KEY, TimerContext, useTimerContext;
28811
28841
  var init_TimerContext = __esm({
28812
28842
  "context/TimerContext.tsx"() {
28813
28843
  "use strict";
28814
28844
  "use client";
28815
28845
  import_react36 = require("react");
28816
28846
  init_utils();
28817
- import_swr4 = __toESM(require("swr"));
28847
+ import_swr5 = __toESM(require("swr"));
28818
28848
  init_useWebSocket();
28819
28849
  init_providers();
28820
28850
  init_platform();
@@ -37343,7 +37373,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
37343
37373
  data: quotaData,
37344
37374
  mutate: refetchQuotaInfo,
37345
37375
  isLoading: isFetchingQuotaInfo
37346
- } = (0, import_swr5.default)(
37376
+ } = (0, import_swr6.default)(
37347
37377
  token && ["quotaInfo"],
37348
37378
  () => {
37349
37379
  return fetchQuotaInfo();
@@ -39864,7 +39894,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
39864
39894
  )
39865
39895
  ));
39866
39896
  }
39867
- var import_react57, import_clsx5, import_sanitize_html2, import_uuid3, import_react_hot_toast9, import_swr5, import_nprogress, MAX_FILES;
39897
+ var import_react57, import_clsx5, import_sanitize_html2, import_uuid3, import_react_hot_toast9, import_swr6, import_nprogress, MAX_FILES;
39868
39898
  var init_Chat = __esm({
39869
39899
  "Chat.tsx"() {
39870
39900
  "use strict";
@@ -39884,7 +39914,7 @@ var init_Chat = __esm({
39884
39914
  import_uuid3 = require("uuid");
39885
39915
  init_hooks();
39886
39916
  import_react_hot_toast9 = __toESM(require("react-hot-toast"));
39887
- import_swr5 = __toESM(require("swr"));
39917
+ import_swr6 = __toESM(require("swr"));
39888
39918
  init_utils();
39889
39919
  init_needsWebSearch();
39890
39920
  init_useWebSocket();
@@ -42187,39 +42217,6 @@ var init_Account = __esm({
42187
42217
  }
42188
42218
  });
42189
42219
 
42190
- // lib/db.ts
42191
- var import_idb, dbInstance, getDB, clearCache;
42192
- var init_db = __esm({
42193
- "lib/db.ts"() {
42194
- "use strict";
42195
- import_idb = require("idb");
42196
- dbInstance = null;
42197
- getDB = async () => {
42198
- if (typeof indexedDB === "undefined") {
42199
- return null;
42200
- }
42201
- if (dbInstance) return dbInstance;
42202
- dbInstance = await (0, import_idb.openDB)("vex-cache", 1, {
42203
- upgrade(db) {
42204
- if (!db.objectStoreNames.contains("cache")) {
42205
- db.createObjectStore("cache");
42206
- }
42207
- }
42208
- });
42209
- return dbInstance;
42210
- };
42211
- clearCache = async () => {
42212
- try {
42213
- const db = await getDB();
42214
- if (!db) return;
42215
- await db.clear("cache");
42216
- } catch (error) {
42217
- console.error("Failed to clear cache:", error);
42218
- }
42219
- };
42220
- }
42221
- });
42222
-
42223
42220
  // SignIn.web.tsx
42224
42221
  function SignIn({
42225
42222
  className,
@@ -42233,6 +42230,7 @@ function SignIn({
42233
42230
  }) {
42234
42231
  const isExtension2 = checkIsExtension();
42235
42232
  const isAppleSignInAvailable = true;
42233
+ const { clear: clear2 } = useCache();
42236
42234
  const {
42237
42235
  setToken,
42238
42236
  user,
@@ -42244,7 +42242,7 @@ function SignIn({
42244
42242
  setSignInPart: setPart
42245
42243
  } = useAuth();
42246
42244
  const signInContext = async (provider, options) => {
42247
- await clearCache();
42245
+ clear2();
42248
42246
  return signInContextInternal?.(provider, options);
42249
42247
  };
42250
42248
  const { t: t5 } = useAppContext();
@@ -42688,7 +42686,7 @@ var init_SignIn_web = __esm({
42688
42686
  init_Modal();
42689
42687
  init_providers();
42690
42688
  init_platform();
42691
- init_db();
42689
+ init_useCache();
42692
42690
  }
42693
42691
  });
42694
42692
 
@@ -43279,7 +43277,7 @@ function Subscribe({
43279
43277
  );
43280
43278
  setGiftedFingerPrint(data.fingerprint);
43281
43279
  }
43282
- fetchSession();
43280
+ await fetchSession();
43283
43281
  setIsModalOpen(false);
43284
43282
  } else {
43285
43283
  if (data.error) {
@@ -47562,6 +47560,7 @@ function MemoryConsent({
47562
47560
  const { actions } = useData();
47563
47561
  const { captureException } = useError();
47564
47562
  const [isDeleting, setIsDeleting] = (0, import_react82.useState)(false);
47563
+ const [isDeletingSession, setIsDeletingSession] = (0, import_react82.useState)(false);
47565
47564
  const containerRef = (0, import_react82.useRef)(null);
47566
47565
  (0, import_react82.useEffect)(() => {
47567
47566
  function handleClickOutside(event) {
@@ -47688,12 +47687,14 @@ function MemoryConsent({
47688
47687
  }
47689
47688
  },
47690
47689
  /* @__PURE__ */ React.createElement(icons_exports.Trash2, { size: 15, color: "var(--accent-0)" })
47691
- ) : null) : /* @__PURE__ */ React.createElement(
47690
+ ) : null) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
47692
47691
  ConfirmButton_default,
47693
47692
  {
47694
47693
  confirm: /* @__PURE__ */ React.createElement(React.Fragment, null, isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.Brain, { color: "#ef5350", size: 18 }), t5("Are you sure?")),
47695
47694
  disabled: isUpdatingMemories,
47696
- title: t5("\u{1F4AD} We use conversation memory to improve responses."),
47695
+ title: t5(
47696
+ "\u{1F4AD} We use conversation memory to improve responses."
47697
+ ),
47697
47698
  className: "transparent",
47698
47699
  style: {
47699
47700
  ...utilities.transparent.style,
@@ -47725,7 +47726,38 @@ function MemoryConsent({
47725
47726
  },
47726
47727
  isUpdatingMemories ? /* @__PURE__ */ React.createElement(Loading, { width: 18, height: 18 }) : /* @__PURE__ */ React.createElement(icons_exports.Brain, { color: "var(--shade-5)", size: 18 }),
47727
47728
  t5("Disable Memories")
47728
- ) : /* @__PURE__ */ React.createElement(
47729
+ ), isE2E && /* @__PURE__ */ React.createElement(
47730
+ ConfirmButton_default,
47731
+ {
47732
+ className: "transparent",
47733
+ processing: isDeletingSession,
47734
+ "data-testid": "clear-session",
47735
+ key: String(isDeletingSession),
47736
+ onConfirm: async () => {
47737
+ if (!token) return;
47738
+ try {
47739
+ const result = await apiFetch(`${API_URL2}/clear`, {
47740
+ method: "POST",
47741
+ headers: {
47742
+ "Content-Type": "application/json",
47743
+ Authorization: `Bearer ${token}`
47744
+ }
47745
+ });
47746
+ const data = await result.json();
47747
+ if (data.error) {
47748
+ import_react_hot_toast19.default.error(data.error);
47749
+ return;
47750
+ }
47751
+ data.success && import_react_hot_toast19.default.success(t5("Session cleared"));
47752
+ } catch (error) {
47753
+ console.error("Error updating guest:", error);
47754
+ } finally {
47755
+ setIsUpdatingMemories(false);
47756
+ }
47757
+ }
47758
+ },
47759
+ /* @__PURE__ */ React.createElement(icons_exports.Trash2, { color: "red", size: 13 })
47760
+ )) : /* @__PURE__ */ React.createElement(
47729
47761
  Button,
47730
47762
  {
47731
47763
  disabled: isUpdatingMemories,
@@ -77907,7 +77939,7 @@ function Calendar3({
77907
77939
  data: calendarEventsData,
77908
77940
  isLoading: isLoadingCalendarEvents,
77909
77941
  mutate: refetchCalendarEvents
77910
- } = (0, import_swr6.default)(
77942
+ } = (0, import_swr7.default)(
77911
77943
  token ? ["calendarEvents", calendarEventsStartDate, calendarEventsEndDate] : null,
77912
77944
  async () => {
77913
77945
  return await actions.getCalendarEvents({
@@ -78440,7 +78472,7 @@ function Calendar3({
78440
78472
  }
78441
78473
  ));
78442
78474
  }
78443
- var import_react_big_calendar, import_styles, import_react105, import_dragAndDrop, import_swr6, import_styles2, import_Calendar_module, import_clsx13, import_react_hot_toast22, locales2, createLocalizer, DnDCalendar, CustomToolbar, EventComponent;
78475
+ var import_react_big_calendar, import_styles, import_react105, import_dragAndDrop, import_swr7, import_styles2, import_Calendar_module, import_clsx13, import_react_hot_toast22, locales2, createLocalizer, DnDCalendar, CustomToolbar, EventComponent;
78444
78476
  var init_Calendar_web = __esm({
78445
78477
  "Calendar.web.tsx"() {
78446
78478
  "use strict";
@@ -78451,7 +78483,7 @@ var init_Calendar_web = __esm({
78451
78483
  init_react_big_calendar_esm();
78452
78484
  import_dragAndDrop = __toESM(require_dragAndDrop());
78453
78485
  init_date_fns();
78454
- import_swr6 = __toESM(require("swr"));
78486
+ import_swr7 = __toESM(require("swr"));
78455
78487
  init_react_big_calendar_esm();
78456
78488
  init_locale();
78457
78489
  import_styles2 = require("./styles-33VDVJ6F.css");
@@ -79574,7 +79606,7 @@ var Threads_exports = {};
79574
79606
  __export(Threads_exports, {
79575
79607
  default: () => Threads_default
79576
79608
  });
79577
- var import_react111, import_swr7, Threads, Threads_default;
79609
+ var import_react111, import_swr8, Threads, Threads_default;
79578
79610
  var init_Threads = __esm({
79579
79611
  "Threads.tsx"() {
79580
79612
  "use strict";
@@ -79582,7 +79614,7 @@ var init_Threads = __esm({
79582
79614
  import_react111 = __toESM(require("react"));
79583
79615
  init_AppContext();
79584
79616
  init_Loading();
79585
- import_swr7 = __toESM(require("swr"));
79617
+ import_swr8 = __toESM(require("swr"));
79586
79618
  init_icons();
79587
79619
  init_utils();
79588
79620
  init_MotiView();
@@ -79672,7 +79704,7 @@ var init_Threads = __esm({
79672
79704
  mutate: refetch,
79673
79705
  isLoading: isLoadingThreads,
79674
79706
  error
79675
- } = (0, import_swr7.default)(
79707
+ } = (0, import_swr8.default)(
79676
79708
  ["threads", until, search, sortByDate, app?.id],
79677
79709
  () => {
79678
79710
  if (!token) return;
@@ -80173,7 +80205,7 @@ var Users_exports = {};
80173
80205
  __export(Users_exports, {
80174
80206
  default: () => Users_default
80175
80207
  });
80176
- var import_react113, import_clsx14, import_swr8, import_react_hot_toast24, Users2, Users_default;
80208
+ var import_react113, import_clsx14, import_swr9, import_react_hot_toast24, Users2, Users_default;
80177
80209
  var init_Users = __esm({
80178
80210
  "Users.tsx"() {
80179
80211
  "use strict";
@@ -80181,7 +80213,7 @@ var init_Users = __esm({
80181
80213
  import_react113 = __toESM(require("react"));
80182
80214
  init_Skeleton();
80183
80215
  import_clsx14 = __toESM(require("clsx"));
80184
- import_swr8 = __toESM(require("swr"));
80216
+ import_swr9 = __toESM(require("swr"));
80185
80217
  init_AppContext();
80186
80218
  init_utils();
80187
80219
  init_Search();
@@ -80224,7 +80256,7 @@ var init_Users = __esm({
80224
80256
  const [selectedCharacterProfileId, setSelectedCharacterProfileId] = (0, import_react113.useState)(void 0);
80225
80257
  const { actions } = useData();
80226
80258
  const [users, setUsers] = (0, import_react113.useState)([]);
80227
- const { data: usersData, error } = (0, import_swr8.default)(
80259
+ const { data: usersData, error } = (0, import_swr9.default)(
80228
80260
  token ? ["users", until, find, similarTo] : null,
80229
80261
  () => {
80230
80262
  if (!token) return;
@@ -81258,7 +81290,7 @@ var init_Hey = __esm({
81258
81290
  if (!isImageLoaded) return;
81259
81291
  const timer = setTimeout(() => {
81260
81292
  setMinSplashTimeElapsed(true);
81261
- }, 700);
81293
+ }, 1e3);
81262
81294
  return () => clearTimeout(timer);
81263
81295
  }, [isImageLoaded]);
81264
81296
  const getSplash = (isSplash2) => {
@@ -81412,7 +81444,7 @@ function AppProviders({
81412
81444
  setTimeout(() => revalidate({ retryCount }), 5e3);
81413
81445
  }
81414
81446
  };
81415
- return /* @__PURE__ */ import_react118.default.createElement(import_swr9.SWRConfig, { key: cacheReady ? "persistent" : "memory", value: swrConfig }, /* @__PURE__ */ import_react118.default.createElement(
81447
+ return /* @__PURE__ */ import_react118.default.createElement(import_swr10.SWRConfig, { key: cacheReady ? "persistent" : "memory", value: swrConfig }, /* @__PURE__ */ import_react118.default.createElement(
81416
81448
  PlatformProvider,
81417
81449
  {
81418
81450
  viewPortWidth,
@@ -81443,7 +81475,7 @@ function AppProviders({
81443
81475
  )))
81444
81476
  ));
81445
81477
  }
81446
- var import_react118, import_swr9;
81478
+ var import_react118, import_swr10;
81447
81479
  var init_providers = __esm({
81448
81480
  "context/providers/index.tsx"() {
81449
81481
  "use strict";
@@ -81466,7 +81498,7 @@ var init_providers = __esm({
81466
81498
  init_ChatProvider();
81467
81499
  init_AppProvider();
81468
81500
  init_AppContext();
81469
- import_swr9 = require("swr");
81501
+ import_swr10 = require("swr");
81470
81502
  init_TimerContext();
81471
81503
  init_Hey();
81472
81504
  init_swrCacheProvider();