@uipath/apollo-react 7.38.0 → 7.40.0

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 (47) hide show
  1. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  2. package/dist/chat/headless/hooks/use-composer-footer.cjs +69 -0
  3. package/dist/chat/headless/hooks/use-composer-footer.d.ts +7 -0
  4. package/dist/chat/headless/hooks/use-composer-footer.d.ts.map +1 -0
  5. package/dist/chat/headless/hooks/use-composer-footer.js +25 -0
  6. package/dist/chat/headless/utils/info-links.cjs +52 -0
  7. package/dist/chat/headless/utils/info-links.d.ts +7 -0
  8. package/dist/chat/headless/utils/info-links.d.ts.map +1 -0
  9. package/dist/chat/headless/utils/info-links.js +18 -0
  10. package/dist/chat/service/ChatModel.cjs +1 -0
  11. package/dist/chat/service/ChatModel.d.ts +12 -0
  12. package/dist/chat/service/ChatModel.d.ts.map +1 -1
  13. package/dist/chat/service/ChatModel.js +1 -0
  14. package/dist/chat/service/ChatService.cjs +7 -0
  15. package/dist/chat/service/ChatService.d.ts +2 -1
  16. package/dist/chat/service/ChatService.d.ts.map +1 -1
  17. package/dist/chat/service/ChatService.js +7 -0
  18. package/dist/chat/stories/chat-playground.d.ts +7 -1
  19. package/dist/chat/stories/chat-playground.d.ts.map +1 -1
  20. package/dist/chat/stories/chat-story-fixtures.d.ts +18 -0
  21. package/dist/chat/stories/chat-story-fixtures.d.ts.map +1 -1
  22. package/dist/chat/styles/tailwind.chat.css +1 -1
  23. package/dist/chat/wind/composer/chat-composer.cjs +3 -5
  24. package/dist/chat/wind/composer/chat-composer.d.ts.map +1 -1
  25. package/dist/chat/wind/composer/chat-composer.js +4 -6
  26. package/dist/chat/wind/composer/composer-footer.cjs +73 -0
  27. package/dist/chat/wind/composer/composer-footer.d.ts +2 -0
  28. package/dist/chat/wind/composer/composer-footer.d.ts.map +1 -0
  29. package/dist/chat/wind/composer/composer-footer.js +39 -0
  30. package/dist/chat/wind/first-run/first-run.cjs +8 -7
  31. package/dist/chat/wind/first-run/first-run.d.ts.map +1 -1
  32. package/dist/chat/wind/first-run/first-run.js +9 -8
  33. package/dist/chat/wind/first-run/hero-branding.cjs +137 -0
  34. package/dist/chat/wind/first-run/hero-branding.d.ts +19 -0
  35. package/dist/chat/wind/first-run/hero-branding.d.ts.map +1 -0
  36. package/dist/chat/wind/first-run/hero-branding.js +84 -0
  37. package/dist/chat/wind/renderers/chat-code-block.cjs +3 -4
  38. package/dist/chat/wind/renderers/chat-code-block.d.ts.map +1 -1
  39. package/dist/chat/wind/renderers/chat-code-block.js +3 -4
  40. package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
  41. package/dist/material/components/ap-chat/components/input/chat-input-footer.cjs +57 -8
  42. package/dist/material/components/ap-chat/components/input/chat-input-footer.d.ts.map +1 -1
  43. package/dist/material/components/ap-chat/components/input/chat-input-footer.js +57 -9
  44. package/dist/material/components/ap-link/ApLink.cjs +9 -4
  45. package/dist/material/components/ap-link/ApLink.d.ts.map +1 -1
  46. package/dist/material/components/ap-link/ApLink.js +9 -4
  47. package/package.json +3 -3
