aov-agent 1.0.18 → 1.0.21

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 (20) hide show
  1. package/dist/agent-ui/components/Assistant/AgentButton/AgentButton.js +37 -15
  2. package/dist/agent-ui/components/Assistant/AgentButton/AgentButton.scss +116 -25
  3. package/dist/agent-ui/components/Assistant/Assistant.js +4 -4
  4. package/dist/agent-ui/components/Assistant/AssistantWidget/AssistantWidget.js +75 -160
  5. package/dist/agent-ui/components/Assistant/AssistantWidget/AssistantWidget.scss +414 -61
  6. package/dist/agent-ui/components/Assistant/AssistantWidget/sections/AllSessions.js +114 -0
  7. package/dist/agent-ui/components/Assistant/AssistantWidget/sections/AssistantMessage.js +57 -0
  8. package/dist/agent-ui/components/Assistant/AssistantWidget/sections/ChatHeader.js +51 -0
  9. package/dist/agent-ui/components/Assistant/AssistantWidget/sections/ChatItem.js +94 -0
  10. package/dist/agent-ui/components/Assistant/AssistantWidget/sections/CustomWelcome.js +43 -0
  11. package/dist/agent-ui/components/Assistant/AssistantWidget/sections/ListChat.js +142 -0
  12. package/dist/agent-ui/components/Assistant/ThreadProvider.js +16 -54
  13. package/dist/agent-ui/components/Assistant/ToolResult/CardTool.js +2 -5
  14. package/dist/agent-ui/components/Assistant/ToolResult/ToolResult.js +1 -1
  15. package/dist/agent-ui/hooks/useFetchApi.js +1 -1
  16. package/dist/agent-ui/hooks/useThread.js +78 -0
  17. package/dist/agent-ui/resources/star-icon.svg +14 -0
  18. package/package.json +3 -2
  19. package/dist/agent-ui/components/Assistant/AssistantWidget/components/ListChat.js +0 -129
  20. /package/dist/agent-ui/components/Assistant/AssistantWidget/{components → sections}/CampaignRendered.js +0 -0
@@ -1,25 +1,47 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
+ import StarIcon from "../../../resources/star-icon.svg";
3
4
  import "./AgentButton.scss";
4
- import iconImg from "../../../resources/assistant-avatar.svg";
5
-
6
- /**
7
- * AgentButton - Floating button to trigger AI assistant
8
- *
9
- * @param {Function} onClick - Click handler to open assistant
10
- * @returns {React.ReactElement} Agent button component
11
- */
12
5
  var AgentButton = function AgentButton(_ref) {
13
- var onClick = _ref.onClick;
14
- return /*#__PURE__*/React.createElement("div", {
6
+ var onClick = _ref.onClick,
7
+ isOpen = _ref.isOpen;
8
+ var buttonClass = "aov-agent-button".concat(isOpen ? ' aov-agent-button--compact' : '');
9
+ return /*#__PURE__*/React.createElement("button", {
15
10
  onClick: onClick,
16
- className: "aov-agent-button"
11
+ className: buttonClass
12
+ }, /*#__PURE__*/React.createElement("span", {
13
+ className: "aov-agent-button__icon"
17
14
  }, /*#__PURE__*/React.createElement("img", {
18
- src: iconImg,
19
- alt: "AI Assistant Icon"
20
- }));
15
+ src: StarIcon,
16
+ alt: ""
17
+ })), /*#__PURE__*/React.createElement("span", {
18
+ className: "aov-agent-button__content"
19
+ }, /*#__PURE__*/React.createElement("span", {
20
+ className: "aov-agent-button__text"
21
+ }, "AOV assistant"), /*#__PURE__*/React.createElement("span", {
22
+ className: "aov-agent-button__arrow"
23
+ }, /*#__PURE__*/React.createElement("svg", {
24
+ width: "16",
25
+ height: "16",
26
+ viewBox: "0 0 16 16",
27
+ fill: "none",
28
+ xmlns: "http://www.w3.org/2000/svg"
29
+ }, /*#__PURE__*/React.createElement("circle", {
30
+ cx: "8",
31
+ cy: "8",
32
+ r: "7",
33
+ stroke: "currentColor",
34
+ strokeWidth: "1.5"
35
+ }), /*#__PURE__*/React.createElement("path", {
36
+ d: "M6 5L10 8L6 11",
37
+ stroke: "currentColor",
38
+ strokeWidth: "1.5",
39
+ strokeLinecap: "round",
40
+ strokeLinejoin: "round"
41
+ })))));
21
42
  };
