@matrix-widget-toolkit/react 1.0.6 → 2.0.1
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 +7 -7
- package/build/esm/index.js +7 -7
- package/build/index.d.ts +0 -2
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ yarn add @matrix-widget-toolkit/react
|
|
|
15
15
|
### Providing the Widget API to React components
|
|
16
16
|
|
|
17
17
|
While this package contains a `<WidgetApiProvider>` you probably don't want to use this package most of the time.
|
|
18
|
-
Prefer using [`@matrix-widget-toolkit/mui`](../mui/)
|
|
18
|
+
Prefer using [`@matrix-widget-toolkit/mui`](../mui/) which internally uses this package to share functionality.
|
|
19
19
|
|
|
20
20
|
### Acessing the Widget API
|
|
21
21
|
|
package/build/cjs/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var reactUse = require('react-use');
|
|
5
|
-
var api = require('@matrix-widget-toolkit/api');
|
|
6
5
|
var react = require('react');
|
|
6
|
+
var api = require('@matrix-widget-toolkit/api');
|
|
7
7
|
var reactErrorBoundary = require('react-error-boundary');
|
|
8
8
|
|
|
9
9
|
/*
|
|
@@ -92,17 +92,17 @@ function WidgetApiProvider(_a) {
|
|
|
92
92
|
var isOpenedByClient = react.useMemo(function () { return api.extractWidgetParameters(); }, []).isOpenedByClient;
|
|
93
93
|
var _b = react.useState(), hasInitalCapabilitiesGranted = _b[0], setInitialCapabilitiesGranted = _b[1];
|
|
94
94
|
var _c = reactUse.useAsyncFn(function (widgetApi) { return __awaiter(_this, void 0, void 0, function () {
|
|
95
|
-
return __generator(this, function (
|
|
96
|
-
switch (
|
|
95
|
+
return __generator(this, function (_b) {
|
|
96
|
+
switch (_b.label) {
|
|
97
97
|
case 0:
|
|
98
|
-
|
|
98
|
+
_b.trys.push([0, 2, , 3]);
|
|
99
99
|
return [4 /*yield*/, widgetApi.rerequestInitialCapabilities()];
|
|
100
100
|
case 1:
|
|
101
|
-
|
|
101
|
+
_b.sent();
|
|
102
102
|
setInitialCapabilitiesGranted(true);
|
|
103
103
|
return [3 /*break*/, 3];
|
|
104
104
|
case 2:
|
|
105
|
-
|
|
105
|
+
_b.sent();
|
|
106
106
|
setInitialCapabilitiesGranted(false);
|
|
107
107
|
return [3 /*break*/, 3];
|
|
108
108
|
case 3: return [2 /*return*/];
|
|
@@ -194,7 +194,7 @@ function ThemeSelectionProvider(_a) {
|
|
|
194
194
|
try {
|
|
195
195
|
(widgetId = api.extractWidgetApiParameters().widgetId);
|
|
196
196
|
}
|
|
197
|
-
catch (
|
|
197
|
+
catch (_a) {
|
|
198
198
|
// ignore
|
|
199
199
|
}
|
|
200
200
|
var isModal = api.parseWidgetId(widgetId).isModal;
|
package/build/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useAsyncFn, useAsync, useAsyncRetry } from 'react-use';
|
|
3
|
-
import { extractWidgetParameters, hasRequiredWidgetParameters, extractWidgetApiParameters, parseWidgetId } from '@matrix-widget-toolkit/api';
|
|
4
3
|
import { createContext, useContext, useMemo, useState, useCallback } from 'react';
|
|
4
|
+
import { extractWidgetParameters, hasRequiredWidgetParameters, extractWidgetApiParameters, parseWidgetId } from '@matrix-widget-toolkit/api';
|
|
5
5
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
6
6
|
|
|
7
7
|
/*
|
|
@@ -90,17 +90,17 @@ function WidgetApiProvider(_a) {
|
|
|
90
90
|
var isOpenedByClient = useMemo(function () { return extractWidgetParameters(); }, []).isOpenedByClient;
|
|
91
91
|
var _b = useState(), hasInitalCapabilitiesGranted = _b[0], setInitialCapabilitiesGranted = _b[1];
|
|
92
92
|
var _c = useAsyncFn(function (widgetApi) { return __awaiter(_this, void 0, void 0, function () {
|
|
93
|
-
return __generator(this, function (
|
|
94
|
-
switch (
|
|
93
|
+
return __generator(this, function (_b) {
|
|
94
|
+
switch (_b.label) {
|
|
95
95
|
case 0:
|
|
96
|
-
|
|
96
|
+
_b.trys.push([0, 2, , 3]);
|
|
97
97
|
return [4 /*yield*/, widgetApi.rerequestInitialCapabilities()];
|
|
98
98
|
case 1:
|
|
99
|
-
|
|
99
|
+
_b.sent();
|
|
100
100
|
setInitialCapabilitiesGranted(true);
|
|
101
101
|
return [3 /*break*/, 3];
|
|
102
102
|
case 2:
|
|
103
|
-
|
|
103
|
+
_b.sent();
|
|
104
104
|
setInitialCapabilitiesGranted(false);
|
|
105
105
|
return [3 /*break*/, 3];
|
|
106
106
|
case 3: return [2 /*return*/];
|
|
@@ -192,7 +192,7 @@ function ThemeSelectionProvider(_a) {
|
|
|
192
192
|
try {
|
|
193
193
|
(widgetId = extractWidgetApiParameters().widgetId);
|
|
194
194
|
}
|
|
195
|
-
catch (
|
|
195
|
+
catch (_a) {
|
|
196
196
|
// ignore
|
|
197
197
|
}
|
|
198
198
|
var isModal = parseWidgetId(widgetId).isModal;
|
package/build/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matrix-widget-toolkit/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "A simplified layer on top of @matrix-widget-toolkit/api to use it in a React based widget.",
|
|
5
5
|
"author": "Nordeck IT + Consulting GmbH",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,22 +9,21 @@
|
|
|
9
9
|
"types": "./build/index.d.ts",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@craco/craco": "^7.1.0",
|
|
12
|
-
"@testing-library/jest-dom": "^6.
|
|
13
|
-
"@testing-library/react": "^
|
|
14
|
-
"@testing-library/
|
|
15
|
-
"@testing-library/user-event": "^14.5.1",
|
|
12
|
+
"@testing-library/jest-dom": "^6.5.0",
|
|
13
|
+
"@testing-library/react": "^16.0.1",
|
|
14
|
+
"@testing-library/user-event": "^14.5.2",
|
|
16
15
|
"@types/jest": "^27.5.2",
|
|
17
|
-
"@types/node": "^
|
|
18
|
-
"@types/react": "^
|
|
16
|
+
"@types/node": "^22.5.3",
|
|
17
|
+
"@types/react": "^18.2.74",
|
|
19
18
|
"react-scripts": "5.0.1",
|
|
20
|
-
"typescript": "^5.
|
|
19
|
+
"typescript": "^5.5.4"
|
|
21
20
|
},
|
|
22
21
|
"scripts": {
|
|
23
22
|
"build": "tsc && rollup --config ../../rollup.config.mjs",
|
|
24
23
|
"tsc": "tsc",
|
|
25
24
|
"lint": "eslint .",
|
|
26
25
|
"test": "jest --watch",
|
|
27
|
-
"depcheck": "depcheck --ignores=@types/node --ignore-dirs=lib,build",
|
|
26
|
+
"depcheck": "depcheck --ignores=@types/node,@types/jest --ignore-dirs=lib,build",
|
|
28
27
|
"prepack": "node ../../scripts/prepack.js",
|
|
29
28
|
"postpack": "node ../../scripts/postpack.js",
|
|
30
29
|
"translate": "echo \"Nothing to translate\"",
|
|
@@ -32,11 +31,11 @@
|
|
|
32
31
|
"generate-api-report": "tsc && api-extractor run --verbose --local"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@matrix-widget-toolkit/api": "^3.
|
|
36
|
-
"matrix-widget-api": "^1.
|
|
37
|
-
"react": "^
|
|
34
|
+
"@matrix-widget-toolkit/api": "^3.4.0",
|
|
35
|
+
"matrix-widget-api": "^1.9.0",
|
|
36
|
+
"react": "^18.2.0",
|
|
38
37
|
"react-error-boundary": "^3.1.4",
|
|
39
|
-
"react-use": "^17.
|
|
38
|
+
"react-use": "^17.5.1"
|
|
40
39
|
},
|
|
41
40
|
"repository": {
|
|
42
41
|
"type": "git",
|