@microsoft/omnichannel-chat-widget 1.1.1-main.45472ff → 1.1.1-main.9164f12
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/cjs/components/draggable/DraggableChatWidget.js +168 -0
- package/lib/cjs/components/draggable/DraggableEventEmitter.js +74 -0
- package/lib/cjs/components/draggable/DraggableEventNames.js +14 -0
- package/lib/cjs/components/draggable/DraggableEventReceiver.js +34 -0
- package/lib/cjs/components/draggable/IDraggableElementPosition.js +1 -0
- package/lib/cjs/components/draggable/IDraggableElementPositionDelta.js +1 -0
- package/lib/cjs/components/draggable/IDraggableEvent.js +1 -0
- package/lib/cjs/components/headerstateful/HeaderStateful.js +27 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +4 -1
- package/lib/cjs/components/livechatwidget/interfaces/IDraggableChatWidgetProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +22 -5
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -4
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +1 -0
- package/lib/esm/components/draggable/DraggableChatWidget.js +158 -0
- package/lib/esm/components/draggable/DraggableEventEmitter.js +64 -0
- package/lib/esm/components/draggable/DraggableEventNames.js +7 -0
- package/lib/esm/components/draggable/DraggableEventReceiver.js +25 -0
- package/lib/esm/components/draggable/IDraggableElementPosition.js +1 -0
- package/lib/esm/components/draggable/IDraggableElementPositionDelta.js +1 -0
- package/lib/esm/components/draggable/IDraggableEvent.js +1 -0
- package/lib/esm/components/headerstateful/HeaderStateful.js +27 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +4 -1
- package/lib/esm/components/livechatwidget/interfaces/IDraggableChatWidgetProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +22 -5
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -4
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +1 -0
- package/lib/types/components/draggable/DraggableChatWidget.d.ts +9 -0
- package/lib/types/components/draggable/DraggableEventEmitter.d.ts +27 -0
- package/lib/types/components/draggable/DraggableEventNames.d.ts +6 -0
- package/lib/types/components/draggable/DraggableEventReceiver.d.ts +27 -0
- package/lib/types/components/draggable/IDraggableElementPosition.d.ts +5 -0
- package/lib/types/components/draggable/IDraggableElementPositionDelta.d.ts +5 -0
- package/lib/types/components/draggable/IDraggableEvent.d.ts +12 -0
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +12 -0
- package/lib/types/components/livechatwidget/interfaces/IDraggableChatWidgetProps.d.ts +10 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _DraggableEventReceiver = _interopRequireDefault(require("./DraggableEventReceiver"));
|
|
9
|
+
var _DraggableEventNames = _interopRequireDefault(require("./DraggableEventNames"));
|
|
10
|
+
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
11
|
+
var _ConversationState = require("../../contexts/common/ConversationState");
|
|
12
|
+
var _utils = require("../../common/utils");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
const DraggableChatWidget = props => {
|
|
17
|
+
const [state] = (0, _useChatContextStore.default)();
|
|
18
|
+
const [initialPosition, setInitialPosition] = (0, _react.useState)({
|
|
19
|
+
offsetLeft: 0,
|
|
20
|
+
offsetTop: 0
|
|
21
|
+
});
|
|
22
|
+
const [cachedPosition, setCachedPosition] = (0, _react.useState)(undefined);
|
|
23
|
+
const [position, setPosition] = (0, _react.useState)({
|
|
24
|
+
offsetLeft: 0,
|
|
25
|
+
offsetTop: 0
|
|
26
|
+
});
|
|
27
|
+
const [delta, setDelta] = (0, _react.useState)({
|
|
28
|
+
left: 0,
|
|
29
|
+
top: 0
|
|
30
|
+
});
|
|
31
|
+
const repositionElement = (draggableElement, offsetLeft, offsetTop) => {
|
|
32
|
+
draggableElement.style.left = `${offsetLeft}px`;
|
|
33
|
+
draggableElement.style.top = `${offsetTop}px`;
|
|
34
|
+
};
|
|
35
|
+
const calculateOffsetsWithinViewport = (0, _react.useCallback)((id, offset, delta) => {
|
|
36
|
+
const draggableElement = document.getElementById(id);
|
|
37
|
+
const positionRelativeToViewport = draggableElement.getBoundingClientRect();
|
|
38
|
+
if ((0, _utils.isNullOrUndefined)(draggableElement) || (0, _utils.isNullOrUndefined)(positionRelativeToViewport) || (0, _utils.isNullOrUndefined)(offset.offsetLeft) || (0, _utils.isNullOrUndefined)(offset.offsetTop)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let offsetLeft = offset.offsetLeft;
|
|
42
|
+
let offsetTop = offset.offsetTop;
|
|
43
|
+
|
|
44
|
+
// Widget size larger than viewport would not have any restriction
|
|
45
|
+
if (positionRelativeToViewport.width > window.innerWidth) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (positionRelativeToViewport.height > window.innerHeight) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Ensures widget is within viewport
|
|
53
|
+
if (positionRelativeToViewport.x < 0) {
|
|
54
|
+
offsetLeft = 0 - delta.left;
|
|
55
|
+
}
|
|
56
|
+
if (positionRelativeToViewport.y < 0) {
|
|
57
|
+
offsetTop = 0 - delta.top;
|
|
58
|
+
}
|
|
59
|
+
if (positionRelativeToViewport.x + positionRelativeToViewport.width > window.innerWidth) {
|
|
60
|
+
offsetLeft = window.innerWidth - positionRelativeToViewport.width - delta.left;
|
|
61
|
+
}
|
|
62
|
+
if (positionRelativeToViewport.y + positionRelativeToViewport.height > window.innerHeight) {
|
|
63
|
+
offsetTop = window.innerHeight - positionRelativeToViewport.height - delta.top;
|
|
64
|
+
}
|
|
65
|
+
repositionElement(draggableElement, offsetLeft, offsetTop);
|
|
66
|
+
setPosition({
|
|
67
|
+
offsetLeft,
|
|
68
|
+
offsetTop
|
|
69
|
+
});
|
|
70
|
+
}, []);
|
|
71
|
+
const resetPosition = (0, _react.useCallback)(targetPosition => {
|
|
72
|
+
calculateOffsetsWithinViewport(props.elementId, targetPosition, delta); // Ensure viewport restriction
|
|
73
|
+
}, [delta]);
|
|
74
|
+
(0, _react.useEffect)(() => {
|
|
75
|
+
if (props.disabled === true) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const cacheInitialPosition = () => {
|
|
79
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
80
|
+
const offsetLeft = draggableElement.offsetLeft;
|
|
81
|
+
const offsetTop = draggableElement.offsetTop;
|
|
82
|
+
setInitialPosition({
|
|
83
|
+
offsetLeft,
|
|
84
|
+
offsetTop
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const calculateOffsets = () => {
|
|
88
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
89
|
+
const offsetLeft = draggableElement.offsetLeft;
|
|
90
|
+
const offsetTop = draggableElement.offsetTop;
|
|
91
|
+
|
|
92
|
+
// Calculates the delta between the position of the widget and the position of the widget relative to the viewport which will be used for repositioning
|
|
93
|
+
const positionRelativeToViewport = draggableElement.getBoundingClientRect();
|
|
94
|
+
const left = positionRelativeToViewport.left - offsetLeft;
|
|
95
|
+
const top = positionRelativeToViewport.top - offsetTop;
|
|
96
|
+
setDelta({
|
|
97
|
+
left,
|
|
98
|
+
top
|
|
99
|
+
});
|
|
100
|
+
calculateOffsetsWithinViewport(props.elementId, {
|
|
101
|
+
offsetLeft,
|
|
102
|
+
offsetTop
|
|
103
|
+
}, {
|
|
104
|
+
left,
|
|
105
|
+
top
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
calculateOffsets();
|
|
109
|
+
cacheInitialPosition();
|
|
110
|
+
window.addEventListener("resize", calculateOffsets);
|
|
111
|
+
return () => {
|
|
112
|
+
window.removeEventListener("resize", calculateOffsets);
|
|
113
|
+
};
|
|
114
|
+
}, [props.disabled]);
|
|
115
|
+
(0, _react.useEffect)(() => {
|
|
116
|
+
if (props.disabled === true) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (state.appStates.conversationState == _ConversationState.ConversationState.Closed) {
|
|
120
|
+
resetPosition(initialPosition);
|
|
121
|
+
} else if (state.appStates.isMinimized) {
|
|
122
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
123
|
+
const offsetLeft = draggableElement.offsetLeft;
|
|
124
|
+
const offsetTop = draggableElement.offsetTop;
|
|
125
|
+
if (!cachedPosition) {
|
|
126
|
+
setCachedPosition({
|
|
127
|
+
offsetLeft,
|
|
128
|
+
offsetTop
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
resetPosition(initialPosition);
|
|
132
|
+
} else if (!(0, _utils.isNullOrUndefined)(state.appStates.isMinimized) && !state.appStates.isMinimized) {
|
|
133
|
+
if (cachedPosition) {
|
|
134
|
+
resetPosition(cachedPosition);
|
|
135
|
+
setCachedPosition(undefined);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}, [props.disabled, state.appStates.isMinimized, state.appStates.conversationState, initialPosition, cachedPosition]);
|
|
139
|
+
const onEvent = (0, _react.useCallback)(event => {
|
|
140
|
+
if (event.eventName === _DraggableEventNames.default.Dragging) {
|
|
141
|
+
if (event.offset) {
|
|
142
|
+
const offsetLeft = position.offsetLeft + event.offset.x;
|
|
143
|
+
const offsetTop = position.offsetTop + event.offset.y;
|
|
144
|
+
|
|
145
|
+
// Update position via DOM manipulation to prevent <Stack/> continuously rendering on style change causing high CPU spike
|
|
146
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
147
|
+
repositionElement(draggableElement, offsetLeft, offsetTop);
|
|
148
|
+
setPosition({
|
|
149
|
+
offsetLeft,
|
|
150
|
+
offsetTop
|
|
151
|
+
});
|
|
152
|
+
calculateOffsetsWithinViewport(props.elementId, {
|
|
153
|
+
offsetLeft,
|
|
154
|
+
offsetTop
|
|
155
|
+
}, delta);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}, [position, delta]);
|
|
159
|
+
if (props.disabled === true) {
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, props.children);
|
|
161
|
+
}
|
|
162
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_DraggableEventReceiver.default, {
|
|
163
|
+
channel: props.channel ?? "lcw",
|
|
164
|
+
onEvent: onEvent
|
|
165
|
+
}, props.children));
|
|
166
|
+
};
|
|
167
|
+
var _default = DraggableChatWidget;
|
|
168
|
+
exports.default = _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _DraggableEventNames = _interopRequireDefault(require("./DraggableEventNames"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
+
/**
|
|
13
|
+
* Trigger component which would send IDraggableEvent to the receiver to update the draggable component position
|
|
14
|
+
*
|
|
15
|
+
* @param props IDraggableEventEmitterProps
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
const DraggableEventEmitter = props => {
|
|
19
|
+
const [initialized, setInitialized] = (0, _react.useState)(false);
|
|
20
|
+
const postMessage = (0, _react.useCallback)(data => {
|
|
21
|
+
const targetWindow = props.targetWindow ?? window;
|
|
22
|
+
targetWindow.postMessage(data, "*");
|
|
23
|
+
}, [props.targetWindow]);
|
|
24
|
+
const dragStart = (0, _react.useCallback)(event => {
|
|
25
|
+
postMessage({
|
|
26
|
+
channel: props.channel,
|
|
27
|
+
eventName: _DraggableEventNames.default.DragStart
|
|
28
|
+
});
|
|
29
|
+
let cursor = {
|
|
30
|
+
x: event.screenX,
|
|
31
|
+
y: event.screenY
|
|
32
|
+
}; // Cursor init position
|
|
33
|
+
const dragging = event => {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
const newX = event.screenX;
|
|
36
|
+
const newY = event.screenY;
|
|
37
|
+
const offset = {
|
|
38
|
+
x: newX - cursor.x,
|
|
39
|
+
y: newY - cursor.y
|
|
40
|
+
}; // Calculate cursor position diff
|
|
41
|
+
cursor = {
|
|
42
|
+
...cursor,
|
|
43
|
+
x: newX,
|
|
44
|
+
y: newY
|
|
45
|
+
}; // Update cursor new position
|
|
46
|
+
|
|
47
|
+
postMessage({
|
|
48
|
+
channel: props.channel,
|
|
49
|
+
eventName: _DraggableEventNames.default.Dragging,
|
|
50
|
+
offset
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const dragEnd = () => {
|
|
54
|
+
postMessage({
|
|
55
|
+
channel: props.channel,
|
|
56
|
+
eventName: _DraggableEventNames.default.DragEnd
|
|
57
|
+
});
|
|
58
|
+
document.removeEventListener("mousemove", dragging);
|
|
59
|
+
document.removeEventListener("mouseup", dragEnd);
|
|
60
|
+
};
|
|
61
|
+
document.addEventListener("mousemove", dragging);
|
|
62
|
+
document.addEventListener("mouseup", dragEnd);
|
|
63
|
+
}, [props.channel]);
|
|
64
|
+
(0, _react.useEffect)(() => {
|
|
65
|
+
if (!initialized && props.elementId) {
|
|
66
|
+
const element = document.getElementById(props.elementId);
|
|
67
|
+
element === null || element === void 0 ? void 0 : element.addEventListener("mousedown", dragStart);
|
|
68
|
+
setInitialized(true);
|
|
69
|
+
}
|
|
70
|
+
}, [dragStart, props.elementId, initialized]);
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", props.children, " ");
|
|
72
|
+
};
|
|
73
|
+
var _default = DraggableEventEmitter;
|
|
74
|
+
exports.default = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var DraggableEventNames;
|
|
8
|
+
(function (DraggableEventNames) {
|
|
9
|
+
DraggableEventNames["DragStart"] = "DragStart";
|
|
10
|
+
DraggableEventNames["Dragging"] = "Dragging";
|
|
11
|
+
DraggableEventNames["DragEnd"] = "DragEnd";
|
|
12
|
+
})(DraggableEventNames || (DraggableEventNames = {}));
|
|
13
|
+
var _default = DraggableEventNames;
|
|
14
|
+
exports.default = _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
+
/**
|
|
11
|
+
* Component which would listen to DraggableEvent, update the component position or react accordingly.
|
|
12
|
+
*
|
|
13
|
+
* @param props IDraggableEventReceiverProps
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const DraggableEventReceiver = props => {
|
|
17
|
+
(0, _react.useEffect)(() => {
|
|
18
|
+
const listener = event => {
|
|
19
|
+
const {
|
|
20
|
+
data
|
|
21
|
+
} = event;
|
|
22
|
+
if (data.channel && props.channel && data.channel === props.channel) {
|
|
23
|
+
props.onEvent(data);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
window.addEventListener("message", listener);
|
|
27
|
+
return () => {
|
|
28
|
+
window.removeEventListener("message", listener);
|
|
29
|
+
};
|
|
30
|
+
}, [props]);
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", props.children, " ");
|
|
32
|
+
};
|
|
33
|
+
var _default = DraggableEventReceiver;
|
|
34
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -14,6 +14,7 @@ var _defaultOutOfOfficeHeaderStyleProps = require("./common/styleProps/defaultOu
|
|
|
14
14
|
var _useChatAdapterStore = _interopRequireDefault(require("../../hooks/useChatAdapterStore"));
|
|
15
15
|
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
16
16
|
var _Constants = require("../../common/Constants");
|
|
17
|
+
var _DraggableEventEmitter = _interopRequireDefault(require("../draggable/DraggableEventEmitter"));
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -100,6 +101,32 @@ const HeaderStateful = props => {
|
|
|
100
101
|
var _state$domainStates2;
|
|
101
102
|
localConfirmationPaneState.current = state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.confirmationState;
|
|
102
103
|
}, [state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.confirmationState]);
|
|
104
|
+
const draggableEventEmitterProps = {
|
|
105
|
+
channel: props.draggableEventChannel ?? "lcw",
|
|
106
|
+
elementId: outOfOperatingHours || state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice ? outOfOfficeControlProps.id : controlProps.id,
|
|
107
|
+
targetWindow: props.draggableEventEmitterTargetWindow ?? window
|
|
108
|
+
};
|
|
109
|
+
if (props.draggable === true) {
|
|
110
|
+
var _generalStyleProps;
|
|
111
|
+
const styleProps = outOfOperatingHours || state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice ? outOfOfficeStyleProps : headerProps === null || headerProps === void 0 ? void 0 : headerProps.styleProps;
|
|
112
|
+
const draggableSelectors = {
|
|
113
|
+
"&:hover": {
|
|
114
|
+
cursor: "move"
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const selectors = Object.assign({}, (styleProps === null || styleProps === void 0 ? void 0 : (_generalStyleProps = styleProps.generalStyleProps) === null || _generalStyleProps === void 0 ? void 0 : _generalStyleProps.selectors) || {}, draggableSelectors); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
118
|
+
const generalStyleProps = Object.assign({}, styleProps === null || styleProps === void 0 ? void 0 : styleProps.generalStyleProps, {
|
|
119
|
+
selectors
|
|
120
|
+
});
|
|
121
|
+
const draggableStyleProps = Object.assign({}, styleProps, {
|
|
122
|
+
generalStyleProps
|
|
123
|
+
});
|
|
124
|
+
return /*#__PURE__*/_react.default.createElement(_DraggableEventEmitter.default, draggableEventEmitterProps, /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Header, {
|
|
125
|
+
componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
|
|
126
|
+
controlProps: outOfOperatingHours || state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
|
|
127
|
+
styleProps: draggableStyleProps
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
103
130
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Header, {
|
|
104
131
|
componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
|
|
105
132
|
controlProps: outOfOperatingHours || state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
|
|
@@ -1804,7 +1804,10 @@ const dummyDefaultProps = {
|
|
|
1804
1804
|
},
|
|
1805
1805
|
adaptiveCardStyles: {
|
|
1806
1806
|
background: "white",
|
|
1807
|
-
color: "black"
|
|
1807
|
+
color: "black",
|
|
1808
|
+
anchorColor: "blue",
|
|
1809
|
+
textWhiteSpace: "normal",
|
|
1810
|
+
buttonWhiteSpace: "normal"
|
|
1808
1811
|
},
|
|
1809
1812
|
hyperlinkTextOverride: false
|
|
1810
1813
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -53,12 +53,13 @@ var _startProactiveChat = require("../common/startProactiveChat");
|
|
|
53
53
|
var _useChatAdapterStore = _interopRequireDefault(require("../../../hooks/useChatAdapterStore"));
|
|
54
54
|
var _useChatContextStore = _interopRequireDefault(require("../../../hooks/useChatContextStore"));
|
|
55
55
|
var _useChatSDKStore = _interopRequireDefault(require("../../../hooks/useChatSDKStore"));
|
|
56
|
+
var _DraggableChatWidget = _interopRequireDefault(require("../../draggable/DraggableChatWidget"));
|
|
56
57
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
58
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
58
59
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
59
60
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
60
61
|
const LiveChatWidgetStateful = props => {
|
|
61
|
-
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
62
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$controlProps11, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
62
63
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
63
64
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
65
|
const [adapter, setAdapter] = (0, _useChatAdapterStore.default)();
|
|
@@ -617,6 +618,22 @@ const LiveChatWidgetStateful = props => {
|
|
|
617
618
|
...props,
|
|
618
619
|
downloadTranscriptProps
|
|
619
620
|
};
|
|
621
|
+
const chatWidgetDraggableConfig = {
|
|
622
|
+
elementId: widgetElementId,
|
|
623
|
+
channel: ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "lcw",
|
|
624
|
+
disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
// Disable receiving IDraggableEvent in current window
|
|
628
|
+
if (((_props$draggableChatW2 = props.draggableChatWidgetProps) === null || _props$draggableChatW2 === void 0 ? void 0 : _props$draggableChatW2.disabled) === false && (_props$draggableChatW3 = props.draggableChatWidgetProps) !== null && _props$draggableChatW3 !== void 0 && _props$draggableChatW3.targetIframe) {
|
|
629
|
+
chatWidgetDraggableConfig.disabled = true;
|
|
630
|
+
}
|
|
631
|
+
const headerDraggableConfig = {
|
|
632
|
+
draggableEventChannel: chatWidgetDraggableConfig.channel ?? "lcw",
|
|
633
|
+
draggableEventEmitterTargetWindow: (_props$draggableChatW4 = props.draggableChatWidgetProps) !== null && _props$draggableChatW4 !== void 0 && _props$draggableChatW4.targetIframe ? window.parent : window,
|
|
634
|
+
draggable: ((_props$draggableChatW5 = props.draggableChatWidgetProps) === null || _props$draggableChatW5 === void 0 ? void 0 : _props$draggableChatW5.disabled) !== true // Draggable by default, unless explicitly disabled
|
|
635
|
+
};
|
|
636
|
+
|
|
620
637
|
return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
|
|
621
638
|
::-webkit-scrollbar {
|
|
622
639
|
width: ${scrollbarProps.width};
|
|
@@ -634,7 +651,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
634
651
|
::-webkit-scrollbar-thumb:hover {
|
|
635
652
|
background: ${scrollbarProps.thumbHoverColor};
|
|
636
653
|
}
|
|
637
|
-
`), /*#__PURE__*/_react2.default.createElement(Composer, _extends({}, webChatProps, {
|
|
654
|
+
`), /*#__PURE__*/_react2.default.createElement(_DraggableChatWidget.default, chatWidgetDraggableConfig, /*#__PURE__*/_react2.default.createElement(Composer, _extends({}, webChatProps, {
|
|
638
655
|
styleOptions: webChatStyles,
|
|
639
656
|
directLine: ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.directLine
|
|
640
657
|
}), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
@@ -648,11 +665,11 @@ const LiveChatWidgetStateful = props => {
|
|
|
648
665
|
})), !((_livechatProps$contro3 = livechatProps.controlProps) !== null && _livechatProps$contro3 !== void 0 && _livechatProps$contro3.hideProactiveChatPane) && (0, _componentController.shouldShowProactiveChatPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon2 = livechatProps.componentOverrides) === null || _livechatProps$compon2 === void 0 ? void 0 : _livechatProps$compon2.proactiveChatPane) || /*#__PURE__*/_react2.default.createElement(_ProactiveChatPaneStateful.default, {
|
|
649
666
|
proactiveChatProps: livechatProps.proactiveChatPaneProps,
|
|
650
667
|
startChat: prepareStartChatRelay
|
|
651
|
-
})), !((_livechatProps$contro4 = livechatProps.controlProps) !== null && _livechatProps$contro4 !== void 0 && _livechatProps$contro4.hideHeader) && (0, _componentController.shouldShowHeader)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon3 = livechatProps.componentOverrides) === null || _livechatProps$compon3 === void 0 ? void 0 : _livechatProps$compon3.header) || /*#__PURE__*/_react2.default.createElement(_HeaderStateful.default, {
|
|
668
|
+
})), !((_livechatProps$contro4 = livechatProps.controlProps) !== null && _livechatProps$contro4 !== void 0 && _livechatProps$contro4.hideHeader) && (0, _componentController.shouldShowHeader)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon3 = livechatProps.componentOverrides) === null || _livechatProps$compon3 === void 0 ? void 0 : _livechatProps$compon3.header) || /*#__PURE__*/_react2.default.createElement(_HeaderStateful.default, _extends({
|
|
652
669
|
headerProps: livechatProps.headerProps,
|
|
653
670
|
outOfOfficeHeaderProps: livechatProps.outOfOfficeHeaderProps,
|
|
654
671
|
endChat: endChatRelay
|
|
655
|
-
})), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && (0, _componentController.shouldShowLoadingPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/_react2.default.createElement(_LoadingPaneStateful.default, {
|
|
672
|
+
}, headerDraggableConfig))), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && (0, _componentController.shouldShowLoadingPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/_react2.default.createElement(_LoadingPaneStateful.default, {
|
|
656
673
|
loadingPaneProps: livechatProps.loadingPaneProps,
|
|
657
674
|
startChatErrorPaneProps: livechatProps.startChatErrorPaneProps
|
|
658
675
|
})), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.hideOutOfOfficeHoursPane) && (0, _componentController.shouldShowOutOfOfficeHoursPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon5 = livechatProps.componentOverrides) === null || _livechatProps$compon5 === void 0 ? void 0 : _livechatProps$compon5.outOfOfficeHoursPane) || /*#__PURE__*/_react2.default.createElement(_OOOHPaneStateful.default, livechatProps.outOfOfficeHoursPaneProps)), !((_livechatProps$contro7 = livechatProps.controlProps) !== null && _livechatProps$contro7 !== void 0 && _livechatProps$contro7.hideReconnectChatPane) && (0, _componentController.shouldShowReconnectChatPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon6 = livechatProps.componentOverrides) === null || _livechatProps$compon6 === void 0 ? void 0 : _livechatProps$compon6.reconnectChatPane) || /*#__PURE__*/_react2.default.createElement(_ReconnectChatPaneStateful.default, {
|
|
@@ -666,7 +683,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
666
683
|
}, livechatProps.callingContainerProps)), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideWebChatContainer) && (0, _componentController.shouldShowWebChatContainer)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.webChatContainer) || /*#__PURE__*/_react2.default.createElement(_WebChatContainerStateful.default, livechatProps.webChatContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideConfirmationPane) && (0, _componentController.shouldShowConfirmationPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.confirmationPane) || /*#__PURE__*/_react2.default.createElement(_ConfirmationPaneStateful.default, _extends({}, confirmationPaneProps, {
|
|
667
684
|
setPostChatContext: setPostChatContextRelay,
|
|
668
685
|
prepareEndChat: prepareEndChatRelay
|
|
669
|
-
}))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && (0, _componentController.shouldShowPostChatLoadingPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/_react2.default.createElement(_PostChatLoadingPaneStateful.default, livechatProps.postChatLoadingPaneProps)), (0, _componentController.shouldShowPostChatSurveyPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/_react2.default.createElement(_PostChatSurveyPaneStateful.default, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), (0, _createFooter.createFooter)(livechatProps, state), (0, _componentController.shouldShowEmailTranscriptPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/_react2.default.createElement(_EmailTranscriptPaneStateful.default, livechatProps.emailTranscriptPane)))));
|
|
686
|
+
}))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && (0, _componentController.shouldShowPostChatLoadingPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/_react2.default.createElement(_PostChatLoadingPaneStateful.default, livechatProps.postChatLoadingPaneProps)), (0, _componentController.shouldShowPostChatSurveyPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/_react2.default.createElement(_PostChatSurveyPaneStateful.default, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), (0, _createFooter.createFooter)(livechatProps, state), (0, _componentController.shouldShowEmailTranscriptPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/_react2.default.createElement(_EmailTranscriptPaneStateful.default, livechatProps.emailTranscriptPane))))));
|
|
670
687
|
};
|
|
671
688
|
exports.LiveChatWidgetStateful = LiveChatWidgetStateful;
|
|
672
689
|
var _default = LiveChatWidgetStateful;
|
|
@@ -52,7 +52,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
const WebChatContainerStateful = props => {
|
|
55
|
-
var _props$adaptiveCardSt, _props$renderingMiddl, _props$renderingMiddl2, _props$renderingMiddl3, _props$renderingMiddl4, _props$adaptiveCardSt2, _props$adaptiveCardSt3, _props$adaptiveCardSt4, _props$renderingMiddl5, _props$renderingMiddl6, _props$renderingMiddl7, _props$renderingMiddl8, _props$renderingMiddl9, _props$renderingMiddl10;
|
|
55
|
+
var _props$adaptiveCardSt, _props$renderingMiddl, _props$renderingMiddl2, _props$renderingMiddl3, _props$renderingMiddl4, _props$adaptiveCardSt2, _props$adaptiveCardSt3, _props$adaptiveCardSt4, _props$adaptiveCardSt5, _props$renderingMiddl5, _props$renderingMiddl6, _props$renderingMiddl7, _props$renderingMiddl8, _props$renderingMiddl9, _props$renderingMiddl10;
|
|
56
56
|
const {
|
|
57
57
|
BasicWebChat
|
|
58
58
|
} = _botframeworkWebchat.Components;
|
|
@@ -133,9 +133,16 @@ const WebChatContainerStateful = props => {
|
|
|
133
133
|
max-width: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl3 = props.renderingMiddlewareProps) === null || _props$renderingMiddl3 === void 0 ? void 0 : (_props$renderingMiddl4 = _props$renderingMiddl3.systemMessageBoxStyles) === null || _props$renderingMiddl4 === void 0 ? void 0 : _props$renderingMiddl4.maxWidth) ?? (_defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles === null || _defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles === void 0 ? void 0 : _defaultSystemMessageBoxStyles.defaultSystemMessageBoxStyles.maxWidth)}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
div[class="ac-textBlock"]
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
div[class="ac-textBlock"] *,
|
|
137
|
+
div[class="ac-input-container"] * {color:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt2 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt2 === void 0 ? void 0 : _props$adaptiveCardSt2.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color}; white-space:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt3 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt3 === void 0 ? void 0 : _props$adaptiveCardSt3.textWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
138
|
+
div[class="ac-textBlock"] a:link,
|
|
139
|
+
div[class="ac-textBlock"] a:visited,
|
|
140
|
+
div[class="ac-textBlock"] a:hover,
|
|
141
|
+
div[class="ac-textBlock"] a:active {
|
|
142
|
+
color: ${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt4 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt4 === void 0 ? void 0 : _props$adaptiveCardSt4.anchorColor) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.anchorColor};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt5 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt5 === void 0 ? void 0 : _props$adaptiveCardSt5.buttonWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
139
146
|
|
|
140
147
|
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
141
148
|
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import DraggableEventReceiver from "./DraggableEventReceiver";
|
|
3
|
+
import DraggableEventNames from "./DraggableEventNames";
|
|
4
|
+
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
5
|
+
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
6
|
+
import { isNullOrUndefined } from "../../common/utils";
|
|
7
|
+
const DraggableChatWidget = props => {
|
|
8
|
+
const [state] = useChatContextStore();
|
|
9
|
+
const [initialPosition, setInitialPosition] = useState({
|
|
10
|
+
offsetLeft: 0,
|
|
11
|
+
offsetTop: 0
|
|
12
|
+
});
|
|
13
|
+
const [cachedPosition, setCachedPosition] = useState(undefined);
|
|
14
|
+
const [position, setPosition] = useState({
|
|
15
|
+
offsetLeft: 0,
|
|
16
|
+
offsetTop: 0
|
|
17
|
+
});
|
|
18
|
+
const [delta, setDelta] = useState({
|
|
19
|
+
left: 0,
|
|
20
|
+
top: 0
|
|
21
|
+
});
|
|
22
|
+
const repositionElement = (draggableElement, offsetLeft, offsetTop) => {
|
|
23
|
+
draggableElement.style.left = `${offsetLeft}px`;
|
|
24
|
+
draggableElement.style.top = `${offsetTop}px`;
|
|
25
|
+
};
|
|
26
|
+
const calculateOffsetsWithinViewport = useCallback((id, offset, delta) => {
|
|
27
|
+
const draggableElement = document.getElementById(id);
|
|
28
|
+
const positionRelativeToViewport = draggableElement.getBoundingClientRect();
|
|
29
|
+
if (isNullOrUndefined(draggableElement) || isNullOrUndefined(positionRelativeToViewport) || isNullOrUndefined(offset.offsetLeft) || isNullOrUndefined(offset.offsetTop)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
let offsetLeft = offset.offsetLeft;
|
|
33
|
+
let offsetTop = offset.offsetTop;
|
|
34
|
+
|
|
35
|
+
// Widget size larger than viewport would not have any restriction
|
|
36
|
+
if (positionRelativeToViewport.width > window.innerWidth) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (positionRelativeToViewport.height > window.innerHeight) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Ensures widget is within viewport
|
|
44
|
+
if (positionRelativeToViewport.x < 0) {
|
|
45
|
+
offsetLeft = 0 - delta.left;
|
|
46
|
+
}
|
|
47
|
+
if (positionRelativeToViewport.y < 0) {
|
|
48
|
+
offsetTop = 0 - delta.top;
|
|
49
|
+
}
|
|
50
|
+
if (positionRelativeToViewport.x + positionRelativeToViewport.width > window.innerWidth) {
|
|
51
|
+
offsetLeft = window.innerWidth - positionRelativeToViewport.width - delta.left;
|
|
52
|
+
}
|
|
53
|
+
if (positionRelativeToViewport.y + positionRelativeToViewport.height > window.innerHeight) {
|
|
54
|
+
offsetTop = window.innerHeight - positionRelativeToViewport.height - delta.top;
|
|
55
|
+
}
|
|
56
|
+
repositionElement(draggableElement, offsetLeft, offsetTop);
|
|
57
|
+
setPosition({
|
|
58
|
+
offsetLeft,
|
|
59
|
+
offsetTop
|
|
60
|
+
});
|
|
61
|
+
}, []);
|
|
62
|
+
const resetPosition = useCallback(targetPosition => {
|
|
63
|
+
calculateOffsetsWithinViewport(props.elementId, targetPosition, delta); // Ensure viewport restriction
|
|
64
|
+
}, [delta]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (props.disabled === true) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const cacheInitialPosition = () => {
|
|
70
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
71
|
+
const offsetLeft = draggableElement.offsetLeft;
|
|
72
|
+
const offsetTop = draggableElement.offsetTop;
|
|
73
|
+
setInitialPosition({
|
|
74
|
+
offsetLeft,
|
|
75
|
+
offsetTop
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const calculateOffsets = () => {
|
|
79
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
80
|
+
const offsetLeft = draggableElement.offsetLeft;
|
|
81
|
+
const offsetTop = draggableElement.offsetTop;
|
|
82
|
+
|
|
83
|
+
// Calculates the delta between the position of the widget and the position of the widget relative to the viewport which will be used for repositioning
|
|
84
|
+
const positionRelativeToViewport = draggableElement.getBoundingClientRect();
|
|
85
|
+
const left = positionRelativeToViewport.left - offsetLeft;
|
|
86
|
+
const top = positionRelativeToViewport.top - offsetTop;
|
|
87
|
+
setDelta({
|
|
88
|
+
left,
|
|
89
|
+
top
|
|
90
|
+
});
|
|
91
|
+
calculateOffsetsWithinViewport(props.elementId, {
|
|
92
|
+
offsetLeft,
|
|
93
|
+
offsetTop
|
|
94
|
+
}, {
|
|
95
|
+
left,
|
|
96
|
+
top
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
calculateOffsets();
|
|
100
|
+
cacheInitialPosition();
|
|
101
|
+
window.addEventListener("resize", calculateOffsets);
|
|
102
|
+
return () => {
|
|
103
|
+
window.removeEventListener("resize", calculateOffsets);
|
|
104
|
+
};
|
|
105
|
+
}, [props.disabled]);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (props.disabled === true) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (state.appStates.conversationState == ConversationState.Closed) {
|
|
111
|
+
resetPosition(initialPosition);
|
|
112
|
+
} else if (state.appStates.isMinimized) {
|
|
113
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
114
|
+
const offsetLeft = draggableElement.offsetLeft;
|
|
115
|
+
const offsetTop = draggableElement.offsetTop;
|
|
116
|
+
if (!cachedPosition) {
|
|
117
|
+
setCachedPosition({
|
|
118
|
+
offsetLeft,
|
|
119
|
+
offsetTop
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
resetPosition(initialPosition);
|
|
123
|
+
} else if (!isNullOrUndefined(state.appStates.isMinimized) && !state.appStates.isMinimized) {
|
|
124
|
+
if (cachedPosition) {
|
|
125
|
+
resetPosition(cachedPosition);
|
|
126
|
+
setCachedPosition(undefined);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, [props.disabled, state.appStates.isMinimized, state.appStates.conversationState, initialPosition, cachedPosition]);
|
|
130
|
+
const onEvent = useCallback(event => {
|
|
131
|
+
if (event.eventName === DraggableEventNames.Dragging) {
|
|
132
|
+
if (event.offset) {
|
|
133
|
+
const offsetLeft = position.offsetLeft + event.offset.x;
|
|
134
|
+
const offsetTop = position.offsetTop + event.offset.y;
|
|
135
|
+
|
|
136
|
+
// Update position via DOM manipulation to prevent <Stack/> continuously rendering on style change causing high CPU spike
|
|
137
|
+
const draggableElement = document.getElementById(props.elementId);
|
|
138
|
+
repositionElement(draggableElement, offsetLeft, offsetTop);
|
|
139
|
+
setPosition({
|
|
140
|
+
offsetLeft,
|
|
141
|
+
offsetTop
|
|
142
|
+
});
|
|
143
|
+
calculateOffsetsWithinViewport(props.elementId, {
|
|
144
|
+
offsetLeft,
|
|
145
|
+
offsetTop
|
|
146
|
+
}, delta);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, [position, delta]);
|
|
150
|
+
if (props.disabled === true) {
|
|
151
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
|
|
152
|
+
}
|
|
153
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DraggableEventReceiver, {
|
|
154
|
+
channel: props.channel ?? "lcw",
|
|
155
|
+
onEvent: onEvent
|
|
156
|
+
}, props.children));
|
|
157
|
+
};
|
|
158
|
+
export default DraggableChatWidget;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import DraggableEventNames from "./DraggableEventNames";
|
|
3
|
+
/**
|
|
4
|
+
* Trigger component which would send IDraggableEvent to the receiver to update the draggable component position
|
|
5
|
+
*
|
|
6
|
+
* @param props IDraggableEventEmitterProps
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
const DraggableEventEmitter = props => {
|
|
10
|
+
const [initialized, setInitialized] = useState(false);
|
|
11
|
+
const postMessage = useCallback(data => {
|
|
12
|
+
const targetWindow = props.targetWindow ?? window;
|
|
13
|
+
targetWindow.postMessage(data, "*");
|
|
14
|
+
}, [props.targetWindow]);
|
|
15
|
+
const dragStart = useCallback(event => {
|
|
16
|
+
postMessage({
|
|
17
|
+
channel: props.channel,
|
|
18
|
+
eventName: DraggableEventNames.DragStart
|
|
19
|
+
});
|
|
20
|
+
let cursor = {
|
|
21
|
+
x: event.screenX,
|
|
22
|
+
y: event.screenY
|
|
23
|
+
}; // Cursor init position
|
|
24
|
+
const dragging = event => {
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
const newX = event.screenX;
|
|
27
|
+
const newY = event.screenY;
|
|
28
|
+
const offset = {
|
|
29
|
+
x: newX - cursor.x,
|
|
30
|
+
y: newY - cursor.y
|
|
31
|
+
}; // Calculate cursor position diff
|
|
32
|
+
cursor = {
|
|
33
|
+
...cursor,
|
|
34
|
+
x: newX,
|
|
35
|
+
y: newY
|
|
36
|
+
}; // Update cursor new position
|
|
37
|
+
|
|
38
|
+
postMessage({
|
|
39
|
+
channel: props.channel,
|
|
40
|
+
eventName: DraggableEventNames.Dragging,
|
|
41
|
+
offset
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const dragEnd = () => {
|
|
45
|
+
postMessage({
|
|
46
|
+
channel: props.channel,
|
|
47
|
+
eventName: DraggableEventNames.DragEnd
|
|
48
|
+
});
|
|
49
|
+
document.removeEventListener("mousemove", dragging);
|
|
50
|
+
document.removeEventListener("mouseup", dragEnd);
|
|
51
|
+
};
|
|
52
|
+
document.addEventListener("mousemove", dragging);
|
|
53
|
+
document.addEventListener("mouseup", dragEnd);
|
|
54
|
+
}, [props.channel]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!initialized && props.elementId) {
|
|
57
|
+
const element = document.getElementById(props.elementId);
|
|
58
|
+
element === null || element === void 0 ? void 0 : element.addEventListener("mousedown", dragStart);
|
|
59
|
+
setInitialized(true);
|
|
60
|
+
}
|
|
61
|
+
}, [dragStart, props.elementId, initialized]);
|
|
62
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, " ", props.children, " ");
|
|
63
|
+
};
|
|
64
|
+
export default DraggableEventEmitter;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var DraggableEventNames;
|
|
2
|
+
(function (DraggableEventNames) {
|
|
3
|
+
DraggableEventNames["DragStart"] = "DragStart";
|
|
4
|
+
DraggableEventNames["Dragging"] = "Dragging";
|
|
5
|
+
DraggableEventNames["DragEnd"] = "DragEnd";
|
|
6
|
+
})(DraggableEventNames || (DraggableEventNames = {}));
|
|
7
|
+
export default DraggableEventNames;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Component which would listen to DraggableEvent, update the component position or react accordingly.
|
|
4
|
+
*
|
|
5
|
+
* @param props IDraggableEventReceiverProps
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
const DraggableEventReceiver = props => {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const listener = event => {
|
|
11
|
+
const {
|
|
12
|
+
data
|
|
13
|
+
} = event;
|
|
14
|
+
if (data.channel && props.channel && data.channel === props.channel) {
|
|
15
|
+
props.onEvent(data);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
window.addEventListener("message", listener);
|
|
19
|
+
return () => {
|
|
20
|
+
window.removeEventListener("message", listener);
|
|
21
|
+
};
|
|
22
|
+
}, [props]);
|
|
23
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, " ", props.children, " ");
|
|
24
|
+
};
|
|
25
|
+
export default DraggableEventReceiver;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,6 +8,7 @@ import { defaultOutOfOfficeHeaderStyleProps } from "./common/styleProps/defaultO
|
|
|
8
8
|
import useChatAdapterStore from "../../hooks/useChatAdapterStore";
|
|
9
9
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
10
10
|
import { ConfirmationState } from "../../common/Constants";
|
|
11
|
+
import DraggableEventEmitter from "../draggable/DraggableEventEmitter";
|
|
11
12
|
export const HeaderStateful = props => {
|
|
12
13
|
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro, _state$domainStates3;
|
|
13
14
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -91,6 +92,32 @@ export const HeaderStateful = props => {
|
|
|
91
92
|
var _state$domainStates2;
|
|
92
93
|
localConfirmationPaneState.current = state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.confirmationState;
|
|
93
94
|
}, [state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.confirmationState]);
|
|
95
|
+
const draggableEventEmitterProps = {
|
|
96
|
+
channel: props.draggableEventChannel ?? "lcw",
|
|
97
|
+
elementId: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps.id : controlProps.id,
|
|
98
|
+
targetWindow: props.draggableEventEmitterTargetWindow ?? window
|
|
99
|
+
};
|
|
100
|
+
if (props.draggable === true) {
|
|
101
|
+
var _generalStyleProps;
|
|
102
|
+
const styleProps = outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeStyleProps : headerProps === null || headerProps === void 0 ? void 0 : headerProps.styleProps;
|
|
103
|
+
const draggableSelectors = {
|
|
104
|
+
"&:hover": {
|
|
105
|
+
cursor: "move"
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const selectors = Object.assign({}, (styleProps === null || styleProps === void 0 ? void 0 : (_generalStyleProps = styleProps.generalStyleProps) === null || _generalStyleProps === void 0 ? void 0 : _generalStyleProps.selectors) || {}, draggableSelectors); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
109
|
+
const generalStyleProps = Object.assign({}, styleProps === null || styleProps === void 0 ? void 0 : styleProps.generalStyleProps, {
|
|
110
|
+
selectors
|
|
111
|
+
});
|
|
112
|
+
const draggableStyleProps = Object.assign({}, styleProps, {
|
|
113
|
+
generalStyleProps
|
|
114
|
+
});
|
|
115
|
+
return /*#__PURE__*/React.createElement(DraggableEventEmitter, draggableEventEmitterProps, /*#__PURE__*/React.createElement(Header, {
|
|
116
|
+
componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
|
|
117
|
+
controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
|
|
118
|
+
styleProps: draggableStyleProps
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
94
121
|
return /*#__PURE__*/React.createElement(Header, {
|
|
95
122
|
componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
|
|
96
123
|
controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
|
|
@@ -1798,7 +1798,10 @@ export const dummyDefaultProps = {
|
|
|
1798
1798
|
},
|
|
1799
1799
|
adaptiveCardStyles: {
|
|
1800
1800
|
background: "white",
|
|
1801
|
-
color: "black"
|
|
1801
|
+
color: "black",
|
|
1802
|
+
anchorColor: "blue",
|
|
1803
|
+
textWhiteSpace: "normal",
|
|
1804
|
+
buttonWhiteSpace: "normal"
|
|
1802
1805
|
},
|
|
1803
1806
|
hyperlinkTextOverride: false
|
|
1804
1807
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -49,8 +49,9 @@ import { startProactiveChat } from "../common/startProactiveChat";
|
|
|
49
49
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
50
50
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
51
51
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
52
|
+
import DraggableChatWidget from "../../draggable/DraggableChatWidget";
|
|
52
53
|
export const LiveChatWidgetStateful = props => {
|
|
53
|
-
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
54
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$controlProps11, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
54
55
|
const [state, dispatch] = useChatContextStore();
|
|
55
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
57
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -609,6 +610,22 @@ export const LiveChatWidgetStateful = props => {
|
|
|
609
610
|
...props,
|
|
610
611
|
downloadTranscriptProps
|
|
611
612
|
};
|
|
613
|
+
const chatWidgetDraggableConfig = {
|
|
614
|
+
elementId: widgetElementId,
|
|
615
|
+
channel: ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "lcw",
|
|
616
|
+
disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
// Disable receiving IDraggableEvent in current window
|
|
620
|
+
if (((_props$draggableChatW2 = props.draggableChatWidgetProps) === null || _props$draggableChatW2 === void 0 ? void 0 : _props$draggableChatW2.disabled) === false && (_props$draggableChatW3 = props.draggableChatWidgetProps) !== null && _props$draggableChatW3 !== void 0 && _props$draggableChatW3.targetIframe) {
|
|
621
|
+
chatWidgetDraggableConfig.disabled = true;
|
|
622
|
+
}
|
|
623
|
+
const headerDraggableConfig = {
|
|
624
|
+
draggableEventChannel: chatWidgetDraggableConfig.channel ?? "lcw",
|
|
625
|
+
draggableEventEmitterTargetWindow: (_props$draggableChatW4 = props.draggableChatWidgetProps) !== null && _props$draggableChatW4 !== void 0 && _props$draggableChatW4.targetIframe ? window.parent : window,
|
|
626
|
+
draggable: ((_props$draggableChatW5 = props.draggableChatWidgetProps) === null || _props$draggableChatW5 === void 0 ? void 0 : _props$draggableChatW5.disabled) !== true // Draggable by default, unless explicitly disabled
|
|
627
|
+
};
|
|
628
|
+
|
|
612
629
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
613
630
|
::-webkit-scrollbar {
|
|
614
631
|
width: ${scrollbarProps.width};
|
|
@@ -626,7 +643,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
626
643
|
::-webkit-scrollbar-thumb:hover {
|
|
627
644
|
background: ${scrollbarProps.thumbHoverColor};
|
|
628
645
|
}
|
|
629
|
-
`), /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
|
|
646
|
+
`), /*#__PURE__*/React.createElement(DraggableChatWidget, chatWidgetDraggableConfig, /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
|
|
630
647
|
styleOptions: webChatStyles,
|
|
631
648
|
directLine: ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
|
|
632
649
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -640,11 +657,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
640
657
|
})), !((_livechatProps$contro3 = livechatProps.controlProps) !== null && _livechatProps$contro3 !== void 0 && _livechatProps$contro3.hideProactiveChatPane) && shouldShowProactiveChatPane(state) && (decodeComponentString((_livechatProps$compon2 = livechatProps.componentOverrides) === null || _livechatProps$compon2 === void 0 ? void 0 : _livechatProps$compon2.proactiveChatPane) || /*#__PURE__*/React.createElement(ProactiveChatPaneStateful, {
|
|
641
658
|
proactiveChatProps: livechatProps.proactiveChatPaneProps,
|
|
642
659
|
startChat: prepareStartChatRelay
|
|
643
|
-
})), !((_livechatProps$contro4 = livechatProps.controlProps) !== null && _livechatProps$contro4 !== void 0 && _livechatProps$contro4.hideHeader) && shouldShowHeader(state) && (decodeComponentString((_livechatProps$compon3 = livechatProps.componentOverrides) === null || _livechatProps$compon3 === void 0 ? void 0 : _livechatProps$compon3.header) || /*#__PURE__*/React.createElement(HeaderStateful, {
|
|
660
|
+
})), !((_livechatProps$contro4 = livechatProps.controlProps) !== null && _livechatProps$contro4 !== void 0 && _livechatProps$contro4.hideHeader) && shouldShowHeader(state) && (decodeComponentString((_livechatProps$compon3 = livechatProps.componentOverrides) === null || _livechatProps$compon3 === void 0 ? void 0 : _livechatProps$compon3.header) || /*#__PURE__*/React.createElement(HeaderStateful, _extends({
|
|
644
661
|
headerProps: livechatProps.headerProps,
|
|
645
662
|
outOfOfficeHeaderProps: livechatProps.outOfOfficeHeaderProps,
|
|
646
663
|
endChat: endChatRelay
|
|
647
|
-
})), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, {
|
|
664
|
+
}, headerDraggableConfig))), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, {
|
|
648
665
|
loadingPaneProps: livechatProps.loadingPaneProps,
|
|
649
666
|
startChatErrorPaneProps: livechatProps.startChatErrorPaneProps
|
|
650
667
|
})), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_livechatProps$compon5 = livechatProps.componentOverrides) === null || _livechatProps$compon5 === void 0 ? void 0 : _livechatProps$compon5.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, livechatProps.outOfOfficeHoursPaneProps)), !((_livechatProps$contro7 = livechatProps.controlProps) !== null && _livechatProps$contro7 !== void 0 && _livechatProps$contro7.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_livechatProps$compon6 = livechatProps.componentOverrides) === null || _livechatProps$compon6 === void 0 ? void 0 : _livechatProps$compon6.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
|
|
@@ -658,6 +675,6 @@ export const LiveChatWidgetStateful = props => {
|
|
|
658
675
|
}, livechatProps.callingContainerProps)), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps.webChatContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
|
|
659
676
|
setPostChatContext: setPostChatContextRelay,
|
|
660
677
|
prepareEndChat: prepareEndChatRelay
|
|
661
|
-
}))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane)))));
|
|
678
|
+
}))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
|
|
662
679
|
};
|
|
663
680
|
export default LiveChatWidgetStateful;
|
|
@@ -44,7 +44,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
export const WebChatContainerStateful = props => {
|
|
47
|
-
var _props$adaptiveCardSt, _props$renderingMiddl, _props$renderingMiddl2, _props$renderingMiddl3, _props$renderingMiddl4, _props$adaptiveCardSt2, _props$adaptiveCardSt3, _props$adaptiveCardSt4, _props$renderingMiddl5, _props$renderingMiddl6, _props$renderingMiddl7, _props$renderingMiddl8, _props$renderingMiddl9, _props$renderingMiddl10;
|
|
47
|
+
var _props$adaptiveCardSt, _props$renderingMiddl, _props$renderingMiddl2, _props$renderingMiddl3, _props$renderingMiddl4, _props$adaptiveCardSt2, _props$adaptiveCardSt3, _props$adaptiveCardSt4, _props$adaptiveCardSt5, _props$renderingMiddl5, _props$renderingMiddl6, _props$renderingMiddl7, _props$renderingMiddl8, _props$renderingMiddl9, _props$renderingMiddl10;
|
|
48
48
|
const {
|
|
49
49
|
BasicWebChat
|
|
50
50
|
} = Components;
|
|
@@ -125,9 +125,16 @@ export const WebChatContainerStateful = props => {
|
|
|
125
125
|
max-width: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl3 = props.renderingMiddlewareProps) === null || _props$renderingMiddl3 === void 0 ? void 0 : (_props$renderingMiddl4 = _props$renderingMiddl3.systemMessageBoxStyles) === null || _props$renderingMiddl4 === void 0 ? void 0 : _props$renderingMiddl4.maxWidth) ?? (defaultSystemMessageBoxStyles === null || defaultSystemMessageBoxStyles === void 0 ? void 0 : defaultSystemMessageBoxStyles.maxWidth)}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
div[class="ac-textBlock"]
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
div[class="ac-textBlock"] *,
|
|
129
|
+
div[class="ac-input-container"] * {color:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt2 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt2 === void 0 ? void 0 : _props$adaptiveCardSt2.color) ?? defaultAdaptiveCardStyles.color}; white-space:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt3 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt3 === void 0 ? void 0 : _props$adaptiveCardSt3.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
130
|
+
div[class="ac-textBlock"] a:link,
|
|
131
|
+
div[class="ac-textBlock"] a:visited,
|
|
132
|
+
div[class="ac-textBlock"] a:hover,
|
|
133
|
+
div[class="ac-textBlock"] a:active {
|
|
134
|
+
color: ${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt4 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt4 === void 0 ? void 0 : _props$adaptiveCardSt4.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt5 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt5 === void 0 ? void 0 : _props$adaptiveCardSt5.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
131
138
|
|
|
132
139
|
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
133
140
|
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface IDraggableChatWidgetInternalProps {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
channel?: string;
|
|
5
|
+
elementId: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const DraggableChatWidget: (props: IDraggableChatWidgetInternalProps) => JSX.Element;
|
|
9
|
+
export default DraggableChatWidget;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface IDraggableEventEmitterProps {
|
|
3
|
+
/**
|
|
4
|
+
* Unique channel name to send/receive draggable events to prevent event collisions
|
|
5
|
+
*/
|
|
6
|
+
channel: string;
|
|
7
|
+
/**
|
|
8
|
+
* React nodes children
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* HTML element ID of the trigger element to send IDraggableEvent to update the draggable element position
|
|
13
|
+
*/
|
|
14
|
+
elementId: string;
|
|
15
|
+
/**
|
|
16
|
+
* Target window to post IDraggableEvent messages
|
|
17
|
+
*/
|
|
18
|
+
targetWindow?: Window;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Trigger component which would send IDraggableEvent to the receiver to update the draggable component position
|
|
22
|
+
*
|
|
23
|
+
* @param props IDraggableEventEmitterProps
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
declare const DraggableEventEmitter: (props: IDraggableEventEmitterProps) => JSX.Element;
|
|
27
|
+
export default DraggableEventEmitter;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import IDraggableEvent from "./IDraggableEvent";
|
|
3
|
+
interface IDraggableEventReceiverProps {
|
|
4
|
+
/**
|
|
5
|
+
* Unique channel name to send/receive draggable events to prevent event collisions
|
|
6
|
+
*/
|
|
7
|
+
channel: string;
|
|
8
|
+
/**
|
|
9
|
+
* React nodes children
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Event handler on receiving draggable events
|
|
14
|
+
*
|
|
15
|
+
* @param event Draggable events
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
onEvent: (event: IDraggableEvent) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Component which would listen to DraggableEvent, update the component position or react accordingly.
|
|
22
|
+
*
|
|
23
|
+
* @param props IDraggableEventReceiverProps
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
declare const DraggableEventReceiver: (props: IDraggableEventReceiverProps) => JSX.Element;
|
|
27
|
+
export default DraggableEventReceiver;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import DraggableEventNames from "./DraggableEventNames";
|
|
2
|
+
import IDraggableElementPosition from "./IDraggableElementPosition";
|
|
3
|
+
interface IDraggableEvent {
|
|
4
|
+
channel: string;
|
|
5
|
+
eventName: DraggableEventNames | string;
|
|
6
|
+
offset?: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
position?: IDraggableElementPosition;
|
|
11
|
+
}
|
|
12
|
+
export default IDraggableEvent;
|
|
@@ -18,4 +18,16 @@ export interface IHeaderStatefulParams {
|
|
|
18
18
|
* @param postMessageToOtherTab : If set to true endchat will send a message to other tabs(multi-tabs)
|
|
19
19
|
*/
|
|
20
20
|
endChat: (adapter: any, skipEndChatSDK?: boolean, skipCloseChat?: boolean, postMessageToOtherTab?: boolean) => Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* draggableEventChannel: Channel to send/receive draggable events
|
|
23
|
+
*/
|
|
24
|
+
draggableEventChannel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* draggableEventEmitterTargetWindow: Target window to post IDraggableEvent messages
|
|
27
|
+
*/
|
|
28
|
+
draggableEventEmitterTargetWindow?: Window;
|
|
29
|
+
/**
|
|
30
|
+
* draggable: Whether the header is draggable
|
|
31
|
+
*/
|
|
32
|
+
draggable?: boolean;
|
|
21
33
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IDraggableChatWidgetProps {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to enable Draggable Chat Widget.
|
|
4
|
+
*/
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* To specify whether the iframe is used to drag. The IDraggableEvent would be posted to the parent window if set to true.
|
|
8
|
+
*/
|
|
9
|
+
targetIframe?: boolean;
|
|
10
|
+
}
|
|
@@ -23,6 +23,7 @@ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidget
|
|
|
23
23
|
import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
|
|
24
24
|
import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
|
|
25
25
|
import { IScrollBarProps } from "./IScrollBarProps";
|
|
26
|
+
import { IDraggableChatWidgetProps } from "./IDraggableChatWidgetProps";
|
|
26
27
|
export interface ILiveChatWidgetProps {
|
|
27
28
|
audioNotificationProps?: IAudioNotificationProps;
|
|
28
29
|
callingContainerProps?: ICallingContainerProps;
|
|
@@ -57,4 +58,5 @@ export interface ILiveChatWidgetProps {
|
|
|
57
58
|
useSessionStorage?: boolean;
|
|
58
59
|
allowSdkChatSupport?: boolean;
|
|
59
60
|
initialCustomContext?: any;
|
|
61
|
+
draggableChatWidgetProps?: IDraggableChatWidgetProps;
|
|
60
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.1.1-main.
|
|
3
|
+
"version": "1.1.1-main.9164f12",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@microsoft/omnichannel-chat-components": "^1.0.3",
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "1.4.
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "1.4.3",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"build-sample": "yarn build && webpack --config ./webpack.config.cjs",
|
|
103
103
|
"build-sample:dev": "yarn build && webpack --config ./webpack.dev.config.cjs",
|
|
104
104
|
"test:visual:build": "yarn build-storybook && yarn test:visual",
|
|
105
|
-
"lint": "yarn eslint ."
|
|
105
|
+
"lint": "yarn eslint . --max-warnings=0"
|
|
106
106
|
},
|
|
107
107
|
"resolutions": {
|
|
108
108
|
"**/url-parse": "1.5.9",
|