@blocklet/pages-kit 0.2.353 → 0.2.355

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.
Files changed (115) hide show
  1. package/lib/cjs/api/call.js +1 -2
  2. package/lib/cjs/api/pages-kit.js +1 -2
  3. package/lib/cjs/builtin/async/ai-runtime/api/agent.js +1 -2
  4. package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +11 -12
  5. package/lib/cjs/builtin/async/ai-runtime/api/message.js +2 -3
  6. package/lib/cjs/builtin/async/ai-runtime/api/request.js +2 -2
  7. package/lib/cjs/builtin/async/ai-runtime/api/secret.js +1 -2
  8. package/lib/cjs/builtin/async/ai-runtime/api/session.js +7 -8
  9. package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +1 -1
  10. package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +6 -4
  11. package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/index.js +1 -1
  12. package/lib/cjs/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +1 -1
  13. package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/index.js +1 -1
  14. package/lib/cjs/builtin/async/ai-runtime/components/Header/SimpleHeader.js +1 -1
  15. package/lib/cjs/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +1 -1
  16. package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +1 -1
  17. package/lib/cjs/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +1 -1
  18. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +3 -3
  19. package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/index.js +3 -3
  20. package/lib/cjs/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +2 -3
  21. package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +1 -1
  22. package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +1 -1
  23. package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +3 -4
  24. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +1 -1
  25. package/lib/cjs/builtin/async/ai-runtime/components/UserInfo.js +3 -4
  26. package/lib/cjs/builtin/async/ai-runtime/constants.js +2 -2
  27. package/lib/cjs/builtin/async/ai-runtime/contexts/ActiveAgent.js +2 -3
  28. package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +2 -3
  29. package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentAgent.js +2 -3
  30. package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentMessage.js +2 -3
  31. package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +3 -4
  32. package/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +1 -2
  33. package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +4 -5
  34. package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +1 -2
  35. package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +1 -1
  36. package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +1 -1
  37. package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +1 -1
  38. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +1 -1
  39. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +1 -2
  40. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +1 -1
  41. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +2 -3
  42. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +1 -1
  43. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +1 -1
  44. package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +1 -1
  45. package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +1 -1
  46. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +1 -1
  47. package/lib/cjs/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +1 -1
  48. package/lib/cjs/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +1 -1
  49. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +1 -1
  50. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +1 -1
  51. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +1 -1
  52. package/lib/cjs/builtin/async/ai-runtime/runtime-components/ShareView/index.js +1 -1
  53. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +1 -1
  54. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +1 -1
  55. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +1 -2
  56. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +1 -1
  57. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +1 -1
  58. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +1 -1
  59. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +1 -1
  60. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +1 -1
  61. package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +1 -1
  62. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +1 -1
  63. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +3 -3
  64. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +1 -1
  65. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +4 -4
  66. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +2 -3
  67. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +1 -1
  68. package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +2 -3
  69. package/lib/cjs/builtin/async/ai-runtime/state/agent.js +1 -2
  70. package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +1 -2
  71. package/lib/cjs/builtin/async/ai-runtime/state/session.js +21 -21
  72. package/lib/cjs/builtin/async/ai-runtime/utils/agent-inputs.js +2 -2
  73. package/lib/cjs/builtin/async/ai-runtime/utils/download-image.js +2 -3
  74. package/lib/cjs/builtin/async/ai-runtime/utils/map-right.js +1 -1
  75. package/lib/cjs/builtin/async/ai-runtime/utils/runtime-output-schema.js +1 -2
  76. package/lib/cjs/builtin/async/ai-runtime/utils/zustand.js +1 -2
  77. package/lib/cjs/builtin/call.js +1 -2
  78. package/lib/cjs/builtin/iconify/react.js +1 -2
  79. package/lib/cjs/builtin/page/header.js +2 -2
  80. package/lib/cjs/builtin/session.js +1 -2
  81. package/lib/cjs/builtin/utils.js +2 -2
  82. package/lib/cjs/components/CustomComponentRenderer/BlockletReactComponentRenderer.js +1 -1
  83. package/lib/cjs/components/CustomComponentRenderer/DevProvider.js +2 -3
  84. package/lib/cjs/components/CustomComponentRenderer/index.js +1 -1
  85. package/lib/cjs/components/CustomComponentRenderer/state.js +3 -3
  86. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  87. package/lib/cjs/utils/preload.js +1 -2
  88. package/lib/cjs/utils/property.js +5 -5
  89. package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +4 -1
  90. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +2 -2
  91. package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/index.js +2 -2
  92. package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +2 -2
  93. package/lib/esm/builtin/async/ai-runtime/state/session.js +17 -17
  94. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  95. package/lib/types/builtin/async/ai-runtime/api/request.d.ts +1 -1
  96. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/LanguageField.d.ts +2 -3
  97. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/NumberField.d.ts +2 -3
  98. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/RadioField.d.ts +2 -3
  99. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/SelectField.d.ts +2 -3
  100. package/lib/types/builtin/async/ai-runtime/components/AgentInputField/StringField.d.ts +2 -3
  101. package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +0 -1
  102. package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +7 -7
  103. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.d.ts +0 -1
  104. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.d.ts +0 -1
  105. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.d.ts +0 -1
  106. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.d.ts +0 -1
  107. package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.d.ts +0 -1
  108. package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +4 -4
  109. package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +22 -23
  110. package/lib/types/builtin/async/react-syntax-highlighter.d.ts +0 -1
  111. package/lib/types/builtin/call.d.ts +0 -1
  112. package/lib/types/tsconfig.tsbuildinfo +1 -1
  113. package/lib/types/utils/typescript/builtin-module-transformer.d.ts +1 -1
  114. package/lib/types/utils/typescript/imports-removal-transformer.d.ts +1 -1
  115. package/package.json +6 -6
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = V0Output;
15
16
  const jsx_runtime_1 = require("react/jsx-runtime");
