@uipath/apollo-react 4.13.1 → 4.14.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 (31) hide show
  1. package/dist/material/components/ap-chat/components/common/action-button.cjs +7 -33
  2. package/dist/material/components/ap-chat/components/common/action-button.d.ts +3 -9
  3. package/dist/material/components/ap-chat/components/common/action-button.d.ts.map +1 -1
  4. package/dist/material/components/ap-chat/components/common/action-button.js +7 -33
  5. package/dist/material/components/ap-chat/components/input/always-on-voice-button.cjs +183 -0
  6. package/dist/material/components/ap-chat/components/input/always-on-voice-button.d.ts +10 -0
  7. package/dist/material/components/ap-chat/components/input/always-on-voice-button.d.ts.map +1 -0
  8. package/dist/material/components/ap-chat/components/input/always-on-voice-button.js +136 -0
  9. package/dist/material/components/ap-chat/components/input/chat-input-actions.cjs +46 -4
  10. package/dist/material/components/ap-chat/components/input/chat-input-actions.d.ts +4 -1
  11. package/dist/material/components/ap-chat/components/input/chat-input-actions.d.ts.map +1 -1
  12. package/dist/material/components/ap-chat/components/input/chat-input-actions.js +46 -4
  13. package/dist/material/components/ap-chat/components/input/chat-input.cjs +19 -5
  14. package/dist/material/components/ap-chat/components/input/chat-input.d.ts.map +1 -1
  15. package/dist/material/components/ap-chat/components/input/chat-input.js +19 -5
  16. package/dist/material/components/ap-chat/locales/en.cjs +1 -1
  17. package/dist/material/components/ap-chat/locales/en.d.ts.map +1 -1
  18. package/dist/material/components/ap-chat/locales/en.js +1 -1
  19. package/dist/material/components/ap-chat/service/ChatModel.cjs +2 -0
  20. package/dist/material/components/ap-chat/service/ChatModel.d.ts +4 -1
  21. package/dist/material/components/ap-chat/service/ChatModel.d.ts.map +1 -1
  22. package/dist/material/components/ap-chat/service/ChatModel.js +2 -0
  23. package/dist/material/components/ap-chat/service/ChatService.cjs +14 -0
  24. package/dist/material/components/ap-chat/service/ChatService.d.ts +4 -0
  25. package/dist/material/components/ap-chat/service/ChatService.d.ts.map +1 -1
  26. package/dist/material/components/ap-chat/service/ChatService.js +14 -0
  27. package/package.json +1 -1
  28. package/dist/material/components/ap-chat/components/audio/chat-audio.cjs +0 -334
  29. package/dist/material/components/ap-chat/components/audio/chat-audio.d.ts +0 -10
  30. package/dist/material/components/ap-chat/components/audio/chat-audio.d.ts.map +0 -1
  31. package/dist/material/components/ap-chat/components/audio/chat-audio.js +0 -290
@@ -65,13 +65,9 @@ const StyledButtonContainer = (0, material_namespaceObject.styled)('div')(()=>({
65
65
  }
66
66
  }
67
67
  }));
