@chrryai/chrry 1.2.13 → 1.2.14

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.14";
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.14";
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.14";
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.14";
18293
18313
  getSlugFromPathname = (path) => {
18294
18314
  const siteConfig = getSiteConfig();
18295
18315
  return getAppAndStoreSlugs(path, {