@squiz/resource-browser 2.2.0-rc.0 → 2.2.2-rc.0
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/.eslintrc +39 -0
- package/CHANGELOG.md +8 -0
- package/build.js +15 -15
- package/lib/MainContainer/MainContainer.js +8 -7
- package/lib/Plugin/Plugin.js +2 -2
- package/lib/ResourceBrowserContext/AuthProvider.js +1 -1
- package/lib/index.css +23 -12
- package/package.json +13 -7
- package/src/Hooks/useAuth.spec.tsx +3 -3
- package/src/MainContainer/MainContainer.tsx +15 -13
- package/src/Plugin/Plugin.tsx +5 -1
- package/src/ResourceBrowserContext/AuthProvider.spec.tsx +5 -5
- package/src/ResourceBrowserContext/AuthProvider.tsx +2 -6
- package/src/__mocks__/StorybookHelpers.tsx +1 -1
- package/src/index.scss +0 -16
- package/src/index.tsx +0 -1
- package/src/types.ts +1 -1
- package/src/utils/authUtils.spec.ts +2 -2
- package/tailwind.config.cjs +1 -0
- package/tsconfig.storybook.json +4 -0
- package/tsconfig.test.json +12 -0
package/.eslintrc
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"extends": ["@squiz"],
|
3
|
+
"plugins": ["import", "prettier"],
|
4
|
+
"rules": {
|
5
|
+
"prettier/prettier": "error",
|
6
|
+
},
|
7
|
+
"settings": {
|
8
|
+
"import/parsers": {
|
9
|
+
"@typescript-eslint/parser": [".ts", ".tsx"],
|
10
|
+
},
|
11
|
+
"import/resolver": {
|
12
|
+
"typescript": {
|
13
|
+
"alwaysTryTypes": true,
|
14
|
+
},
|
15
|
+
},
|
16
|
+
},
|
17
|
+
"ignorePatterns": ["**/lib/"],
|
18
|
+
"overrides": [
|
19
|
+
{
|
20
|
+
"files": ["*.spec.ts", "*.spec.tsx"],
|
21
|
+
"rules": {
|
22
|
+
"no-var": 0,
|
23
|
+
"import/no-extraneous-dependencies": 0,
|
24
|
+
},
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"files": ["*.config.ts", "*.config.js", "build.js"],
|
28
|
+
"rules": {
|
29
|
+
"import/no-extraneous-dependencies": 0,
|
30
|
+
},
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"files": ["*.stories.ts", "*.stories.tsx"],
|
34
|
+
"rules": {
|
35
|
+
"import/no-extraneous-dependencies": 0,
|
36
|
+
},
|
37
|
+
},
|
38
|
+
],
|
39
|
+
}
|
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.2.2-rc.0](https://gitlab.squiz.net/dxp/dxp-shared-ui/resource-browser/compare/@squiz/resource-browser@2.2.1-rc.0...@squiz/resource-browser@2.2.2-rc.0) (2024-06-10)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @squiz/resource-browser
|
9
|
+
|
10
|
+
## [2.2.1-rc.0](https://gitlab.squiz.net/dxp/dxp-shared-ui/resource-browser/compare/@squiz/resource-browser@2.2.0-rc.0...@squiz/resource-browser@2.2.1-rc.0) (2024-06-07)
|
11
|
+
|
12
|
+
**Note:** Version bump only for package @squiz/resource-browser
|
13
|
+
|
6
14
|
# [2.2.0-rc.0](https://gitlab.squiz.net/dxp/dxp-shared-ui/resource-browser/compare/@squiz/resource-browser@2.1.10-rc.0...@squiz/resource-browser@2.2.0-rc.0) (2024-06-06)
|
7
15
|
|
8
16
|
### Features
|
package/build.js
CHANGED
@@ -4,18 +4,18 @@ const postcss = require('postcss');
|
|
4
4
|
const postcssConfig = require('./postcss.config').plugins;
|
5
5
|
|
6
6
|
esbuild
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
7
|
+
.build({
|
8
|
+
entryPoints: ['src/index.scss'],
|
9
|
+
bundle: true,
|
10
|
+
outdir: 'lib',
|
11
|
+
plugins: [
|
12
|
+
sassPlugin({
|
13
|
+
type: 'css',
|
14
|
+
transform: async (source) => {
|
15
|
+
const { css } = postcss(postcssConfig).process(source);
|
16
|
+
return css;
|
17
|
+
},
|
18
|
+
}),
|
19
|
+
],
|
20
|
+
})
|
21
|
+
.catch(() => process.exit(1));
|
@@ -40,22 +40,23 @@ function MainContainer({ title, titleAriaProps, allowedTypes, sources, selectedS
|
|
40
40
|
}, [setHeaderPortal]);
|
41
41
|
// MainContainer will either render the source list view if no source is set or the plugins UI if a source has been selected
|
42
42
|
return (react_1.default.createElement("div", { className: "relative flex flex-col h-full text-gray-800" },
|
43
|
-
react_1.default.createElement("div", { className: "flex items-center
|
43
|
+
react_1.default.createElement("div", { className: "flex items-center py-4.5 pl-4.5 pr-10" },
|
44
44
|
react_1.default.createElement("h2", { ...titleAriaProps, className: "text-xl leading-6 text-gray-800 font-semibold mr-6" },
|
45
45
|
!plugin && 'Environment Selector',
|
46
46
|
plugin && title),
|
47
47
|
plugin && selectedSource && (react_1.default.createElement(react_1.default.Fragment, null,
|
48
48
|
sources.length > 1 && (react_1.default.createElement("div", { className: "px-3 border-l border-gray-300 w-300px" },
|
49
49
|
react_1.default.createElement(SourceDropdown_1.default, { sources: sources, selectedSource: selectedSource, onSourceSelect: onSourceSelect }))),
|
50
|
-
plugin.createHeaderPortal && (react_1.default.createElement("div", { ref: setHeaderPortalRef, className: "px-3 border-l border-gray-300 w-300px" })))),
|
50
|
+
plugin.createHeaderPortal && (react_1.default.createElement("div", { ref: setHeaderPortalRef, className: "squiz-rb-plugin px-3 border-l border-gray-300 w-300px" })))),
|
51
51
|
react_1.default.createElement("button", { type: "button", "aria-label": `Close ${title} dialog`, onClick: onClose, className: "absolute top-2 right-2 p-2.5 rounded hover:bg-blue-100 focus:bg-blue-100" },
|
52
52
|
react_1.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
53
53
|
react_1.default.createElement("path", { d: "M13.3 0.710017C13.1131 0.522765 12.8595 0.417532 12.595 0.417532C12.3305 0.417532 12.0768 0.522765 11.89 0.710017L6.99997 5.59002L2.10997 0.700017C1.92314 0.512765 1.66949 0.407532 1.40497 0.407532C1.14045 0.407532 0.886802 0.512765 0.699971 0.700017C0.309971 1.09002 0.309971 1.72002 0.699971 2.11002L5.58997 7.00002L0.699971 11.89C0.309971 12.28 0.309971 12.91 0.699971 13.3C1.08997 13.69 1.71997 13.69 2.10997 13.3L6.99997 8.41002L11.89 13.3C12.28 13.69 12.91 13.69 13.3 13.3C13.69 12.91 13.69 12.28 13.3 11.89L8.40997 7.00002L13.3 2.11002C13.68 1.73002 13.68 1.09002 13.3 0.710017Z", fill: "currentColor" })))),
|
54
|
-
react_1.default.createElement("div", { className: "
|
55
|
-
plugin && selectedSource && SourceBrowser && (react_1.default.createElement(
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
react_1.default.createElement("div", { className: "border-t border-gray-300 overflow-y-hidden" },
|
55
|
+
plugin && selectedSource && SourceBrowser && (react_1.default.createElement("div", { className: "squiz-rb-plugin" },
|
56
|
+
react_1.default.createElement(SourceBrowser, { source: selectedSource, allowedTypes: allowedTypes, headerPortal: plugin.createHeaderPortal && headerPortal ? headerPortal : undefined, preselectedResource: preselectedResource || undefined, onSelected: (resource) => {
|
57
|
+
onChange(resource);
|
58
|
+
onClose();
|
59
|
+
} }))),
|
59
60
|
!selectedSource && react_1.default.createElement(SourceList_1.default, { sources: sources, onSourceSelect: onSourceSelect }))));
|
60
61
|
}
|
61
62
|
exports.default = MainContainer;
|
package/lib/Plugin/Plugin.js
CHANGED
@@ -9,8 +9,8 @@ const ResourceBrowserInput_1 = require("../ResourceBrowserInput/ResourceBrowserI
|
|
9
9
|
const AuthProvider_1 = require("../ResourceBrowserContext/AuthProvider");
|
10
10
|
const PluginRender = ({ render, ...props }) => {
|
11
11
|
if (render) {
|
12
|
-
return react_1.default.createElement(AuthProvider_1.AuthProvider, { authConfig: props.source },
|
13
|
-
react_1.default.createElement(ResourceBrowserInput_1.ResourceBrowserInput, { ...props }));
|
12
|
+
return (react_1.default.createElement(AuthProvider_1.AuthProvider, { authConfig: props.source },
|
13
|
+
react_1.default.createElement(ResourceBrowserInput_1.ResourceBrowserInput, { ...props })));
|
14
14
|
}
|
15
15
|
else {
|
16
16
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
@@ -41,6 +41,6 @@ const AuthProvider = ({ children, authConfig }) => {
|
|
41
41
|
if (!authConfiguration?.configuration) {
|
42
42
|
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
43
43
|
}
|
44
|
-
return
|
44
|
+
return react_1.default.createElement(exports.AuthContext.Provider, { value: auth }, children);
|
45
45
|
};
|
46
46
|
exports.AuthProvider = AuthProvider;
|
package/lib/index.css
CHANGED
@@ -610,6 +610,9 @@
|
|
610
610
|
.squiz-rb-scope .max-w-\[50rem\]:not(.squiz-rb-plugin *) {
|
611
611
|
max-width: 50rem;
|
612
612
|
}
|
613
|
+
.squiz-rb-scope .max-w-\[52rem\]:not(.squiz-rb-plugin *) {
|
614
|
+
max-width: 52rem;
|
615
|
+
}
|
613
616
|
.squiz-rb-scope .flex-1:not(.squiz-rb-plugin *) {
|
614
617
|
flex: 1 1 0%;
|
615
618
|
}
|
@@ -815,6 +818,14 @@
|
|
815
818
|
padding-top: 0.5rem;
|
816
819
|
padding-bottom: 0.5rem;
|
817
820
|
}
|
821
|
+
.squiz-rb-scope .py-4:not(.squiz-rb-plugin *) {
|
822
|
+
padding-top: 1rem;
|
823
|
+
padding-bottom: 1rem;
|
824
|
+
}
|
825
|
+
.squiz-rb-scope .py-4\.5:not(.squiz-rb-plugin *) {
|
826
|
+
padding-top: 1.125rem;
|
827
|
+
padding-bottom: 1.125rem;
|
828
|
+
}
|
818
829
|
.squiz-rb-scope .py-8:not(.squiz-rb-plugin *) {
|
819
830
|
padding-top: 2rem;
|
820
831
|
padding-bottom: 2rem;
|
@@ -825,12 +836,24 @@
|
|
825
836
|
.squiz-rb-scope .pb-4:not(.squiz-rb-plugin *) {
|
826
837
|
padding-bottom: 1rem;
|
827
838
|
}
|
839
|
+
.squiz-rb-scope .pb-4\.5:not(.squiz-rb-plugin *) {
|
840
|
+
padding-bottom: 1.125rem;
|
841
|
+
}
|
828
842
|
.squiz-rb-scope .pl-4:not(.squiz-rb-plugin *) {
|
829
843
|
padding-left: 1rem;
|
830
844
|
}
|
845
|
+
.squiz-rb-scope .pl-4\.5:not(.squiz-rb-plugin *) {
|
846
|
+
padding-left: 1.125rem;
|
847
|
+
}
|
848
|
+
.squiz-rb-scope .pr-10:not(.squiz-rb-plugin *) {
|
849
|
+
padding-right: 2.5rem;
|
850
|
+
}
|
831
851
|
.squiz-rb-scope .pr-4:not(.squiz-rb-plugin *) {
|
832
852
|
padding-right: 1rem;
|
833
853
|
}
|
854
|
+
.squiz-rb-scope .pr-4\.5:not(.squiz-rb-plugin *) {
|
855
|
+
padding-right: 1.125rem;
|
856
|
+
}
|
834
857
|
.squiz-rb-scope .pt-3:not(.squiz-rb-plugin *) {
|
835
858
|
padding-top: 0.75rem;
|
836
859
|
}
|
@@ -1032,18 +1055,6 @@
|
|
1032
1055
|
--tw-text-opacity: 1;
|
1033
1056
|
color: rgb(112 112 112 / var(--tw-text-opacity));
|
1034
1057
|
}
|
1035
|
-
.squiz-rb-scope .p-4\.5:not(.squiz-rb-plugin *) {
|
1036
|
-
padding: 18px;
|
1037
|
-
}
|
1038
|
-
.squiz-rb-scope .pl-4\.5:not(.squiz-rb-plugin *) {
|
1039
|
-
padding-left: 18px;
|
1040
|
-
}
|
1041
|
-
.squiz-rb-scope .pr-4\.5:not(.squiz-rb-plugin *) {
|
1042
|
-
padding-right: 18px;
|
1043
|
-
}
|
1044
|
-
.squiz-rb-scope .pb-4\.5:not(.squiz-rb-plugin *) {
|
1045
|
-
padding-bottom: 18px;
|
1046
|
-
}
|
1047
1058
|
.squiz-rb-scope .break-word:not(.squiz-rb-plugin *) {
|
1048
1059
|
word-break: break-word;
|
1049
1060
|
overflow-wrap: anywhere;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/resource-browser",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.2-rc.0",
|
4
4
|
"main": "lib/index.js",
|
5
5
|
"types": "lib/index.d.ts",
|
6
6
|
"private": false,
|
@@ -12,26 +12,31 @@
|
|
12
12
|
"compile:code": "tsc",
|
13
13
|
"compile:styles": "node build.js",
|
14
14
|
"storybook": "storybook dev -p 6006",
|
15
|
-
"test": "
|
15
|
+
"test": "npm run test:unit && npm run test:eslint",
|
16
16
|
"test:unit": "jest",
|
17
|
+
"test:eslint": "eslint .",
|
17
18
|
"test:watch": "jest --watch"
|
18
19
|
},
|
19
20
|
"dependencies": {
|
20
21
|
"@emotion/styled": "^11.11.5",
|
21
22
|
"@mui/icons-material": "5.11.16",
|
22
23
|
"@react-aria/interactions": "^3.21.1",
|
23
|
-
"@react-types/
|
24
|
+
"@react-types/overlays": "^3.8.7",
|
25
|
+
"@react-types/shared": "^3.23.1",
|
24
26
|
"@squiz/dx-json-schema-lib": "^1.67.0",
|
25
27
|
"@squiz/generic-browser-lib": "^1.66.0",
|
26
|
-
"@squiz/resource-browser-ui-lib": "^0.8.
|
28
|
+
"@squiz/resource-browser-ui-lib": "^0.8.3-rc.0",
|
27
29
|
"clsx": "^2.1.0",
|
28
30
|
"expiry-map": "^2.0.0",
|
29
31
|
"p-memoize": "^4.0.4",
|
32
|
+
"react": "^16.14.0 || ^17 || ^18",
|
30
33
|
"react-aria": "3.23.1",
|
34
|
+
"react-dom": "^16.14.0 || ^17 || ^18",
|
31
35
|
"react-responsive": "9.0.2",
|
32
36
|
"react-stately": "3.21.0"
|
33
37
|
},
|
34
38
|
"devDependencies": {
|
39
|
+
"@squiz/eslint-config": "^1.7.0",
|
35
40
|
"@storybook/addon-essentials": "^7.5.3",
|
36
41
|
"@storybook/addon-interactions": "^7.5.3",
|
37
42
|
"@storybook/addon-links": "^7.5.3",
|
@@ -46,9 +51,12 @@
|
|
46
51
|
"@types/postcss-js": "4.0.0",
|
47
52
|
"@types/react": "^18.2.45",
|
48
53
|
"@types/react-dom": "^18.2.18",
|
54
|
+
"@typescript-eslint/parser": "^7.12.0",
|
49
55
|
"autoprefixer": "10.4.14",
|
50
56
|
"esbuild": "^0.19.3",
|
51
57
|
"esbuild-sass-plugin": "^2.8.0",
|
58
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
59
|
+
"eslint-plugin-import": "^2.29.1",
|
52
60
|
"jest": "29.4.1",
|
53
61
|
"jest-environment-jsdom": "29.4.1",
|
54
62
|
"postcss": "8.4.31",
|
@@ -56,8 +64,6 @@
|
|
56
64
|
"postcss-nested": "6.0.1",
|
57
65
|
"postcss-prefix-selector": "1.16.0",
|
58
66
|
"prop-types": "15.8.1",
|
59
|
-
"react": "^18.0.0",
|
60
|
-
"react-dom": "^18.0.0",
|
61
67
|
"storybook": "^7.5.3",
|
62
68
|
"tailwindcss": "3.3.1",
|
63
69
|
"ts-jest": "29.0.5",
|
@@ -81,5 +87,5 @@
|
|
81
87
|
"volta": {
|
82
88
|
"node": "18.18.0"
|
83
89
|
},
|
84
|
-
"gitHead": "
|
90
|
+
"gitHead": "5d66e140b42ee6c9794ca079b1049289ca4f74f8"
|
85
91
|
}
|
@@ -14,7 +14,7 @@ describe('useAuth', () => {
|
|
14
14
|
authUrl: 'https://auth.example.com',
|
15
15
|
clientId: 'example-client-id',
|
16
16
|
redirectUrl: 'https://example.com/callback',
|
17
|
-
scope: 'offline_access'
|
17
|
+
scope: 'offline_access',
|
18
18
|
};
|
19
19
|
|
20
20
|
beforeEach(() => {
|
@@ -55,7 +55,7 @@ describe('useAuth', () => {
|
|
55
55
|
|
56
56
|
Object.defineProperty(popupMock, 'closed', {
|
57
57
|
get: jest.fn(() => false),
|
58
|
-
set: jest.fn()
|
58
|
+
set: jest.fn(),
|
59
59
|
});
|
60
60
|
|
61
61
|
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
@@ -93,7 +93,7 @@ describe('useAuth', () => {
|
|
93
93
|
expect(window.open).toHaveBeenCalledWith(
|
94
94
|
`${authConfig.authUrl}?client_id=${authConfig.clientId}&scope=offline_access&redirect_uri=${encodeURIComponent(authConfig.redirectUrl)}&response_type=code&state=state`,
|
95
95
|
'Login',
|
96
|
-
'width=600,height=600'
|
96
|
+
'width=600,height=600',
|
97
97
|
);
|
98
98
|
|
99
99
|
act(() => {
|
@@ -46,7 +46,7 @@ function MainContainer({
|
|
46
46
|
// MainContainer will either render the source list view if no source is set or the plugins UI if a source has been selected
|
47
47
|
return (
|
48
48
|
<div className="relative flex flex-col h-full text-gray-800">
|
49
|
-
<div className="flex items-center
|
49
|
+
<div className="flex items-center py-4.5 pl-4.5 pr-10">
|
50
50
|
<h2 {...titleAriaProps} className="text-xl leading-6 text-gray-800 font-semibold mr-6">
|
51
51
|
{!plugin && 'Environment Selector'}
|
52
52
|
{plugin && title}
|
@@ -60,7 +60,7 @@ function MainContainer({
|
|
60
60
|
</div>
|
61
61
|
)}
|
62
62
|
{plugin.createHeaderPortal && (
|
63
|
-
<div ref={setHeaderPortalRef} className="px-3 border-l border-gray-300 w-300px"></div>
|
63
|
+
<div ref={setHeaderPortalRef} className="squiz-rb-plugin px-3 border-l border-gray-300 w-300px"></div>
|
64
64
|
)}
|
65
65
|
</>
|
66
66
|
)}
|
@@ -79,18 +79,20 @@ function MainContainer({
|
|
79
79
|
</svg>
|
80
80
|
</button>
|
81
81
|
</div>
|
82
|
-
<div className="
|
82
|
+
<div className="border-t border-gray-300 overflow-y-hidden">
|
83
83
|
{plugin && selectedSource && SourceBrowser && (
|
84
|
-
<
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
84
|
+
<div className="squiz-rb-plugin">
|
85
|
+
<SourceBrowser
|
86
|
+
source={selectedSource}
|
87
|
+
allowedTypes={allowedTypes}
|
88
|
+
headerPortal={plugin.createHeaderPortal && headerPortal ? headerPortal : undefined}
|
89
|
+
preselectedResource={preselectedResource || undefined}
|
90
|
+
onSelected={(resource: ResourceBrowserResource) => {
|
91
|
+
onChange(resource);
|
92
|
+
onClose();
|
93
|
+
}}
|
94
|
+
/>
|
95
|
+
</div>
|
94
96
|
)}
|
95
97
|
{!selectedSource && <SourceList sources={sources} onSourceSelect={onSourceSelect} />}
|
96
98
|
</div>
|
package/src/Plugin/Plugin.tsx
CHANGED
@@ -14,7 +14,11 @@ export type PluginRenderType = ResourceBrowserInputProps & {
|
|
14
14
|
};
|
15
15
|
export const PluginRender = ({ render, ...props }: PluginRenderType) => {
|
16
16
|
if (render) {
|
17
|
-
return
|
17
|
+
return (
|
18
|
+
<AuthProvider authConfig={props.source}>
|
19
|
+
<ResourceBrowserInput {...props} />
|
20
|
+
</AuthProvider>
|
21
|
+
);
|
18
22
|
} else {
|
19
23
|
return <></>;
|
20
24
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { render, screen, fireEvent } from '@testing-library/react';
|
3
3
|
import { AuthProvider, useAuthContext } from './AuthProvider';
|
4
|
-
import {AuthenticationConfiguration, ResourceBrowserSourceWithConfig} from '../types';
|
4
|
+
import { AuthenticationConfiguration, ResourceBrowserSourceWithConfig } from '../types';
|
5
5
|
import { useAuth } from '../Hooks/useAuth';
|
6
6
|
|
7
7
|
jest.mock('../Hooks/useAuth');
|
@@ -13,13 +13,13 @@ describe('AuthContext', () => {
|
|
13
13
|
authUrl: 'https://auth.example.com',
|
14
14
|
clientId: 'example-client-id',
|
15
15
|
redirectUrl: 'https://example.com/callback',
|
16
|
-
scope: 'offline'
|
16
|
+
scope: 'offline',
|
17
17
|
};
|
18
18
|
|
19
|
-
const sourceConfig: ResourceBrowserSourceWithConfig
|
19
|
+
const sourceConfig: ResourceBrowserSourceWithConfig = {
|
20
20
|
id: '1',
|
21
21
|
type: 'dam',
|
22
|
-
configuration: authConfig
|
22
|
+
configuration: authConfig,
|
23
23
|
};
|
24
24
|
|
25
25
|
const authState = {
|
@@ -49,7 +49,7 @@ describe('AuthContext', () => {
|
|
49
49
|
render(
|
50
50
|
<AuthProvider authConfig={sourceConfig}>
|
51
51
|
<TestComponent />
|
52
|
-
</AuthProvider
|
52
|
+
</AuthProvider>,
|
53
53
|
);
|
54
54
|
|
55
55
|
expect(screen.getByText(/Token: testAuthToken/)).toBeInTheDocument();
|
@@ -24,7 +24,7 @@ interface AuthProviderProps {
|
|
24
24
|
authConfig?: ResourceBrowserSource | null;
|
25
25
|
}
|
26
26
|
|
27
|
-
export const AuthProvider = (
|
27
|
+
export const AuthProvider = ({ children, authConfig }: AuthProviderProps) => {
|
28
28
|
const authConfiguration = authConfig as ResourceBrowserSourceWithConfig;
|
29
29
|
const auth = useAuth(authConfiguration?.configuration);
|
30
30
|
|
@@ -32,9 +32,5 @@ export const AuthProvider = ( {children, authConfig}: AuthProviderProps ) => {
|
|
32
32
|
return <>{children}</>;
|
33
33
|
}
|
34
34
|
|
35
|
-
return
|
36
|
-
<AuthContext.Provider value={auth}>
|
37
|
-
{children}
|
38
|
-
</AuthContext.Provider>
|
39
|
-
);
|
35
|
+
return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>;
|
40
36
|
};
|
@@ -21,7 +21,7 @@ export const createPlugins = (callbackWait: number, headerPortal = false): Resou
|
|
21
21
|
sourceBrowserComponent: () => {
|
22
22
|
return (props) => {
|
23
23
|
return (
|
24
|
-
<div className="h-screen lg:h-[calc(100vh-9rem)] w-screen max-w-[
|
24
|
+
<div className="h-screen lg:h-[calc(100vh-9rem)] w-screen max-w-[52rem]">
|
25
25
|
<div>THIS IS A {type} PLUGIN</div>
|
26
26
|
<button
|
27
27
|
onClick={() => {
|
package/src/index.scss
CHANGED
@@ -18,22 +18,6 @@ svg {
|
|
18
18
|
@apply text-gray-600;
|
19
19
|
}
|
20
20
|
|
21
|
-
.p-4\.5 {
|
22
|
-
padding: 18px;
|
23
|
-
}
|
24
|
-
|
25
|
-
.pl-4\.5 {
|
26
|
-
padding-left: 18px;
|
27
|
-
}
|
28
|
-
|
29
|
-
.pr-4\.5 {
|
30
|
-
padding-right: 18px;
|
31
|
-
}
|
32
|
-
|
33
|
-
.pb-4\.5 {
|
34
|
-
padding-bottom: 18px;
|
35
|
-
}
|
36
|
-
|
37
21
|
// In tailwind there is no break-word as it is deprecated, but break-words which is slightly different does not work here, so I have added the suggested combination here
|
38
22
|
// https://v1.tailwindcss.com/docs/word-break
|
39
23
|
// https://github.com/tailwindlabs/tailwindcss/discussions/2213
|
package/src/index.tsx
CHANGED
package/src/types.ts
CHANGED
@@ -7,7 +7,7 @@ global.fetch = jest.fn();
|
|
7
7
|
describe('auth-utils', () => {
|
8
8
|
beforeEach(() => {
|
9
9
|
// Clear all cookies before each test
|
10
|
-
document.cookie.split(';').forEach(cookie => {
|
10
|
+
document.cookie.split(';').forEach((cookie) => {
|
11
11
|
const eqPos = cookie.indexOf('=');
|
12
12
|
const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
|
13
13
|
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
|
@@ -47,7 +47,7 @@ describe('auth-utils', () => {
|
|
47
47
|
authUrl: 'https://auth.example.com',
|
48
48
|
clientId: 'example-client-id',
|
49
49
|
redirectUrl: 'https://example.com/callback',
|
50
|
-
scope: 'offline_access'
|
50
|
+
scope: 'offline_access',
|
51
51
|
};
|
52
52
|
|
53
53
|
it('should throw an error if authConfig is not provided', async () => {
|
package/tailwind.config.cjs
CHANGED