@chrryai/chrry 1.5.75 → 1.5.76

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
@@ -719,6 +719,24 @@ declare function generateStoreMetadata({ store, locale, currentDomain, translati
719
719
  translations: Record<string, any>;
720
720
  }): Metadata | undefined;
721
721
 
722
+ /**
723
+ * Generate dynamic metadata for a thread page
724
+ *
725
+ * @example
726
+ * ```typescript
727
+ * export async function generateMetadata({ params }) {
728
+ * const thread = await getThread({ id: params.threadId })
729
+ * return generateThreadMetadata({ thread, locale: params.locale, currentDomain })
730
+ * }
731
+ * ```
732
+ */
733
+ declare function generateThreadMetadata({ thread, locale, currentDomain, translations, }: {
734
+ thread: thread;
735
+ locale?: locale | string;
736
+ currentDomain: string;
737
+ translations: Record<string, any>;
738
+ }): Metadata;
739
+
722
740
  interface FileValidationResult {
723
741
  isSupported: boolean;
724
742
  maxSize: number;
@@ -1073,7 +1091,7 @@ declare function useStoreMetadata(store?: storeWithApps): void;
1073
1091
  * Hook to dynamically update page metadata for app pages
1074
1092
  * Uses the same generateAppMetadata function as server-side
1075
1093
  */
1076
- declare function useAppMetadata(app?: appWithStore, enabled?: boolean): void;
1094
+ declare function useAppMetadata(): void;
1077
1095
  /**
1078
1096
  * Hook to dynamically update page metadata for thread pages
1079
1097
  */
@@ -1793,4 +1811,4 @@ interface HistoryRouterProviderProps {
1793
1811
  */
1794
1812
  declare function HistoryRouterProvider({ children, }: HistoryRouterProviderProps): React.ReactElement;
1795
1813
 
1796
- export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, type CreateCustomAiAgent, FREE_DAYS, FRONTEND_URL, type FileValidationResult, GUEST_TASKS_COUNT, HistoryRouterProvider, MAX_FILE_LIMITS, MAX_FILE_SIZES, MAX_TOOL_CALLS_PER_MESSAGE, MEMBER_TASKS_COUNT, OWNER_CREDITS, PDF_LIMITS, PLUS_PRICE, PLUS_TASKS_COUNT, PROD_FRONTEND_URL, PROMPT_LIMITS, PRO_PRICE, Sidebar, Store, VERSION, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, deleteApp, deleteCalendarEvent, deleteMemories, deleteMessage, deleteSubscription, exampleInstructions, expenseCategory, type expenseCategoryType, exportToGoogleCalendar, extensionSuggestions, formatFileSize, generateAppMetadata, generateStoreMetadata, getActions, getApp, getApps, getBrowserAPI, getBrowserIdentity, getCalendarEvents, getDailyImageLimit, getExampleInstructions, getExtensionUrl, getExtensionUrls, getFlag, getGuest, getHourlyLimit, getImageSrc, getInstructionConfig, getLastMessage, getMaxFileSize, getMetadata, getRedirectURL, getSession, getSlugFromPathname, getThread, getThreadId, getThreads, getTranslations, getUser, getUsers, getWeatherCacheTime, type instructionBase, isCI, isCollaborator, isDeepEqual, isDevelopment, isE2E, isFirefox, isOwner, isProduction, isSameDay, isTestingDevice, isTextFile, isValidUsername, isValidUuidV4, pageSizes, removeParam, removeUser, reorderApps, replaceLinks, storage, syncGoogleCalendar, updateApp, updateCalendarEvent, updateCollaboration, updateGuest, updateMessage, updateThread, updateUser, uploadUserImage, useAppMetadata, useComputedValue, useCookieOrLocalStorage, useCountdown, useDeviceInfo, useHasHydrated, useLocalStorage, usePWAInstall, useStoreMetadata, useSyncedState, useThreadMetadata, utcToday, validateFile };
1814
+ export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, type CreateCustomAiAgent, FREE_DAYS, FRONTEND_URL, type FileValidationResult, GUEST_TASKS_COUNT, HistoryRouterProvider, MAX_FILE_LIMITS, MAX_FILE_SIZES, MAX_TOOL_CALLS_PER_MESSAGE, MEMBER_TASKS_COUNT, OWNER_CREDITS, PDF_LIMITS, PLUS_PRICE, PLUS_TASKS_COUNT, PROD_FRONTEND_URL, PROMPT_LIMITS, PRO_PRICE, Sidebar, Store, VERSION, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, deleteApp, deleteCalendarEvent, deleteMemories, deleteMessage, deleteSubscription, exampleInstructions, expenseCategory, type expenseCategoryType, exportToGoogleCalendar, extensionSuggestions, formatFileSize, generateAppMetadata, generateStoreMetadata, generateThreadMetadata, getActions, getApp, getApps, getBrowserAPI, getBrowserIdentity, getCalendarEvents, getDailyImageLimit, getExampleInstructions, getExtensionUrl, getExtensionUrls, getFlag, getGuest, getHourlyLimit, getImageSrc, getInstructionConfig, getLastMessage, getMaxFileSize, getMetadata, getRedirectURL, getSession, getSlugFromPathname, getThread, getThreadId, getThreads, getTranslations, getUser, getUsers, getWeatherCacheTime, type instructionBase, isCI, isCollaborator, isDeepEqual, isDevelopment, isE2E, isFirefox, isOwner, isProduction, isSameDay, isTestingDevice, isTextFile, isValidUsername, isValidUuidV4, pageSizes, removeParam, removeUser, reorderApps, replaceLinks, storage, syncGoogleCalendar, updateApp, updateCalendarEvent, updateCollaboration, updateGuest, updateMessage, updateThread, updateUser, uploadUserImage, useAppMetadata, useComputedValue, useCookieOrLocalStorage, useCountdown, useDeviceInfo, useHasHydrated, useLocalStorage, usePWAInstall, useStoreMetadata, useSyncedState, useThreadMetadata, utcToday, validateFile };
package/dist/index.d.ts CHANGED
@@ -719,6 +719,24 @@ declare function generateStoreMetadata({ store, locale, currentDomain, translati
719
719
  translations: Record<string, any>;
720
720
  }): Metadata | undefined;