68
- const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default().forwardRef(({ iconName, disabled, iconSize, preventHover, overrideColor, variant = 'outlined', text, tooltip, tooltipPlacement = 'bottom', ariaLabel, ariaDescribedby, title, tabIndex, onMouseEnter, onMouseLeave, onFocus, onBlur, onMouseDown, onMouseUp, onKeyDown, disableInteractiveTooltip = false, 'data-testid': dataTestId, ...props }, ref)=>{
68
+ const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default().forwardRef(({ iconName, disabled, iconSize, preventHover, overrideColor, variant = 'outlined', text, tooltip, tooltipPlacement = 'bottom', ariaLabel, ariaDescribedby, ariaPressed, title, tabIndex, onClick, onMouseEnter, onMouseLeave, onFocus, onBlur, onMouseDown, onMouseUp, onKeyDown, disableInteractiveTooltip = false, 'data-testid': dataTestId }, ref)=>{
69
69
  const [iconColor, setIconColor] = external_react_default().useState('var(--color-icon-default)');
70
70
  const { chatMode } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
71
- const [isPressed, setIsPressed] = external_react_default().useState(false);
72
- const onClick = 'onClick' in props ? props.onClick : ()=>{};
73
- const onPress = 'onPress' in props ? props.onPress : ()=>{};
74
- const onRelease = 'onRelease' in props ? props.onRelease : ()=>{};
75
71
  const showTooltip = tooltip && chatMode !== index_cjs_namespaceObject.AutopilotChatMode.Closed && !disabled;
76
72
  const button = text ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(StyledButtonContainer, {
77
73
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Button, {
@@ -82,10 +78,6 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default(
82
78
  },
83
79
  onMouseLeave: (event)=>{
84
80
  onMouseLeave?.(event);
85
- if (isPressed) {
86
- setIsPressed(false);
87
- onRelease(event);
88
- }
89
81
  if (!preventHover) setIconColor('var(--color-icon-default)');
90
82
  },
91
83
  startIcon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_cjs_namespaceObject.ApIcon, {
@@ -96,6 +88,7 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default(
96
88
  }),
97
89
  "aria-label": ariaLabel,
98
90
  "aria-describedby": ariaDescribedby,
91
+ "aria-pressed": ariaPressed,
99
92
  title: showTooltip ? void 0 : title,
100
93
  variant: "text",
101
94
  size: "small",
@@ -103,16 +96,8 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default(
103
96
  onClick: onClick,
104
97
  onFocus: onFocus,
105
98
  onBlur: onBlur,
106
- onMouseDown: (event)=>{
107
- onMouseDown?.(event);
108
- setIsPressed(true);
109
- onPress(event);
110
- },
111
- onMouseUp: (event)=>{
112
- onMouseUp?.(event);
113
- setIsPressed(false);
114
- onRelease(event);
115
- },
99
+ onMouseDown: onMouseDown,
100
+ onMouseUp: onMouseUp,
116
101
  tabIndex: tabIndex,
117
102
  onKeyDown: onKeyDown,
118
103
  "data-testid": dataTestId,
@@ -125,20 +110,13 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default(
125
110
  onClick: onClick,
126
111
  onFocus: onFocus,
127
112
  onBlur: onBlur,
128
- onMouseDown: (event)=>{
129
- onMouseDown?.(event);
130
- setIsPressed(true);
131
- onPress(event);
132
- },
133
- onMouseUp: (event)=>{
134
- onMouseUp?.(event);
135
- setIsPressed(false);
136
- onRelease(event);
137
- },
113
+ onMouseDown: onMouseDown,
114
+ onMouseUp: onMouseUp,
138
115
  tabIndex: tabIndex,
139
116
  onKeyDown: onKeyDown,
140
117
  "aria-label": ariaLabel,
141
118
  "aria-describedby": ariaDescribedby,
119
+ "aria-pressed": ariaPressed,
142
120
  title: showTooltip ? void 0 : title,
143
121
  onMouseEnter: (event)=>{
144
122
  onMouseEnter?.(event);
@@ -146,10 +124,6 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ external_react_default(
146
124
  },
147
125
  onMouseLeave: (event)=>{
148
126
  onMouseLeave?.(event);
149
- if (isPressed) {
150
- setIsPressed(false);
151
- onRelease(event);
152
- }
153
127
  if (!preventHover) setIconColor('var(--color-icon-default)');
154
128
  },
155
129
  "data-testid": dataTestId,
@@ -1,7 +1,6 @@
1
1
  import { type TooltipProps } from '@mui/material';
2
2
  import React from 'react';
3
- type AutopilotChatActionButtonProps = AutopilotChatActionButtonBaseProps & (AutopilotChatActionButtonClickProps | AutopilotChatActionButtonPressProps);
4
- interface AutopilotChatActionButtonBaseProps {
3
+ interface AutopilotChatActionButtonProps {
5
4
  iconName: string;
6
5
  iconSize?: string;
7
6
  disabled?: boolean;
@@ -13,9 +12,11 @@ interface AutopilotChatActionButtonBaseProps {
13
12
  tooltipPlacement?: TooltipProps['placement'];
14
13
  ariaLabel?: string;
15
14
  ariaDescribedby?: string;
15
+ ariaPressed?: boolean;
16
16
  title?: string;
17
17
  tabIndex?: number;
18
18
  disableInteractiveTooltip?: boolean;
19
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
19
20
  onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;
20
21
  onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;
21
22
  onMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void;
@@ -25,13 +26,6 @@ interface AutopilotChatActionButtonBaseProps {
25
26
  onMouseLeave?: (event: React.MouseEvent<HTMLElement>) => void;
26
27
  'data-testid'?: string;
27
28
  }
28
- interface AutopilotChatActionButtonClickProps {
29
- onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
30
- }
31
- interface AutopilotChatActionButtonPressProps {
32
- onPress: (event: React.MouseEvent<HTMLButtonElement>) => void;
33
- onRelease: (event: React.MouseEvent<HTMLButtonElement>) => void;
34
- }
35
29
  export declare const AutopilotChatActionButton: React.NamedExoticComponent<AutopilotChatActionButtonProps & React.RefAttributes<HTMLButtonElement>>;
36
30
  export {};
37
31
  //# sourceMappingURL=action-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-button.d.ts","sourceRoot":"","sources":["../../../../../../src/material/components/ap-chat/components/common/action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlE,OAAO,KAAK,MAAM,OAAO,CAAC;AA4B1B,KAAK,8BAA8B,GAAG,kCAAkC,GACtE,CAAC,mCAAmC,GAAG,mCAAmC,CAAC,CAAC;AAE9E,UAAU,kCAAkC;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gBAAgB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC/D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9D,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACnE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACjE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACpE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC9D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,mCAAmC;IAC3C,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAC/D;AAED,UAAU,mCAAmC;IAC3C,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9D,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACjE;AAwKD,eAAO,MAAM,yBAAyB,qGAAiD,CAAC"}
1
+ {"version":3,"file":"action-button.d.ts","sourceRoot":"","sources":["../../../../../../src/material/components/ap-chat/components/common/action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlE,OAAO,KAAK,MAAM,OAAO,CAAC;AAyB1B,UAAU,8BAA8B;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,gBAAgB,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC/D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9D,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACnE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACjE,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACpE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC9D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA0ID,eAAO,MAAM,yBAAyB,qGAAiD,CAAC"}
@@ -26,13 +26,9 @@ const StyledButtonContainer = styled('div')(()=>({
26
26
  }
27
27
  }
28
28
  }));
29
- const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ iconName, disabled, iconSize, preventHover, overrideColor, variant = 'outlined', text, tooltip, tooltipPlacement = 'bottom', ariaLabel, ariaDescribedby, title, tabIndex, onMouseEnter, onMouseLeave, onFocus, onBlur, onMouseDown, onMouseUp, onKeyDown, disableInteractiveTooltip = false, 'data-testid': dataTestId, ...props }, ref)=>{
29
+ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ iconName, disabled, iconSize, preventHover, overrideColor, variant = 'outlined', text, tooltip, tooltipPlacement = 'bottom', ariaLabel, ariaDescribedby, ariaPressed, title, tabIndex, onClick, onMouseEnter, onMouseLeave, onFocus, onBlur, onMouseDown, onMouseUp, onKeyDown, disableInteractiveTooltip = false, 'data-testid': dataTestId }, ref)=>{
30
30
  const [iconColor, setIconColor] = react.useState('var(--color-icon-default)');
31
31
  const { chatMode } = useChatState();
32
- const [isPressed, setIsPressed] = react.useState(false);
33
- const onClick = 'onClick' in props ? props.onClick : ()=>{};
34
- const onPress = 'onPress' in props ? props.onPress : ()=>{};
35
- const onRelease = 'onRelease' in props ? props.onRelease : ()=>{};
36
32
  const showTooltip = tooltip && chatMode !== AutopilotChatMode.Closed && !disabled;
37
33
  const button = text ? /*#__PURE__*/ jsx(StyledButtonContainer, {
38
34
  children: /*#__PURE__*/ jsx(Button, {
@@ -43,10 +39,6 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
43
39
  },
44
40
  onMouseLeave: (event)=>{
45
41
  onMouseLeave?.(event);
46
- if (isPressed) {
47
- setIsPressed(false);
48
- onRelease(event);
49
- }
50
42
  if (!preventHover) setIconColor('var(--color-icon-default)');
51
43
  },
52
44
  startIcon: /*#__PURE__*/ jsx(ApIcon, {
@@ -57,6 +49,7 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
57
49
  }),
58
50
  "aria-label": ariaLabel,
59
51
  "aria-describedby": ariaDescribedby,
52
+ "aria-pressed": ariaPressed,
60
53
  title: showTooltip ? void 0 : title,
61
54
  variant: "text",
62
55
  size: "small",
@@ -64,16 +57,8 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
64
57
  onClick: onClick,
65
58
  onFocus: onFocus,
66
59
  onBlur: onBlur,
67
- onMouseDown: (event)=>{
68
- onMouseDown?.(event);
69
- setIsPressed(true);
70
- onPress(event);
71
- },
72
- onMouseUp: (event)=>{
73
- onMouseUp?.(event);
74
- setIsPressed(false);
75
- onRelease(event);
76
- },
60
+ onMouseDown: onMouseDown,
61
+ onMouseUp: onMouseUp,
77
62
  tabIndex: tabIndex,
78
63
  onKeyDown: onKeyDown,
79
64
  "data-testid": dataTestId,
@@ -86,20 +71,13 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
86
71
  onClick: onClick,
87
72
  onFocus: onFocus,
88
73
  onBlur: onBlur,
89
- onMouseDown: (event)=>{
90
- onMouseDown?.(event);
91
- setIsPressed(true);
92
- onPress(event);
93
- },
94
- onMouseUp: (event)=>{
95
- onMouseUp?.(event);
96
- setIsPressed(false);
97
- onRelease(event);
98
- },
74
+ onMouseDown: onMouseDown,
75
+ onMouseUp: onMouseUp,
99
76
  tabIndex: tabIndex,
100
77
  onKeyDown: onKeyDown,
101
78
  "aria-label": ariaLabel,
102
79
  "aria-describedby": ariaDescribedby,
80
+ "aria-pressed": ariaPressed,
103
81
  title: showTooltip ? void 0 : title,
104
82
  onMouseEnter: (event)=>{
105
83
  onMouseEnter?.(event);
@@ -107,10 +85,6 @@ const AutopilotChatActionButtonComponent = /*#__PURE__*/ react.forwardRef(({ ico
107
85
  },
108
86
  onMouseLeave: (event)=>{
109
87
  onMouseLeave?.(event);
110
- if (isPressed) {
111
- setIsPressed(false);
112
- onRelease(event);
113
- }
114
88
  if (!preventHover) setIconColor('var(--color-icon-default)');
115
89
  },
116
90
  "data-testid": dataTestId,
@@ -0,0 +1,183 @@
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
+ AlwaysOnVoiceButton: ()=>AlwaysOnVoiceButton,
37
+ VoiceButtonContainer: ()=>VoiceButtonContainer
38
+ });
39
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
40
+ const react_namespaceObject = require("@lingui/react");
41
+ const material_namespaceObject = require("@mui/material");
42
+ const apollo_core_namespaceObject = require("@uipath/apollo-core");
43
+ var apollo_core_default = /*#__PURE__*/ __webpack_require__.n(apollo_core_namespaceObject);
44
+ const external_react_namespaceObject = require("react");
45
+ const chat_service_provider_cjs_namespaceObject = require("../../providers/chat-service.provider.cjs");
46
+ const index_cjs_namespaceObject = require("../../service/index.cjs");
47
+ const chat_audio_input_cjs_namespaceObject = require("../audio/chat-audio-input.cjs");
48
+ const chat_audio_output_cjs_namespaceObject = require("../audio/chat-audio-output.cjs");
49
+ const action_button_cjs_namespaceObject = require("../common/action-button.cjs");
50
+ const VoiceButtonContainer = (0, material_namespaceObject.styled)('div', {
51
+ shouldForwardProp: (prop)=>'active' !== prop
52
+ })(({ active })=>({
53
+ '& .MuiIconButton-root': {
54
+ borderRadius: apollo_core_default().Border.BorderRadiusM,
55
+ ...active && {
56
+ backgroundColor: "var(--color-foreground) !important",
57
+ '&:hover, &:active, &:focus': {
58
+ backgroundColor: "var(--color-foreground-de-emp) !important"
59
+ }
60
+ }
61
+ }
62
+ }));
63
+ const AlwaysOnVoiceButton = ({ disabled = false, onActiveChange })=>{
64
+ const { _ } = (0, react_namespaceObject.useLingui)();
65
+ const [isActive, setIsActive] = (0, external_react_namespaceObject.useState)(false);
66
+ const chatService = (0, chat_service_provider_cjs_namespaceObject.useChatService)();
67
+ const isActiveRef = (0, external_react_namespaceObject.useRef)(false);
68
+ const onActiveChangeRef = (0, external_react_namespaceObject.useRef)(onActiveChange);
69
+ onActiveChangeRef.current = onActiveChange;
70
+ const { queueOutputAudio, clearOutputAudioQueue } = (0, chat_audio_output_cjs_namespaceObject.useAudioOutput)();
71
+ (0, external_react_namespaceObject.useEffect)(()=>{
72
+ if (!chatService) return;
73
+ return chatService.on(index_cjs_namespaceObject.AutopilotChatEvent.OutputStream, (event)=>{
74
+ if (!isActiveRef.current) return;
75
+ if (event.mediaChunks) {
76
+ for (const chunk of event.mediaChunks)if (chunk.mimeType.startsWith('audio/pcm;')) queueOutputAudio(chunk.mimeType, chunk.data, chunk.sequenceNumber);
77
+ }
78
+ if (event.interrupted) clearOutputAudioQueue();
79
+ });
80
+ }, [
81
+ chatService,
82
+ queueOutputAudio,
83
+ clearOutputAudioQueue
84
+ ]);
85
+ const handleAudioInputStart = (0, external_react_namespaceObject.useCallback)((automaticActivityDetectionEnabled)=>{
86
+ if (!chatService) return;
87
+ isActiveRef.current = true;
88
+ setIsActive(true);
89
+ onActiveChangeRef.current?.(true);
90
+ chatService.sendInputStreamEvent({
91
+ activityStart: {
92
+ automaticActivityDetectionEnabled
93
+ }
94
+ });
95
+ }, [
96
+ chatService
97
+ ]);
98
+ const handleAudioInputEnd = (0, external_react_namespaceObject.useCallback)((sequenceNumber)=>{
99
+ if (!chatService) return;
100
+ isActiveRef.current = false;
101
+ setIsActive(false);
102
+ onActiveChangeRef.current?.(false);
103
+ clearOutputAudioQueue();
104
+ chatService.sendInputStreamEvent({
105
+ activityEnd: {
106
+ sequenceNumber
107
+ }
108
+ });
109
+ }, [
110
+ chatService,
111
+ clearOutputAudioQueue
112
+ ]);
113
+ const handleAudioInputData = (0, external_react_namespaceObject.useCallback)((mimeType, data, sequenceNumber)=>{
114
+ if (!chatService) return;
115
+ chatService.sendInputStreamEvent({
116
+ mediaChunks: [
117
+ {
118
+ mimeType,
119
+ data,
120
+ sequenceNumber
121
+ }
122
+ ]
123
+ });
124
+ }, [
125
+ chatService
126
+ ]);
127
+ const { startAudioInput, stopAudioInput } = (0, chat_audio_input_cjs_namespaceObject.useAudioInput)({
128
+ handleAudioInputData,
129
+ handleAudioInputStart,
130
+ handleAudioInputEnd
131
+ });
132
+ (0, external_react_namespaceObject.useEffect)(()=>()=>{
133
+ if (isActiveRef.current) {
134
+ isActiveRef.current = false;
135
+ stopAudioInput();
136
+ clearOutputAudioQueue();
137
+ onActiveChangeRef.current?.(false);
138
+ }
139
+ }, [
140
+ stopAudioInput,
141
+ clearOutputAudioQueue
142
+ ]);
143
+ const handleClick = (0, external_react_namespaceObject.useCallback)(async ()=>{
144
+ if (disabled) return;
145
+ if (isActive) stopAudioInput();
146
+ else await startAudioInput(true);
147
+ }, [
148
+ disabled,
149
+ isActive,
150
+ startAudioInput,
151
+ stopAudioInput
152
+ ]);
153
+ const iconColor = disabled ? 'var(--color-foreground-disable)' : isActive ? 'var(--color-background)' : void 0;
154
+ const stopLabel = _({
155
+ id: 'autopilot-chat.input.actions.stop'
156
+ });
157
+ const voiceLabel = _({
158
+ id: 'autopilot-chat.input.actions.voice-interaction'
159
+ });
160
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VoiceButtonContainer, {
161
+ active: isActive,
162
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(action_button_cjs_namespaceObject.AutopilotChatActionButton, {
163
+ iconName: isActive ? 'stop' : 'graphic_eq',
164
+ tooltip: isActive ? stopLabel : voiceLabel,
165
+ overrideColor: iconColor,
166
+ preventHover: true,
167
+ disabled: disabled,
168
+ onClick: handleClick,
169
+ "data-testid": "autopilot-chat-always-on-voice-button",
170
+ ariaLabel: isActive ? stopLabel : voiceLabel,
171
+ ariaPressed: isActive
172
+ })
173
+ });
174
+ };
175
+ exports.AlwaysOnVoiceButton = __webpack_exports__.AlwaysOnVoiceButton;
176
+ exports.VoiceButtonContainer = __webpack_exports__.VoiceButtonContainer;
177
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
178
+ "AlwaysOnVoiceButton",
179
+ "VoiceButtonContainer"
180
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
181
+ Object.defineProperty(exports, '__esModule', {
182
+ value: true
183
+ });
@@ -0,0 +1,10 @@
1
+ export declare const VoiceButtonContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
2
+ active?: boolean;
3
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
4
+ interface AlwaysOnVoiceButtonProps {
5
+ disabled?: boolean;
6
+ onActiveChange?: (isActive: boolean) => void;
7
+ }
8
+ export declare const AlwaysOnVoiceButton: ({ disabled, onActiveChange, }: AlwaysOnVoiceButtonProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=always-on-voice-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"always-on-voice-button.d.ts","sourceRoot":"","sources":["../../../../../../src/material/components/ap-chat/components/input/always-on-voice-button.tsx"],"names":[],"mappings":"AAiBA,eAAO,MAAM,oBAAoB;aAEnB,OAAO;yGAUlB,CAAC;AAEJ,UAAU,wBAAwB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAOD,eAAO,MAAM,mBAAmB,GAAI,+BAGjC,wBAAwB,4CA4I1B,CAAC"}
@@ -0,0 +1,136 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useLingui } from "@lingui/react";
3
+ import { styled } from "@mui/material";
4
+ import apollo_core from "@uipath/apollo-core";
5
+ import { useCallback, useEffect, useRef, useState } from "react";
6
+ import { useChatService } from "../../providers/chat-service.provider.js";
7
+ import { AutopilotChatEvent } from "../../service/index.js";
8
+ import { useAudioInput } from "../audio/chat-audio-input.js";
9
+ import { useAudioOutput } from "../audio/chat-audio-output.js";
10
+ import { AutopilotChatActionButton } from "../common/action-button.js";
11
+ const VoiceButtonContainer = styled('div', {
12
+ shouldForwardProp: (prop)=>'active' !== prop
13
+ })(({ active })=>({
14
+ '& .MuiIconButton-root': {
15
+ borderRadius: apollo_core.Border.BorderRadiusM,
16
+ ...active && {
17
+ backgroundColor: "var(--color-foreground) !important",
18
+ '&:hover, &:active, &:focus': {
19
+ backgroundColor: "var(--color-foreground-de-emp) !important"
20
+ }
21
+ }
22
+ }
23
+ }));
24
+ const AlwaysOnVoiceButton = ({ disabled = false, onActiveChange })=>{
25
+ const { _ } = useLingui();
26
+ const [isActive, setIsActive] = useState(false);
27
+ const chatService = useChatService();
28
+ const isActiveRef = useRef(false);
29
+ const onActiveChangeRef = useRef(onActiveChange);
30
+ onActiveChangeRef.current = onActiveChange;
31
+ const { queueOutputAudio, clearOutputAudioQueue } = useAudioOutput();
32
+ useEffect(()=>{
33
+ if (!chatService) return;
34
+ return chatService.on(AutopilotChatEvent.OutputStream, (event)=>{
35
+ if (!isActiveRef.current) return;
36
+ if (event.mediaChunks) {
37
+ for (const chunk of event.mediaChunks)if (chunk.mimeType.startsWith('audio/pcm;')) queueOutputAudio(chunk.mimeType, chunk.data, chunk.sequenceNumber);
38
+ }
39
+ if (event.interrupted) clearOutputAudioQueue();
40
+ });
41
+ }, [
42
+ chatService,
43
+ queueOutputAudio,
44
+ clearOutputAudioQueue
45
+ ]);
46
+ const handleAudioInputStart = useCallback((automaticActivityDetectionEnabled)=>{
47
+ if (!chatService) return;
48
+ isActiveRef.current = true;
49
+ setIsActive(true);
50
+ onActiveChangeRef.current?.(true);
51
+ chatService.sendInputStreamEvent({
52
+ activityStart: {
53
+ automaticActivityDetectionEnabled
54
+ }
55
+ });
56
+ }, [
57
+ chatService
58
+ ]);
59
+ const handleAudioInputEnd = useCallback((sequenceNumber)=>{
60
+ if (!chatService) return;
61
+ isActiveRef.current = false;
62
+ setIsActive(false);
63
+ onActiveChangeRef.current?.(false);
64
+ clearOutputAudioQueue();
65
+ chatService.sendInputStreamEvent({
66
+ activityEnd: {
67
+ sequenceNumber
68
+ }
69
+ });
70
+ }, [
71
+ chatService,
72
+ clearOutputAudioQueue
73
+ ]);
74
+ const handleAudioInputData = useCallback((mimeType, data, sequenceNumber)=>{
75
+ if (!chatService) return;
76
+ chatService.sendInputStreamEvent({
77
+ mediaChunks: [
78
+ {
79
+ mimeType,
80
+ data,
81
+ sequenceNumber
82
+ }
83
+ ]
84
+ });
85
+ }, [
86
+ chatService
87
+ ]);
88
+ const { startAudioInput, stopAudioInput } = useAudioInput({
89
+ handleAudioInputData,
90
+ handleAudioInputStart,
91
+ handleAudioInputEnd
92
+ });
93
+ useEffect(()=>()=>{
94
+ if (isActiveRef.current) {
95
+ isActiveRef.current = false;
96
+ stopAudioInput();
97
+ clearOutputAudioQueue();
98
+ onActiveChangeRef.current?.(false);
99
+ }
100
+ }, [
101
+ stopAudioInput,
102
+ clearOutputAudioQueue
103
+ ]);
104
+ const handleClick = useCallback(async ()=>{
105
+ if (disabled) return;
106
+ if (isActive) stopAudioInput();
107
+ else await startAudioInput(true);
108
+ }, [
109
+ disabled,
110
+ isActive,
111
+ startAudioInput,
112
+ stopAudioInput
113
+ ]);
114
+ const iconColor = disabled ? 'var(--color-foreground-disable)' : isActive ? 'var(--color-background)' : void 0;
115
+ const stopLabel = _({
116
+ id: 'autopilot-chat.input.actions.stop'
117
+ });
118
+ const voiceLabel = _({
119
+ id: 'autopilot-chat.input.actions.voice-interaction'
120
+ });
121
+ return /*#__PURE__*/ jsx(VoiceButtonContainer, {
122
+ active: isActive,
123
+ children: /*#__PURE__*/ jsx(AutopilotChatActionButton, {
124
+ iconName: isActive ? 'stop' : 'graphic_eq',
125
+ tooltip: isActive ? stopLabel : voiceLabel,
126
+ overrideColor: iconColor,
127
+ preventHover: true,
128
+ disabled: disabled,
129
+ onClick: handleClick,
130
+ "data-testid": "autopilot-chat-always-on-voice-button",
131
+ ariaLabel: isActive ? stopLabel : voiceLabel,
132
+ ariaPressed: isActive
133
+ })
134
+ });
135
+ };
136
+ export { AlwaysOnVoiceButton, VoiceButtonContainer };
@@ -44,13 +44,15 @@ const external_react_namespaceObject = require("react");
44
44
  var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
45
45
  const index_cjs_namespaceObject = require("../../../ap-typography/index.cjs");
46
46
  const attachements_provider_cjs_namespaceObject = require("../../providers/attachements-provider.cjs");
47
+ const chat_service_provider_cjs_namespaceObject = require("../../providers/chat-service.provider.cjs");
47
48
  const chat_state_provider_cjs_namespaceObject = require("../../providers/chat-state-provider.cjs");
48
49
  const error_provider_cjs_namespaceObject = require("../../providers/error-provider.cjs");
49
50
  const picker_provider_cjs_namespaceObject = require("../../providers/picker-provider.cjs");
51
+ const external_service_index_cjs_namespaceObject = require("../../service/index.cjs");
50
52
  const file_reader_cjs_namespaceObject = require("../../utils/file-reader.cjs");
51
- const chat_audio_cjs_namespaceObject = require("../audio/chat-audio.cjs");
52
53
  const action_button_cjs_namespaceObject = require("../common/action-button.cjs");
53
54
  const shared_controls_cjs_namespaceObject = require("../common/shared-controls.cjs");
55
+ const external_always_on_voice_button_cjs_namespaceObject = require("./always-on-voice-button.cjs");
54
56
  const external_chat_input_agent_mode_selector_cjs_namespaceObject = require("./chat-input-agent-mode-selector.cjs");
55
57
  const external_chat_input_model_picker_cjs_namespaceObject = require("./chat-input-model-picker.cjs");
56
58
  const external_chat_input_resource_trigger_cjs_namespaceObject = require("./chat-input-resource-trigger.cjs");
@@ -75,12 +77,28 @@ const SubmitButtonContainer = (0, material_namespaceObject.styled)('div')(()=>({
75
77
  }
76
78
  }
77
79
  }));
78
- function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waitingResponse, onResourceTriggerClick }) {
80
+ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, isInputEmpty, waitingResponse, onResourceTriggerClick, onVoiceInteractionChange, isVoiceInteractionActive }) {
79
81
  const { _ } = (0, react_namespaceObject.useLingui)();
82
+ const chatService = (0, chat_service_provider_cjs_namespaceObject.useChatService)();
80
83
  const { addAttachments } = (0, attachements_provider_cjs_namespaceObject.useAttachments)();
81
84
  const { setError } = (0, error_provider_cjs_namespaceObject.useError)();
82
85
  const { disabledFeatures, allowedAttachments } = (0, chat_state_provider_cjs_namespaceObject.useChatState)();
83
86
  const { models, agentModes } = (0, picker_provider_cjs_namespaceObject.usePicker)();
87
+ const [isSpeechToTextActive, setIsSpeechToTextActive] = external_react_default().useState(()=>chatService?.isSpeechToTextActive ?? false);
88
+ external_react_default().useEffect(()=>{
89
+ if (!chatService) return;
90
+ setIsSpeechToTextActive(chatService.isSpeechToTextActive);
91
+ return chatService.on(external_service_index_cjs_namespaceObject.AutopilotChatEvent.SetSpeechToTextState, (isActive)=>{
92
+ setIsSpeechToTextActive(isActive);
93
+ });
94
+ }, [
95
+ chatService
96
+ ]);
97
+ const handleSpeechToTextClick = external_react_default().useCallback(()=>{
98
+ chatService?.publishSpeechToTextToggle();
99
+ }, [
100
+ chatService
101
+ ]);
84
102
  const fileInputRef = external_react_default().useRef(null);
85
103
  const handleFileButtonClick = ()=>{
86
104
  if (fileInputRef.current) {
@@ -150,6 +168,7 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
150
168
  acceptedExtensions,
151
169
  _
152
170
  ]);
171
+ const showVoice = false === disabledFeatures.audioStreaming && (isVoiceInteractionActive || !!isInputEmpty && !waitingResponse);
153
172
  const hasMultipleFeatures = [
154
173
  !disabledFeatures.attachments,
155
174
  models.length > 0,
@@ -158,6 +177,9 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
158
177
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(InputActionsContainer, {
159
178
  children: [
160
179
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(InputActionsGroup, {
180
+ style: isVoiceInteractionActive ? {
181
+ visibility: 'hidden'
182
+ } : void 0,
161
183
  children: [
162
184
  !disabledFeatures.attachments && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
163
185
  children: [
@@ -250,8 +272,28 @@ function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waiti
250
272
  }),
251
273
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(InputActionsGroup, {
252
274
  children: [
253
- !disabledFeatures.audio && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(chat_audio_cjs_namespaceObject.AutopilotChatAudio, {}),
254
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SubmitButtonContainer, {
275
+ !isVoiceInteractionActive && !disabledFeatures.audio && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_always_on_voice_button_cjs_namespaceObject.VoiceButtonContainer, {
276
+ active: isSpeechToTextActive,
277
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(action_button_cjs_namespaceObject.AutopilotChatActionButton, {
278
+ iconName: "mic",
279
+ onClick: handleSpeechToTextClick,
280
+ tooltipPlacement: "top",
281
+ tooltip: _({
282
+ id: 'autopilot-chat.input.actions.dictate'
283
+ }),
284
+ overrideColor: isSpeechToTextActive ? 'var(--color-background)' : void 0,
285
+ "data-testid": "autopilot-chat-stt-button",
286
+ ariaLabel: _({
287
+ id: 'autopilot-chat.input.actions.dictate'
288
+ }),
289
+ ariaPressed: isSpeechToTextActive
290
+ })
291
+ }),
292
+ showVoice && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_always_on_voice_button_cjs_namespaceObject.AlwaysOnVoiceButton, {
293
+ disabled: isSpeechToTextActive,
294
+ onActiveChange: onVoiceInteractionChange
295
+ }),
296
+ !showVoice && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SubmitButtonContainer, {
255
297
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(action_button_cjs_namespaceObject.AutopilotChatActionButton, {
256
298
  iconName: waitingResponse ? 'stop' : 'arrow_upward',
257
299
  tooltip: waitingResponse ? _({
@@ -2,10 +2,13 @@ import React from 'react';
2
2
  interface AutopilotChatInputActionsProps {
3
3
  handleSubmit: (event: React.MouseEvent) => void;
4
4
  disableSubmit: boolean;
5
+ isInputEmpty?: boolean;
5
6
  waitingResponse: boolean;
6
7
  onResourceTriggerClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
8
+ onVoiceInteractionChange?: (isActive: boolean) => void;
9
+ isVoiceInteractionActive?: boolean;
7
10
  }
8
- declare function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, waitingResponse, onResourceTriggerClick, }: AutopilotChatInputActionsProps): import("react/jsx-runtime").JSX.Element;
11
+ declare function AutopilotChatInputActionsComponent({ handleSubmit, disableSubmit, isInputEmpty, waitingResponse, onResourceTriggerClick, onVoiceInteractionChange, isVoiceInteractionActive, }: AutopilotChatInputActionsProps): import("react/jsx-runtime").JSX.Element;
9
12
  export declare const AutopilotChatInputActions: React.MemoExoticComponent<typeof AutopilotChatInputActionsComponent>;
10
13
  export {};
11
14
  //# sourceMappingURL=chat-input-actions.d.ts.map