File

libs/sdk/src/lib/journey/config/migrations/notification-config/notification-config.ts

Extends

PageJsonSchema

Index

Properties

Properties

notifications (Optional)
Type NotificationConfig[]
blocks (Optional)
Type (BuildingBlockConfiguration | DynamicFormBBConfiguration)[]
Default value []
Description

Provide a list of configurations for Building Blocks. This is required for generation to determine which Building Block needs to be output. This configuration is used during runtime too. []

bannerBlock (Optional)
Type BannerBlockConfiguration
Description

A Building Block that will be shown in the top area of the page and will stick to the top of the window

id
Type string
Description

The page id is used to determine the filename of the generated page. The page Id must also match the page id in the PFE configuration otherwise the setup during runtime will fail.

Example :
notificationsGroup (Optional)
Type { columnSpan?: "4" | "6" | "8" | "10" | "12"; items: NotificationConfig[] }
Description

Configuration for overarching notifications

overarchingDetailsBlock (Optional)
Type OverarchingDetailsBlockConfiguration
Description

A configuration of the Building Block that will be displayed as overarching details above the page content area.

pageData (Optional)
Type PageData
panels (Optional)
Type PanelDefinition[]
Description

List of available panels to group other content into.

sections (Optional)
Type PageSectionDefinition[]
Default value []
Description

List of available sections to group other content into. []

sidebar (Optional)
Type SidebarConfiguration
Description

Sidebar configuration for the page.

smallPrint (Optional)
Type SmallPrintDefinition
title (Optional)
Type PageTitle
Description

The page title can either be specified as a string or as an object to configure it in more detail (e.g. placing it within a stage).

Example :
import { copyComments } from '../shared/jsonc-comments';
import { PageJsonSchema, PagesJsonSchema } from '../../../../model';
import { cloneDeepWithJsonComments } from '../shared/utils';
import { NotificationConfig } from '@allianz/taly-core/schemas';

export interface PageJsonSchemaBeforeNotificationMigration extends PageJsonSchema {
  notifications?: NotificationConfig[];
}

export function migrateNotificationConfigurationPagesJson(pagesConfiguration: PagesJsonSchema) {
  if (!pagesConfiguration.pages) {
    return pagesConfiguration;
  }
  const migratedPageConfigurations = pagesConfiguration.pages.map((pageConfig) =>
    migratePageNotificationConfig(pageConfig)
  );

  const migratedPagesConfiguration = cloneDeepWithJsonComments(pagesConfiguration);
  migratedPagesConfiguration.pages = migratedPageConfigurations;

  migratedPagesConfiguration.pages = copyComments(
    migratedPagesConfiguration.pages,
    pagesConfiguration.pages
  );

  return migratedPagesConfiguration as PagesJsonSchema;
}

export function migratePageNotificationConfig(
  pageConfiguration: PageJsonSchemaBeforeNotificationMigration
) {
  const notifications = pageConfiguration?.notifications;

  if (notifications === undefined) {
    return pageConfiguration as PageJsonSchema;
  }

  const migratedPageConfiguration = cloneDeepWithJsonComments(pageConfiguration);

  migratedPageConfiguration.notificationsGroup = { items: notifications };

  migratedPageConfiguration.notificationsGroup = copyComments(
    migratedPageConfiguration.notificationsGroup,
    pageConfiguration,
    new Map([['items', 'notifications']])
  );

  delete migratedPageConfiguration.notifications;
  return migratedPageConfiguration as PageJsonSchema;
}

results matching ""

    No results matching ""