@chrryai/chrry 1.5.62 → 1.5.63

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
@@ -1305,7 +1305,7 @@ declare const getThreads: ({ pageSize, token, search, sort, threadId, userName,
1305
1305
  search?: string;
1306
1306
  threadId?: string;
1307
1307
  userName?: string;
1308
- collaborationStatus?: "pending" | "active";
1308
+ collaborationStatus?: "pending" | "active" | null;
1309
1309
  myPendingCollaborations?: boolean;
1310
1310
  onError?: (status: number) => void;
1311
1311
  appId?: string;
@@ -1538,7 +1538,7 @@ declare const getActions: ({ API_URL, token, }: {
1538
1538
  search?: string;
1539
1539
  threadId?: string;
1540
1540
  userName?: string;
1541
- collaborationStatus?: "pending" | "active";
1541
+ collaborationStatus?: "pending" | "active" | null;
1542
1542
  myPendingCollaborations?: boolean;
1543
1543
  onError?: (status: number) => void;
1544
1544
  slug?: "Atlas" | "Peach" | "Vault" | "Bloom" | string | null;
package/dist/index.d.ts CHANGED
@@ -1305,7 +1305,7 @@ declare const getThreads: ({ pageSize, token, search, sort, threadId, userName,
1305
1305
  search?: string;
1306
1306
  threadId?: string;
1307
1307
  userName?: string;
1308
- collaborationStatus?: "pending" | "active";
1308
+ collaborationStatus?: "pending" | "active" | null;
1309
1309
  myPendingCollaborations?: boolean;
1310
1310
  onError?: (status: number) => void;
1311
1311
  appId?: string;
@@ -1538,7 +1538,7 @@ declare const getActions: ({ API_URL, token, }: {
1538
1538
  search?: string;
1539
1539
  threadId?: string;
1540
1540
  userName?: string;
1541
- collaborationStatus?: "pending" | "active";
1541
+ collaborationStatus?: "pending" | "active" | null;
1542
1542
  myPendingCollaborations?: boolean;
1543
1543
  onError?: (status: number) => void;
1544
1544
  slug?: "Atlas" | "Peach" | "Vault" | "Bloom" | string | null;
package/dist/index.js CHANGED
@@ -489,7 +489,7 @@ var init_locales = __esm({
489
489
 
490
490
  // utils/siteConfig.ts
491
491
  function detectSiteModeDomain(hostname2, mode) {
492
- const defaultMode = process.env.MODE || import_meta?.env?.VITE_SITE_MODE || mode || "focus";
492
+ const defaultMode = process.env.MODE || import_meta?.env?.VITE_SITE_MODE || mode || "vex";
493
493
  const rawHost = hostname2 || (typeof window !== "undefined" ? window?.location?.hostname : "") || "";
494
494
  let host = rawHost?.trim().toLowerCase();
495
495
  if (host?.includes("://")) {
@@ -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.62";
2096
+ VERSION = config.version || "1.5.63";
2097
2097
  getSlugFromPathname = (path) => {
2098
2098
  return getAppAndStoreSlugs(path, {
2099
2099
  defaultAppSlug: config.slug,
@@ -5329,7 +5329,7 @@ var init_lib = __esm({
5329
5329
  }) => {
5330
5330
  const url = new URL(`${API_URL2}/threads`);
5331
5331
  url.searchParams.set("pageSize", pageSize?.toString() || "10");
5332
- collaborationStatus && url.searchParams.set("collaborationStatus", collaborationStatus);
5332
+ collaborationStatus === null ? url.searchParams.set("collaborationStatus", "null") : collaborationStatus && url.searchParams.set("collaborationStatus", collaborationStatus);
5333
5333
  appId && url.searchParams.set("appId", appId);
5334
5334
  if (search) url.searchParams.set("search", search);
5335
5335
  if (sort) url.searchParams.set("sort", sort);
@@ -24400,7 +24400,7 @@ function DataProvider({ children, ...rest }) {
24400
24400
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24401
24401
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24402
24402
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24403
- const VERSION4 = "1.5.62";
24403
+ const VERSION4 = "1.5.63";
24404
24404
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24405
24405
  const {
24406
24406
  API_URL: API_URL2,
@@ -26455,11 +26455,11 @@ function ChatProvider({
26455
26455
  userNameByUrl = pathSegments[pathSegments.length - 1];
26456
26456
  }
26457
26457
  const [collaborationStatus, setCollaborationStatusInternal] = (0, import_react31.useState)(
26458
- searchParams.get("collaborationStatus") ?? threads?.threads?.every(
26458
+ user && threads && threads?.threads?.length && (searchParams.get("collaborationStatus") ?? threads?.threads?.every(
26459
26459
  (thread3) => thread3.collaborations?.some(
26460
26460
  (collaboration) => collaboration.user.id === user?.id && collaboration.collaboration.status === "pending"
26461
26461
  )
26462
- ) ? void 0 : void 0
26462
+ )) ? "pending" : void 0
26463
26463
  );
26464
26464
  (0, import_react31.useEffect)(() => {
26465
26465
  if (user && migratedFromGuestRef.current) {
@@ -26487,7 +26487,7 @@ function ChatProvider({
26487
26487
  userName: userNameByUrl,
26488
26488
  pageSize: pageSizes.menuThreads - (isMobile ? 2 : 0),
26489
26489
  sort: "bookmark",
26490
- collaborationStatus: collaborationStatus ?? void 0,
26490
+ collaborationStatus: collaborationStatus === "pending" ? void 0 : collaborationStatus,
26491
26491
  threadId: !thread2?.collaborations?.some(
26492
26492
  (c) => user && c.user.id === user?.id
26493
26493
  ) || guest ? thread2?.id : void 0
@@ -26514,9 +26514,7 @@ function ChatProvider({
26514
26514
  }
26515
26515
  }, [threadsError, isLoadingThreadsSwr]);
26516
26516
  const [activeCollaborationThreadsCount, setActiveCollaborationThreadsCount] = (0, import_react31.useState)(
26517
- threads?.threads?.filter(
26518
- (t5) => t5.collaborations?.some((c) => c.collaboration.status === "active")
26519
- ).length || 0
26517
+ user?.activeCollaborationThreadsCount || guest?.activeCollaborationThreadsCount || 0
26520
26518
  );
26521
26519
  (0, import_react31.useEffect)(() => {
26522
26520
  if (threadsSwr && Array.isArray(threadsSwr.threads)) {
@@ -26524,6 +26522,7 @@ function ChatProvider({
26524
26522
  setIsLoadingThreads(false);
26525
26523
  }
26526
26524
  }, [threadsSwr]);
26525
+ console.log(`\u{1F680} ~ threadsSwr:`, threadsSwr);
26527
26526
  const fetchActiveCollaborationThreadsCount = async () => {
26528
26527
  const threads2 = await actions.getThreads({
26529
26528
  pageSize: 1,
@@ -26554,19 +26553,6 @@ function ChatProvider({
26554
26553
  fetchPendingCollaborationThreadsCount();
26555
26554
  };
26556
26555
  const [isNewChat, setIsNewChatInternal] = (0, import_react31.useState)(false);
26557
- (0, import_react31.useEffect)(() => {
26558
- if (pathname !== "/") return;
26559
- if (!threadsSwr || !Array.isArray(threadsSwr.threads)) return;
26560
- if (collaborationStatus === void 0) {
26561
- !hasNotification && setHasNotification(true);
26562
- threadsSwr.threads.some((thread3) => thread3.userId === user?.id) && setCollaborationStatus("pending");
26563
- }
26564
- }, [
26565
- pendingCollaborationThreadsCount,
26566
- threadsSwr,
26567
- collaborationStatus,
26568
- hasNotification
26569
- ]);
26570
26556
  const [collaborationStep, setCollaborationStep] = (0, import_react31.useState)(0);
26571
26557
  const [isIncognito, setIsIncognito] = (0, import_react31.useState)(
26572
26558
  searchParams.get("incognito") === "true"
@@ -26617,11 +26603,20 @@ function ChatProvider({
26617
26603
  router.push(to);
26618
26604
  setStatus(null);
26619
26605
  isIncognito && setWasIncognito(true);
26620
- setCollaborationStatus(void 0);
26606
+ setCollaborationStatus(null);
26621
26607
  setIsChatFloating(false);
26622
26608
  }
26623
26609
  setIsNewChatInternal(value);
26624
26610
  };
26611
+ const fetchThreads = async () => {
26612
+ setShouldFetchThreads(true);
26613
+ shouldFetchThreads && await refetchThreads();
26614
+ };
26615
+ (0, import_react31.useEffect)(() => {
26616
+ if (app) {
26617
+ fetchThreads();
26618
+ }
26619
+ }, [app]);
26625
26620
  (0, import_react31.useEffect)(() => {
26626
26621
  setWasIncognito(isIncognito);
26627
26622
  if (isIncognito) {
@@ -27052,6 +27047,8 @@ function ChatProvider({
27052
27047
  ChatContext.Provider,
27053
27048
  {
27054
27049
  value: {
27050
+ fetchActiveCollaborationThreadsCount,
27051
+ fetchPendingCollaborationThreadsCount,
27055
27052
  setIsNewAppChat,
27056
27053
  shouldFocus,
27057
27054
  setShouldFocus,
@@ -27129,10 +27126,7 @@ function ChatProvider({
27129
27126
  setCollaborationStep,
27130
27127
  isVisitor,
27131
27128
  setIsVisitor,
27132
- refetchThreads: async () => {
27133
- setShouldFetchThreads(true);
27134
- shouldFetchThreads && await refetchThreads();
27135
- },
27129
+ refetchThreads: fetchThreads,
27136
27130
  userNameByUrl
27137
27131
  }
27138
27132
  },
@@ -46373,7 +46367,7 @@ function Message({
46373
46367
  key: message2.message.id,
46374
46368
  style: {
46375
46369
  ...styles4.userMessageContainer.style,
46376
- ...owner && styles4.owner.style,
46370
+ ...owner ? styles4.owner.style : { ...styles4.owner.style, alignSelf: "flex-start" },
46377
46371
  flexDirection: !isMobileDevice ? "row" : "column"
46378
46372
  }
46379
46373
  },
@@ -46422,7 +46416,7 @@ function Message({
46422
46416
  ),
46423
46417
  !owner && /* @__PURE__ */ React.createElement(Span, { style: styles4.userMessageTime.style }, timeAgo2(message2.message.createdOn, language))
46424
46418
  ),
46425
- !owner && isMobileDevice && /* @__PURE__ */ React.createElement(
46419
+ !owner && !isMobileDevice && /* @__PURE__ */ React.createElement(
46426
46420
  Span,
46427
46421
  {
46428
46422
  style: {
@@ -46643,6 +46637,9 @@ function Message({
46643
46637
  ));
46644
46638
  }
46645
46639
  const agent = message2.aiAgent;
46640
+ if (!agent) {
46641
+ return null;
46642
+ }
46646
46643
  return /* @__PURE__ */ React.createElement(Div, { style: styles4.message.style, "data-testid": "message" }, /* @__PURE__ */ React.createElement(
46647
46644
  Modal,
46648
46645
  {