aov-agent 1.0.0 → 1.0.6
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.
- package/README.md +313 -1
- package/dist/agent-ui/components/Assistant/AgentButton/AgentButton.js +28 -0
- package/dist/agent-ui/components/Assistant/AgentButton/AgentButton.scss +40 -0
- package/dist/agent-ui/components/Assistant/Assistant.js +68 -0
- package/dist/agent-ui/components/Assistant/Assistant.scss +3 -0
- package/dist/agent-ui/components/Assistant/AssistantWidget/AssistantWidget.js +193 -0
- package/dist/agent-ui/components/Assistant/AssistantWidget/AssistantWidget.scss +205 -0
- package/dist/agent-ui/components/Assistant/AssistantWidget/components/CampaignRendered.js +30 -0
- package/dist/agent-ui/components/Assistant/AssistantWidget/components/ListChat.js +129 -0
- package/dist/agent-ui/components/Assistant/Markdown/MarkdownText.js +228 -0
- package/dist/agent-ui/components/Assistant/Markdown/MarkdownText.scss +222 -0
- package/dist/agent-ui/components/Assistant/Markdown/MathRenderer.js +52 -0
- package/dist/agent-ui/components/Assistant/Suggestions/Suggestions.js +62 -0
- package/dist/agent-ui/components/Assistant/Suggestions/Suggestions.scss +22 -0
- package/dist/agent-ui/components/Assistant/ThreadProvider.js +481 -0
- package/dist/agent-ui/components/Assistant/ToolResult/CardTool.js +98 -0
- package/dist/agent-ui/components/Assistant/ToolResult/CardTool.scss +12 -0
- package/dist/agent-ui/components/Assistant/ToolResult/ToolResult.js +44 -0
- package/dist/agent-ui/components/CopyToClipboard/CopyToClipboard.js +43 -0
- package/dist/agent-ui/components/CopyToClipboard/index.js +2 -0
- package/dist/agent-ui/components/ResizableModal/ResizableModal.js +262 -0
- package/dist/agent-ui/components/ResizableModal/ResizableModal.scss +117 -0
- package/dist/agent-ui/const/appName.js +6 -0
- package/dist/agent-ui/const/option.js +9 -0
- package/dist/agent-ui/const/toolName.js +6 -0
- package/dist/agent-ui/contexts/AgentContext.js +54 -0
- package/dist/agent-ui/contexts/SuggestionsContext.js +64 -0
- package/dist/agent-ui/contexts/ThreadContext.js +60 -0
- package/dist/agent-ui/helpers/copyToClipboard.js +33 -0
- package/dist/agent-ui/helpers/formatQuery.js +15 -0
- package/dist/agent-ui/hooks/useFetchApi.js +238 -0
- package/dist/agent-ui/hooks/useStreamApi.js +127 -0
- package/dist/agent-ui/index.js +1 -0
- package/dist/agent-ui/resources/assistant-avatar.svg +51 -0
- package/dist/agent-ui/services/errorService.js +39 -0
- package/dist/agent-ui/utils/api.js +164 -0
- package/package.json +44 -9
- package/dist/index.js +0 -7
- package/types/index.d.ts +0 -5
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Tooltip } from "@shopify/polaris";
|
|
3
|
+
import * as PropTypes from "prop-types";
|
|
4
|
+
import copyToClipboard from "../../helpers/copyToClipboard";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param text
|
|
8
|
+
* @param icon
|
|
9
|
+
* @returns {JSX.Element}
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
export default function CopyToClipboard(_ref) {
|
|
13
|
+
var text = _ref.text,
|
|
14
|
+
_ref$icon = _ref.icon,
|
|
15
|
+
icon = _ref$icon === void 0 ? /*#__PURE__*/React.createElement("svg", {
|
|
16
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
+
width: "20",
|
|
18
|
+
height: "20",
|
|
19
|
+
viewBox: "0 0 20 20",
|
|
20
|
+
fill: "none"
|
|
21
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
fillRule: "evenodd",
|
|
23
|
+
clipRule: "evenodd",
|
|
24
|
+
d: "M8.75 3.5C8.06212 3.49988 7.39916 3.75756 6.89193 4.22221C6.38471 4.68686 6.07003 5.32474 6.01 6.01C5.32474 6.07003 4.68686 6.38471 4.22221 6.89193C3.75756 7.39916 3.49988 8.06212 3.5 8.75V13.75C3.5 14.4793 3.78973 15.1788 4.30546 15.6945C4.82118 16.2103 5.52065 16.5 6.25 16.5H11.25C11.9379 16.5001 12.6008 16.2424 13.1081 15.7778C13.6153 15.3131 13.93 14.6753 13.99 13.99C14.6753 13.93 15.3131 13.6153 15.7778 13.1081C16.2424 12.6008 16.5001 11.9379 16.5 11.25V6.25C16.5 5.52065 16.2103 4.82118 15.6945 4.30546C15.1788 3.78973 14.4793 3.5 13.75 3.5H8.75ZM11.25 6H7.525C7.641 5.43 8.145 5 8.75 5H13.75C14.44 5 15 5.56 15 6.25V11.25C15 11.855 14.57 12.36 14 12.475V8.75C14 8.38886 13.9289 8.03127 13.7907 7.69762C13.6525 7.36398 13.4499 7.06082 13.1945 6.80546C12.9392 6.5501 12.636 6.34753 12.3024 6.20933C11.9687 6.07113 11.6111 6 11.25 6ZM6.25 7.5C5.56 7.5 5 8.06 5 8.75V13.75C5 14.44 5.56 15 6.25 15H11.25C11.94 15 12.5 14.44 12.5 13.75V8.75C12.5 8.06 11.94 7.5 11.25 7.5H6.25Z",
|
|
25
|
+
fill: "#4A4A4A"
|
|
26
|
+
})) : _ref$icon;
|
|
27
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
28
|
+
content: "Click to copy",
|
|
29
|
+
preferredPosition: "above"
|
|
30
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
style: {
|
|
32
|
+
cursor: "pointer",
|
|
33
|
+
pointerEvents: "auto"
|
|
34
|
+
},
|
|
35
|
+
onClick: function onClick() {
|
|
36
|
+
copyToClipboard(text);
|
|
37
|
+
}
|
|
38
|
+
}, icon));
|
|
39
|
+
}
|
|
40
|
+
CopyToClipboard.propTypes = {
|
|
41
|
+
text: PropTypes.string,
|
|
42
|
+
icon: PropTypes.node
|
|
43
|
+
};
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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; } }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import React, { useEffect, useRef, useState, useCallback } from "react";
|
|
8
|
+
import { Portal } from "@shopify/polaris";
|
|
9
|
+
import PropTypes from "prop-types";
|
|
10
|
+
import "./ResizableModal.scss";
|
|
11
|
+
var MIN_WIDTH = 325;
|
|
12
|
+
var MIN_HEIGHT = 200;
|
|
13
|
+
var DEFAULT_WIDTH = 450;
|
|
14
|
+
var DEFAULT_HEIGHT = 400;
|
|
15
|
+
var MAX_WIDTH = 650;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* ResizableModal - A draggable and resizable modal component
|
|
19
|
+
*
|
|
20
|
+
* @param {boolean} open - Whether the modal is open
|
|
21
|
+
* @param {Function} onClose - Callback function when modal closes
|
|
22
|
+
* @param {string} accessibilityLabel - Accessibility label for screen readers
|
|
23
|
+
* @param {React.ReactNode} children - Modal content
|
|
24
|
+
* @param {boolean} disableClickOutsideClose - Disable closing when clicking outside
|
|
25
|
+
* @param {number} initialWidth - Initial width of modal
|
|
26
|
+
* @param {number} initialHeight - Initial height of modal
|
|
27
|
+
* @param {number} minWidth - Minimum width of modal
|
|
28
|
+
* @param {number} minHeight - Minimum height of modal
|
|
29
|
+
* @param {number} maxWidth - Maximum width of modal
|
|
30
|
+
* @returns {React.ReactElement|null} Resizable modal component
|
|
31
|
+
*/
|
|
32
|
+
var ResizableModal = function ResizableModal(_ref) {
|
|
33
|
+
var open = _ref.open,
|
|
34
|
+
onClose = _ref.onClose,
|
|
35
|
+
accessibilityLabel = _ref.accessibilityLabel,
|
|
36
|
+
children = _ref.children,
|
|
37
|
+
_ref$disableClickOuts = _ref.disableClickOutsideClose,
|
|
38
|
+
disableClickOutsideClose = _ref$disableClickOuts === void 0 ? false : _ref$disableClickOuts,
|
|
39
|
+
_ref$initialWidth = _ref.initialWidth,
|
|
40
|
+
initialWidth = _ref$initialWidth === void 0 ? DEFAULT_WIDTH : _ref$initialWidth,
|
|
41
|
+
_ref$initialHeight = _ref.initialHeight,
|
|
42
|
+
initialHeight = _ref$initialHeight === void 0 ? DEFAULT_HEIGHT : _ref$initialHeight,
|
|
43
|
+
_ref$minWidth = _ref.minWidth,
|
|
44
|
+
minWidth = _ref$minWidth === void 0 ? MIN_WIDTH : _ref$minWidth,
|
|
45
|
+
_ref$minHeight = _ref.minHeight,
|
|
46
|
+
minHeight = _ref$minHeight === void 0 ? MIN_HEIGHT : _ref$minHeight,
|
|
47
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
48
|
+
maxWidth = _ref$maxWidth === void 0 ? MAX_WIDTH : _ref$maxWidth;
|
|
49
|
+
var modalRef = useRef(null);
|
|
50
|
+
var _useState = useState(false),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
isClosing = _useState2[0],
|
|
53
|
+
setIsClosing = _useState2[1];
|
|
54
|
+
var _useState3 = useState(open),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
isVisible = _useState4[0],
|
|
57
|
+
setIsVisible = _useState4[1];
|
|
58
|
+
var _useState5 = useState(false),
|
|
59
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
60
|
+
isDragging = _useState6[0],
|
|
61
|
+
setIsDragging = _useState6[1];
|
|
62
|
+
var _useState7 = useState(false),
|
|
63
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
64
|
+
isResizing = _useState8[0],
|
|
65
|
+
setIsResizing = _useState8[1];
|
|
66
|
+
var _useState9 = useState(""),
|
|
67
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
68
|
+
resizeDirection = _useState0[0],
|
|
69
|
+
setResizeDirection = _useState0[1];
|
|
70
|
+
var _useState1 = useState({
|
|
71
|
+
width: initialWidth,
|
|
72
|
+
height: initialHeight
|
|
73
|
+
}),
|
|
74
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
75
|
+
dimensions = _useState10[0],
|
|
76
|
+
setDimensions = _useState10[1];
|
|
77
|
+
var _useState11 = useState({
|
|
78
|
+
x: 0,
|
|
79
|
+
y: 0
|
|
80
|
+
}),
|
|
81
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
82
|
+
position = _useState12[0],
|
|
83
|
+
setPosition = _useState12[1];
|
|
84
|
+
var _useState13 = useState({
|
|
85
|
+
x: 0,
|
|
86
|
+
y: 0
|
|
87
|
+
}),
|
|
88
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
89
|
+
dragStart = _useState14[0],
|
|
90
|
+
setDragStart = _useState14[1];
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
if (open) {
|
|
93
|
+
setIsVisible(true);
|
|
94
|
+
setIsClosing(false);
|
|
95
|
+
setPosition({
|
|
96
|
+
x: 0,
|
|
97
|
+
y: 0
|
|
98
|
+
});
|
|
99
|
+
setDimensions({
|
|
100
|
+
width: initialWidth,
|
|
101
|
+
height: window.innerHeight
|
|
102
|
+
});
|
|
103
|
+
} else if (isVisible) {
|
|
104
|
+
setIsClosing(true);
|
|
105
|
+
var timer = setTimeout(function () {
|
|
106
|
+
setIsVisible(false);
|
|
107
|
+
}, 200);
|
|
108
|
+
return function () {
|
|
109
|
+
return clearTimeout(timer);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}, [open, isVisible, initialWidth]);
|
|
113
|
+
var handleMouseDown = useCallback(function (e, action) {
|
|
114
|
+
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
if (action === "drag") {
|
|
117
|
+
setIsDragging(true);
|
|
118
|
+
setDragStart({
|
|
119
|
+
x: e.clientX - position.x,
|
|
120
|
+
y: e.clientY - position.y
|
|
121
|
+
});
|
|
122
|
+
} else if (action === "resize") {
|
|
123
|
+
setIsResizing(true);
|
|
124
|
+
setResizeDirection(direction);
|
|
125
|
+
}
|
|
126
|
+
}, [position]);
|
|
127
|
+
var handleMouseMove = useCallback(function (e) {
|
|
128
|
+
if (isDragging) {
|
|
129
|
+
var newX = Math.max(0, Math.min(window.innerWidth - dimensions.width, e.clientX - dragStart.x));
|
|
130
|
+
var newY = Math.max(0, Math.min(window.innerHeight - dimensions.height, e.clientY - dragStart.y));
|
|
131
|
+
setPosition({
|
|
132
|
+
x: newX,
|
|
133
|
+
y: newY
|
|
134
|
+
});
|
|
135
|
+
} else if (isResizing && modalRef.current) {
|
|
136
|
+
var rect = modalRef.current.getBoundingClientRect();
|
|
137
|
+
var newWidth = dimensions.width;
|
|
138
|
+
var newHeight = dimensions.height;
|
|
139
|
+
var _newX = position.x;
|
|
140
|
+
var _newY = position.y;
|
|
141
|
+
if (resizeDirection.includes("right")) {
|
|
142
|
+
newWidth = Math.max(minWidth, e.clientX - rect.left);
|
|
143
|
+
}
|
|
144
|
+
if (resizeDirection.includes("left")) {
|
|
145
|
+
var deltaX = rect.left - e.clientX;
|
|
146
|
+
newWidth = Math.max(minWidth, dimensions.width + deltaX);
|
|
147
|
+
if (newWidth > minWidth) {
|
|
148
|
+
_newX = e.clientX;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (resizeDirection.includes("bottom")) {
|
|
152
|
+
newHeight = Math.max(minHeight, e.clientY - rect.top);
|
|
153
|
+
}
|
|
154
|
+
if (resizeDirection.includes("top")) {
|
|
155
|
+
var deltaY = rect.top - e.clientY;
|
|
156
|
+
newHeight = Math.max(minHeight, dimensions.height + deltaY);
|
|
157
|
+
if (newHeight > minHeight) {
|
|
158
|
+
_newY = e.clientY;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (_newX + newWidth > window.innerWidth) {
|
|
162
|
+
newWidth = window.innerWidth - _newX;
|
|
163
|
+
}
|
|
164
|
+
newWidth = Math.min(newWidth, maxWidth);
|
|
165
|
+
if (_newY + newHeight > window.innerHeight) {
|
|
166
|
+
newHeight = window.innerHeight - _newY;
|
|
167
|
+
}
|
|
168
|
+
setDimensions({
|
|
169
|
+
width: newWidth,
|
|
170
|
+
height: newHeight
|
|
171
|
+
});
|
|
172
|
+
setPosition({
|
|
173
|
+
x: _newX,
|
|
174
|
+
y: _newY
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}, [isDragging, isResizing, dragStart, dimensions, position, resizeDirection, minWidth, minHeight, maxWidth]);
|
|
178
|
+
var handleMouseUp = useCallback(function () {
|
|
179
|
+
setIsDragging(false);
|
|
180
|
+
setIsResizing(false);
|
|
181
|
+
setResizeDirection("");
|
|
182
|
+
}, []);
|
|
183
|
+
useEffect(function () {
|
|
184
|
+
if (isDragging || isResizing) {
|
|
185
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
186
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
187
|
+
document.body.style.userSelect = "none";
|
|
188
|
+
}
|
|
189
|
+
return function () {
|
|
190
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
191
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
192
|
+
document.body.style.userSelect = "auto";
|
|
193
|
+
};
|
|
194
|
+
}, [isDragging, isResizing, handleMouseMove, handleMouseUp]);
|
|
195
|
+
var handleClose = useCallback(function () {
|
|
196
|
+
setIsClosing(true);
|
|
197
|
+
var timer = setTimeout(function () {
|
|
198
|
+
onClose();
|
|
199
|
+
}, 200);
|
|
200
|
+
return function () {
|
|
201
|
+
return clearTimeout(timer);
|
|
202
|
+
};
|
|
203
|
+
}, [onClose]);
|
|
204
|
+
useEffect(function () {
|
|
205
|
+
var handleEscapeKey = function handleEscapeKey(event) {
|
|
206
|
+
if (event.key === "Escape") {
|
|
207
|
+
handleClose();
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
if (open) {
|
|
211
|
+
document.addEventListener("keydown", handleEscapeKey);
|
|
212
|
+
document.body.style.overflow = "hidden";
|
|
213
|
+
}
|
|
214
|
+
return function () {
|
|
215
|
+
document.removeEventListener("keydown", handleEscapeKey);
|
|
216
|
+
document.body.style.overflow = "unset";
|
|
217
|
+
};
|
|
218
|
+
}, [open, handleClose]);
|
|
219
|
+
if (!isVisible) return null;
|
|
220
|
+
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("div", {
|
|
221
|
+
className: "Avada-ResizableModal__Container"
|
|
222
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
className: "Avada-ResizableModal__Backdrop ".concat(isClosing ? "Avada-ResizableModal__Backdrop--closing" : "")
|
|
224
|
+
// onMouseDown={() => {
|
|
225
|
+
// if (!disableClickOutsideClose) {
|
|
226
|
+
// handleClose();
|
|
227
|
+
// }
|
|
228
|
+
// }}
|
|
229
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
230
|
+
ref: modalRef,
|
|
231
|
+
className: "Avada-ResizableModal__Content ".concat(isClosing ? "Avada-ResizableModal__Content--closing" : ""),
|
|
232
|
+
role: "dialog",
|
|
233
|
+
"aria-modal": "true",
|
|
234
|
+
"aria-label": accessibilityLabel,
|
|
235
|
+
style: {
|
|
236
|
+
width: dimensions.width,
|
|
237
|
+
height: dimensions.height,
|
|
238
|
+
left: position.x,
|
|
239
|
+
bottom: position.y
|
|
240
|
+
}
|
|
241
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: "Avada-ResizableModal__Body"
|
|
243
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
className: "Avada-ResizableModal__ResizeHandle Avada-ResizableModal__ResizeHandle--right",
|
|
245
|
+
onMouseDown: function onMouseDown(e) {
|
|
246
|
+
return handleMouseDown(e, "resize", "right");
|
|
247
|
+
}
|
|
248
|
+
}))));
|
|
249
|
+
};
|
|
250
|
+
ResizableModal.propTypes = {
|
|
251
|
+
open: PropTypes.bool.isRequired,
|
|
252
|
+
onClose: PropTypes.func.isRequired,
|
|
253
|
+
accessibilityLabel: PropTypes.string,
|
|
254
|
+
children: PropTypes.node,
|
|
255
|
+
disableClickOutsideClose: PropTypes.bool,
|
|
256
|
+
initialWidth: PropTypes.number,
|
|
257
|
+
initialHeight: PropTypes.number,
|
|
258
|
+
minWidth: PropTypes.number,
|
|
259
|
+
minHeight: PropTypes.number,
|
|
260
|
+
maxWidth: PropTypes.number
|
|
261
|
+
};
|
|
262
|
+
export default ResizableModal;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
.Avada-ResizableModal {
|
|
2
|
+
&__Container {
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
z-index: 399;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&__Backdrop {
|
|
14
|
+
position: fixed;
|
|
15
|
+
top: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
left: 0;
|
|
19
|
+
z-index: 10000;
|
|
20
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
21
|
+
pointer-events: auto;
|
|
22
|
+
animation: fadeIn 0.2s ease-in-out;
|
|
23
|
+
|
|
24
|
+
&--closing {
|
|
25
|
+
animation: fadeOut 0.2s ease-in-out forwards;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__Content {
|
|
30
|
+
position: fixed;
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
background-color: #FFFFFF;
|
|
34
|
+
z-index: 10001;
|
|
35
|
+
pointer-events: auto;
|
|
36
|
+
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
37
|
+
animation: slideInFromLeft 0.2s ease-in-out;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
|
|
40
|
+
&--closing {
|
|
41
|
+
animation: slideOutToLeft 0.2s ease-in-out forwards;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@media (max-width: 48em) {
|
|
45
|
+
width: 95vw !important;
|
|
46
|
+
height: 90vh !important;
|
|
47
|
+
left: 2.5vw !important;
|
|
48
|
+
top: 5vh !important;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&__Body {
|
|
53
|
+
flex: 1;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
min-height: 0;
|
|
58
|
+
height: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&__ResizeHandle {
|
|
62
|
+
position: absolute;
|
|
63
|
+
background: transparent;
|
|
64
|
+
|
|
65
|
+
&--right {
|
|
66
|
+
top: 0;
|
|
67
|
+
right: 0;
|
|
68
|
+
bottom: 0;
|
|
69
|
+
width: 4px;
|
|
70
|
+
cursor: e-resize;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
background-color: rgba(0, 123, 255, 0.2);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@keyframes fadeIn {
|
|
80
|
+
from {
|
|
81
|
+
opacity: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
to {
|
|
85
|
+
opacity: 1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@keyframes fadeOut {
|
|
90
|
+
from {
|
|
91
|
+
opacity: 1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
to {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@keyframes slideInFromLeft {
|
|
100
|
+
from {
|
|
101
|
+
transform: translateX(-100%);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
to {
|
|
105
|
+
transform: translateX(0);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@keyframes slideOutToLeft {
|
|
110
|
+
from {
|
|
111
|
+
transform: translateX(0);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
to {
|
|
115
|
+
transform: translateX(-100%);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AOV_APPS } from "./appName";
|
|
2
|
+
export var welcomeSuggestions = function welcomeSuggestions(appName) {
|
|
3
|
+
switch (appName) {
|
|
4
|
+
case AOV_APPS.FG:
|
|
5
|
+
return ["How do I create my first Buy X Get Y campaign?", "How do I set a spending threshold for free gifts?", "How do I customize the Pop-up for my campaign?", "How do I check campaign performance and reports?"];
|
|
6
|
+
default:
|
|
7
|
+
return ["How do I create my first Buy X Get Y campaign?", "How do I set a spending threshold for free gifts?", "How do I customize the Pop-up for my campaign?", "How do I check campaign performance and reports?"];
|
|
8
|
+
}
|
|
9
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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; } }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import React, { createContext, useState } from "react";
|
|
14
|
+
import PropTypes from "prop-types";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Context for managing agent UI visibility state
|
|
18
|
+
*
|
|
19
|
+
* @property {boolean} openAgent - Whether the agent widget is open
|
|
20
|
+
* @property {Function} setOpenAgent - Toggle agent visibility
|
|
21
|
+
* @property {Object} customToolRenderers - Custom renderers for tool results
|
|
22
|
+
* Keys should match tool names from FG_TOOL_NAMES (e.g., 'create_campaign', 'update_campaign')
|
|
23
|
+
* Values are React components that receive { result, args, toolName } props
|
|
24
|
+
*/
|
|
25
|
+
export var AgentContext = /*#__PURE__*/createContext({
|
|
26
|
+
openAgent: false,
|
|
27
|
+
setOpenAgent: function setOpenAgent() {},
|
|
28
|
+
customToolRenderers: {}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* AgentProvider - Provides agent context to children
|
|
33
|
+
*
|
|
34
|
+
* @param {React.ReactNode} children - Child components
|
|
35
|
+
* @returns {React.ReactElement} AgentProvider component
|
|
36
|
+
*/
|
|
37
|
+
export var AgentProvider = function AgentProvider(_ref) {
|
|
38
|
+
var children = _ref.children,
|
|
39
|
+
_ref$contextValue = _ref.contextValue,
|
|
40
|
+
contextValue = _ref$contextValue === void 0 ? {} : _ref$contextValue;
|
|
41
|
+
var _useState = useState(false),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
openAgent = _useState2[0],
|
|
44
|
+
setOpenAgent = _useState2[1];
|
|
45
|
+
return /*#__PURE__*/React.createElement(AgentContext.Provider, {
|
|
46
|
+
value: _objectSpread(_objectSpread({}, contextValue), {}, {
|
|
47
|
+
openAgent: openAgent,
|
|
48
|
+
setOpenAgent: setOpenAgent
|
|
49
|
+
})
|
|
50
|
+
}, children);
|
|
51
|
+
};
|
|
52
|
+
AgentProvider.propTypes = {
|
|
53
|
+
children: PropTypes.node.isRequired
|
|
54
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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; } }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import React, { createContext, useState, useContext } from "react";
|
|
8
|
+
import PropTypes from "prop-types";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Context for managing AI suggestions state
|
|
12
|
+
*/
|
|
13
|
+
var SuggestionsContext = /*#__PURE__*/createContext({
|
|
14
|
+
suggestions: [],
|
|
15
|
+
isVisible: false,
|
|
16
|
+
updateSuggestions: function updateSuggestions() {},
|
|
17
|
+
clearSuggestions: function clearSuggestions() {}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* SuggestionsProvider - Provides suggestions context to children
|
|
22
|
+
*
|
|
23
|
+
* @param {React.ReactNode} children - Child components
|
|
24
|
+
* @returns {React.ReactElement} SuggestionsProvider component
|
|
25
|
+
*/
|
|
26
|
+
export var SuggestionsProvider = function SuggestionsProvider(_ref) {
|
|
27
|
+
var children = _ref.children;
|
|
28
|
+
var _useState = useState([]),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
suggestions = _useState2[0],
|
|
31
|
+
setSuggestions = _useState2[1];
|
|
32
|
+
var _useState3 = useState(true),
|
|
33
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
|
+
isVisible = _useState4[0],
|
|
35
|
+
setIsVisible = _useState4[1];
|
|
36
|
+
var updateSuggestions = function updateSuggestions(newSuggestions) {
|
|
37
|
+
setSuggestions(newSuggestions);
|
|
38
|
+
setIsVisible(true);
|
|
39
|
+
};
|
|
40
|
+
var clearSuggestions = function clearSuggestions() {
|
|
41
|
+
setSuggestions([]);
|
|
42
|
+
setIsVisible(false);
|
|
43
|
+
};
|
|
44
|
+
return /*#__PURE__*/React.createElement(SuggestionsContext.Provider, {
|
|
45
|
+
value: {
|
|
46
|
+
suggestions: suggestions,
|
|
47
|
+
isVisible: isVisible,
|
|
48
|
+
updateSuggestions: updateSuggestions,
|
|
49
|
+
clearSuggestions: clearSuggestions
|
|
50
|
+
}
|
|
51
|
+
}, children);
|
|
52
|
+
};
|
|
53
|
+
SuggestionsProvider.propTypes = {
|
|
54
|
+
children: PropTypes.node.isRequired
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Custom hook to access suggestions context
|
|
59
|
+
*
|
|
60
|
+
* @returns {Object} Suggestions context value
|
|
61
|
+
*/
|
|
62
|
+
export var useSuggestions = function useSuggestions() {
|
|
63
|
+
return useContext(SuggestionsContext);
|
|
64
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
2
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
3
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
|
+
import React, { createContext } from "react";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Context for managing chat thread state and operations
|
|
9
|
+
* Provides thread list, loading states, and CRUD operations
|
|
10
|
+
*/
|
|
11
|
+
export var ThreadContext = /*#__PURE__*/createContext({
|
|
12
|
+
threads: [],
|
|
13
|
+
loadingThreads: false,
|
|
14
|
+
loadingMessages: false,
|
|
15
|
+
getThread: function () {
|
|
16
|
+
var _getThread = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
17
|
+
return _regenerator().w(function (_context) {
|
|
18
|
+
while (1) switch (_context.n) {
|
|
19
|
+
case 0:
|
|
20
|
+
return _context.a(2);
|
|
21
|
+
}
|
|
22
|
+
}, _callee);
|
|
23
|
+
}));
|
|
24
|
+
function getThread() {
|
|
25
|
+
return _getThread.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
return getThread;
|
|
28
|
+
}(),
|
|
29
|
+
thread: {},
|
|
30
|
+
setThread: function setThread() {},
|
|
31
|
+
resetThread: function resetThread() {},
|
|
32
|
+
deleteThread: function () {
|
|
33
|
+
var _deleteThread = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
34
|
+
return _regenerator().w(function (_context2) {
|
|
35
|
+
while (1) switch (_context2.n) {
|
|
36
|
+
case 0:
|
|
37
|
+
return _context2.a(2);
|
|
38
|
+
}
|
|
39
|
+
}, _callee2);
|
|
40
|
+
}));
|
|
41
|
+
function deleteThread() {
|
|
42
|
+
return _deleteThread.apply(this, arguments);
|
|
43
|
+
}
|
|
44
|
+
return deleteThread;
|
|
45
|
+
}(),
|
|
46
|
+
updateThread: function () {
|
|
47
|
+
var _updateThread = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
48
|
+
return _regenerator().w(function (_context3) {
|
|
49
|
+
while (1) switch (_context3.n) {
|
|
50
|
+
case 0:
|
|
51
|
+
return _context3.a(2);
|
|
52
|
+
}
|
|
53
|
+
}, _callee3);
|
|
54
|
+
}));
|
|
55
|
+
function updateThread() {
|
|
56
|
+
return _updateThread.apply(this, arguments);
|
|
57
|
+
}
|
|
58
|
+
return updateThread;
|
|
59
|
+
}()
|
|
60
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} text
|
|
3
|
+
* @returns {*}
|
|
4
|
+
*/
|
|
5
|
+
export default function copyToClipboard(text) {
|
|
6
|
+
if (navigator.clipboard) {
|
|
7
|
+
navigator.clipboard.writeText(text).then(function () {})["catch"](function () {
|
|
8
|
+
fallbackCopyToClipboard(text);
|
|
9
|
+
});
|
|
10
|
+
} else {
|
|
11
|
+
fallbackCopyToClipboard(text);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function fallbackCopyToClipboard(text) {
|
|
15
|
+
var textArea = document.createElement("textarea");
|
|
16
|
+
textArea.value = text;
|
|
17
|
+
|
|
18
|
+
// Avoid scrolling to bottom
|
|
19
|
+
textArea.style.top = "0";
|
|
20
|
+
textArea.style.left = "0";
|
|
21
|
+
textArea.style.position = "fixed";
|
|
22
|
+
document.body.appendChild(textArea);
|
|
23
|
+
textArea.focus();
|
|
24
|
+
textArea.select();
|
|
25
|
+
try {
|
|
26
|
+
var successful = document.execCommand("copy");
|
|
27
|
+
var msg = successful ? "successful" : "unsuccessful";
|
|
28
|
+
console.log("Fallback: Copying text command was " + msg);
|
|
29
|
+
} catch (err) {
|
|
30
|
+
console.error("Fallback: Oops, unable to copy", err);
|
|
31
|
+
}
|
|
32
|
+
document.body.removeChild(textArea);
|
|
33
|
+
}
|