@chrryai/chrry 1.5.34 → 1.5.36

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
@@ -1500,23 +1500,22 @@ declare const getSession: ({ deviceId, fingerprint, gift, isStandalone, appId, t
1500
1500
  translate?: boolean;
1501
1501
  locale?: string;
1502
1502
  source?: string;
1503
- }) => Promise<session | {
1504
- error?: string;
1505
- status?: number;
1506
- } | undefined>;
1503
+ }) => Promise<session | undefined>;
1507
1504
  type ApiActions = ReturnType<typeof getActions>;
1508
- declare const getApps: ({ API_URL, token, appId, }: {
1505
+ declare const getApps: ({ API_URL, token, chrryUrl, appId, }: {
1509
1506
  API_URL?: string;
1510
1507
  token: string;
1511
1508
  appId?: string;
1509
+ chrryUrl?: string;
1512
1510
  }) => Promise<appWithStore[] | {
1513
1511
  error: string;
1514
1512
  status: number;
1515
1513
  }>;
1516
- declare const getApp: ({ API_URL, token, appId, }: {
1514
+ declare const getApp: ({ API_URL, token, appId, chrryUrl, }: {
1517
1515
  API_URL?: string;
1518
1516
  token: string;
1519
1517
  appId: string;
1518
+ chrryUrl?: string;
1520
1519
  }) => Promise<appWithStore>;
1521
1520
  declare const getTranslations: ({ API_URL, token, locale, }?: {
1522
1521
  API_URL?: string;
@@ -1649,10 +1648,7 @@ declare const getActions: ({ API_URL, token, }: {
1649
1648
  API_URL?: string;
1650
1649
  VERSION?: string;
1651
1650
  app?: "extension" | "pwa" | "web";
1652
- }) => Promise<session | {
1653
- error?: string;
1654
- status?: number;
1655
- } | undefined>;
1651
+ }) => Promise<session | undefined>;
1656
1652
  };
1657
1653
 
1658
1654
  declare const aiAgentCapabilitiesSchema: z.ZodObject<{
package/dist/index.d.ts CHANGED
@@ -1500,23 +1500,22 @@ declare const getSession: ({ deviceId, fingerprint, gift, isStandalone, appId, t
1500
1500
  translate?: boolean;
1501
1501
  locale?: string;
1502
1502
  source?: string;
1503
- }) => Promise<session | {
1504
- error?: string;
1505
- status?: number;
1506
- } | undefined>;
1503
+ }) => Promise<session | undefined>;
1507
1504
  type ApiActions = ReturnType<typeof getActions>;
1508
- declare const getApps: ({ API_URL, token, appId, }: {
1505
+ declare const getApps: ({ API_URL, token, chrryUrl, appId, }: {
1509
1506
  API_URL?: string;
1510
1507
  token: string;
1511
1508
  appId?: string;
1509
+ chrryUrl?: string;
1512
1510
  }) => Promise<appWithStore[] | {
1513
1511
  error: string;
1514
1512
  status: number;
1515
1513
  }>;
1516
- declare const getApp: ({ API_URL, token, appId, }: {
1514
+ declare const getApp: ({ API_URL, token, appId, chrryUrl, }: {
1517
1515
  API_URL?: string;
1518
1516
  token: string;
1519
1517
  appId: string;
1518
+ chrryUrl?: string;
1520
1519
  }) => Promise<appWithStore>;
1521
1520
  declare const getTranslations: ({ API_URL, token, locale, }?: {
1522
1521
  API_URL?: string;
@@ -1649,10 +1648,7 @@ declare const getActions: ({ API_URL, token, }: {
1649
1648
  API_URL?: string;
1650
1649
  VERSION?: string;
1651
1650
  app?: "extension" | "pwa" | "web";
1652
- }) => Promise<session | {
1653
- error?: string;
1654
- status?: number;
1655
- } | undefined>;
1651
+ }) => Promise<session | undefined>;
1656
1652
  };
1657
1653
 
1658
1654
  declare const aiAgentCapabilitiesSchema: z.ZodObject<{
package/dist/index.js CHANGED
@@ -489,7 +489,7 @@ var init_locales = __esm({
489
489
 
490
490
  // utils/siteConfig.ts
491
491
  function detectSiteModeDomain(hostname2, mode) {
492
- const defaultMode = process.env.MODE || import_meta?.env?.VITE_SITE_MODE || mode || "vex";
492
+ const defaultMode = process.env.MODE || import_meta?.env?.VITE_SITE_MODE || mode || "zarathustra";
493
493
  const rawHost = hostname2 || (typeof window !== "undefined" ? window?.location?.hostname : "") || "";
494
494
  let host = rawHost?.trim().toLowerCase();
495
495
  if (host?.includes("://")) {
@@ -2093,7 +2093,7 @@ var init_utils = __esm({
2093
2093
  };
2094
2094
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
2095
2095
  config = getSiteConfig(getClientHostname());
2096
- VERSION = config.version || "1.5.34";
2096
+ VERSION = config.version || "1.5.36";
2097
2097
  getSlugFromPathname = (path) => {
2098
2098
  return getAppAndStoreSlugs(path, {
2099
2099
  defaultAppSlug: config.slug,
@@ -3833,6 +3833,7 @@ var init_PlatformPrimitives = __esm({
3833
3833
  type = "button",
3834
3834
  onClick,
3835
3835
  disabled,
3836
+ suppressHydrationWarning,
3836
3837
  children,
3837
3838
  ...props
3838
3839
  }, ref) => {
@@ -3850,6 +3851,7 @@ var init_PlatformPrimitives = __esm({
3850
3851
  style: sanitizedStyle,
3851
3852
  onClick,
3852
3853
  disabled,
3854
+ suppressHydrationWarning,
3853
3855
  ...props
3854
3856
  },
3855
3857
  children
@@ -5860,13 +5862,16 @@ var init_lib = __esm({
5860
5862
  getApps = async ({
5861
5863
  API_URL: API_URL2 = API_URL,
5862
5864
  token,
5865
+ chrryUrl,
5863
5866
  appId
5864
5867
  }) => {
5865
5868
  const params = new URLSearchParams();
5866
5869
  appId && params.append("appId", appId);
5870
+ chrryUrl && params.append("chrryUrl", chrryUrl);
5867
5871
  const response = await fetch(`${API_URL2}/apps?${params}`, {
5868
5872
  headers: {
5869
- Authorization: `Bearer ${token}`
5873
+ Authorization: `Bearer ${token}`,
5874
+ ...chrryUrl ? { "x-chrry-url": chrryUrl } : {}
5870
5875
  }
5871
5876
  });
5872
5877
  if (!response.ok) {
@@ -5881,12 +5886,16 @@ var init_lib = __esm({
5881
5886
  getApp = async ({
5882
5887
  API_URL: API_URL2 = API_URL,
5883
5888
  token,
5884
- appId
5889
+ appId,
5890
+ chrryUrl
5885
5891
  }) => {
5892
+ const params = new URLSearchParams();
5893
+ chrryUrl && params.append("chrryUrl", chrryUrl);
5886
5894
  const response = await fetch(`${API_URL2}/apps/${appId}`, {
5887
5895
  headers: {
5888
5896
  Authorization: `Bearer ${token}`,
5889
- "x-app-id": appId
5897
+ "x-app-id": appId,
5898
+ ...chrryUrl ? { "x-chrry-url": chrryUrl } : {}
5890
5899
  }
5891
5900
  });
5892
5901
  const data = await response.json();
@@ -23332,6 +23341,7 @@ function AuthProvider({
23332
23341
  const API_PORT2 = process.env.API_PORT || "3001";
23333
23342
  const isTestingDevice2 = false;
23334
23343
  const chrryUrl = CHRRY_URL;
23344
+ console.log(`\u{1F680} ~ AuthProvider ~ chrryUrl:`, chrryUrl);
23335
23345
  const [deviceId, setDeviceId] = useCookieOrLocalStorage(
23336
23346
  "deviceId",
23337
23347
  session2?.deviceId
@@ -23478,11 +23488,11 @@ function AuthProvider({
23478
23488
  throw new Error("No response from server");
23479
23489
  }
23480
23490
  if ("error" in result || "status" in result) {
23481
- if (result.status === 429) {
23491
+ if ("status" in result && result.status === 429) {
23482
23492
  setShouldFetchSession(false);
23483
23493
  throw new Error("Rate limit exceeded");
23484
23494
  }
23485
- if (result.error) {
23495
+ if ("error" in result && result.error) {
23486
23496
  import_react_hot_toast.default.error(result.error);
23487
23497
  setShouldFetchSession(false);
23488
23498
  }
@@ -23505,7 +23515,7 @@ function AuthProvider({
23505
23515
  }
23506
23516
  return sessionResult;
23507
23517
  } catch (error2) {
23508
- import_react_hot_toast.default.error("Something went wrong");
23518
+ console.error("Error fetching session:", error2);
23509
23519
  }
23510
23520
  },
23511
23521
  {
@@ -23615,7 +23625,7 @@ function AuthProvider({
23615
23625
  }
23616
23626
  return computedSlug || defaultSlug;
23617
23627
  };
23618
- const baseApp = storeApps?.find((item) => {
23628
+ const baseApp = storeApps.concat(session2?.app?.store?.apps || []).find((item) => {
23619
23629
  if (!item) return false;
23620
23630
  if (siteConfig.slug === item.slug && item.store?.slug === siteConfig.storeSlug) {
23621
23631
  return true;
@@ -23746,6 +23756,7 @@ function AuthProvider({
23746
23756
  const [newApp, setNewApp] = (0, import_react19.useState)(void 0);
23747
23757
  const mergeApps = (0, import_react19.useCallback)((newApps) => {
23748
23758
  setAllApps((prevApps) => {
23759
+ console.log(`\u{1F680} ~ AuthProvider ~ prevApps:`, prevApps);
23749
23760
  const existingAppsMap = new Map(prevApps.map((app2) => [app2.id, app2]));
23750
23761
  newApps.forEach((app2) => {
23751
23762
  if (!existingAppsMap.has(app2.id) || !existingAppsMap.get(app2.id)?.store?.apps.length || !existingAppsMap.get(app2.id)?.store?.app) {
@@ -23785,11 +23796,13 @@ function AuthProvider({
23785
23796
  } = (0, import_swr2.default)(token && appId ? ["app", appId] : null, async () => {
23786
23797
  try {
23787
23798
  if (!token || !appId) return;
23788
- const apps2 = await getApp({ token, appId });
23799
+ const app2 = await getApp({ token, appId, chrryUrl });
23789
23800
  if (loadingAppId) {
23790
23801
  setLoadingAppId(void 0);
23791
23802
  }
23792
- return apps2.store?.apps;
23803
+ const apps2 = app2.store?.apps;
23804
+ apps2 && mergeApps(apps2);
23805
+ return apps2;
23793
23806
  } catch (error2) {
23794
23807
  import_react_hot_toast.default.error("Something went wrong");
23795
23808
  }
@@ -23814,11 +23827,6 @@ function AuthProvider({
23814
23827
  refetchApps();
23815
23828
  }
23816
23829
  }, [loadingApp, isLoadingApps, storeApps]);
23817
- (0, import_react19.useEffect)(() => {
23818
- if (storeAppsSwr && Array.isArray(storeAppsSwr)) {
23819
- mergeApps(storeAppsSwr);
23820
- }
23821
- }, [storeAppsSwr, mergeApps]);
23822
23830
  const canShowFocus = !!focus2 && app?.id === focus2.id && !threadId;
23823
23831
  const [showFocus, setShowFocus] = (0, import_react19.useState)(canShowFocus);
23824
23832
  (0, import_react19.useEffect)(() => {
@@ -24414,7 +24422,7 @@ function DataProvider({ children, ...rest }) {
24414
24422
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24415
24423
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24416
24424
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24417
- const VERSION4 = "1.5.34";
24425
+ const VERSION4 = "1.5.36";
24418
24426
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24419
24427
  const {
24420
24428
  API_URL: API_URL2,
@@ -26883,7 +26891,7 @@ function ChatProvider({
26883
26891
  return threadData2;
26884
26892
  },
26885
26893
  {
26886
- revalidateOnMount: true
26894
+ // revalidateOnMount: true,
26887
26895
  }
26888
26896
  );
26889
26897
  const [agentName, setAgentName] = (0, import_react31.useState)(session2?.aiAgent?.name || "");
@@ -28318,7 +28326,9 @@ var init_AppContext = __esm({
28318
28326
  reportedMissingKeys = /* @__PURE__ */ new Set();
28319
28327
  checkedKeys = /* @__PURE__ */ new Set();
28320
28328
  AppContext = (0, import_react35.createContext)({
28321
- t: (key, values, autoAdd) => key
28329
+ t: (key, values, autoAdd) => key,
28330
+ captureException: () => {
28331
+ }
28322
28332
  });
28323
28333
  AppContextProvider = ({
28324
28334
  children
@@ -28340,11 +28350,13 @@ var init_AppContext = __esm({
28340
28350
  const name = app && atlas2 && app.store?.appId === atlas2.id ? "Atlas" : config2.name;
28341
28351
  return result.replace(/Vex/g, name).replace(/vex/g, name.toLowerCase());
28342
28352
  };
28353
+ const { captureException } = useError();
28343
28354
  return /* @__PURE__ */ import_react35.default.createElement(
28344
28355
  AppContext.Provider,
28345
28356
  {
28346
28357
  value: {
28347
- t: t5
28358
+ t: t5,
28359
+ captureException
28348
28360
  }
28349
28361
  },
28350
28362
  children
@@ -41356,7 +41368,15 @@ function Menu({
41356
41368
  size: 20
41357
41369
  }
41358
41370
  )
41359
- )) : /* @__PURE__ */ import_react62.default.createElement(Button, { className: "link", onClick: toggleMenu }, /* @__PURE__ */ import_react62.default.createElement(ImageComponent, { app, size: 28 }))), /* @__PURE__ */ import_react62.default.createElement(
41371
+ )) : /* @__PURE__ */ import_react62.default.createElement(
41372
+ Button,
41373
+ {
41374
+ suppressHydrationWarning: true,
41375
+ className: "link",
41376
+ onClick: toggleMenu
41377
+ },
41378
+ /* @__PURE__ */ import_react62.default.createElement(ImageComponent, { app, size: 28 })
41379
+ )), /* @__PURE__ */ import_react62.default.createElement(
41360
41380
  Div,
41361
41381
  {
41362
41382
  style: {