@uipath/apollo-react 4.13.1 → 4.14.0-pr593.59e5bb0

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 (34) hide show
  1. package/dist/canvas/components/Edges/SequenceEdge.cjs +10 -8
  2. package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
  3. package/dist/canvas/components/Edges/SequenceEdge.js +10 -8
  4. package/dist/material/components/ap-chat/components/common/action-button.cjs +7 -33
  5. package/dist/material/components/ap-chat/components/common/action-button.d.ts +3 -9
  6. package/dist/material/components/ap-chat/components/common/action-button.d.ts.map +1 -1
  7. package/dist/material/components/ap-chat/components/common/action-button.js +7 -33
  8. package/dist/material/components/ap-chat/components/input/always-on-voice-button.cjs +183 -0
  9. package/dist/material/components/ap-chat/components/input/always-on-voice-button.d.ts +10 -0
  10. package/dist/material/components/ap-chat/components/input/always-on-voice-button.d.ts.map +1 -0
  11. package/dist/material/components/ap-chat/components/input/always-on-voice-button.js +136 -0
  12. package/dist/material/components/ap-chat/components/input/chat-input-actions.cjs +46 -4
  13. package/dist/material/components/ap-chat/components/input/chat-input-actions.d.ts +4 -1
  14. package/dist/material/components/ap-chat/components/input/chat-input-actions.d.ts.map +1 -1
  15. package/dist/material/components/ap-chat/components/input/chat-input-actions.js +46 -4
  16. package/dist/material/components/ap-chat/components/input/chat-input.cjs +19 -5
  17. package/dist/material/components/ap-chat/components/input/chat-input.d.ts.map +1 -1
  18. package/dist/material/components/ap-chat/components/input/chat-input.js +19 -5
  19. package/dist/material/components/ap-chat/locales/en.cjs +1 -1
  20. package/dist/material/components/ap-chat/locales/en.d.ts.map +1 -1
  21. package/dist/material/components/ap-chat/locales/en.js +1 -1
  22. package/dist/material/components/ap-chat/service/ChatModel.cjs +2 -0
  23. package/dist/material/components/ap-chat/service/ChatModel.d.ts +4 -1
  24. package/dist/material/components/ap-chat/service/ChatModel.d.ts.map +1 -1
  25. package/dist/material/components/ap-chat/service/ChatModel.js +2 -0
  26. package/dist/material/components/ap-chat/service/ChatService.cjs +14 -0
  27. package/dist/material/components/ap-chat/service/ChatService.d.ts +4 -0
  28. package/dist/material/components/ap-chat/service/ChatService.d.ts.map +1 -1
  29. package/dist/material/components/ap-chat/service/ChatService.js +14 -0
  30. package/package.json +1 -1
  31. package/dist/material/components/ap-chat/components/audio/chat-audio.cjs +0 -334
  32. package/dist/material/components/ap-chat/components/audio/chat-audio.d.ts +0 -10
  33. package/dist/material/components/ap-chat/components/audio/chat-audio.d.ts.map +0 -1
  34. package/dist/material/components/ap-chat/components/audio/chat-audio.js +0 -290
@@ -88,6 +88,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
88
88
  const status = executionStatus ? executionStatus?.status ?? executionStatus : validationStatus;
89
89
  const isDiffAdded = data?.isDiffAdded === true;
90
90
  const isDiffRemoved = data?.isDiffRemoved === true;
91
+ const hideArrowHead = data?.hideArrowHead === true;
92
+ const hideToolbar = data?.hideToolbar === true;
91
93
  const angle = ANGLE_MAP[targetPosition];
92
94
  const { x: offsetX, y: offsetY } = ARROW_OFFSETS[targetPosition];
93
95
  const { edgePath, labelX, labelY } = (0, index_cjs_namespaceObject.useEdgePath)({
@@ -98,8 +100,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
98
100
  sourceX,
99
101
  sourceY,
100
102
  sourcePosition,
101
- targetX,
102
- targetY,
103
+ targetX: hideArrowHead ? targetX + offsetX : targetX,
104
+ targetY: hideArrowHead ? targetY + offsetY : targetY,
103
105
  targetPosition
104
106
  });