@@ -51,6 +51,7 @@ const loading_provider_cjs_namespaceObject = require("../../headless/providers/l
51
51
  const index_cjs_namespaceObject = require("../../service/index.cjs");
52
52
  const message_attachments_cjs_namespaceObject = require("../messages/message-attachments.cjs");
53
53
  const markdown_renderer_cjs_namespaceObject = require("../renderers/markdown-renderer.cjs");
54
+ const external_composer_footer_cjs_namespaceObject = require("./composer-footer.cjs");
54
55
  const external_composer_strings_cjs_namespaceObject = require("./composer-strings.cjs");
55
56
  const promptText = (prompt)=>'string' == typeof prompt ? prompt : prompt?.content ?? '';
56
57
  function ComposerErrorText({ message }) {
@@ -65,7 +66,7 @@ function ComposerErrorText({ message }) {
65
66
  function WindChatComposer() {
66
67
  const chatService = (0, chat_service_provider_cjs_namespaceObject.useChatService)();
67
68
  const { disabledFeatures, spacing, allowedAttachments } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
68
- const { inputPlaceholder, footerDisclaimer } = (0, use_chat_labels_cjs_namespaceObject.useChatLabels)();
69
+ const { inputPlaceholder } = (0, use_chat_labels_cjs_namespaceObject.useChatLabels)();
69
70
  const { skeletonLoader } = (0, loading_provider_cjs_namespaceObject.useLoading)();
70
71
  const { error, clearError } = (0, error_provider_cjs_namespaceObject.useError)();
71
72
  const { attachments, attachmentsLoading, removeAttachment, clearAttachments } = (0, attachments_provider_cjs_namespaceObject.useAttachments)();
@@ -197,10 +198,7 @@ function WindChatComposer() {
197
198
  })
198
199
  ]
199
200
  }),
200
- !disabledFeatures.footer && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ChatComposerFooter, {
201
- className: "text-[10px]",
202
- children: footerDisclaimer
203
- })
201
+ !disabledFeatures.footer && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_composer_footer_cjs_namespaceObject.WindComposerFooter, {})
204
202
  ]
205
203
  });
206
204
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chat-composer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/composer/chat-composer.tsx"],"names":[],"mappings":"AA2DA,wBAAgB,gBAAgB,4CAkJ/B"}
1
+ {"version":3,"file":"chat-composer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/composer/chat-composer.tsx"],"names":[],"mappings":"AA2DA,wBAAgB,gBAAgB,4CA+I/B"}
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { ChatComposer, ChatComposerAttachButton, ChatComposerAttachments, ChatComposerError, ChatComposerFooter, ChatComposerInputGroup, ChatComposerSubmit, ChatComposerTextarea, ChatComposerToolbar, Markdown, Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "@uipath/apollo-wind";
2
+ import { ChatComposer, ChatComposerAttachButton, ChatComposerAttachments, ChatComposerError, ChatComposerInputGroup, ChatComposerSubmit, ChatComposerTextarea, ChatComposerToolbar, Markdown, Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "@uipath/apollo-wind";
3
3
  import react from "react";
4
4
  import { getAcceptedFileTypes, useAttachmentIntake } from "../../headless/hooks/use-attachment-intake.js";
5
5
  import { useAttachmentLimits } from "../../headless/hooks/use-attachment-limits.js";
@@ -13,6 +13,7 @@ import { useLoading } from "../../headless/providers/loading-provider.js";
13
13
  import { AutopilotChatEvent, AutopilotChatInternalEvent } from "../../service/index.js";
14
14
  import { AttachmentTypeIcon } from "../messages/message-attachments.js";
15
15
  import { useMarkdownStrings } from "../renderers/markdown-renderer.js";
16
+ import { WindComposerFooter } from "./composer-footer.js";
16
17
  import { useComposerStrings } from "./composer-strings.js";
17
18
  const promptText = (prompt)=>'string' == typeof prompt ? prompt : prompt?.content ?? '';
18
19
  function ComposerErrorText({ message }) {
@@ -27,7 +28,7 @@ function ComposerErrorText({ message }) {
27
28
  function WindChatComposer() {
28
29
  const chatService = useChatService();
29
30
  const { disabledFeatures, spacing, allowedAttachments } = useChatState();
30
- const { inputPlaceholder, footerDisclaimer } = useChatLabels();
31
+ const { inputPlaceholder } = useChatLabels();
31
32
  const { skeletonLoader } = useLoading();
32
33
  const { error, clearError } = useError();
33
34
  const { attachments, attachmentsLoading, removeAttachment, clearAttachments } = useAttachments();
@@ -159,10 +160,7 @@ function WindChatComposer() {
159
160
  })
160
161
  ]
161
162
  }),
162
- !disabledFeatures.footer && /*#__PURE__*/ jsx(ChatComposerFooter, {
163
- className: "text-[10px]",
164
- children: footerDisclaimer
165
- })
163
+ !disabledFeatures.footer && /*#__PURE__*/ jsx(WindComposerFooter, {})
166
164
  ]
