diff --git a/config/webpack.cy.config.js b/config/webpack.cy.config.js index 925f40f3e..ae06b45c5 100644 --- a/config/webpack.cy.config.js +++ b/config/webpack.cy.config.js @@ -108,8 +108,10 @@ const JSConfig = { { 'react-dom': { singleton: true, eager: true } }, { 'react-router-dom': { singleton: true } }, { 'react-redux': {} }, + { '@openshift/dynamic-plugin-sdk': { singleton: true } }, { '@patternfly/react-core': {} }, { '@patternfly/quickstarts': { singleton: true } }, + { '@scalprum/core': { singleton: true } }, { '@scalprum/react-core': { singleton: true } }, { '@unleash/proxy-client-react': { singleton: true } }, ], diff --git a/cypress/component/GatewayErrors.cy.tsx b/cypress/component/GatewayErrors.cy.tsx index 0d78777fc..cd59a2831 100644 --- a/cypress/component/GatewayErrors.cy.tsx +++ b/cypress/component/GatewayErrors.cy.tsx @@ -1,101 +1,59 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { IntlProvider } from 'react-intl'; import { MemoryRouter } from 'react-router-dom'; -import { Provider } from 'react-redux'; +import { Provider, useSelector } from 'react-redux'; import { applyMiddleware, combineReducers, createStore } from 'redux'; import logger from 'redux-logger'; -import { AppMetadata, removeScalprum } from '@scalprum/core'; +import { removeScalprum } from '@scalprum/core'; import type { AuthContextProps } from 'react-oidc-context'; +import { ChromeUser } from '@redhat-cloud-services/types'; +import { useSetAtom } from 'jotai'; -import ScalprumRoot from '../../src/components/RootApp/ScalprumRoot'; import chromeReducer from '../../src/redux'; -import { FeatureFlagsProvider } from '../../src/components/FeatureFlags'; -import { loadModulesSchema, userLogIn } from '../../src/redux/actions'; +import { userLogIn } from '../../src/redux/actions'; import qe from '../../src/utils/iqeEnablement'; import { COMPLIACE_ERROR_CODES } from '../../src/utils/responseInterceptors'; import testUserJson from '../fixtures/testUser.json'; -import { ChromeUser } from '@redhat-cloud-services/types'; -import { RemoteModule } from '../../src/@types/types'; import { BLOCK_CLEAR_GATEWAY_ERROR } from '../../src/utils/common'; import { initializeVisibilityFunctions } from '../../src/utils/VisibilitySingleton'; -import ChromeAuthContext, { ChromeAuthContextValue } from '../../src/auth/ChromeAuthContext'; +import { ReduxState } from '../../src/redux/store'; +import GatewayErrorComponent from '../../src/components/ErrorComponents/GatewayErrorComponent'; +import { activeModuleAtom } from '../../src/state/atoms/activeModuleAtom'; const testUser: ChromeUser = testUserJson as unknown as ChromeUser; -const chromeUser: ChromeUser = testUser as unknown as ChromeUser; +const ErrorCatcher = ({ children }: { children: React.ReactNode }) => { + const gatewayError = useSelector(({ chrome: { gatewayError } }: ReduxState) => gatewayError); + + if (gatewayError) { + return ; + } -const chromeAuthContextValue: ChromeAuthContextValue = { - doOffline: () => Promise.resolve(), - getOfflineToken: () => Promise.resolve({} as any), - getToken: () => Promise.resolve(''), - getUser: () => Promise.resolve(chromeUser), - login: () => Promise.resolve(), - loginAllTabs: () => Promise.resolve(), - logout: () => Promise.resolve(), - logoutAllTabs: () => Promise.resolve(), - ready: true, - token: '', - tokenExpires: 0, - user: chromeUser, + return <>{children}; }; -function createEnv(code?: string) { - if (!code) { - throw 'Enviroment must have identifier'; - } +function createEnv(code: string, childNode: React.ReactNode) { const reduxStore = createStore(combineReducers(chromeReducer()), applyMiddleware(logger)); // initialize user object for feature flags reduxStore.dispatch(userLogIn(testUser)); // initializes request interceptors qe.init(reduxStore, { current: { user: { access_token: 'foo' } } as unknown as AuthContextProps }); - reduxStore.dispatch( - loadModulesSchema({ - [code]: { - manifestLocation: `/apps/${code}/fed-mods.json`, - modules: [ - { - id: code, - module: './RootApp', - routes: [`/${code}`], - } as RemoteModule, - ], - }, - }) - ); - const Component = () => ( - + const Component = () => { + const setActiveModule = useSetAtom(activeModuleAtom); + useEffect(() => { + setActiveModule(code); + }, []); + return ( - + - - undefined, - disableTopics: () => undefined, - enableTopics: () => Promise.resolve([]), - }} - quickstartsAPI={{ - Catalog: () => null, - set: () => undefined, - toggle: () => undefined, - updateQuickStarts: () => undefined, - version: 1, - }} - config={{ - [code]: { - manifestLocation: `/apps/${code}/fed-mods.json`, - name: code, - module: `${code}#./RootApp`, - } as AppMetadata, - }} - /> - + {childNode} - + - - ); + ); + }; return Component; } @@ -126,15 +84,13 @@ describe('Gateway errors', () => { it('handles 403 3scale gateway error', () => { const code = 'gateway-403'; - const Component = createEnv(code); - cy.window().then((win) => { - win[code] = { - init: () => undefined, - get: () => () => ({ - default: () =>
{code}
, - }), - }; - }); + const TestComponent = () => { + useEffect(() => { + fetch(`/apps/${code}/fed-mods.json`); + }); + return null; + }; + const Component = createEnv(code, ); // throw 403 gateway error cy.intercept('GET', `/apps/${code}/fed-mods.json`, { statusCode: 403, @@ -161,30 +117,13 @@ describe('Gateway errors', () => { COMPLIACE_ERROR_CODES.forEach((code, index) => { it(`handles compliance ${code} gateway error`, () => { const moduleName = `module${index}`; - removeScalprum(); - window[moduleName] = { - init: () => undefined, - get: () => () => ({ - // eslint-disable-next-line react/display-name - default: () => { - return ( -
- -
- ); - }, - }), + const TestComponent = () => { + useEffect(() => { + fetch(`/${code}/bar`); + }, []); + return null; }; - const Component = createEnv(moduleName); - cy.intercept(`/apps/${code}/bar.js*`, {}); - cy.intercept('GET', `/apps/${moduleName}/fed-mods.json`, { - statusCode: 200, - body: { - [moduleName]: { - entry: [`/apps/${code}/bar.js`], - }, - }, - }).as(`${code}-string`); + const Component = createEnv(moduleName, ); cy.intercept('GET', `/${code}/bar`, { statusCode: 403, @@ -205,9 +144,6 @@ describe('Gateway errors', () => { }).as(`${code}-call`); cy.mount(); - - cy.wait(`@${code}-string`); - cy.contains('Force API call').click(); cy.wait(`@${code}-call`); cy.contains(code).should('exist'); cy.contains(`Gateway has thrown ${code} compliance error`).should('exist'); @@ -217,34 +153,13 @@ describe('Gateway errors', () => { COMPLIACE_ERROR_CODES.forEach((code, index) => { it(`handles compliance ${code} string error`, () => { const moduleName = `module${index}`; - removeScalprum(); - window[moduleName] = { - init: () => undefined, - get: () => () => ({ - // eslint-disable-next-line react/display-name - default: () => { - return ( -
- -
- ); - }, - }), + const TestComponent = () => { + useEffect(() => { + fetch(`/${code}/bar`); + }, []); + return null; }; - cy.on('uncaught:exception', () => { - // runtime exception is expected - return false; - }); - const Component = createEnv(moduleName); - cy.intercept(`/apps/${code}/bar.js*`, {}); - cy.intercept('GET', `/apps/${moduleName}/fed-mods.json`, { - statusCode: 200, - body: { - [moduleName]: { - entry: [`/apps/${code}/bar.js`], - }, - }, - }).as(`${code}-string`); + const Component = createEnv(moduleName, ); cy.intercept('GET', `/${code}/bar`, { statusCode: 403, @@ -256,8 +171,6 @@ describe('Gateway errors', () => { cy.mount(); - cy.wait(`@${code}-string`); - cy.contains('Force API call').click(); cy.wait(`@${code}-call`); cy.contains(code).should('exist'); cy.contains(`Gateway has thrown ${code} compliance error`).should('exist'); @@ -266,34 +179,20 @@ describe('Gateway errors', () => { it('should render component if a 403 error does not originate from gateway', () => { const code = 'not-gateway-403'; - // make sure to mock the JS modle asset - cy.intercept('/apps/foo/bar.js*', {}); - const Component = createEnv(code); - // mock the module - window[code] = { - init: () => undefined, - get: () => () => ({ - // eslint-disable-next-line react/display-name - default: () => { - const [err, setErr] = useState(false); - return ( -
- {err ?

Component error handler

:

Normal render

} - -
- ); - }, - }), + const TestComponent = () => { + const [err, setErr] = useState(false); + + return ( +
+ {err ?

Component error handler

:

Normal render

} + +
+ ); }; - cy.intercept('GET', `/apps/${code}/fed-mods.json`, { - statusCode: 200, - body: { - [code]: { - entry: ['/apps/foo/bar.js'], - }, - }, - }).as(code); + + const Component = createEnv(code, ); + // throw 403 gateway error cy.intercept('GET', `/foo/bar`, { statusCode: 403, @@ -301,7 +200,7 @@ describe('Gateway errors', () => { errors: [ { status: 403, - detail: 'Aome API error', + detail: 'Some API error', }, ], }, @@ -319,41 +218,22 @@ describe('Gateway errors', () => { it('does not handle 404 3scale gateway error', () => { const code = 'gateway-404'; - cy.intercept('/apps/foo/bar.js*', {}); - const Component = createEnv(code); - - // mock the module - window[code] = { - init: () => undefined, - get: () => () => ({ - // eslint-disable-next-line react/display-name - default: () => { - const [err, setErr] = useState(false); - - return ( -
- {err ?

Component error handler

:

Normal render

} - -
- ); - }, - }), + const TestComponent = () => { + const [err, setErr] = useState(false); + + return ( +
+ {err ?

Component error handler

:

Normal render

} + +
+ ); }; - // throw 403 gateway error - cy.intercept('GET', `/apps/${code}/fed-mods.json`, { - statusCode: 200, - body: { - [code]: { - entry: ['/apps/foo/bar.js'], - }, - }, - }).as(code); + const Component = createEnv(code, ); cy.mount(); cy.contains(`Normal render`).should('exist'); cy.contains(`Component error handler`).should('not.exist'); cy.contains('Force API call').click(); - cy.wait(`@${code}`); cy.contains(`Normal render`).should('not.exist'); cy.contains(`Component error handler`).should('exist'); diff --git a/package-lock.json b/package-lock.json index 32b732b21..12491bfa4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,23 +13,23 @@ "@data-driven-forms/pf4-component-mapper": "^3.22.1", "@data-driven-forms/react-form-renderer": "^3.22.1", "@formatjs/cli": "4.8.4", - "@openshift/dynamic-plugin-sdk": "^4.0.0", + "@openshift/dynamic-plugin-sdk": "^5.0.1", "@patternfly/patternfly": "^5.1.0", "@patternfly/quickstarts": "^5.1.0", "@patternfly/react-charts": "^7.1.2", "@patternfly/react-core": "^5.1.2", "@patternfly/react-icons": "^5.1.2", "@patternfly/react-tokens": "^5.1.2", - "@redhat-cloud-services/chrome": "^1.0.5", + "@redhat-cloud-services/chrome": "^1.0.6", "@redhat-cloud-services/entitlements-client": "1.2.0", - "@redhat-cloud-services/frontend-components": "^4.2.1", + "@redhat-cloud-services/frontend-components": "^4.2.2", "@redhat-cloud-services/frontend-components-notifications": "^4.1.0", "@redhat-cloud-services/frontend-components-pdf-generator": "4.0.4", "@redhat-cloud-services/frontend-components-utilities": "^4.0.2", "@redhat-cloud-services/host-inventory-client": "1.2.0", "@redhat-cloud-services/rbac-client": "1.2.0", - "@scalprum/core": "^0.6.5", - "@scalprum/react-core": "^0.6.5", + "@scalprum/core": "^0.7.0", + "@scalprum/react-core": "^0.7.0", "@segment/analytics-next": "^1.62.0", "@sentry/react": "^7.91.0", "@sentry/tracing": "^7.91.0", @@ -4097,9 +4097,9 @@ } }, "node_modules/@openshift/dynamic-plugin-sdk": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk/-/dynamic-plugin-sdk-4.0.0.tgz", - "integrity": "sha512-OQsRqpRFz8IO6dZP6oKqdS7fLpdK25jxteevhussWFDd6RETNaLAG9GaSfvN0oigrzNIUTwH59kJx8PP8PrMug==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk/-/dynamic-plugin-sdk-5.0.1.tgz", + "integrity": "sha512-+azUBN6FgcDmlcWMzG0bthcRUJC1u12wf9xa2aJGFbC/uTiOXwjrkcQ7LW/PyK5Em7wDhwaUdapaeOgh8I6Kjg==", "dependencies": { "lodash": "^4.17.21", "semver": "^7.3.7", @@ -4433,14 +4433,14 @@ } }, "node_modules/@redhat-cloud-services/chrome": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@redhat-cloud-services/chrome/-/chrome-1.0.5.tgz", - "integrity": "sha512-WxGE9OoFH6ekuhdR3BGmqFqoCCrx85pftJqJDJYbrFAdJlgJADOpqt5rykRvhGE+VXDWB0oBo1SDiAzNQDsI3A==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@redhat-cloud-services/chrome/-/chrome-1.0.6.tgz", + "integrity": "sha512-pYcN1zOk5U7kNhb5eSu04s07DFxyRHIKedsLk2emRygYMi3ZbHp1bqwf7dtOgSl1P2s3VcScSc1NTIz+JXd3Eg==", "dependencies": { "lodash": "^4.17.21" }, "peerDependencies": { - "@scalprum/react-core": "^0.6.5", + "@scalprum/react-core": "^0.7.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.0.0" @@ -4473,15 +4473,15 @@ } }, "node_modules/@redhat-cloud-services/frontend-components": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@redhat-cloud-services/frontend-components/-/frontend-components-4.2.1.tgz", - "integrity": "sha512-XLaCaG+wfu6dSiLMt+tlj6kVn6WVaJgsPV3rXEdg4afFPmjaA55OBm2AxrjpfXNj+YOgRVvXPKI8/FPbPMOOYA==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@redhat-cloud-services/frontend-components/-/frontend-components-4.2.2.tgz", + "integrity": "sha512-mXaxcWQR/8fsFPkXX1jVSQsa8grXy69v7hRU8OGXd4Xr14oXB37IzGyxeF7H7FT+fK9GAGkh0JWYpIlkyYWWFw==", "dependencies": { "@patternfly/react-component-groups": "^5.0.0-prerelease.7", "@redhat-cloud-services/frontend-components-utilities": "^4.0.0", "@redhat-cloud-services/types": "^0.0.24", - "@scalprum/core": "^0.6.5", - "@scalprum/react-core": "^0.6.5", + "@scalprum/core": "^0.7.0", + "@scalprum/react-core": "^0.7.0", "sanitize-html": "^2.7.2" }, "peerDependencies": { @@ -4703,6 +4703,74 @@ "react": "^16.0.0 || ^17.0.0" } }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/@scalprum/core": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/@scalprum/core/-/core-0.6.6.tgz", + "integrity": "sha512-Paj2Ok50LD7oTKK5av5xgaB3mZyAzHthlhlTv2rPXnMGaAhY3VryOYQttzUMIfojm+EByrKp30hdZ+WbTW70oQ==", + "dependencies": { + "@openshift/dynamic-plugin-sdk": "^4.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/@scalprum/core/node_modules/@openshift/dynamic-plugin-sdk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk/-/dynamic-plugin-sdk-4.0.0.tgz", + "integrity": "sha512-OQsRqpRFz8IO6dZP6oKqdS7fLpdK25jxteevhussWFDd6RETNaLAG9GaSfvN0oigrzNIUTwH59kJx8PP8PrMug==", + "dependencies": { + "lodash": "^4.17.21", + "semver": "^7.3.7", + "uuid": "^8.3.2", + "yup": "^0.32.11" + }, + "peerDependencies": { + "react": "^17 || ^18" + } + }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/@scalprum/core/node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/@scalprum/core/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/@scalprum/react-core": { + "version": "0.6.7", + "resolved": "https://registry.npmjs.org/@scalprum/react-core/-/react-core-0.6.7.tgz", + "integrity": "sha512-3LZyG8ts+skEKxytpEyNEAc6Oh9zV9UIhNse6HEk4fvgZXfgC1xaw913UrBNFosaieFTgICBGc+Tp9mhjRNwSw==", + "dependencies": { + "@openshift/dynamic-plugin-sdk": "^4.0.0", + "@scalprum/core": "^0.6.5", + "lodash": "^4.17.0" + }, + "peerDependencies": { + "react": ">=16.8.0 || >=17.0.0 || ^18.0.0", + "react-dom": ">=16.8.0 || >=17.0.0 || ^18.0.0" + } + }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/@scalprum/react-core/node_modules/@openshift/dynamic-plugin-sdk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk/-/dynamic-plugin-sdk-4.0.0.tgz", + "integrity": "sha512-OQsRqpRFz8IO6dZP6oKqdS7fLpdK25jxteevhussWFDd6RETNaLAG9GaSfvN0oigrzNIUTwH59kJx8PP8PrMug==", + "dependencies": { + "lodash": "^4.17.21", + "semver": "^7.3.7", + "uuid": "^8.3.2", + "yup": "^0.32.11" + }, + "peerDependencies": { + "react": "^17 || ^18" + } + }, "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/d3-array": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz", @@ -4784,6 +4852,17 @@ "delaunator": "^4.0.0" } }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/react": { "version": "16.12.0", "resolved": "https://registry.npmjs.org/react/-/react-16.12.0.tgz", @@ -4850,6 +4929,20 @@ "object-assign": "^4.1.1" } }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -5081,6 +5174,11 @@ "victory-core": "^34.3.12" } }, + "node_modules/@redhat-cloud-services/frontend-components-pdf-generator/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/@redhat-cloud-services/frontend-components-utilities": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@redhat-cloud-services/frontend-components-utilities/-/frontend-components-utilities-4.0.2.tgz", @@ -5151,21 +5249,21 @@ } }, "node_modules/@scalprum/core": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@scalprum/core/-/core-0.6.5.tgz", - "integrity": "sha512-Q9xQKmcmqKyzDev4hKyJ7Emu3uqI8rWbwezC47dffcafDLn5F9ZOTS+cNpRJcvt0Yulcb11xYDj4tBDk49B7aA==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@scalprum/core/-/core-0.7.0.tgz", + "integrity": "sha512-zvrPXexI+bxHGFY/teuwPI5yjnOuiq8uT+RDsrm3gnpr1AqZQVUiGdskl1ON/ci5lSs1kNadmXceF1BTKlicwg==", "dependencies": { - "@openshift/dynamic-plugin-sdk": "^4.0.0", + "@openshift/dynamic-plugin-sdk": "^5.0.1", "tslib": "^2.6.2" } }, "node_modules/@scalprum/react-core": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@scalprum/react-core/-/react-core-0.6.5.tgz", - "integrity": "sha512-ntBRJHbVFthHIxjlRYDnnqlvXXomf+QInwtCLLv2VQYRC4SOeGW6egr9jsoxImIhEBQ7BF4xnzdkqy1nAlOuvw==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@scalprum/react-core/-/react-core-0.7.0.tgz", + "integrity": "sha512-vi1THIHlm8VezAvOhPrDyyP4qDoRITQgpbwAyAXvak0ZbUilc4Pk0y8IoZ2qh0ymh1C7GGxGy5CEBjsX9bY0/g==", "dependencies": { - "@openshift/dynamic-plugin-sdk": "^4.0.0", - "@scalprum/core": "^0.6.5", + "@openshift/dynamic-plugin-sdk": "^5.0.1", + "@scalprum/core": "^0.6.6", "lodash": "^4.17.0" }, "peerDependencies": { @@ -5173,6 +5271,59 @@ "react-dom": ">=16.8.0 || >=17.0.0 || ^18.0.0" } }, + "node_modules/@scalprum/react-core/node_modules/@scalprum/core": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/@scalprum/core/-/core-0.6.6.tgz", + "integrity": "sha512-Paj2Ok50LD7oTKK5av5xgaB3mZyAzHthlhlTv2rPXnMGaAhY3VryOYQttzUMIfojm+EByrKp30hdZ+WbTW70oQ==", + "dependencies": { + "@openshift/dynamic-plugin-sdk": "^4.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@scalprum/react-core/node_modules/@scalprum/core/node_modules/@openshift/dynamic-plugin-sdk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@openshift/dynamic-plugin-sdk/-/dynamic-plugin-sdk-4.0.0.tgz", + "integrity": "sha512-OQsRqpRFz8IO6dZP6oKqdS7fLpdK25jxteevhussWFDd6RETNaLAG9GaSfvN0oigrzNIUTwH59kJx8PP8PrMug==", + "dependencies": { + "lodash": "^4.17.21", + "semver": "^7.3.7", + "uuid": "^8.3.2", + "yup": "^0.32.11" + }, + "peerDependencies": { + "react": "^17 || ^18" + } + }, + "node_modules/@scalprum/react-core/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@scalprum/react-core/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@scalprum/react-core/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/@segment/analytics-core": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@segment/analytics-core/-/analytics-core-1.4.0.tgz", diff --git a/package.json b/package.json index 3ad5b0d65..69daf06a7 100644 --- a/package.json +++ b/package.json @@ -131,23 +131,23 @@ "@data-driven-forms/pf4-component-mapper": "^3.22.1", "@data-driven-forms/react-form-renderer": "^3.22.1", "@formatjs/cli": "4.8.4", - "@openshift/dynamic-plugin-sdk": "^4.0.0", + "@openshift/dynamic-plugin-sdk": "^5.0.1", "@patternfly/patternfly": "^5.1.0", "@patternfly/quickstarts": "^5.1.0", "@patternfly/react-charts": "^7.1.2", "@patternfly/react-core": "^5.1.2", "@patternfly/react-icons": "^5.1.2", "@patternfly/react-tokens": "^5.1.2", - "@redhat-cloud-services/chrome": "^1.0.5", + "@redhat-cloud-services/chrome": "^1.0.6", "@redhat-cloud-services/entitlements-client": "1.2.0", - "@redhat-cloud-services/frontend-components": "^4.2.1", + "@redhat-cloud-services/frontend-components": "^4.2.2", "@redhat-cloud-services/frontend-components-notifications": "^4.1.0", "@redhat-cloud-services/frontend-components-pdf-generator": "4.0.4", "@redhat-cloud-services/frontend-components-utilities": "^4.0.2", "@redhat-cloud-services/host-inventory-client": "1.2.0", "@redhat-cloud-services/rbac-client": "1.2.0", - "@scalprum/core": "^0.6.5", - "@scalprum/react-core": "^0.6.5", + "@scalprum/core": "^0.7.0", + "@scalprum/react-core": "^0.7.0", "@segment/analytics-next": "^1.62.0", "@sentry/react": "^7.91.0", "@sentry/tracing": "^7.91.0", diff --git a/src/components/RootApp/ScalprumRoot.tsx b/src/components/RootApp/ScalprumRoot.tsx index 4a1a5a2c9..352489a5e 100644 --- a/src/components/RootApp/ScalprumRoot.tsx +++ b/src/components/RootApp/ScalprumRoot.tsx @@ -168,7 +168,7 @@ const ScalprumRoot = memo( pluginSDKOptions: { pluginLoaderOptions: { // sharedScope: scope, - postProcessManifest: (manifest) => { + transformPluginManifest: (manifest) => { if (manifest.name === 'chrome') { return { ...manifest,