@chrryai/chrry 1.4.36 → 1.4.40

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/Store.module.scss CHANGED
@@ -72,6 +72,8 @@
72
72
 
73
73
  .appTitle {
74
74
  display: flex;
75
+ margin: 0 0 toRem.toRem(10) 0;
76
+ font-size: toRem.toRem(20);
75
77
  }
76
78
 
77
79
  .titleText {
package/dist/index.js CHANGED
@@ -732,7 +732,7 @@ function getSiteConfig(hostnameOrMode) {
732
732
  favicon: "focus",
733
733
  mode: "focus",
734
734
  slug: "focus",
735
- version: "26.10.32",
735
+ version: "26.10.33",
736
736
  storeSlug: "blossom",
737
737
  name: "Focus",
738
738
  domain: "focus.chrry.ai",
@@ -1898,7 +1898,7 @@ var init_utils = __esm({
1898
1898
  };
1899
1899
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
1900
1900
  config = getSiteConfig(getClientHostname());
1901
- VERSION = config.version || "1.4.36";
1901
+ VERSION = config.version || "1.4.40";
1902
1902
  getSlugFromPathname = (path) => {
1903
1903
  return getAppAndStoreSlugs(path, {
1904
1904
  defaultAppSlug: config.slug,
@@ -23228,7 +23228,9 @@ function AuthProvider({
23228
23228
  if (!appSlug) {
23229
23229
  return void 0;
23230
23230
  }
23231
- const matchedApp = allApps?.find((app2) => app2.slug === appSlug);
23231
+ const matchedApp = allApps?.find(
23232
+ (app2) => app2.slug === appSlug || app2.store?.slug === appSlug
23233
+ );
23232
23234
  return matchedApp?.slug;
23233
23235
  };
23234
23236
  const findAppByPathname = (path, apps2) => {
@@ -23241,7 +23243,7 @@ function AuthProvider({
23241
23243
  setAllApps((prevApps) => {
23242
23244
  const existingAppsMap = new Map(prevApps.map((app2) => [app2.id, app2]));
23243
23245
  newApps.forEach((app2) => {
23244
- if (!existingAppsMap.has(app2.id) || !existingAppsMap.get(app2.id)?.store?.apps.length) {
23246
+ if (!existingAppsMap.has(app2.id) || !existingAppsMap.get(app2.id)?.store?.apps.length || !existingAppsMap.get(app2.id)?.store?.app) {
23245
23247
  existingAppsMap.set(app2.id, app2);
23246
23248
  }
23247
23249
  });
@@ -23379,9 +23381,8 @@ function AuthProvider({
23379
23381
  (0, import_react17.useEffect)(() => {
23380
23382
  const loadCachedApps = async () => {
23381
23383
  if (!token || !loadingApp?.id && !app?.id) return;
23382
- const key = `allApps-${loadingApp?.id || app?.id}-${user?.id || guest?.id}`;
23384
+ const key = `allApps`;
23383
23385
  const cached = await getCachedData(key);
23384
- console.log(`\u{1F680} ~ file: AuthProvider.tsx:958 ~ cached:`, cached);
23385
23386
  if (cached && cached.length > 0) {
23386
23387
  console.log("\u26A1 Loading cached apps instantly");
23387
23388
  mergeApps(cached);
@@ -23413,16 +23414,12 @@ function AuthProvider({
23413
23414
  }
23414
23415
  );
23415
23416
  (0, import_react17.useEffect)(() => {
23416
- console.log(`\u{1F680} ~ file: AuthProvider.tsx:940 ~ isLoadingApps:`, {
23417
- isLoadingApps,
23418
- loadingApp,
23419
- allAppsSwr
23420
- });
23421
- if (loadingApp && allApps?.find((app2) => app2.id === loadingApp.id)?.store?.apps.length) {
23422
- router.push(getAppSlug(loadingApp));
23417
+ const item = loadingApp ? allApps?.find((app2) => app2.id === loadingApp?.id) : void 0;
23418
+ if (loadingApp && item?.store?.apps.length) {
23423
23419
  setLoadingApp(void 0);
23420
+ return;
23424
23421
  }
23425
- if (!isLoadingApps && loadingApp) {
23422
+ if (loadingApp) {
23426
23423
  refetchApps();
23427
23424
  }
23428
23425
  }, [loadingApp, isLoadingApps, allApps]);
@@ -23623,7 +23620,6 @@ function AuthProvider({
23623
23620
  }
23624
23621
  }, [threadId]);
23625
23622
  const [isLoadingTasks, setIsLoadingTasks] = (0, import_react17.useState)(true);
23626
- console.log(`\u{1F680} ~ file: AuthProvider.tsx:1184 ~ allApps:`, allApps);
23627
23623
  (0, import_react17.useEffect)(() => {
23628
23624
  if (!allApps.length || !thread2 && threadId) return;
23629
23625
  let matchedApp;
@@ -23748,20 +23744,6 @@ function AuthProvider({
23748
23744
  if (sessionData.app) {
23749
23745
  setApp(sessionData.app);
23750
23746
  setStore(sessionData.app.store);
23751
- console.log("\u{1F504} Processing Session Data - Apps:", {
23752
- totalApps: sessionData.app.store?.apps?.length || 0,
23753
- apps: sessionData.app.store?.apps?.map((a) => ({
23754
- slug: a.slug,
23755
- name: a.name,
23756
- storeId: a.store?.id,
23757
- storeName: a.store?.name
23758
- })),
23759
- currentStoreId: sessionData.app.store?.id,
23760
- currentStoreName: sessionData.app.store?.name
23761
- });
23762
- if (sessionData?.app?.store?.apps?.length && sessionData?.app?.store?.apps?.length > 0) {
23763
- const currentStoreApps = sessionData.app.store.apps;
23764
- }
23765
23747
  }
23766
23748
  }
23767
23749
  }, [sessionData]);
@@ -24059,7 +24041,7 @@ function DataProvider({ children, ...rest }) {
24059
24041
  const [instructions, setInstructions] = (0, import_react19.useState)([]);
24060
24042
  const [affiliateStats, setAffiliateStats] = (0, import_react19.useState)(null);
24061
24043
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react19.useState)(false);
24062
- const VERSION4 = "1.4.36";
24044
+ const VERSION4 = "1.4.40";
24063
24045
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24064
24046
  const {
24065
24047
  API_URL: API_URL2,
@@ -25139,7 +25121,8 @@ function AppProvider({ children }) {
25139
25121
  setIsSavingApp,
25140
25122
  defaultInstructions,
25141
25123
  sushi,
25142
- focus
25124
+ focus,
25125
+ setLoadingApp
25143
25126
  } = useAuth();
25144
25127
  const { actions } = useData();
25145
25128
  const { t: t6 } = (0, import_react_i18next4.useTranslation)();
@@ -25350,11 +25333,20 @@ function AppProvider({ children }) {
25350
25333
  (0, import_react26.useEffect)(() => {
25351
25334
  setStoreSlug(pathname.replace("/", ""));
25352
25335
  }, [pathname]);
25353
- const currentStore = (0, import_react26.useMemo)(() => {
25336
+ const getCurrentStoreApp = () => {
25354
25337
  const pathSegments = pathname.split("/").filter(Boolean);
25355
25338
  const lastSegment = pathSegments[pathSegments.length - 1] || "";
25356
25339
  const matchedApp = allApps?.find((app2) => app2?.store?.slug === lastSegment);
25357
- return matchedApp?.store;
25340
+ return matchedApp;
25341
+ };
25342
+ const [currentStore, setCurrentStore] = (0, import_react26.useState)(getCurrentStoreApp()?.store);
25343
+ (0, import_react26.useEffect)(() => {
25344
+ const matchedApp = getCurrentStoreApp();
25345
+ if (matchedApp && !matchedApp?.store?.apps?.length) {
25346
+ setLoadingApp(matchedApp);
25347
+ return;
25348
+ }
25349
+ matchedApp?.store && setCurrentStore(matchedApp.store);
25358
25350
  }, [pathname, allApps]);
25359
25351
  const appFormWatcher = {
25360
25352
  ...watcher,
@@ -26045,6 +26037,8 @@ function ChatProvider({
26045
26037
  favouriteAgent,
26046
26038
  threadId,
26047
26039
  setThreadId,
26040
+ loadingApp,
26041
+ setLoadingApp,
26048
26042
  ...auth
26049
26043
  } = useAuth();
26050
26044
  const [isChatFloating, setIsChatFloating] = (0, import_react29.useState)(false);
@@ -26221,7 +26215,33 @@ function ChatProvider({
26221
26215
  setIsIncognito(searchParams.get("incognito") === "true");
26222
26216
  }, [searchParams]);
26223
26217
  const [wasIncognito, setWasIncognito] = (0, import_react29.useState)(isIncognito);
26224
- const [newChatTrigger, setNewChatTrigger] = (0, import_react29.useState)(0);
26218
+ const hasStoreApps = (item) => {
26219
+ const i = item && allApps?.find((app2) => app2.id === item?.id);
26220
+ return i?.store?.apps.length;
26221
+ };
26222
+ const [loading, setLoading] = (0, import_react29.useState)(false);
26223
+ const setIsNewAppChat = (item) => {
26224
+ if (!loadingApp && hasStoreApps(item) && item) {
26225
+ setIsNewChat(true, getAppSlug(item));
26226
+ setLoading(false);
26227
+ return;
26228
+ }
26229
+ if (!loadingApp && item) {
26230
+ setLoading(true);
26231
+ setLoadingApp(item);
26232
+ return;
26233
+ }
26234
+ };
26235
+ (0, import_react29.useEffect)(() => {
26236
+ if (!loading || !loadingApp) {
26237
+ return;
26238
+ }
26239
+ if (hasStoreApps(loadingApp) && loadingApp) {
26240
+ setIsNewChat(true, getAppSlug(loadingApp));
26241
+ setLoading(false);
26242
+ return;
26243
+ }
26244
+ }, [loading, allApps, loadingApp]);
26225
26245
  const setIsNewChat = (value, to = app?.slug ? getAppSlug(app) : "/") => {
26226
26246
  if (value) {
26227
26247
  setCollaborationStep(0);
@@ -26236,9 +26256,6 @@ function ChatProvider({
26236
26256
  setCollaborationStatus(void 0);
26237
26257
  setIsChatFloating(false);
26238
26258
  }
26239
- if (value && isExtension2) {
26240
- setNewChatTrigger((prev2) => prev2 + 1);
26241
- }
26242
26259
  setIsNewChatInternal(value);
26243
26260
  };
26244
26261
  (0, import_react29.useEffect)(() => {
@@ -26662,6 +26679,7 @@ function ChatProvider({
26662
26679
  ChatContext.Provider,
26663
26680
  {
26664
26681
  value: {
26682
+ setIsNewAppChat,
26665
26683
  shouldFocus,
26666
26684
  setShouldFocus,
26667
26685
  placeHolderText,
@@ -27490,7 +27508,9 @@ var init_Store_styles = __esm({
27490
27508
  fontSize: 14
27491
27509
  },
27492
27510
  appTitle: {
27493
- display: "flex"
27511
+ display: "flex",
27512
+ margin: "0 0 10px 0",
27513
+ fontSize: 20
27494
27514
  },
27495
27515
  titleText: {
27496
27516
  gap: 5,
@@ -29066,7 +29086,7 @@ function Loading({
29066
29086
  }) {
29067
29087
  const isHydrated = useHasHydrated();
29068
29088
  const styles4 = useLoadingStyles();
29069
- const LoadingWrapper = ({ children }) => fullScreen ? /* @__PURE__ */ React.createElement(Div, { style: styles4.loadingWrapper.style }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
29089
+ const LoadingWrapper = ({ children }) => fullScreen ? /* @__PURE__ */ React.createElement(Div, { className: "fullScreen", style: styles4.loadingWrapper.style }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
29070
29090
  if (!isHydrated) {
29071
29091
  return null;
29072
29092
  }
@@ -29077,7 +29097,8 @@ function Loading({
29077
29097
  height: height2 || size2 || 24,
29078
29098
  style: styles4.loadingCircle.style,
29079
29099
  color,
29080
- "data-testid": "imgLoading"
29100
+ "data-testid": "imgLoading",
29101
+ className: "spinner"
29081
29102
  }
29082
29103
  ));
29083
29104
  }
@@ -35060,7 +35081,7 @@ function App({
35060
35081
  } = useAuth();
35061
35082
  const { FRONTEND_URL: FRONTEND_URL2, API_URL: API_URL2 } = useData();
35062
35083
  const { router, setIsNewChat, getStoreSlug } = useNavigationContext();
35063
- const { setInput, setIsWebSearchEnabled } = useChat();
35084
+ const { setInput, setIsWebSearchEnabled, setIsNewAppChat } = useChat();
35064
35085
  const { addHapticFeedback } = useTheme2();
35065
35086
  const currentStoreId = store?.id;
35066
35087
  const focus = apps.find((app2) => app2.slug === "focus");
@@ -35070,8 +35091,7 @@ function App({
35070
35091
  const atlas = apps.find((app2) => app2.slug === "atlas");
35071
35092
  const grape = apps.find((app2) => app2.slug === "grape");
35072
35093
  const zarathustra = apps.find((app2) => app2.slug === "zarathustra");
35073
- const isBlossom = app?.id === chrry?.id;
35074
- console.log(`\u{1F680} ~ file: App.tsx:178 ~ apps:`, apps);
35094
+ const isBlossom = app?.store?.id === chrry?.store?.id;
35075
35095
  const getApps2 = () => {
35076
35096
  return apps.filter(
35077
35097
  (item) => item.id !== store?.appId && item.id !== chrry?.id && item.id !== grape?.id && (isBlossom ? item.id !== atlas?.id && item.id !== zarathustra?.id && item.id !== popcorn?.id : true)
@@ -35229,7 +35249,7 @@ function App({
35229
35249
  href: getAppSlug(storeApp),
35230
35250
  onClick: (e) => {
35231
35251
  e.preventDefault();
35232
- setIsNewChat(true, getAppSlug(storeApp));
35252
+ setIsNewAppChat(storeApp);
35233
35253
  addHapticFeedback();
35234
35254
  setAppStatus(void 0);
35235
35255
  if (e.metaKey || e.ctrlKey) {
@@ -35737,7 +35757,7 @@ function App({
35737
35757
  return;
35738
35758
  }
35739
35759
  e.preventDefault();
35740
- setIsNewChat(true, getAppSlug(chrry));
35760
+ setIsNewAppChat(chrry);
35741
35761
  },
35742
35762
  style: {
35743
35763
  ...styles4.chrry.style
@@ -35768,7 +35788,7 @@ function App({
35768
35788
  return;
35769
35789
  }
35770
35790
  e.preventDefault();
35771
- setIsNewChat(true, getAppSlug(zarathustra));
35791
+ setIsNewAppChat(zarathustra);
35772
35792
  },
35773
35793
  style: {
35774
35794
  ...styles4.zarathustra.style
@@ -35800,7 +35820,7 @@ function App({
35800
35820
  return;
35801
35821
  }
35802
35822
  e.preventDefault();
35803
- setIsNewChat(true, getAppSlug(popcorn));
35823
+ setIsNewAppChat(popcorn);
35804
35824
  },
35805
35825
  style: {
35806
35826
  ...styles4.popcorn.style
@@ -35855,13 +35875,7 @@ function App({
35855
35875
  if (e.metaKey || e.ctrlKey) {
35856
35876
  return;
35857
35877
  }
35858
- if (!item?.store?.apps.every(
35859
- (a) => a.store?.apps.length
35860
- )) {
35861
- setLoadingApp(item);
35862
- } else {
35863
- setIsNewChat(true, getAppSlug(item));
35864
- }
35878
+ setIsNewAppChat(item);
35865
35879
  e.preventDefault();
35866
35880
  }
35867
35881
  },
@@ -35888,7 +35902,7 @@ function App({
35888
35902
  return;
35889
35903
  }
35890
35904
  e.preventDefault();
35891
- setIsNewChat(true, getAppSlug(atlas));
35905
+ setIsNewAppChat(atlas);
35892
35906
  },
35893
35907
  style: {
35894
35908
  ...styles4.atlas.style
@@ -41857,6 +41871,7 @@ var init_Account_styles = __esm({
41857
41871
  function Account({ style: style2 }) {
41858
41872
  const { push } = useRouter();
41859
41873
  const styles4 = useAccountStyles();
41874
+ const { isMobileDevice } = useTheme2();
41860
41875
  const { utilities } = useStyles();
41861
41876
  const { t: t6 } = useAppContext();
41862
41877
  const {
@@ -42017,6 +42032,7 @@ function Account({ style: style2 }) {
42017
42032
  style: {
42018
42033
  ...utilities.transparent.style,
42019
42034
  ...utilities.small.style,
42035
+ display: isMobileDevice ? "none" : "flex",
42020
42036
  ...style2
42021
42037
  },
42022
42038
  onClick: () => {
@@ -44560,9 +44576,9 @@ function Store({
44560
44576
  const { FRONTEND_URL: FRONTEND_URL2 } = useData();
44561
44577
  const { isMobileDevice } = useTheme2();
44562
44578
  const { utilities } = useStyles();
44563
- const { router, setIsNewChat, pathname, searchParams } = useNavigationContext();
44564
- const { getAppSlug } = useAuth();
44565
- const { track, allApps } = useAuth();
44579
+ const { router, pathname, searchParams } = useNavigationContext();
44580
+ const { setIsNewAppChat } = useChat();
44581
+ const { track, allApps, getAppSlug, loadingApp } = useAuth();
44566
44582
  const { currentStore } = useApp();
44567
44583
  const store = slug ? allApps.find((app) => app.slug === slug)?.store : currentStore;
44568
44584
  const apps = store?.apps;
@@ -44608,10 +44624,10 @@ function Store({
44608
44624
  }, [selectedApp?.id, store?.id, track]);
44609
44625
  useStoreMetadata(store);
44610
44626
  const styles4 = useStoreStyles();
44627
+ if (!store?.app) {
44628
+ return null;
44629
+ }
44611
44630
  const render = () => {
44612
- if (!store?.app) {
44613
- return null;
44614
- }
44615
44631
  return /* @__PURE__ */ import_react73.default.createElement(
44616
44632
  Div,
44617
44633
  {
@@ -44652,7 +44668,7 @@ function Store({
44652
44668
  onClick: (e) => {
44653
44669
  e.preventDefault();
44654
44670
  if (store.app) {
44655
- setIsNewChat(true, getAppSlug(store.app));
44671
+ setIsNewAppChat(store.app);
44656
44672
  }
44657
44673
  if (e.metaKey || e.ctrlKey) {
44658
44674
  return;
@@ -44714,7 +44730,7 @@ function Store({
44714
44730
  display: isMobileDevice ? "none" : "flex"
44715
44731
  }
44716
44732
  },
44717
- /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appName.style } }, app.icon, " ", app.name),
44733
+ /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appName.style } }, loadingApp?.id === app.id ? /* @__PURE__ */ import_react73.default.createElement(Loading, { size: 16 }) : app.icon, " ", app.name),
44718
44734
  /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appSubtitle.style } }, t6(app.subtitle || ""))
44719
44735
  )
44720
44736
  ))), /* @__PURE__ */ import_react73.default.createElement(Div, { key: selectedApp?.id, style: styles4.footer.style }, selectedApp && /* @__PURE__ */ import_react73.default.createElement(Div, { style: styles4.appDetails.style }, /* @__PURE__ */ import_react73.default.createElement(H3, { style: styles4.appTitle.style }, selectedApp.icon, " ", selectedApp.name, /* @__PURE__ */ import_react73.default.createElement(
@@ -44726,7 +44742,7 @@ function Store({
44726
44742
  return;
44727
44743
  }
44728
44744
  e.preventDefault();
44729
- setIsNewChat(true, getAppSlug(selectedApp));
44745
+ setIsNewAppChat(selectedApp);
44730
44746
  },
44731
44747
  style: styles4.tryItNow.style
44732
44748
  },
@@ -44748,7 +44764,7 @@ function Store({
44748
44764
  return;
44749
44765
  }
44750
44766
  e.preventDefault();
44751
- setIsNewChat(true, getAppSlug(selectedApp));
44767
+ setIsNewAppChat(selectedApp);
44752
44768
  },
44753
44769
  className: "link"
44754
44770
  },
@@ -44779,9 +44795,6 @@ function Store({
44779
44795
  if (compact) {
44780
44796
  return render();
44781
44797
  }
44782
- if (!store?.app) {
44783
- return null;
44784
- }
44785
44798
  return /* @__PURE__ */ import_react73.default.createElement(Skeleton, null, render());
44786
44799
  }
44787
44800
  var import_react73;
@@ -44800,6 +44813,7 @@ var init_Store = __esm({
44800
44813
  init_A();
44801
44814
  init_useMetadata();
44802
44815
  init_StylesContext();
44816
+ init_Loading();
44803
44817
  }
44804
44818
  });
44805
44819