@chrryai/chrry 1.6.21 → 1.6.27

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.
@@ -568,7 +568,7 @@
568
568
  .taskContent {
569
569
  display: flex;
570
570
  align-items: center;
571
- gap: 5px;
571
+ gap: 10px;
572
572
  flex: 1;
573
573
  }
574
574
 
package/dist/index.js CHANGED
@@ -3108,7 +3108,7 @@ var init_utils = __esm({
3108
3108
  };
3109
3109
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
3110
3110
  config = getSiteConfig(getClientHostname());
3111
- VERSION = config.version || "1.6.21";
3111
+ VERSION = config.version || "1.6.27";
3112
3112
  getSlugFromPathname = (path) => {
3113
3113
  return getAppAndStoreSlugs(path, {
3114
3114
  defaultAppSlug: config.slug,
@@ -24617,7 +24617,7 @@ function DataProvider({ children, ...rest }) {
24617
24617
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24618
24618
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24619
24619
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24620
- const VERSION4 = "1.6.21";
24620
+ const VERSION4 = "1.6.27";
24621
24621
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24622
24622
  const {
24623
24623
  API_URL: API_URL2,
@@ -26897,6 +26897,7 @@ function ChatProvider({
26897
26897
  );
26898
26898
  if (!a) return;
26899
26899
  setSelectedAgent(a);
26900
+ setDebateAgent(null);
26900
26901
  }, [app, aiAgents]);
26901
26902
  const { isDevelopment: isDevelopment3, isE2E: isE2E3, actions } = useData();
26902
26903
  const hourlyLimit = isDevelopment3 && !isE2E3 ? 5e4 : getHourlyLimit({
@@ -28440,8 +28441,7 @@ function TimerContextProvider({
28440
28441
  timer: data,
28441
28442
  selectedTasks,
28442
28443
  type: "timer",
28443
- isCountingDown: false,
28444
- fingerprint
28444
+ isCountingDown: false
28445
28445
  });
28446
28446
  return;
28447
28447
  }
@@ -28450,14 +28450,17 @@ function TimerContextProvider({
28450
28450
  send({
28451
28451
  timer: data,
28452
28452
  selectedTasks,
28453
- type: "timer",
28454
- fingerprint
28453
+ type: "timer"
28455
28454
  });
28456
28455
  lastSent.current = now2;
28457
28456
  }
28458
28457
  },
28459
28458
  [send, selectedTasks, token, isCountingDown, isFinished, remoteTimer]
28460
28459
  );
28460
+ (0, import_react34.useEffect)(() => {
28461
+ if (!isCountingDown || !timer) return;
28462
+ updateTimer(timer);
28463
+ }, [isCountingDown, timer]);
28461
28464
  const setPresetMin1 = (0, import_react34.useCallback)(
28462
28465
  (value) => {
28463
28466
  setPresetMin1Internal(value);
@@ -28524,7 +28527,7 @@ function TimerContextProvider({
28524
28527
  setPresetMin2Internal(timer.preset2);
28525
28528
  setPresetMin3Internal(timer.preset3);
28526
28529
  }, [timer?.id]);
28527
- const [shouldFetchTimer, setShouldFetchTimer] = (0, import_react34.useState)(false);
28530
+ const [shouldFetchTimer, setShouldFetchTimer] = (0, import_react34.useState)(true);
28528
28531
  const {
28529
28532
  data: timerData,
28530
28533
  mutate: refetchTimer,
@@ -28581,7 +28584,9 @@ function TimerContextProvider({
28581
28584
  if (currentElapsed === 0) {
28582
28585
  return;
28583
28586
  }
28587
+ const updatedSelectedTasks = [];
28584
28588
  for (const selectedTask of selectedTasks) {
28589
+ let updatedTotal = null;
28585
28590
  setTasks((prevTasks) => {
28586
28591
  if (!prevTasks) return prevTasks;
28587
28592
  return {
@@ -28600,17 +28605,7 @@ function TimerContextProvider({
28600
28605
  ...task.total,
28601
28606
  { date: currentDay.toISOString(), count: 1 }
28602
28607
  ] : [{ date: currentDay.toISOString(), count: 1 }];
28603
- setSelectedTasks(
28604
- selectedTasks?.map((t5) => {
28605
- if (t5.id === task.id) {
28606
- return {
28607
- ...t5,
28608
- total
28609
- };
28610
- }
28611
- return t5;
28612
- })
28613
- );
28608
+ updatedTotal = total;
28614
28609
  return {
28615
28610
  ...task,
28616
28611
  total
@@ -28620,6 +28615,17 @@ function TimerContextProvider({
28620
28615
  })
28621
28616
  };
28622
28617
  });
28618
+ if (updatedTotal) {
28619
+ updatedSelectedTasks.push({
28620
+ ...selectedTask,
28621
+ total: updatedTotal
28622
+ });
28623
+ } else {
28624
+ updatedSelectedTasks.push(selectedTask);
28625
+ }
28626
+ }
28627
+ if (updatedSelectedTasks.length > 0) {
28628
+ setSelectedTasks(updatedSelectedTasks);
28623
28629
  }
28624
28630
  }
28625
28631
  }, [time, isCountingDown, isPaused, token]);
@@ -40201,7 +40207,7 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
40201
40207
  const sushiAgent2 = aiAgents.find(
40202
40208
  (agent) => agent.name === "sushi"
40203
40209
  );
40204
- if (sushiAgent2 && selectedAgent?.name !== "sushi") {
40210
+ if (sushiAgent2 && !selectedAgent?.capabilities?.pdf) {
40205
40211
  setSelectedAgent(sushiAgent2);
40206
40212
  }
40207
40213
  triggerFileInput(
@@ -42980,7 +42986,7 @@ function SignIn({
42980
42986
  console.error("Google auth failed:", error);
42981
42987
  }
42982
42988
  };
42983
- return /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, !user && !isExtension2 ? /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, showSignIn && /* @__PURE__ */ import_react64.default.createElement(
42989
+ return /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, !user ? /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, showSignIn && /* @__PURE__ */ import_react64.default.createElement(
42984
42990
  "button",
42985
42991
  {
42986
42992
  "data-testid": "login-button",
@@ -45088,7 +45094,7 @@ function Store({
45088
45094
  const { FRONTEND_URL: FRONTEND_URL2 } = useData();
45089
45095
  const { isMobileDevice } = useTheme2();
45090
45096
  const { utilities } = useStyles();
45091
- const { router, pathname, searchParams } = useNavigationContext();
45097
+ const { router, searchParams } = useNavigationContext();
45092
45098
  const { setIsNewAppChat } = useChat();
45093
45099
  const {
45094
45100
  track,
@@ -49292,7 +49298,7 @@ var init_FocusButton_styles = __esm({
49292
49298
  taskContent: {
49293
49299
  display: "flex",
49294
49300
  alignItems: "center",
49295
- gap: 5,
49301
+ gap: 10,
49296
49302
  flex: 1
49297
49303
  },
49298
49304
  addTaskButtons: {
@@ -49506,6 +49512,7 @@ function FocusButton2({
49506
49512
  setSelectedTasks,
49507
49513
  remoteTimer
49508
49514
  } = useTimerContext();
49515
+ const [isDeletingTask, setIsDeletingTask] = (0, import_react85.useState)(false);
49509
49516
  const isMovingItemRef = (0, import_react85.useRef)(false);
49510
49517
  const { isDark, setTheme: setThemeInContext } = useTheme2();
49511
49518
  const { setPlaceHolderText, placeHolderText, setShouldFocus } = useChat();
@@ -50270,8 +50277,12 @@ function FocusButton2({
50270
50277
  },
50271
50278
  /* @__PURE__ */ import_react85.default.createElement(icons_exports.GripVertical, { width: 22, height: 22 })
50272
50279
  ), /* @__PURE__ */ import_react85.default.createElement(
50273
- Button,
50280
+ ConfirmButton_default,
50274
50281
  {
50282
+ style: {
50283
+ position: "relative",
50284
+ bottom: 1.5
50285
+ },
50275
50286
  "data-testid": "edit-task-button",
50276
50287
  className: "link",
50277
50288
  onClick: () => {
@@ -50279,9 +50290,36 @@ function FocusButton2({
50279
50290
  handlePause();
50280
50291
  }
50281
50292
  setEditingTask(task);
50293
+ },
50294
+ processing: isDeletingTask,
50295
+ onConfirm: async () => {
50296
+ try {
50297
+ setIsDeletingTask(true);
50298
+ const response = await fetch(
50299
+ `${API_URL}/tasks/${task.id}`,
50300
+ {
50301
+ method: "DELETE",
50302
+ headers: {
50303
+ "Content-Type": "application/json",
50304
+ Authorization: `Bearer ${token}`
50305
+ }
50306
+ }
50307
+ );
50308
+ const result = await response.json();
50309
+ if (result.error) {
50310
+ import_react_hot_toast20.toast.error(result.error);
50311
+ return;
50312
+ }
50313
+ await fetchTasks();
50314
+ import_react_hot_toast20.toast.success(t5("Deleted"));
50315
+ } catch (error) {
50316
+ import_react_hot_toast20.toast.error(t5("Something went wrong"));
50317
+ } finally {
50318
+ setIsDeletingTask(false);
50319
+ }
50282
50320
  }
50283
50321
  },
50284
- /* @__PURE__ */ import_react85.default.createElement(icons_exports.Pencil, { width: 18, height: 18 })
50322
+ /* @__PURE__ */ import_react85.default.createElement(icons_exports.Trash2, { width: 18, height: 18 })
50285
50323
  ))
50286
50324
  )
50287
50325
  }
@@ -50329,6 +50367,7 @@ var init_FocusButton = __esm({
50329
50367
  init_siteConfig();
50330
50368
  init_FocusButton_styles();
50331
50369
  init_ThemeSwitcher();
50370
+ init_ConfirmButton();
50332
50371
  MAX_TIME = 3600;
50333
50372
  }
50334
50373
  });
@@ -81917,8 +81956,7 @@ var init_Hey = __esm({
81917
81956
  init_ErrorBoundary();
81918
81957
  init_Thread();
81919
81958
  init_Home();
81920
- init_url();
81921
- init_locales();
81959
+ init_providers();
81922
81960
  Store2 = (0, import_react114.lazy)(() => Promise.resolve().then(() => (init_Store(), Store_exports)));
81923
81961
  Calendar4 = (0, import_react114.lazy)(() => Promise.resolve().then(() => (init_Calendar(), Calendar_exports)));
81924
81962
  Why = (0, import_react114.lazy)(() => Promise.resolve().then(() => (init_Why(), Why_exports)));
@@ -81947,7 +81985,7 @@ var init_Hey = __esm({
81947
81985
  children,
81948
81986
  useExtensionIcon
81949
81987
  }) {
81950
- const { isHome, pathname, router } = useNavigationContext();
81988
+ const { pathname, router } = useNavigationContext();
81951
81989
  const { isExtension: isExtension2 } = usePlatform();
81952
81990
  const styles4 = useSidebarStyles();
81953
81991
  const [pathnameLocal, setPathnameLocal] = useLocalStorage2("pathname", isExtension2 ? pathname : void 0);
@@ -81957,20 +81995,12 @@ var init_Hey = __esm({
81957
81995
  }
81958
81996
  }, [pathname, isExtension2]);
81959
81997
  const { threadId } = useChat();
81960
- const { storeApps, app, isSplash, setIsSplash, apps } = useAuth();
81998
+ const { app, isSplash, setIsSplash, storeApps } = useAuth();
81999
+ const { currentStore } = useApp();
81961
82000
  const lastPathSegment = pathname.split("/").pop()?.split("?")[0];
81962
- const store = storeApps?.find(
81963
- (app2) => app2?.store?.slug === lastPathSegment
81964
- )?.store;
81965
82001
  const ssrRoutes = ["blog"];
81966
82002
  const ssrPrefixes = ["/blog"];
81967
82003
  const isSSRRoute = lastPathSegment && ssrRoutes.includes(lastPathSegment) || ssrPrefixes.some((prefix) => pathname.startsWith(prefix));
81968
- const { appSlug } = getAppAndStoreSlugs(pathname, {
81969
- defaultAppSlug: app?.slug ?? "",
81970
- defaultStoreSlug: app?.store?.slug ?? "",
81971
- excludedRoutes: excludedSlugRoutes,
81972
- locales
81973
- });
81974
82004
  const pathWithoutLocale = pathname.replace(/^\/[a-z]{2}\//, "/").slice(1).split("?")[0];
81975
82005
  (0, import_react114.useEffect)(() => {
81976
82006
  if (pathnameLocal && isExtension2 && pathnameLocal !== "/") {
@@ -81978,55 +82008,59 @@ var init_Hey = __esm({
81978
82008
  }
81979
82009
  }, [pathnameLocal, isExtension2]);
81980
82010
  const isChrry = app && app.slug === "chrry";
81981
- const isAppSlug = !!appSlug && storeApps.some((candidate) => candidate.slug === appSlug);
81982
- const isStorePage = !!store;
81983
- const isThreadDetailPage = !!threadId;
81984
- const RouteComponent = isStorePage ? Store2 : pathWithoutLocale && ROUTES[pathWithoutLocale] ? ROUTES[pathWithoutLocale] : lastPathSegment && ROUTES[lastPathSegment] ? ROUTES[lastPathSegment] : isAppSlug ? Home : null;
81985
- const isClientRoute = isExtension2 || !isSSRRoute && (!!RouteComponent || threadId || isThreadDetailPage || pathname === "/" || pathname === "/api" || isAppSlug);
82011
+ const isStorePage = storeApps?.find(
82012
+ (app2) => app2.store?.slug === pathWithoutLocale
82013
+ );
82014
+ const RouteComponent = isStorePage ? Store2 : pathWithoutLocale && ROUTES[pathWithoutLocale] ? ROUTES[pathWithoutLocale] : lastPathSegment && ROUTES[lastPathSegment] ? ROUTES[lastPathSegment] : null;
82015
+ const isClientRoute = isExtension2 || !isSSRRoute && (!!RouteComponent || threadId || pathname === "/" || pathname === "/api" || app || currentStore);
81986
82016
  const isHydrated = useHasHydrated();
81987
82017
  const [isImageLoaded, setIsImageLoaded] = (0, import_react114.useState)(false);
81988
82018
  const [minSplashTimeElapsed, setMinSplashTimeElapsed] = (0, import_react114.useState)(false);
81989
82019
  (0, import_react114.useEffect)(() => {
81990
82020
  if (!isImageLoaded) return;
82021
+ if (!app?.store?.apps?.length) return;
81991
82022
  const timer = setTimeout(() => {
81992
82023
  setMinSplashTimeElapsed(true);
81993
82024
  }, 1e3);
81994
82025
  return () => clearTimeout(timer);
81995
- }, [isImageLoaded]);
81996
- const getSplash = (isSplash2) => {
81997
- const splashStyle = styles4.splash;
81998
- const hiddenStyle = styles4.splashHidden;
81999
- if (!app) return null;
82000
- return /* @__PURE__ */ React.createElement(
82001
- Div,
82002
- {
82003
- style: {
82004
- ...splashStyle.style,
82005
- ...!isSplash2 ? hiddenStyle.style : {}
82006
- }
82007
- },
82008
- /* @__PURE__ */ React.createElement(
82009
- ImageComponent,
82026
+ }, [isImageLoaded, app]);
82027
+ const getSplash = (0, import_react114.useCallback)(
82028
+ (isSplash2) => {
82029
+ const splashStyle = styles4.splash;
82030
+ const hiddenStyle = styles4.splashHidden;
82031
+ if (!app) return null;
82032
+ return /* @__PURE__ */ React.createElement(
82033
+ Div,
82010
82034
  {
82011
- onLoad: (src) => {
82012
- setIsImageLoaded(true);
82013
- },
82014
- app: isChrry ? void 0 : app,
82015
- logo: isChrry ? "blossom" : void 0,
82016
- showLoading: false,
82017
- size: isChrry ? 72 : 64
82018
- }
82019
- )
82020
- );
82021
- };
82035
+ style: {
82036
+ ...splashStyle.style,
82037
+ ...!isSplash2 ? hiddenStyle.style : {}
82038
+ }
82039
+ },
82040
+ /* @__PURE__ */ React.createElement(
82041
+ ImageComponent,
82042
+ {
82043
+ onLoad: (src) => {
82044
+ setIsImageLoaded(true);
82045
+ },
82046
+ app: isChrry ? void 0 : app,
82047
+ logo: isChrry ? "blossom" : void 0,
82048
+ showLoading: false,
82049
+ size: isChrry ? 72 : 64
82050
+ }
82051
+ )
82052
+ );
82053
+ },
82054
+ [app, isSplash]
82055
+ );
82022
82056
  const splash = getSplash(isSplash);
82023
82057
  (0, import_react114.useEffect)(() => {
82024
- isSplash && isImageLoaded && isHydrated && minSplashTimeElapsed && setIsSplash(!apps.length);
82025
- }, [isImageLoaded, isHydrated, isSplash, apps, minSplashTimeElapsed]);
82058
+ isSplash && isImageLoaded && isHydrated && minSplashTimeElapsed && setIsSplash(!app?.store?.apps?.length);
82059
+ }, [isImageLoaded, isHydrated, isSplash, minSplashTimeElapsed]);
82026
82060
  return /* @__PURE__ */ React.createElement(Div, null, /* @__PURE__ */ React.createElement(ErrorBoundary, null, !app ? /* @__PURE__ */ React.createElement(Div, { style: styles4.splash.style }, /* @__PURE__ */ React.createElement(ImageComponent, { logo: "blossom", showLoading: false, size: 64 })) : /* @__PURE__ */ React.createElement(React.Fragment, null, splash, /* @__PURE__ */ React.createElement(import_react114.Suspense, null, isClientRoute ? (
82027
82061
  // Client-side routes: SWAP content
82028
82062
  // Check thread detail FIRST before RouteComponent
82029
- isThreadDetailPage && !isHome ? /* @__PURE__ */ React.createElement(Thread_default, { key: threadId }) : RouteComponent ? /* @__PURE__ */ React.createElement(RouteComponent, { className }) : isHome && /* @__PURE__ */ React.createElement(Home, { className })
82063
+ threadId ? /* @__PURE__ */ React.createElement(Thread_default, { key: threadId }) : RouteComponent ? /* @__PURE__ */ React.createElement(RouteComponent, null) : /* @__PURE__ */ React.createElement(Home, null)
82030
82064
  ) : children))));
82031
82065
  },
82032
82066
  (prevProps, nextProps) => {
@@ -82355,9 +82389,10 @@ var init_providers = __esm({
82355
82389
  // hooks/useMetadata.ts
82356
82390
  function useStoreMetadata(store) {
82357
82391
  const { i18n: i18n2 } = (0, import_react_i18next9.useTranslation)();
82358
- const { baseApp } = useAuth();
82392
+ const { baseApp, showFocus } = useAuth();
82359
82393
  const currentDomain = baseApp?.store?.domain || (typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "");
82360
82394
  (0, import_react116.useEffect)(() => {
82395
+ if (showFocus) return;
82361
82396
  if (typeof document === "undefined" || !store) return;
82362
82397
  const locale5 = i18n2.language || "en";
82363
82398
  const translations = i18n2.store.data[locale5]?.translation || {};
@@ -82408,13 +82443,13 @@ function useStoreMetadata(store) {
82408
82443
  if (metadata.alternates?.canonical) {
82409
82444
  updateOrCreateLink("canonical", String(metadata.alternates.canonical));
82410
82445
  }
82411
- }, [store, i18n2.language, baseApp]);
82446
+ }, [store, i18n2.language, baseApp, showFocus]);
82412
82447
  }
82413
82448
  function useAppMetadata2() {
82414
82449
  const { i18n: i18n2 } = (0, import_react_i18next9.useTranslation)();
82415
82450
  const { currentStore } = useApp();
82416
82451
  const enabled = !currentStore;
82417
- const { baseApp, app, language: locale5 } = useAuth();
82452
+ const { baseApp, app, language: locale5, showFocus } = useAuth();
82418
82453
  const storeApp = getWhiteLabel_default({ app }).storeApp || baseApp;
82419
82454
  const currentDomain = storeApp?.store?.domain || (typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "");
82420
82455
  const translations = i18n2.store.data[locale5]?.translation || {};
@@ -82427,6 +82462,7 @@ function useAppMetadata2() {
82427
82462
  whiteLabel: storeApp
82428
82463
  }) : void 0;
82429
82464
  (0, import_react116.useEffect)(() => {
82465
+ if (showFocus) return;
82430
82466
  if (!metadata || !enabled) return;
82431
82467
  if (metadata.title) {
82432
82468
  document.title = metadata.title;
@@ -82473,7 +82509,7 @@ function useAppMetadata2() {
82473
82509
  updateOrCreateLink("alternate", String(url), lang2);
82474
82510
  });
82475
82511
  }
82476
- }, [metadata, enabled]);
82512
+ }, [metadata, enabled, showFocus]);
82477
82513
  }
82478
82514
  function useThreadMetadata(thread2) {
82479
82515
  const { i18n: i18n2 } = (0, import_react_i18next9.useTranslation)();