Skip to content

Latest commit

 

History

History
308 lines (265 loc) · 6.29 KB

pages.api.md

File metadata and controls

308 lines (265 loc) · 6.29 KB

API Report File for "@yext/pages"

Do not edit this file. It is a report generated by API Extractor.

import { Command } from "commander";
import { default as React_2 } from "react";

// @public
export type Attributes = Record<string, string>;

// @internal
export interface ClientRenderTemplate {
  render(pageContext: PageContext<any>): Promise<string>;
}

// @internal
export interface ClientServerRenderTemplates {
  clientRenderTemplatePath: string;
  isCustomRenderTemplate: boolean;
  serverRenderTemplatePath: string;
}

// @internal
export const convertToPosixPath: (p: string) => string;

// @internal (undocumented)
export const createDevServer: (
  dynamicGenerateData: boolean,
  useProdURLs: boolean,
  devServerPort: number,
  scope?: string
) => Promise<void>;

// @internal (undocumented)
export const devCommand: (program: Command) => void;

// @public
export interface FunctionModule {
  default?: FunctionType;
}

// @public
export type FunctionType = HttpFunction | OnUrlChangeFunction;

// @public
export type GetHeadConfig<T extends TemplateRenderProps> = (
  props: T
) => HeadConfig;

// @public
export const getLang: <T extends TemplateRenderProps<any>>(
  headConfig: HeadConfig | undefined,
  props: T
) => string;

// @public
export type GetPath<T extends TemplateProps> = (props: T) => string;

// @public
export type GetRedirects<T extends TemplateProps> = (props: T) => string[];

// @public
export const getRelativePrefixToRootFromPath: (path: string) => string;

// @public
export interface HeadConfig {
  charset?: string;
  lang?: string;
  other?: string;
  tags?: Tag[];
  title?: string;
  viewport?: string;
}

// @public
export type HttpFunction = (arg: PagesHttpRequest) => PagesHttpResponse;

// @public
export type Manifest = {
  serverPaths: {
    [key: string]: string;
  };
  clientPaths: {
    [key: string]: string;
  };
  renderPaths: {
    [key: string]: string;
  };
  projectStructure: ProjectStructureConfig;
  bundlerManifest?: any;
};

// @public
export type Module = () => React.JSX.Element;

// @public
export interface ModuleConfig {
  name?: string;
}

// @public
export interface ModuleProps {
  __meta: {
    mode: "development" | "production";
  };
}

// @public
export type OnUrlChangeFunction = (
  arg: PagesOnUrlChangeRequest
) => PagesOnUrlChangeResponse;

// @internal
export interface PageContext<T extends TemplateRenderProps<T>> {
  Page: Template<T>;
  pageProps: T;
}

// @public
export interface PagesHttpRequest {
  body: string;
  headers: {
    [key: string]: string[];
  };
  method: string;
  pathParams: {
    [key: string]: string;
  };
  queryParams: {
    [key: string]: string;
  };
  site: Site;
}

// @public
export interface PagesHttpResponse {
  body: string;
  headers:
    | {
        [key: string]: string;
      }
    | {
        [key: string]: [string];
      };
  statusCode: number;
}

// @public
export interface PagesOnUrlChangeRequest {
  domainMap: {
    production: string;
    staging: string;
    deployPreview: string;
    displayUrlPrefix: string;
  };
  entityId: string;
  feature: string;
  locale: string;
  path: string;
  previousUrl: string;
  site: Site;
  url: string;
}

// @public
export type PagesOnUrlChangeResponse = void;

// @public
export type Render<T extends TemplateRenderProps<T>> = (props: T) => string;

// @public
export const renderHeadConfigToString: (headConfig: HeadConfig) => string;

// @internal
export interface ServerRenderTemplate {
  indexHtml: string;
  render(pageContext: PageContext<any>): Promise<string>;
  replacementTag: string;
}

// @public
export interface Site {
  branchId: string;
  businessId: string;
  businessName: string;
  commitHash: string;
  commitMessage: string;
  deployId: string;
  displayUrlPrefix: string;
  invocationContext: "local" | "preview" | "staging" | "production" | null;
  partnerId: string;
  platformUrl: string;
  previewDomain: string;
  productionDomain: string;
  repoBranchName: string;
  repoBranchUrl: string;
  repoUrl: string;
  siteId: string;
  siteName: string;
  stagingDomain: string;
  yextUniverse: "development" | "qa" | "sandbox" | "production" | null;
}

// @public
export interface StaticTemplateConfig {
  hydrate?: boolean;
  locales?: string[];
  name?: string;
  onUrlChange?: string;
}

// @public
export interface Stream {
  $id: string;
  fields: string[];
  filter: {
    entityIds?: string[];
    entityTypes?: string[];
    savedFilterIds?: string[];
  };
  localization:
    | {
        locales: string[];
        primary?: never;
      }
    | {
        primary: true;
        locales?: never;
      };
  transform?: {
    expandOptionFields?: string[];
    replaceOptionValuesWithDisplayNames?: string[];
  };
}

// @public
export interface Tag {
  attributes: Attributes;
  type: TagType;
}

// @public
export type TagType =
  | "base"
  | "link"
  | "style"
  | "meta"
  | "script"
  | "noscript"
  | "template";

// @public
export type Template<T extends TemplateRenderProps> = (
  props: T
) => React_2.JSX.Element;

// @public
export interface TemplateConfig {
  alternateLanguageFields?: string[];
  hydrate?: boolean;
  name?: string;
  onUrlChange?: string;
  pageUrlField?: string;
  slugField?: string;
  stream?: Stream;
  streamId?: string;
}

// @public
export interface TemplateModule<
  T extends TemplateProps,
  U extends TemplateRenderProps,
> {
  config?: TemplateConfig;
  // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@yext/pages" does not have an export "render"
  default?: Template<U>;
  getHeadConfig?: GetHeadConfig<U>;
  getPath: GetPath<T>;
  getRedirects?: GetRedirects<U>;
  render?: Render<U>;
  transformProps?: TransformProps<T>;
}

// @public
export interface TemplateProps<T = Record<string, any>> {
  __meta: {
    mode: "development" | "production";
  };
  document: T;
  pathOverride?: string;
}

// @public
export interface TemplateRenderProps<T = any> extends TemplateProps<T> {
  path: string;
  relativePrefixToRoot: string;
}

// @public
export type TransformProps<T extends TemplateProps> = (props: T) => Promise<T>;

// Warnings were encountered during analysis:
//
// dist/types/src/common/src/template/types.d.ts:165:5 - (ae-forgotten-export) The symbol "ProjectStructureConfig" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)