105
107
  const { showToolbar, toolbarPositioning, config: toolbarConfig, handleMouseMoveOnPath } = (0, external_Toolbar_index_cjs_namespaceObject.useEdgeToolbarState)({
@@ -166,12 +168,12 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
166
168
  },
167
169
  ref: pathElementRef
168
170
  }),
169
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("polygon", {
171
+ !hideArrowHead && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("polygon", {
170
172
  points: `
171
- ${targetX},${targetY}
172
- ${targetX - ARROW_SIZE * Math.cos(angle - Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle - Math.PI / 6)}
173
- ${targetX - ARROW_SIZE * Math.cos(angle + Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle + Math.PI / 6)}
174
- `,
173
+ ${targetX},${targetY}
174
+ ${targetX - ARROW_SIZE * Math.cos(angle - Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle - Math.PI / 6)}
175
+ ${targetX - ARROW_SIZE * Math.cos(angle + Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle + Math.PI / 6)}
176
+ `,
175
177
  fill: edgeColor,
176
178
  style: {
177
179
  pointerEvents: 'none',
@@ -211,7 +213,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
211
213
  })
212
214
  ]
213
215
  }),
214
- showToolbar && toolbarPositioning && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.EdgeToolbar, {
216
+ !hideToolbar && showToolbar && toolbarPositioning && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.EdgeToolbar, {
215
217
  edgeId: id,
216
218
  visible: showToolbar,
217
219
  positioning: toolbarPositioning,
@@ -1 +1 @@
1
- {"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,0CAA0C,CAAC;AAoDpF,eAAO,MAAM,YAAY,iDAuMJ,CAAC"}
1
+ {"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,0CAA0C,CAAC;AAoDpF,eAAO,MAAM,YAAY,iDA+MJ,CAAC"}
@@ -60,6 +60,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
60
60
  const status = executionStatus ? executionStatus?.status ?? executionStatus : validationStatus;
61
61
  const isDiffAdded = data?.isDiffAdded === true;
62
62
  const isDiffRemoved = data?.isDiffRemoved === true;
63
+ const hideArrowHead = data?.hideArrowHead === true;
64
+ const hideToolbar = data?.hideToolbar === true;
63
65
  const angle = ANGLE_MAP[targetPosition];
64
66
  const { x: offsetX, y: offsetY } = ARROW_OFFSETS[targetPosition];
65
67
  const { edgePath, labelX, labelY } = useEdgePath({
@@ -70,8 +72,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
70
72
  sourceX,
71
73
  sourceY,
72
74
  sourcePosition,
73
- targetX,
74
- targetY,
75
+ targetX: hideArrowHead ? targetX + offsetX : targetX,
76
+ targetY: hideArrowHead ? targetY + offsetY : targetY,
75
77
  targetPosition
76
78
  });
77
79
  const { showToolbar, toolbarPositioning, config: toolbarConfig, handleMouseMoveOnPath } = useEdgeToolbarState({
@@ -138,12 +140,12 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
138
140
  },
139
141
  ref: pathElementRef
140
142
  }),
141
- /*#__PURE__*/ jsx("polygon", {
143
+ !hideArrowHead && /*#__PURE__*/ jsx("polygon", {
142
144
  points: `
143
- ${targetX},${targetY}
144
- ${targetX - ARROW_SIZE * Math.cos(angle - Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle - Math.PI / 6)}
145
- ${targetX - ARROW_SIZE * Math.cos(angle + Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle + Math.PI / 6)}
146
- `,
145
+ ${targetX},${targetY}
146
+ ${targetX - ARROW_SIZE * Math.cos(angle - Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle - Math.PI / 6)}
147
+ ${targetX - ARROW_SIZE * Math.cos(angle + Math.PI / 6)},${targetY - ARROW_SIZE * Math.sin(angle + Math.PI / 6)}
148
+ `,
147
149
  fill: edgeColor,
148
150
  style: {
149
151
  pointerEvents: 'none',
@@ -183,7 +185,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
183
185
  })
184
186
  ]
185
187
  }),
186
- showToolbar && toolbarPositioning && /*#__PURE__*/ jsx(EdgeToolbar, {
188
+ !hideToolbar && showToolbar && toolbarPositioning && /*#__PURE__*/ jsx(EdgeToolbar, {
187
189
  edgeId: id,
188
190
  visible: showToolbar,
189
191
  positioning: toolbarPositioning,
@@ -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,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AC,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 };