File

libs/core/src/lib/services/taly-page-data.model.ts

Index

Properties

Properties

navigation (Optional)
Type Navigation
pageActionConfig (Optional)
Type PageActionConfig
import {
  type BusinessEventAction,
  type BusinessEventServiceActivator
} from './taly-business-event.model';

export interface PageDataForTemplate extends PageData {
  stage?: Stage;
}

/**
 * @additionalProperties false
 */
export interface Navigation {
  /**
   * Hide the navigation when the user is on this particular page.
   */
  hidden?: boolean;

  /**
   * Disable navigation by clicking on the navigation menu
   */
  preventClickNavigation?: boolean;
}

/**
 * @additionalProperties false
 */
export interface PageData {
  navigation?: Navigation;
  pageActionConfig?: PageActionConfig;
}

/**
 * @additionalProperties false
 */
export interface PageActionConfig {
  /**
   * Hide the "NEXT" button on this page.
   */
  nextButtonHidden?: boolean;

  /**
   * Hide the "BACK" button on this page.
   */
  backButtonHidden?: boolean;

  /**
   * Provide a customized text for the "BACK" button of page (default is 'Back').
   * Specify either a string or different labels that are linked to conditions.
   * This value will be translatable.
   * @examples [[{"label": "My conditional label", "condition": "{$.person.firstName} === {$.person.lastName}"}], "My label"]
   */
  backButtonLabel?: string | PageActionButtonLabel[];

  /**
   * Override the default styling for the back button in the page, making it a "tertiary" button.
   * Only applies for Expert journeys.
   */
  backButtonUseTertiaryStyle?: boolean;

  /**
   * Provide a customized text for the "NEXT" button of page (default is 'Next').
   * Specify either a string or different labels that are linked to conditions.
   * This value will be translatable.
   * @examples [[{"label": "My conditional label", "condition": "{$.person.firstName} === {$.person.lastName}"}], "My label"]
   */
  nextButtonLabel?: string | PageActionButtonLabel[];

  /**
   * Provide a customized text for the "CANCEL" button of page (default is 'Cancel').
   * Specify either a string or different labels that are linked to conditions.
   * This value will be translatable.
   * @examples [[{"label": "My conditional label", "condition": "{$.person.firstName} === {$.person.lastName}"}], "My label"]
   */
  cancelButtonLabel?: string | PageActionButtonLabel[];

  /**
   * Configure additional buttons that will be shown along the Next and the Back button.
   * @default []
   * @examples [["SAVE_OFFER", { "icon": "edit", "id": "my-custom-button", "label": "My custom label", "handlerType": "PFE_ACTION", "config": { "type": "MY_CUSTOM_PFE_ACTION" }}]]
   */
  extraActions?: ExtraPageAction[];
}

export interface PageActionButtonLabel {
  label: string;
  condition: string;
}

/**
 * Available types of additional action buttons
 */
// Developer's note: add new page actions via unions (e.g. `'TYPE' | 'TYPE2'`).
// If we turn this list of actions into an enum we run into problems in generated
// apps that use `strict` compilation because of the way we "render" page data.
export type ExtraPageAction = 'SAVE_OFFER' | 'CANCEL_OPERATION' | CustomAction;

/**
 * @additionalProperties false
 */
export type CustomAction = CustomActionWithPfeServiceActivator | CustomActionWithPfeAction;

/**
 * @additionalProperties false
 */
interface CustomActionWithPfeServiceActivator
  extends BaseCustomAction,
    BusinessEventServiceActivator {}

/**
 * @additionalProperties false
 */
interface CustomActionWithPfeAction extends BaseCustomAction, BusinessEventAction {}

/**
 * @additionalProperties false
 */
interface BaseCustomAction {
  /**
   * The id of the button to be used as ACL key, tracking Id, tracking value and translation key.
   */
  id: string;
  /**
   * The label of the button. It's translatable by default
   */
  label: string;
  /**
   * The name of the NDBX icon to be displayed before the label
   */
  icon?: string;
}

export type Stage =
  | PageTitleAsStageBase
  | PageTitleAsStageWithSubline
  | PageTitleAsStageWithTopline;

export type PageTitle = string | PageTitleObject | Stage;

/**
 * @additionalProperties false
 */
export interface PageTitleObject {
  /**
   * The headline of the page title.
   */
  headline: string;
  /**
   * Specifies whether to show the page title as a stage.
   */
  showAsStage?: false;
  /**
   * The subline of the page title.
   */
  subline?: string;
}

/**
 * @additionalProperties false
 */
export interface PageTitleAsStageBase {
  /**
   * The headline of the page title.
   */
  headline: string;
  /**
   * Specifies whether to show the page title as a stage.
   */
  showAsStage: true;
  /**
   * The image on the end side of the horizontal axis (right-hand when LTR)
   */
  endImage?: string;
  /**
   * Replacement when the screen estate is limited like on the mobile layout.
   */
  narrowImage?: string;
  /**
   * The image on the start side of the horizontal axis (left-hand when LTR)
   */
  startImage?: string;
  /**
   * Flag that allows to hide the back link for specific pages, in case being displayed for the generated app
   */
  hideBackLink?: boolean;
}

/**
 * @additionalProperties false
 */
export interface PageTitleAsStageWithSubline extends PageTitleAsStageBase {
  /**
   * The subline of the page title. The subline can only be set if no topline exists.
   */
  subline: string;
}

/**
 * @additionalProperties false
 */
export interface PageTitleAsStageWithTopline extends PageTitleAsStageBase {
  /**
   * The topline of the page title. The topline can only be set if no subline exists.
   */
  topline: string;
}

results matching ""

    No results matching ""