22
43
  AgentButton.propTypes = {
23
- onClick: PropTypes.func.isRequired
44
+ onClick: PropTypes.func.isRequired,
45
+ isOpen: PropTypes.bool
24
46
  };
25
47
  export default AgentButton;
@@ -5,28 +5,32 @@
5
5
  z-index: 380;
6
6
  display: flex;
7
7
  align-items: center;
8
- gap: 6px;
8
+ padding: 8px;
9
9
  border: none;
10
10
  border-radius: 50px;
11
- box-shadow: 0 4px 20px rgba(10, 40, 70, 0.5),
12
- 0 8px 32px rgba(26, 74, 92, 0.4);
11
+ background: linear-gradient(0deg, rgba(0, 205, 174, 0.15) 0%, rgba(0, 205, 174, 0.15) 100%), #FFF;
12
+
13
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1),
14
+ 0 4px 20px rgba(6, 105, 116, 0.15);
13
15
  cursor: pointer;
14
- transition: all 0.3s ease;
15
- max-width: 60px;
16
+ will-change: transform, border-radius, padding;
17
+ transition:
18
+ padding 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
19
+ border-radius 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
20
+ background 0.3s ease,
21
+ box-shadow 0.3s ease;
16
22
 
17
23
  &:hover {
18
- transform: translateY(-2px);
19
- box-shadow: 0 6px 24px rgba(10, 40, 70, 0.6),
20
- 0 12px 40px rgba(26, 74, 92, 0.5);
24
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12),
25
+ 0 8px 32px rgba(6, 105, 116, 0.2);
21
26
  }
22
27
 
23
28
  &:active {
24
- transform: translateY(0);
25
- box-shadow: 0 2px 12px rgba(10, 40, 70, 0.5);
29
+ transform: scale(0.96);
26
30
  }
27
31
 
28
32
  &:focus {
29
- outline: 2px solid #fff;
33
+ outline: 2px solid #066974;
30
34
  outline-offset: 2px;
31
35
  }
32
36
 
@@ -34,24 +38,111 @@
34
38
  outline: none;
35
39
  }
36
40
 