721
721
 
722
+ /**
723
+ * Generate dynamic metadata for a thread page
724
+ *
725
+ * @example
726
+ * ```typescript
727
+ * export async function generateMetadata({ params }) {
728
+ * const thread = await getThread({ id: params.threadId })
729
+ * return generateThreadMetadata({ thread, locale: params.locale, currentDomain })
730
+ * }
731
+ * ```
732
+ */
733
+ declare function generateThreadMetadata({ thread, locale, currentDomain, translations, }: {
734
+ thread: thread;
735
+ locale?: locale | string;
736
+ currentDomain: string;
737
+ translations: Record<string, any>;
738
+ }): Metadata;
739
+
722
740
  interface FileValidationResult {
723
741
  isSupported: boolean;
724
742
  maxSize: number;
@@ -1073,7 +1091,7 @@ declare function useStoreMetadata(store?: storeWithApps): void;
1073
1091
  * Hook to dynamically update page metadata for app pages
1074
1092
  * Uses the same generateAppMetadata function as server-side
1075
1093
  */
1076
- declare function useAppMetadata(app?: appWithStore, enabled?: boolean): void;
1094
+ declare function useAppMetadata(): void;
1077
1095
  /**
1078
1096
  * Hook to dynamically update page metadata for thread pages
1079
1097
  */
@@ -1793,4 +1811,4 @@ interface HistoryRouterProviderProps {
1793
1811
  */
1794
1812
  declare function HistoryRouterProvider({ children, }: HistoryRouterProviderProps): React.ReactElement;
1795
1813
 
1796
- export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, type CreateCustomAiAgent, FREE_DAYS, FRONTEND_URL, type FileValidationResult, GUEST_TASKS_COUNT, HistoryRouterProvider, MAX_FILE_LIMITS, MAX_FILE_SIZES, MAX_TOOL_CALLS_PER_MESSAGE, MEMBER_TASKS_COUNT, OWNER_CREDITS, PDF_LIMITS, PLUS_PRICE, PLUS_TASKS_COUNT, PROD_FRONTEND_URL, PROMPT_LIMITS, PRO_PRICE, Sidebar, Store, VERSION, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, deleteApp, deleteCalendarEvent, deleteMemories, deleteMessage, deleteSubscription, exampleInstructions, expenseCategory, type expenseCategoryType, exportToGoogleCalendar, extensionSuggestions, formatFileSize, generateAppMetadata, generateStoreMetadata, getActions, getApp, getApps, getBrowserAPI, getBrowserIdentity, getCalendarEvents, getDailyImageLimit, getExampleInstructions, getExtensionUrl, getExtensionUrls, getFlag, getGuest, getHourlyLimit, getImageSrc, getInstructionConfig, getLastMessage, getMaxFileSize, getMetadata, getRedirectURL, getSession, getSlugFromPathname, getThread, getThreadId, getThreads, getTranslations, getUser, getUsers, getWeatherCacheTime, type instructionBase, isCI, isCollaborator, isDeepEqual, isDevelopment, isE2E, isFirefox, isOwner, isProduction, isSameDay, isTestingDevice, isTextFile, isValidUsername, isValidUuidV4, pageSizes, removeParam, removeUser, reorderApps, replaceLinks, storage, syncGoogleCalendar, updateApp, updateCalendarEvent, updateCollaboration, updateGuest, updateMessage, updateThread, updateUser, uploadUserImage, useAppMetadata, useComputedValue, useCookieOrLocalStorage, useCountdown, useDeviceInfo, useHasHydrated, useLocalStorage, usePWAInstall, useStoreMetadata, useSyncedState, useThreadMetadata, utcToday, validateFile };
1814
+ export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, type CreateCustomAiAgent, FREE_DAYS, FRONTEND_URL, type FileValidationResult, GUEST_TASKS_COUNT, HistoryRouterProvider, MAX_FILE_LIMITS, MAX_FILE_SIZES, MAX_TOOL_CALLS_PER_MESSAGE, MEMBER_TASKS_COUNT, OWNER_CREDITS, PDF_LIMITS, PLUS_PRICE, PLUS_TASKS_COUNT, PROD_FRONTEND_URL, PROMPT_LIMITS, PRO_PRICE, Sidebar, Store, VERSION, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, deleteApp, deleteCalendarEvent, deleteMemories, deleteMessage, deleteSubscription, exampleInstructions, expenseCategory, type expenseCategoryType, exportToGoogleCalendar, extensionSuggestions, formatFileSize, generateAppMetadata, generateStoreMetadata, generateThreadMetadata, getActions, getApp, getApps, getBrowserAPI, getBrowserIdentity, getCalendarEvents, getDailyImageLimit, getExampleInstructions, getExtensionUrl, getExtensionUrls, getFlag, getGuest, getHourlyLimit, getImageSrc, getInstructionConfig, getLastMessage, getMaxFileSize, getMetadata, getRedirectURL, getSession, getSlugFromPathname, getThread, getThreadId, getThreads, getTranslations, getUser, getUsers, getWeatherCacheTime, type instructionBase, isCI, isCollaborator, isDeepEqual, isDevelopment, isE2E, isFirefox, isOwner, isProduction, isSameDay, isTestingDevice, isTextFile, isValidUsername, isValidUuidV4, pageSizes, removeParam, removeUser, reorderApps, replaceLinks, storage, syncGoogleCalendar, updateApp, updateCalendarEvent, updateCollaboration, updateGuest, updateMessage, updateThread, updateUser, uploadUserImage, useAppMetadata, useComputedValue, useCookieOrLocalStorage, useCountdown, useDeviceInfo, useHasHydrated, useLocalStorage, usePWAInstall, useStoreMetadata, useSyncedState, useThreadMetadata, utcToday, validateFile };
package/dist/index.js CHANGED
@@ -2389,36 +2389,34 @@ function generateAppMetadata({
2389
2389
  const ogImage = app.images?.[0]?.url || "/logo/logo-512-512.png";
2390
2390
  const storeSlug = store.slug || "chrry";
2391
2391
  const storeName = store.name || "Blossom";
2392
- const baseUrl = whiteLabel?.store?.domain || currentDomain;
2393
2392
  const cleanSlug = (slug2) => slug2.replace(/\/+$/, "");
2394
- const slug = whiteLabel ? getAppSlug_default({
2393
+ const toRelative = (val) => {
2394
+ return val.replace(baseUrl, "");
2395
+ };
2396
+ const baseUrl = cleanSlug(whiteLabel?.store?.domain || currentDomain);
2397
+ const rawSlug = whiteLabel ? getAppSlug_default({
2395
2398
  targetApp: app,
2396
2399
  pathname,
2397
2400
  baseApp: whiteLabel,
2398
2401
  defaultSlug: "/"
2399
2402
  }) : `/${storeSlug}/${app.slug}`;
2400
- const canonicalUrl = cleanSlug(baseUrl) + cleanSlug(slug);
2403
+ const slug = cleanSlug(rawSlug.startsWith("/") ? rawSlug : `/${rawSlug}`);
2404
+ const canonicalUrl = baseUrl + slug;
2401
2405
  const t5 = (key) => {
2402
2406
  return t(translations)(key);
2403
2407
  };
2404
- const toRelative = (val) => {
2405
- return val.replace(baseUrl, "");
2406
- };
2407
2408
  return {
2408
- title: `${t5(app.name)} - ${t5(app.title)} - ${storeName}`,
2409
+ title: `${t5(app.name)} - ${t5(app.title)}`,
2409
2410
  description,
2410
- manifest: `/manifest.webmanifest`,
2411
- icons: [16, 48, 128, 180, 192, 512].reduce(
2412
- (icons, size2) => icons.concat({
2413
- src: toRelative(
2414
- getImageSrc({ app, size: size2, BASE_URL: baseUrl }).src || "/images/pacman/space-invader.png"
2415
- ),
2416
- sizes: `${size2}x${size2}`,
2417
- type: "image/png",
2418
- purpose: "any maskable"
2419
- }),
2420
- []
2421
- ),
2411
+ manifest: `/manifest.webmanifest?appId=${app.id}`,
2412
+ icons: [16, 48, 128, 180, 192, 512].map((size2) => ({
2413
+ url: toRelative(
2414
+ getImageSrc({ app, size: size2, BASE_URL: baseUrl }).src || "/images/pacman/space-invader.png"
2415
+ ),
2416
+ sizes: `${size2}x${size2}`,
2417
+ type: "image/png",
2418
+ purpose: "any maskable"
2419
+ })),
2422
2420
  appleWebApp: {
2423
2421
  capable: true,
2424
2422
  statusBarStyle: "default",
@@ -2448,16 +2446,19 @@ function generateAppMetadata({
2448
2446
  alternates: {
2449
2447
  canonical: canonicalUrl,
2450
2448
  languages: {
2451
- // Default locale points exactly to the canonical URL (no /en prefix)
2449
+ "x-default": canonicalUrl,
2450
+ // Default fallback for unmatched locales
2452
2451
  en: canonicalUrl,
2453
- // Other locales live on the same canonical base host
2452
+ // English uses canonical URL (no /en prefix due to localePrefix: "as-needed")
2454
2453
  de: `${baseUrl}/de${slug}`,
2455
2454
  fr: `${baseUrl}/fr${slug}`,
2456
2455
  es: `${baseUrl}/es${slug}`,
2457
2456
  ja: `${baseUrl}/ja${slug}`,
2458
2457
  ko: `${baseUrl}/ko${slug}`,
2459
2458
  pt: `${baseUrl}/pt${slug}`,
2460
- zh: `${baseUrl}/zh${slug}`
2459
+ zh: `${baseUrl}/zh${slug}`,
2460
+ nl: `${baseUrl}/nl${slug}`,
2461
+ tr: `${baseUrl}/tr${slug}`
2461
2462
  }
2462
2463
  }
2463
2464
  };
@@ -2483,7 +2484,7 @@ var init_getWhiteLabel = __esm({
2483
2484
  );
2484
2485
  const storeApp = whiteLabel ? app?.store?.apps.find(
2485
2486
  (a) => a.slug === whiteLabel?.slug && a.store?.slug === whiteLabel?.storeSlug
2486
- ) : app?.store?.apps.find((a) => a.store?.appId && a.store?.appId === app?.id);
2487
+ ) : void 0;
2487
2488
  return { storeApp, whiteLabel };
2488
2489
  };
2489
2490
  getWhiteLabel_default = getWhiteLabel;
@@ -2517,18 +2518,15 @@ function generateStoreMetadata({
2517
2518
  return {
2518
2519
  title: `${t5(storeName)} - Chrry`,
2519
2520
  description,
2520
- manifest: `${API_URL}/manifest/${store?.app?.id}`,
2521
- icons: [16, 48, 128, 180, 192, 512].reduce(
2522
- (icons, size2) => icons.concat({
2523
- src: toRelative(
2524
- getImageSrc({ app: storeApp, size: size2, BASE_URL: baseUrl }).src || "/images/pacman/space-invader.png"
2525
- ),
2526
- sizes: `${size2}x${size2}`,
2527
- type: "image/png",
2528
- purpose: "any maskable"
2529
- }),
2530
- []
2531
- ),
2521
+ manifest: `/manifest.webmanifest?appId=${store?.app?.id}`,
2522
+ icons: [16, 48, 128, 180, 192, 512].map((size2) => ({
2523
+ url: toRelative(
2524
+ getImageSrc({ app: storeApp, size: size2, BASE_URL: baseUrl }).src || "/images/pacman/space-invader.png"
2525
+ ),
2526
+ sizes: `${size2}x${size2}`,
2527
+ type: "image/png",
2528
+ purpose: "any maskable"
2529
+ })),
2532
2530
  appleWebApp: {
2533
2531
  capable: true,
2534
2532
  statusBarStyle: "default",
@@ -2576,12 +2574,78 @@ var init_generateStoreMetadata = __esm({
2576
2574
  "utils/generateStoreMetadata.ts"() {
2577
2575
  "use strict";
2578
2576
  init_t();
2579
- init_utils();
2580
2577
  init_getWhiteLabel();
2581
2578
  init_lib();
2582
2579
  }
2583
2580
  });
2584
2581
 
2582
+ // utils/generateThreadMetadata.ts
2583
+ function generateThreadMetadata({
2584
+ thread: thread2,
2585
+ locale: locale4 = "en",
2586
+ currentDomain,
2587
+ translations
2588
+ }) {
2589
+ const threadTitle = thread2.title?.substring(0, 120) || "Thread";
2590
+ const descriptions = {
2591
+ en: "Thread for Vex AI Assistant",
2592
+ de: "Thread f\xFCr den Vex KI-Assistenten",
2593
+ fr: "Thread pour l'assistant IA Vex",
2594
+ ja: "Vex AI\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306E\u30B9\u30EC\u30C3\u30C9",
2595
+ ko: "Vex AI \uC5B4\uC2DC\uC2A4\uD134\uD2B8\uC758 \uC2A4\uB808\uB4DC",
2596
+ pt: "Thread para o Assistente de IA Vex",
2597
+ es: "Thread del Asistente de IA Vex",
2598
+ zh: "Vex AI\u52A9\u624B\u7684\u7EBF\u7A0B",
2599
+ nl: "Thread voor de Vex AI-assistent",
2600
+ tr: "Vex AI Asistan\u0131 i\xE7in konu"
2601
+ };
2602
+ const title = `${threadTitle} | Vex`;
2603
+ const description = descriptions[locale4] || descriptions.en;
2604
+ const baseUrl = currentDomain;
2605
+ const canonicalUrl = `${baseUrl}/threads/${thread2.id}`;
2606
+ const t5 = (key) => {
2607
+ return t(translations)(key);
2608
+ };
2609
+ return {
2610
+ title,
2611
+ description,
2612
+ openGraph: {
2613
+ title,
2614
+ description,
2615
+ type: "article",
2616
+ url: canonicalUrl,
2617
+ locale: locale4
2618
+ },
2619
+ twitter: {
2620
+ card: "summary",
2621
+ title,
2622
+ description
2623
+ },
2624
+ alternates: {
2625
+ canonical: canonicalUrl,
2626
+ languages: {
2627
+ "x-default": canonicalUrl,
2628
+ en: canonicalUrl,
2629
+ de: `${baseUrl}/de/threads/${thread2.id}`,
2630
+ fr: `${baseUrl}/fr/threads/${thread2.id}`,
2631
+ es: `${baseUrl}/es/threads/${thread2.id}`,
2632
+ ja: `${baseUrl}/ja/threads/${thread2.id}`,
2633
+ ko: `${baseUrl}/ko/threads/${thread2.id}`,
2634
+ pt: `${baseUrl}/pt/threads/${thread2.id}`,
2635
+ zh: `${baseUrl}/zh/threads/${thread2.id}`,
2636
+ nl: `${baseUrl}/nl/threads/${thread2.id}`,
2637
+ tr: `${baseUrl}/tr/threads/${thread2.id}`
2638
+ }
2639
+ }
2640
+ };
2641
+ }
2642
+ var init_generateThreadMetadata = __esm({
2643
+ "utils/generateThreadMetadata.ts"() {
2644
+ "use strict";
2645
+ init_t();
2646
+ }
2647
+ });
2648
+
2585
2649
  // utils/fileValidation.ts
2586
2650
  function getMaxFileSize(fileType, agentModel = "sushi") {
2587
2651
  const limits = MAX_FILE_SIZES[agentModel] || MAX_FILE_SIZES.sushi;
@@ -2770,6 +2834,7 @@ var init_utils = __esm({
2770
2834
  init_getHourlyLimit();
2771
2835
  init_generateAppMetadata();
2772
2836
  init_generateStoreMetadata();
2837
+ init_generateThreadMetadata();
2773
2838
  init_fileValidation();
2774
2839
  isSameDay = (date1, date2) => {
2775
2840
  return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
@@ -2984,7 +3049,7 @@ var init_utils = __esm({
2984
3049
  };
2985
3050
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
2986
3051
  config = getSiteConfig(getClientHostname());
2987
- VERSION = config.version || "1.5.75";
3052
+ VERSION = config.version || "1.5.76";
2988
3053
  getSlugFromPathname = (path) => {
2989
3054
  return getAppAndStoreSlugs(path, {
2990
3055
  defaultAppSlug: config.slug,
@@ -24491,7 +24556,7 @@ function DataProvider({ children, ...rest }) {
24491
24556
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24492
24557
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24493
24558
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24494
- const VERSION4 = "1.5.75";
24559
+ const VERSION4 = "1.5.76";
24495
24560
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24496
24561
  const {
24497
24562
  API_URL: API_URL2,
@@ -50829,7 +50894,8 @@ function Home({
50829
50894
  }) {
50830
50895
  const { language, threadId } = useAuth();
50831
50896
  const { currentStore: store, app } = useApp();
50832
- useAppMetadata2(app, !store && !threadId);
50897
+ console.log(`\u{1F680} ~ store:`, store);
50898
+ useAppMetadata2();
50833
50899
  return /* @__PURE__ */ React.createElement(Div, { "data-url": language === defaultLocale ? "/" : `/${language}` }, /* @__PURE__ */ React.createElement(Thread_default, { isHome: true }));
50834
50900
  }
50835
50901
  var init_Home = __esm({
@@ -82180,10 +82246,11 @@ var init_providers = __esm({
82180
82246
  // hooks/useMetadata.ts
82181
82247
  function useStoreMetadata(store) {
82182
82248
  const { i18n: i18n2 } = (0, import_react_i18next9.useTranslation)();
82249
+ const { baseApp } = useAuth();
82250
+ const currentDomain = baseApp?.store?.domain || (typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "");
82183
82251
  (0, import_react116.useEffect)(() => {
82184
82252
  if (typeof document === "undefined" || !store) return;
82185
82253
  const locale4 = i18n2.language || "en";
82186
- const currentDomain = typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "";
82187
82254
  const translations = i18n2.store.data[locale4]?.translation || {};
82188
82255
  const metadata = generateStoreMetadata({
82189
82256
  store,
@@ -82232,32 +82299,26 @@ function useStoreMetadata(store) {
82232
82299
  if (metadata.alternates?.canonical) {
82233
82300
  updateOrCreateLink("canonical", String(metadata.alternates.canonical));
82234
82301
  }
82235
- }, [
82236
- store?.id,
82237
- store?.name,
82238
- store?.slug,
82239
- store?.description,
82240
- store?.app?.id,
82241
- i18n2.language
82242
- ]);
82302
+ }, [store, i18n2.language, baseApp]);
82243
82303
  }
82244
- function useAppMetadata2(app, enabled = true) {
82304
+ function useAppMetadata2() {
82245
82305
  const { i18n: i18n2 } = (0, import_react_i18next9.useTranslation)();
82246
- const { baseApp, hasStoreApps } = useAuth();
82247
- const { storeApp } = hasStoreApps(app) ? getWhiteLabel_default({ app }) : { storeApp: baseApp };
82306
+ const { currentStore } = useApp();
82307
+ const enabled = !currentStore;
82308
+ const { baseApp, app, language: locale4 } = useAuth();
82309
+ const storeApp = getWhiteLabel_default({ app }).storeApp || baseApp;
82310
+ const currentDomain = storeApp?.store?.domain || (typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "");
82311
+ const translations = i18n2.store.data[locale4]?.translation || {};
82312
+ const metadata = app ? generateAppMetadata({
82313
+ app,
82314
+ store: storeApp?.store,
82315
+ locale: locale4,
82316
+ currentDomain,
82317
+ translations,
82318
+ whiteLabel: storeApp
82319
+ }) : void 0;
82248
82320
  (0, import_react116.useEffect)(() => {
82249
- if (!enabled || typeof document === "undefined" || !storeApp) return;
82250
- const locale4 = i18n2.language || "en";
82251
- const currentDomain = storeApp?.store?.domain || (typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "");
82252
- const translations = i18n2.store.data[locale4]?.translation || {};
82253
- const metadata = generateAppMetadata({
82254
- app: storeApp,
82255
- store: storeApp?.store,
82256
- locale: locale4,
82257
- currentDomain,
82258
- translations,
82259
- whiteLabel: storeApp
82260
- });
82321
+ if (!metadata || !enabled) return;
82261
82322
  if (metadata.title) {
82262
82323
  document.title = metadata.title;
82263
82324
  }
@@ -82298,56 +82359,63 @@ function useAppMetadata2(app, enabled = true) {
82298
82359
  if (metadata.alternates?.canonical) {
82299
82360
  updateOrCreateLink("canonical", String(metadata.alternates.canonical));
82300
82361
  }
82301
- }, [
82302
- app?.id,
82303
- app?.name,
82304
- app?.slug,
82305
- app?.title,
82306
- app?.description,
82307
- app?.store?.id,
82308
- app?.store?.name,
82309
- app?.store?.slug,
82310
- i18n2.language,
82311
- enabled
82312
- ]);
82362
+ if (metadata.alternates?.languages) {
82363
+ Object.entries(metadata.alternates.languages).forEach(([lang2, url]) => {
82364
+ updateOrCreateLink("alternate", String(url), lang2);
82365
+ });
82366
+ }
82367
+ }, [metadata, enabled]);
82313
82368
  }
82314
82369
  function useThreadMetadata(thread2) {
82315
- const { i18n: i18n2, t: t5 } = (0, import_react_i18next9.useTranslation)();
82370
+ const { i18n: i18n2 } = (0, import_react_i18next9.useTranslation)();
82371
+ const { baseApp } = useAuth();
82372
+ const locale4 = i18n2.language || "en";
82373
+ const currentDomain = baseApp?.store?.domain || (typeof window !== "undefined" ? `${window.location.protocol}//${window.location.host}` : "");
82374
+ const translations = i18n2.store.data[locale4]?.translation || {};
82375
+ const metadata = thread2 ? generateThreadMetadata({
82376
+ thread: thread2,
82377
+ locale: locale4,
82378
+ currentDomain,
82379
+ translations
82380
+ }) : void 0;
82316
82381
  (0, import_react116.useEffect)(() => {
82317
- if (typeof document === "undefined" || !thread2) return;
82318
- const locale4 = i18n2.language || "en";
82319
- const threadTitle = thread2.title?.substring(0, 120) || "Thread";
82320
- const descriptions = {
82321
- en: "Thread for Vex AI Assistant",
82322
- de: "Thread f\xFCr den Vex KI-Assistenten",
82323
- fr: "Thread pour l'assistant IA Vex",
82324
- ja: "Vex AI\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u306E\u30B9\u30EC\u30C3\u30C9",
82325
- ko: "Vex AI \uC5B4\uC2DC\uC2A4\uD134\uD2B8\uC758 \uC2A4\uB808\uB4DC",
82326
- pt: "Thread para o Assistente de IA Vex",
82327
- es: "Thread del Asistente de IA Vex",
82328
- zh: "Vex AI\u52A9\u624B\u7684\u7EBF\u7A0B",
82329
- nl: "Thread voor de Vex AI-assistent",
82330
- tr: "Vex AI Asistan\u0131 i\xE7in konu"
82331
- };
82332
- const title = `${threadTitle} | Vex`;
82333
- const description = descriptions[locale4] || descriptions.en;
82334
- document.title = title;
82335
- if (description) {
82336
- updateOrCreateMeta("name", "description", description);
82337
- }
82338
- updateOrCreateMeta("property", "og:title", title);
82339
- if (description) {
82340
- updateOrCreateMeta("property", "og:description", description);
82341
- }
82342
- updateOrCreateMeta("name", "twitter:title", title);
82343
- if (description) {
82344
- updateOrCreateMeta("name", "twitter:description", description);
82345
- }
82346
- if (typeof window !== "undefined" && thread2.id) {
82347
- const currentDomain = `${window.location.protocol}//${window.location.host}`;
82348
- updateOrCreateLink("canonical", `${currentDomain}/threads/${thread2.id}`);
82349
- }
82350
- }, [thread2?.id, thread2?.title, i18n2.language]);
82382
+ if (!metadata || typeof document === "undefined") return;
82383
+ if (metadata.title) {
82384
+ document.title = metadata.title;
82385
+ }
82386
+ if (metadata.description) {
82387
+ updateOrCreateMeta("name", "description", metadata.description);
82388
+ }
82389
+ if (metadata.openGraph) {
82390
+ const og = metadata.openGraph;
82391
+ if (og.title) {
82392
+ updateOrCreateMeta("property", "og:title", String(og.title));
82393
+ }
82394
+ if (og.description) {
82395
+ updateOrCreateMeta("property", "og:description", og.description);
82396
+ }
82397
+ if (og.url) {
82398
+ updateOrCreateMeta("property", "og:url", String(og.url));
82399
+ }
82400
+ }
82401
+ if (metadata.twitter) {
82402
+ const twitter = metadata.twitter;
82403
+ if (twitter.title) {
82404
+ updateOrCreateMeta("name", "twitter:title", twitter.title);
82405
+ }
82406
+ if (twitter.description) {
82407
+ updateOrCreateMeta("name", "twitter:description", twitter.description);
82408
+ }
82409
+ }
82410
+ if (metadata.alternates?.canonical) {
82411
+ updateOrCreateLink("canonical", String(metadata.alternates.canonical));
82412
+ }
82413
+ if (metadata.alternates?.languages) {
82414
+ Object.entries(metadata.alternates.languages).forEach(([lang2, url]) => {
82415
+ updateOrCreateLink("alternate", String(url), lang2);
82416
+ });
82417
+ }
82418
+ }, [metadata]);
82351
82419
  }
82352
82420
  function updateOrCreateMeta(attributeName, attributeValue, content) {
82353
82421
  let metaTag = document.querySelector(
@@ -82360,11 +82428,18 @@ function updateOrCreateMeta(attributeName, attributeValue, content) {
82360
82428
  }
82361
82429
  metaTag.setAttribute("content", content);
82362
82430
  }
82363
- function updateOrCreateLink(rel, href) {
82364
- let linkTag = document.querySelector(`link[rel="${rel}"]`);
82431
+ function updateOrCreateLink(rel, href, hreflang) {
82432
+ let selector = `link[rel="${rel}"]`;
82433
+ if (hreflang) {
82434
+ selector += `[hreflang="${hreflang}"]`;
82435
+ }
82436
+ let linkTag = document.querySelector(selector);
82365
82437
  if (!linkTag) {
82366
82438
  linkTag = document.createElement("link");
82367
82439
  linkTag.setAttribute("rel", rel);
82440
+ if (hreflang) {
82441
+ linkTag.setAttribute("hreflang", hreflang);
82442
+ }
82368
82443
  document.head.appendChild(linkTag);
82369
82444
  }
82370
82445
  linkTag.setAttribute("href", href);
@@ -82497,6 +82572,7 @@ __export(index_exports, {
82497
82572
  formatFileSize: () => formatFileSize,
82498
82573
  generateAppMetadata: () => generateAppMetadata,
82499
82574
  generateStoreMetadata: () => generateStoreMetadata,
82575
+ generateThreadMetadata: () => generateThreadMetadata,
82500
82576
  getActions: () => getActions,
82501
82577
  getApp: () => getApp,
82502
82578
  getApps: () => getApps,
@@ -82688,6 +82764,7 @@ function HistoryRouterProvider({
82688
82764
  formatFileSize,
82689
82765
  generateAppMetadata,
82690
82766
  generateStoreMetadata,
82767
+ generateThreadMetadata,
82691
82768
  getActions,
82692
82769
  getApp,
82693
82770
  getApps,