@blocklet/pages-kit 0.2.419 → 0.2.421
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/lib/cjs/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +3 -1
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +6 -2
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +3 -1
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +1 -2
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +3 -1
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +6 -2
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +3 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +1 -2
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
|
@@ -12,5 +12,7 @@ function ErrorRender({ error }) {
|
|
|
12
12
|
}
|
|
13
13
|
export function RuntimeLocaleProvider({ children }) {
|
|
14
14
|
const { locale } = useLocaleContext();
|
|
15
|
-
return (
|
|
15
|
+
return (
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
_jsx(LocaleProvider, { translations: translations, locale: locale, fallbackLocale: "en", children: children }));
|
|
16
18
|
}
|
|
@@ -27,6 +27,7 @@ import DOMPurify from 'isomorphic-dompurify';
|
|
|
27
27
|
import { useMemo } from 'react';
|
|
28
28
|
import { getQuery, joinURL, withQuery } from 'ufo';
|
|
29
29
|
import { useLocaleContext } from '../../../../locale';
|
|
30
|
+
import { useSessionContext } from '../../../../session';
|
|
30
31
|
import { AI_RUNTIME_DID } from '../../constants';
|
|
31
32
|
import { useCurrentAgent } from '../../contexts/CurrentAgent';
|
|
32
33
|
import { useCurrentMessage } from '../../contexts/CurrentMessage';
|
|
@@ -210,13 +211,16 @@ const StyledActionButton = styled(ActionButton)(({ theme }) => theme.unstable_sx
|
|
|
210
211
|
minHeight: '0 !important',
|
|
211
212
|
}));
|
|
212
213
|
const useCurrentLink = () => {
|
|
213
|
-
var _a, _b;
|
|
214
|
+
var _a, _b, _c;
|
|
215
|
+
const { session } = useSessionContext();
|
|
214
216
|
const { message } = useCurrentMessage();
|
|
215
217
|
const prefix = (_b = (_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.componentMountPoints.find((i) => i.did === AI_RUNTIME_DID)) === null || _b === void 0 ? void 0 : _b.mountPoint;
|
|
216
218
|
if (!prefix)
|
|
217
219
|
throw new Error('No aigne runtime prefix found');
|
|
218
220
|
const link = withQuery(joinURL(window.origin, prefix, '/messages', message.id), {
|
|
219
|
-
agentUrl: getQuery(window.location.href).agentUrl || window.location.href,
|
|
221
|
+
agentUrl: withQuery(getQuery(window.location.href).agentUrl || window.location.href, {
|
|
222
|
+
inviter: (_c = session.user) === null || _c === void 0 ? void 0 : _c.did,
|
|
223
|
+
}),
|
|
220
224
|
});
|
|
221
225
|
return { link };
|
|
222
226
|
};
|
|
@@ -35,7 +35,9 @@ export default function SocialShare(props) {
|
|
|
35
35
|
// @ts-ignore
|
|
36
36
|
return _jsx(SocialShareMenu, Object.assign({}, restProps));
|
|
37
37
|
}, [type, restProps]);
|
|
38
|
-
return (
|
|
38
|
+
return (
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
_jsx(LocaleProvider, { translations: translations, locale: locale, fallbackLocale: "en", children: renderContent() }));
|
|
39
41
|
}
|
|
40
42
|
export function SocialShareMenu(_a) {
|
|
41
43
|
var { url = getFormattedUrl(window.location.href), content, children = _jsx(Icon, { icon: "tabler:share" }), MenuProps, disableCopyLink = false } = _a, restProps = __rest(_a, ["url", "content", "children", "MenuProps", "disableCopyLink"]);
|
|
@@ -24,7 +24,6 @@ import CurrentAgentProvider from '../../contexts/CurrentAgent';
|
|
|
24
24
|
import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
25
25
|
import useAppearances from '../../hooks/use-appearances';
|
|
26
26
|
import { useAutoLoadSessionState, useCurrentSessionState, useSessionState } from '../../state/session';
|
|
27
|
-
import mapRight from '../../utils/map-right';
|
|
28
27
|
export default function PhotoGallery({ resultTitle }) {
|
|
29
28
|
const { activeAgentId } = useActiveAgent();
|
|
30
29
|
useAutoLoadSessionState();
|
|
@@ -50,7 +49,7 @@ function OutputView(_a) {
|
|
|
50
49
|
return (_jsxs(Stack, Object.assign({ width: "100%", alignItems: "center", px: { xs: 2, sm: 3 }, mt: { xs: 2, sm: 3 } }, props, { children: [resultTitle && (_jsx(Typography, { width: "100%", component: "h2", fontSize: 36, fontWeight: 700, textAlign: "center", children: _jsx(Balancer, { children: resultTitle }) })), loaded && !messages.length && _jsx(NoOutputs, {}), _jsxs(Masonry, { ref: ref, columns: { xs: 2, sm: 3, md: 4, lg: 5 }, spacing: 1, sequential: true, sx: { width: '100%', overflow: 'hidden', '> *': { borderRadius: 1 } }, children: [running && (_jsx(Skeleton, { variant: "rectangular", sx: {
|
|
51
50
|
// FIXME: default using history height
|
|
52
51
|
height: (_e = (_d = (_c = ref.current) === null || _c === void 0 ? void 0 : _c.querySelector('*')) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 200,
|
|
53
|
-
} })),
|
|
52
|
+
} })), messages.map((message) => (_jsx(OutputItemView, { message: message }, message.id)))] }), _jsx(Box, { my: 4, children: !!messages.length && !noMoreMessage && (_jsx(LoadingButton, { variant: "outlined", onClick: () => loadMoreMessages(), children: t('loadMore') })) })] })));
|
|
54
53
|
}
|
|
55
54
|
const OutputItemView = memo(({ message }) => {
|
|
56
55
|
const { appearanceOutput } = useAppearances({ agentId: message.agentId });
|