File

src/lib/config/first-spirit-managed-page.ts

Description

This data class represents a page that includes content managed by FirstSpirit.

Index

Properties
Methods
Accessors

Constructor

Private constructor(config: literal type)
Parameters :
Name Type Optional
config literal type No

Properties

Private _isFirstSpiritOnly
Type : boolean
Private Optional _sapPageIdentifier
Type : string
Private Optional _sapPageType
Type : PageType
Private _slots
Type : FirstSpiritManagedSlot[]
Private _template
Type : string

Methods

Static enhanceSapPages
enhanceSapPages(sapTemplate: string, slots: FirstSpiritManagedSlot[])

This helper function enhances SAP Commerce pages to include content from SAP Commerce as well as FirstSpirit content. For example relevant for pages that can benefit from information provided by SAP Commerce like a store finder page.

Parameters :
Name Type Optional Description
sapTemplate string No

The SAP page template to be enhanced.

slots FirstSpiritManagedSlot[] No

The slots to be enhanced.

An instance of a FirstSpiritManagedPage with provided SAP page information.

Static integrateFsDrivenPages
integrateFsDrivenPages(fsTemplate: string, slots: FirstSpiritManagedSlot[])

This helper function adds a new page handled entirely by FirstSpirit without the need for a SAP Commerce page. For example relevant for pure content pages like a blog or similar.

Parameters :
Name Type Optional Description
fsTemplate string No

The template to be used by the new page.

slots FirstSpiritManagedSlot[] No

The list of slots to be provided to the new page.

An instance of a FirstSpiritManagedPage for a page that only contains FirstSpirit content and does not exist in SAP Commerce.

Static integrateFsDrivenPagesIntoSapSkeleton
integrateFsDrivenPagesIntoSapSkeleton(sapPageIdentifier: string, sapPageType: PageType, fsTemplate: string, slots: FirstSpiritManagedSlot[])

This helper function overrides the content of a SAP Commerce with content from FirstSpirit, while keeping the header and footer from the SAP Commerce page. For example relevant for pages that should use the SAP header but are entirely maintained in FirstSpirit.

Parameters :
Name Type Optional Description
sapPageIdentifier string No

The UID of the page in SAP Commerce (usually auto generated by SAP Commerce unless the page was created via impex).

sapPageType PageType No

The Page type of the page in SAP Commerce (maintainable in SAP Commerce).

fsTemplate string No

The FirstSpirit template to be used.

slots FirstSpiritManagedSlot[] No

The slots to be handled by FirstSpirit.

An instance of a FirstSpiritManagedPage with provided SAP page information that only contains FirstSpirit content.

Accessors

sapPageIdentifier
getsapPageIdentifier()
sapPageType
getsapPageType()
template
gettemplate()
slots
getslots()
isFirstSpiritOnly
getisFirstSpiritOnly()
import { PageType } from '@spartacus/core';
import { FirstSpiritManagedSlot } from './first-spirit-managed-slot';

/**
 * This data class represents a page that includes content managed by FirstSpirit.
 * @export
 */
export class FirstSpiritManagedPage {
  private _sapPageIdentifier?: string;
  private _sapPageType?: PageType;
  private _template: string;
  private _slots: FirstSpiritManagedSlot[];
  private _isFirstSpiritOnly: boolean;

  private constructor(config: {
    sapPageIdentifier?: string;
    sapPageType?: PageType;
    template: string;
    slots: FirstSpiritManagedSlot[];
    isFirstSpiritOnly: boolean;
  }) {
    const { sapPageIdentifier, slots, sapPageType, template, isFirstSpiritOnly } = config || {};
    this._sapPageIdentifier = sapPageIdentifier;
    this._sapPageType = sapPageType;
    this._template = template;
    this._slots = slots;
    this._isFirstSpiritOnly = isFirstSpiritOnly;
  }
  get sapPageIdentifier(): string | undefined {
    return this._sapPageIdentifier;
  }

  get sapPageType(): PageType | undefined {
    return this._sapPageType;
  }

  get template(): string {
    return this._template;
  }

  get slots(): FirstSpiritManagedSlot[] {
    return this._slots;
  }

  get isFirstSpiritOnly(): boolean {
    return this._isFirstSpiritOnly;
  }

  /**
   * This helper function overrides the content of a SAP Commerce  with content from FirstSpirit, while keeping the header and footer from the SAP Commerce page.
   * For example relevant for pages that should use the SAP header but are entirely maintained in FirstSpirit.
   *
   * @param sapPageIdentifier The UID of the page in SAP Commerce (usually auto generated by SAP Commerce unless the page was created via impex).
   * @param sapPageType The Page type of the page in SAP Commerce (maintainable in SAP Commerce).
   * @param fsTemplate The FirstSpirit template to be used.
   * @param slots The slots to be handled by FirstSpirit.
   * @return An instance of a FirstSpiritManagedPage with provided SAP page information that only contains FirstSpirit content.
   */
  public static integrateFsDrivenPagesIntoSapSkeleton(
    sapPageIdentifier: string,
    sapPageType: PageType,
    fsTemplate: string,
    slots: FirstSpiritManagedSlot[]
  ): FirstSpiritManagedPage {
    return new FirstSpiritManagedPage({ sapPageIdentifier, sapPageType, template: fsTemplate, slots, isFirstSpiritOnly: true });
  }

  /**
   * This helper function adds a new page handled entirely by FirstSpirit without the need for a SAP Commerce page.
   * For example relevant for pure content pages like a blog or similar.
   * @param fsTemplate The template to be used by the new page.
   * @param slots The list of slots to be provided to the new page.
   * @return An instance of a FirstSpiritManagedPage for a page that only contains FirstSpirit content and does not exist in SAP Commerce.
   */
  public static integrateFsDrivenPages(fsTemplate: string, slots: FirstSpiritManagedSlot[]): FirstSpiritManagedPage {
    return new FirstSpiritManagedPage({ template: fsTemplate, slots, isFirstSpiritOnly: true });
  }

  /**
   * This helper function enhances SAP Commerce pages to include content from SAP Commerce as well as FirstSpirit content.
   * For example relevant for pages that can benefit from information provided by SAP Commerce like a store finder page.
   * @param sapTemplate The SAP page template to be enhanced.
   * @param slots The slots to be enhanced.
   * @return An instance of a FirstSpiritManagedPage with provided SAP page information.
   */
  public static enhanceSapPages(sapTemplate: string, slots: FirstSpiritManagedSlot[]): FirstSpiritManagedPage {
    return new FirstSpiritManagedPage({ template: sapTemplate, slots, isFirstSpiritOnly: false });
  }
}

results matching ""

    No results matching ""