@chrryai/chrry 1.3.26 → 1.3.29
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +81 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3044,14 +3044,16 @@ function useLocalStorage(key, initialValue) {
|
|
|
3044
3044
|
const setValue = (0, import_react9.useCallback)(
|
|
3045
3045
|
(value) => {
|
|
3046
3046
|
try {
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3047
|
+
setStoredValue((prev) => {
|
|
3048
|
+
const valueToStore = value instanceof Function ? value(prev) : value;
|
|
3049
|
+
storage.setItem(key, valueToStore);
|
|
3050
|
+
return valueToStore;
|
|
3051
|
+
});
|
|
3050
3052
|
} catch (error) {
|
|
3051
3053
|
console.error(`Error saving ${key} to storage:`, error);
|
|
3052
3054
|
}
|
|
3053
3055
|
},
|
|
3054
|
-
[key
|
|
3056
|
+
[key]
|
|
3055
3057
|
);
|
|
3056
3058
|
return [storedValue, setValue];
|
|
3057
3059
|
}
|
|
@@ -20604,10 +20606,10 @@ function AuthProvider({
|
|
|
20604
20606
|
signOutContext,
|
|
20605
20607
|
error,
|
|
20606
20608
|
locale: locale4,
|
|
20607
|
-
...
|
|
20609
|
+
...props
|
|
20608
20610
|
}) {
|
|
20609
20611
|
const [wasGifted, setWasGifted] = (0, import_react12.useState)(false);
|
|
20610
|
-
const [session2, setSession] = (0, import_react12.useState)(
|
|
20612
|
+
const [session2, setSession] = (0, import_react12.useState)(props.session);
|
|
20611
20613
|
(0, import_react12.useEffect)(() => {
|
|
20612
20614
|
if (error) {
|
|
20613
20615
|
import_react_hot_toast.default.error(error);
|
|
@@ -20649,7 +20651,7 @@ function AuthProvider({
|
|
|
20649
20651
|
console.log("\u{1F4DD} Creating deviceId (no session):", deviceId);
|
|
20650
20652
|
setDeviceIdToStorage(deviceId);
|
|
20651
20653
|
}
|
|
20652
|
-
}, [session2?.deviceId, deviceId, deviceIdFromStorage
|
|
20654
|
+
}, [session2?.deviceId, deviceId, deviceIdFromStorage]);
|
|
20653
20655
|
(0, import_react12.useEffect)(() => {
|
|
20654
20656
|
if (deviceIdFromStorage && deviceIdFromStorage !== deviceId && !session2?.deviceId) {
|
|
20655
20657
|
console.log("\u{1F4DD} Updating deviceId from storage:", deviceIdFromStorage);
|
|
@@ -20663,7 +20665,7 @@ function AuthProvider({
|
|
|
20663
20665
|
if (deviceId) {
|
|
20664
20666
|
setDeviceIdCookie(deviceId);
|
|
20665
20667
|
}
|
|
20666
|
-
}, [deviceId
|
|
20668
|
+
}, [deviceId]);
|
|
20667
20669
|
const [shouldFetchSession, setShouldFetchSession] = (0, import_react12.useState)(!session2);
|
|
20668
20670
|
const [fingerprint, setFingerprint] = useLocalStorage(
|
|
20669
20671
|
"fingerprint",
|
|
@@ -20677,7 +20679,7 @@ function AuthProvider({
|
|
|
20677
20679
|
const fp = (0, import_uuid2.v4)();
|
|
20678
20680
|
setFingerprint(fp);
|
|
20679
20681
|
}
|
|
20680
|
-
}, [fingerprint
|
|
20682
|
+
}, [fingerprint]);
|
|
20681
20683
|
const [versions, setVersions] = (0, import_react12.useState)(
|
|
20682
20684
|
session2?.versions || {
|
|
20683
20685
|
webVersion: VERSION2,
|
|
@@ -20715,7 +20717,7 @@ function AuthProvider({
|
|
|
20715
20717
|
browser: browser3,
|
|
20716
20718
|
device: device2,
|
|
20717
20719
|
os: os2,
|
|
20718
|
-
props = {},
|
|
20720
|
+
props: props2 = {},
|
|
20719
20721
|
isPWA
|
|
20720
20722
|
}) {
|
|
20721
20723
|
const canAdd = isPWA !== void 0 && os2 !== void 0 && browser3 !== void 0;
|
|
@@ -20727,7 +20729,7 @@ function AuthProvider({
|
|
|
20727
20729
|
name,
|
|
20728
20730
|
url: `https://${domain}${u}`,
|
|
20729
20731
|
domain,
|
|
20730
|
-
props
|
|
20732
|
+
props: props2
|
|
20731
20733
|
})
|
|
20732
20734
|
}).catch(() => {
|
|
20733
20735
|
});
|
|
@@ -20744,7 +20746,7 @@ function AuthProvider({
|
|
|
20744
20746
|
name,
|
|
20745
20747
|
url,
|
|
20746
20748
|
domain,
|
|
20747
|
-
props = {},
|
|
20749
|
+
props: props2 = {},
|
|
20748
20750
|
device: device2,
|
|
20749
20751
|
os: os2,
|
|
20750
20752
|
browser: browser3,
|
|
@@ -20754,7 +20756,7 @@ function AuthProvider({
|
|
|
20754
20756
|
trackPlausibleEvent({
|
|
20755
20757
|
url,
|
|
20756
20758
|
name,
|
|
20757
|
-
props,
|
|
20759
|
+
props: props2,
|
|
20758
20760
|
domain,
|
|
20759
20761
|
device: device2,
|
|
20760
20762
|
os: os2,
|
|
@@ -20805,7 +20807,7 @@ function AuthProvider({
|
|
|
20805
20807
|
name,
|
|
20806
20808
|
url,
|
|
20807
20809
|
domain = "askvex.com",
|
|
20808
|
-
props = {}
|
|
20810
|
+
props: props2 = {}
|
|
20809
20811
|
}) => {
|
|
20810
20812
|
if (!user && !guest) return;
|
|
20811
20813
|
if (user?.role === "admin") return;
|
|
@@ -20818,7 +20820,7 @@ function AuthProvider({
|
|
|
20818
20820
|
browser: browser2,
|
|
20819
20821
|
isPWA: isStandalone2,
|
|
20820
20822
|
props: {
|
|
20821
|
-
...
|
|
20823
|
+
...props2,
|
|
20822
20824
|
isStandalone: isStandalone2,
|
|
20823
20825
|
os,
|
|
20824
20826
|
device,
|
|
@@ -21135,23 +21137,49 @@ function AuthProvider({
|
|
|
21135
21137
|
...item,
|
|
21136
21138
|
image: item.image || item.images?.[0]?.url
|
|
21137
21139
|
} : void 0;
|
|
21140
|
+
if (newApp2?.id !== prevApp?.id) {
|
|
21141
|
+
setTimeout(() => {
|
|
21142
|
+
newApp2?.themeColor && setColorScheme(newApp2.themeColor);
|
|
21143
|
+
newApp2?.backgroundColor && setAppTheme(newApp2.backgroundColor);
|
|
21144
|
+
}, 0);
|
|
21145
|
+
}
|
|
21138
21146
|
return newApp2;
|
|
21139
21147
|
});
|
|
21140
|
-
if (item?.id !== app?.id) {
|
|
21141
|
-
setTimeout(() => {
|
|
21142
|
-
item?.themeColor && setColorScheme(item?.themeColor);
|
|
21143
|
-
item?.backgroundColor && setAppTheme(item.backgroundColor);
|
|
21144
|
-
}, 0);
|
|
21145
|
-
}
|
|
21146
21148
|
},
|
|
21147
|
-
[setColorScheme, setAppTheme
|
|
21149
|
+
[setColorScheme, setAppTheme]
|
|
21148
21150
|
);
|
|
21151
|
+
const [thread2, setThread] = (0, import_react12.useState)(props.thread?.thread);
|
|
21149
21152
|
(0, import_react12.useEffect)(() => {
|
|
21150
21153
|
if (!baseApp || !allApps) return;
|
|
21151
|
-
|
|
21152
|
-
if (
|
|
21154
|
+
let matchedApp;
|
|
21155
|
+
if (thread2?.appId) {
|
|
21156
|
+
const threadApp = allApps.find((app2) => app2.id === thread2.appId);
|
|
21157
|
+
if (threadApp) {
|
|
21158
|
+
matchedApp = threadApp;
|
|
21159
|
+
console.log("\u{1F9F5} Using thread app:", threadApp.slug);
|
|
21160
|
+
}
|
|
21161
|
+
}
|
|
21162
|
+
if (!matchedApp) {
|
|
21163
|
+
matchedApp = findAppByPathname(pathname, allApps) || baseApp;
|
|
21164
|
+
console.log("\u{1F6E3}\uFE0F Using pathname app:", matchedApp?.slug);
|
|
21165
|
+
}
|
|
21166
|
+
console.log("\u{1F50D} App detection:", {
|
|
21167
|
+
pathname,
|
|
21168
|
+
threadId: thread2?.id,
|
|
21169
|
+
threadAppId: thread2?.appId,
|
|
21170
|
+
matchedAppSlug: matchedApp?.slug,
|
|
21171
|
+
matchedAppId: matchedApp?.id,
|
|
21172
|
+
currentAppSlug: app?.slug,
|
|
21173
|
+
currentAppId: app?.id,
|
|
21174
|
+
baseAppSlug: baseApp?.slug,
|
|
21175
|
+
willSwitch: matchedApp.id !== app?.id
|
|
21176
|
+
});
|
|
21177
|
+
if (matchedApp && matchedApp.id !== app?.id) {
|
|
21178
|
+
console.log("\u{1F504} Switching app:", app?.slug, "\u2192", matchedApp.slug);
|
|
21153
21179
|
setApp(matchedApp);
|
|
21154
21180
|
setStore(matchedApp.store);
|
|
21181
|
+
}
|
|
21182
|
+
if (matchedApp) {
|
|
21155
21183
|
let currentStoreApps = [];
|
|
21156
21184
|
if (matchedApp?.store?.apps && matchedApp.store.apps.length > 0) {
|
|
21157
21185
|
currentStoreApps = matchedApp.store.apps;
|
|
@@ -21179,7 +21207,7 @@ function AuthProvider({
|
|
|
21179
21207
|
setApps(finalApps);
|
|
21180
21208
|
setSlug(getAppSlug(matchedApp) || "");
|
|
21181
21209
|
}
|
|
21182
|
-
}, [allApps, pathname, baseApp,
|
|
21210
|
+
}, [allApps, pathname, baseApp, app?.id, thread2?.appId]);
|
|
21183
21211
|
const [profile, setProfileInternal] = (0, import_react12.useState)(void 0);
|
|
21184
21212
|
const setProfile = (profile2) => {
|
|
21185
21213
|
setProfileInternal(profile2);
|
|
@@ -21394,6 +21422,8 @@ function AuthProvider({
|
|
|
21394
21422
|
isLoading,
|
|
21395
21423
|
setIsLoading,
|
|
21396
21424
|
signOut,
|
|
21425
|
+
thread: thread2,
|
|
21426
|
+
setThread,
|
|
21397
21427
|
isExtensionRedirect,
|
|
21398
21428
|
signInContext,
|
|
21399
21429
|
signOutContext,
|
|
@@ -21525,7 +21555,7 @@ function DataProvider({
|
|
|
21525
21555
|
const [instructions, setInstructions] = (0, import_react14.useState)([]);
|
|
21526
21556
|
const [affiliateStats, setAffiliateStats] = (0, import_react14.useState)(null);
|
|
21527
21557
|
const [loadingAffiliateStats, setLoadingAffiliateStats] = (0, import_react14.useState)(false);
|
|
21528
|
-
const VERSION3 = "1.3.
|
|
21558
|
+
const VERSION3 = "1.3.29";
|
|
21529
21559
|
const [weather, setWeather] = useLocalStorage("weather", user?.weather || guest?.weather || void 0);
|
|
21530
21560
|
const {
|
|
21531
21561
|
API_URL: API_URL2,
|
|
@@ -21982,9 +22012,9 @@ function ThemeProvider({
|
|
|
21982
22012
|
"colorScheme",
|
|
21983
22013
|
session2?.app?.themeColor || "orange"
|
|
21984
22014
|
);
|
|
21985
|
-
const setColorScheme = (
|
|
21986
|
-
if (
|
|
21987
|
-
setColorSchemeInternal(
|
|
22015
|
+
const setColorScheme = (scheme) => {
|
|
22016
|
+
if (scheme && Object.keys(COLORS).includes(scheme)) {
|
|
22017
|
+
scheme !== colorScheme && setColorSchemeInternal(scheme);
|
|
21988
22018
|
}
|
|
21989
22019
|
};
|
|
21990
22020
|
const getInitialTheme = () => {
|
|
@@ -22622,7 +22652,7 @@ var init_utils = __esm({
|
|
|
22622
22652
|
window.history.replaceState({}, "", newUrl);
|
|
22623
22653
|
};
|
|
22624
22654
|
isFirefox = typeof navigator !== "undefined" && navigator?.userAgent.includes("Firefox");
|
|
22625
|
-
VERSION = "1.3.
|
|
22655
|
+
VERSION = "1.3.29";
|
|
22626
22656
|
getSlugFromPathname = (path) => {
|
|
22627
22657
|
const siteConfig = getSiteConfig();
|
|
22628
22658
|
return getAppAndStoreSlugs(path, {
|
|
@@ -23478,9 +23508,6 @@ function AppProvider({
|
|
|
23478
23508
|
]
|
|
23479
23509
|
);
|
|
23480
23510
|
const [instructions, setInstructions] = (0, import_react21.useState)(i);
|
|
23481
|
-
(0, import_react21.useEffect)(() => {
|
|
23482
|
-
setInstructions(i);
|
|
23483
|
-
}, [i]);
|
|
23484
23511
|
const siteConfig = getSiteConfig();
|
|
23485
23512
|
const suggestSaveApp = !!(appFormWatcher.systemPrompt && appFormWatcher.canSubmit);
|
|
23486
23513
|
const canEditApp = isAppOwner && !!appFormWatcher?.id && (step === "update" || step === "restore");
|
|
@@ -24010,9 +24037,15 @@ var init_useWebSocket = __esm({
|
|
|
24010
24037
|
if (!wsManager) return;
|
|
24011
24038
|
const checkConnection = setInterval(() => {
|
|
24012
24039
|
const currentState = wsManager.getConnectionState();
|
|
24040
|
+
const isCurrentlyConnected = wsManager.isConnected();
|
|
24013
24041
|
if (currentState !== connectionStateRef.current) {
|
|
24014
24042
|
connectionStateRef.current = currentState;
|
|
24015
|
-
setConnected(
|
|
24043
|
+
setConnected((prev) => {
|
|
24044
|
+
if (prev !== isCurrentlyConnected) {
|
|
24045
|
+
return isCurrentlyConnected;
|
|
24046
|
+
}
|
|
24047
|
+
return prev;
|
|
24048
|
+
});
|
|
24016
24049
|
}
|
|
24017
24050
|
}, 3e3);
|
|
24018
24051
|
return () => clearInterval(checkConnection);
|
|
@@ -24089,12 +24122,13 @@ function ChatProvider({
|
|
|
24089
24122
|
user,
|
|
24090
24123
|
guest,
|
|
24091
24124
|
session: session2,
|
|
24125
|
+
thread: thread2,
|
|
24126
|
+
setThread,
|
|
24092
24127
|
...auth
|
|
24093
24128
|
} = useAuth();
|
|
24094
24129
|
const [isChatFloating, setIsChatFloating] = (0, import_react24.useState)(false);
|
|
24095
24130
|
const [input, setInput] = (0, import_react24.useState)("");
|
|
24096
24131
|
const [isEmpty, setIsEmpty] = (0, import_react24.useState)(true);
|
|
24097
|
-
const [thread2, setThread] = (0, import_react24.useState)(props.thread?.thread);
|
|
24098
24132
|
const [messages, setMessages] = (0, import_react24.useState)(props.thread?.messages.messages || []);
|
|
24099
24133
|
(0, import_react24.useEffect)(() => {
|
|
24100
24134
|
if (messages.length > 0) {
|
|
@@ -24462,14 +24496,6 @@ function ChatProvider({
|
|
|
24462
24496
|
}
|
|
24463
24497
|
}
|
|
24464
24498
|
}, [appStatus?.part, guest, user]);
|
|
24465
|
-
(0, import_react24.useEffect)(() => {
|
|
24466
|
-
if (thread2) {
|
|
24467
|
-
const threadApp = allApps.find((app2) => app2.id === thread2.appId);
|
|
24468
|
-
if (threadApp && app?.id !== threadApp?.id) {
|
|
24469
|
-
setApp(threadApp);
|
|
24470
|
-
}
|
|
24471
|
-
}
|
|
24472
|
-
}, [thread2, allApps, app]);
|
|
24473
24499
|
(0, import_react24.useEffect)(() => {
|
|
24474
24500
|
if (threadId) {
|
|
24475
24501
|
thread2?.placeHolder ? setPlaceHolder(thread2?.placeHolder) : setPlaceHolder(void 0);
|
|
@@ -24631,9 +24657,7 @@ function ChatProvider({
|
|
|
24631
24657
|
}, [
|
|
24632
24658
|
hitHourlyLimit,
|
|
24633
24659
|
user?.lastMessage?.createdOn,
|
|
24634
|
-
guest?.lastMessage?.createdOn
|
|
24635
|
-
user,
|
|
24636
|
-
guest
|
|
24660
|
+
guest?.lastMessage?.createdOn
|
|
24637
24661
|
]);
|
|
24638
24662
|
(0, import_react24.useEffect)(() => {
|
|
24639
24663
|
debateAgent && !user && guest && setDebateAgent(null);
|
|
@@ -24717,7 +24741,7 @@ function ChatProvider({
|
|
|
24717
24741
|
isLoading,
|
|
24718
24742
|
refetchThread: async () => {
|
|
24719
24743
|
setShouldFetchThread(true);
|
|
24720
|
-
mutate();
|
|
24744
|
+
shouldFetchThread && await mutate();
|
|
24721
24745
|
},
|
|
24722
24746
|
setIsWebSearchEnabled,
|
|
24723
24747
|
input,
|
|
@@ -24785,7 +24809,7 @@ function ChatProvider({
|
|
|
24785
24809
|
setIsVisitor,
|
|
24786
24810
|
refetchThreads: async () => {
|
|
24787
24811
|
setShouldFetchThreads(true);
|
|
24788
|
-
await refetchThreads();
|
|
24812
|
+
shouldFetchThreads && await refetchThreads();
|
|
24789
24813
|
},
|
|
24790
24814
|
userNameByUrl
|
|
24791
24815
|
}
|
|
@@ -26758,6 +26782,7 @@ function AppProviders({
|
|
|
26758
26782
|
/* @__PURE__ */ import_react30.default.createElement(ErrorProvider, null, /* @__PURE__ */ import_react30.default.createElement(ThemeProvider, { session: session2 }, /* @__PURE__ */ import_react30.default.createElement(
|
|
26759
26783
|
AuthProvider,
|
|
26760
26784
|
{
|
|
26785
|
+
thread: thread2,
|
|
26761
26786
|
locale: locale4,
|
|
26762
26787
|
error,
|
|
26763
26788
|
apiKey,
|
|
@@ -27136,12 +27161,6 @@ function Img({
|
|
|
27136
27161
|
setIsLoading(false);
|
|
27137
27162
|
}
|
|
27138
27163
|
};
|
|
27139
|
-
(0, import_react33.useEffect)(() => {
|
|
27140
|
-
if (src) {
|
|
27141
|
-
setImageSrc(null);
|
|
27142
|
-
setError(null);
|
|
27143
|
-
}
|
|
27144
|
-
}, [src]);
|
|
27145
27164
|
(0, import_react33.useEffect)(() => {
|
|
27146
27165
|
if (inView2 && !imageSrc && !error) {
|
|
27147
27166
|
loadImage(src);
|
|
@@ -33179,18 +33198,6 @@ Return ONLY ONE WORD: ${apps.map((a) => a.name).join(", ")}, or "none"`;
|
|
|
33179
33198
|
}
|
|
33180
33199
|
};
|
|
33181
33200
|
const setInput = (value) => {
|
|
33182
|
-
if (!app || empty) {
|
|
33183
|
-
!app && !appStatus?.part && !thread2?.appId && getPossibleApp(value).then((detectedApp) => {
|
|
33184
|
-
console.log(`\u{1F680} Detected app:`, detectedApp);
|
|
33185
|
-
if (detectedApp) {
|
|
33186
|
-
console.log(
|
|
33187
|
-
`\u2728 Auto-switching to ${detectedApp.name} (first message)`
|
|
33188
|
-
);
|
|
33189
|
-
setApp(detectedApp);
|
|
33190
|
-
!threadId && windowHistory.router.push(`/${detectedApp.name.toLowerCase()}`);
|
|
33191
|
-
}
|
|
33192
|
-
});
|
|
33193
|
-
}
|
|
33194
33201
|
inputRef.current = value;
|
|
33195
33202
|
setInputInternal(value);
|
|
33196
33203
|
};
|
|
@@ -39651,7 +39658,7 @@ function Store({
|
|
|
39651
39658
|
if (selectedApp && app?.id !== selectedApp.id) {
|
|
39652
39659
|
setApp(selectedApp);
|
|
39653
39660
|
}
|
|
39654
|
-
}, [selectedApp, app?.id
|
|
39661
|
+
}, [selectedApp, app?.id]);
|
|
39655
39662
|
const setSelectedApp = (app2) => {
|
|
39656
39663
|
if (!app2?.store?.slug) return;
|
|
39657
39664
|
if (!app2?.slug) return;
|
|
@@ -42300,12 +42307,15 @@ var init_Thread = __esm({
|
|
|
42300
42307
|
(0, import_react78.useEffect)(() => {
|
|
42301
42308
|
const lastMessage = messages[messages.length - 1];
|
|
42302
42309
|
if (lastMessage?.message.agentId && !autoSelectedAgent && !debateAgent) {
|
|
42303
|
-
|
|
42304
|
-
|
|
42310
|
+
const agent = aiAgents?.find(
|
|
42311
|
+
(agent2) => agent2.id === lastMessage?.message.agentId
|
|
42305
42312
|
);
|
|
42306
|
-
|
|
42313
|
+
if (agent) {
|
|
42314
|
+
setSelectedAgent(agent);
|
|
42315
|
+
setAutoSelectedAgent(true);
|
|
42316
|
+
}
|
|
42307
42317
|
}
|
|
42308
|
-
}, [messages, autoSelectedAgent,
|
|
42318
|
+
}, [messages, autoSelectedAgent, debateAgent]);
|
|
42309
42319
|
const hasHydrated = useHasHydrated();
|
|
42310
42320
|
const nameIsRequired = `\u{1F44B} ${t6("Name your app......")}`;
|
|
42311
42321
|
const titleIsRequired = `\u270D\uFE0F ${t6("Give it a title...")}`;
|