@chrryai/chrry 1.5.30 → 1.5.32

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.js CHANGED
@@ -772,7 +772,7 @@ var init_siteConfig = __esm({
772
772
  favicon: "focus",
773
773
  mode: "focus",
774
774
  slug: "focus",
775
- version: "26.10.44",
775
+ version: "26.10.45",
776
776
  storeSlug: "blossom",
777
777
  name: "Focus",
778
778
  domain: "focus.chrry.ai",
@@ -2092,7 +2092,7 @@ var init_utils = __esm({
2092
2092
  };
2093
2093
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
2094
2094
  config = getSiteConfig(getClientHostname());
2095
- VERSION = config.version || "1.5.30";
2095
+ VERSION = config.version || "1.5.32";
2096
2096
  getSlugFromPathname = (path) => {
2097
2097
  return getAppAndStoreSlugs(path, {
2098
2098
  defaultAppSlug: config.slug,
@@ -23765,14 +23765,19 @@ function AuthProvider({
23765
23765
  shouldFetchSession && await refetchSession(void 0, { revalidate: true });
23766
23766
  };
23767
23767
  const [isSplash, setIsSplash] = (0, import_react19.useState)(true);
23768
- const [loadingApp, setLoadingApp] = (0, import_react19.useState)(
23768
+ const [loadingAppId, setLoadingAppId] = (0, import_react19.useState)(
23769
23769
  void 0
23770
23770
  );
23771
+ const [loadingApp, setLoadingAppInternal] = (0, import_react19.useState)(void 0);
23772
+ const setLoadingApp = (appWithStore) => {
23773
+ setLoadingAppId(appWithStore?.id);
23774
+ setLoadingAppInternal(appWithStore);
23775
+ };
23771
23776
  const chrry = storeApps?.find((app2) => !app2.store?.parentStoreId);
23772
23777
  const vex2 = storeApps?.find((app2) => app2.slug === "vex");
23773
23778
  const sushi = storeApps?.find((app2) => app2.slug === "sushi");
23774
23779
  const focus2 = storeApps?.find((app2) => app2.slug === "focus");
23775
- const appId = loadingApp?.id || app?.id;
23780
+ const appId = loadingAppId || app?.id;
23776
23781
  const {
23777
23782
  data: storeAppsSwr,
23778
23783
  mutate: refetchApps,
@@ -23781,12 +23786,17 @@ function AuthProvider({
23781
23786
  try {
23782
23787
  if (!token || !appId) return;
23783
23788
  const apps2 = await getApp({ token, appId });
23789
+ if (loadingAppId || loadingApp) {
23790
+ setLoadingApp(void 0);
23791
+ setLoadingAppId(void 0);
23792
+ }
23784
23793
  return apps2.store?.apps;
23785
23794
  } catch (error2) {
23786
23795
  import_react_hot_toast.default.error("Something went wrong");
23787
23796
  }
23788
23797
  });
23789
23798
  const hasStoreApps = (item) => {
23799
+ if (!item || !storeApps.length) return false;
23790
23800
  const app2 = storeApps?.find((app3) => {
23791
23801
  return app3.id === item?.id;
23792
23802
  });
@@ -23999,10 +24009,7 @@ function AuthProvider({
23999
24009
  let matchedApp;
24000
24010
  if (thread2?.appId) {
24001
24011
  const threadApp = storeApps.find((app2) => app2.id === thread2.appId);
24002
- if (threadApp) {
24003
- matchedApp = threadApp;
24004
- console.log("\u{1F9F5} Using thread app:", threadApp.slug);
24005
- }
24012
+ matchedApp = threadApp;
24006
24013
  }
24007
24014
  if (!matchedApp) {
24008
24015
  matchedApp = findAppByPathname(pathname, storeApps) || baseApp;
@@ -24034,7 +24041,8 @@ function AuthProvider({
24034
24041
  thread2,
24035
24042
  threadId,
24036
24043
  lastAppId,
24037
- isExtension2
24044
+ isExtension2,
24045
+ loadingAppId
24038
24046
  ]);
24039
24047
  const [profile, setProfileInternal] = (0, import_react19.useState)(void 0);
24040
24048
  const setProfile = (profile2) => {
@@ -24205,6 +24213,8 @@ function AuthProvider({
24205
24213
  isLoadingMood,
24206
24214
  enableNotifications,
24207
24215
  setEnableNotifications,
24216
+ loadingAppId,
24217
+ setLoadingAppId,
24208
24218
  defaultInstructions,
24209
24219
  isSavingApp,
24210
24220
  setIsSavingApp,
@@ -24405,7 +24415,7 @@ function DataProvider({ children, ...rest }) {
24405
24415
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24406
24416
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24407
24417
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24408
- const VERSION4 = "1.5.30";
24418
+ const VERSION4 = "1.5.32";
24409
24419
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24410
24420
  const {
24411
24421
  API_URL: API_URL2,
@@ -29511,11 +29521,19 @@ function Loading({
29511
29521
  height: height2,
29512
29522
  size: size2,
29513
29523
  color = "var(--accent-6)",
29514
- fullScreen = false
29524
+ fullScreen = false,
29525
+ style: style2
29515
29526
  }) {
29516
29527
  const isHydrated = useHasHydrated();
29517
29528
  const styles4 = useLoadingStyles();
29518
- const LoadingWrapper = ({ children }) => fullScreen ? /* @__PURE__ */ React.createElement(Div, { className: "fullScreen", style: styles4.loadingWrapper.style }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
29529
+ const LoadingWrapper = ({ children }) => fullScreen ? /* @__PURE__ */ React.createElement(
29530
+ Div,
29531
+ {
29532
+ className: "fullScreen",
29533
+ style: { ...styles4.loadingWrapper.style, ...style2 }
29534
+ },
29535
+ children
29536
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, children);
29519
29537
  if (!isHydrated) {
29520
29538
  return null;
29521
29539
  }
@@ -29524,7 +29542,7 @@ function Loading({
29524
29542
  {
29525
29543
  width: width || size2 || 24,
29526
29544
  height: height2 || size2 || 24,
29527
- style: styles4.loadingCircle.style,
29545
+ style: { ...styles4.loadingCircle.style, ...style2 },
29528
29546
  color,
29529
29547
  "data-testid": "imgLoading",
29530
29548
  className: "spinner"
@@ -41154,7 +41172,19 @@ function Menu({
41154
41172
  showThreads = true
41155
41173
  }) {
41156
41174
  const { t: t5 } = useAppContext();
41157
- const { user, guest, profile, track, showFocus, setShowFocus, getAppSlug } = useAuth();
41175
+ const {
41176
+ user,
41177
+ guest,
41178
+ profile,
41179
+ track,
41180
+ showFocus,
41181
+ setShowFocus,
41182
+ getAppSlug,
41183
+ loadingAppId,
41184
+ storeApps,
41185
+ setLoadingAppId,
41186
+ hasStoreApps
41187
+ } = useAuth();
41158
41188
  const styles4 = useMenuStyles();
41159
41189
  const {
41160
41190
  router,
@@ -41172,6 +41202,12 @@ function Menu({
41172
41202
  } = useNavigationContext();
41173
41203
  const { app } = useApp();
41174
41204
  const { viewPortHeight, isStandalone: isStandalone2 } = usePlatform();
41205
+ const [loadingThreadId, setLoadingThreadId] = (0, import_react62.useState)(null);
41206
+ (0, import_react62.useEffect)(() => {
41207
+ if (!loadingAppId) {
41208
+ setLoadingThreadId(null);
41209
+ }
41210
+ }, [loadingAppId]);
41175
41211
  const {
41176
41212
  theme,
41177
41213
  isDark,
@@ -41597,6 +41633,14 @@ function Menu({
41597
41633
  ...styles4.threadItem.style
41598
41634
  },
41599
41635
  onClick: (e) => {
41636
+ const threadApp = storeApps.find(
41637
+ (app2) => app2.id === thread2.appId
41638
+ );
41639
+ if (thread2.appId && threadApp && !hasStoreApps(threadApp)) {
41640
+ setLoadingThreadId(thread2.id);
41641
+ setLoadingAppId(thread2.appId);
41642
+ return;
41643
+ }
41600
41644
  track({
41601
41645
  name: "thread-click-menu",
41602
41646
  props: {
@@ -41615,7 +41659,16 @@ function Menu({
41615
41659
  thread2.title
41616
41660
  );
41617
41661
  })(),
41618
- collaborationStatus === "pending" ? /* @__PURE__ */ import_react62.default.createElement(
41662
+ loadingThreadId === thread2.id ? /* @__PURE__ */ import_react62.default.createElement(
41663
+ Loading,
41664
+ {
41665
+ style: {
41666
+ ...styles4.star.style,
41667
+ width: 14,
41668
+ height: 14
41669
+ }
41670
+ }
41671
+ ) : collaborationStatus === "pending" ? /* @__PURE__ */ import_react62.default.createElement(
41619
41672
  CollaborationStatus,
41620
41673
  {
41621
41674
  dataTestId: "menu",