@chrryai/chrry 1.5.5 → 1.5.7

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.js CHANGED
@@ -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.5";
1905
+ VERSION = config.version || "1.5.7";
1906
1906
  getSlugFromPathname = (path) => {
1907
1907
  return getAppAndStoreSlugs(path, {
1908
1908
  defaultAppSlug: config.slug,
@@ -23995,7 +23995,7 @@ function DataProvider({ children, ...rest }) {
23995
23995
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
23996
23996
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
23997
23997
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
23998
- const VERSION4 = "1.5.5";
23998
+ const VERSION4 = "1.5.7";
23999
23999
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24000
24000
  const {
24001
24001
  API_URL: API_URL2,
@@ -26044,7 +26044,10 @@ function ChatProvider({
26044
26044
  } = (0, import_swr3.default)(
26045
26045
  shouldFetchThreads ? ["contextThreads", thread2?.id, app?.id, token] : null,
26046
26046
  async () => {
26047
- const key = `threads-${app?.id}-${user?.id || guest?.id}`;
26047
+ console.log(
26048
+ `\u{1F680} ~ file: ChatProvider.tsx:251 ~ shouldFetchThreads:`,
26049
+ shouldFetchThreads
26050
+ );
26048
26051
  try {
26049
26052
  const threads2 = await actions.getThreads({
26050
26053
  onError: (status2) => {
@@ -26077,6 +26080,7 @@ function ChatProvider({
26077
26080
  // revalidateOnFocus: true,
26078
26081
  }
26079
26082
  );
26083
+ console.log(`\u{1F680} ~ file: ChatProvider.tsx:246 ~ threadsData:`, threadsData);
26080
26084
  const [isLoadingThreads, setIsLoadingThreads] = (0, import_react31.useState)(true);
26081
26085
  (0, import_react31.useEffect)(() => {
26082
26086
  if (threadsError || !isLoadingThreadsSwr) {
@@ -26087,6 +26091,8 @@ function ChatProvider({
26087
26091
  threads: [],
26088
26092
  totalCount: 0
26089
26093
  });
26094
+ console.log(`\u{1F680} ~ file: ChatProvider.tsx:307 ~ threads:`, threads);
26095
+ console.log(`\u{1F680} ~ file: ChatProvider.tsx:321 ~ threadsData:`, threadsData);
26090
26096
  const [activeCollaborationThreadsCount, setActiveCollaborationThreadsCount] = (0, import_react31.useState)(0);
26091
26097
  (0, import_react31.useEffect)(() => {
26092
26098
  if (threadsData && Array.isArray(threadsData.threads)) {
@@ -81218,7 +81224,7 @@ var init_Hey = __esm({
81218
81224
  }
81219
81225
  }, [pathname, isExtension2]);
81220
81226
  const { threadId } = useChat();
81221
- const { allApps, app, isSplash, setIsSplash, session: session2 } = useAuth();
81227
+ const { allApps, app, isSplash, setIsSplash } = useAuth();
81222
81228
  const lastPathSegment = pathname.split("/").pop()?.split("?")[0];
81223
81229
  const store = allApps?.find(
81224
81230
  (app2) => app2?.store?.slug === lastPathSegment
@@ -81268,7 +81274,7 @@ var init_Hey = __esm({
81268
81274
  /* @__PURE__ */ React.createElement(
81269
81275
  ImageComponent,
81270
81276
  {
81271
- onLoad: (src) => {
81277
+ onLoad: () => {
81272
81278
  setIsImageLoaded(true);
81273
81279
  },
81274
81280
  app: isChrry ? void 0 : app,
@@ -81279,7 +81285,7 @@ var init_Hey = __esm({
81279
81285
  )
81280
81286
  );
81281
81287
  };
81282
- const splash = getSplash(isSplash);
81288
+ const splash = (0, import_react116.useMemo)(() => getSplash(isSplash), [isSplash]);
81283
81289
  (0, import_react116.useEffect)(() => {
81284
81290
  isSplash && isImageLoaded && isHydrated && minSplashTimeElapsed && setIsSplash(!app?.store?.apps?.length);
81285
81291
  }, [isImageLoaded, isHydrated, isSplash, allApps, minSplashTimeElapsed]);
@@ -81376,9 +81382,14 @@ function AppProviders({
81376
81382
  }) {
81377
81383
  const [error, setError] = (0, import_react118.useState)("");
81378
81384
  const cacheProvider = useSWRCacheProvider();
81385
+ const [cacheReady, setCacheReady] = (0, import_react118.useState)(false);
81386
+ (0, import_react118.useEffect)(() => {
81387
+ if (cacheProvider && !cacheReady) {
81388
+ setCacheReady(true);
81389
+ }
81390
+ }, [cacheProvider, cacheReady]);
81379
81391
  const swrConfig = {
81380
- // Use persistent cache provider when ready (IndexedDB on web, MMKV on native)
81381
- // If not ready yet, SWR uses its default in-memory cache
81392
+ // Use persistent cache provider (IndexedDB on web, MMKV on native)
81382
81393
  ...cacheProvider ? { provider: cacheProvider } : {},
81383
81394
  // Pre-populate cache with SSR session data
81384
81395
  fallback: session2 ? { session: { data: session2 } } : {},
@@ -81400,7 +81411,7 @@ function AppProviders({
81400
81411
  setTimeout(() => revalidate({ retryCount }), 5e3);
81401
81412
  }
81402
81413
  };
81403
- return /* @__PURE__ */ import_react118.default.createElement(import_swr9.SWRConfig, { value: swrConfig }, /* @__PURE__ */ import_react118.default.createElement(
81414
+ return /* @__PURE__ */ import_react118.default.createElement(import_swr9.SWRConfig, { key: cacheReady ? "persistent" : "memory", value: swrConfig }, /* @__PURE__ */ import_react118.default.createElement(
81404
81415
  PlatformProvider,
81405
81416
  {
81406
81417
  viewPortWidth,