@chrryai/chrry 1.2.13 → 1.2.15

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 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.13";
1374
+ declare const VERSION = "1.2.15";
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.13";
1374
+ declare const VERSION = "1.2.15";
1375
1375
  type instructionBase = {
1376
1376
  id: string;
1377
1377
  title: string;
package/dist/index.js CHANGED
@@ -16706,15 +16706,35 @@ function AuthProvider({
16706
16706
  };
16707
16707
  const isLiveTest = isGuestTest || isMemberTest;
16708
16708
  const getAppSlug = (targetApp, defaultSlug = "/") => {
16709
- if (!targetApp) return defaultSlug;
16710
- if (targetApp.id === baseApp?.id) return defaultSlug;
16711
- if (baseApp?.id === chrry?.id && targetApp.id === chrry?.id) {
16712
- return defaultSlug;
16709
+ const localeMatch = locales.find(
16710
+ (loc) => pathname === `/${loc}` || pathname.startsWith(`/${loc}/`)
16711
+ );
16712
+ const localePrefix = localeMatch ? `/${localeMatch}` : "";
16713
+ let computedSlug = defaultSlug;
16714
+ if (targetApp) {
16715
+ if (targetApp.id === baseApp?.id) {
16716
+ computedSlug = defaultSlug;
16717
+ } else if (baseApp?.id === chrry?.id && targetApp.id === chrry?.id) {
16718
+ computedSlug = defaultSlug;
16719
+ } else if (targetApp.id === chrry?.id || baseApp?.store?.apps.some((app2) => app2.id === targetApp.id)) {
16720
+ computedSlug = `/${targetApp.slug}`;
16721
+ } else {
16722
+ computedSlug = `/${targetApp.store?.slug}/${targetApp.slug}`;
16723
+ }
16713
16724
  }
16714
- if (targetApp.id === chrry?.id || baseApp?.store?.apps.some((app2) => app2.id === targetApp.id)) {
16715
- return `/${targetApp.slug}`;
16725
+ if (localePrefix) {
16726
+ if (!computedSlug || computedSlug === "/") {
16727
+ return localePrefix || "/";
16728
+ }
16729
+ if (computedSlug === localePrefix || computedSlug.startsWith(`${localePrefix}/`)) {
16730
+ return computedSlug;
16731
+ }
16732
+ if (computedSlug.startsWith("/")) {
16733
+ return `${localePrefix}${computedSlug}`;
16734
+ }
16735
+ return `${localePrefix}/${computedSlug}`;
16716
16736
  }
16717
- return `/${targetApp.store?.slug}/${targetApp.slug}`;
16737
+ return computedSlug || defaultSlug;
16718
16738
  };
16719
16739
  (0, import_react12.useEffect)(() => {
16720
16740
  const signInParam = searchParams.get("signIn");
@@ -17313,7 +17333,7 @@ function DataProvider({
17313
17333
  const [instructions, setInstructions] = (0, import_react14.useState)([]);
17314
17334
  const [affiliateStats, setAffiliateStats] = (0, import_react14.useState)(null);
17315
17335
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react14.useState)(false);
17316
- const VERSION3 = "1.2.13";
17336
+ const VERSION3 = "1.2.15";
17317
17337
  const [weather, setWeather] = useLocalStorage("weather", user?.weather || guest?.weather || void 0);
17318
17338
  const {
17319
17339
  API_URL: API_URL2,
@@ -18289,7 +18309,7 @@ var init_utils = __esm({
18289
18309
  window.history.replaceState({}, "", newUrl);
18290
18310
  };
18291
18311
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent.includes("Firefox");
18292
- VERSION = "1.2.13";
18312
+ VERSION = "1.2.15";
18293
18313
  getSlugFromPathname = (path) => {
18294
18314
  const siteConfig = getSiteConfig();
18295
18315
  return getAppAndStoreSlugs(path, {
@@ -19967,6 +19987,13 @@ function NavigationProvider({
19967
19987
  const goToThreads = () => {
19968
19988
  router.push(slug ? `/${slug.toLowerCase()}/threads` : "/threads");
19969
19989
  };
19990
+ const getStoreSlug = (slug2) => {
19991
+ if (language === defaultLocale) {
19992
+ return `/${slug2}`;
19993
+ } else {
19994
+ return `/${language}/${slug2}`;
19995
+ }
19996
+ };
19970
19997
  const goToThread = (threadId2) => {
19971
19998
  router.push(`/threads/${threadId2}`);
19972
19999
  };
@@ -19997,7 +20024,8 @@ function NavigationProvider({
19997
20024
  isLoading,
19998
20025
  slug,
19999
20026
  setSlug,
20000
- getAppSlug
20027
+ getAppSlug,
20028
+ language
20001
20029
  } = useAuth();
20002
20030
  const [isShowingCollaborate, setIsShowingCollaborate] = (0, import_react25.useState)(false);
20003
20031
  const [collaborationStep, setCollaborationStep] = (0, import_react25.useState)(0);
@@ -20407,6 +20435,7 @@ function NavigationProvider({
20407
20435
  setShowAddToHomeScreen,
20408
20436
  setSlug,
20409
20437
  goToThreads,
20438
+ getStoreSlug,
20410
20439
  goToApp,
20411
20440
  goToThread,
20412
20441
  pendingCollaborationThreadsCount,
@@ -20452,6 +20481,7 @@ var init_NavigationProvider = __esm({
20452
20481
  import_i18next4 = require("i18next");
20453
20482
  init_useWebSocket();
20454
20483
  init_siteConfig();
20484
+ init_locales();
20455
20485
  NavigationContext = (0, import_react25.createContext)(void 0);
20456
20486
  }
20457
20487
  });
@@ -25813,7 +25843,7 @@ function App({
25813
25843
  } = useApp();
25814
25844
  const { user, guest, getAppSlug, store, apps, chrry } = useAuth();
25815
25845
  const { FRONTEND_URL: FRONTEND_URL4 } = useData();
25816
- const { router, setIsNewChat } = useNavigationContext();
25846
+ const { router, setIsNewChat, getStoreSlug } = useNavigationContext();
25817
25847
  const { setInput, setIsWebSearchEnabled } = useChat();
25818
25848
  const { addHapticFeedback } = useTheme2();
25819
25849
  const currentStoreId = store?.id;
@@ -26363,7 +26393,7 @@ function App({
26363
26393
  gap: "0.4rem"
26364
26394
  },
26365
26395
  title: t5(store?.title || "Your AI-Powered Life"),
26366
- href: `${FRONTEND_URL4}/${store?.slug}`,
26396
+ href: getStoreSlug(store?.slug),
26367
26397
  className: (0, import_clsx12.default)("button inverted small slideUp"),
26368
26398
  onClick: (e) => {
26369
26399
  addHapticFeedback();
@@ -26371,7 +26401,7 @@ function App({
26371
26401
  return;
26372
26402
  }
26373
26403
  e.preventDefault();
26374
- router.push(`/${store?.slug}`);
26404
+ router.push(getStoreSlug(store?.slug));
26375
26405
  }
26376
26406
  },
26377
26407
  /* @__PURE__ */ import_react49.default.createElement(
@@ -33316,19 +33346,26 @@ function Store({
33316
33346
  }) {
33317
33347
  const { FRONTEND_URL: FRONTEND_URL4 } = useData();
33318
33348
  const { router, setIsNewChat, pathname } = useNavigationContext();
33319
- const { allApps, getAppSlug, setApp } = useAuth();
33320
- const storeSlug = slug || pathname.split("/")[1];
33321
- const matchedApp = allApps?.find((app) => app?.store?.slug === storeSlug);
33349
+ const { allApps, getAppSlug, setApp, app } = useAuth();
33350
+ const { appSlug, storeSlug } = getAppAndStoreSlugs(pathname, {
33351
+ defaultAppSlug: app?.slug ?? "",
33352
+ defaultStoreSlug: app?.store?.slug ?? "",
33353
+ excludedRoutes: excludedSlugRoutes,
33354
+ locales
33355
+ });
33356
+ const matchedApp = allApps?.find(
33357
+ (app2) => app2?.store?.slug === storeSlug || app2?.store?.slug === appSlug
33358
+ );
33322
33359
  const store = matchedApp?.store;
33323
33360
  const apps = store?.apps;
33324
- const baseApp = store?.app || apps?.find((app) => app?.id === store?.appId);
33361
+ const baseApp = store?.app || apps?.find((app2) => app2?.id === store?.appId);
33325
33362
  const { t: t5 } = useAppContext();
33326
33363
  const { track } = useAuth();
33327
33364
  const storeApps = apps;
33328
- const [selectedApp, setSelectedAppInternal] = (0, import_react66.useState)(storeApps?.find((app) => app.slug === "chrry"));
33329
- const setSelectedApp = (app) => {
33330
- setSelectedAppInternal(app);
33331
- setApp(app);
33365
+ const [selectedApp, setSelectedAppInternal] = (0, import_react66.useState)(storeApps?.find((app2) => app2.slug === "chrry"));
33366
+ const setSelectedApp = (app2) => {
33367
+ setSelectedAppInternal(app2);
33368
+ setApp(app2);
33332
33369
  };
33333
33370
  (0, import_react66.useEffect)(() => {
33334
33371
  if (store) {
@@ -33424,19 +33461,19 @@ function Store({
33424
33461
  /* @__PURE__ */ import_react66.default.createElement(icons_exports.Sparkles, { size: 16, color: "var(--accent-1)" }),
33425
33462
  t5("Create Your Agent")
33426
33463
  )),
33427
- /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.content }, /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.apps }, storeApps?.map((app) => /* @__PURE__ */ import_react66.default.createElement(
33464
+ /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.content }, /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.apps }, storeApps?.map((app2) => /* @__PURE__ */ import_react66.default.createElement(
33428
33465
  "div",
33429
33466
  {
33430
- key: app.id,
33467
+ key: app2.id,
33431
33468
  className: (0, import_clsx27.default)(
33432
33469
  import_Store_module.default.app,
33433
- selectedApp?.id === app.id && import_Store_module.default.selected
33470
+ selectedApp?.id === app2.id && import_Store_module.default.selected
33434
33471
  ),
33435
- onClick: () => setSelectedApp(app)
33472
+ onClick: () => setSelectedApp(app2)
33436
33473
  },
33437
33474
  /* @__PURE__ */ import_react66.default.createElement("span", { className: (0, import_clsx27.default)(import_Store_module.default.badge) }, t5("live")),
33438
- /* @__PURE__ */ import_react66.default.createElement(ImageComponent, { app, alt: app.name, size: 80 }),
33439
- /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.appInfo }, /* @__PURE__ */ import_react66.default.createElement("span", { className: import_Store_module.default.appName }, app.icon, " ", app.name), /* @__PURE__ */ import_react66.default.createElement("span", { className: import_Store_module.default.appSubtitle }, t5(app.subtitle || "")))
33475
+ /* @__PURE__ */ import_react66.default.createElement(ImageComponent, { app: app2, alt: app2.name, size: 80 }),
33476
+ /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.appInfo }, /* @__PURE__ */ import_react66.default.createElement("span", { className: import_Store_module.default.appName }, app2.icon, " ", app2.name), /* @__PURE__ */ import_react66.default.createElement("span", { className: import_Store_module.default.appSubtitle }, t5(app2.subtitle || "")))
33440
33477
  ))), /* @__PURE__ */ import_react66.default.createElement("div", { key: selectedApp?.id, className: import_Store_module.default.footer }, selectedApp && /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.appDetails }, /* @__PURE__ */ import_react66.default.createElement("h3", null, selectedApp.icon, " ", selectedApp.name), /* @__PURE__ */ import_react66.default.createElement("p", { className: import_Store_module.default.subtitle }, t5(selectedApp.title || "")), /* @__PURE__ */ import_react66.default.createElement("p", { className: import_Store_module.default.description }, t5(selectedApp.description || "")), Array.isArray(selectedApp.featureList) && selectedApp.featureList.length > 0 && /* @__PURE__ */ import_react66.default.createElement("div", { className: import_Store_module.default.features }, /* @__PURE__ */ import_react66.default.createElement("h4", null, t5("Key Features")), /* @__PURE__ */ import_react66.default.createElement("ul", null, selectedApp.featureList.map((feature, index) => /* @__PURE__ */ import_react66.default.createElement("li", { className: import_Store_module.default.feature, key: index }, /* @__PURE__ */ import_react66.default.createElement(
33441
33478
  icons_exports.Sparkles,
33442
33479
  {
@@ -33522,6 +33559,8 @@ var init_Store = __esm({
33522
33559
  init_Store_styles();
33523
33560
  init_icons();
33524
33561
  init_platform();
33562
+ init_url();
33563
+ init_locales();
33525
33564
  }
33526
33565
  });
33527
33566