@chrryai/chrry 1.4.36 → 1.4.39

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
@@ -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.39";
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.39";
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,
@@ -26221,7 +26213,32 @@ function ChatProvider({
26221
26213
  setIsIncognito(searchParams.get("incognito") === "true");
26222
26214
  }, [searchParams]);
26223
26215
  const [wasIncognito, setWasIncognito] = (0, import_react29.useState)(isIncognito);
26224
- const [newChatTrigger, setNewChatTrigger] = (0, import_react29.useState)(0);
26216
+ const hasStoreApps = (item) => {
26217
+ const i = item && allApps?.find((app2) => app2.id === item?.id);
26218
+ return i?.store?.apps.length;
26219
+ };
26220
+ const [loadingApp, setLoadingApp] = (0, import_react29.useState)(
26221
+ void 0
26222
+ );
26223
+ const setIsNewAppChat = (item) => {
26224
+ if (!loadingApp && hasStoreApps(item) && item) {
26225
+ setIsNewChat(true, getAppSlug(item));
26226
+ return;
26227
+ }
26228
+ if (!loadingApp && item) {
26229
+ setLoadingApp(item);
26230
+ return;
26231
+ }
26232
+ };
26233
+ (0, import_react29.useEffect)(() => {
26234
+ if (!loadingApp) {
26235
+ return;
26236
+ }
26237
+ if (hasStoreApps(loadingApp)) {
26238
+ setIsNewChat(true, getAppSlug(loadingApp));
26239
+ return;
26240
+ }
26241
+ }, [loadingApp, allApps]);
26225
26242
  const setIsNewChat = (value, to = app?.slug ? getAppSlug(app) : "/") => {
26226
26243
  if (value) {
26227
26244
  setCollaborationStep(0);
@@ -26236,9 +26253,6 @@ function ChatProvider({
26236
26253
  setCollaborationStatus(void 0);
26237
26254
  setIsChatFloating(false);
26238
26255
  }
26239
- if (value && isExtension2) {
26240
- setNewChatTrigger((prev2) => prev2 + 1);
26241
- }
26242
26256
  setIsNewChatInternal(value);
26243
26257
  };
26244
26258
  (0, import_react29.useEffect)(() => {
@@ -26662,6 +26676,7 @@ function ChatProvider({
26662
26676
  ChatContext.Provider,
26663
26677
  {
26664
26678
  value: {
26679
+ setIsNewAppChat,
26665
26680
  shouldFocus,
26666
26681
  setShouldFocus,
26667
26682
  placeHolderText,
@@ -27490,7 +27505,9 @@ var init_Store_styles = __esm({
27490
27505
  fontSize: 14
27491
27506
  },
27492
27507
  appTitle: {
27493
- display: "flex"
27508
+ display: "flex",
27509
+ margin: "0 0 10px 0",
27510
+ fontSize: 20
27494
27511
  },
27495
27512
  titleText: {
27496
27513
  gap: 5,
@@ -29066,7 +29083,7 @@ function Loading({
29066
29083
  }) {
29067
29084
  const isHydrated = useHasHydrated();
29068
29085
  const styles4 = useLoadingStyles();
29069
- const LoadingWrapper = ({ children }) => fullScreen ? /* @__PURE__ */ React.createElement(Div, { style: styles4.loadingWrapper.style }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
29086
+ const LoadingWrapper = ({ children }) => fullScreen ? /* @__PURE__ */ React.createElement(Div, { className: "fullScreen", style: styles4.loadingWrapper.style }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
29070
29087
  if (!isHydrated) {
29071
29088
  return null;
29072
29089
  }
@@ -29077,7 +29094,8 @@ function Loading({
29077
29094
  height: height2 || size2 || 24,
29078
29095
  style: styles4.loadingCircle.style,
29079
29096
  color,
29080
- "data-testid": "imgLoading"
29097
+ "data-testid": "imgLoading",
29098
+ className: "spinner"
29081
29099
  }
29082
29100
  ));
29083
29101
  }
@@ -35060,7 +35078,7 @@ function App({
35060
35078
  } = useAuth();
35061
35079
  const { FRONTEND_URL: FRONTEND_URL2, API_URL: API_URL2 } = useData();
35062
35080
  const { router, setIsNewChat, getStoreSlug } = useNavigationContext();
35063
- const { setInput, setIsWebSearchEnabled } = useChat();
35081
+ const { setInput, setIsWebSearchEnabled, setIsNewAppChat } = useChat();
35064
35082
  const { addHapticFeedback } = useTheme2();
35065
35083
  const currentStoreId = store?.id;
35066
35084
  const focus = apps.find((app2) => app2.slug === "focus");
@@ -35070,8 +35088,7 @@ function App({
35070
35088
  const atlas = apps.find((app2) => app2.slug === "atlas");
35071
35089
  const grape = apps.find((app2) => app2.slug === "grape");
35072
35090
  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);
35091
+ const isBlossom = app?.store?.id === chrry?.store?.id;
35075
35092
  const getApps2 = () => {
35076
35093
  return apps.filter(
35077
35094
  (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 +35246,7 @@ function App({
35229
35246
  href: getAppSlug(storeApp),
35230
35247
  onClick: (e) => {
35231
35248
  e.preventDefault();
35232
- setIsNewChat(true, getAppSlug(storeApp));
35249
+ setIsNewAppChat(storeApp);
35233
35250
  addHapticFeedback();
35234
35251
  setAppStatus(void 0);
35235
35252
  if (e.metaKey || e.ctrlKey) {
@@ -35737,7 +35754,7 @@ function App({
35737
35754
  return;
35738
35755
  }
35739
35756
  e.preventDefault();
35740
- setIsNewChat(true, getAppSlug(chrry));
35757
+ setIsNewAppChat(chrry);
35741
35758
  },
35742
35759
  style: {
35743
35760
  ...styles4.chrry.style
@@ -35768,7 +35785,7 @@ function App({
35768
35785
  return;
35769
35786
  }
35770
35787
  e.preventDefault();
35771
- setIsNewChat(true, getAppSlug(zarathustra));
35788
+ setIsNewAppChat(zarathustra);
35772
35789
  },
35773
35790
  style: {
35774
35791
  ...styles4.zarathustra.style
@@ -35800,7 +35817,7 @@ function App({
35800
35817
  return;
35801
35818
  }
35802
35819
  e.preventDefault();
35803
- setIsNewChat(true, getAppSlug(popcorn));
35820
+ setIsNewAppChat(popcorn);
35804
35821
  },
35805
35822
  style: {
35806
35823
  ...styles4.popcorn.style
@@ -35855,13 +35872,7 @@ function App({
35855
35872
  if (e.metaKey || e.ctrlKey) {
35856
35873
  return;
35857
35874
  }
35858
- if (!item?.store?.apps.every(
35859
- (a) => a.store?.apps.length
35860
- )) {
35861
- setLoadingApp(item);
35862
- } else {
35863
- setIsNewChat(true, getAppSlug(item));
35864
- }
35875
+ setIsNewAppChat(item);
35865
35876
  e.preventDefault();
35866
35877
  }
35867
35878
  },
@@ -35888,7 +35899,7 @@ function App({
35888
35899
  return;
35889
35900
  }
35890
35901
  e.preventDefault();
35891
- setIsNewChat(true, getAppSlug(atlas));
35902
+ setIsNewAppChat(atlas);
35892
35903
  },
35893
35904
  style: {
35894
35905
  ...styles4.atlas.style
@@ -41857,6 +41868,7 @@ var init_Account_styles = __esm({
41857
41868
  function Account({ style: style2 }) {
41858
41869
  const { push } = useRouter();
41859
41870
  const styles4 = useAccountStyles();
41871
+ const { isMobileDevice } = useTheme2();
41860
41872
  const { utilities } = useStyles();
41861
41873
  const { t: t6 } = useAppContext();
41862
41874
  const {
@@ -42017,6 +42029,7 @@ function Account({ style: style2 }) {
42017
42029
  style: {
42018
42030
  ...utilities.transparent.style,
42019
42031
  ...utilities.small.style,
42032
+ display: isMobileDevice ? "none" : "flex",
42020
42033
  ...style2
42021
42034
  },
42022
42035
  onClick: () => {
@@ -44560,9 +44573,9 @@ function Store({
44560
44573
  const { FRONTEND_URL: FRONTEND_URL2 } = useData();
44561
44574
  const { isMobileDevice } = useTheme2();
44562
44575
  const { utilities } = useStyles();
44563
- const { router, setIsNewChat, pathname, searchParams } = useNavigationContext();
44564
- const { getAppSlug } = useAuth();
44565
- const { track, allApps } = useAuth();
44576
+ const { router, pathname, searchParams } = useNavigationContext();
44577
+ const { setIsNewAppChat } = useChat();
44578
+ const { track, allApps, getAppSlug, loadingApp } = useAuth();
44566
44579
  const { currentStore } = useApp();
44567
44580
  const store = slug ? allApps.find((app) => app.slug === slug)?.store : currentStore;
44568
44581
  const apps = store?.apps;
@@ -44608,10 +44621,10 @@ function Store({
44608
44621
  }, [selectedApp?.id, store?.id, track]);
44609
44622
  useStoreMetadata(store);
44610
44623
  const styles4 = useStoreStyles();
44624
+ if (!store?.app) {
44625
+ return null;
44626
+ }
44611
44627
  const render = () => {
44612
- if (!store?.app) {
44613
- return null;
44614
- }
44615
44628
  return /* @__PURE__ */ import_react73.default.createElement(
44616
44629
  Div,
44617
44630
  {
@@ -44652,7 +44665,7 @@ function Store({
44652
44665
  onClick: (e) => {
44653
44666
  e.preventDefault();
44654
44667
  if (store.app) {
44655
- setIsNewChat(true, getAppSlug(store.app));
44668
+ setIsNewAppChat(store.app);
44656
44669
  }
44657
44670
  if (e.metaKey || e.ctrlKey) {
44658
44671
  return;
@@ -44714,7 +44727,7 @@ function Store({
44714
44727
  display: isMobileDevice ? "none" : "flex"
44715
44728
  }
44716
44729
  },
44717
- /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appName.style } }, app.icon, " ", app.name),
44730
+ /* @__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
44731
  /* @__PURE__ */ import_react73.default.createElement(Span, { style: { ...styles4.appSubtitle.style } }, t6(app.subtitle || ""))
44719
44732
  )
44720
44733
  ))), /* @__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 +44739,7 @@ function Store({
44726
44739
  return;
44727
44740
  }
44728
44741
  e.preventDefault();
44729
- setIsNewChat(true, getAppSlug(selectedApp));
44742
+ setIsNewAppChat(selectedApp);
44730
44743
  },
44731
44744
  style: styles4.tryItNow.style
44732
44745
  },
@@ -44748,7 +44761,7 @@ function Store({
44748
44761
  return;
44749
44762
  }
44750
44763
  e.preventDefault();
44751
- setIsNewChat(true, getAppSlug(selectedApp));
44764
+ setIsNewAppChat(selectedApp);
44752
44765
  },
44753
44766
  className: "link"
44754
44767
  },
@@ -44779,9 +44792,6 @@ function Store({
44779
44792
  if (compact) {
44780
44793
  return render();
44781
44794
  }
44782
- if (!store?.app) {
44783
- return null;
44784
- }
44785
44795
  return /* @__PURE__ */ import_react73.default.createElement(Skeleton, null, render());
44786
44796
  }
44787
44797
  var import_react73;
@@ -44800,6 +44810,7 @@ var init_Store = __esm({
44800
44810
  init_A();
44801
44811
  init_useMetadata();
44802
44812
  init_StylesContext();
44813
+ init_Loading();
44803
44814
  }
44804
44815
  });
44805
44816