@matrix-widget-toolkit/mui 1.1.3 → 1.1.5
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/README.md +1 -1
- package/build/cjs/index.js +56 -177
- package/build/esm/index.js +56 -177
- package/build/index.d.ts +1 -1
- package/package.json +20 -20
package/README.md
CHANGED
package/build/cjs/index.js
CHANGED
|
@@ -31,6 +31,42 @@ var ContentCopyOutlinedIcon__default = /*#__PURE__*/_interopDefaultCompat(Conten
|
|
|
31
31
|
var LanguageDetector__default = /*#__PURE__*/_interopDefaultCompat(LanguageDetector);
|
|
32
32
|
var resourcesToBackend__default = /*#__PURE__*/_interopDefaultCompat(resourcesToBackend);
|
|
33
33
|
|
|
34
|
+
/*
|
|
35
|
+
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
36
|
+
*
|
|
37
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
38
|
+
* you may not use this file except in compliance with the License.
|
|
39
|
+
* You may obtain a copy of the License at
|
|
40
|
+
*
|
|
41
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
42
|
+
*
|
|
43
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
44
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
45
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
46
|
+
* See the License for the specific language governing permissions and
|
|
47
|
+
* limitations under the License.
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Retrieve the nonce passed by our Docker base image.
|
|
51
|
+
* @returns A nonce that can be used to perform operations that are disabled in
|
|
52
|
+
* our CSP by default.
|
|
53
|
+
*/
|
|
54
|
+
function getNonce() {
|
|
55
|
+
return window['NONCE'];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function createEmotionCache() {
|
|
59
|
+
return createCache__default.default({
|
|
60
|
+
key: 'widget',
|
|
61
|
+
nonce: getNonce(),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
var cache = createEmotionCache();
|
|
65
|
+
function EmotionCacheProvider(_a) {
|
|
66
|
+
var children = _a.children;
|
|
67
|
+
return jsxRuntime.jsx(react.CacheProvider, { value: cache, children: children });
|
|
68
|
+
}
|
|
69
|
+
|
|
34
70
|
/*
|
|
35
71
|
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
36
72
|
*
|
|
@@ -68,53 +104,6 @@ function getEnvironment(name, defaultValue) {
|
|
|
68
104
|
return value !== null && value !== void 0 ? value : defaultValue;
|
|
69
105
|
}
|
|
70
106
|
|
|
71
|
-
/*
|
|
72
|
-
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
73
|
-
*
|
|
74
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
75
|
-
* you may not use this file except in compliance with the License.
|
|
76
|
-
* You may obtain a copy of the License at
|
|
77
|
-
*
|
|
78
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
79
|
-
*
|
|
80
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
81
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
82
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
83
|
-
* See the License for the specific language governing permissions and
|
|
84
|
-
* limitations under the License.
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
|
-
* Retrieve the nonce passed by our Docker base image.
|
|
88
|
-
* @returns A nonce that can be used to perform operations that are disabled in
|
|
89
|
-
* our CSP by default.
|
|
90
|
-
*/
|
|
91
|
-
function getNonce() {
|
|
92
|
-
return window['NONCE'];
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var __assign$b = (undefined && undefined.__assign) || function () {
|
|
96
|
-
__assign$b = Object.assign || function(t) {
|
|
97
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
98
|
-
s = arguments[i];
|
|
99
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
100
|
-
t[p] = s[p];
|
|
101
|
-
}
|
|
102
|
-
return t;
|
|
103
|
-
};
|
|
104
|
-
return __assign$b.apply(this, arguments);
|
|
105
|
-
};
|
|
106
|
-
function createEmotionCache() {
|
|
107
|
-
return createCache__default.default({
|
|
108
|
-
key: 'widget',
|
|
109
|
-
nonce: getNonce(),
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
var cache = createEmotionCache();
|
|
113
|
-
function EmotionCacheProvider(_a) {
|
|
114
|
-
var children = _a.children;
|
|
115
|
-
return jsxRuntime.jsx(react.CacheProvider, __assign$b({ value: cache }, { children: children }));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
107
|
/*
|
|
119
108
|
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
120
109
|
*
|
|
@@ -132,12 +121,12 @@ function EmotionCacheProvider(_a) {
|
|
|
132
121
|
*/
|
|
133
122
|
var fontFamily = [
|
|
134
123
|
'Inter',
|
|
135
|
-
'Twemoji',
|
|
136
|
-
'"Apple Color Emoji"',
|
|
137
|
-
'"Segoe UI Emoji"',
|
|
138
124
|
'Arial',
|
|
139
125
|
'Helvetica',
|
|
140
126
|
'sans-serif',
|
|
127
|
+
'Twemoji',
|
|
128
|
+
'"Apple Color Emoji"',
|
|
129
|
+
'"Segoe UI Emoji"',
|
|
141
130
|
'"Noto Color Emoji"',
|
|
142
131
|
].join(',');
|
|
143
132
|
var primaryColor = getEnvironment('REACT_APP_PRIMARY_COLOR', '#0dbd8b');
|
|
@@ -613,17 +602,6 @@ var darkTheme = {
|
|
|
613
602
|
},
|
|
614
603
|
};
|
|
615
604
|
|
|
616
|
-
var __assign$a = (undefined && undefined.__assign) || function () {
|
|
617
|
-
__assign$a = Object.assign || function(t) {
|
|
618
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
619
|
-
s = arguments[i];
|
|
620
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
621
|
-
t[p] = s[p];
|
|
622
|
-
}
|
|
623
|
-
return t;
|
|
624
|
-
};
|
|
625
|
-
return __assign$a.apply(this, arguments);
|
|
626
|
-
};
|
|
627
605
|
/**
|
|
628
606
|
* Provide a semantic UI based theme to the child components.
|
|
629
607
|
* @param param0 - {@link MuiThemeProviderProps}
|
|
@@ -661,7 +639,7 @@ function ElementMuiThemeProvider(_a) {
|
|
|
661
639
|
var localeOptions = locale$1 && new Intl.Locale(locale$1).language === 'de' ? locale.deDE : locale.enUS;
|
|
662
640
|
return material.createTheme(utils.deepmerge(baseTheme, themeOptions), localeOptions);
|
|
663
641
|
}, [locale$1, theme]);
|
|
664
|
-
return (jsxRuntime.jsxs(material.ThemeProvider,
|
|
642
|
+
return (jsxRuntime.jsxs(material.ThemeProvider, { theme: muiTheme, children: [jsxRuntime.jsx(material.CssBaseline, {}), children] }));
|
|
665
643
|
}
|
|
666
644
|
|
|
667
645
|
/*
|
|
@@ -754,8 +732,8 @@ function getInitialLetter(name) {
|
|
|
754
732
|
return lodash.split(name, '', 1)[0].toUpperCase();
|
|
755
733
|
}
|
|
756
734
|
|
|
757
|
-
var __assign
|
|
758
|
-
__assign
|
|
735
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
736
|
+
__assign = Object.assign || function(t) {
|
|
759
737
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
760
738
|
s = arguments[i];
|
|
761
739
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -763,7 +741,7 @@ var __assign$9 = (undefined && undefined.__assign) || function () {
|
|
|
763
741
|
}
|
|
764
742
|
return t;
|
|
765
743
|
};
|
|
766
|
-
return __assign
|
|
744
|
+
return __assign.apply(this, arguments);
|
|
767
745
|
};
|
|
768
746
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
769
747
|
var t = {};
|
|
@@ -800,55 +778,22 @@ var ElementAvatar = react$2.forwardRef(function ElementAvatar(_a, ref) {
|
|
|
800
778
|
var avatarUrl = _a.avatarUrl, userId = _a.userId, displayName = _a.displayName, props = __rest(_a, ["avatarUrl", "userId", "displayName"]);
|
|
801
779
|
var src = avatarUrl ? createAvatarUrl(avatarUrl) : undefined;
|
|
802
780
|
var name = displayName !== null && displayName !== void 0 ? displayName : userId;
|
|
803
|
-
return (jsxRuntime.jsx(StyledAvatar, __assign
|
|
781
|
+
return (jsxRuntime.jsx(StyledAvatar, __assign({ ref: ref, alt: "", "aria-hidden": true, src: src, color: getColor(userId) }, props, { children: getInitialLetter(name) })));
|
|
804
782
|
});
|
|
805
783
|
|
|
806
|
-
var __assign$8 = (undefined && undefined.__assign) || function () {
|
|
807
|
-
__assign$8 = Object.assign || function(t) {
|
|
808
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
809
|
-
s = arguments[i];
|
|
810
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
811
|
-
t[p] = s[p];
|
|
812
|
-
}
|
|
813
|
-
return t;
|
|
814
|
-
};
|
|
815
|
-
return __assign$8.apply(this, arguments);
|
|
816
|
-
};
|
|
817
784
|
function LoadingView() {
|
|
818
785
|
var id = utils.unstable_useId();
|
|
819
786
|
var isLongLoad = reactUse.useTimeout(100)[0];
|
|
820
787
|
var t = reactI18next.useTranslation('widget-toolkit').t;
|
|
821
|
-
return isLongLoad() ? (jsxRuntime.jsxs(material.Box,
|
|
788
|
+
return isLongLoad() ? (jsxRuntime.jsxs(material.Box, { display: "flex", flexDirection: "column", alignItems: "center", p: 2, children: [jsxRuntime.jsx(material.CircularProgress, { "aria-labelledby": id }), jsxRuntime.jsx(material.Typography, { py: 2, variant: "h6", id: id, children: t('loading.message', 'Loading…') })] })) : (jsxRuntime.jsx(jsxRuntime.Fragment, {}));
|
|
822
789
|
}
|
|
823
790
|
|
|
824
|
-
var __assign$7 = (undefined && undefined.__assign) || function () {
|
|
825
|
-
__assign$7 = Object.assign || function(t) {
|
|
826
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
827
|
-
s = arguments[i];
|
|
828
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
829
|
-
t[p] = s[p];
|
|
830
|
-
}
|
|
831
|
-
return t;
|
|
832
|
-
};
|
|
833
|
-
return __assign$7.apply(this, arguments);
|
|
834
|
-
};
|
|
835
791
|
function MissingCapabilitiesError(_a) {
|
|
836
792
|
var onRetry = _a.onRetry;
|
|
837
793
|
var t = reactI18next.useTranslation('widget-toolkit').t;
|
|
838
|
-
return (jsxRuntime.jsx(material.Box,
|
|
794
|
+
return (jsxRuntime.jsx(material.Box, { my: 2, children: jsxRuntime.jsxs(material.Alert, { severity: "error", icon: jsxRuntime.jsx(ErrorIcon__default.default, {}), children: [jsxRuntime.jsx(material.AlertTitle, { children: t('missing-capabilities.title', 'Missing capabilities') }), jsxRuntime.jsx(material.Typography, { variant: "body2", children: t('missing-capabilities.instructions', 'The minimum capabilities required for this widget are missing. Make sure to grant all requested capabilities.') }), jsxRuntime.jsx(material.Box, { mt: 1, children: jsxRuntime.jsx(material.Button, { variant: "contained", onClick: onRetry, children: t('missing-capabilities.request-capabilities', 'Request capabilities') }) })] }) }));
|
|
839
795
|
}
|
|
840
796
|
|
|
841
|
-
var __assign$6 = (undefined && undefined.__assign) || function () {
|
|
842
|
-
__assign$6 = Object.assign || function(t) {
|
|
843
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
844
|
-
s = arguments[i];
|
|
845
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
846
|
-
t[p] = s[p];
|
|
847
|
-
}
|
|
848
|
-
return t;
|
|
849
|
-
};
|
|
850
|
-
return __assign$6.apply(this, arguments);
|
|
851
|
-
};
|
|
852
797
|
/**
|
|
853
798
|
* A guard that ask the user for capabilities and only shows the `children`
|
|
854
799
|
* if all capabilities were accepted.
|
|
@@ -858,65 +803,32 @@ var __assign$6 = (undefined && undefined.__assign) || function () {
|
|
|
858
803
|
*/
|
|
859
804
|
function MuiCapabilitiesGuard(_a) {
|
|
860
805
|
var capabilities = _a.capabilities, children = _a.children;
|
|
861
|
-
return (jsxRuntime.jsx(react$1.CapabilitiesGuard,
|
|
806
|
+
return (jsxRuntime.jsx(react$1.CapabilitiesGuard, { capabilities: capabilities, loadingComponent: LoadingView, missingCapabilitiesComponent: MissingCapabilitiesError, children: children }));
|
|
862
807
|
}
|
|
863
808
|
|
|
864
|
-
var __assign$5 = (undefined && undefined.__assign) || function () {
|
|
865
|
-
__assign$5 = Object.assign || function(t) {
|
|
866
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
867
|
-
s = arguments[i];
|
|
868
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
869
|
-
t[p] = s[p];
|
|
870
|
-
}
|
|
871
|
-
return t;
|
|
872
|
-
};
|
|
873
|
-
return __assign$5.apply(this, arguments);
|
|
874
|
-
};
|
|
875
809
|
function CopyableCode(_a) {
|
|
876
810
|
var code = _a.code;
|
|
877
811
|
var t = reactI18next.useTranslation('widget-toolkit').t;
|
|
878
812
|
var _b = react$2.useState(false), hasCopied = _b[0], setHasCopied = _b[1];
|
|
879
813
|
var _c = reactUse.useCopyToClipboard(), copyToClipboard = _c[1];
|
|
880
814
|
var copyLabel = t('code.copy-to-clipboard', 'Copy to clipboard');
|
|
881
|
-
return (jsxRuntime.jsx(material.Paper,
|
|
815
|
+
return (jsxRuntime.jsx(material.Paper, { sx: { position: 'relative' }, children: jsxRuntime.jsxs(material.Box, { sx: { overflowY: 'auto' }, children: [jsxRuntime.jsx(material.Box, { component: "code", sx: { userSelect: 'all' }, m: 0, children: jsxRuntime.jsx(material.Box, { component: "pre", m: 2, children: code }) }), jsxRuntime.jsx(material.IconButton, { sx: function (theme) { return ({
|
|
882
816
|
position: 'absolute',
|
|
883
817
|
right: theme.spacing(1),
|
|
884
818
|
bottom: theme.spacing(1),
|
|
885
819
|
}); }, onClick: function () {
|
|
886
820
|
copyToClipboard(code);
|
|
887
821
|
setHasCopied(true);
|
|
888
|
-
}, onBlur: function () { return setHasCopied(false); }, "aria-label": copyLabel
|
|
822
|
+
}, onBlur: function () { return setHasCopied(false); }, "aria-label": copyLabel, children: hasCopied ? jsxRuntime.jsx(CheckOutlinedIcon__default.default, {}) : jsxRuntime.jsx(ContentCopyOutlinedIcon__default.default, {}) })] }) }));
|
|
889
823
|
}
|
|
890
824
|
|
|
891
|
-
var __assign$4 = (undefined && undefined.__assign) || function () {
|
|
892
|
-
__assign$4 = Object.assign || function(t) {
|
|
893
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
894
|
-
s = arguments[i];
|
|
895
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
896
|
-
t[p] = s[p];
|
|
897
|
-
}
|
|
898
|
-
return t;
|
|
899
|
-
};
|
|
900
|
-
return __assign$4.apply(this, arguments);
|
|
901
|
-
};
|
|
902
825
|
function ChildError(_a) {
|
|
903
826
|
var _b;
|
|
904
827
|
var error = _a.error;
|
|
905
828
|
var t = reactI18next.useTranslation('widget-toolkit').t;
|
|
906
|
-
return (jsxRuntime.jsx(material.Box,
|
|
829
|
+
return (jsxRuntime.jsx(material.Box, { my: 2, children: jsxRuntime.jsxs(material.Alert, { severity: "error", icon: jsxRuntime.jsx(ErrorIcon__default.default, {}), children: [jsxRuntime.jsx(material.AlertTitle, { children: t('error.title', 'Ohh no!') }), jsxRuntime.jsx(material.Typography, { variant: "body2", children: t('error.instructions', 'An error occured inside the widget. You can try to reopen the widget.') }), jsxRuntime.jsx(material.Box, { mt: 1, children: jsxRuntime.jsx(CopyableCode, { code: "".concat((_b = error.stack) !== null && _b !== void 0 ? _b : error) }) })] }) }));
|
|
907
830
|
}
|
|
908
831
|
|
|
909
|
-
var __assign$3 = (undefined && undefined.__assign) || function () {
|
|
910
|
-
__assign$3 = Object.assign || function(t) {
|
|
911
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
912
|
-
s = arguments[i];
|
|
913
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
914
|
-
t[p] = s[p];
|
|
915
|
-
}
|
|
916
|
-
return t;
|
|
917
|
-
};
|
|
918
|
-
return __assign$3.apply(this, arguments);
|
|
919
|
-
};
|
|
920
832
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
921
833
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
922
834
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -932,7 +844,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
932
844
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
933
845
|
function step(op) {
|
|
934
846
|
if (f) throw new TypeError("Generator is already executing.");
|
|
935
|
-
while (_) try {
|
|
847
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
936
848
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
937
849
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
938
850
|
switch (op[0]) {
|
|
@@ -982,54 +894,21 @@ function MissingParametersError(_a) {
|
|
|
982
894
|
var errorDialogTextId = utils.unstable_useId();
|
|
983
895
|
var successDialogTitleId = utils.unstable_useId();
|
|
984
896
|
var successDialogTextId = utils.unstable_useId();
|
|
985
|
-
return (jsxRuntime.jsxs(material.Box,
|
|
897
|
+
return (jsxRuntime.jsxs(material.Box, { my: 2, children: [jsxRuntime.jsxs(material.Alert, { severity: "error", icon: jsxRuntime.jsx(ErrorIcon__default.default, {}), children: [jsxRuntime.jsx(material.AlertTitle, { children: t('missing-parameters.title', 'Wrong widget registration') }), jsxRuntime.jsx(material.Typography, { variant: "body2", children: t('missing-parameters.instructions', 'The widget is not registered correctly. Make sure to include the correct parameters in the widget URL:') }), jsxRuntime.jsx(material.Box, { my: 1, children: jsxRuntime.jsx(CopyableCode, { code: api.generateWidgetRegistrationUrl() }) }), jsxRuntime.jsx(material.Typography, { variant: "body2", children: t('missing-parameters.repair-instructions', 'You can either modify the widget registration manually or fix it automatically:') }), jsxRuntime.jsx(material.Box, { mt: 1, children: jsxRuntime.jsx(material.Button, { variant: "contained", onClick: handleRepairWidget, children: t('missing-parameters.repair', 'Repair registration') }) })] }), jsxRuntime.jsxs(material.Dialog, { open: isErrorDialogOpen, onClose: function () { return setErrorDialogOpen(false); }, "aria-labelledby": errorDialogTitleId, "aria-describedby": errorDialogTextId, children: [jsxRuntime.jsx(material.DialogTitle, { id: errorDialogTitleId, children: t('missing-parameters.permissions-error.title', 'Error') }), jsxRuntime.jsx(material.DialogContent, { children: jsxRuntime.jsx(material.DialogContentText, { id: errorDialogTextId, children: t('missing-parameters.permissions-error.instructions', 'Insufficient permissions, could not configure widget. Only room admins can configure the widget.') }) }), jsxRuntime.jsx(material.DialogActions, { children: jsxRuntime.jsx(material.Button, { onClick: function () { return setErrorDialogOpen(false); }, autoFocus: true, children: t('missing-parameters.permissions-error.close', 'Close') }) })] }), jsxRuntime.jsxs(material.Dialog, { open: isCompleted, "aria-labelledby": successDialogTitleId, "aria-describedby": successDialogTextId, children: [jsxRuntime.jsx(material.DialogTitle, { id: successDialogTitleId, children: t('missing-parameters.completed.title', 'Widget configuration complete') }), jsxRuntime.jsx(material.DialogContent, { children: jsxRuntime.jsx(material.DialogContentText, { id: successDialogTextId, children: t('missing-parameters.completed.instructions', 'Configuration completed, reopen the widget to start using it.') }) })] })] }));
|
|
986
898
|
}
|
|
987
899
|
|
|
988
|
-
var __assign$2 = (undefined && undefined.__assign) || function () {
|
|
989
|
-
__assign$2 = Object.assign || function(t) {
|
|
990
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
991
|
-
s = arguments[i];
|
|
992
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
993
|
-
t[p] = s[p];
|
|
994
|
-
}
|
|
995
|
-
return t;
|
|
996
|
-
};
|
|
997
|
-
return __assign$2.apply(this, arguments);
|
|
998
|
-
};
|
|
999
900
|
function MobileClientError() {
|
|
1000
901
|
var t = reactI18next.useTranslation('widget-toolkit').t;
|
|
1001
|
-
return (jsxRuntime.jsx(material.Box,
|
|
902
|
+
return (jsxRuntime.jsx(material.Box, { m: 2, children: jsxRuntime.jsxs(material.Alert, { severity: "error", icon: jsxRuntime.jsx(ErrorIcon__default.default, {}), children: [jsxRuntime.jsx(material.AlertTitle, { children: t('mobile-client.title', 'Mobile clients are not supported') }), t('mobile-client.instructions', "The widget doesn't work in mobile clients due to technical limitations. Open the widget on you Desktop or Web client.")] }) }));
|
|
1002
903
|
}
|
|
1003
904
|
|
|
1004
|
-
var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
1005
|
-
__assign$1 = Object.assign || function(t) {
|
|
1006
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1007
|
-
s = arguments[i];
|
|
1008
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1009
|
-
t[p] = s[p];
|
|
1010
|
-
}
|
|
1011
|
-
return t;
|
|
1012
|
-
};
|
|
1013
|
-
return __assign$1.apply(this, arguments);
|
|
1014
|
-
};
|
|
1015
905
|
function OutsideClientError() {
|
|
1016
906
|
var t = reactI18next.useTranslation('widget-toolkit').t;
|
|
1017
|
-
return (jsxRuntime.jsx(material.Box,
|
|
907
|
+
return (jsxRuntime.jsx(material.Box, { m: 2, children: jsxRuntime.jsxs(material.Alert, { severity: "error", icon: jsxRuntime.jsx(ErrorIcon__default.default, {}), children: [jsxRuntime.jsx(material.AlertTitle, { children: t('outside-client.title', 'Only runs as a widget') }), jsxRuntime.jsx(material.Typography, { variant: "body2", children: t('outside-client.instructions', "You need to register this URL as a widget, it's not possible to use it standalone. Run this command in the matrix room you want to register the widget in:") }), jsxRuntime.jsx(material.Box, { mt: 1, children: jsxRuntime.jsx(CopyableCode, { code: "/addwidget ".concat(api.generateWidgetRegistrationUrl({
|
|
1018
908
|
includeParameters: false,
|
|
1019
|
-
})) }) })
|
|
909
|
+
})) }) })] }) }));
|
|
1020
910
|
}
|
|
1021
911
|
|
|
1022
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
|
1023
|
-
__assign = Object.assign || function(t) {
|
|
1024
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1025
|
-
s = arguments[i];
|
|
1026
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1027
|
-
t[p] = s[p];
|
|
1028
|
-
}
|
|
1029
|
-
return t;
|
|
1030
|
-
};
|
|
1031
|
-
return __assign.apply(this, arguments);
|
|
1032
|
-
};
|
|
1033
912
|
/**
|
|
1034
913
|
* Provides the `WidgetApi` in the React context once it's fully
|
|
1035
914
|
* initialized without errors.
|
|
@@ -1038,7 +917,7 @@ var __assign = (undefined && undefined.__assign) || function () {
|
|
|
1038
917
|
*/
|
|
1039
918
|
function MuiWidgetApiProvider(_a) {
|
|
1040
919
|
var widgetRegistration = _a.widgetRegistration, widgetApiPromise = _a.widgetApiPromise, children = _a.children;
|
|
1041
|
-
return (jsxRuntime.jsx(react$1.WidgetApiProvider,
|
|
920
|
+
return (jsxRuntime.jsx(react$1.WidgetApiProvider, { widgetApiPromise: widgetApiPromise, widgetRegistration: widgetRegistration, loadingViewComponent: LoadingView, mobileClientErrorComponent: MobileClientError, childErrorComponent: ChildError, outsideClientErrorComponent: OutsideClientError, missingCapabilitiesComponent: MissingCapabilitiesError, missingParametersErrorComponent: MissingParametersError, children: children }));
|
|
1042
921
|
}
|
|
1043
922
|
|
|
1044
923
|
/*
|
package/build/esm/index.js
CHANGED
|
@@ -19,6 +19,42 @@ import { repairWidgetRegistration, generateWidgetRegistrationUrl, extractWidgetP
|
|
|
19
19
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
20
20
|
import resourcesToBackend from 'i18next-resources-to-backend';
|
|
21
21
|
|
|
22
|
+
/*
|
|
23
|
+
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
24
|
+
*
|
|
25
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26
|
+
* you may not use this file except in compliance with the License.
|
|
27
|
+
* You may obtain a copy of the License at
|
|
28
|
+
*
|
|
29
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
+
*
|
|
31
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
32
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
33
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
34
|
+
* See the License for the specific language governing permissions and
|
|
35
|
+
* limitations under the License.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Retrieve the nonce passed by our Docker base image.
|
|
39
|
+
* @returns A nonce that can be used to perform operations that are disabled in
|
|
40
|
+
* our CSP by default.
|
|
41
|
+
*/
|
|
42
|
+
function getNonce() {
|
|
43
|
+
return window['NONCE'];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function createEmotionCache() {
|
|
47
|
+
return createCache({
|
|
48
|
+
key: 'widget',
|
|
49
|
+
nonce: getNonce(),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
var cache = createEmotionCache();
|
|
53
|
+
function EmotionCacheProvider(_a) {
|
|
54
|
+
var children = _a.children;
|
|
55
|
+
return jsx(CacheProvider, { value: cache, children: children });
|
|
56
|
+
}
|
|
57
|
+
|
|
22
58
|
/*
|
|
23
59
|
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
24
60
|
*
|
|
@@ -56,53 +92,6 @@ function getEnvironment(name, defaultValue) {
|
|
|
56
92
|
return value !== null && value !== void 0 ? value : defaultValue;
|
|
57
93
|
}
|
|
58
94
|
|
|
59
|
-
/*
|
|
60
|
-
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
61
|
-
*
|
|
62
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
63
|
-
* you may not use this file except in compliance with the License.
|
|
64
|
-
* You may obtain a copy of the License at
|
|
65
|
-
*
|
|
66
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
67
|
-
*
|
|
68
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
69
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
70
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
71
|
-
* See the License for the specific language governing permissions and
|
|
72
|
-
* limitations under the License.
|
|
73
|
-
*/
|
|
74
|
-
/**
|
|
75
|
-
* Retrieve the nonce passed by our Docker base image.
|
|
76
|
-
* @returns A nonce that can be used to perform operations that are disabled in
|
|
77
|
-
* our CSP by default.
|
|
78
|
-
*/
|
|
79
|
-
function getNonce() {
|
|
80
|
-
return window['NONCE'];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var __assign$b = (undefined && undefined.__assign) || function () {
|
|
84
|
-
__assign$b = Object.assign || function(t) {
|
|
85
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
86
|
-
s = arguments[i];
|
|
87
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
88
|
-
t[p] = s[p];
|
|
89
|
-
}
|
|
90
|
-
return t;
|
|
91
|
-
};
|
|
92
|
-
return __assign$b.apply(this, arguments);
|
|
93
|
-
};
|
|
94
|
-
function createEmotionCache() {
|
|
95
|
-
return createCache({
|
|
96
|
-
key: 'widget',
|
|
97
|
-
nonce: getNonce(),
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
var cache = createEmotionCache();
|
|
101
|
-
function EmotionCacheProvider(_a) {
|
|
102
|
-
var children = _a.children;
|
|
103
|
-
return jsx(CacheProvider, __assign$b({ value: cache }, { children: children }));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
95
|
/*
|
|
107
96
|
* Copyright 2022 Nordeck IT + Consulting GmbH
|
|
108
97
|
*
|
|
@@ -120,12 +109,12 @@ function EmotionCacheProvider(_a) {
|
|
|
120
109
|
*/
|
|
121
110
|
var fontFamily = [
|
|
122
111
|
'Inter',
|
|
123
|
-
'Twemoji',
|
|
124
|
-
'"Apple Color Emoji"',
|
|
125
|
-
'"Segoe UI Emoji"',
|
|
126
112
|
'Arial',
|
|
127
113
|
'Helvetica',
|
|
128
114
|
'sans-serif',
|
|
115
|
+
'Twemoji',
|
|
116
|
+
'"Apple Color Emoji"',
|
|
117
|
+
'"Segoe UI Emoji"',
|
|
129
118
|
'"Noto Color Emoji"',
|
|
130
119
|
].join(',');
|
|
131
120
|
var primaryColor = getEnvironment('REACT_APP_PRIMARY_COLOR', '#0dbd8b');
|
|
@@ -601,17 +590,6 @@ var darkTheme = {
|
|
|
601
590
|
},
|
|
602
591
|
};
|
|
603
592
|
|
|
604
|
-
var __assign$a = (undefined && undefined.__assign) || function () {
|
|
605
|
-
__assign$a = Object.assign || function(t) {
|
|
606
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
607
|
-
s = arguments[i];
|
|
608
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
609
|
-
t[p] = s[p];
|
|
610
|
-
}
|
|
611
|
-
return t;
|
|
612
|
-
};
|
|
613
|
-
return __assign$a.apply(this, arguments);
|
|
614
|
-
};
|
|
615
593
|
/**
|
|
616
594
|
* Provide a semantic UI based theme to the child components.
|
|
617
595
|
* @param param0 - {@link MuiThemeProviderProps}
|
|
@@ -649,7 +627,7 @@ function ElementMuiThemeProvider(_a) {
|
|
|
649
627
|
var localeOptions = locale && new Intl.Locale(locale).language === 'de' ? deDE : enUS;
|
|
650
628
|
return createTheme(deepmerge(baseTheme, themeOptions), localeOptions);
|
|
651
629
|
}, [locale, theme]);
|
|
652
|
-
return (jsxs(ThemeProvider,
|
|
630
|
+
return (jsxs(ThemeProvider, { theme: muiTheme, children: [jsx(CssBaseline, {}), children] }));
|
|
653
631
|
}
|
|
654
632
|
|
|
655
633
|
/*
|
|
@@ -742,8 +720,8 @@ function getInitialLetter(name) {
|
|
|
742
720
|
return split(name, '', 1)[0].toUpperCase();
|
|
743
721
|
}
|
|
744
722
|
|
|
745
|
-
var __assign
|
|
746
|
-
__assign
|
|
723
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
724
|
+
__assign = Object.assign || function(t) {
|
|
747
725
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
748
726
|
s = arguments[i];
|
|
749
727
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -751,7 +729,7 @@ var __assign$9 = (undefined && undefined.__assign) || function () {
|
|
|
751
729
|
}
|
|
752
730
|
return t;
|
|
753
731
|
};
|
|
754
|
-
return __assign
|
|
732
|
+
return __assign.apply(this, arguments);
|
|
755
733
|
};
|
|
756
734
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
757
735
|
var t = {};
|
|
@@ -788,55 +766,22 @@ var ElementAvatar = forwardRef(function ElementAvatar(_a, ref) {
|
|
|
788
766
|
var avatarUrl = _a.avatarUrl, userId = _a.userId, displayName = _a.displayName, props = __rest(_a, ["avatarUrl", "userId", "displayName"]);
|
|
789
767
|
var src = avatarUrl ? createAvatarUrl(avatarUrl) : undefined;
|
|
790
768
|
var name = displayName !== null && displayName !== void 0 ? displayName : userId;
|
|
791
|
-
return (jsx(StyledAvatar, __assign
|
|
769
|
+
return (jsx(StyledAvatar, __assign({ ref: ref, alt: "", "aria-hidden": true, src: src, color: getColor(userId) }, props, { children: getInitialLetter(name) })));
|
|
792
770
|
});
|
|
793
771
|
|
|
794
|
-
var __assign$8 = (undefined && undefined.__assign) || function () {
|
|
795
|
-
__assign$8 = Object.assign || function(t) {
|
|
796
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
797
|
-
s = arguments[i];
|
|
798
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
799
|
-
t[p] = s[p];
|
|
800
|
-
}
|
|
801
|
-
return t;
|
|
802
|
-
};
|
|
803
|
-
return __assign$8.apply(this, arguments);
|
|
804
|
-
};
|
|
805
772
|
function LoadingView() {
|
|
806
773
|
var id = unstable_useId();
|
|
807
774
|
var isLongLoad = useTimeout(100)[0];
|
|
808
775
|
var t = useTranslation('widget-toolkit').t;
|
|
809
|
-
return isLongLoad() ? (jsxs(Box,
|
|
776
|
+
return isLongLoad() ? (jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", p: 2, children: [jsx(CircularProgress, { "aria-labelledby": id }), jsx(Typography, { py: 2, variant: "h6", id: id, children: t('loading.message', 'Loading…') })] })) : (jsx(Fragment, {}));
|
|
810
777
|
}
|
|
811
778
|
|
|
812
|
-
var __assign$7 = (undefined && undefined.__assign) || function () {
|
|
813
|
-
__assign$7 = Object.assign || function(t) {
|
|
814
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
815
|
-
s = arguments[i];
|
|
816
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
817
|
-
t[p] = s[p];
|
|
818
|
-
}
|
|
819
|
-
return t;
|
|
820
|
-
};
|
|
821
|
-
return __assign$7.apply(this, arguments);
|
|
822
|
-
};
|
|
823
779
|
function MissingCapabilitiesError(_a) {
|
|
824
780
|
var onRetry = _a.onRetry;
|
|
825
781
|
var t = useTranslation('widget-toolkit').t;
|
|
826
|
-
return (jsx(Box,
|
|
782
|
+
return (jsx(Box, { my: 2, children: jsxs(Alert, { severity: "error", icon: jsx(ErrorIcon, {}), children: [jsx(AlertTitle, { children: t('missing-capabilities.title', 'Missing capabilities') }), jsx(Typography, { variant: "body2", children: t('missing-capabilities.instructions', 'The minimum capabilities required for this widget are missing. Make sure to grant all requested capabilities.') }), jsx(Box, { mt: 1, children: jsx(Button, { variant: "contained", onClick: onRetry, children: t('missing-capabilities.request-capabilities', 'Request capabilities') }) })] }) }));
|
|
827
783
|
}
|
|
828
784
|
|
|
829
|
-
var __assign$6 = (undefined && undefined.__assign) || function () {
|
|
830
|
-
__assign$6 = Object.assign || function(t) {
|
|
831
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
832
|
-
s = arguments[i];
|
|
833
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
834
|
-
t[p] = s[p];
|
|
835
|
-
}
|
|
836
|
-
return t;
|
|
837
|
-
};
|
|
838
|
-
return __assign$6.apply(this, arguments);
|
|
839
|
-
};
|
|
840
785
|
/**
|
|
841
786
|
* A guard that ask the user for capabilities and only shows the `children`
|
|
842
787
|
* if all capabilities were accepted.
|
|
@@ -846,65 +791,32 @@ var __assign$6 = (undefined && undefined.__assign) || function () {
|
|
|
846
791
|
*/
|
|
847
792
|
function MuiCapabilitiesGuard(_a) {
|
|
848
793
|
var capabilities = _a.capabilities, children = _a.children;
|
|
849
|
-
return (jsx(CapabilitiesGuard,
|
|
794
|
+
return (jsx(CapabilitiesGuard, { capabilities: capabilities, loadingComponent: LoadingView, missingCapabilitiesComponent: MissingCapabilitiesError, children: children }));
|
|
850
795
|
}
|
|
851
796
|
|
|
852
|
-
var __assign$5 = (undefined && undefined.__assign) || function () {
|
|
853
|
-
__assign$5 = Object.assign || function(t) {
|
|
854
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
855
|
-
s = arguments[i];
|
|
856
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
857
|
-
t[p] = s[p];
|
|
858
|
-
}
|
|
859
|
-
return t;
|
|
860
|
-
};
|
|
861
|
-
return __assign$5.apply(this, arguments);
|
|
862
|
-
};
|
|
863
797
|
function CopyableCode(_a) {
|
|
864
798
|
var code = _a.code;
|
|
865
799
|
var t = useTranslation('widget-toolkit').t;
|
|
866
800
|
var _b = useState(false), hasCopied = _b[0], setHasCopied = _b[1];
|
|
867
801
|
var _c = useCopyToClipboard(), copyToClipboard = _c[1];
|
|
868
802
|
var copyLabel = t('code.copy-to-clipboard', 'Copy to clipboard');
|
|
869
|
-
return (jsx(Paper,
|
|
803
|
+
return (jsx(Paper, { sx: { position: 'relative' }, children: jsxs(Box, { sx: { overflowY: 'auto' }, children: [jsx(Box, { component: "code", sx: { userSelect: 'all' }, m: 0, children: jsx(Box, { component: "pre", m: 2, children: code }) }), jsx(IconButton, { sx: function (theme) { return ({
|
|
870
804
|
position: 'absolute',
|
|
871
805
|
right: theme.spacing(1),
|
|
872
806
|
bottom: theme.spacing(1),
|
|
873
807
|
}); }, onClick: function () {
|
|
874
808
|
copyToClipboard(code);
|
|
875
809
|
setHasCopied(true);
|
|
876
|
-
}, onBlur: function () { return setHasCopied(false); }, "aria-label": copyLabel
|
|
810
|
+
}, onBlur: function () { return setHasCopied(false); }, "aria-label": copyLabel, children: hasCopied ? jsx(CheckOutlinedIcon, {}) : jsx(ContentCopyOutlinedIcon, {}) })] }) }));
|
|
877
811
|
}
|
|
878
812
|
|
|
879
|
-
var __assign$4 = (undefined && undefined.__assign) || function () {
|
|
880
|
-
__assign$4 = Object.assign || function(t) {
|
|
881
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
882
|
-
s = arguments[i];
|
|
883
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
884
|
-
t[p] = s[p];
|
|
885
|
-
}
|
|
886
|
-
return t;
|
|
887
|
-
};
|
|
888
|
-
return __assign$4.apply(this, arguments);
|
|
889
|
-
};
|
|
890
813
|
function ChildError(_a) {
|
|
891
814
|
var _b;
|
|
892
815
|
var error = _a.error;
|
|
893
816
|
var t = useTranslation('widget-toolkit').t;
|
|
894
|
-
return (jsx(Box,
|
|
817
|
+
return (jsx(Box, { my: 2, children: jsxs(Alert, { severity: "error", icon: jsx(ErrorIcon, {}), children: [jsx(AlertTitle, { children: t('error.title', 'Ohh no!') }), jsx(Typography, { variant: "body2", children: t('error.instructions', 'An error occured inside the widget. You can try to reopen the widget.') }), jsx(Box, { mt: 1, children: jsx(CopyableCode, { code: "".concat((_b = error.stack) !== null && _b !== void 0 ? _b : error) }) })] }) }));
|
|
895
818
|
}
|
|
896
819
|
|
|
897
|
-
var __assign$3 = (undefined && undefined.__assign) || function () {
|
|
898
|
-
__assign$3 = Object.assign || function(t) {
|
|
899
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
900
|
-
s = arguments[i];
|
|
901
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
902
|
-
t[p] = s[p];
|
|
903
|
-
}
|
|
904
|
-
return t;
|
|
905
|
-
};
|
|
906
|
-
return __assign$3.apply(this, arguments);
|
|
907
|
-
};
|
|
908
820
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
909
821
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
910
822
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -920,7 +832,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
|
920
832
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
921
833
|
function step(op) {
|
|
922
834
|
if (f) throw new TypeError("Generator is already executing.");
|
|
923
|
-
while (_) try {
|
|
835
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
924
836
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
925
837
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
926
838
|
switch (op[0]) {
|
|
@@ -970,54 +882,21 @@ function MissingParametersError(_a) {
|
|
|
970
882
|
var errorDialogTextId = unstable_useId();
|
|
971
883
|
var successDialogTitleId = unstable_useId();
|
|
972
884
|
var successDialogTextId = unstable_useId();
|
|
973
|
-
return (jsxs(Box,
|
|
885
|
+
return (jsxs(Box, { my: 2, children: [jsxs(Alert, { severity: "error", icon: jsx(ErrorIcon, {}), children: [jsx(AlertTitle, { children: t('missing-parameters.title', 'Wrong widget registration') }), jsx(Typography, { variant: "body2", children: t('missing-parameters.instructions', 'The widget is not registered correctly. Make sure to include the correct parameters in the widget URL:') }), jsx(Box, { my: 1, children: jsx(CopyableCode, { code: generateWidgetRegistrationUrl() }) }), jsx(Typography, { variant: "body2", children: t('missing-parameters.repair-instructions', 'You can either modify the widget registration manually or fix it automatically:') }), jsx(Box, { mt: 1, children: jsx(Button, { variant: "contained", onClick: handleRepairWidget, children: t('missing-parameters.repair', 'Repair registration') }) })] }), jsxs(Dialog, { open: isErrorDialogOpen, onClose: function () { return setErrorDialogOpen(false); }, "aria-labelledby": errorDialogTitleId, "aria-describedby": errorDialogTextId, children: [jsx(DialogTitle, { id: errorDialogTitleId, children: t('missing-parameters.permissions-error.title', 'Error') }), jsx(DialogContent, { children: jsx(DialogContentText, { id: errorDialogTextId, children: t('missing-parameters.permissions-error.instructions', 'Insufficient permissions, could not configure widget. Only room admins can configure the widget.') }) }), jsx(DialogActions, { children: jsx(Button, { onClick: function () { return setErrorDialogOpen(false); }, autoFocus: true, children: t('missing-parameters.permissions-error.close', 'Close') }) })] }), jsxs(Dialog, { open: isCompleted, "aria-labelledby": successDialogTitleId, "aria-describedby": successDialogTextId, children: [jsx(DialogTitle, { id: successDialogTitleId, children: t('missing-parameters.completed.title', 'Widget configuration complete') }), jsx(DialogContent, { children: jsx(DialogContentText, { id: successDialogTextId, children: t('missing-parameters.completed.instructions', 'Configuration completed, reopen the widget to start using it.') }) })] })] }));
|
|
974
886
|
}
|
|
975
887
|
|
|
976
|
-
var __assign$2 = (undefined && undefined.__assign) || function () {
|
|
977
|
-
__assign$2 = Object.assign || function(t) {
|
|
978
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
979
|
-
s = arguments[i];
|
|
980
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
981
|
-
t[p] = s[p];
|
|
982
|
-
}
|
|
983
|
-
return t;
|
|
984
|
-
};
|
|
985
|
-
return __assign$2.apply(this, arguments);
|
|
986
|
-
};
|
|
987
888
|
function MobileClientError() {
|
|
988
889
|
var t = useTranslation('widget-toolkit').t;
|
|
989
|
-
return (jsx(Box,
|
|
890
|
+
return (jsx(Box, { m: 2, children: jsxs(Alert, { severity: "error", icon: jsx(ErrorIcon, {}), children: [jsx(AlertTitle, { children: t('mobile-client.title', 'Mobile clients are not supported') }), t('mobile-client.instructions', "The widget doesn't work in mobile clients due to technical limitations. Open the widget on you Desktop or Web client.")] }) }));
|
|
990
891
|
}
|
|
991
892
|
|
|
992
|
-
var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
993
|
-
__assign$1 = Object.assign || function(t) {
|
|
994
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
995
|
-
s = arguments[i];
|
|
996
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
997
|
-
t[p] = s[p];
|
|
998
|
-
}
|
|
999
|
-
return t;
|
|
1000
|
-
};
|
|
1001
|
-
return __assign$1.apply(this, arguments);
|
|
1002
|
-
};
|
|
1003
893
|
function OutsideClientError() {
|
|
1004
894
|
var t = useTranslation('widget-toolkit').t;
|
|
1005
|
-
return (jsx(Box,
|
|
895
|
+
return (jsx(Box, { m: 2, children: jsxs(Alert, { severity: "error", icon: jsx(ErrorIcon, {}), children: [jsx(AlertTitle, { children: t('outside-client.title', 'Only runs as a widget') }), jsx(Typography, { variant: "body2", children: t('outside-client.instructions', "You need to register this URL as a widget, it's not possible to use it standalone. Run this command in the matrix room you want to register the widget in:") }), jsx(Box, { mt: 1, children: jsx(CopyableCode, { code: "/addwidget ".concat(generateWidgetRegistrationUrl({
|
|
1006
896
|
includeParameters: false,
|
|
1007
|
-
})) }) })
|
|
897
|
+
})) }) })] }) }));
|
|
1008
898
|
}
|
|
1009
899
|
|
|
1010
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
|
1011
|
-
__assign = Object.assign || function(t) {
|
|
1012
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1013
|
-
s = arguments[i];
|
|
1014
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
1015
|
-
t[p] = s[p];
|
|
1016
|
-
}
|
|
1017
|
-
return t;
|
|
1018
|
-
};
|
|
1019
|
-
return __assign.apply(this, arguments);
|
|
1020
|
-
};
|
|
1021
900
|
/**
|
|
1022
901
|
* Provides the `WidgetApi` in the React context once it's fully
|
|
1023
902
|
* initialized without errors.
|
|
@@ -1026,7 +905,7 @@ var __assign = (undefined && undefined.__assign) || function () {
|
|
|
1026
905
|
*/
|
|
1027
906
|
function MuiWidgetApiProvider(_a) {
|
|
1028
907
|
var widgetRegistration = _a.widgetRegistration, widgetApiPromise = _a.widgetApiPromise, children = _a.children;
|
|
1029
|
-
return (jsx(WidgetApiProvider,
|
|
908
|
+
return (jsx(WidgetApiProvider, { widgetApiPromise: widgetApiPromise, widgetRegistration: widgetRegistration, loadingViewComponent: LoadingView, mobileClientErrorComponent: MobileClientError, childErrorComponent: ChildError, outsideClientErrorComponent: OutsideClientError, missingCapabilitiesComponent: MissingCapabilitiesError, missingParametersErrorComponent: MissingParametersError, children: children }));
|
|
1030
909
|
}
|
|
1031
910
|
|
|
1032
911
|
/*
|
package/build/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { WidgetRegistration } from '@matrix-widget-toolkit/api';
|
|
|
22
22
|
* A component to display user and room avatars in the style of Element.
|
|
23
23
|
* @param param0 - {@link ElementAvatarProps}
|
|
24
24
|
*/
|
|
25
|
-
export declare const ElementAvatar: ForwardRefExoticComponent<Pick<ElementAvatarProps, "id" | "userId" | "displayName" | "avatarUrl" | "title" | "results" | "children" | "slot" | "onReset" | "onError" | "color" | "translate" | keyof CommonProps | "sx" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export declare const ElementAvatar: ForwardRefExoticComponent<Pick<ElementAvatarProps, "id" | "userId" | "displayName" | "avatarUrl" | "title" | "results" | "children" | "slot" | "onReset" | "onError" | "color" | "translate" | keyof CommonProps | "sx" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & RefAttributes<HTMLDivElement>>;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Props for the {@link ElementAvatar} component.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matrix-widget-toolkit/mui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "A customized material-ui theme that matches the style of the Element Matrix client",
|
|
5
5
|
"author": "Nordeck IT + Consulting GmbH",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
"module": "./build/esm/index.js",
|
|
9
9
|
"types": "./build/index.d.ts",
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@craco/craco": "^
|
|
12
|
-
"@testing-library/jest-dom": "^
|
|
11
|
+
"@craco/craco": "^7.1.0",
|
|
12
|
+
"@testing-library/jest-dom": "^6.0.1",
|
|
13
13
|
"@testing-library/react": "^12.1.5",
|
|
14
14
|
"@testing-library/user-event": "^14.4.3",
|
|
15
15
|
"@types/jest": "^27.5.2",
|
|
16
16
|
"@types/jest-axe": "^3.5.5",
|
|
17
|
-
"@types/lodash": "^4.14.
|
|
18
|
-
"@types/node": "^16.18.
|
|
17
|
+
"@types/lodash": "^4.14.197",
|
|
18
|
+
"@types/node": "^16.18.42",
|
|
19
19
|
"@types/react": "^17.0.45",
|
|
20
20
|
"copyfiles": "^2.4.1",
|
|
21
|
-
"i18next-parser": "^
|
|
22
|
-
"jest-axe": "^
|
|
21
|
+
"i18next-parser": "^8.6.0",
|
|
22
|
+
"jest-axe": "^8.0.0",
|
|
23
23
|
"react": "^17.0.2",
|
|
24
24
|
"react-scripts": "5.0.1",
|
|
25
|
-
"typescript": "^
|
|
25
|
+
"typescript": "^5.1.6"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsc && rollup --config ../../rollup.config.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"tsc": "tsc",
|
|
31
31
|
"lint": "eslint .",
|
|
32
32
|
"test": "jest --watch",
|
|
33
|
-
"depcheck": "depcheck --ignores=@types/
|
|
33
|
+
"depcheck": "depcheck --ignores=@types/node --ignore-dirs=lib,build",
|
|
34
34
|
"prepack": "node ../../scripts/prepack.js",
|
|
35
35
|
"postpack": "node ../../scripts/postpack.js",
|
|
36
36
|
"translate": "i18next src/**/*.{ts,tsx}",
|
|
@@ -38,22 +38,22 @@
|
|
|
38
38
|
"generate-api-report": "tsc && api-extractor run --verbose --local"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@emotion/cache": "^11.
|
|
42
|
-
"@emotion/react": "^11.
|
|
43
|
-
"@emotion/styled": "^11.
|
|
44
|
-
"@fontsource/inter": "^
|
|
45
|
-
"@mui/icons-material": "^5.
|
|
46
|
-
"@mui/material": "^5.
|
|
47
|
-
"@mui/utils": "^5.
|
|
48
|
-
"@matrix-widget-toolkit/api": "^3.2.
|
|
41
|
+
"@emotion/cache": "^11.11.0",
|
|
42
|
+
"@emotion/react": "^11.11.1",
|
|
43
|
+
"@emotion/styled": "^11.11.0",
|
|
44
|
+
"@fontsource/inter": "^5.0.8",
|
|
45
|
+
"@mui/icons-material": "^5.14.3",
|
|
46
|
+
"@mui/material": "^5.14.5",
|
|
47
|
+
"@mui/utils": "^5.14.5",
|
|
48
|
+
"@matrix-widget-toolkit/api": "^3.2.1",
|
|
49
49
|
"@matrix-widget-toolkit/react": "^1.0.5",
|
|
50
|
-
"i18next": "^
|
|
51
|
-
"i18next-browser-languagedetector": "^7.0
|
|
50
|
+
"i18next": "^23.4.4",
|
|
51
|
+
"i18next-browser-languagedetector": "^7.1.0",
|
|
52
52
|
"i18next-resources-to-backend": "^1.1.3",
|
|
53
53
|
"lodash": "^4.17.21",
|
|
54
54
|
"matrix-widget-api": "^1.3.1",
|
|
55
55
|
"react": "^17.0.2",
|
|
56
|
-
"react-i18next": "^
|
|
56
|
+
"react-i18next": "^13.1.2",
|
|
57
57
|
"react-use": "^17.4.0"
|
|
58
58
|
},
|
|
59
59
|
"repository": {
|