167
165
  });
168
166
  }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ WindComposerFooter: ()=>WindComposerFooter
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
31
+ const use_composer_footer_cjs_namespaceObject = require("../../headless/hooks/use-composer-footer.cjs");
32
+ function WindComposerFooter() {
33
+ const { disclaimer, links } = (0, use_composer_footer_cjs_namespaceObject.useComposerFooter)();
34
+ if (0 === links.length) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ChatComposerFooter, {
35
+ className: "text-[10px]",
36
+ children: disclaimer
37
+ });
38
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
39
+ "data-slot": "chat-composer-footer-row",
40
+ className: "flex flex-wrap items-baseline justify-between gap-2 px-1 text-[10px] text-muted-foreground",
41
+ children: [
42
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("ul", {
43
+ "data-slot": "chat-composer-info-links",
44
+ className: "flex flex-wrap gap-x-3",
45
+ children: links.map(({ label, href }, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("li", {
46
+ children: href ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
47
+ asChild: true,
48
+ variant: "link",
49
+ size: "4xs",
50
+ className: "h-auto px-0 text-[10px]",
51
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
52
+ href: href,
53
+ target: "_blank",
54
+ rel: "noopener noreferrer",
55
+ children: label
56
+ })
57
+ }) : label
58
+ }, index))
59
+ }),
60
+ disclaimer && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ChatComposerFooter, {
61
+ className: "px-0 text-end text-[10px]",
62
+ children: disclaimer
63
+ })
64
+ ]
65
+ });
66
+ }
67
+ exports.WindComposerFooter = __webpack_exports__.WindComposerFooter;
68
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
69
+ "WindComposerFooter"
70
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
71
+ Object.defineProperty(exports, '__esModule', {
72
+ value: true
73
+ });
@@ -0,0 +1,2 @@
1
+ export declare function WindComposerFooter(): import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=composer-footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer-footer.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/composer/composer-footer.tsx"],"names":[],"mappings":"AAQA,wBAAgB,kBAAkB,4CAmCjC"}
@@ -0,0 +1,39 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, ChatComposerFooter } from "@uipath/apollo-wind";
3
+ import { useComposerFooter } from "../../headless/hooks/use-composer-footer.js";
4
+ function WindComposerFooter() {
5
+ const { disclaimer, links } = useComposerFooter();
6
+ if (0 === links.length) return /*#__PURE__*/ jsx(ChatComposerFooter, {
7
+ className: "text-[10px]",
8
+ children: disclaimer
9
+ });
10
+ return /*#__PURE__*/ jsxs("div", {
11
+ "data-slot": "chat-composer-footer-row",
12
+ className: "flex flex-wrap items-baseline justify-between gap-2 px-1 text-[10px] text-muted-foreground",
13
+ children: [
14
+ /*#__PURE__*/ jsx("ul", {
15
+ "data-slot": "chat-composer-info-links",
16
+ className: "flex flex-wrap gap-x-3",
17
+ children: links.map(({ label, href }, index)=>/*#__PURE__*/ jsx("li", {
18
+ children: href ? /*#__PURE__*/ jsx(Button, {
19
+ asChild: true,
20
+ variant: "link",
21
+ size: "4xs",
22
+ className: "h-auto px-0 text-[10px]",
23
+ children: /*#__PURE__*/ jsx("a", {
24
+ href: href,
25
+ target: "_blank",
26
+ rel: "noopener noreferrer",
27
+ children: label
28
+ })
29
+ }) : label
30
+ }, index))
31
+ }),
32
+ disclaimer && /*#__PURE__*/ jsx(ChatComposerFooter, {
33
+ className: "px-0 text-end text-[10px]",
34
+ children: disclaimer
35
+ })
36
+ ]
37
+ });
38
+ }
39
+ export { WindComposerFooter };
@@ -29,15 +29,16 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
31
  const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
