@chrryai/chrry 1.6.69 → 1.6.70

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
@@ -825,6 +825,21 @@ declare function validateFile(file: File, capabilities?: AgentCapabilities, agen
825
825
  */
826
826
  declare function formatFileSize(bytes: number): string;
827
827
 
828
+ /**
829
+ * Get the appropriate API URL based on execution context
830
+ * - Client-side (browser/extension): Use public URL through Cloudflare
831
+ * - Server-side (SSR/API): Use internal localhost URL to avoid round-trip
832
+ */
833
+ declare function getApiUrl(options?: {
834
+ forcePublic?: boolean;
835
+ }): string;
836
+ /**
837
+ * Get the full API URL for a specific endpoint
838
+ */
839
+ declare function getApiEndpoint(path: string, options?: {
840
+ forcePublic?: boolean;
841
+ }): string;
842
+
828
843
  type BrowserAPIType = typeof chrome | typeof browser;
829
844
 
830
845
  declare const isSameDay: (date1: Date, date2: Date) => boolean;
@@ -1898,4 +1913,4 @@ interface HistoryRouterProviderProps {
1898
1913
  */
1899
1914
  declare function HistoryRouterProvider({ children, }: HistoryRouterProviderProps): React.ReactElement;
1900
1915
 
1901
- export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, Chrry, 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_SERVER_URL, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, Chrry as default, 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 };
1916
+ export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, Chrry, 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_SERVER_URL, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, Chrry as default, deleteApp, deleteCalendarEvent, deleteMemories, deleteMessage, deleteSubscription, exampleInstructions, expenseCategory, type expenseCategoryType, exportToGoogleCalendar, extensionSuggestions, formatFileSize, generateAppMetadata, generateStoreMetadata, generateThreadMetadata, getActions, getApiEndpoint, getApiUrl, 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
@@ -825,6 +825,21 @@ declare function validateFile(file: File, capabilities?: AgentCapabilities, agen
825
825
  */
826
826
  declare function formatFileSize(bytes: number): string;
827
827
 
828
+ /**
829
+ * Get the appropriate API URL based on execution context
830
+ * - Client-side (browser/extension): Use public URL through Cloudflare
831
+ * - Server-side (SSR/API): Use internal localhost URL to avoid round-trip
832
+ */
833
+ declare function getApiUrl(options?: {
834
+ forcePublic?: boolean;
835
+ }): string;
836
+ /**
837
+ * Get the full API URL for a specific endpoint
838
+ */
839
+ declare function getApiEndpoint(path: string, options?: {
840
+ forcePublic?: boolean;
841
+ }): string;
842
+
828
843
  type BrowserAPIType = typeof chrome | typeof browser;
829
844
 
830
845
  declare const isSameDay: (date1: Date, date2: Date) => boolean;
@@ -1898,4 +1913,4 @@ interface HistoryRouterProviderProps {
1898
1913
  */
1899
1914
  declare function HistoryRouterProvider({ children, }: HistoryRouterProviderProps): React.ReactElement;
1900
1915
 
1901
- export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, Chrry, 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_SERVER_URL, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, Chrry as default, 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 };
1916
+ export { ADDITIONAL_CREDITS, API_URL, type AgentCapabilities, type AgentModel, type AiAgent, type AiAgentCapabilities, type ApiActions, BrowserInstance, CHRRY_URL, CREDITS_PRICE, type CalendarEventFormData, Chrry, 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_SERVER_URL, WS_URL, addParam, aiAgentCapabilitiesSchema, aiAgentSchema, apiFetch, type appFormData, appSchema, budgetCategory, capitalizeFirstLetter, checkIsExtension, checkThreadSummaryLimit, createApp, createCalendarEvent, createCustomAiAgentSchema, Chrry as default, deleteApp, deleteCalendarEvent, deleteMemories, deleteMessage, deleteSubscription, exampleInstructions, expenseCategory, type expenseCategoryType, exportToGoogleCalendar, extensionSuggestions, formatFileSize, generateAppMetadata, generateStoreMetadata, generateThreadMetadata, getActions, getApiEndpoint, getApiUrl, 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
@@ -2839,6 +2839,28 @@ var init_fileValidation = __esm({
2839
2839
  }
2840
2840
  });
2841
2841
 
2842
+ // utils/getApiUrl.ts
2843
+ function getApiUrl(options) {
2844
+ const isServer = typeof window === "undefined";
2845
+ if (options?.forcePublic) {
2846
+ return process.env.NEXT_PUBLIC_API_URL || process.env.API_URL || "https://chrry.dev/api";
2847
+ }
2848
+ if (isServer) {
2849
+ return process.env.INTERNAL_API_URL || process.env.API_URL || "http://localhost:3001/api";
2850
+ }
2851
+ return process.env.NEXT_PUBLIC_API_URL || "https://chrry.dev/api";
2852
+ }
2853
+ function getApiEndpoint(path, options) {
2854
+ const baseUrl = getApiUrl(options);
2855
+ const cleanPath = path.startsWith("/") ? path.slice(1) : path;
2856
+ return `${baseUrl}/${cleanPath}`;
2857
+ }
2858
+ var init_getApiUrl = __esm({
2859
+ "utils/getApiUrl.ts"() {
2860
+ "use strict";
2861
+ }
2862
+ });
2863
+
2842
2864
  // utils/index.ts
2843
2865
  function isValidUuidV4(uuid) {
2844
2866
  return /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
@@ -2915,6 +2937,7 @@ var init_utils = __esm({
2915
2937
  init_generateStoreMetadata();
2916
2938
  init_generateThreadMetadata();
2917
2939
  init_fileValidation();
2940
+ init_getApiUrl();
2918
2941
  isSameDay = (date1, date2) => {
2919
2942
  return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
2920
2943
  };
@@ -3129,7 +3152,7 @@ var init_utils = __esm({
3129
3152
  };
3130
3153
  isFirefox = typeof navigator !== "undefined" && navigator?.userAgent?.includes("Firefox");
3131
3154
  config = getSiteConfig(getClientHostname());
3132
- VERSION = config.version || "1.6.69";
3155
+ VERSION = config.version || "1.6.70";
3133
3156
  getSlugFromPathname = (path) => {
3134
3157
  return getAppAndStoreSlugs(path, {
3135
3158
  defaultAppSlug: config.slug,
@@ -24675,7 +24698,7 @@ function DataProvider({ children, ...rest }) {
24675
24698
  const [instructions, setInstructions] = (0, import_react21.useState)([]);
24676
24699
  const [affiliateStats, setAffiliateStats] = (0, import_react21.useState)(null);
24677
24700
  const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react21.useState)(false);
24678
- const VERSION4 = "1.6.69";
24701
+ const VERSION4 = "1.6.70";
24679
24702
  const [weather, setWeather] = useLocalStorage2("weather", user?.weather || guest?.weather || void 0);
24680
24703
  const {
24681
24704
  API_URL: API_URL2,
@@ -42846,14 +42869,14 @@ function SignIn({
42846
42869
  isCallbackUrlURI = false;
42847
42870
  }
42848
42871
  }
42849
- const baseUrl = isDevelopment ? FRONTEND_URL3 : "https://chrry.ai";
42872
+ const siteConfig = getSiteConfig(CHRRY_URL);
42873
+ const baseUrl = isDevelopment ? FRONTEND_URL3 : siteConfig.url;
42874
+ console.log(`\u{1F680} ~ getCallbacks ~ isDevelopment:`, isDevelopment);
42850
42875
  const errorUrl = new URL(baseUrl + "/?signIn=login&error");
42851
42876
  const successUrl = new URL(
42852
42877
  callbackUrl ? isCallbackUrlURI ? callbackUrl : baseUrl + callbackUrl : baseUrl
42853
42878
  );
42854
- if (!isDevelopment && CHRRY_URL !== "https://chrry.ai") {
42855
- successUrl.searchParams.set("chrryUrl", encodeURIComponent(CHRRY_URL));
42856
- }
42879
+ console.log(`\u{1F680} ~ getCallbacks ~ successUrl:`, successUrl);
42857
42880
  isExtensionRedirect && successUrl.searchParams.set("extension", "true");
42858
42881
  return {
42859
42882
  successUrl,
@@ -43200,6 +43223,7 @@ var init_SignIn_web = __esm({
43200
43223
  init_icons();
43201
43224
  init_utils();
43202
43225
  import_fa3 = require("react-icons/fa");
43226
+ init_siteConfig();
43203
43227
  init_utils();
43204
43228
  import_react_hot_toast12 = __toESM(require("react-hot-toast"));
43205
43229
  init_Account();
@@ -66659,6 +66683,8 @@ __export(index_exports, {
66659
66683
  generateStoreMetadata: () => generateStoreMetadata,
66660
66684
  generateThreadMetadata: () => generateThreadMetadata,
66661
66685
  getActions: () => getActions,
66686
+ getApiEndpoint: () => getApiEndpoint,
66687
+ getApiUrl: () => getApiUrl,
66662
66688
  getApp: () => getApp,
66663
66689
  getApps: () => getApps,
66664
66690
  getBrowserAPI: () => getBrowserAPI,
@@ -66895,6 +66921,8 @@ function HistoryRouterProvider({
66895
66921
  generateStoreMetadata,
66896
66922
  generateThreadMetadata,
66897
66923
  getActions,
66924
+ getApiEndpoint,
66925
+ getApiUrl,
66898
66926
  getApp,
66899
66927
  getApps,
66900
66928
  getBrowserAPI,