@equinor/fusion-framework-cli
Advanced tools
Comparing version
@@ -7,2 +7,15 @@ import { useCallback } from 'react'; | ||
import { useFrameworkModule } from '@equinor/fusion-framework-react'; | ||
const generatePathname = (currentPathname, item, context, pathContextId) => { | ||
var _a, _b, _c, _d; | ||
if (pathContextId) { | ||
// context id exists in the url, replace it with the new context id | ||
const pathname = (_b = (_a = context === null || context === void 0 ? void 0 : context.generatePathFromContext) === null || _a === void 0 ? void 0 : _a.call(context, item, currentPathname)) !== null && _b !== void 0 ? _b : currentPathname.replace(pathContextId, item.id); | ||
console.debug(`🌍 Portal: context changed, navigating to app's context url:`, `found context id [${pathContextId}] in url, replacing with [${pathname}]`); | ||
return pathname; | ||
} | ||
// could not find context id in the url, set the path to the new context id | ||
const pathname = (_d = (_c = context === null || context === void 0 ? void 0 : context.generatePathFromContext) === null || _c === void 0 ? void 0 : _c.call(context, item, currentPathname)) !== null && _d !== void 0 ? _d : `/${item === null || item === void 0 ? void 0 : item.id}`; | ||
console.debug(`🌍 Portal: context changed, navigating to app's context url:`, `could not find context id in url, navigating to path [${pathname}]`); | ||
return pathname; | ||
}; | ||
/** | ||
@@ -26,3 +39,3 @@ * when current application changes, this hook will observe the application module instances. | ||
useCallback((item) => { | ||
var _a, _b, _c, _d; | ||
var _a, _b; | ||
// sanity check, if the item or navigation is undefined, early return | ||
@@ -52,16 +65,7 @@ if (item === undefined || navigation === undefined) { | ||
} | ||
// extract the context id from the current path | ||
const pathContextId = (_b = (_a = context === null || context === void 0 ? void 0 : context.extractContextIdFromPath) === null || _a === void 0 ? void 0 : _a.call(context, currentPathname)) !== null && _b !== void 0 ? _b : extractContextIdFromPath(currentPathname); | ||
// generate path to the selected context | ||
const pathname = pathContextId | ||
? item | ||
? // context id exists in the url, replace it with the new context id | ||
((_d = (_c = context === null || context === void 0 ? void 0 : context.generatePathFromContext) === null || _c === void 0 ? void 0 : _c.call(context, item, currentPathname)) !== null && _d !== void 0 ? _d : currentPathname.replace(pathContextId, item.id)) | ||
: // context was cleared, set the path to the root | ||
'/' | ||
: // could not find context id in the url, set the path to the new context id | ||
`/${item === null || item === void 0 ? void 0 : item.id}`; | ||
console.debug('🌍 Portal:', "context changed, navigating to app's context url:", pathContextId | ||
? `found context id [${pathContextId}] in url, ${item ? `replacing with [${item.id}]` : 'context was cleared, navigating to root'}` | ||
: `could not find context id in url, navigating to context id [${item ? item.id : 'root'}]`); | ||
if (item === undefined) { | ||
// no-op | ||
return; | ||
} | ||
const pathname = generatePathname(currentPathname, item, context, (_b = (_a = context === null || context === void 0 ? void 0 : context.extractContextIdFromPath) === null || _a === void 0 ? void 0 : _a.call(context, currentPathname)) !== null && _b !== void 0 ? _b : extractContextIdFromPath(currentPathname)); | ||
// if app has its own navigation, use it to navigate | ||
@@ -81,4 +85,5 @@ if (appNavigation) { | ||
appNavigation, | ||
context, | ||
])); | ||
}; | ||
//# sourceMappingURL=useAppContextNavigation.js.map |
@@ -1,1 +0,1 @@ | ||
export declare const version = "10.6.1"; | ||
export declare const version = "10.7.0"; |
// Generated by genversion. | ||
export const version = '10.6.1'; | ||
export const version = '10.7.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@equinor/fusion-framework-cli", | ||
"version": "10.7.0-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"version": "10.7.0", | ||
"keywords": [ | ||
@@ -67,3 +67,3 @@ "Fusion", | ||
"@equinor/fusion-react-progress-indicator": "^0.3.0", | ||
"@equinor/fusion-react-side-sheet": "1.3.6", | ||
"@equinor/fusion-react-side-sheet": "1.3.7", | ||
"@equinor/fusion-react-styles": "^0.6.4", | ||
@@ -88,17 +88,17 @@ "@equinor/fusion-wc-chip": "^1.2.2", | ||
"typescript": "^5.8.2", | ||
"@equinor/fusion-framework": "^7.3.4-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-module-app": "^6.1.9-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-app": "^9.3.6-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-module-bookmark": "^2.1.4-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-module-context": "^5.1.0-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-module-feature-flag": "^1.1.15-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-module-msal": "^4.0.3-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-module-navigation": "^4.0.10-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-module-services": "^5.1.3-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-react": "^7.4.4-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-react-components-bookmark": "^1.0.12-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-react-components-people-provider": "^1.5.8-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-observable": "^8.4.7-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-framework-react-module-bookmark": "^3.0.4-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68", | ||
"@equinor/fusion-query": "^5.2.4-beta-AH-test-778ecddcafac619d1bdc9be4a2c50f2f8c15cc68" | ||
"@equinor/fusion-framework": "^7.3.4", | ||
"@equinor/fusion-framework-app": "^9.3.6", | ||
"@equinor/fusion-framework-module-app": "^6.1.8", | ||
"@equinor/fusion-framework-module-context": "^5.1.0", | ||
"@equinor/fusion-framework-module-feature-flag": "^1.1.14", | ||
"@equinor/fusion-framework-module-bookmark": "^2.1.3", | ||
"@equinor/fusion-framework-module-services": "^5.1.2", | ||
"@equinor/fusion-framework-module-navigation": "^4.0.9", | ||
"@equinor/fusion-framework-module-msal": "^4.0.2", | ||
"@equinor/fusion-framework-react": "^7.4.4", | ||
"@equinor/fusion-framework-react-components-bookmark": "^1.0.12", | ||
"@equinor/fusion-framework-react-components-people-provider": "^1.5.8", | ||
"@equinor/fusion-observable": "^8.4.6", | ||
"@equinor/fusion-query": "^5.2.3", | ||
"@equinor/fusion-framework-react-module-bookmark": "^3.0.4" | ||
}, | ||
@@ -105,0 +105,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
14712
0.05%1
-50%2390228
-0.02%