16
17
  const Toast_1 = __importDefault(require("@arcblock/ux/lib/Toast"));
17
18
  const react_1 = require("@iconify/react");
@@ -114,8 +115,8 @@ function V0Output() {
114
115
  disabled,
115
116
  sx: Object.assign({}, responsiveSx),
116
117
  onClick: (e) => __awaiter(this, void 0, void 0, function* () {
117
- var _c;
118
- const { taskid: taskId } = ((_c = e === null || e === void 0 ? void 0 : e.currentTarget) === null || _c === void 0 ? void 0 : _c.dataset) || {};
118
+ var _a;
119
+ const { taskid: taskId } = ((_a = e === null || e === void 0 ? void 0 : e.currentTarget) === null || _a === void 0 ? void 0 : _a.dataset) || {};
119
120
  const currentCode = (0, CodePreview_1.getCurrentCodeByTaskId)(message);
120
121
  try {
121
122
  yield (0, CustomComponentRenderer_1.transpileAndLoadScript)(currentCode).then((m) => {
@@ -249,4 +250,3 @@ function V0Output() {
249
250
  fontSize: 22,
250
251
  }, children: (0, jsx_runtime_1.jsx)(react_1.Icon, { icon: "tabler:x" }) })] }), (0, jsx_runtime_1.jsx)(material_1.Alert, { severity: "info", sx: { mb: 2 }, children: t('v0.codePreviewTip') }), (0, jsx_runtime_1.jsx)(MarkdownRenderer_1.default, { children: `\`\`\`typescript\n${code}\n\`\`\`` })] }) }), (0, jsx_runtime_1.jsx)(PropertiesSetting_1.default, { ref: propertiesSettingRef })] })] }));
251
252
  }
252
- exports.default = V0Output;
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = Page;
15
16
  const jsx_runtime_1 = require("react/jsx-runtime");
16
17
  const Empty_1 = __importDefault(require("@arcblock/ux/lib/Empty"));
