botframework-webchat-component 4.15.1 → 4.15.2-main.20220413.af6e8a3
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/lib/Activity/CarouselLayout.js +3 -3
- package/lib/Activity/Speak.d.ts +2 -2
- package/lib/Activity/Speak.d.ts.map +1 -1
- package/lib/Activity/Speak.js +14 -7
- package/lib/Activity/StackedLayout.d.ts +5 -3
- package/lib/Activity/StackedLayout.d.ts.map +1 -1
- package/lib/Activity/StackedLayout.js +15 -20
- package/lib/Attachment/FileContent.js +2 -2
- package/lib/BasicSendBox.d.ts.map +1 -1
- package/lib/BasicSendBox.js +7 -8
- package/lib/BasicToast.js +1 -1
- package/lib/BasicToaster.js +1 -1
- package/lib/BasicTranscript.d.ts.map +1 -1
- package/lib/BasicTranscript.js +4 -4
- package/lib/BasicTypingIndicator.js +1 -1
- package/lib/Composer.js +3 -3
- package/lib/ConnectivityStatus/Connecting.js +1 -1
- package/lib/Dictation.js +1 -1
- package/lib/Middleware/Activity/createCoreMiddleware.d.ts.map +1 -1
- package/lib/Middleware/Activity/createCoreMiddleware.js +9 -12
- package/lib/Middleware/ActivityStatus/SendStatus/SendFailedRetry.js +1 -1
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.d.ts +2 -2
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.d.ts.map +1 -1
- package/lib/Middleware/ActivityStatus/SendStatus/SendStatus.js +4 -3
- package/lib/Middleware/ActivityStatus/Timestamp.d.ts +2 -2
- package/lib/Middleware/ActivityStatus/Timestamp.d.ts.map +1 -1
- package/lib/Middleware/ActivityStatus/Timestamp.js +4 -2
- package/lib/Middleware/ActivityStatus/createSendStatusMiddleware.js +2 -2
- package/lib/ReactWebChat.js +2 -2
- package/lib/ScreenReaderActivity.js +1 -1
- package/lib/ScreenReaderText.js +1 -1
- package/lib/SendBox/AutoResizeTextArea.js +1 -1
- package/lib/SendBox/IconButton.js +1 -1
- package/lib/SendBox/MicrophoneButton.js +1 -1
- package/lib/SendBox/SendButton.js +1 -1
- package/lib/SendBox/SuggestedAction.js +2 -2
- package/lib/SendBox/SuggestedActions.js +2 -2
- package/lib/SendBox/TextBox.js +3 -3
- package/lib/SendBox/UploadButton.js +3 -3
- package/lib/Styles/StyleSet/Bubble.js +2 -2
- package/lib/Styles/StyleSet/CarouselFilmStrip.js +2 -2
- package/lib/Styles/StyleSet/CarouselFilmStripAttachment.js +2 -2
- package/lib/Styles/createStyleSet.d.ts +1 -1
- package/lib/Styles/createStyleSet.js +2 -2
- package/lib/Transcript/ActivityRow.d.ts +2 -2
- package/lib/Transcript/ActivityRow.d.ts.map +1 -1
- package/lib/Transcript/ActivityRow.js +4 -2
- package/lib/Transcript/ActivityTextAlt.js +1 -1
- package/lib/Transcript/FocusTrap.js +1 -1
- package/lib/Transcript/KeyboardHelp.js +1 -1
- package/lib/Transcript/LiveRegionTranscript.d.ts.map +1 -1
- package/lib/Transcript/LiveRegionTranscript.js +22 -7
- package/lib/Transcript/useActivityAccessibleName.d.ts +2 -2
- package/lib/Transcript/useActivityAccessibleName.d.ts.map +1 -1
- package/lib/Transcript/useActivityAccessibleName.js +2 -2
- package/lib/Transcript/useTypistNames.d.ts +3 -0
- package/lib/Transcript/useTypistNames.d.ts.map +1 -0
- package/lib/Transcript/useTypistNames.js +61 -0
- package/lib/Utils/AccessKeySink/Surface.js +1 -1
- package/lib/Utils/AccessibleButton.js +1 -1
- package/lib/Utils/AccessibleInputText.js +1 -1
- package/lib/Utils/AccessibleTextArea.js +1 -1
- package/lib/Utils/CroppedImage.js +1 -1
- package/lib/Utils/FocusRedirector.js +1 -1
- package/lib/Utils/InlineMarkdown.js +3 -3
- package/lib/Utils/TypeFocusSink/FocusBox.js +1 -1
- package/lib/Utils/addTargetBlankToHyperlinksMarkdown.js +2 -2
- package/lib/Utils/downscaleImageToDataURL/index.js +1 -1
- package/lib/Utils/getActivityUniqueId.js +1 -1
- package/lib/connectToWebChat.js +2 -2
- package/lib/hooks/internal/BypassSpeechSynthesisPonyfill.js +3 -3
- package/lib/hooks/internal/useMemoize.d.ts +1 -1
- package/lib/hooks/internal/useMemoize.d.ts.map +1 -1
- package/lib/hooks/internal/useMemoize.js +1 -1
- package/lib/hooks/useObserveTranscriptFocus.d.ts +2 -2
- package/lib/hooks/useObserveTranscriptFocus.d.ts.map +1 -1
- package/lib/hooks/useObserveTranscriptFocus.js +1 -1
- package/lib/hooks/useSendFiles.d.ts.map +1 -1
- package/lib/hooks/useSendFiles.js +4 -4
- package/lib/index.d.ts +3 -3
- package/lib/index.js +5 -5
- package/lib/providers/ActivityTree/ActivityTreeComposer.d.ts.map +1 -1
- package/lib/providers/ActivityTree/ActivityTreeComposer.js +2 -2
- package/lib/providers/ActivityTree/private/types.d.ts +2 -2
- package/lib/providers/ActivityTree/private/types.d.ts.map +1 -1
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.d.ts +2 -2
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.d.ts.map +1 -1
- package/lib/providers/ActivityTree/private/useActivitiesWithRenderer.js +1 -1
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.d.ts.map +1 -1
- package/lib/providers/ActivityTree/private/useActivityTreeWithRenderer.js +1 -1
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.d.ts +2 -0
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.d.ts.map +1 -1
- package/lib/providers/LiveRegionTwin/LiveRegionTwinComposer.js +10 -6
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.d.ts +1 -0
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.d.ts.map +1 -1
- package/lib/providers/LiveRegionTwin/private/LiveRegionTwinContainer.js +22 -8
- package/lib/providers/TranscriptFocus/TranscriptFocusComposer.js +1 -1
- package/package.json +24 -20
- package/src/Activity/Speak.tsx +21 -18
- package/src/Activity/StackedLayout.tsx +20 -26
- package/src/Attachment/FileContent.tsx +1 -1
- package/src/BasicSendBox.tsx +3 -2
- package/src/BasicTranscript.tsx +2 -6
- package/src/Middleware/Activity/createCoreMiddleware.tsx +5 -10
- package/src/Middleware/ActivityStatus/SendStatus/SendStatus.tsx +5 -3
- package/src/Middleware/ActivityStatus/Timestamp.tsx +5 -3
- package/src/SendBox/SuggestedAction.tsx +1 -1
- package/src/SendBox/SuggestedActions.tsx +1 -1
- package/src/Transcript/ActivityRow.tsx +4 -5
- package/src/Transcript/ActivityTextAlt.tsx +2 -3
- package/src/Transcript/LiveRegionTranscript.tsx +27 -12
- package/src/Transcript/useActivityAccessibleName.ts +3 -4
- package/src/Transcript/useTypistNames.ts +37 -0
- package/src/Utils/getActivityUniqueId.ts +2 -2
- package/src/hooks/internal/useMemoize.ts +6 -6
- package/src/hooks/useObserveTranscriptFocus.ts +2 -2
- package/src/hooks/useSendFiles.ts +7 -5
- package/src/providers/ActivityTree/ActivityTreeComposer.tsx +2 -2
- package/src/providers/ActivityTree/private/types.ts +2 -2
- package/src/providers/ActivityTree/private/useActivitiesWithRenderer.ts +4 -6
- package/src/providers/ActivityTree/private/useActivityTreeWithRenderer.ts +6 -11
- package/src/providers/LiveRegionTwin/LiveRegionTwinComposer.tsx +10 -3
- package/src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx +22 -6
- package/lib/Middleware/GroupActivities/createCoreMiddleware.js +0 -69
- package/src/Middleware/GroupActivities/createCoreMiddleware.js +0 -57
|
@@ -5,6 +5,7 @@ declare type LiveRegionTwinContainerProps = {
|
|
|
5
5
|
'aria-roledescription'?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
role?: string;
|
|
8
|
+
textElementClassName?: string;
|
|
8
9
|
};
|
|
9
10
|
declare const LiveRegionTwinContainer: VFC<LiveRegionTwinContainerProps>;
|
|
10
11
|
export default LiveRegionTwinContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveRegionTwinContainer.d.ts","sourceRoot":"","sources":["../../../../src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAKjC,aAAK,4BAA4B,GAAG;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,GAAG,QAAQ,CAAC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"LiveRegionTwinContainer.d.ts","sourceRoot":"","sources":["../../../../src/providers/LiveRegionTwin/private/LiveRegionTwinContainer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAKjC,aAAK,4BAA4B,GAAG;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,GAAG,QAAQ,CAAC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF,QAAA,MAAM,uBAAuB,EAAE,GAAG,CAAC,4BAA4B,CAwC9D,CAAC;AAqBF,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -39,7 +39,8 @@ var LiveRegionTwinContainer = function LiveRegionTwinContainer(_ref) {
|
|
|
39
39
|
ariaLive = _ref['aria-live'],
|
|
40
40
|
ariaRoleDescription = _ref['aria-roledescription'],
|
|
41
41
|
className = _ref.className,
|
|
42
|
-
role = _ref.role
|
|
42
|
+
role = _ref.role,
|
|
43
|
+
textElementClassName = _ref.textElementClassName;
|
|
43
44
|
|
|
44
45
|
var _useStaticElementEntr = (0, _useStaticElementEntries.default)(),
|
|
45
46
|
_useStaticElementEntr2 = _slicedToArray(_useStaticElementEntr, 1),
|
|
@@ -58,9 +59,20 @@ var LiveRegionTwinContainer = function LiveRegionTwinContainer(_ref) {
|
|
|
58
59
|
}, staticElementEntries.map(function (_ref2) {
|
|
59
60
|
var element = _ref2.element,
|
|
60
61
|
key = _ref2.key;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
|
|
63
|
+
if (typeof element === 'string') {
|
|
64
|
+
var id = "webchat__live-region-twin__text-element-".concat(key);
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
66
|
+
"aria-atomic": true,
|
|
67
|
+
"aria-labelledby": id,
|
|
68
|
+
className: textElementClassName,
|
|
69
|
+
key: key
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
71
|
+
id: id
|
|
72
|
+
}, element));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
64
76
|
key: key
|
|
65
77
|
}, element);
|
|
66
78
|
}));
|
|
@@ -70,7 +82,8 @@ LiveRegionTwinContainer.defaultProps = {
|
|
|
70
82
|
'aria-label': undefined,
|
|
71
83
|
'aria-roledescription': undefined,
|
|
72
84
|
className: undefined,
|
|
73
|
-
role: undefined
|
|
85
|
+
role: undefined,
|
|
86
|
+
textElementClassName: undefined
|
|
74
87
|
};
|
|
75
88
|
LiveRegionTwinContainer.propTypes = {
|
|
76
89
|
'aria-label': _propTypes.default.string,
|
|
@@ -79,8 +92,9 @@ LiveRegionTwinContainer.propTypes = {
|
|
|
79
92
|
'aria-live': _propTypes.default.oneOf(['assertive', 'polite']).isRequired,
|
|
80
93
|
'aria-roledescription': _propTypes.default.string,
|
|
81
94
|
className: _propTypes.default.string,
|
|
82
|
-
role: _propTypes.default.string
|
|
95
|
+
role: _propTypes.default.string,
|
|
96
|
+
textElementClassName: _propTypes.default.string
|
|
83
97
|
};
|
|
84
98
|
var _default = LiveRegionTwinContainer;
|
|
85
99
|
exports.default = _default;
|
|
86
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
100
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9wcm92aWRlcnMvTGl2ZVJlZ2lvblR3aW4vcHJpdmF0ZS9MaXZlUmVnaW9uVHdpbkNvbnRhaW5lci50c3giXSwibmFtZXMiOlsiTGl2ZVJlZ2lvblR3aW5Db250YWluZXIiLCJhcmlhTGFiZWwiLCJhcmlhTGl2ZSIsImFyaWFSb2xlRGVzY3JpcHRpb24iLCJjbGFzc05hbWUiLCJyb2xlIiwidGV4dEVsZW1lbnRDbGFzc05hbWUiLCJzdGF0aWNFbGVtZW50RW50cmllcyIsIm1hcCIsImVsZW1lbnQiLCJrZXkiLCJpZCIsImRlZmF1bHRQcm9wcyIsInVuZGVmaW5lZCIsInByb3BUeXBlcyIsIlByb3BUeXBlcyIsInN0cmluZyIsIm9uZU9mIiwiaXNSZXF1aXJlZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUE7O0FBQ0E7O0FBSUE7O0FBQ0E7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBV0E7QUFDQSxJQUFNQSx1QkFBMEQsR0FBRyxTQUE3REEsdUJBQTZELE9BTzdEO0FBQUEsTUFOVUMsU0FNVixRQU5KLFlBTUk7QUFBQSxNQUxTQyxRQUtULFFBTEosV0FLS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8L2Rpdj5cbiAgKTtcbn07XG5cbkxpdmVSZWdpb25Ud2luQ29udGFpbmVyLmRlZmF1bHRQcm9wcyA9IHtcbiAgJ2FyaWEtbGFiZWwnOiB1bmRlZmluZWQsXG4gICdhcmlhLXJvbGVkZXNjcmlwdGlvbic6IHVuZGVmaW5lZCxcbiAgY2xhc3NOYW1lOiB1bmRlZmluZWQsXG4gIHJvbGU6IHVuZGVmaW5lZCxcbiAgdGV4dEVsZW1lbnRDbGFzc05hbWU6IHVuZGVmaW5lZFxufTtcblxuTGl2ZVJlZ2lvblR3aW5Db250YWluZXIucHJvcFR5cGVzID0ge1xuICAnYXJpYS1sYWJlbCc6IFByb3BUeXBlcy5zdHJpbmcsXG4gIC8vIFByb3BUeXBlcy5vbmVPZigpIHJldHVybnMgdHlwZSBvZiBgc3RyaW5nYCwgYnV0IG5vdCBgJ2Fzc2VydGl2ZScgfCAncG9saXRlJ2AuXG4gIC8vIEB0cy1pZ25vcmVcbiAgJ2FyaWEtbGl2ZSc6IFByb3BUeXBlcy5vbmVPZihbJ2Fzc2VydGl2ZScsICdwb2xpdGUnXSkuaXNSZXF1aXJlZCxcbiAgJ2FyaWEtcm9sZWRlc2NyaXB0aW9uJzogUHJvcFR5cGVzLnN0cmluZyxcbiAgY2xhc3NOYW1lOiBQcm9wVHlwZXMuc3RyaW5nLFxuICByb2xlOiBQcm9wVHlwZXMuc3RyaW5nLFxuICB0ZXh0RWxlbWVudENsYXNzTmFtZTogUHJvcFR5cGVzLnN0cmluZ1xufTtcblxuZXhwb3J0IGRlZmF1bHQgTGl2ZVJlZ2lvblR3aW5Db250YWluZXI7XG4iXX0=
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "botframework-webchat-component",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.2-main.20220413.af6e8a3",
|
|
4
4
|
"description": "React component of botframework-webchat",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
"build": "npm run build:typescript && npm run build:babel",
|
|
22
22
|
"build:babel": "babel src --copy-files --extensions .js,.ts,.tsx --ignore **/*.spec.js,**/*.spec.ts,**/*.spec.tsx,**/*.test.js,**/*.test.ts,**/*.test.tsx,__tests__/**/*.js,__tests__/**/*.ts,__tests__/**/*.tsx --no-copy-ignored --out-dir lib --verbose",
|
|
23
23
|
"build:typescript": "tsc --project src/tsconfig.json",
|
|
24
|
+
"bump": "npm run bump:prod && npm run bump:dev",
|
|
25
|
+
"bump:dev": "npm install $(cat package.json | jq -r '(.devDependencies | keys) - .skipBump | .[]' | awk '{print $1 \"@latest\"}')",
|
|
26
|
+
"bump:prod": "npm install --save-exact $(cat package.json | jq -r '(.dependencies | keys) - .skipBump | .[]' | awk '{print $1 \"@latest\"}')",
|
|
24
27
|
"eslint": "npm run precommit",
|
|
25
28
|
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
|
|
26
29
|
"precommit:eslint": "../../node_modules/.bin/eslint --report-unused-disable-directives --max-warnings 0",
|
|
@@ -30,39 +33,40 @@
|
|
|
30
33
|
"start:babel": "npm run build:babel -- --skip-initial-build --watch",
|
|
31
34
|
"start:typescript": "npm run build:typescript -- --watch"
|
|
32
35
|
},
|
|
36
|
+
"skipBump": [],
|
|
33
37
|
"devDependencies": {
|
|
34
|
-
"@babel/cli": "^7.
|
|
35
|
-
"@babel/core": "^7.
|
|
36
|
-
"@babel/preset-env": "^7.
|
|
37
|
-
"@babel/preset-react": "^7.
|
|
38
|
-
"@babel/preset-typescript": "^7.
|
|
39
|
-
"@types/node": "^
|
|
40
|
-
"@types/react": "^17.0.
|
|
41
|
-
"babel-plugin-istanbul": "^6.
|
|
38
|
+
"@babel/cli": "^7.17.6",
|
|
39
|
+
"@babel/core": "^7.17.5",
|
|
40
|
+
"@babel/preset-env": "^7.16.11",
|
|
41
|
+
"@babel/preset-react": "^7.16.7",
|
|
42
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
43
|
+
"@types/node": "^17.0.21",
|
|
44
|
+
"@types/react": "^17.0.39",
|
|
45
|
+
"babel-plugin-istanbul": "^6.1.1",
|
|
42
46
|
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
|
|
43
|
-
"concurrently": "^
|
|
44
|
-
"core-js": "^3.
|
|
45
|
-
"node-dev": "^7.
|
|
46
|
-
"typescript": "^4.
|
|
47
|
+
"concurrently": "^7.0.0",
|
|
48
|
+
"core-js": "^3.21.1",
|
|
49
|
+
"node-dev": "^7.1.0",
|
|
50
|
+
"typescript": "^4.6.2"
|
|
47
51
|
},
|
|
48
52
|
"dependencies": {
|
|
49
|
-
"@emotion/css": "11.1
|
|
53
|
+
"@emotion/css": "11.7.1",
|
|
50
54
|
"base64-js": "1.5.1",
|
|
51
|
-
"botframework-webchat-api": "4.15.
|
|
52
|
-
"botframework-webchat-core": "4.15.
|
|
55
|
+
"botframework-webchat-api": "4.15.2-main.20220413.af6e8a3",
|
|
56
|
+
"botframework-webchat-core": "4.15.2-main.20220413.af6e8a3",
|
|
53
57
|
"classnames": "2.3.1",
|
|
54
58
|
"compute-scroll-into-view": "1.0.17",
|
|
55
59
|
"event-target-shim": "6.0.2",
|
|
56
60
|
"markdown-it": "12.3.2",
|
|
57
61
|
"math-random": "2.0.1",
|
|
58
|
-
"memoize-one": "
|
|
59
|
-
"prop-types": "15.
|
|
62
|
+
"memoize-one": "6.0.0",
|
|
63
|
+
"prop-types": "15.8.1",
|
|
60
64
|
"react-dictate-button": "2.0.1",
|
|
61
65
|
"react-film": "3.1.0",
|
|
62
|
-
"react-redux": "7.2.
|
|
66
|
+
"react-redux": "7.2.6",
|
|
63
67
|
"react-say": "2.1.0",
|
|
64
68
|
"react-scroll-to-bottom": "4.2.0",
|
|
65
|
-
"redux": "4.
|
|
69
|
+
"redux": "4.1.2",
|
|
66
70
|
"simple-update-in": "2.2.0"
|
|
67
71
|
},
|
|
68
72
|
"peerDependencies": {
|
package/src/Activity/Speak.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DirectLineActivity } from 'botframework-webchat-core';
|
|
2
1
|
import { hooks } from 'botframework-webchat-api';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import React, { FC, useCallback, useMemo } from 'react';
|
|
5
4
|
import Say, { SayUtterance } from 'react-say';
|
|
5
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
6
6
|
|
|
7
7
|
import connectToWebChat from '../connectToWebChat';
|
|
8
8
|
import SayAlt from './SayAlt';
|
|
@@ -24,7 +24,7 @@ const connectSpeakActivity = (...selectors) =>
|
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
type SpeakProps = {
|
|
27
|
-
activity:
|
|
27
|
+
activity: WebChatActivity;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const Speak: FC<SpeakProps> = ({ activity }) => {
|
|
@@ -36,25 +36,25 @@ const Speak: FC<SpeakProps> = ({ activity }) => {
|
|
|
36
36
|
markActivityAsSpoken(activity);
|
|
37
37
|
}, [activity, markActivityAsSpoken]);
|
|
38
38
|
|
|
39
|
-
const singleLine = useMemo(() => {
|
|
39
|
+
const singleLine: false | string = useMemo(() => {
|
|
40
|
+
if (activity.type !== 'message') {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
const { attachments = [], speak, text } = activity;
|
|
41
45
|
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.filter(line => line)
|
|
51
|
-
.join('\r\n')
|
|
52
|
-
);
|
|
46
|
+
return [
|
|
47
|
+
speak || text,
|
|
48
|
+
...attachments
|
|
49
|
+
.filter(({ contentType }) => contentType === 'application/vnd.microsoft.card.adaptive')
|
|
50
|
+
.map(attachment => attachment?.content?.speak)
|
|
51
|
+
]
|
|
52
|
+
.filter(line => line)
|
|
53
|
+
.join('\r\n');
|
|
53
54
|
}, [activity]);
|
|
54
55
|
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
}: { channelData: { speechSynthesisUtterance?: SpeechSynthesisUtterance } } = activity;
|
|
56
|
+
const speechSynthesisUtterance: false | SpeechSynthesisUtterance | undefined =
|
|
57
|
+
activity.type === 'message' && activity.channelData?.speechSynthesisUtterance;
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
!!activity && (
|
|
@@ -71,6 +71,8 @@ const Speak: FC<SpeakProps> = ({ activity }) => {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
Speak.propTypes = {
|
|
74
|
+
// PropTypes cannot fully capture TypeScript types.
|
|
75
|
+
// @ts-ignore
|
|
74
76
|
activity: PropTypes.shape({
|
|
75
77
|
attachments: PropTypes.arrayOf(
|
|
76
78
|
PropTypes.shape({
|
|
@@ -84,7 +86,8 @@ Speak.propTypes = {
|
|
|
84
86
|
speechSynthesisUtterance: PropTypes.any
|
|
85
87
|
}),
|
|
86
88
|
speak: PropTypes.string,
|
|
87
|
-
text: PropTypes.string
|
|
89
|
+
text: PropTypes.string,
|
|
90
|
+
type: PropTypes.string.isRequired
|
|
88
91
|
}).isRequired
|
|
89
92
|
};
|
|
90
93
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/* eslint complexity: ["error",
|
|
1
|
+
/* eslint complexity: ["error", 50] */
|
|
2
2
|
|
|
3
|
-
import { DirectLineActivity } from 'botframework-webchat-core';
|
|
4
3
|
import { hooks, RenderAttachment } from 'botframework-webchat-api';
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
7
6
|
import React, { FC, ReactNode } from 'react';
|
|
7
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
8
8
|
|
|
9
9
|
import Bubble from './Bubble';
|
|
10
10
|
import connectToWebChat from '../connectToWebChat';
|
|
@@ -89,11 +89,11 @@ const connectStackedLayout = (...selectors) =>
|
|
|
89
89
|
);
|
|
90
90
|
|
|
91
91
|
type StackedLayoutProps = {
|
|
92
|
-
activity:
|
|
92
|
+
activity: WebChatActivity;
|
|
93
93
|
hideTimestamp?: boolean;
|
|
94
94
|
renderActivityStatus?: (({ hideTimestamp: boolean }) => Exclude<ReactNode, boolean | null | undefined>) | false;
|
|
95
95
|
renderAttachment?: RenderAttachment;
|
|
96
|
-
renderAvatar?: (activity:
|
|
96
|
+
renderAvatar?: ({ activity: WebChatActivity }) => (() => Exclude<ReactNode, boolean | null | undefined>) | false;
|
|
97
97
|
showCallout?: boolean;
|
|
98
98
|
};
|
|
99
99
|
|
|
@@ -115,23 +115,13 @@ const StackedLayout: FC<StackedLayoutProps> = ({
|
|
|
115
115
|
|
|
116
116
|
const { bubbleNubOffset, bubbleNubSize, bubbleFromUserNubOffset, bubbleFromUserNubSize } = styleOptions;
|
|
117
117
|
|
|
118
|
-
const
|
|
119
|
-
attachments = [],
|
|
120
|
-
channelData: { messageBack: { displayText: messageBackDisplayText } = {} } = {},
|
|
121
|
-
from: { role } = {},
|
|
122
|
-
text,
|
|
123
|
-
textFormat
|
|
124
|
-
}: {
|
|
125
|
-
attachments?: [];
|
|
126
|
-
channelData?: { messageBack?: { displayText?: string } };
|
|
127
|
-
from?: { role?: 'bot' | 'user' };
|
|
128
|
-
text?: string;
|
|
129
|
-
textFormat?: string;
|
|
130
|
-
} = activity;
|
|
131
|
-
|
|
132
|
-
const activityDisplayText = messageBackDisplayText || text;
|
|
133
|
-
const fromUser = role === 'user';
|
|
118
|
+
const isMessage = activity.type === 'message';
|
|
134
119
|
|
|
120
|
+
const attachments = (isMessage && activity.attachments) || [];
|
|
121
|
+
const fromUser = activity.from.role === 'user';
|
|
122
|
+
const messageBackDisplayText: string = (isMessage && activity.channelData?.messageBack?.displayText) || '';
|
|
123
|
+
|
|
124
|
+
const activityDisplayText = isMessage ? messageBackDisplayText || activity.text : '';
|
|
135
125
|
const attachedAlt = localize(fromUser ? 'ACTIVITY_YOU_ATTACHED_ALT' : 'ACTIVITY_BOT_ATTACHED_ALT');
|
|
136
126
|
const greetingAlt = (
|
|
137
127
|
fromUser ? localize('ACTIVITY_YOU_SAID_ALT') : localize('ACTIVITY_BOT_SAID_ALT', botInitials || '')
|
|
@@ -152,7 +142,7 @@ const StackedLayout: FC<StackedLayoutProps> = ({
|
|
|
152
142
|
const extraTrailing = !hasOtherAvatar && hasOtherNub; // This is for bot message with user nub and no user avatar. And vice versa.
|
|
153
143
|
|
|
154
144
|
const showAvatar = showCallout && hasAvatar && !!renderAvatar;
|
|
155
|
-
const showNub = showCallout && hasNub && (topAlignedCallout || !attachments
|
|
145
|
+
const showNub = showCallout && hasNub && (topAlignedCallout || !attachments?.length);
|
|
156
146
|
|
|
157
147
|
return (
|
|
158
148
|
<div
|
|
@@ -192,10 +182,12 @@ const StackedLayout: FC<StackedLayoutProps> = ({
|
|
|
192
182
|
>
|
|
193
183
|
{renderAttachment({
|
|
194
184
|
activity,
|
|
195
|
-
attachment:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
185
|
+
attachment: isMessage
|
|
186
|
+
? {
|
|
187
|
+
content: activityDisplayText,
|
|
188
|
+
contentType: textFormatToContentType(activity.textFormat)
|
|
189
|
+
}
|
|
190
|
+
: undefined
|
|
199
191
|
})}
|
|
200
192
|
</Bubble>
|
|
201
193
|
</div>
|
|
@@ -246,6 +238,8 @@ StackedLayout.defaultProps = {
|
|
|
246
238
|
};
|
|
247
239
|
|
|
248
240
|
StackedLayout.propTypes = {
|
|
241
|
+
// PropTypes cannot fully capture TypeScript types.
|
|
242
|
+
// @ts-ignore
|
|
249
243
|
activity: PropTypes.shape({
|
|
250
244
|
attachments: PropTypes.array,
|
|
251
245
|
channelData: PropTypes.shape({
|
|
@@ -257,7 +251,7 @@ StackedLayout.propTypes = {
|
|
|
257
251
|
role: PropTypes.string.isRequired
|
|
258
252
|
}).isRequired,
|
|
259
253
|
text: PropTypes.string,
|
|
260
|
-
textFormat: PropTypes.
|
|
254
|
+
textFormat: PropTypes.oneOf(['markdown', 'plain', 'xml']),
|
|
261
255
|
timestamp: PropTypes.string,
|
|
262
256
|
type: PropTypes.string.isRequired
|
|
263
257
|
}).isRequired,
|
package/src/BasicSendBox.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { hooks } from 'botframework-webchat-api';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React, { FC } from 'react';
|
|
6
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
6
7
|
|
|
7
8
|
import DictationInterims from './SendBox/DictationInterims';
|
|
8
9
|
import MicrophoneButton from './SendBox/MicrophoneButton';
|
|
@@ -31,8 +32,8 @@ const ROOT_STYLE = {
|
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
// TODO: [P3] We should consider exposing core/src/definitions and use it instead
|
|
34
|
-
function activityIsSpeakingOrQueuedToSpeak(
|
|
35
|
-
return
|
|
35
|
+
function activityIsSpeakingOrQueuedToSpeak(activity: WebChatActivity) {
|
|
36
|
+
return activity.type === 'message' && activity.channelData?.speak;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
function useSendBoxSpeechInterimsVisible(): [boolean] {
|
package/src/BasicTranscript.tsx
CHANGED
|
@@ -15,8 +15,8 @@ import React, { forwardRef, Fragment, useCallback, useMemo, useRef } from 'react
|
|
|
15
15
|
|
|
16
16
|
import type { ActivityComponentFactory, AvatarComponentFactory } from 'botframework-webchat-api';
|
|
17
17
|
import type { ActivityElementMap } from './Transcript/types';
|
|
18
|
-
import type { DirectLineActivity } from 'botframework-webchat-core';
|
|
19
18
|
import type { FC, KeyboardEventHandler, MutableRefObject, ReactNode, VFC } from 'react';
|
|
19
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
20
20
|
|
|
21
21
|
import { android } from './Utils/detectBrowser';
|
|
22
22
|
import ActivityRow from './Transcript/ActivityRow';
|
|
@@ -94,11 +94,7 @@ const ROOT_STYLE = {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
type RenderingElement = {
|
|
97
|
-
activity:
|
|
98
|
-
channelData?: {
|
|
99
|
-
['webchat:fallback-text']: string;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
97
|
+
activity: WebChatActivity;
|
|
102
98
|
callbackRef: (element: HTMLElement) => void;
|
|
103
99
|
hideTimestamp: boolean;
|
|
104
100
|
key: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable complexity */
|
|
2
1
|
import { ActivityMiddleware } from 'botframework-webchat-api';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
|
|
@@ -20,28 +19,24 @@ export default function createCoreMiddleware(): ActivityMiddleware[] {
|
|
|
20
19
|
if (type === 'conversationUpdate' || type === 'event' || type === 'invoke' || type === 'typing') {
|
|
21
20
|
return false;
|
|
22
21
|
} else if (type === 'message') {
|
|
23
|
-
const { attachments
|
|
22
|
+
const { attachments, channelData, text } = activity;
|
|
24
23
|
|
|
25
24
|
if (
|
|
26
25
|
// Do not show postback
|
|
27
|
-
|
|
26
|
+
channelData?.postBack ||
|
|
28
27
|
// Do not show messageBack if displayText is undefined
|
|
29
|
-
(channelData
|
|
28
|
+
(channelData?.messageBack && !channelData.messageBack.displayText) ||
|
|
30
29
|
// Do not show empty bubbles (no text and attachments, and not "typing")
|
|
31
|
-
!(text || attachments
|
|
30
|
+
!(text || attachments?.length)
|
|
32
31
|
) {
|
|
33
32
|
return false;
|
|
34
33
|
}
|
|
35
|
-
// eslint-disable-next-line no-dupe-else-if
|
|
36
|
-
} else if (type === 'typing' && activity.from.role === 'user') {
|
|
37
|
-
// Do not show typing by oneself
|
|
38
|
-
return false;
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
if (type === 'message' || type === 'typing') {
|
|
42
37
|
if (
|
|
43
38
|
type === 'message' &&
|
|
44
|
-
(activity.attachments ||
|
|
39
|
+
(activity.attachments?.length || 0) > 1 &&
|
|
45
40
|
activity.attachmentLayout === 'carousel'
|
|
46
41
|
) {
|
|
47
42
|
// The following line is not a React functional component, it's a render function called by useCreateActivityRenderer() hook.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Constants
|
|
1
|
+
import { Constants } from 'botframework-webchat-core';
|
|
2
2
|
import { hooks } from 'botframework-webchat-api';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { FC, useCallback } from 'react';
|
|
5
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
5
6
|
|
|
6
7
|
import connectToWebChat from '../../../connectToWebChat';
|
|
7
8
|
import ScreenReaderText from '../../../ScreenReaderText';
|
|
@@ -33,7 +34,7 @@ const connectSendStatus = (...selectors) =>
|
|
|
33
34
|
);
|
|
34
35
|
|
|
35
36
|
type SendStatusProps = {
|
|
36
|
-
activity:
|
|
37
|
+
activity: WebChatActivity;
|
|
37
38
|
sendState: 'sending' | 'send failed' | 'sent';
|
|
38
39
|
};
|
|
39
40
|
|
|
@@ -72,9 +73,10 @@ const SendStatus: FC<SendStatusProps> = ({ activity, sendState }) => {
|
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
SendStatus.propTypes = {
|
|
76
|
+
// PropTypes cannot fully capture TypeScript types.
|
|
77
|
+
// @ts-ignore
|
|
75
78
|
activity: PropTypes.shape({
|
|
76
79
|
channelData: PropTypes.shape({
|
|
77
|
-
clientTimestamp: PropTypes.string,
|
|
78
80
|
state: PropTypes.string
|
|
79
81
|
})
|
|
80
82
|
}).isRequired,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DirectLineActivity } from 'botframework-webchat-core';
|
|
2
1
|
import { hooks } from 'botframework-webchat-api';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import React, { FC } from 'react';
|
|
5
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
6
6
|
|
|
7
7
|
import AbsoluteTime from './AbsoluteTime';
|
|
8
8
|
import RelativeTime from './RelativeTime';
|
|
@@ -11,7 +11,7 @@ import useStyleSet from '../../hooks/useStyleSet';
|
|
|
11
11
|
const { useStyleOptions } = hooks;
|
|
12
12
|
|
|
13
13
|
type TimestampProps = {
|
|
14
|
-
activity:
|
|
14
|
+
activity: WebChatActivity;
|
|
15
15
|
className?: string;
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -40,8 +40,10 @@ Timestamp.defaultProps = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
Timestamp.propTypes = {
|
|
43
|
+
// PropTypes cannot fully capture TypeScript types.
|
|
44
|
+
// @ts-ignore
|
|
43
45
|
activity: PropTypes.shape({
|
|
44
|
-
timestamp: PropTypes.string
|
|
46
|
+
timestamp: PropTypes.string
|
|
45
47
|
}).isRequired,
|
|
46
48
|
className: PropTypes.string
|
|
47
49
|
};
|
|
@@ -2,6 +2,7 @@ import { hooks } from 'botframework-webchat-api';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { MouseEventHandler, useCallback, useRef, VFC } from 'react';
|
|
5
|
+
import type { DirectLineCardAction } from 'botframework-webchat-core';
|
|
5
6
|
|
|
6
7
|
import AccessibleButton from '../Utils/AccessibleButton';
|
|
7
8
|
import connectToWebChat from '../connectToWebChat';
|
|
@@ -13,7 +14,6 @@ import useScrollToEnd from '../hooks/useScrollToEnd';
|
|
|
13
14
|
import useSuggestedActionsAccessKey from '../hooks/internal/useSuggestedActionsAccessKey';
|
|
14
15
|
import useStyleSet from '../hooks/useStyleSet';
|
|
15
16
|
import useStyleToEmotionObject from '../hooks/internal/useStyleToEmotionObject';
|
|
16
|
-
import { DirectLineCardAction } from 'botframework-webchat-core';
|
|
17
17
|
|
|
18
18
|
const { useDirection, useDisabled, usePerformCardAction, useStyleOptions, useSuggestedActions } = hooks;
|
|
19
19
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint react/no-array-index-key: "off" */
|
|
2
2
|
|
|
3
|
-
import { DirectLineCardAction } from 'botframework-webchat-core';
|
|
4
3
|
import { hooks } from 'botframework-webchat-api';
|
|
5
4
|
import BasicFilm, { createBasicStyleSet as createBasicStyleSetForReactFilm } from 'react-film';
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
7
|
import React, { FC, useMemo, useRef } from 'react';
|
|
8
|
+
import type { DirectLineCardAction } from 'botframework-webchat-core';
|
|
9
9
|
|
|
10
10
|
import connectToWebChat from '../connectToWebChat';
|
|
11
11
|
import ScreenReaderText from '../ScreenReaderText';
|
|
@@ -2,9 +2,8 @@ import { hooks } from 'botframework-webchat-api';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { forwardRef, useCallback, useRef } from 'react';
|
|
5
|
-
|
|
6
|
-
import type { DirectLineActivity } from 'botframework-webchat-core';
|
|
7
5
|
import type { MouseEventHandler, PropsWithChildren } from 'react';
|
|
6
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
8
7
|
|
|
9
8
|
import { android } from '../Utils/detectBrowser';
|
|
10
9
|
import FocusTrap from './FocusTrap';
|
|
@@ -18,9 +17,7 @@ import useValueRef from '../hooks/internal/useValueRef';
|
|
|
18
17
|
|
|
19
18
|
const { useActivityKeysByRead, useGetHasAcknowledgedByActivityKey, useGetKeyByActivity } = hooks;
|
|
20
19
|
|
|
21
|
-
type ActivityRowProps = PropsWithChildren<{
|
|
22
|
-
activity: DirectLineActivity;
|
|
23
|
-
}>;
|
|
20
|
+
type ActivityRowProps = PropsWithChildren<{ activity: WebChatActivity }>;
|
|
24
21
|
|
|
25
22
|
const ActivityRow = forwardRef<HTMLLIElement, ActivityRowProps>(({ activity, children }, ref) => {
|
|
26
23
|
const [activeDescendantId] = useActiveDescendantId();
|
|
@@ -112,6 +109,8 @@ ActivityRow.defaultProps = {
|
|
|
112
109
|
};
|
|
113
110
|
|
|
114
111
|
ActivityRow.propTypes = {
|
|
112
|
+
// PropTypes cannot fully capture TypeScript type.
|
|
113
|
+
// @ts-ignore
|
|
115
114
|
activity: PropTypes.shape({
|
|
116
115
|
channelData: PropTypes.shape({
|
|
117
116
|
speak: PropTypes.bool,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import type { DirectLineActivity } from 'botframework-webchat-core';
|
|
5
3
|
import type { RefObject, VFC } from 'react';
|
|
4
|
+
import type { WebChatActivity } from 'botframework-webchat-core';
|
|
6
5
|
|
|
7
6
|
import ScreenReaderText from '../ScreenReaderText';
|
|
8
7
|
import useActivityAccessibleName from './useActivityAccessibleName';
|
|
9
8
|
|
|
10
9
|
type ActivityTextAltProps = {
|
|
11
|
-
activity:
|
|
10
|
+
activity: WebChatActivity;
|
|
12
11
|
bodyRef: RefObject<HTMLDivElement>;
|
|
13
12
|
id: string;
|
|
14
13
|
};
|