@chrryai/chrry 1.5.65 → 1.5.67

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/README.md CHANGED
@@ -27,7 +27,7 @@ Chrry is a comprehensive React component library built for AI applications. It i
27
27
 
28
28
  ## 🌶️ Pepper Router
29
29
 
30
- Chrry pairs perfectly with **[Pepper Router](https://github.com/askvex/pepper)** - our universal router with view transitions:
30
+ Chrry pairs perfectly with **[Pepper Router](https://github.comchrryAIpepper)** - our universal router with view transitions:
31
31
 
32
32
  ```bash
33
33
  npm install @chrryai/pepper
package/dist/index.js CHANGED
@@ -2093,7 +2093,7 @@ var init_utils = __esm({
2093
2093
  };
2094
2094
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
2095
2095
  config = getSiteConfig(getClientHostname());
2096
- VERSION = config.version || "1.5.65";
2096
+ VERSION = config.version || "1.5.67";
2097
2097
  getSlugFromPathname = (path) => {
2098
2098
  return getAppAndStoreSlugs(path, {
2099
2099
  defaultAppSlug: config.slug,
@@ -24415,7 +24415,7 @@ function DataProvider({ children, ...rest }) {
24415
24415
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24416
24416
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24417
24417
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24418
- const VERSION4 = "1.5.65";
24418
+ const VERSION4 = "1.5.67";
24419
24419
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24420
24420
  const {
24421
24421
  API_URL: API_URL2,
@@ -26470,11 +26470,11 @@ function ChatProvider({
26470
26470
  userNameByUrl = pathSegments[pathSegments.length - 1];
26471
26471
  }
26472
26472
  const [collaborationStatus, setCollaborationStatusInternal] = (0, import_react31.useState)(
26473
- user && threads && threads?.threads?.length && (searchParams.get("collaborationStatus") ?? threads?.threads?.every(
26474
- (thread3) => thread3.collaborations?.some(
26475
- (collaboration) => collaboration.user.id === user?.id && collaboration.collaboration.status === "pending"
26476
- )
26477
- )) ? "pending" : void 0
26473
+ user?.pendingCollaborationThreadsCount || guest?.pendingCollaborationThreadsCount ? "pending" : void 0
26474
+ );
26475
+ console.log(
26476
+ `\u{1F680} ~ user?.pendingCollaborationThreadsCount:`,
26477
+ user?.pendingCollaborationThreadsCount
26478
26478
  );
26479
26479
  (0, import_react31.useEffect)(() => {
26480
26480
  if (user && migratedFromGuestRef.current) {
@@ -26537,7 +26537,6 @@ function ChatProvider({
26537
26537
  setIsLoadingThreads(false);
26538
26538
  }
26539
26539
  }, [threadsSwr]);
26540
- console.log(`\u{1F680} ~ threadsSwr:`, threadsSwr);
26541
26540
  const fetchActiveCollaborationThreadsCount = async () => {
26542
26541
  const threads2 = await actions.getThreads({
26543
26542
  pageSize: 1,
@@ -26562,8 +26561,11 @@ function ChatProvider({
26562
26561
  });
26563
26562
  threads2 && threads2.totalCount && setPendingCollaborationThreadsCount(threads2.totalCount);
26564
26563
  };
26565
- const setCollaborationStatus = (status2) => {
26566
- setCollaborationStatusInternal(status2);
26564
+ const setCollaborationStatus = (newStatus) => {
26565
+ if (newStatus === collaborationStatus) {
26566
+ return;
26567
+ }
26568
+ setCollaborationStatusInternal(newStatus);
26567
26569
  fetchActiveCollaborationThreadsCount();
26568
26570
  fetchPendingCollaborationThreadsCount();
26569
26571
  };
@@ -37253,7 +37255,7 @@ function Chat({
37253
37255
  setDebateAgent,
37254
37256
  isDebating,
37255
37257
  setIsDebating,
37256
- setIsChatFloating: setIsChatFloatingContext,
37258
+ setIsChatFloating,
37257
37259
  setIsWebSearchEnabled: setWebSearchEnabledInternal,
37258
37260
  isWebSearchEnabled,
37259
37261
  setInput: setInputInternal,
@@ -37383,11 +37385,10 @@ function Chat({
37383
37385
  const [hasBottomOffset, setHasBottomOffset] = (0, import_react57.useState)(false);
37384
37386
  const shouldUseCompactMode = compactMode || hasBottomOffset;
37385
37387
  const floatingInitial = shouldUseCompactMode ? true : !threadId ? false : isChatFloatingContext && !empty && !showChatInput;
37386
- const [isChatFloating, setIsChatFloatingState] = (0, import_react57.useState)(floatingInitial);
37388
+ const isChatFloating = floatingInitial;
37387
37389
  (0, import_react57.useEffect)(() => {
37388
- setIsChatFloatingContext(floatingInitial);
37389
- setIsChatFloatingState(floatingInitial);
37390
- }, [floatingInitial]);
37390
+ setIsChatFloating(floatingInitial);
37391
+ }, [floatingInitial, threadId]);
37391
37392
  const stripActionFromText = (text3) => {
37392
37393
  const actionMatch = text3.match(/ACTION:\s*(\{(?:[^{}]|\{[^}]*\})*\})\s*$/);
37393
37394
  if (actionMatch) {
@@ -38695,7 +38696,11 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
38695
38696
  const threadId2 = threadIdRef.current;
38696
38697
  if (!token) return;
38697
38698
  const clientId = data?.clientId;
38698
- if (type === "stream_update" && data.chunk && clientId) {
38699
+ const chunk2 = data?.chunk;
38700
+ if (type === "stream_update" && chunk2 && clientId && data.message && (isOwner_default(data.message.message, {
38701
+ userId: user?.id,
38702
+ guestId: guest?.id
38703
+ }) ? data.deviceId === deviceId : true)) {
38699
38704
  if (isSpeechActive && os !== "ios") {
38700
38705
  return;
38701
38706
  }
@@ -38710,10 +38715,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
38710
38715
  if (shouldStopRef.current) return;
38711
38716
  if (!shouldStopRef.current) {
38712
38717
  streamContentRef.current += data.chunk;
38713
- const cleanContent = stripActionText(
38714
- streamContentRef.current,
38715
- data.chunk
38716
- );
38718
+ const cleanContent = stripActionText(streamContentRef.current, chunk2);
38717
38719
  onStreamingUpdate?.({
38718
38720
  content: cleanContent,
38719
38721
  clientId,
@@ -45076,7 +45078,7 @@ function Store({
45076
45078
  if (slugParam) {
45077
45079
  const app = storeApps?.find((app2) => app2.slug === slugParam);
45078
45080
  if (app) {
45079
- setSelectedApp(app);
45081
+ setSelectedAppInternal(app);
45080
45082
  }
45081
45083
  }
45082
45084
  }, [slugParam, storeAppsContext]);
@@ -82032,7 +82034,7 @@ function createDexieProvider(config2 = DEFAULT_CONFIG) {
82032
82034
  }
82033
82035
  }
82034
82036
  initialize();
82035
- return {
82037
+ const cache = {
82036
82038
  get: (key) => {
82037
82039
  const value = memCache.get(key);
82038
82040
  if (value !== void 0 && !degradedMode) {
@@ -82043,38 +82045,56 @@ function createDexieProvider(config2 = DEFAULT_CONFIG) {
82043
82045
  },
82044
82046
  set: (key, value) => {
82045
82047
  memCache.set(key, value);
82046
- if (degradedMode) return;
82047
- const entry = {
82048
- key,
82049
- value,
82050
- ts: Date.now(),
82051
- lastAccess: Date.now(),
82052
- version: SCHEMA_VERSION
82053
- };
82054
- withRetry(() => db.cache.put(entry), config2, `set(${key})`).catch(
82055
- (error) => {
82056
- if (isQuotaExceeded(error)) {
82057
- runGarbageCollection().then(() => {
82058
- db.cache.put(entry).catch(() => {
82059
- console.warn("[SWR Cache] Switching to degraded mode");
82060
- degradedMode = true;
82048
+ if (!degradedMode) {
82049
+ const entry = {
82050
+ key,
82051
+ value,
82052
+ ts: Date.now(),
82053
+ lastAccess: Date.now(),
82054
+ version: SCHEMA_VERSION
82055
+ };
82056
+ withRetry(() => db.cache.put(entry), config2, `set(${key})`).catch(
82057
+ (error) => {
82058
+ if (isQuotaExceeded(error)) {
82059
+ runGarbageCollection().then(() => {
82060
+ db.cache.put(entry).catch(() => {
82061
+ console.warn("[SWR Cache] Switching to degraded mode");
82062
+ degradedMode = true;
82063
+ });
82061
82064
  });
82062
- });
82065
+ }
82063
82066
  }
82064
- }
82065
- );
82067
+ );
82068
+ }
82066
82069
  },
82067
82070
  delete: (key) => {
82068
82071
  memCache.delete(key);
82069
- if (degradedMode) return;
82070
- db.cache.delete(key).catch((error) => {
82071
- console.error("[SWR Cache] Failed to delete from IndexedDB:", error);
82072
- });
82072
+ if (!degradedMode) {
82073
+ db.cache.delete(key).catch((error) => {
82074
+ console.error("[SWR Cache] Failed to delete from IndexedDB:", error);
82075
+ });
82076
+ }
82073
82077
  },
82074
82078
  keys: () => {
82075
82079
  return memCache.keys();
82080
+ },
82081
+ // Additional Map-like methods for compatibility
82082
+ has: (key) => {
82083
+ return memCache.has(key);
82084
+ },
82085
+ clear: () => {
82086
+ memCache.clear();
82087
+ if (!degradedMode) {
82088
+ db.cache.clear().catch((error) => {
82089
+ console.error("[SWR Cache] Failed to clear IndexedDB:", error);
82090
+ });
82091
+ }
82092
+ },
82093
+ get size() {
82094
+ return memCache.size;
82076
82095
  }
82077
82096
  };
82097
+ return cache;
82078
82098
  }
82079
82099
  function createMemoryProvider() {
82080
82100
  const cache = /* @__PURE__ */ new Map();