File

libs/sdk/src/lib/journey/config/migrations/small-print-config/small-print-config.ts

Extends

Omit<PageJsonSchema, 'smallPrint'>

Index

Properties

Properties

smallPrint (Optional)
Type string[]
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.

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 { PageJsonSchema, PagesJsonSchema } from '../../../../model';
import { copyComments } from '../shared/jsonc-comments';
import { cloneDeepWithJsonComments } from '../shared/utils';

export interface PageJsonSchemaBeforeSmallPrintMigration
  extends Omit<PageJsonSchema, 'smallPrint'> {
  smallPrint?: string[];
}

export function migrateSmallPrintConfigurationPagesJson(pagesConfiguration: PagesJsonSchema) {
  if (!pagesConfiguration.pages) {
    return pagesConfiguration;
  }
  const migratedPageConfigurations = pagesConfiguration.pages.map((pageConfig) =>
    migratePageSmallPrintConfig(pageConfig as PageJsonSchemaBeforeSmallPrintMigration)
  );

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

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

  return migratedPagesConfiguration as PagesJsonSchema;
}

export function migratePageSmallPrintConfig(
  pageConfiguration: PageJsonSchemaBeforeSmallPrintMigration
) {
  const smallPrint = pageConfiguration?.smallPrint;

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

  const pageConfigurationWithJsonComments = cloneDeepWithJsonComments(pageConfiguration);

  let migratedPageConfiguration: PageJsonSchema = {
    ...pageConfigurationWithJsonComments,
    smallPrint: {
      items: pageConfigurationWithJsonComments.smallPrint as string[]
    }
  };

  migratedPageConfiguration = copyComments(
    migratedPageConfiguration,
    pageConfigurationWithJsonComments
  );

  return migratedPageConfiguration;
}

results matching ""

    No results matching ""