32
- const autopilot_logo_cjs_namespaceObject = require("../../assets/autopilot-logo.cjs");
33
32
  const chat_state_provider_cjs_namespaceObject = require("../../headless/providers/chat-state-provider.cjs");
34
33
  const loading_provider_cjs_namespaceObject = require("../../headless/providers/loading-provider.cjs");
35
34
  const thinking_row_cjs_namespaceObject = require("../messages/thinking-row.cjs");
35
+ const external_hero_branding_cjs_namespaceObject = require("./hero-branding.cjs");
36
36
  const external_suggestion_list_cjs_namespaceObject = require("./suggestion-list.cjs");
37
37
  function useFirstRunShown() {
38
- const { firstRunVisible } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
38
+ const { firstRunVisible, firstRunExperience, hasMessages } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
39
39
  const { skeletonLoader } = (0, loading_provider_cjs_namespaceObject.useLoading)();
40
- return firstRunVisible && !skeletonLoader;
40
+ const image = (0, external_hero_branding_cjs_namespaceObject.useHeroImage)(firstRunExperience?.image);
41
+ return (firstRunVisible || !hasMessages && void 0 !== image) && !skeletonLoader;
41
42
  }
42
43
  const revealFocusedChip = (event)=>event.target.scrollIntoView?.({
43
44
  block: 'nearest',
@@ -58,10 +59,10 @@ function FirstRun({ layout, className, wrapperClassName, children }) {
58
59
  children: [
59
60
  shown && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.ChatHeroHeader, {
60
61
  children: [
61
- centered && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ChatHeroLogo, {
62
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(autopilot_logo_cjs_namespaceObject.AutopilotLogo, {
63
- className: "size-10"
64
- })
62
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_hero_branding_cjs_namespaceObject.HeroBranding, {
63
+ image: firstRunExperience?.image,
64
+ layout: layout,
65
+ density: density
65
66
  }),
66
67
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ChatHeroTitle, {
67
68
  children: firstRunExperience?.title
@@ -1 +1 @@
1
- {"version":3,"file":"first-run.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/first-run/first-run.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EAIpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,wBAAgB,gBAAgB,YAI/B;AAeD,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,2CA2CA"}
1
+ {"version":3,"file":"first-run.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/first-run/first-run.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EAGpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,wBAAgB,gBAAgB,YAK/B;AAeD,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,cAAc,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,2CAuCA"}
@@ -1,14 +1,15 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { ChatHero, ChatHeroDescription, ChatHeroHeader, ChatHeroLogo, ChatHeroTitle, cn } from "@uipath/apollo-wind";
3
- import { AutopilotLogo } from "../../assets/autopilot-logo.js";
2
+ import { ChatHero, ChatHeroDescription, ChatHeroHeader, ChatHeroTitle, cn } from "@uipath/apollo-wind";
4
3
  import { useChatState } from "../../headless/providers/chat-state-provider.js";
5
4
  import { useLoading } from "../../headless/providers/loading-provider.js";
6
5
  import { ThinkingRow } from "../messages/thinking-row.js";
6
+ import { HeroBranding, useHeroImage } from "./hero-branding.js";
7
7
  import { SuggestionList } from "./suggestion-list.js";
8
8
  function useFirstRunShown() {
9
- const { firstRunVisible } = useChatState();
9
+ const { firstRunVisible, firstRunExperience, hasMessages } = useChatState();
10
10
  const { skeletonLoader } = useLoading();
11
- return firstRunVisible && !skeletonLoader;
11
+ const image = useHeroImage(firstRunExperience?.image);
12
+ return (firstRunVisible || !hasMessages && void 0 !== image) && !skeletonLoader;
12
13
  }
13
14
  const revealFocusedChip = (event)=>event.target.scrollIntoView?.({
14
15
  block: 'nearest',
@@ -29,10 +30,10 @@ function FirstRun({ layout, className, wrapperClassName, children }) {
29
30
  children: [
30
31
  shown && /*#__PURE__*/ jsxs(ChatHeroHeader, {
31
32
  children: [
32
- centered && /*#__PURE__*/ jsx(ChatHeroLogo, {
33
- children: /*#__PURE__*/ jsx(AutopilotLogo, {
34
- className: "size-10"
35
- })
33
+ /*#__PURE__*/ jsx(HeroBranding, {
34
+ image: firstRunExperience?.image,
35
+ layout: layout,
36
+ density: density
36
37
  }),
37
38
  /*#__PURE__*/ jsx(ChatHeroTitle, {
38
39
  children: firstRunExperience?.title
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ useHeroImage: ()=>useHeroImage,
37
+ resolveHeroImageHeight: ()=>resolveHeroImageHeight,
38
+ resolveHeroImageUrl: ()=>resolveHeroImageUrl,
39
+ HeroBranding: ()=>HeroBranding
40
+ });
41
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
42
+ const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
43
+ const external_react_namespaceObject = require("react");
44
+ var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
45
+ const autopilot_logo_cjs_namespaceObject = require("../../assets/autopilot-logo.cjs");
46
+ const theme_provider_cjs_namespaceObject = require("../../headless/providers/theme-provider.cjs");
47
+ const openable_url_cjs_namespaceObject = require("../../headless/utils/openable-url.cjs");
48
+ function resolveHeroImageUrl(image, isDark) {
49
+ const url = isDark && image.dark || image.light;
50
+ return 'string' == typeof url && '' !== url.trim() && (0, openable_url_cjs_namespaceObject.isOpenableUrl)(url) ? url : void 0;
51
+ }
52
+ function resolveHeroImageHeight(image) {
53
+ const { height } = image;
54
+ return 'number' == typeof height && Number.isFinite(height) && height > 0 ? height : void 0;
55
+ }
56
+ const MAX_HEIGHT = {
57
+ centered: {
58
+ comfortable: 'max-h-60',
59
+ compact: 'max-h-40'
60
+ },
61
+ docked: {
62
+ comfortable: 'max-h-40',
63
+ compact: 'max-h-30'
64
+ }
65
+ };
66
+ const failedUrls = new WeakMap();
67
+ const listeners = new Set();
68
+ let failureCount = 0;
69
+ function markFailed(image, url) {
70
+ const failed = failedUrls.get(image) ?? new Set();
71
+ if (failed.has(url)) return;
72
+ failedUrls.set(image, failed.add(url));
73
+ failureCount += 1;
74
+ for (const notify of listeners)notify();
75
+ }
76
+ function subscribe(notify) {
77
+ listeners.add(notify);
78
+ return ()=>{
79
+ listeners.delete(notify);
80
+ };
81
+ }
82
+ const getFailureCount = ()=>failureCount;
83
+ function useHeroImage(image) {
84
+ const { isDark } = (0, theme_provider_cjs_namespaceObject.useTheme)();
85
+ external_react_default().useSyncExternalStore(subscribe, getFailureCount, getFailureCount);
86
+ if ('object' != typeof image || null === image) return;
87
+ const url = resolveHeroImageUrl(image, isDark);
88
+ if (void 0 === url || failedUrls.get(image)?.has(url)) return;
89
+ return {
90
+ url,
91
+ alt: 'string' == typeof image.alt ? image.alt : '',
92
+ height: resolveHeroImageHeight(image),
93
+ onError: ()=>markFailed(image, url)
94
+ };
95
+ }
96
+ function HeroBranding({ image, layout, density }) {
97
+ const shown = useHeroImage(image);
98
+ const centered = 'centered' === layout;
99
+ if (shown) {
100
+ const { height } = shown;
101
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ChatHeroLogo, {
102
+ className: (0, apollo_wind_namespaceObject.cn)('block max-w-full', !centered && 'mb-1'),
103
+ style: void 0 === height ? void 0 : {
104
+ '--hero-image-height': `${height}px`
105
+ },
106
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
107
+ src: shown.url,
108
+ alt: shown.alt,
109
+ "data-slot": "chat-hero-image",
110
+ referrerPolicy: "no-referrer",
111
+ decoding: "async",
112
+ draggable: false,
113
+ className: (0, apollo_wind_namespaceObject.cn)('block w-auto max-w-full object-contain', void 0 === height ? 'h-auto' : 'h-(--hero-image-height)', !centered && 'object-left', MAX_HEIGHT[layout][density]),
114
+ onError: shown.onError
115
+ })
116
+ });
117
+ }
118
+ if (!centered) return null;
119
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ChatHeroLogo, {
120
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(autopilot_logo_cjs_namespaceObject.AutopilotLogo, {
121
+ className: "size-10"
122
+ })
123
+ });
124
+ }
125
+ exports.HeroBranding = __webpack_exports__.HeroBranding;
126
+ exports.resolveHeroImageHeight = __webpack_exports__.resolveHeroImageHeight;
127
+ exports.resolveHeroImageUrl = __webpack_exports__.resolveHeroImageUrl;
128
+ exports.useHeroImage = __webpack_exports__.useHeroImage;
129
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
130
+ "HeroBranding",
131
+ "resolveHeroImageHeight",
132
+ "resolveHeroImageUrl",
133
+ "useHeroImage"
134
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
135
+ Object.defineProperty(exports, '__esModule', {
136
+ value: true
137
+ });
@@ -0,0 +1,19 @@
1
+ import { type ChatHeroDensity, type ChatHeroLayout } from '@uipath/apollo-wind';
2
+ import type { AutopilotChatConfiguration } from '../../service/ChatModel';
3
+ type FirstRunExperience = NonNullable<AutopilotChatConfiguration['firstRunExperience']>;
4
+ export type HeroImage = NonNullable<FirstRunExperience['image']>;
5
+ export declare function resolveHeroImageUrl(image: HeroImage, isDark: boolean): string | undefined;
6
+ export declare function resolveHeroImageHeight(image: HeroImage): number | undefined;
7
+ export declare function useHeroImage(image: HeroImage | undefined): {
8
+ url: string;
9
+ alt: string;
10
+ height: number | undefined;
11
+ onError: () => void;
12
+ } | undefined;
13
+ export declare function HeroBranding({ image, layout, density, }: {
14
+ image: HeroImage | undefined;
15
+ layout: ChatHeroLayout;
16
+ density: ChatHeroDensity;
17
+ }): import("react/jsx-runtime").JSX.Element | null;
18
+ export {};
19
+ //# sourceMappingURL=hero-branding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hero-branding.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/first-run/hero-branding.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AAMlG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,KAAK,kBAAkB,GAAG,WAAW,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACxF,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;AAOjE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIzF;AAGD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAG3E;AAqCD,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS;;;;;cAYxD;AAOD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,OAAO,GACR,EAAE;IACD,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC;CAC1B,kDA0CA"}
@@ -0,0 +1,84 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { ChatHeroLogo, cn } from "@uipath/apollo-wind";
3
+ import react from "react";
4
+ import { AutopilotLogo } from "../../assets/autopilot-logo.js";
5
+ import { useTheme } from "../../headless/providers/theme-provider.js";
6
+ import { isOpenableUrl } from "../../headless/utils/openable-url.js";
7
+ function resolveHeroImageUrl(image, isDark) {
8
+ const url = isDark && image.dark || image.light;
9
+ return 'string' == typeof url && '' !== url.trim() && isOpenableUrl(url) ? url : void 0;
10
+ }
11
+ function resolveHeroImageHeight(image) {
12
+ const { height } = image;
13
+ return 'number' == typeof height && Number.isFinite(height) && height > 0 ? height : void 0;
14
+ }
15
+ const MAX_HEIGHT = {
16
+ centered: {
17
+ comfortable: 'max-h-60',
18
+ compact: 'max-h-40'
19
+ },
20
+ docked: {
21
+ comfortable: 'max-h-40',
22
+ compact: 'max-h-30'
23
+ }
24
+ };
25
+ const failedUrls = new WeakMap();
26
+ const listeners = new Set();
27
+ let failureCount = 0;
28
+ function markFailed(image, url) {
29
+ const failed = failedUrls.get(image) ?? new Set();
30
+ if (failed.has(url)) return;
31
+ failedUrls.set(image, failed.add(url));
32
+ failureCount += 1;
33
+ for (const notify of listeners)notify();
34
+ }
35
+ function subscribe(notify) {
36
+ listeners.add(notify);
37
+ return ()=>{
38
+ listeners.delete(notify);
39
+ };
40
+ }
41
+ const getFailureCount = ()=>failureCount;
42
+ function useHeroImage(image) {
43
+ const { isDark } = useTheme();
44
+ react.useSyncExternalStore(subscribe, getFailureCount, getFailureCount);
45
+ if ('object' != typeof image || null === image) return;
46
+ const url = resolveHeroImageUrl(image, isDark);
47
+ if (void 0 === url || failedUrls.get(image)?.has(url)) return;
48
+ return {
49
+ url,
50
+ alt: 'string' == typeof image.alt ? image.alt : '',
51
+ height: resolveHeroImageHeight(image),
52
+ onError: ()=>markFailed(image, url)
53
+ };
54
+ }
55
+ function HeroBranding({ image, layout, density }) {
56
+ const shown = useHeroImage(image);
57
+ const centered = 'centered' === layout;
58
+ if (shown) {
59
+ const { height } = shown;
60
+ return /*#__PURE__*/ jsx(ChatHeroLogo, {
61
+ className: cn('block max-w-full', !centered && 'mb-1'),
62
+ style: void 0 === height ? void 0 : {
63
+ '--hero-image-height': `${height}px`
64
+ },
65
+ children: /*#__PURE__*/ jsx("img", {
66
+ src: shown.url,
67
+ alt: shown.alt,
68
+ "data-slot": "chat-hero-image",
69
+ referrerPolicy: "no-referrer",
70
+ decoding: "async",
71
+ draggable: false,
72
+ className: cn('block w-auto max-w-full object-contain', void 0 === height ? 'h-auto' : 'h-(--hero-image-height)', !centered && 'object-left', MAX_HEIGHT[layout][density]),
73
+ onError: shown.onError
74
+ })
75
+ });
76
+ }
77
+ if (!centered) return null;
78
+ return /*#__PURE__*/ jsx(ChatHeroLogo, {
79
+ children: /*#__PURE__*/ jsx(AutopilotLogo, {
80
+ className: "size-10"
81
+ })
82
+ });
83
+ }
84
+ export { HeroBranding, resolveHeroImageHeight, resolveHeroImageUrl, useHeroImage };
@@ -59,9 +59,8 @@ function ChatCodeBlock({ block, codeBlockProps, htmlPreview, streaming }) {
59
59
  const { _ } = (0, react_namespaceObject.useLingui)();
60
60
  const dialogContainer = (0, dialog_container_cjs_namespaceObject.useDialogContainer)();
61
61
  const previewable = htmlPreview && block.language?.trim().toLowerCase() === 'html';
62
- const [previewedCode, setPreviewedCode] = external_react_default().useState(null);
63
- if (!previewable && null !== previewedCode) setPreviewedCode(null);
64
- const showPreview = previewable && !streaming && previewedCode === block.code;
62
+ const [showSource, setShowSource] = external_react_default().useState(false);
63
+ const showPreview = previewable && !streaming && !showSource;
65
64
  const [expanded, setExpanded] = external_react_default().useState(false);
66
65
  const codeLabel = _({
67
66
  id: 'autopilot-chat.message.code-block-code'
@@ -88,7 +87,7 @@ function ChatCodeBlock({ block, codeBlockProps, htmlPreview, streaming }) {
88
87
  "aria-label": toggleLabel,
89
88
  title: toggleLabel,
90
89
  disabled: streaming,
91
- onClick: ()=>setPreviewedCode(showPreview ? null : block.code),
90
+ onClick: ()=>setShowSource(showPreview),
92
91
  children: showPreview ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Code, {
93
92
  "aria-hidden": true
94
93
  }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Eye, {
@@ -1 +1 @@
1
- {"version":3,"file":"chat-code-block.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/chat-code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EAMnB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAY7B,UAAU,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB,CAAC;IAEzB,cAAc,EAAE,cAAc,CAAC;IAE/B,WAAW,EAAE,OAAO,CAAC;IAErB,SAAS,EAAE,OAAO,CAAC;CACpB;AA4BD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,cAAc,EACd,WAAW,EACX,SAAS,GACV,EAAE,kBAAkB,2CA8FpB"}
1
+ {"version":3,"file":"chat-code-block.d.ts","sourceRoot":"","sources":["../../../../src/chat/wind/renderers/chat-code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EAMnB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAY7B,UAAU,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB,CAAC;IAEzB,cAAc,EAAE,cAAc,CAAC;IAE/B,WAAW,EAAE,OAAO,CAAC;IAErB,SAAS,EAAE,OAAO,CAAC;CACpB;AA4BD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,cAAc,EACd,WAAW,EACX,SAAS,GACV,EAAE,kBAAkB,2CAyFpB"}
@@ -21,9 +21,8 @@ function ChatCodeBlock({ block, codeBlockProps, htmlPreview, streaming }) {
21
21
  const { _ } = useLingui();
22
22
  const dialogContainer = useDialogContainer();
23
23
  const previewable = htmlPreview && block.language?.trim().toLowerCase() === 'html';
24
- const [previewedCode, setPreviewedCode] = react.useState(null);
25
- if (!previewable && null !== previewedCode) setPreviewedCode(null);
26
- const showPreview = previewable && !streaming && previewedCode === block.code;
24
+ const [showSource, setShowSource] = react.useState(false);
25
+ const showPreview = previewable && !streaming && !showSource;
27
26
  const [expanded, setExpanded] = react.useState(false);
28
27
  const codeLabel = _({
29
28
  id: 'autopilot-chat.message.code-block-code'
@@ -50,7 +49,7 @@ function ChatCodeBlock({ block, codeBlockProps, htmlPreview, streaming }) {
50
49
  "aria-label": toggleLabel,
51
50
  title: toggleLabel,
52
51
  disabled: streaming,
53
- onClick: ()=>setPreviewedCode(showPreview ? null : block.code),
52
+ onClick: ()=>setShowSource(showPreview),
54
53
  children: showPreview ? /*#__PURE__*/ jsx(Code, {
55
54
  "aria-hidden": true
56
55
  }) : /*#__PURE__*/ jsx(Eye, {