17
18
  const RelativeTime_1 = __importDefault(require("@arcblock/ux/lib/RelativeTime"));
@@ -84,7 +85,6 @@ function V0Page({ textColor = '#333', primaryColor = '#333' }) {
84
85
  function Page() {
85
86
  return ((0, jsx_runtime_1.jsx)(V0Runtime_1.V0RuntimeProvider, { children: (0, jsx_runtime_1.jsx)(V0Page, {}) }));
86
87
  }
87
- exports.default = Page;
88
88
  function V0ListRender() {
89
89
  var _a, _b;
90
90
  const ConfirmDialogRef = (0, react_2.useRef)();
@@ -23,7 +23,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getCurrentCodeByTaskId = exports.CodeRenderByMessageMemo = exports.CodeRenderByMessage = exports.CodePreviewMemo = void 0;
26
+ exports.CodeRenderByMessageMemo = exports.CodePreviewMemo = void 0;
27
+ exports.default = CodePreview;
28
+ exports.CodeRenderByMessage = CodeRenderByMessage;
29
+ exports.getCurrentCodeByTaskId = getCurrentCodeByTaskId;
27
30
  const jsx_runtime_1 = require("react/jsx-runtime");
28
31
  const react_1 = require("@iconify/react");
29
32
  const material_1 = require("@mui/material");
@@ -108,7 +111,6 @@ function CodePreview(_a) {
108
111
  },
109
112
  } }) }), componentId));
110
113
  }
111
- exports.default = CodePreview;
112
114
  exports.CodePreviewMemo = (0, react_2.memo)(CodePreview);
113
115
  function CodeRenderByMessage({ zoom, message, minHeight = 200, sx, propertiesValueMap, }) {
114
116
  var _a;
@@ -146,10 +148,8 @@ function CodeRenderByMessage({ zoom, message, minHeight = 200, sx, propertiesVal
146
148
  // p: 2,
147
149
  } }), children: (0, jsx_runtime_1.jsx)(ContentRender, {}) }, message === null || message === void 0 ? void 0 : message.id));
148
150
  }
149
- exports.CodeRenderByMessage = CodeRenderByMessage;
150
151
  exports.CodeRenderByMessageMemo = (0, react_2.memo)(CodeRenderByMessage);
151
152
  function getCurrentCodeByTaskId(message) {
152
153
  var _a, _b, _c;
153
154
  return (_c = (_b = (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c[codeField];
154
155
  }
155
- exports.getCurrentCodeByTaskId = getCurrentCodeByTaskId;
@@ -14,7 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.AIRunningLoading = void 0;
17
+ exports.default = Loading;
18
+ exports.AIRunningLoading = AIRunningLoading;
18
19
  const jsx_runtime_1 = require("react/jsx-runtime");
19
20
  const Spinner_1 = __importDefault(require("@arcblock/ux/lib/Spinner"));
20
21
  const material_1 = require("@mui/material");
@@ -22,7 +23,6 @@ function Loading(props) {
22
23
  const { sx } = props, restProps = __rest(props, ["sx"]);
23
24
  return ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: Object.assign({ flex: 1, display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'fixed', top: 0, left: 0, width: '100vw', height: '100vh', backgroundColor: 'rgba(255, 255, 255, 0.8)' }, sx) }, restProps, { children: (0, jsx_runtime_1.jsx)(Spinner_1.default, {}) })));
24
25
  }
25
- exports.default = Loading;
26
26
  function AIRunningLoading(props) {
27
27
  const { sx } = props, restProps = __rest(props, ["sx"]);
28
28
  const animationTimeList = [
@@ -151,4 +151,3 @@ function AIRunningLoading(props) {
151
151
  height, animationIterationCount: isLast ? 'infinite' : 1, animationFillMode: isLast ? 'forwards' : 'none' }, sx) }, restSkeletonProps)) }, index));
152
152
  }) })));
153
153
  }
