@microsoft/omnichannel-chat-components 1.1.12 → 1.1.14
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/common/Constants.js +1 -0
- package/lib/cjs/components/citationpane/CitationPane.js +132 -0
- package/lib/cjs/components/citationpane/ScalingTest.js +77 -0
- package/lib/cjs/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.js +22 -0
- package/lib/cjs/components/citationpane/common/defaultProps/defaultCitationPaneProps.js +16 -0
- package/lib/cjs/components/citationpane/common/defaultProps/defaultCitationPaneStyleProps.js +25 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js +40 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js +21 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js +29 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.js +8 -0
- package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonStyles.js +43 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneClassNames.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneComponentOverrides.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneControlProps.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneProps.js +1 -0
- package/lib/cjs/components/citationpane/interfaces/ICitationPaneStyleProps.js +1 -0
- package/lib/cjs/index.js +8 -0
- package/lib/cjs/interfaces/IPostMessageOptions.js +1 -0
- package/lib/cjs/services/BroadcastService.js +33 -2
- package/lib/cjs/services/EventQueue.js +91 -0
- package/lib/esm/common/Constants.js +1 -0
- package/lib/esm/components/citationpane/CitationPane.js +106 -0
- package/lib/esm/components/citationpane/ScalingTest.js +64 -0
- package/lib/esm/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.js +15 -0
- package/lib/esm/components/citationpane/common/defaultProps/defaultCitationPaneProps.js +6 -0
- package/lib/esm/components/citationpane/common/defaultProps/defaultCitationPaneStyleProps.js +12 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js +33 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js +14 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js +22 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.js +1 -0
- package/lib/esm/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonStyles.js +36 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneClassNames.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneComponentOverrides.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneControlProps.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneProps.js +1 -0
- package/lib/esm/components/citationpane/interfaces/ICitationPaneStyleProps.js +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/interfaces/IPostMessageOptions.js +1 -0
- package/lib/esm/services/BroadcastService.js +29 -2
- package/lib/esm/services/EventQueue.js +83 -0
- package/lib/types/common/Constants.d.ts +1 -0
- package/lib/types/components/citationpane/CitationPane.d.ts +4 -0
- package/lib/types/components/citationpane/ScalingTest.d.ts +7 -0
- package/lib/types/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultProps/defaultCitationPaneProps.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultProps/defaultCitationPaneStyleProps.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneTitleStyles.d.ts +2 -0
- package/lib/types/components/citationpane/common/defaultStyles/defaultCitationPaneTopCloseButtonStyles.d.ts +2 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneClassNames.d.ts +7 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneComponentOverrides.d.ts +7 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneControlProps.d.ts +16 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneProps.d.ts +8 -0
- package/lib/types/components/citationpane/interfaces/ICitationPaneStyleProps.d.ts +10 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/interfaces/ICustomEvent.d.ts +1 -0
- package/lib/types/interfaces/IPostMessageOptions.d.ts +4 -0
- package/lib/types/services/BroadcastService.d.ts +2 -1
- package/lib/types/services/EventQueue.d.ts +17 -0
- package/package.json +2 -2
|
@@ -42,6 +42,7 @@ exports.ElementType = ElementType;
|
|
|
42
42
|
ElementType["ReconnectChatPane"] = "ReconnectChatPane";
|
|
43
43
|
ElementType["ConfirmationPaneConfirmButton"] = "ConfirmationPaneConfirmButton";
|
|
44
44
|
ElementType["ConfirmationPaneCancelButton"] = "ConfirmationPaneCancelButton";
|
|
45
|
+
ElementType["CitationPaneCloseButton"] = "CitationPaneCloseButton";
|
|
45
46
|
ElementType["PreChatSurveySubmitButton"] = "PreChatSurveySubmitButton";
|
|
46
47
|
ElementType["PreChatSurveyError"] = "PreChatSurveyError";
|
|
47
48
|
ElementType["IncomingCallDeclineCallButton"] = "IncomingCallDeclineCallButton";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@fluentui/react");
|
|
9
|
+
|
|
10
|
+
var _Constants = require("../../common/Constants");
|
|
11
|
+
|
|
12
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
13
|
+
|
|
14
|
+
var _BroadcastService = require("../../services/BroadcastService");
|
|
15
|
+
|
|
16
|
+
var _decodeComponentString = require("../../common/decodeComponentString");
|
|
17
|
+
|
|
18
|
+
var _defaultCitationPaneCloseButtonStyles = require("./common/defaultStyles/defaultCitationPaneCloseButtonStyles");
|
|
19
|
+
|
|
20
|
+
var _defaultCitationPaneContentStyles = require("./common/defaultStyles/defaultCitationPaneContentStyles");
|
|
21
|
+
|
|
22
|
+
var _defaultCitationPaneControlProps = require("./common/defaultProps/defaultCitationPaneControlProps");
|
|
23
|
+
|
|
24
|
+
var _defaultCitationPaneGeneralStyles = require("./common/defaultStyles/defaultCitationPaneGeneralStyles");
|
|
25
|
+
|
|
26
|
+
var _defaultCitationPaneTitleStyles = require("./common/defaultStyles/defaultCitationPaneTitleStyles");
|
|
27
|
+
|
|
28
|
+
var _defaultCitationPaneTopCloseButtonStyles = require("./common/defaultStyles/defaultCitationPaneTopCloseButtonStyles");
|
|
29
|
+
|
|
30
|
+
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); }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
function CitationPane(props) {
|
|
35
|
+
var _props$controlProps, _props$styleProps, _props$styleProps2, _props$styleProps3, _props$styleProps4, _props$controlProps4, _props$styleProps5, _props$controlProps5, _props$styleProps6, _props$styleProps6$cl, _props$controlProps6, _props$componentOverr, _props$controlProps7, _props$styleProps7, _props$styleProps7$cl, _props$controlProps8, _props$componentOverr2, _props$styleProps8, _props$styleProps8$cl, _props$controlProps9, _props$styleProps9, _props$styleProps9$cl, _props$controlProps10, _props$controlProps11, _props$componentOverr3, _props$controlProps12, _props$controlProps13, _props$styleProps10, _props$styleProps10$c;
|
|
36
|
+
|
|
37
|
+
const elementId = ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.id) ?? _defaultCitationPaneControlProps.defaultCitationPaneControlProps.id;
|
|
38
|
+
const handleClose = (0, _react2.useCallback)(() => {
|
|
39
|
+
var _props$controlProps2;
|
|
40
|
+
|
|
41
|
+
if ((_props$controlProps2 = props.controlProps) !== null && _props$controlProps2 !== void 0 && _props$controlProps2.onClose) {
|
|
42
|
+
var _props$controlProps3;
|
|
43
|
+
|
|
44
|
+
const customEvent = {
|
|
45
|
+
elementType: _Constants.ElementType.CitationPaneCloseButton,
|
|
46
|
+
elementId: elementId + "-close",
|
|
47
|
+
eventName: _Constants.EventNames.OnClick
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
_BroadcastService.BroadcastService.postMessage(customEvent);
|
|
51
|
+
|
|
52
|
+
(_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.onClose();
|
|
53
|
+
}
|
|
54
|
+
}, [props.controlProps, elementId]);
|
|
55
|
+
const handleTopClose = (0, _react2.useCallback)(() => {
|
|
56
|
+
if (handleClose) {
|
|
57
|
+
const customEvent = {
|
|
58
|
+
elementType: _Constants.ElementType.CitationPaneCloseButton,
|
|
59
|
+
elementId: elementId + "-top-close",
|
|
60
|
+
eventName: _Constants.EventNames.OnClick
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_BroadcastService.BroadcastService.postMessage(customEvent);
|
|
64
|
+
|
|
65
|
+
handleClose();
|
|
66
|
+
}
|
|
67
|
+
}, [props.controlProps, elementId]);
|
|
68
|
+
const containerStyles = {
|
|
69
|
+
root: Object.assign({}, _defaultCitationPaneGeneralStyles.defaultCitationPaneGeneralStyles, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
70
|
+
position: "relative" // Ensure container is positioned for absolute positioning of top close button
|
|
71
|
+
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
const titleStyles = {
|
|
75
|
+
root: Object.assign({}, _defaultCitationPaneTitleStyles.defaultCitationPaneTitleStyles, (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.titleStyleProps)
|
|
76
|
+
};
|
|
77
|
+
const contentStyles = { ..._defaultCitationPaneContentStyles.defaultCitationPaneContentStyles,
|
|
78
|
+
...((_props$styleProps3 = props.styleProps) === null || _props$styleProps3 === void 0 ? void 0 : _props$styleProps3.contentStyleProps)
|
|
79
|
+
};
|
|
80
|
+
const closeButtonStyles = {
|
|
81
|
+
root: Object.assign({}, _defaultCitationPaneCloseButtonStyles.defaultCitationPaneCloseButtonStyles, (_props$styleProps4 = props.styleProps) === null || _props$styleProps4 === void 0 ? void 0 : _props$styleProps4.closeButtonStyleProps)
|
|
82
|
+
};
|
|
83
|
+
const topCloseButtonPosition = ((_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.topCloseButtonPosition) || _defaultCitationPaneControlProps.defaultCitationPaneControlProps.topCloseButtonPosition;
|
|
84
|
+
const topCloseButtonStyles = {
|
|
85
|
+
root: Object.assign({}, _defaultCitationPaneTopCloseButtonStyles.defaultCitationPaneTopCloseButtonStyles, (_props$styleProps5 = props.styleProps) === null || _props$styleProps5 === void 0 ? void 0 : _props$styleProps5.topCloseButtonStyleProps, topCloseButtonPosition === "topLeft" ? {
|
|
86
|
+
left: "0.5em",
|
|
87
|
+
right: "auto"
|
|
88
|
+
} : {
|
|
89
|
+
right: "0.5em",
|
|
90
|
+
left: "auto"
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
94
|
+
id: elementId,
|
|
95
|
+
role: "dialog",
|
|
96
|
+
"aria-labelledby": elementId + "-title",
|
|
97
|
+
"aria-describedby": elementId + "-content",
|
|
98
|
+
dir: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.dir) || _defaultCitationPaneControlProps.defaultCitationPaneControlProps.dir,
|
|
99
|
+
styles: containerStyles,
|
|
100
|
+
className: (_props$styleProps6 = props.styleProps) === null || _props$styleProps6 === void 0 ? void 0 : (_props$styleProps6$cl = _props$styleProps6.classNames) === null || _props$styleProps6$cl === void 0 ? void 0 : _props$styleProps6$cl.containerClassName
|
|
101
|
+
}, !((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.hideTopCloseButton) && ((0, _decodeComponentString.decodeComponentString)((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.topCloseButton) || /*#__PURE__*/_react2.default.createElement(_react.IconButton, {
|
|
102
|
+
onClick: handleTopClose,
|
|
103
|
+
id: elementId + "-top-close",
|
|
104
|
+
iconProps: {
|
|
105
|
+
iconName: "ChromeClose"
|
|
106
|
+
},
|
|
107
|
+
ariaLabel: ((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.topCloseButtonAriaLabel) || _defaultCitationPaneControlProps.defaultCitationPaneControlProps.topCloseButtonAriaLabel,
|
|
108
|
+
styles: topCloseButtonStyles,
|
|
109
|
+
className: (_props$styleProps7 = props.styleProps) === null || _props$styleProps7 === void 0 ? void 0 : (_props$styleProps7$cl = _props$styleProps7.classNames) === null || _props$styleProps7$cl === void 0 ? void 0 : _props$styleProps7$cl.topCloseButtonClassName
|
|
110
|
+
})), !((_props$controlProps8 = props.controlProps) !== null && _props$controlProps8 !== void 0 && _props$controlProps8.hideTitle) && ((0, _decodeComponentString.decodeComponentString)((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.title) || /*#__PURE__*/_react2.default.createElement(_react.Label, {
|
|
111
|
+
id: elementId + "-title",
|
|
112
|
+
styles: titleStyles,
|
|
113
|
+
className: (_props$styleProps8 = props.styleProps) === null || _props$styleProps8 === void 0 ? void 0 : (_props$styleProps8$cl = _props$styleProps8.classNames) === null || _props$styleProps8$cl === void 0 ? void 0 : _props$styleProps8$cl.titleClassName
|
|
114
|
+
}, ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.titleText) || _defaultCitationPaneControlProps.defaultCitationPaneControlProps.titleText)), /*#__PURE__*/_react2.default.createElement("div", {
|
|
115
|
+
id: elementId + "-content",
|
|
116
|
+
style: contentStyles,
|
|
117
|
+
className: (_props$styleProps9 = props.styleProps) === null || _props$styleProps9 === void 0 ? void 0 : (_props$styleProps9$cl = _props$styleProps9.classNames) === null || _props$styleProps9$cl === void 0 ? void 0 : _props$styleProps9$cl.contentClassName,
|
|
118
|
+
dangerouslySetInnerHTML: {
|
|
119
|
+
__html: ((_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.contentHtml) ?? ""
|
|
120
|
+
}
|
|
121
|
+
}), !((_props$controlProps11 = props.controlProps) !== null && _props$controlProps11 !== void 0 && _props$controlProps11.hideCloseButton) && ((0, _decodeComponentString.decodeComponentString)((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.closeButton) || /*#__PURE__*/_react2.default.createElement(_react.DefaultButton, {
|
|
122
|
+
onClick: handleClose,
|
|
123
|
+
id: elementId + "-close",
|
|
124
|
+
text: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.closeButtonText) || _defaultCitationPaneControlProps.defaultCitationPaneControlProps.closeButtonText,
|
|
125
|
+
ariaLabel: ((_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.closeButtonAriaLabel) || _defaultCitationPaneControlProps.defaultCitationPaneControlProps.closeButtonAriaLabel,
|
|
126
|
+
styles: closeButtonStyles,
|
|
127
|
+
className: (_props$styleProps10 = props.styleProps) === null || _props$styleProps10 === void 0 ? void 0 : (_props$styleProps10$c = _props$styleProps10.classNames) === null || _props$styleProps10$c === void 0 ? void 0 : _props$styleProps10$c.closeButtonClassName
|
|
128
|
+
}))));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var _default = CitationPane;
|
|
132
|
+
exports.default = _default;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.CitationPaneScalingTest = void 0;
|
|
7
|
+
|
|
8
|
+
var _CitationPane = _interopRequireDefault(require("./CitationPane"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Test component to verify CitationPane scaling behavior at different zoom levels
|
|
16
|
+
* This demonstrates how the component responds to 50% to 400% view sizes
|
|
17
|
+
*/
|
|
18
|
+
const CitationPaneScalingTest = () => {
|
|
19
|
+
const baseProps = {
|
|
20
|
+
controlProps: {
|
|
21
|
+
id: "scaling-test-citation",
|
|
22
|
+
titleText: "Scaling Test Citation",
|
|
23
|
+
contentHtml: `
|
|
24
|
+
<div>
|
|
25
|
+
<p>This citation pane is designed to scale properly from 50% to 400% zoom levels.</p>
|
|
26
|
+
<p><strong>Key improvements for scaling:</strong></p>
|
|
27
|
+
<ul>
|
|
28
|
+
<li>Uses <code>em</code> units instead of <code>px</code> for dimensions</li>
|
|
29
|
+
<li>Scalable padding, margins, and positioning</li>
|
|
30
|
+
<li>Relative font sizes throughout</li>
|
|
31
|
+
<li>Container-relative maximum height instead of viewport-based</li>
|
|
32
|
+
</ul>
|
|
33
|
+
<p><strong>Test Instructions:</strong></p>
|
|
34
|
+
<ol>
|
|
35
|
+
<li>Use your browser's zoom controls (Ctrl/Cmd + or -)</li>
|
|
36
|
+
<li>Test zoom levels: 50%, 75%, 100%, 150%, 200%, 300%, 400%</li>
|
|
37
|
+
<li>Verify all elements remain proportional and usable</li>
|
|
38
|
+
<li>Check that buttons remain clickable and text remains readable</li>
|
|
39
|
+
</ol>
|
|
40
|
+
</div>
|
|
41
|
+
`,
|
|
42
|
+
closeButtonText: "Close Test",
|
|
43
|
+
onClose: () => {
|
|
44
|
+
console.log("Scaling test close button clicked at current zoom level");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
style: {
|
|
50
|
+
padding: "2em",
|
|
51
|
+
backgroundColor: "#f5f5f5",
|
|
52
|
+
minHeight: "100vh",
|
|
53
|
+
display: "flex",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "center"
|
|
56
|
+
}
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
+
style: {
|
|
59
|
+
maxWidth: "600px"
|
|
60
|
+
}
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement("h2", {
|
|
62
|
+
style: {
|
|
63
|
+
marginBottom: "1em",
|
|
64
|
+
textAlign: "center"
|
|
65
|
+
}
|
|
66
|
+
}, "CitationPane Scaling Test"), /*#__PURE__*/_react.default.createElement("p", {
|
|
67
|
+
style: {
|
|
68
|
+
marginBottom: "2em",
|
|
69
|
+
textAlign: "center",
|
|
70
|
+
fontSize: "0.9em"
|
|
71
|
+
}
|
|
72
|
+
}, "Test this component at browser zoom levels from 50% to 400%"), /*#__PURE__*/_react.default.createElement(_CitationPane.default, baseProps)));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.CitationPaneScalingTest = CitationPaneScalingTest;
|
|
76
|
+
var _default = CitationPaneScalingTest;
|
|
77
|
+
exports.default = _default;
|
package/lib/cjs/components/citationpane/common/defaultProps/defaultCitationPaneControlProps.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneControlProps = void 0;
|
|
7
|
+
const defaultCitationPaneControlProps = {
|
|
8
|
+
id: "ocw-citation-pane",
|
|
9
|
+
dir: "ltr",
|
|
10
|
+
hideTitle: false,
|
|
11
|
+
titleText: "Citation",
|
|
12
|
+
hideCloseButton: false,
|
|
13
|
+
closeButtonText: "Close",
|
|
14
|
+
closeButtonAriaLabel: "Close citation",
|
|
15
|
+
hideTopCloseButton: false,
|
|
16
|
+
topCloseButtonAriaLabel: "Close",
|
|
17
|
+
topCloseButtonPosition: "topRight",
|
|
18
|
+
onClose: () => {
|
|
19
|
+
console.log("Citation pane close");
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.defaultCitationPaneControlProps = defaultCitationPaneControlProps;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneProps = void 0;
|
|
7
|
+
|
|
8
|
+
var _defaultCitationPaneControlProps = require("./defaultCitationPaneControlProps");
|
|
9
|
+
|
|
10
|
+
var _defaultCitationPaneStyleProps = require("./defaultCitationPaneStyleProps");
|
|
11
|
+
|
|
12
|
+
const defaultCitationPaneProps = {
|
|
13
|
+
controlProps: _defaultCitationPaneControlProps.defaultCitationPaneControlProps,
|
|
14
|
+
styleProps: _defaultCitationPaneStyleProps.defaultCitationPaneStyleProps
|
|
15
|
+
};
|
|
16
|
+
exports.defaultCitationPaneProps = defaultCitationPaneProps;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneStyleProps = void 0;
|
|
7
|
+
|
|
8
|
+
var _defaultCitationPaneCloseButtonStyles = require("../defaultStyles/defaultCitationPaneCloseButtonStyles");
|
|
9
|
+
|
|
10
|
+
var _defaultCitationPaneContentStyles = require("../defaultStyles/defaultCitationPaneContentStyles");
|
|
11
|
+
|
|
12
|
+
var _defaultCitationPaneGeneralStyles = require("../defaultStyles/defaultCitationPaneGeneralStyles");
|
|
13
|
+
|
|
14
|
+
var _defaultCitationPaneTitleStyles = require("../defaultStyles/defaultCitationPaneTitleStyles");
|
|
15
|
+
|
|
16
|
+
var _defaultCitationPaneTopCloseButtonStyles = require("../defaultStyles/defaultCitationPaneTopCloseButtonStyles");
|
|
17
|
+
|
|
18
|
+
const defaultCitationPaneStyleProps = {
|
|
19
|
+
generalStyleProps: _defaultCitationPaneGeneralStyles.defaultCitationPaneGeneralStyles,
|
|
20
|
+
titleStyleProps: _defaultCitationPaneTitleStyles.defaultCitationPaneTitleStyles,
|
|
21
|
+
contentStyleProps: _defaultCitationPaneContentStyles.defaultCitationPaneContentStyles,
|
|
22
|
+
closeButtonStyleProps: _defaultCitationPaneCloseButtonStyles.defaultCitationPaneCloseButtonStyles,
|
|
23
|
+
topCloseButtonStyleProps: _defaultCitationPaneTopCloseButtonStyles.defaultCitationPaneTopCloseButtonStyles
|
|
24
|
+
};
|
|
25
|
+
exports.defaultCitationPaneStyleProps = defaultCitationPaneStyleProps;
|
package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneCloseButtonStyles.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneCloseButtonStyles = void 0;
|
|
7
|
+
const defaultCitationPaneCloseButtonStyles = {
|
|
8
|
+
marginTop: "1em",
|
|
9
|
+
// Space between content and close button (scalable)
|
|
10
|
+
alignSelf: "center",
|
|
11
|
+
// Center the button horizontally
|
|
12
|
+
backgroundColor: "#f3f2f1",
|
|
13
|
+
border: "1px solid #d2d0ce",
|
|
14
|
+
borderRadius: "0.25em",
|
|
15
|
+
// Scalable border radius
|
|
16
|
+
color: "#323130",
|
|
17
|
+
cursor: "pointer",
|
|
18
|
+
fontSize: "1em",
|
|
19
|
+
// Use relative font size for better scaling
|
|
20
|
+
fontWeight: "500",
|
|
21
|
+
minHeight: "2em",
|
|
22
|
+
// Scalable minimum height
|
|
23
|
+
minWidth: "5em",
|
|
24
|
+
// Scalable minimum width
|
|
25
|
+
padding: "0.5em 1em",
|
|
26
|
+
// Scalable padding
|
|
27
|
+
selectors: {
|
|
28
|
+
":hover": {
|
|
29
|
+
backgroundColor: "#e1dfdd",
|
|
30
|
+
borderColor: "#c8c6c4"
|
|
31
|
+
},
|
|
32
|
+
":focus": {
|
|
33
|
+
outline: "0.125em solid #0078d4",
|
|
34
|
+
// Scalable outline
|
|
35
|
+
outlineOffset: "0.125em" // Scalable offset
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.defaultCitationPaneCloseButtonStyles = defaultCitationPaneCloseButtonStyles;
|
package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneContentStyles.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneContentStyles = void 0;
|
|
7
|
+
const defaultCitationPaneContentStyles = {
|
|
8
|
+
fontSize: "1em",
|
|
9
|
+
// Use relative units for better scaling
|
|
10
|
+
lineHeight: "1.5",
|
|
11
|
+
// Already relative, good for scaling
|
|
12
|
+
marginBottom: "0",
|
|
13
|
+
// No bottom margin since close button has top margin
|
|
14
|
+
flex: "1",
|
|
15
|
+
// Allow content to grow and push close button to bottom
|
|
16
|
+
overflow: "auto",
|
|
17
|
+
// Enable scrolling for long content
|
|
18
|
+
paddingRight: "0.25em" // Small padding to prevent scrollbar from touching border (scalable)
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
exports.defaultCitationPaneContentStyles = defaultCitationPaneContentStyles;
|
package/lib/cjs/components/citationpane/common/defaultStyles/defaultCitationPaneGeneralStyles.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneGeneralStyles = void 0;
|
|
7
|
+
const defaultCitationPaneGeneralStyles = {
|
|
8
|
+
position: "relative",
|
|
9
|
+
// Required for absolute positioning of top close button
|
|
10
|
+
paddingTop: "2.5em",
|
|
11
|
+
// Space for top close button to prevent overlap (scalable)
|
|
12
|
+
padding: "1em",
|
|
13
|
+
// Scalable padding using em units
|
|
14
|
+
backgroundColor: "#ffffff",
|
|
15
|
+
border: "1px solid #d2d0ce",
|
|
16
|
+
borderRadius: "0.5em",
|
|
17
|
+
// Scalable border radius
|
|
18
|
+
boxShadow: "0px 0.125em 0.25em rgba(0, 0, 0, 0.1)",
|
|
19
|
+
// Scalable shadow
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
minHeight: "7.5em",
|
|
23
|
+
// Minimum height to ensure proper layout (scalable)
|
|
24
|
+
maxHeight: "30em",
|
|
25
|
+
// Container-relative height instead of viewport-based
|
|
26
|
+
overflow: "hidden" // Hide overflow on container, let content area handle scrolling
|
|
27
|
+
|
|
28
|
+
};
|
|
29
|
+
exports.defaultCitationPaneGeneralStyles = defaultCitationPaneGeneralStyles;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneTopCloseButtonStyles = void 0;
|
|
7
|
+
const defaultCitationPaneTopCloseButtonStyles = {
|
|
8
|
+
position: "absolute",
|
|
9
|
+
top: "0.5em",
|
|
10
|
+
// Scalable positioning
|
|
11
|
+
right: "0.5em",
|
|
12
|
+
// Scalable positioning
|
|
13
|
+
minWidth: "2em",
|
|
14
|
+
// Scalable minimum width
|
|
15
|
+
height: "2em",
|
|
16
|
+
// Scalable height
|
|
17
|
+
padding: "0",
|
|
18
|
+
fontSize: "1em",
|
|
19
|
+
// Scalable font size
|
|
20
|
+
fontWeight: "bold",
|
|
21
|
+
color: "#605e5c",
|
|
22
|
+
backgroundColor: "transparent",
|
|
23
|
+
border: "none",
|
|
24
|
+
borderRadius: "0.25em",
|
|
25
|
+
// Scalable border radius
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
zIndex: 1000,
|
|
28
|
+
":hover": {
|
|
29
|
+
backgroundColor: "#f3f2f1",
|
|
30
|
+
color: "#323130"
|
|
31
|
+
},
|
|
32
|
+
":active": {
|
|
33
|
+
backgroundColor: "#edebe9",
|
|
34
|
+
color: "#201f1e"
|
|
35
|
+
},
|
|
36
|
+
":focus": {
|
|
37
|
+
outline: "0.125em solid #605e5c",
|
|
38
|
+
// Scalable outline
|
|
39
|
+
outlineOffset: "0.125em" // Scalable offset
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.defaultCitationPaneTopCloseButtonStyles = defaultCitationPaneTopCloseButtonStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/cjs/index.js
CHANGED
|
@@ -63,6 +63,12 @@ Object.defineProperty(exports, "ChatReconnectIconBase64", {
|
|
|
63
63
|
return _Icons.ChatReconnectIconBase64;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "CitationPane", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _CitationPane.default;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
66
72
|
Object.defineProperty(exports, "CloseChatButtonIconBase64", {
|
|
67
73
|
enumerable: true,
|
|
68
74
|
get: function () {
|
|
@@ -262,6 +268,8 @@ var _Footer = _interopRequireDefault(require("./components/footer/Footer"));
|
|
|
262
268
|
|
|
263
269
|
var _ConfirmationPane = _interopRequireDefault(require("./components/confirmationpane/ConfirmationPane"));
|
|
264
270
|
|
|
271
|
+
var _CitationPane = _interopRequireDefault(require("./components/citationpane/CitationPane"));
|
|
272
|
+
|
|
265
273
|
var _ChatButton = _interopRequireDefault(require("./components/chatbutton/ChatButton"));
|
|
266
274
|
|
|
267
275
|
var _InputValidationPane = _interopRequireDefault(require("./components/inputvalidationpane/InputValidationPane"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -11,6 +11,12 @@ var _operators = require("rxjs/operators");
|
|
|
11
11
|
|
|
12
12
|
var _broadcastChannel = require("broadcast-channel");
|
|
13
13
|
|
|
14
|
+
var _utils = require("../common/utils");
|
|
15
|
+
|
|
16
|
+
var _EventQueue = _interopRequireDefault(require("./EventQueue"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
14
20
|
const newMessage = new _rxjs.Subject(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
21
|
|
|
16
22
|
const broadcastServicePubList = {}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -20,8 +26,11 @@ const broadcastServiceSubList = {}; // eslint-disable-next-line @typescript-esli
|
|
|
20
26
|
let pubChannel; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
27
|
|
|
22
28
|
let subChannel;
|
|
29
|
+
let eventQueue;
|
|
23
30
|
|
|
24
31
|
const BroadcastServiceInitialize = channelName => {
|
|
32
|
+
eventQueue = new _EventQueue.default(newMessage);
|
|
33
|
+
|
|
25
34
|
if (broadcastServicePubList[channelName]) {
|
|
26
35
|
pubChannel = broadcastServicePubList[channelName];
|
|
27
36
|
} else {
|
|
@@ -41,18 +50,39 @@ const BroadcastServiceInitialize = channelName => {
|
|
|
41
50
|
|
|
42
51
|
subChannel.onmessage = message => {
|
|
43
52
|
newMessage.next(message);
|
|
53
|
+
eventQueue.popEvent(message);
|
|
54
|
+
eventQueue.stopIfEmpty();
|
|
44
55
|
};
|
|
45
56
|
};
|
|
46
57
|
|
|
47
58
|
exports.BroadcastServiceInitialize = BroadcastServiceInitialize;
|
|
48
59
|
const BroadcastService = {
|
|
49
60
|
//broadcast a message
|
|
50
|
-
postMessage: message
|
|
61
|
+
postMessage: function (message) {
|
|
62
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
63
|
+
retry: true
|
|
64
|
+
};
|
|
65
|
+
|
|
51
66
|
/**
|
|
52
67
|
* Omit copying methods to prevent 'DataCloneError' in older browsers when passing an object with functions
|
|
53
68
|
* This exception occurs when an object can't be clone with the 'structured clone algorithm' (used by postMessage)
|
|
54
69
|
*/
|
|
55
|
-
|
|
70
|
+
try {
|
|
71
|
+
const messageCopy = JSON.parse(JSON.stringify(message));
|
|
72
|
+
const eventId = (0, _utils.uuidv4)();
|
|
73
|
+
const event = { ...messageCopy,
|
|
74
|
+
eventId
|
|
75
|
+
};
|
|
76
|
+
eventQueue.pushEvent(event);
|
|
77
|
+
pubChannel.postMessage(event);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error("Error in BroadcastService.postMessage:", error);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (options !== null && options !== void 0 && options.retry) {
|
|
83
|
+
const queueTimeout = (options === null || options === void 0 ? void 0 : options.queueTimeout) || 500;
|
|
84
|
+
eventQueue.startQueue(queueTimeout);
|
|
85
|
+
}
|
|
56
86
|
},
|
|
57
87
|
getMessage: message => {
|
|
58
88
|
return newMessage.pipe((0, _operators.filter)(msg => msg.elementId == message.elementId && msg.elementType == message.elementType && msg.eventName == message.eventName));
|
|
@@ -66,6 +96,7 @@ const BroadcastService = {
|
|
|
66
96
|
disposeChannel: () => {
|
|
67
97
|
pubChannel.close();
|
|
68
98
|
subChannel.close();
|
|
99
|
+
eventQueue.dispose();
|
|
69
100
|
}
|
|
70
101
|
};
|
|
71
102
|
exports.BroadcastService = BroadcastService;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
|
|
10
|
+
class EventQueue {
|
|
11
|
+
constructor(newMessage) {
|
|
12
|
+
_defineProperty(this, "queueing", false);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "channelEventQueue", void 0);
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "queueingId", void 0);
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "newMessage", void 0);
|
|
19
|
+
|
|
20
|
+
this.channelEventQueue = new Map();
|
|
21
|
+
this.newMessage = newMessage;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
processEvents() {
|
|
25
|
+
this.channelEventQueue.forEach((event, eventId) => {
|
|
26
|
+
// Process entry based on insertion order
|
|
27
|
+
this.newMessage.next(event); // Post event directly instead of using pubChannel
|
|
28
|
+
|
|
29
|
+
this.channelEventQueue.delete(eventId); // Remove event from queue regardless of outcome
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
queueEvents() {
|
|
34
|
+
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
|
|
35
|
+
this.stopIfEmpty();
|
|
36
|
+
|
|
37
|
+
if (this.queueingId) {
|
|
38
|
+
// Queueing in progress
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (this.queueing) {
|
|
43
|
+
this.queueingId = setTimeout(() => {
|
|
44
|
+
this.processEvents();
|
|
45
|
+
this.queueEvents(timeout);
|
|
46
|
+
}, timeout);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
startQueue() {
|
|
51
|
+
let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
|
|
52
|
+
this.queueing = true;
|
|
53
|
+
this.queueEvents(timeout);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
stopIfEmpty() {
|
|
57
|
+
if (this.channelEventQueue.size === 0) {
|
|
58
|
+
if (this.queueingId) {
|
|
59
|
+
clearTimeout(this.queueingId);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
this.queueing = false;
|
|
63
|
+
this.queueingId = undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
pushEvent(event) {
|
|
68
|
+
if (event.eventId) {
|
|
69
|
+
this.channelEventQueue.set(event.eventId, event);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
popEvent(event) {
|
|
74
|
+
if (event.eventId) {
|
|
75
|
+
this.channelEventQueue.delete(event.eventId);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
dispose() {
|
|
80
|
+
if (this.queueingId) {
|
|
81
|
+
clearTimeout(this.queueingId);
|
|
82
|
+
this.queueingId = undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
this.channelEventQueue.clear();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var _default = EventQueue;
|
|
91
|
+
exports.default = _default;
|
|
@@ -30,6 +30,7 @@ export let ElementType;
|
|
|
30
30
|
ElementType["ReconnectChatPane"] = "ReconnectChatPane";
|
|
31
31
|
ElementType["ConfirmationPaneConfirmButton"] = "ConfirmationPaneConfirmButton";
|
|
32
32
|
ElementType["ConfirmationPaneCancelButton"] = "ConfirmationPaneCancelButton";
|
|
33
|
+
ElementType["CitationPaneCloseButton"] = "CitationPaneCloseButton";
|
|
33
34
|
ElementType["PreChatSurveySubmitButton"] = "PreChatSurveySubmitButton";
|
|
34
35
|
ElementType["PreChatSurveyError"] = "PreChatSurveyError";
|
|
35
36
|
ElementType["IncomingCallDeclineCallButton"] = "IncomingCallDeclineCallButton";
|