@blocklet/pages-kit 0.2.313 → 0.2.315

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.
@@ -38,7 +38,7 @@ const utils_1 = require("../../../../utils");
38
38
  const RuntimeCommonProvider_1 = __importStar(require("../../components/RuntimeCommonProvider"));
39
39
  const SocialShare_1 = __importDefault(require("../../components/SocialShare"));
40
40
  const constants_1 = require("../../constants");
41
- const Runtime_1 = require("../../contexts/Runtime");
41
+ const Runtime_1 = __importStar(require("../../contexts/Runtime"));
42
42
  const use_appearances_1 = __importDefault(require("../../hooks/use-appearances"));
43
43
  const runtime_1 = require("../../state/runtime");
44
44
  const logoSize = 44;
@@ -46,8 +46,12 @@ function AgentCreatedBy({ did }) {
46
46
  const { t } = (0, locale_1.useLocaleContext)();
47
47
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [t('by'), " ", (0, jsx_runtime_1.jsx)(material_1.Box, { component: ux_1.DID, did: did, copyable: false, responsive: true })] }));
48
48
  }
49
- function Runtime() {
50
- return ((0, jsx_runtime_1.jsx)(Runtime_1.RuntimeProviderFromUrl, { children: (0, jsx_runtime_1.jsx)(RuntimeView, {}) }));
49
+ function Runtime({ aid, working }) {
50
+ const children = ((0, jsx_runtime_1.jsx)(RuntimeCommonProvider_1.default, { children: (0, jsx_runtime_1.jsx)(RuntimeView, {}) }));
51
+ if (aid) {
52
+ return ((0, jsx_runtime_1.jsx)(Runtime_1.default, { aid: aid, working: working, children: children }));
53
+ }
54
+ return (0, jsx_runtime_1.jsx)(Runtime_1.RuntimeProviderFromUrl, { children: children });
51
55
  }
52
56
  exports.default = Runtime;
53
57
  function RuntimeView() {
@@ -84,5 +88,5 @@ ${agent === null || agent === void 0 ? void 0 : agent.description}
84
88
  };
85
89
  }, [locale, isMobile, agent]);
86
90
  const componentId = (_a = appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentId) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_PAGE_COMPONENT_ID;
87
- return ((0, jsx_runtime_1.jsxs)(RuntimeCommonProvider_1.default, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_1.Helmet, { children: [agent.project.name && (0, jsx_runtime_1.jsx)("title", { children: agent.project.name }), agent.project.description && (0, jsx_runtime_1.jsx)("meta", { name: "description", content: agent.project.description })] }), (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProps })] }));
91
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_1.Helmet, { children: [agent.project.name && (0, jsx_runtime_1.jsx)("title", { children: agent.project.name }), agent.project.description && (0, jsx_runtime_1.jsx)("meta", { name: "description", content: agent.project.description })] }), (0, jsx_runtime_1.jsx)(CustomComponentRenderer_1.default, { componentId: componentId, properties: appearancePage === null || appearancePage === void 0 ? void 0 : appearancePage.componentProps })] }));
88
92
  }
@@ -16,8 +16,7 @@ const agent_1 = require("../api/agent");
16
16
  const Runtime_1 = require("../contexts/Runtime");
17
17
  const zustand_2 = require("../utils/zustand");
18
18
  const createAgentState = ({ aid, working, agent }) => {
19
- const key = working ? `${aid}-working` : aid;
20
- return (0, zustand_2.createCachedStore)(key, () => (0, zustand_1.create)()((0, immer_1.immer)((set) => ({
19
+ return (0, zustand_2.createCachedStore)(`agent-state-${aid}-${working}`, () => (0, zustand_1.create)()((0, immer_1.immer)((set) => ({
21
20
  agent,
22
21
  load: () => __awaiter(void 0, void 0, void 0, function* () {
23
22
  set((state) => {
@@ -52,7 +51,7 @@ function useAgentState({ aid, working }) {
52
51
  if (!state.agent) {
53
52
  if (state.error)
54
53
  throw state.error;
55
- const key = working ? `${aid}-working` : aid;
54
+ const key = `agent-loading-${aid}-${working}`;
56
55
  (_a = LOADING_TASKS[key]) !== null && _a !== void 0 ? _a : (LOADING_TASKS[key] = state.load());
57
56
  throw LOADING_TASKS[key];
58
57
  }
@@ -39,7 +39,7 @@ const zustand_2 = require("../utils/zustand");
39
39
  const GET_MESSAGES_LIMIT = 100;
40
40
  const GET_MESSAGES_ORDER_DIRECTION = 'desc';
41
41
  const createSessionState = ({ aid }) => {
42
- return (0, zustand_2.createCachedStore)(aid, () => (0, zustand_1.create)()((0, immer_1.immer)((set, get) => ({
42
+ return (0, zustand_2.createCachedStore)(`session-state-${aid}`, () => (0, zustand_1.create)()((0, immer_1.immer)((set, get) => ({
43
43
  reset: () => {
44
44
  set((state) => {
45
45
  state.loading = undefined;
@@ -163,7 +163,7 @@ function usePreloadComponent({ instanceId, componentId, properties, locale, dev
163
163
  previousRef.current = result;
164
164
  return result;
165
165
  }
166
- if (realLocale && instanceId) {
166
+ if (instanceId) {
167
167
  const key = [instanceId, realLocale].join('-');
168
168
  (_a = COMPONENT_LOADER_MAP[key]) !== null && _a !== void 0 ? _a : (COMPONENT_LOADER_MAP[key] = (0, exports.customComponentStates)()
169
169
  .getState()