154
- exports.AIRunningLoading = AIRunningLoading;
@@ -23,6 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.default = UserQuestion;
26
27
  const jsx_runtime_1 = require("react/jsx-runtime");
27
28
  const ClickToCopy_1 = __importStar(require("@arcblock/ux/lib/ClickToCopy"));
28
29
  const material_1 = require("@mui/material");
@@ -63,4 +64,3 @@ function UserQuestion({ question }) {
63
64
  }, children: copyButton })] }), children: (0, jsx_runtime_1.jsx)(material_1.Typography, { sx: Object.assign(Object.assign(Object.assign({}, BASE_QUESTION_SX), { textAlign: 'left', alignItems: 'center' }), (0, utils_1.getLineClamp)(1)), children: question }) }) }) }));
64
65
  } }) })] }));
65
66
  }
66
- exports.default = UserQuestion;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useV0RuntimeContext = exports.V0RuntimeProvider = void 0;
3
+ exports.V0RuntimeProvider = V0RuntimeProvider;
4
+ exports.useV0RuntimeContext = useV0RuntimeContext;
4
5
  const jsx_runtime_1 = require("react/jsx-runtime");
5
6
  const material_1 = require("@mui/material");
6
7
  const react_1 = require("react");
@@ -46,7 +47,6 @@ function V0RuntimeProvider({ children }) {
46
47
  }), [setCurrentMessageTaskId, currentMessageTaskId, propertiesValueMap, setPropertiesValueMap, isMobile]);
47
48
  return (0, jsx_runtime_1.jsx)(context.Provider, { value: state, children: children });
48
49
  }
49
- exports.V0RuntimeProvider = V0RuntimeProvider;
50
50
  function useV0RuntimeContext() {
51
51
  const current = (0, react_1.useContext)(context);
52
52
  if (!current) {
@@ -54,4 +54,3 @@ function useV0RuntimeContext() {
54
54
  }
55
55
  return current;
56
56
  }
57
- exports.useV0RuntimeContext = useV0RuntimeContext;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useAgentState = void 0;
12
+ exports.useAgentState = useAgentState;
13
13
  const zustand_1 = require("zustand");
14
14
  const immer_1 = require("zustand/middleware/immer");
15
15
  const agent_1 = require("../api/agent");
@@ -56,4 +56,3 @@ function useAgentState({ blockletDid, aid, working, }) {
56
56
  }
57
57
  return [state.agent, state];
58
58
  }
59
- exports.useAgentState = useAgentState;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useRuntimeState = void 0;
12
+ exports.useRuntimeState = useRuntimeState;
13
13
  const react_1 = require("react");
14
14
  const session_1 = require("../../../session");
15
15
  const Runtime_1 = require("../contexts/Runtime");
@@ -45,4 +45,3 @@ function useRuntimeState() {
45
45
  }), [authSession.user, exec, blockletDid, working, login]);
46
46
  return { blockletDid, aid, working, agent, execute };
47
47
  }
48
- exports.useRuntimeState = useRuntimeState;
@@ -27,7 +27,10 @@ var __rest = (this && this.__rest) || function (s, e) {
27
27
  return t;
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.useCurrentSessionState = exports.useSessionState = exports.useAutoLoadSessionState = exports.createSessionState = void 0;
30
+ exports.createSessionState = void 0;
31
+ exports.useAutoLoadSessionState = useAutoLoadSessionState;
32
+ exports.useSessionState = useSessionState;
33
+ exports.useCurrentSessionState = useCurrentSessionState;
31
34
  const aid_1 = require("@blocklet/ai-runtime/common/aid");
32
35
  const react_1 = require("react");
33
36
  const zustand_1 = require("zustand");
@@ -140,7 +143,7 @@ const createSessionState = ({ aid }) => {
140
143
  state.currentSessionId = sessionId;
141
144
  });
142
145
  },
