|
| 1 | +// eslint-disable-next-line import/prefer-default-export |
1 | 2 | export const isContainerInitialized = (pConnect) => { |
2 | 3 | const context = pConnect.getContextName(); |
3 | 4 | const containerName = pConnect.getContainerName(); |
4 | 5 | return PCore.getContainerUtils().isContainerInitialized(context, containerName); |
5 | 6 | }; |
| 7 | + |
| 8 | +export const configureBrowserBookmark = (pConnect) => { |
| 9 | + const context = pConnect.getContextName(); |
| 10 | + const containerName = pConnect.getContainerName(); |
| 11 | + const envInfo = PCore.getEnvironmentInfo(); |
| 12 | + const { APP } = PCore.getConstants(); |
| 13 | + |
| 14 | + const navPages = pConnect.getValue('pyPortal.pyPrimaryNavPages'); |
| 15 | + let ruleName = ''; |
| 16 | + let className = ''; |
| 17 | + let defaultViewLabel = ''; |
| 18 | + |
| 19 | + const isNextGenLandingPageRouting = (envInfo?.environmentInfoObject as any)?.pyExecutionRuntimeName === (APP as any).INFINITY_RUNTIME; |
| 20 | + |
| 21 | + if (Array.isArray(navPages) && navPages.length > 0) { |
| 22 | + const firstNavPage = navPages[0]; |
| 23 | + const nestedNavPage = firstNavPage.NavigationPages?.[0]; |
| 24 | + |
| 25 | + if (isNextGenLandingPageRouting) { |
| 26 | + if (nestedNavPage?.pyRuleName) { |
| 27 | + ruleName = nestedNavPage.pyRuleName; |
| 28 | + className = nestedNavPage.pyClassName || ''; |
| 29 | + } else if (firstNavPage?.pyRuleName) { |
| 30 | + ruleName = firstNavPage.pyRuleName; |
| 31 | + className = firstNavPage.pyClassName || ''; |
| 32 | + } else if (nestedNavPage?.pyLabel) { |
| 33 | + defaultViewLabel = nestedNavPage.pyLabel; |
| 34 | + } else if (firstNavPage?.pyLabel) { |
| 35 | + defaultViewLabel = firstNavPage.pyLabel; |
| 36 | + } |
| 37 | + } else if (nestedNavPage?.pyLabel) { |
| 38 | + defaultViewLabel = nestedNavPage.pyLabel; |
| 39 | + } else if (firstNavPage?.pyLabel) { |
| 40 | + defaultViewLabel = firstNavPage.pyLabel; |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + PCore.configureForBrowserBookmark({ |
| 45 | + context, |
| 46 | + containerName, |
| 47 | + acName: containerName, |
| 48 | + semanticURL: '', |
| 49 | + defaultViewLabel, |
| 50 | + ruleName, |
| 51 | + className |
| 52 | + }); |
| 53 | +}; |
0 commit comments