@jss-rule-engine/nextjs
Version:
40 lines (39 loc) • 1.74 kB
TypeScript
import { GetServerSidePropsContext, GetStaticPropsContext } from 'next';
import { JssRuleEngine } from '@jss-rule-engine/core';
import { DictionaryPhrases, ComponentPropsCollection, LayoutServiceData, SiteInfo, HTMLLink } from '@sitecore-jss/sitecore-jss-nextjs';
export type SitecorePageProps = {
site: SiteInfo;
locale: string;
dictionary: DictionaryPhrases;
componentProps: ComponentPropsCollection;
notFound: boolean;
layoutData: LayoutServiceData;
headLinks: HTMLLink[];
};
interface Plugin {
/**
* Detect order when the plugin should be called, e.g. 0 - will be called first (can be a plugin which data is required for other plugins)
*/
order: number;
/**
* A function which will be called during page props generation
*/
exec(props: SitecorePageProps, context: GetServerSidePropsContext | GetStaticPropsContext): Promise<SitecorePageProps>;
}
export declare class RulesSSGPersonalizationPlugin implements Plugin {
graphQLEndpoint: string;
sitecoreApiKey: string;
ruleEngine: JssRuleEngine;
constructor(endpointUrl: string, sitecoreApiKey: string, ruleEngine: JssRuleEngine);
order: number;
isDisconnectedMode(props: any): boolean;
isPageEditing(props: any): any;
extractRuleActions(variantId: string): boolean[];
/**
* Determines whether context is GetServerSidePropsContext (SSR) or GetStaticPropsContext (SSG)
* @param {GetServerSidePropsContext | GetStaticPropsContext} context
*/
isServerSidePropsContext(context: GetServerSidePropsContext | GetStaticPropsContext): context is GetServerSidePropsContext;
exec(props: any, context: GetServerSidePropsContext | GetStaticPropsContext): Promise<any>;
}
export {};