143
- createSession: (...args_2) => __awaiter(void 0, [...args_2], void 0, function* ({ name } = {}) {
146
+ createSession: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* ({ name } = {}) {
144
147
  const { created, sessions } = yield (0, session_1.createSession)({ aid, name });
145
148
  set((state) => {
146
149
  state.sessions = sessions;
@@ -155,7 +158,7 @@ const createSessionState = ({ aid }) => {
155
158
  });
156
159
  return created;
157
160
  }),
158
- deleteSession: (...args_3) => __awaiter(void 0, [...args_3], void 0, function* (args = {}) {
161
+ deleteSession: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (args = {}) {
159
162
  var _a;
160
163
  const sessionId = args.sessionId || get().currentSessionId;
161
164
  const autoSetCurrentSessionId = (_a = args.autoSetCurrentSessionId) !== null && _a !== void 0 ? _a : true;
@@ -170,7 +173,7 @@ const createSessionState = ({ aid }) => {
170
173
  }
171
174
  });
172
175
  }),
173
- clearSession: (...args_4) => __awaiter(void 0, [...args_4], void 0, function* (args = {}) {
176
+ clearSession: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (args = {}) {
174
177
  const sessionId = args.sessionId || get().currentSessionId;
175
178
  if (!sessionId)
176
179
  return;
@@ -185,8 +188,8 @@ const createSessionState = ({ aid }) => {
185
188
  s.messageLoading = undefined;
186
189
  });
187
190
  }),
188
- loadMoreMessages: (...args_5) => __awaiter(void 0, [...args_5], void 0, function* (args = {}) {
189
- var _b, _c;
191
+ loadMoreMessages: (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (args = {}) {
192
+ var _a, _b;
190
193
  const sessionId = args.sessionId || get().currentSessionId;
191
194
  const limit = args.limit || GET_MESSAGES_LIMIT;
192
195
  if (!sessionId)
@@ -205,7 +208,7 @@ const createSessionState = ({ aid }) => {
205
208
  try {
206
209
  const result = yield (0, message_1.getMessages)({
207
210
  sessionId: s.session.id,
208
- before: (_c = (_b = s.messages) === null || _b === void 0 ? void 0 : _b.slice(-1)[0]) === null || _c === void 0 ? void 0 : _c.id,
211
+ before: (_b = (_a = s.messages) === null || _a === void 0 ? void 0 : _a.slice(-1)[0]) === null || _b === void 0 ? void 0 : _b.id,
209
212
  orderDirection: GET_MESSAGES_ORDER_DIRECTION,
210
213
  limit,
211
214
  });
@@ -235,18 +238,18 @@ const createSessionState = ({ aid }) => {
235
238
  for (let i = 0; i < sessions.length; i += groupSize) {
236
239
  const group = sessions.slice(i, i + groupSize);
237
240
  // eslint-disable-next-line no-await-in-loop
238
- yield Promise.all(group.map((_d) => __awaiter(void 0, [_d], void 0, function* ({ id: sessionId }) {
239
- var _e, _f;
241
+ yield Promise.all(group.map((_a) => __awaiter(void 0, [_a], void 0, function* ({ id: sessionId }) {
242
+ var _b, _c;
240
243
  // if messages is empty, load latest message
241
- if (!((_f = (_e = sessionMap === null || sessionMap === void 0 ? void 0 : sessionMap[sessionId]) === null || _e === void 0 ? void 0 : _e.messages) === null || _f === void 0 ? void 0 : _f.length)) {
244
+ if (!((_c = (_b = sessionMap === null || sessionMap === void 0 ? void 0 : sessionMap[sessionId]) === null || _b === void 0 ? void 0 : _b.messages) === null || _c === void 0 ? void 0 : _c.length)) {
242
245
  yield get().loadMoreMessages({ sessionId, limit: 1 });
243
246
  }
244
247
  })));
245
248
  }
246
249
  }),
247
- execute: (_g) => __awaiter(void 0, void 0, void 0, function* () {
248
- var _h, e_1, _j, _k;
249
- var { blockletDid, aid, working, parameters, onResponseStart } = _g, args = __rest(_g, ["blockletDid", "aid", "working", "parameters", "onResponseStart"]);
250
+ execute: (_a) => __awaiter(void 0, void 0, void 0, function* () {
251
+ var _b, e_1, _c, _d;
252
+ var { blockletDid, aid, working, parameters, onResponseStart } = _a, args = __rest(_a, ["blockletDid", "aid", "working", "parameters", "onResponseStart"]);
250
253
  const sessionId = args.sessionId ||
251
254
  get().currentSessionId ||
252
255
  (yield get().createSession({
@@ -272,10 +275,10 @@ const createSessionState = ({ aid }) => {
272
275
  });
273
276
  let responseStarted = false;
274
277
  try {
275
- for (var _l = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _h = stream_1_1.done, !_h; _l = true) {
276
- _k = stream_1_1.value;
277
- _l = false;
278
- const value = _k;
278
+ for (var _e = true, stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield stream_1.next(), _b = stream_1_1.done, !_b; _e = true) {
279
+ _d = stream_1_1.value;
280
+ _e = false;
281
+ const value = _d;
279
282
  if (!responseStarted) {
280
283
  responseStarted = true;
281
284
  onResponseStart === null || onResponseStart === void 0 ? void 0 : onResponseStart();
@@ -339,7 +342,7 @@ const createSessionState = ({ aid }) => {
339
342
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
340
343
  finally {
341
344
  try {
342
- if (!_l && !_h && (_j = stream_1.return)) yield _j.call(stream_1);
345
+ if (!_e && !_b && (_c = stream_1.return)) yield _c.call(stream_1);
343
346
  }
344
347
  finally { if (e_1) throw e_1.error; }
345
348
  }
@@ -379,12 +382,10 @@ function useAutoLoadSessionState(...args) {
379
382
  state.getState().load(...args);
380
383
  }, [state, currentSessionId]);
381
384
  }
382
- exports.useAutoLoadSessionState = useAutoLoadSessionState;
383
385
  function useSessionState(selector) {
384
386
  const { aid } = (0, Runtime_1.useRuntimeContext)();
385
387
  return (0, react_1.useMemo)(() => (0, exports.createSessionState)({ aid }), [aid])(selector);
386
388
  }
387
- exports.useSessionState = useSessionState;
388
389
  function useCurrentSessionState(selector) {
389
390
  return useSessionState((state) => {
390
391
  var _a;
@@ -392,4 +393,3 @@ function useCurrentSessionState(selector) {
392
393
  return selector(s);
393
394
  });
394
395
  }
395
- exports.useCurrentSessionState = useCurrentSessionState;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidInput = exports.USER_INPUT_PARAMETER_TYPES = void 0;
3
+ exports.USER_INPUT_PARAMETER_TYPES = void 0;
4
+ exports.isValidInput = isValidInput;
4
5
  exports.USER_INPUT_PARAMETER_TYPES = ['string', 'number', 'select', 'language'];
5
6
  function isValidInput(input) {
6
7
  return !!input.key && exports.USER_INPUT_PARAMETER_TYPES.includes(input.type || 'string');
7
8
  }
8
- exports.isValidInput = isValidInput;
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.convertImageToBlob = exports.downloadImage = void 0;
12
+ exports.downloadImage = downloadImage;
13
+ exports.convertImageToBlob = convertImageToBlob;
13
14
  function downloadImage(_a) {
14
15
  return __awaiter(this, arguments, void 0, function* ({ url }) {
15
16
  return new Promise((resolve, reject) => {
@@ -20,7 +21,6 @@ function downloadImage(_a) {
20
21
  });
21
22
  });
22
23
  }
23
- exports.downloadImage = downloadImage;
24
24
  function convertImageToBlob(image) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
26
  return new Promise((resolve, reject) => {
@@ -38,4 +38,3 @@ function convertImageToBlob(image) {
38
38
  });
39
39
  });
40
40
  }
41
- exports.convertImageToBlob = convertImageToBlob;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = mapRight;
3
4
  function mapRight(array, fn) {
4
5
  const result = new Array(array.length);
5
6
  for (let i = array.length - 1; i >= 0; i--) {
@@ -7,4 +8,3 @@ function mapRight(array, fn) {
7
8
  }
8
9
  return result;
9
10
  }
10
- exports.default = mapRight;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOutputVariableInitialValue = void 0;
3
+ exports.getOutputVariableInitialValue = getOutputVariableInitialValue;
4
4
  function getOutputVariableInitialValue(agent, output) {
5
5
  var _a, _b;
6
6
  return (_b = (_a = agent.outputVariables) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === output)) === null || _b === void 0 ? void 0 : _b.initialValue;
7
7
  }
8
- exports.getOutputVariableInitialValue = getOutputVariableInitialValue;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCachedStore = void 0;
3
+ exports.createCachedStore = createCachedStore;
4
4
  const STATES = {};
5
5
  function createCachedStore(key, creator) {
6
6
  var _a;
7
7
  (_a = STATES[key]) !== null && _a !== void 0 ? _a : (STATES[key] = creator());
8
8
  return STATES[key];
9
9
  }
10
- exports.createCachedStore = createCachedStore;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.call = void 0;
12
+ exports.call = call;
13
13
  const utils_1 = require("./utils");
14
14
  function call(input) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
@@ -41,4 +41,3 @@ function call(input) {
41
41
  });
42
42
  });
43
43
  }
44
- exports.call = call;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Icon = void 0;
3
+ exports.Icon = Icon;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("@iconify/react");
6
6
  const material_1 = require("@mui/material");
7
7
  function Icon(props) {
8
8
  return (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ component: react_1.Icon }, props));
9
9
  }
10
- exports.Icon = Icon;
11
10
  exports.default = Icon;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useHeader = exports.useHeaderState = void 0;
3
+ exports.useHeaderState = void 0;
4
+ exports.useHeader = useHeader;
4
5
  const immer_1 = require("immer");
5
6
  const react_1 = require("react");
6
7
  const zustand_1 = require("zustand");
@@ -45,4 +46,3 @@ function useHeader(creator, deps) {
45
46
  return () => exports.useHeaderState.getState().delete(creator);
46
47
  }, deps);
47
48
  }
48
- exports.useHeader = useHeader;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSessionContext = void 0;
3
+ exports.useSessionContext = useSessionContext;
4
4
  const Session_1 = require("@arcblock/did-connect/lib/Session");
5
5
  const react_1 = require("react");
6
6
  function useSessionContext() {
7
7
  return (0, react_1.useContext)(Session_1.SessionContext);
8
8
  }
9
- exports.useSessionContext = useSessionContext;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getComponentMountPoint = exports.getQuery = exports.withQuery = exports.joinURL = void 0;
3
+ exports.getQuery = exports.withQuery = exports.joinURL = void 0;
4
+ exports.getComponentMountPoint = getComponentMountPoint;
4
5
  var ufo_1 = require("ufo");
5
6
  Object.defineProperty(exports, "joinURL", { enumerable: true, get: function () { return ufo_1.joinURL; } });
6
7
  Object.defineProperty(exports, "withQuery", { enumerable: true, get: function () { return ufo_1.withQuery; } });
@@ -13,4 +14,3 @@ function getComponentMountPoint(name) {
13
14
  }
14
15
  return (_b = (_a = globalThis.blocklet) === null || _a === void 0 ? void 0 : _a.componentMountPoints.find((i) => i.name === name || i.did === name)) === null || _b === void 0 ? void 0 : _b.mountPoint;
15
16
  }
16
- exports.getComponentMountPoint = getComponentMountPoint;
@@ -34,6 +34,7 @@ var __rest = (this && this.__rest) || function (s, e) {
34
34
  return t;
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.default = BlockletReactComponentRenderer;
37
38
  const jsx_runtime_1 = require("react/jsx-runtime");
38
39
  const react_1 = __importStar(require("react"));
39
40
  const utils_1 = require("../../builtin/utils");
@@ -53,7 +54,6 @@ function BlockletReactComponentRenderer(_a) {
53
54
  const C = loadComponent(url);
54
55
  return (0, jsx_runtime_1.jsx)(C, Object.assign({}, props.props));
55
56
  }
56
- exports.default = BlockletReactComponentRenderer;
57
57
  const COMPONENTS_CACHE = {};
58
58
  function loadComponent(url) {
59
59
  var _a;
@@ -11,7 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.useDev = exports.DevProvider = void 0;
14
+ exports.DevProvider = DevProvider;
15
+ exports.useDev = useDev;
15
16
  const jsx_runtime_1 = require("react/jsx-runtime");
16
17
  const react_1 = require("react");
17
18
  const devContext = (0, react_1.createContext)(undefined);
@@ -19,8 +20,6 @@ function DevProvider(_a) {
19
20
  var { dev } = _a, props = __rest(_a, ["dev"]);
20
21
  return (0, jsx_runtime_1.jsx)(devContext.Provider, Object.assign({ value: dev }, props));
21
22
  }
22
- exports.DevProvider = DevProvider;
23
23
  function useDev() {
24
24
  return (0, react_1.useContext)(devContext);
25
25
  }
26
- exports.useDev = useDev;
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  return (mod && mod.__esModule) ? mod : { "default": mod };
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.default = CustomComponentRenderer;
31
32
  const jsx_runtime_1 = require("react/jsx-runtime");
32
33
  const material_1 = require("@mui/material");
33
34
  const react_error_boundary_1 = require("react-error-boundary");
@@ -44,7 +45,6 @@ function CustomComponentRenderer(_a) {
44
45
  const BuiltinComponent = BuiltinComponents[props.componentId];
45
46
  return ((0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: (props === null || props === void 0 ? void 0 : props.fallbackRender) || ErrorView, children: (0, jsx_runtime_1.jsx)(DevProvider_1.DevProvider, { dev: dev !== null && dev !== void 0 ? dev : inheritedDev, children: BuiltinComponent ? ((0, jsx_runtime_1.jsx)(BuiltinComponent, Object.assign({}, props))) : ((0, jsx_runtime_1.jsx)(ComponentRenderer, Object.assign({}, props, { instanceId: (_b = props.instanceId) !== null && _b !== void 0 ? _b : props.componentId }))) }) }));
46
47
  }
47
- exports.default = CustomComponentRenderer;
48
48
  const BuiltinComponents = {
49
49
  'blocklet-react-component': BlockletReactComponentRenderer_1.default,
50
50
  };
@@ -46,7 +46,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
46
46
  return (mod && mod.__esModule) ? mod : { "default": mod };
47
47
  };
48
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.transpileAndLoadScript = exports.useComponent = exports.customComponentStates = void 0;
49
+ exports.customComponentStates = void 0;
50
+ exports.useComponent = useComponent;
51
+ exports.transpileAndLoadScript = transpileAndLoadScript;
50
52
  const set_1 = __importDefault(require("lodash/set"));
51
53
  const react_1 = require("react");
52
54
  const zustand_1 = require("zustand");
@@ -154,7 +156,6 @@ function useComponent({ instanceId, componentId, properties, locale, dev }) {
154
156
  error: transpile === null || transpile === void 0 ? void 0 : transpile.error,
155
157
  };
156
158
  }
157
- exports.useComponent = useComponent;
158
159
  const COMPONENT_LOADER_MAP = {};
159
160
  function usePreloadComponent({ instanceId, componentId, properties, locale, dev }) {
160
161
  var _a;
@@ -252,4 +253,3 @@ function transpileAndLoadScript(script) {
252
253
  return Promise.resolve(`${url}`).then(s => __importStar(require(s)));
253
254
  });
254
255
  }
255
- exports.transpileAndLoadScript = transpileAndLoadScript;