37
- img{
38
- max-width: 100%;
39
- border-radius: 50%;
41
+ &__icon {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ width: 28px;
46
+ height: 28px;
47
+ flex-shrink: 0;
48
+ will-change: transform, width, height;
49
+ transition:
50
+ width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
51
+ height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
52
+ transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
53
+
54
+ img {
55
+ width: 100%;
56
+ height: 100%;
57
+ object-fit: contain;
58
+ }
59
+ }
60
+
61
+ &:hover &__icon {
62
+ transform: scale(1.1) rotate(15deg);
63
+ }
64
+
65
+ &__content {
66
+ display: grid;
67
+ grid-template-columns: 1fr auto;
68
+ align-items: center;
69
+ gap: 6px;
70
+ width: 130px;
71
+ padding-left: 8px;
72
+ padding-right: 4px;
73
+ overflow: hidden;
74
+ will-change: width, opacity, padding;
75
+ transition:
76
+ width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
77
+ padding 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
78
+ opacity 0.25s ease;
79
+ }
80
+
81
+ &__text {
82
+ color: #066974;
83
+ font-size: 14px;
84
+ font-weight: 600;
85
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
86
+ white-space: nowrap;
87
+ letter-spacing: -0.01em;
88
+ will-change: transform, opacity;
89
+ transition:
90
+ transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
91
+ opacity 0.2s ease;
40
92
  }
41
93
 
42
- &__badge {
94
+ &__arrow {
43
95
  display: flex;
44
96
  align-items: center;
45
97
  justify-content: center;
46
- padding: 2px 20px;
47
- border: 2px solid rgba(255, 255, 255, 0.4);
48
- border-radius: 50px;
49
- background: rgba(255, 255, 255, 0.15);
50
- backdrop-filter: blur(4px);
51
- color: #fff;
52
- font-size: 12px;
53
- font-weight: 600;
54
- letter-spacing: 1px;
98
+ color: #066974;
99
+ opacity: 0.6;
100
+ flex-shrink: 0;
101
+ will-change: transform, opacity;
102
+ transition:
103
+ transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
104
+ opacity 0.2s ease;
105
+
106
+ svg {
107
+ width: 16px;
108
+ height: 16px;
109
+ }
55
110
  }
56
- }
57
111
 
112
+ &:hover &__arrow {
113
+ opacity: 1;
114
+ transform: translateX(2px);
115
+ }
116
+
117
+ &--compact {
118
+ padding: 10px;
119
+ border-radius: 50%;
120
+ background: linear-gradient(135deg, #d4f0f2 0%, #e8f4f5 100%);
121
+
122
+ .aov-agent-button__icon {
123
+ width: 32px;
124
+ height: 32px;
125
+ }
126
+
127
+ .aov-agent-button__content {
128
+ width: 0;
129
+ padding-left: 0;
130
+ padding-right: 0;
131
+ opacity: 0;
132
+ }
133
+
134
+ .aov-agent-button__text {
135
+ opacity: 0;
136
+ transform: translateX(-8px);
137
+ }
138
+
139
+ .aov-agent-button__arrow {
140
+ opacity: 0;
141
+ transform: translateX(-8px);
142
+ }
143
+
144
+ &:hover .aov-agent-button__icon {
145
+ transform: scale(1.15);
146
+ }
147
+ }
148
+ }
@@ -2,10 +2,10 @@ import React, { useContext } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { AgentProvider, AgentContext } from "../../contexts/AgentContext.js";
4
4
  import { SuggestionsProvider } from "../../contexts/SuggestionsContext.js";
5
+ import ResizableModal from "../ResizableModal/ResizableModal.js";
5
6
  import AgentButton from "./AgentButton/AgentButton.js";
6
7
  import ThreadProvider from "./ThreadProvider.js";
7
8
  import AssistantWidget from "./AssistantWidget/AssistantWidget.js";
8
- import ResizableModal from "../ResizableModal/ResizableModal.js";
9
9
  import "./Assistant.scss";
10
10
  var AssistantCore = function AssistantCore() {
11
11
  var _useContext = useContext(AgentContext),
@@ -15,8 +15,9 @@ var AssistantCore = function AssistantCore() {
15
15
  className: "aov-assistant-core"
16
16
  }, /*#__PURE__*/React.createElement(AgentButton, {
17
17
  onClick: function onClick() {
18
- return setOpenAgent(true);
19
- }
18
+ return setOpenAgent(!openAgent);
19
+ },
20
+ isOpen: openAgent
20
21
  }), /*#__PURE__*/React.createElement(ResizableModal, {
21
22
  open: openAgent,
22
23
  onClose: function onClose() {
@@ -46,7 +47,6 @@ export var Assistant = function Assistant(_ref) {
46
47
  apiUrl = _ref.apiUrl,
47
48
  appName = _ref.appName,
48
49
  customToolRenderers = _ref.customToolRenderers;
49
- if (!shop.showAgentChat) return null;
50
50
  return /*#__PURE__*/React.createElement(AgentProvider, {
51
51
  contextValue: {
52
52
  appName: appName,
@@ -1,89 +1,34 @@
1
- var _excluded = ["shop"];
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
3
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
4
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
5
5
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6
6
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
7
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
8
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
9
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
11
8
  import React, { useCallback, useState, useContext, useMemo } from "react";
12
9
  import PropTypes from "prop-types";
13
- import { Badge, BlockStack, Box, Button, InlineStack, Popover, Spinner, Text } from "@shopify/polaris";
14
- import { ComposeIcon, XIcon } from "@shopify/polaris-icons";
15
- import { ThreadContext } from "../../../contexts/ThreadContext.js";
16
- import { useThread, useMessage } from "@assistant-ui/react";
10
+ import { Popover, Spinner } from "@shopify/polaris";
17
11
  import { Composer, Thread, ThreadWelcome } from "@assistant-ui/react-ui";
18
- import { MarkdownText } from "../Markdown/MarkdownText.js";
19
- import MathRenderer from "../Markdown/MathRenderer.js";
20
- import { useThreadAutoScrollFix } from "../ThreadProvider.js";
21
- import Suggestions from "../Suggestions/Suggestions.js";
22
12
  import "@assistant-ui/react-markdown/styles/dot.css";
23
- import ToolResult from "../ToolResult/ToolResult.js";
24
- import ListChat from "./components/ListChat.js";
25
- import "./AssistantWidget.scss";
26
- import Avatar from "../../../resources/assistant-avatar.svg";
27
- import { welcomeSuggestions, welComeMessage } from "../../../const/option";
13
+ import { ThreadContext } from "../../../contexts/ThreadContext.js";
14
+ import { useThreadViewport } from "../../../hooks/useThreadViewport.js";
15
+ import Suggestions from "../Suggestions/Suggestions.js";
16
+
17
+ // import Avatar from "@resources/assistant-avatar.svg";
28
18
  import { AgentContext } from "../../../contexts/AgentContext.js";
29
- import { ContactSupportCard } from "../ToolResult/CardTool.js";
30
- var AssistantText = /*#__PURE__*/React.memo(function AssistantText(props) {
31
- try {
32
- return /*#__PURE__*/React.createElement("div", {
33
- className: "assistant-markdown-text"
34
- }, /*#__PURE__*/React.createElement(MathRenderer, null, /*#__PURE__*/React.createElement(MarkdownText, props)));
35
- } catch (err) {
36
- console.error("Error rendering markdown text:", err);
37
- return /*#__PURE__*/React.createElement("div", {
38
- className: "assistant-markdown-text"
39
- }, props.children);
40
- }
41
- });
42
- var AssistantTool = /*#__PURE__*/React.memo(function AssistantTool(_ref) {
43
- var shop = _ref.shop,
44
- props = _objectWithoutProperties(_ref, _excluded);
45
- try {
46
- return /*#__PURE__*/React.createElement(ToolResult, _extends({}, props, {
47
- shop: shop
48
- }));
49
- } catch (err) {
50
- console.error("Error rendering tool result:", err);
51
- return null;
52
- }
53
- });
54
- var AssistantMessageFooter = function AssistantMessageFooter() {
55
- var messages = useThread(function (state) {
56
- return state.messages;
57
- });
58
- var currentMessage = useMessage();
59
- var isRunning = useThread(function (state) {
60
- return state.isRunning;
61
- });
62
- if (isRunning) return null;
63
- var currentIndex = messages.findIndex(function (m) {
64
- return m.id === currentMessage.id;
65
- });
66
- var userMessage = messages.slice(0, currentIndex).reverse().find(function (m) {
67
- return m.role === "user";
68
- });
69
- if (!userMessage) return null;
70
- var userContent = Array.isArray(userMessage.content) ? userMessage.content.filter(function (part) {
71
- return part.type === "text";
72
- }).map(function (part) {
73
- return part.text;
74
- }).join(" ") : userMessage.content;
75
- return /*#__PURE__*/React.createElement(ContactSupportCard, {
76
- userContent: userContent
77
- });
78
- };
79
- var AssistantWidget = function AssistantWidget(_ref2) {
80
- var onClose = _ref2.onClose;
19
+ import ListChat from "./sections/ListChat.js";
20
+ import AllSessions from "./sections/AllSessions.js";
21
+ import ChatHeader from "./sections/ChatHeader.js";
22
+ import CustomWelcome from "./sections/CustomWelcome.js";
23
+ import { AssistantText, AssistantTool, AssistantMessageFooter } from "./sections/AssistantMessage.js";
24
+ import "./AssistantWidget.scss";
25
+ var AssistantWidget = function AssistantWidget(_ref) {
26
+ var onClose = _ref.onClose;
81
27
  var _useContext = useContext(AgentContext),
82
28
  appName = _useContext.appName,
83
29
  shop = _useContext.shop;
84
30
  var _useContext2 = useContext(ThreadContext),
85
31
  threads = _useContext2.threads,
86
- loadingThreads = _useContext2.loadingThreads,
87
32
  getThread = _useContext2.getThread,
88
33
  loadingMessages = _useContext2.loadingMessages,
89
34
  thread = _useContext2.thread,
@@ -91,30 +36,29 @@ var AssistantWidget = function AssistantWidget(_ref2) {
91
36
  resetThread = _useContext2.resetThread,
92
37
  updateThread = _useContext2.updateThread,
93
38
  deleteThread = _useContext2.deleteThread;
94
- var _useThreadAutoScrollF = useThreadAutoScrollFix(),
95
- autoScroll = _useThreadAutoScrollF.autoScroll,
96
- handleScroll = _useThreadAutoScrollF.handleScroll;
39
+ var _useThreadViewport = useThreadViewport(),
40
+ autoScroll = _useThreadViewport.autoScroll,
41
+ handleScroll = _useThreadViewport.handleScroll,
42
+ isRunning = _useThreadViewport.isRunning;
97
43
  var _useState = useState(false),
98
44
  _useState2 = _slicedToArray(_useState, 2),
99
45
  popoverActive = _useState2[0],
100
46
  setPopoverActive = _useState2[1];
47
+ var _useState3 = useState(false),
48
+ _useState4 = _slicedToArray(_useState3, 2),
49
+ showAllSessions = _useState4[0],
50
+ setShowAllSessions = _useState4[1];
101
51
  var togglePopoverActive = useCallback(function () {
102
- return setPopoverActive(function (popoverActive) {
103
- return !popoverActive;
52
+ return setPopoverActive(function (prev) {
53
+ return !prev;
104
54
  });
105
55
  }, []);
106
- var activator = /*#__PURE__*/React.createElement(Box, {
107
- width: "fit-content"
108
- }, /*#__PURE__*/React.createElement(Button, {
109
- onClick: togglePopoverActive,
110
- disclosure: true,
111
- variant: "monochromePlain"
112
- }, /*#__PURE__*/React.createElement(Box, {
113
- width: "fit-content",
114
- minWidth: "60px"
115
- }, /*#__PURE__*/React.createElement(Text, {
116
- truncate: true
117
- }, thread && "title" in thread ? thread.title : "New chat"))));
56
+ var handleNewChat = useCallback(function () {
57
+ setShowAllSessions(false);
58
+ _setThread({});
59
+ resetThread();
60
+ }, [_setThread, resetThread]);
61
+ var isWelcomeScreen = (!thread || !thread.id) && !isRunning && !loadingMessages && !showAllSessions;
118
62
  var assistantComponents = useMemo(function () {
119
63
  return {
120
64
  Text: AssistantText,
@@ -127,82 +71,61 @@ var AssistantWidget = function AssistantWidget(_ref2) {
127
71
  };
128
72
  }, [shop]);
129
73
  return /*#__PURE__*/React.createElement("div", {
130
- className: "AOV-Sidekick__Container"
131
- }, /*#__PURE__*/React.createElement(Box, {
132
- paddingBlockStart: "300",
133
- paddingBlockEnd: "200",
134
- paddingInlineStart: "200",
135
- paddingInlineEnd: "300",
136
- borderBlockEndWidth: "0165",
137
- borderColor: "border-disabled"
138
- }, /*#__PURE__*/React.createElement(InlineStack, {
139
- align: "space-between",
140
- blockAlign: "center",
141
- gap: "100",
142
- wrap: false
143
- }, loadingThreads && !(thread !== null && thread !== void 0 && thread.title) ? /*#__PURE__*/React.createElement(Spinner, {
144
- size: "small"
145
- }) : /*#__PURE__*/React.createElement("div", {
146
- className: "AOV-Sidekick__ChatSelector"
147
- }, /*#__PURE__*/React.createElement(Popover, {
74
+ className: "AOV-Sidekick__Container".concat(isWelcomeScreen ? " AOV-Sidekick__Container--welcome" : "")
75
+ }, /*#__PURE__*/React.createElement(ChatHeader, {
76
+ isWelcomeScreen: isWelcomeScreen,
77
+ onClose: onClose,
78
+ onHistoryClick: togglePopoverActive,
79
+ onNewChat: handleNewChat
80
+ }), /*#__PURE__*/React.createElement(Popover, {
148
81
  active: popoverActive,
149
- activator: activator,
82
+ activator: /*#__PURE__*/React.createElement("div", null),
150
83
  onClose: togglePopoverActive,
151
- preferredAlignment: "start"
84
+ preferredAlignment: "left",
85
+ fullWidth: true
152
86
  }, /*#__PURE__*/React.createElement(ListChat, {
153
87
  threads: threads,
154
- setThread: function setThread(thread) {
88
+ setThread: function setThread(selectedThread) {
155
89
  togglePopoverActive();
156
- if ("id" in thread) {
157
- getThread(thread.id, thread);
90
+ if ("id" in selectedThread) {
91
+ getThread(selectedThread.id, selectedThread);
158
92
  } else {
159
- _setThread(thread);
93
+ _setThread(selectedThread);
160
94
  }
161
95
  },
162
96
  updateThread: updateThread,
163
- deleteThread: deleteThread
164
- }))), /*#__PURE__*/React.createElement(Box, {
165
- width: "90px"
166
- }, /*#__PURE__*/React.createElement(InlineStack, {
167
- wrap: false,
168
- blockAlign: "center",
169
- gap: "100"
170
- }, /*#__PURE__*/React.createElement(Badge, {
171
- tone: "info-strong"
172
- }, "BETA"), /*#__PURE__*/React.createElement(Button, {
173
- icon: ComposeIcon,
174
- variant: "monochromePlain",
175
- onClick: function onClick() {
176
- _setThread({});
177
- resetThread();
97
+ deleteThread: deleteThread,
98
+ onViewAll: function onViewAll() {
99
+ togglePopoverActive();
100
+ setShowAllSessions(true);
101
+ },
102
+ onClose: togglePopoverActive
103
+ })), showAllSessions && /*#__PURE__*/React.createElement(AllSessions, {
104
+ threads: threads,
105
+ setThread: function setThread(selectedThread) {
106
+ setShowAllSessions(false);
107
+ if ("id" in selectedThread) {
108
+ getThread(selectedThread.id, selectedThread);
109
+ } else {
110
+ _setThread(selectedThread);
111
+ }
112
+ },
113
+ updateThread: updateThread,
114
+ deleteThread: deleteThread,
115
+ onBack: function onBack() {
116
+ return setShowAllSessions(false);
178
117
  }
179
- }), /*#__PURE__*/React.createElement(Button, {
180
- icon: XIcon,
181
- variant: "monochromePlain",
182
- onClick: onClose
183
- }))))), /*#__PURE__*/React.createElement(Thread.Root, {
118
+ }), /*#__PURE__*/React.createElement(Thread.Root, {
119
+ className: showAllSessions ? "AOV-Sidekick__Hidden" : "",
184
120
  config: {
185
- welcome: {
186
- message: /*#__PURE__*/React.createElement(BlockStack, {
187
- gap: "200",
188
- inlineAlign: "center"
189
- }, /*#__PURE__*/React.createElement(InlineStack, {
190
- gap: "200",
191
- blockAlign: "center"
192
- }, /*#__PURE__*/React.createElement(Text, {
193
- variant: "headingMd"
194
- }, "Hi! I'm Pemond"), /*#__PURE__*/React.createElement(Badge, {
195
- tone: "info-strong"
196
- }, "BETA")), /*#__PURE__*/React.createElement(Text, {
197
- tone: "subdued"
198
- }, welComeMessage(appName)))
199
- },
200
121
  assistantAvatar: {
201
- src: Avatar,
122
+ src: "",
202
123
  alt: "Pemond"
203
124
  },
204
125
  assistantMessage: {
205
126
  allowEdit: false,
127
+ allowCopy: true,
128
+ allowReload: true,
206
129
  components: assistantComponents
207
130
  },
208
131
  userMessage: {
@@ -216,20 +139,12 @@ var AssistantWidget = function AssistantWidget(_ref2) {
216
139
  className: "AOV-Sidekick__Loading"
217
140
  }, /*#__PURE__*/React.createElement(Spinner, {
218
141
  size: "small"
219
- })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ThreadWelcome.Root, null, /*#__PURE__*/React.createElement(ThreadWelcome.Center, null, /*#__PURE__*/React.createElement(ThreadWelcome.Avatar, {
220
- size: "large"
221
- }), /*#__PURE__*/React.createElement(ThreadWelcome.Message, null)), /*#__PURE__*/React.createElement("div", {
222
- className: "aui-thread-welcome-suggestion-container"
223
- }, welcomeSuggestions(appName).map(function (prompt, index) {
224
- return /*#__PURE__*/React.createElement(ThreadWelcome.Suggestion, {
225
- key: index,
226
- suggestion: {
227
- prompt: prompt
228
- }
229
- });
230
- }))), /*#__PURE__*/React.createElement(Thread.Messages, null))), /*#__PURE__*/React.createElement(Thread.ViewportFooter, null, /*#__PURE__*/React.createElement(Suggestions, null), /*#__PURE__*/React.createElement(Composer.Root, null, /*#__PURE__*/React.createElement(Composer.Input, {
142
+ })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ThreadWelcome.Root, null, /*#__PURE__*/React.createElement(CustomWelcome, {
143
+ appName: appName,
144
+ name: shop === null || shop === void 0 ? void 0 : shop.firstName
145
+ })), /*#__PURE__*/React.createElement(Thread.Messages, null))), /*#__PURE__*/React.createElement(Thread.ViewportFooter, null, /*#__PURE__*/React.createElement(Suggestions, null), /*#__PURE__*/React.createElement(Composer.Root, null, /*#__PURE__*/React.createElement(Composer.Input, {
231
146
  autoFocus: true,
232
- placeholder: "Ask anything ..."
147
+ placeholder: "Ask anything"
233
148
  }), /*#__PURE__*/React.createElement(Composer.Action, null)))));
234
149
  };
235
150
  AssistantWidget.propTypes = {