React New design changes for self service portal.#599
Conversation
| if (!isMyWorklistChecked) { | ||
| const pegaMap = SdkComponentMap?.getPegaProvidedComponentMap?.(); | ||
| const OOTBTodo = pegaMap?.['Todo']; | ||
| if (OOTBTodo) { | ||
| return <OOTBTodo {...props} />; | ||
| } | ||
| return null; | ||
| } |
There was a problem hiding this comment.
import OOTBTodo directly from '@pega/react-sdk-components'
| @@ -0,0 +1,23 @@ | |||
| import { createContext, useContext, useState, useRef, type ReactNode, type MutableRefObject } from 'react'; | |||
There was a problem hiding this comment.
check why it is needed
There was a problem hiding this comment.
React doesn't have a direct equivalent of Angular CDK's TemplatePortal + cdkPortalOutlet (where a template is defined in one component and physically projected into another component's render output).
The React-idiomatic way to achieve the same result is exactly what TodoPortalContext does — share data via Context, and let the consuming component render the UI. This is actually the standard React approach:
| @@ -1,2 +1,69 @@ | |||
| .mediaco { | |||
| // Action Buttons styles for MediaCo sample app - start | |||
There was a problem hiding this comment.
there is no import for this file anywhere
src/index.tsx
Outdated
| import TopLevelApp from '../src/samples/TopLevelApp'; | ||
| import './common.css'; | ||
|
|
||
| // Suppress "Uncaught runtime errors" overlay for non-fatal Axios errors from |
| width: '100%', | ||
| minHeight: '100%', | ||
| backgroundColor: '#fff', | ||
| display: 'flex', | ||
| flexDirection: 'column' |
There was a problem hiding this comment.
move these inline styles to classes
| const OOTBSelfServiceCaseView = SdkComponentMap.getPegaProvidedComponentMap().SelfServiceCaseView; | ||
| return <OOTBSelfServiceCaseView {...props} />; |
There was a problem hiding this comment.
same here, import from components repo directly
| // Delegate to OOTB MultiStep when not on the WSS portal | ||
| const isWssPortal = (PCore.getEnvironmentInfo() as any).environmentInfoObject?.pyPortalTemplate === 'wss'; | ||
| if (!isWssPortal) { | ||
| const OOTBMultiStep = SdkComponentMap.getPegaProvidedComponentMap().MultiStep; |
| const pegaMap = SdkComponentMap?.getPegaProvidedComponentMap?.(); | ||
| const OOTBListView = pegaMap?.['ListView']; | ||
| if (OOTBListView) { | ||
| return <OOTBListView {...props} />; | ||
| } | ||
| return null; |
src/samples/mediaco/utils/helpers.ts
Outdated
| @@ -0,0 +1,89 @@ | |||
| /** | |||
| * Utility to build the SDK static content URL for icon/image assets. | |||
| * Mirrors the Angular Utils.getSDKStaticContentUrl / getImageSrc pattern. | |||
src/samples/mediaco/utils/helpers.ts
Outdated
| } | ||
|
|
||
| /** | ||
| * Fetch work list data from a data page (mirrors Angular fetchMyWorkList). |
There was a problem hiding this comment.
Remove mirrors Angular fetchMyWorkList
src/common.css
Outdated
| border-color: #6750a4 !important; | ||
| } | ||
|
|
||
| /* ========== MediaCo WSS: Assignment-routed banner (matches Angular mat-card style) ========== */ |
There was a problem hiding this comment.
Remove matches Angular mat-card style
|
|
||
| /** | ||
| * Custom ActionButtons for WSS (MediaCo) portal. | ||
| * Styled to match the Angular SDK's Material 3 button look: |
| * Styled to match the Angular SDK's Material 3 button look: | ||
| * - Primary: filled pill buttons with purple background | ||
| * - Secondary: outlined pill buttons | ||
| * - Layout: left-aligned secondary, right-aligned primary (matching Angular's button-bar) |
There was a problem hiding this comment.
Remove matching Angular's button-bar
| @@ -0,0 +1,53 @@ | |||
| /** | |||
| * ListView-specific helpers — co-located with the ListView component. | |||
| * Mirrors Angular's list-view/listViewHelpers.ts + utils.ts pattern. | |||
There was a problem hiding this comment.
Remove Angular mention
| )} | ||
| </div> | ||
|
|
||
| {/* Main case view with flex layout (matching Angular SDK) */} |
There was a problem hiding this comment.
Remove matching Angular SDK
| const isWssPortal = (PCore.getEnvironmentInfo() as any).environmentInfoObject?.pyPortalTemplate === 'wss'; | ||
| if (!isWssPortal) { | ||
| const OOTBActionButtons = SdkComponentMap.getPegaProvidedComponentMap().ActionButtons; | ||
| return <OOTBActionButtons {...props} />; |
There was a problem hiding this comment.
Import from the components repo
| @@ -0,0 +1,113 @@ | |||
| import { type PropsWithChildren, useEffect, useState } from 'react'; | |||
| import OOTBAppShell from '@pega/react-sdk-components/lib/components/template/AppShell'; | |||
There was a problem hiding this comment.
make the OOTB to Appshell
| if (!isWssPortal) { | ||
| return <OOTBMultiStep {...(props as any)} />; | ||
| } |
| import { Avatar, Card, CardHeader, Divider, Typography, Button, Menu, MenuItem } from '@mui/material'; | ||
| import { useState, type MouseEvent } from 'react'; | ||
| import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map'; | ||
| import OOTBSelfServiceCaseView from '@pega/react-sdk-components/lib/components/template/SelfServiceCaseView'; | ||
| import { prepareCaseSummaryData, filterUtilities } from '@pega/react-sdk-components/lib/components/template/utils'; | ||
| import { Utils } from '@pega/react-sdk-components/lib/components/helpers/utils'; | ||
|
|
There was a problem hiding this comment.
update components repo
|
|
||
| // Fetch case types available to create | ||
| useEffect(() => { | ||
| const ei: any = PCore.getEnvironmentInfo(); |
There was a problem hiding this comment.
repurpose the variable
| <Box className='mc-footer-container'> | ||
| {/* Top Section */} | ||
| <Box className='mc-footer-top'> | ||
| {/* Column 1 - MediaCo */} |
| </List> | ||
| </Box> | ||
|
|
||
| {/* Column 3 - Support */} |
| </List> | ||
| </Box> | ||
|
|
||
| {/* Column 4 - Contact Us */} |
| @@ -0,0 +1,52 @@ | |||
| /** | |||
| * ListView-specific helpers — co-located with the ListView component. | |||
| * Maps activity types to icons (for Account History list). | ||
| */ | ||
| export const CASE_TYPE_TO_ACTIVITY_MAP: Record<string, string> = { | ||
| 'Plan Upgrade': 'Plan Upgrade', |
There was a problem hiding this comment.
Make all of them of uniform type.
| import { getActivityIcon, timeSince, CASE_TYPE_TO_ACTIVITY_MAP } from './helpers'; | ||
| import Carousel from '../carousel'; | ||
| import GalleryGrid from '../gallery-grid'; | ||
| import OOTBListView from '@pega/react-sdk-components/lib/components/template/ListView'; |
There was a problem hiding this comment.
Remove OOTB and move this above local imports
|
|
||
| // ── If NOT a custom MediaCo data page → delegate to OOTB ListView immediately ── | ||
| if (!isCustomDataPage) { | ||
| return <OOTBListView {...(props as any)} />; |
| const template = preset?.template || ''; | ||
|
|
||
| useEffect(() => { | ||
| const componentConfig: any = pConn.getComponentConfig(); |
| import Box from '@mui/material/Box'; | ||
| import Typography from '@mui/material/Typography'; | ||
| import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map'; | ||
| import OOTBMultiStep from '@pega/react-sdk-components/lib/components/infra/MultiStep'; |
| @@ -0,0 +1,190 @@ | |||
| import { Avatar, Card, CardHeader, Divider, Typography, Button, Menu, MenuItem } from '@mui/material'; | |||
| import { useState, type MouseEvent } from 'react'; | |||
There was a problem hiding this comment.
move this at the top
| @@ -0,0 +1,124 @@ | |||
| import { useEffect, useState, useCallback } from 'react'; | |||
| import OOTBTodo from '@pega/react-sdk-components/lib/components/widget/ToDo'; | |||
| @@ -1,11 +1,28 @@ | |||
| // Statically load all "MediaCo" components. | |||
| import './mediaCoStyles.scss'; | |||
…tep for case-sensitive rename)
… clean up unused code
React new design changes for the self service portal