@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.
@@ -19,5 +19,7 @@ function ErrorRender({ error }) {
19
19
  }
20
20
  function RuntimeLocaleProvider({ children }) {
21
21
  const { locale } = (0, locale_1.useLocaleContext)();
22
- return ((0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { translations: locales_1.translations, locale: locale, fallbackLocale: "en", children: children }));
22
+ return (
23
+ // @ts-ignore
24
+ (0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { translations: locales_1.translations, locale: locale, fallbackLocale: "en", children: children }));
23
25
  }
@@ -56,6 +56,7 @@ const isomorphic_dompurify_1 = __importDefault(require("isomorphic-dompurify"));
56
56
  const react_2 = require("react");
57
57
  const ufo_1 = require("ufo");
58
58
  const locale_1 = require("../../../../locale");
59
+ const session_1 = require("../../../../session");
59
60
  const constants_1 = require("../../constants");
60
61
  const CurrentAgent_1 = require("../../contexts/CurrentAgent");
61
62
  const CurrentMessage_1 = require("../../contexts/CurrentMessage");
@@ -239,13 +240,16 @@ const StyledActionButton = (0, material_1.styled)(ActionButton_1.default)(({ the
239
240
  minHeight: '0 !important',
240
241
  }));
241
242
  const useCurrentLink = () => {
242
- var _a, _b;
243
+ var _a, _b, _c;
244
+ const { session } = (0, session_1.useSessionContext)();
243
245
  const { message } = (0, CurrentMessage_1.useCurrentMessage)();
244
246
  const prefix = (_b = (_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.componentMountPoints.find((i) => i.did === constants_1.AI_RUNTIME_DID)) === null || _b === void 0 ? void 0 : _b.mountPoint;
245
247
  if (!prefix)
246
248
  throw new Error('No aigne runtime prefix found');
247
249
  const link = (0, ufo_1.withQuery)((0, ufo_1.joinURL)(window.origin, prefix, '/messages', message.id), {
248
- agentUrl: (0, ufo_1.getQuery)(window.location.href).agentUrl || window.location.href,
250
+ agentUrl: (0, ufo_1.withQuery)((0, ufo_1.getQuery)(window.location.href).agentUrl || window.location.href, {
251
+ inviter: (_c = session.user) === null || _c === void 0 ? void 0 : _c.did,
252
+ }),
249
253
  });
250
254
  return { link };
251
255
  };
@@ -43,7 +43,9 @@ function SocialShare(props) {
43
43
  // @ts-ignore
44
44
  return (0, jsx_runtime_1.jsx)(SocialShareMenu, Object.assign({}, restProps));
45
45
  }, [type, restProps]);
46
- return ((0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { translations: locales_1.translations, locale: locale, fallbackLocale: "en", children: renderContent() }));
46
+ return (
47
+ // @ts-ignore
48
+ (0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { translations: locales_1.translations, locale: locale, fallbackLocale: "en", children: renderContent() }));
47
49
  }
48
50
  function SocialShareMenu(_a) {
49
51
  var { url = getFormattedUrl(window.location.href), content, children = (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:share" }), MenuProps, disableCopyLink = false } = _a, restProps = __rest(_a, ["url", "content", "children", "MenuProps", "disableCopyLink"]);
@@ -30,7 +30,6 @@ const CurrentAgent_1 = __importDefault(require("../../contexts/CurrentAgent"));
30
30
  const CurrentMessage_1 = __importDefault(require("../../contexts/CurrentMessage"));
31
31
  const use_appearances_1 = __importDefault(require("../../hooks/use-appearances"));
32
32
  const session_1 = require("../../state/session");
33
- const map_right_1 = __importDefault(require("../../utils/map-right"));
34
33
  function PhotoGallery({ resultTitle }) {
35
34
  const { activeAgentId } = (0, ActiveAgent_1.useActiveAgent)();
36
35
  (0, session_1.useAutoLoadSessionState)();
@@ -56,7 +55,7 @@ function OutputView(_a) {
56
55
  return ((0, jsx_runtime_1.jsxs)(material_1.Stack, Object.assign({ width: "100%", alignItems: "center", px: { xs: 2, sm: 3 }, mt: { xs: 2, sm: 3 } }, props, { children: [resultTitle && ((0, jsx_runtime_1.jsx)(material_1.Typography, { width: "100%", component: "h2", fontSize: 36, fontWeight: 700, textAlign: "center", children: (0, jsx_runtime_1.jsx)(react_wrap_balancer_1.default, { children: resultTitle }) })), loaded && !messages.length && (0, jsx_runtime_1.jsx)(NoOutputs, {}), (0, jsx_runtime_1.jsxs)(lab_1.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 && ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", sx: {
57
56
  // FIXME: default using history height
58
57
  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,
59
- } })), (0, map_right_1.default)(messages, (message) => ((0, jsx_runtime_1.jsx)(OutputItemView, { message: message }, message.id)))] }), (0, jsx_runtime_1.jsx)(material_1.Box, { my: 4, children: !!messages.length && !noMoreMessage && ((0, jsx_runtime_1.jsx)(LoadingButton_1.default, { variant: "outlined", onClick: () => loadMoreMessages(), children: t('loadMore') })) })] })));
58
+ } })), messages.map((message) => ((0, jsx_runtime_1.jsx)(OutputItemView, { message: message }, message.id)))] }), (0, jsx_runtime_1.jsx)(material_1.Box, { my: 4, children: !!messages.length && !noMoreMessage && ((0, jsx_runtime_1.jsx)(LoadingButton_1.default, { variant: "outlined", onClick: () => loadMoreMessages(), children: t('loadMore') })) })] })));
60
59
  }
61
60
  const OutputItemView = (0, react_1.memo)(({ message }) => {
62
61
  const { appearanceOutput } = (0, use_appearances_1.default)({ agentId: message.agentId });