@chrryai/chrry 1.2.12 → 1.2.13
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1371,7 +1371,7 @@ declare const isFirefox: boolean;
|
|
|
1371
1371
|
declare function getFlag({ code }: {
|
|
1372
1372
|
code?: string;
|
|
1373
1373
|
}): string;
|
|
1374
|
-
declare const VERSION = "1.2.
|
|
1374
|
+
declare const VERSION = "1.2.13";
|
|
1375
1375
|
type instructionBase = {
|
|
1376
1376
|
id: string;
|
|
1377
1377
|
title: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1371,7 +1371,7 @@ declare const isFirefox: boolean;
|
|
|
1371
1371
|
declare function getFlag({ code }: {
|
|
1372
1372
|
code?: string;
|
|
1373
1373
|
}): string;
|
|
1374
|
-
declare const VERSION = "1.2.
|
|
1374
|
+
declare const VERSION = "1.2.13";
|
|
1375
1375
|
type instructionBase = {
|
|
1376
1376
|
id: string;
|
|
1377
1377
|
title: string;
|
package/dist/index.js
CHANGED
|
@@ -776,9 +776,13 @@ function getAppAndStoreSlugs(path, {
|
|
|
776
776
|
}
|
|
777
777
|
function getThreadId(pathname) {
|
|
778
778
|
const path = pathname || (typeof window !== "undefined" ? window.location.pathname : void 0);
|
|
779
|
-
if (!path || !path.includes("/threads
|
|
780
|
-
const
|
|
781
|
-
|
|
779
|
+
if (!path || !path.includes("/threads")) return void 0;
|
|
780
|
+
const segments = path.split("/").filter(Boolean);
|
|
781
|
+
const threadsIndex = segments.findIndex((segment) => segment === "threads");
|
|
782
|
+
if (threadsIndex === -1) return void 0;
|
|
783
|
+
const threadSegment = segments[threadsIndex + 1] || "";
|
|
784
|
+
const [threadId] = threadSegment.split("?")[0]?.split("&") ?? [];
|
|
785
|
+
return threadId || void 0;
|
|
782
786
|
}
|
|
783
787
|
var excludedSlugRoutes;
|
|
784
788
|
var init_url = __esm({
|
|
@@ -16803,7 +16807,7 @@ function AuthProvider({
|
|
|
16803
16807
|
const [hasNotifications, setHasNotifications] = (0, import_react12.useState)(
|
|
16804
16808
|
false
|
|
16805
16809
|
);
|
|
16806
|
-
const
|
|
16810
|
+
const getSlugFromPathname2 = (path) => {
|
|
16807
16811
|
if (path === "/") return void 0;
|
|
16808
16812
|
const siteConfig2 = getSiteConfig();
|
|
16809
16813
|
const { appSlug } = getAppAndStoreSlugs(path, {
|
|
@@ -16819,7 +16823,7 @@ function AuthProvider({
|
|
|
16819
16823
|
return matchedApp?.slug;
|
|
16820
16824
|
};
|
|
16821
16825
|
const findAppByPathname = (path, apps2) => {
|
|
16822
|
-
const slugFromPath =
|
|
16826
|
+
const slugFromPath = getSlugFromPathname2(path);
|
|
16823
16827
|
if (!slugFromPath) return void 0;
|
|
16824
16828
|
return apps2.find((app2) => app2.slug === slugFromPath);
|
|
16825
16829
|
};
|
|
@@ -17309,7 +17313,7 @@ function DataProvider({
|
|
|
17309
17313
|
const [instructions, setInstructions] = (0, import_react14.useState)([]);
|
|
17310
17314
|
const [affiliateStats, setAffiliateStats] = (0, import_react14.useState)(null);
|
|
17311
17315
|
const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react14.useState)(false);
|
|
17312
|
-
const VERSION3 = "1.2.
|
|
17316
|
+
const VERSION3 = "1.2.13";
|
|
17313
17317
|
const [weather, setWeather] = useLocalStorage("weather", user?.weather || guest?.weather || void 0);
|
|
17314
17318
|
const {
|
|
17315
17319
|
API_URL: API_URL2,
|
|
@@ -18285,7 +18289,7 @@ var init_utils = __esm({
|
|
|
18285
18289
|
window.history.replaceState({}, "", newUrl);
|
|
18286
18290
|
};
|
|
18287
18291
|
isFirefox = typeof navigator !== "undefined" && navigator?.userAgent.includes("Firefox");
|
|
18288
|
-
VERSION = "1.2.
|
|
18292
|
+
VERSION = "1.2.13";
|
|
18289
18293
|
getSlugFromPathname = (path) => {
|
|
18290
18294
|
const siteConfig = getSiteConfig();
|
|
18291
18295
|
return getAppAndStoreSlugs(path, {
|
|
@@ -18817,7 +18821,7 @@ function AppProvider({
|
|
|
18817
18821
|
setColorScheme: setColorSchemeInternal,
|
|
18818
18822
|
setTheme
|
|
18819
18823
|
} = useTheme2();
|
|
18820
|
-
const
|
|
18824
|
+
const getSlugFromPathname2 = (path) => {
|
|
18821
18825
|
const pathWithoutLocale = path.replace(/^\/[a-z]{2}\//, "/");
|
|
18822
18826
|
const match = pathWithoutLocale.match(/^\/([^\/]+)/);
|
|
18823
18827
|
if (!match) return null;
|
|
@@ -19935,7 +19939,7 @@ function NavigationProvider({
|
|
|
19935
19939
|
};
|
|
19936
19940
|
const navigation = useNavigation();
|
|
19937
19941
|
const { searchParams, pathname, ...router } = navigation;
|
|
19938
|
-
const
|
|
19942
|
+
const getSlugFromPathname2 = (path) => {
|
|
19939
19943
|
const pathWithoutLocale = path.replace(/^\/[a-z]{2}\//, "/");
|
|
19940
19944
|
const match = pathWithoutLocale.match(/^\/([^\/]+)/);
|
|
19941
19945
|
if (!match) return null;
|
|
@@ -39417,7 +39421,7 @@ function Sidebar({
|
|
|
39417
39421
|
}) {
|
|
39418
39422
|
return /* @__PURE__ */ React.createElement(Providers, null, /* @__PURE__ */ React.createElement(Hey, { useExtensionIcon }));
|
|
39419
39423
|
}
|
|
39420
|
-
var import_react90, import_clsx46, import_Sidebar_module, Store2, Calendar3, Why, Privacy2, Terms2, About3, Threads2, Users4, Chrry2, Affiliate2, AffiliateDashboard2, ROUTES,
|
|
39424
|
+
var import_react90, import_clsx46, import_Sidebar_module, Store2, Calendar3, Why, Privacy2, Terms2, About3, Threads2, Users4, Chrry2, Affiliate2, AffiliateDashboard2, ROUTES, Hey;
|
|
39421
39425
|
var init_Sidebar = __esm({
|
|
39422
39426
|
"Sidebar.tsx"() {
|
|
39423
39427
|
"use strict";
|
|
@@ -39432,6 +39436,8 @@ var init_Sidebar = __esm({
|
|
|
39432
39436
|
init_Thread();
|
|
39433
39437
|
init_Home();
|
|
39434
39438
|
init_siteConfig();
|
|
39439
|
+
init_url();
|
|
39440
|
+
init_locales();
|
|
39435
39441
|
Store2 = (0, import_react90.lazy)(() => Promise.resolve().then(() => (init_Store(), Store_exports)));
|
|
39436
39442
|
Calendar3 = (0, import_react90.lazy)(() => Promise.resolve().then(() => (init_Calendar(), Calendar_exports)));
|
|
39437
39443
|
Why = (0, import_react90.lazy)(() => Promise.resolve().then(() => (init_Why(), Why_exports)));
|
|
@@ -39457,40 +39463,6 @@ var init_Sidebar = __esm({
|
|
|
39457
39463
|
u: Users4,
|
|
39458
39464
|
chrryDotDev: Chrry2
|
|
39459
39465
|
};
|
|
39460
|
-
getSlugFromPathname2 = (path) => {
|
|
39461
|
-
const pathWithoutLocale = path.replace(/^\/[a-z]{2}\//, "/");
|
|
39462
|
-
const match = pathWithoutLocale.match(/^\/([^\/]+)/);
|
|
39463
|
-
if (!match) return null;
|
|
39464
|
-
const segment = match[1];
|
|
39465
|
-
const excludedRoutes = [
|
|
39466
|
-
// Client routes (handled by ROUTES)
|
|
39467
|
-
"threads",
|
|
39468
|
-
"calendar",
|
|
39469
|
-
// "lifeOS",
|
|
39470
|
-
"why",
|
|
39471
|
-
"privacy",
|
|
39472
|
-
"terms",
|
|
39473
|
-
"about",
|
|
39474
|
-
"u",
|
|
39475
|
-
"home",
|
|
39476
|
-
"chrryDotDev",
|
|
39477
|
-
"affiliate",
|
|
39478
|
-
// SSR routes (Next.js pages)
|
|
39479
|
-
"blog",
|
|
39480
|
-
"pricing",
|
|
39481
|
-
// System routes
|
|
39482
|
-
"settings",
|
|
39483
|
-
"profile",
|
|
39484
|
-
"apps",
|
|
39485
|
-
"api",
|
|
39486
|
-
"_next",
|
|
39487
|
-
"signin",
|
|
39488
|
-
"signup",
|
|
39489
|
-
"onboarding"
|
|
39490
|
-
];
|
|
39491
|
-
if (segment && excludedRoutes.includes(segment)) return null;
|
|
39492
|
-
return segment || null;
|
|
39493
|
-
};
|
|
39494
39466
|
Hey = (0, import_react90.memo)(
|
|
39495
39467
|
function Hey2({
|
|
39496
39468
|
className,
|
|
@@ -39499,7 +39471,7 @@ var init_Sidebar = __esm({
|
|
|
39499
39471
|
}) {
|
|
39500
39472
|
const { isHome, userNameByUrl, pathname, isSplash, setIsSplash } = useNavigationContext();
|
|
39501
39473
|
const { threadId } = useChat();
|
|
39502
|
-
const { slug, allApps, chrry, ...auth } = useAuth();
|
|
39474
|
+
const { slug, allApps, chrry, getAppSlug, ...auth } = useAuth();
|
|
39503
39475
|
const { isDevelopment: isDevelopment3 } = useData();
|
|
39504
39476
|
(0, import_react90.useEffect)(() => {
|
|
39505
39477
|
useExtensionIcon?.(slug);
|
|
@@ -39508,15 +39480,21 @@ var init_Sidebar = __esm({
|
|
|
39508
39480
|
const store = allApps?.find(
|
|
39509
39481
|
(app2) => app2?.store?.slug === lastPathSegment
|
|
39510
39482
|
)?.store;
|
|
39511
|
-
const
|
|
39483
|
+
const config = getSiteConfig();
|
|
39484
|
+
const app = config.mode === "chrryDev" ? chrry : auth.app;
|
|
39512
39485
|
const ssrRoutes = ["blog"];
|
|
39513
39486
|
const ssrPrefixes = ["/blog"];
|
|
39514
39487
|
const isSSRRoute = lastPathSegment && ssrRoutes.includes(lastPathSegment) || ssrPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
39515
|
-
const
|
|
39516
|
-
|
|
39488
|
+
const { appSlug } = getAppAndStoreSlugs(pathname, {
|
|
39489
|
+
defaultAppSlug: app?.slug ?? "",
|
|
39490
|
+
defaultStoreSlug: app?.store?.slug ?? "",
|
|
39491
|
+
excludedRoutes: excludedSlugRoutes,
|
|
39492
|
+
locales
|
|
39493
|
+
});
|
|
39494
|
+
const isAppSlug = !!appSlug && allApps.some((candidate) => candidate.slug === appSlug);
|
|
39517
39495
|
const pathWithoutLocale = pathname.replace(/^\/[a-z]{2}\//, "/").slice(1).split("?")[0];
|
|
39518
39496
|
const isStorePage = !!store;
|
|
39519
|
-
const isThreadDetailPage =
|
|
39497
|
+
const isThreadDetailPage = !!threadId;
|
|
39520
39498
|
const RouteComponent = isStorePage ? Store2 : pathWithoutLocale && ROUTES[pathWithoutLocale] ? ROUTES[pathWithoutLocale] : lastPathSegment && ROUTES[lastPathSegment] ? ROUTES[lastPathSegment] : isAppSlug ? Home : null;
|
|
39521
39499
|
const isClientRoute = !isSSRRoute && (!!RouteComponent || threadId || isThreadDetailPage || pathname === "/" || pathname === "/chrryDotDev" || isAppSlug);
|
|
39522
39500
|
const isHydrated = useHasHydrated();
|
|
@@ -39524,8 +39502,6 @@ var init_Sidebar = __esm({
|
|
|
39524
39502
|
const handleImageLoad = (0, import_react90.useCallback)(() => {
|
|
39525
39503
|
setIsImageLoaded(true);
|
|
39526
39504
|
}, []);
|
|
39527
|
-
const config = getSiteConfig();
|
|
39528
|
-
const app = config.mode === "chrryDev" ? chrry : auth.app;
|
|
39529
39505
|
const memoizedApp = (0, import_react90.useMemo)(() => app, [app?.id, app?.slug, app?.image]);
|
|
39530
39506
|
const splash = (0, import_react90.useMemo)(
|
|
39531
39507
|
() => memoizedApp && /* @__PURE__ */ React.createElement("div", { className: (0, import_clsx46.default)(import_Sidebar_module.default.splash, !isSplash && import_Sidebar_module.default.hidden) }, /* @__PURE__ */ React.createElement(
|