@yext/visual-editor 1.4.11 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SectionLibraryVisualEditorProvider-67ng4X9e.js +108670 -0
- package/dist/SectionLibraryVisualEditorProvider.css +1 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/Address.tsx +251 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/HeadingText.tsx +147 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursStatus.tsx +157 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/HoursTable.tsx +164 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/MapboxStaticMap.tsx +205 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/Phone.tsx +155 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/EmptyImageState.tsx +168 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/Image.tsx +275 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/image/styling.ts +66 -0
- package/dist/cli/assets/directory-locator-source/components/contentBlocks/index.ts +13 -0
- package/dist/cli/assets/directory-locator-source/components/sections/Breadcrumbs.tsx +298 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.test.tsx +872 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/Directory.tsx +260 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryCard.tsx +507 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/DirectoryWrapper.tsx +491 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.test.tsx +226 -0
- package/dist/cli/assets/directory-locator-source/components/sections/directory/directoryChildReference.tsx +98 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.test.tsx +147 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Filters.tsx +691 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.test.tsx +1551 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Locator.tsx +541 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorFields.test.ts +43 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorResultCard.tsx +1594 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/LocatorWrapper.tsx +1157 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Map.tsx +304 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/MapPinIcon.tsx +160 -0
- package/dist/cli/assets/directory-locator-source/components/sections/locator/Results.tsx +267 -0
- package/dist/cli/assets/directory-locator-source/sectionLibrarySupport.ts +245 -0
- package/dist/cli/yextve.js +16888 -0
- package/dist/index.d.ts +542 -6311
- package/dist/locales/page/cs/visual-editor.json +85 -0
- package/dist/locales/page/da/visual-editor.json +73 -0
- package/dist/locales/page/de/visual-editor.json +73 -0
- package/dist/locales/page/en/visual-editor.json +73 -0
- package/dist/locales/page/en-GB/visual-editor.json +73 -0
- package/dist/locales/page/es/visual-editor.json +79 -0
- package/dist/locales/page/et/visual-editor.json +73 -0
- package/dist/locales/page/fi/visual-editor.json +73 -0
- package/dist/locales/page/fr/visual-editor.json +79 -0
- package/dist/locales/page/hr/visual-editor.json +79 -0
- package/dist/locales/page/hu/visual-editor.json +73 -0
- package/dist/locales/page/it/visual-editor.json +79 -0
- package/dist/locales/page/ja/visual-editor.json +73 -0
- package/dist/locales/page/lt/visual-editor.json +85 -0
- package/dist/locales/page/lv/visual-editor.json +77 -0
- package/dist/locales/page/nb/visual-editor.json +73 -0
- package/dist/locales/page/nl/visual-editor.json +73 -0
- package/dist/locales/page/pl/visual-editor.json +85 -0
- package/dist/locales/page/pt/visual-editor.json +79 -0
- package/dist/locales/page/ro/visual-editor.json +79 -0
- package/dist/locales/page/sk/visual-editor.json +85 -0
- package/dist/locales/page/sv/visual-editor.json +73 -0
- package/dist/locales/page/tr/visual-editor.json +73 -0
- package/dist/locales/page/zh/visual-editor.json +73 -0
- package/dist/locales/page/zh-TW/visual-editor.json +73 -0
- package/dist/locales/platform/cs/visual-editor.json +531 -0
- package/dist/locales/platform/da/visual-editor.json +519 -0
- package/dist/locales/platform/de/visual-editor.json +519 -0
- package/dist/locales/platform/en/visual-editor.json +519 -0
- package/dist/locales/platform/en-GB/visual-editor.json +519 -0
- package/dist/locales/platform/es/visual-editor.json +525 -0
- package/dist/locales/platform/et/visual-editor.json +519 -0
- package/dist/locales/platform/fi/visual-editor.json +519 -0
- package/dist/locales/platform/fr/visual-editor.json +525 -0
- package/dist/locales/platform/hr/visual-editor.json +525 -0
- package/dist/locales/platform/hu/visual-editor.json +519 -0
- package/dist/locales/platform/it/visual-editor.json +525 -0
- package/dist/locales/platform/ja/visual-editor.json +519 -0
- package/dist/locales/platform/lt/visual-editor.json +531 -0
- package/dist/locales/platform/lv/visual-editor.json +523 -0
- package/dist/locales/platform/nb/visual-editor.json +519 -0
- package/dist/locales/platform/nl/visual-editor.json +519 -0
- package/dist/locales/platform/pl/visual-editor.json +531 -0
- package/dist/locales/platform/pt/visual-editor.json +525 -0
- package/dist/locales/platform/ro/visual-editor.json +525 -0
- package/dist/locales/platform/sk/visual-editor.json +531 -0
- package/dist/locales/platform/sv/visual-editor.json +519 -0
- package/dist/locales/platform/tr/visual-editor.json +519 -0
- package/dist/locales/platform/zh/visual-editor.json +519 -0
- package/dist/locales/platform/zh-TW/visual-editor.json +519 -0
- package/dist/locatorEntityTypes-s4dmT9l5.d.ts +1850 -0
- package/dist/plugin/internal/sectionLibraryValidation/builtInTranslationResources.d.ts +3 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/api/api.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/api/libraryMetadata.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/code/importRules.d.ts +13 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/code/validateCode.d.ts +10 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/code/xssRules.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/stages/structure/structure.d.ts +7 -0
- package/dist/plugin/internal/sectionLibraryValidation/types.d.ts +48 -0
- package/dist/plugin/internal/sectionLibraryValidation/validateSectionLibrary.d.ts +8 -0
- package/dist/plugin/internal/sectionLibraryValidation/validationError.d.ts +6 -0
- package/dist/plugin/plugin.js +2233 -5786
- package/dist/plugin/types/entityFields.d.ts +21 -0
- package/dist/plugin/types/images.d.ts +62 -0
- package/dist/plugin/types/sectionLibrary.d.ts +94 -0
- package/dist/plugin/types/types.d.ts +204 -0
- package/dist/plugin/types/videos.d.ts +24 -0
- package/dist/plugin/utils/i18n/locales.d.ts +5 -0
- package/dist/plugin/utils/i18n/translationResources.d.ts +41 -0
- package/dist/plugin/utils/normalizeLocale.d.ts +8 -0
- package/dist/plugin/utils/plainText.d.ts +6 -0
- package/dist/plugin/vite-plugin/index.d.ts +2 -0
- package/dist/plugin/vite-plugin/local-editor/artifacts.d.ts +18 -0
- package/dist/plugin/vite-plugin/local-editor/config.d.ts +11 -0
- package/dist/plugin/vite-plugin/local-editor/data.d.ts +10 -0
- package/dist/plugin/vite-plugin/local-editor/entityFields.d.ts +13 -0
- package/dist/plugin/vite-plugin/local-editor/fixtureData.d.ts +12 -0
- package/dist/plugin/vite-plugin/local-editor/generatedFiles.d.ts +34 -0
- package/dist/plugin/vite-plugin/local-editor/server.d.ts +18 -0
- package/dist/plugin/vite-plugin/local-editor/types.d.ts +109 -0
- package/dist/plugin/vite-plugin/local-editor/utils.d.ts +16 -0
- package/dist/plugin/vite-plugin/plugin.d.ts +8 -0
- package/dist/plugin/vite-plugin/section-library/migrationRegistry.d.ts +6 -0
- package/dist/plugin/vite-plugin/section-library/sectionFrontmatter.d.ts +3 -0
- package/dist/plugin/vite-plugin/section-library/sectionLibraryGenerator.d.ts +21 -0
- package/dist/plugin/vite-plugin/section-library/sharedComponentRegistry.d.ts +16 -0
- package/dist/section-library-support.js +158 -0
- package/dist/sectionLibrarySupport.d.ts +282 -0
- package/dist/style.css +1 -1
- package/dist/visual-editor-9bLkRo2X.js +702 -0
- package/dist/visual-editor-B5f3AZF6.js +706 -0
- package/dist/visual-editor-BGZbJkMp.js +694 -0
- package/dist/visual-editor-BPVqHHz5.js +706 -0
- package/dist/visual-editor-BPvDMSb8.js +706 -0
- package/dist/visual-editor-BTT9n9b6.js +718 -0
- package/dist/visual-editor-BXSlgf31.js +694 -0
- package/dist/visual-editor-BXYlpe7B.js +145 -0
- package/dist/visual-editor-Bez9GftS.js +694 -0
- package/dist/visual-editor-Bk5QJccl.js +718 -0
- package/dist/visual-editor-BqtG2m0y.js +694 -0
- package/dist/visual-editor-Bxy81Ezy.js +145 -0
- package/dist/visual-editor-C00efXqJ.js +706 -0
- package/dist/visual-editor-C0vq2BRM.js +145 -0
- package/dist/visual-editor-CCgmYV5S.js +169 -0
- package/dist/visual-editor-CERViyTJ.js +145 -0
- package/dist/visual-editor-CZdmgAn0.js +706 -0
- package/dist/visual-editor-CcOCcCUQ.js +694 -0
- package/dist/visual-editor-CjORnP1D.js +169 -0
- package/dist/visual-editor-CmomGJB8.js +157 -0
- package/dist/visual-editor-Cymg8ID2.js +169 -0
- package/dist/visual-editor-D2Hk1nhM.js +145 -0
- package/dist/visual-editor-D2_8u6ZI.js +694 -0
- package/dist/visual-editor-D4vaqoBN.js +694 -0
- package/dist/visual-editor-D6n8EP_O.js +694 -0
- package/dist/visual-editor-D8MRFn5x.js +157 -0
- package/dist/visual-editor-DKG_E7X4.js +694 -0
- package/dist/visual-editor-DOXtCqRv.js +145 -0
- package/dist/visual-editor-DQEd3xwY.js +145 -0
- package/dist/visual-editor-DQq0_rUn.js +706 -0
- package/dist/visual-editor-DRXezaoB.js +694 -0
- package/dist/visual-editor-DUngIOnE.js +157 -0
- package/dist/visual-editor-DbgFzBNV.js +718 -0
- package/dist/visual-editor-DeZVZYfd.js +169 -0
- package/dist/visual-editor-DfJMZpiP.js +145 -0
- package/dist/visual-editor-DgAsQK9D.js +145 -0
- package/dist/visual-editor-Dhi__-7_.js +145 -0
- package/dist/visual-editor-DiLdoISr.js +718 -0
- package/dist/visual-editor-DjdqpJU-.js +145 -0
- package/dist/visual-editor-DnTPMRV4.js +694 -0
- package/dist/visual-editor-DvuH3jyL.js +157 -0
- package/dist/visual-editor-E0hASBXn.js +694 -0
- package/dist/visual-editor-TfVDfO5_.js +145 -0
- package/dist/visual-editor-W1OHU94y.js +694 -0
- package/dist/visual-editor-W_ZDmMFn.js +145 -0
- package/dist/visual-editor-b7ALusk8.js +145 -0
- package/dist/visual-editor-bauJ9beX.js +694 -0
- package/dist/visual-editor-erGXf3kS.js +157 -0
- package/dist/visual-editor-xnDHZFuO.js +153 -0
- package/dist/visual-editor-yiWZqIH0.js +157 -0
- package/dist/visual-editor.css +1 -0
- package/dist/visual-editor.js +15074 -137463
- package/package.json +46 -25
- package/dist/editor.css +0 -1
- package/dist/visual-editor-1QC8zZX_.js +0 -221
- package/dist/visual-editor-5C5XV5rL.js +0 -221
- package/dist/visual-editor-B8-FoFxc.js +0 -1049
- package/dist/visual-editor-BJgCpnYV.js +0 -1073
- package/dist/visual-editor-BKLiin5z.js +0 -1049
- package/dist/visual-editor-BWbqw_QE.js +0 -233
- package/dist/visual-editor-Bb6upvTE.js +0 -221
- package/dist/visual-editor-BcZCBLFh.js +0 -1049
- package/dist/visual-editor-BecDYKH8.js +0 -1049
- package/dist/visual-editor-BllAUu_T.js +0 -1073
- package/dist/visual-editor-BmaYFuCe.js +0 -233
- package/dist/visual-editor-BnPFkJlo.js +0 -221
- package/dist/visual-editor-BoIXa-xl.js +0 -245
- package/dist/visual-editor-BtDJICJp.js +0 -1073
- package/dist/visual-editor-BwxWyr_L.js +0 -221
- package/dist/visual-editor-Bz7BlR_j.js +0 -221
- package/dist/visual-editor-CC0RAmib.js +0 -1049
- package/dist/visual-editor-CDY9slY9.js +0 -1061
- package/dist/visual-editor-CFebs6R8.js +0 -1049
- package/dist/visual-editor-CNL0HyVh.js +0 -1049
- package/dist/visual-editor-CYnzwNwX.js +0 -229
- package/dist/visual-editor-CZH605TK.js +0 -233
- package/dist/visual-editor-Cada46ZF.js +0 -1049
- package/dist/visual-editor-CheComxC.js +0 -1061
- package/dist/visual-editor-CuA8h_Xv.js +0 -221
- package/dist/visual-editor-CuRmgs-p.js +0 -245
- package/dist/visual-editor-D9_YWQQY.js +0 -1073
- package/dist/visual-editor-D9w4wRG8.js +0 -245
- package/dist/visual-editor-D9xTiOC0.js +0 -221
- package/dist/visual-editor-DA7CixSl.js +0 -1061
- package/dist/visual-editor-DAnBQ9H_.js +0 -221
- package/dist/visual-editor-DF8RsMvq.js +0 -233
- package/dist/visual-editor-DLrKYx7j.js +0 -1061
- package/dist/visual-editor-DQJc_Xok.js +0 -233
- package/dist/visual-editor-DTZFGKm7.js +0 -221
- package/dist/visual-editor-DXebihTA.js +0 -233
- package/dist/visual-editor-DZ4U1fk-.js +0 -221
- package/dist/visual-editor-Dg7P-vDv.js +0 -1057
- package/dist/visual-editor-Dh2cuwWt.js +0 -1049
- package/dist/visual-editor-DpetyO9o.js +0 -1049
- package/dist/visual-editor-Duav2tXb.js +0 -1061
- package/dist/visual-editor-DvYsu_s9.js +0 -221
- package/dist/visual-editor-DwlX3nnZ.js +0 -221
- package/dist/visual-editor-Dz5s66Og.js +0 -221
- package/dist/visual-editor-E57fPJMD.js +0 -1049
- package/dist/visual-editor-Fy_uEJju.js +0 -1061
- package/dist/visual-editor-G8e2TllW.js +0 -1049
- package/dist/visual-editor-HkfpXRw7.js +0 -1049
- package/dist/visual-editor-ZKG4e_Ey.js +0 -1049
- package/dist/visual-editor-rZRnDwgU.js +0 -245
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type YextSchemaField = {
|
|
2
|
+
name: string;
|
|
3
|
+
displayName?: string;
|
|
4
|
+
definition: YextSchemaFieldDefinition;
|
|
5
|
+
children?: {
|
|
6
|
+
fields: YextSchemaField[];
|
|
7
|
+
};
|
|
8
|
+
optionFormat?: "OPTION_FORMAT_EXPANDED";
|
|
9
|
+
};
|
|
10
|
+
export type YextSchemaFieldDefinition = {
|
|
11
|
+
name: string;
|
|
12
|
+
isList?: boolean;
|
|
13
|
+
registryId?: string;
|
|
14
|
+
typeName?: string;
|
|
15
|
+
typeRegistryId?: string;
|
|
16
|
+
type: Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
export type StreamFields = {
|
|
19
|
+
fields: YextSchemaField[];
|
|
20
|
+
displayNames?: Record<string, string>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ImageType } from "@yext/pages-components";
|
|
2
|
+
import { TranslatableString } from "./types.ts";
|
|
3
|
+
/** Describes the possible image fill types. */
|
|
4
|
+
export type ImageFillType = "fill" | "fit";
|
|
5
|
+
/** Describes an image's aspect ratio. */
|
|
6
|
+
type ImageAspectRatio = {
|
|
7
|
+
horizontalFactor: number;
|
|
8
|
+
verticalFactor: number;
|
|
9
|
+
};
|
|
10
|
+
/** Describes the dimensions of an image. */
|
|
11
|
+
type ImageDimension = {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
/** Describes the data corresponding to a single image. */
|
|
16
|
+
type ImageData = {
|
|
17
|
+
url: string;
|
|
18
|
+
dimension?: ImageDimension;
|
|
19
|
+
exifMetadata?: {
|
|
20
|
+
rotate: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/** Describes the data corresponding to an image rotation. */
|
|
24
|
+
type ImageRotation = {
|
|
25
|
+
degree: number;
|
|
26
|
+
};
|
|
27
|
+
/** Describes the crop boundary box data */
|
|
28
|
+
type ImageCrop = {
|
|
29
|
+
left: number;
|
|
30
|
+
top: number;
|
|
31
|
+
height: number;
|
|
32
|
+
width: number;
|
|
33
|
+
aspectRatio?: ImageAspectRatio;
|
|
34
|
+
};
|
|
35
|
+
type TransformKind = "CROP" | "ROTATION";
|
|
36
|
+
/** Outlines the possible image transformations. */
|
|
37
|
+
type ImageTransformation = ImageRotation | ImageCrop;
|
|
38
|
+
type ImageTransformations = Partial<Record<TransformKind, ImageTransformation>>;
|
|
39
|
+
/** Describes the data corresponding to a piece of image content. */
|
|
40
|
+
export type ImageContentData = {
|
|
41
|
+
name?: string;
|
|
42
|
+
transformedImage?: ImageData;
|
|
43
|
+
originalImage?: ImageData;
|
|
44
|
+
childImages?: ImageData[];
|
|
45
|
+
transformations?: ImageTransformations;
|
|
46
|
+
sourceUrl?: string;
|
|
47
|
+
altText?: string;
|
|
48
|
+
};
|
|
49
|
+
export type AssetImageType = Omit<ImageType, "alternateText"> & {
|
|
50
|
+
alternateText?: TranslatableString;
|
|
51
|
+
assetImage?: ImageContentData;
|
|
52
|
+
};
|
|
53
|
+
export type LocalizedAssetImage = {
|
|
54
|
+
hasLocalizedValue?: "true";
|
|
55
|
+
defaultValue?: AssetImageType;
|
|
56
|
+
} & {
|
|
57
|
+
[locale: string]: AssetImageType | undefined;
|
|
58
|
+
};
|
|
59
|
+
export type TranslatableAssetImage = AssetImageType | LocalizedAssetImage;
|
|
60
|
+
export declare const isLocalizedAssetImage: (value: unknown) => value is LocalizedAssetImage;
|
|
61
|
+
export declare const resolveLocalizedAssetImage: (value: TranslatableAssetImage | ImageType | undefined, locale: string) => AssetImageType | undefined;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export declare const supportedPageSetTypes: readonly ["ENTITY", "DIRECTORY", "LOCATOR"];
|
|
2
|
+
export type PageSetType = (typeof supportedPageSetTypes)[number];
|
|
3
|
+
/** A hidden internal Puck component that can appear in saved slot layout data. */
|
|
4
|
+
export type SharedHiddenPuckComponent = {
|
|
5
|
+
/** Stable Puck component ID stored in the layout data. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Page-set types that can render this hidden internal component. */
|
|
8
|
+
pageSetTypes: PageSetType[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Static metadata from a Section Library shared registry.
|
|
12
|
+
*
|
|
13
|
+
* The generator uses this metadata to validate saved component IDs, register
|
|
14
|
+
* their Puck configs, and omit them from editor add-component menus.
|
|
15
|
+
*/
|
|
16
|
+
export type SharedHiddenPuckComponentRegistry = {
|
|
17
|
+
/** Hidden internal components that can appear in saved layout data. */
|
|
18
|
+
components: SharedHiddenPuckComponent[];
|
|
19
|
+
/** Page-set types that need the shared root config, even without components. */
|
|
20
|
+
rootPageSetTypes: PageSetType[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Metadata describing a Section.
|
|
24
|
+
* A section is a horizontal slice of a page that is
|
|
25
|
+
* available for configuration in the Visual Layout Editor.
|
|
26
|
+
*/
|
|
27
|
+
export type SectionConfig = {
|
|
28
|
+
/** The internal id of the section. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** The user-facing display name of the section. */
|
|
31
|
+
displayName: string;
|
|
32
|
+
/** The description of the section's purpose. */
|
|
33
|
+
description: string;
|
|
34
|
+
/** The page set types in which the section can be used. */
|
|
35
|
+
pageSetTypes: PageSetType[];
|
|
36
|
+
/** The category in the left sidebar in which the section will be listed. */
|
|
37
|
+
category?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Metadata describing a Library.
|
|
41
|
+
* A library is a collection of Sections and Layouts.
|
|
42
|
+
*/
|
|
43
|
+
export type LibraryMetadata = {
|
|
44
|
+
/** The version of the library.json metadata schema used in this repo. */
|
|
45
|
+
schemaVersion: 1;
|
|
46
|
+
/** The internal id of the library. */
|
|
47
|
+
id: string;
|
|
48
|
+
/** The user-facing display name of the library. */
|
|
49
|
+
displayName: string;
|
|
50
|
+
/** The user-facing description of the library. */
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
export declare const verticals: readonly ["HEALTHCARE", "FINANCIAL_SERVICES", "FOOD_AND_DINING", "RETAIL", "HOSPITALITY", "PROFESSIONAL_SERVICES"];
|
|
54
|
+
export type Vertical = (typeof verticals)[number];
|
|
55
|
+
export declare const purposes: readonly ["LOCATION", "CITATION"];
|
|
56
|
+
export type Purpose = (typeof purposes)[number];
|
|
57
|
+
/** A layout for use with entity page sets. */
|
|
58
|
+
export type EntityLayoutMetadata = {
|
|
59
|
+
/** The internal id of the entity layout. */
|
|
60
|
+
id: string;
|
|
61
|
+
/** The user-facing display name of the layout. */
|
|
62
|
+
displayName: string;
|
|
63
|
+
/** The entity categories/industries recommended for use with this layout. */
|
|
64
|
+
vertical?: Vertical[];
|
|
65
|
+
/** Whether this layout is intended as the primary location landing page, as an alternate citation page, or both. */
|
|
66
|
+
purpose?: Purpose[];
|
|
67
|
+
pageSetType: "ENTITY";
|
|
68
|
+
};
|
|
69
|
+
/** A layout for use with directory page sets. */
|
|
70
|
+
export type DirectoryLayoutMetadata = {
|
|
71
|
+
/** The internal id of the directory layout. */
|
|
72
|
+
id: string;
|
|
73
|
+
/** The user-facing display name of the layout. */
|
|
74
|
+
displayName: string;
|
|
75
|
+
pageSetType: "DIRECTORY";
|
|
76
|
+
};
|
|
77
|
+
/** A layout for use with locator page sets. */
|
|
78
|
+
export type LocatorLayoutMetadata = {
|
|
79
|
+
/** The internal id of the locator layout. */
|
|
80
|
+
id: string;
|
|
81
|
+
/** The user-facing display name of the layout. */
|
|
82
|
+
displayName: string;
|
|
83
|
+
pageSetType: "LOCATOR";
|
|
84
|
+
};
|
|
85
|
+
export type LayoutMetadata = EntityLayoutMetadata | DirectoryLayoutMetadata | LocatorLayoutMetadata;
|
|
86
|
+
/**
|
|
87
|
+
* A Section Library Layout is a starting point for a page set.
|
|
88
|
+
* It appears in the Section Library Gallery and sets the page set's initial layout configuration.
|
|
89
|
+
*/
|
|
90
|
+
export type SectionLibraryLayout = {
|
|
91
|
+
metadata: LayoutMetadata;
|
|
92
|
+
/** Puck Layout JSON */
|
|
93
|
+
defaultLayout: Record<string, any>;
|
|
94
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { ImageType, CTA as CTAType } from "@yext/pages-components";
|
|
2
|
+
import { AssetImageType } from "./images.ts";
|
|
3
|
+
import { AssetVideo } from "./videos.ts";
|
|
4
|
+
/**
|
|
5
|
+
* A pages-components CTA with a translatable label and link
|
|
6
|
+
*/
|
|
7
|
+
export type TranslatableCTA = Omit<CTAType, "label" | "link"> & {
|
|
8
|
+
/** The text to display in the CTA */
|
|
9
|
+
label: TranslatableString;
|
|
10
|
+
/** The link the for the CTA */
|
|
11
|
+
link: TranslatableString;
|
|
12
|
+
/** Whether the link should be normalized before rendering */
|
|
13
|
+
normalizeLink?: boolean;
|
|
14
|
+
openInNewTab?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** Enhanced CTA options */
|
|
17
|
+
export type EnhancedTranslatableCTA = TranslatableCTA & {
|
|
18
|
+
/**
|
|
19
|
+
* The type of CTA button to display.
|
|
20
|
+
* textAndLink is a standard button
|
|
21
|
+
* getDirections is a button that opens a map based on the coordinate field
|
|
22
|
+
* presetImage uses a preset image such as app store or food delivery logos for the button
|
|
23
|
+
* @defaultValue "textAndLink"
|
|
24
|
+
*/
|
|
25
|
+
ctaType?: "textAndLink" | "getDirections" | "presetImage";
|
|
26
|
+
};
|
|
27
|
+
/** Preset delivery logo options */
|
|
28
|
+
export declare const FOOD_DELIVERY_SERVICES: readonly ["deliveroo", "doordash", "grubhub", "skip-the-dishes", "postmates", "uber-eats", "ezcater"];
|
|
29
|
+
export type FoodDeliveryServiceType = (typeof FOOD_DELIVERY_SERVICES)[number];
|
|
30
|
+
/** Preset image types for CTA buttons - app store or food delivery logos */
|
|
31
|
+
export type PresetImageType = "app-store" | "google-play" | "galaxy-store" | "app-gallery" | FoodDeliveryServiceType;
|
|
32
|
+
/** Data for the HeroSection */
|
|
33
|
+
export type HeroSectionType = {
|
|
34
|
+
/**
|
|
35
|
+
* The image to show in the hero section
|
|
36
|
+
*/
|
|
37
|
+
image?: ImageType | AssetImageType;
|
|
38
|
+
/** The first CTA button for the hero section */
|
|
39
|
+
primaryCta?: EnhancedTranslatableCTA;
|
|
40
|
+
/** The second CTA button for the hero section */
|
|
41
|
+
secondaryCta?: EnhancedTranslatableCTA;
|
|
42
|
+
};
|
|
43
|
+
/** Data for the PromoSection */
|
|
44
|
+
export type PromoSectionType = {
|
|
45
|
+
/**
|
|
46
|
+
* The image or video to show in the promo
|
|
47
|
+
*/
|
|
48
|
+
image?: ImageType | AssetImageType | AssetVideo;
|
|
49
|
+
/** The main text to display in the promo */
|
|
50
|
+
title?: TranslatableString;
|
|
51
|
+
/** The sub text to display in the promo */
|
|
52
|
+
description?: TranslatableRichText;
|
|
53
|
+
/** The CTA button for the promo */
|
|
54
|
+
cta: EnhancedTranslatableCTA;
|
|
55
|
+
};
|
|
56
|
+
/** Data for the ProductSection */
|
|
57
|
+
export type ProductSectionType = {
|
|
58
|
+
products: Array<ProductStruct>;
|
|
59
|
+
};
|
|
60
|
+
/** A structured product price with an amount and ISO currency code. */
|
|
61
|
+
export type ProductPrice = {
|
|
62
|
+
/** The numeric price value. */
|
|
63
|
+
value?: number | string;
|
|
64
|
+
/** The ISO 4217 currency code, for example USD or GBP. */
|
|
65
|
+
currencyCode?: string;
|
|
66
|
+
};
|
|
67
|
+
/** An individual product in the ProductSection */
|
|
68
|
+
export type ProductStruct = {
|
|
69
|
+
/**
|
|
70
|
+
* The product's image
|
|
71
|
+
*/
|
|
72
|
+
image?: ImageType | AssetImageType;
|
|
73
|
+
/**
|
|
74
|
+
* The product's brow text above the title/name
|
|
75
|
+
*/
|
|
76
|
+
brow?: TranslatableString | TranslatableRichText;
|
|
77
|
+
/** The product's name */
|
|
78
|
+
name?: TranslatableString;
|
|
79
|
+
/**
|
|
80
|
+
* The product's price
|
|
81
|
+
*/
|
|
82
|
+
price?: ProductPrice;
|
|
83
|
+
/** The product's description */
|
|
84
|
+
description?: TranslatableRichText;
|
|
85
|
+
/**
|
|
86
|
+
* The product's category
|
|
87
|
+
*/
|
|
88
|
+
category?: TranslatableString | TranslatableRichText;
|
|
89
|
+
/** The product's CTA */
|
|
90
|
+
cta: EnhancedTranslatableCTA;
|
|
91
|
+
};
|
|
92
|
+
/** Data for the EventSection */
|
|
93
|
+
export type EventSectionType = {
|
|
94
|
+
events: Array<EventStruct>;
|
|
95
|
+
};
|
|
96
|
+
/** An individual event in the EventsSection */
|
|
97
|
+
export type EventStruct = {
|
|
98
|
+
/**
|
|
99
|
+
* An image representing the event
|
|
100
|
+
*/
|
|
101
|
+
image?: ImageType | AssetImageType;
|
|
102
|
+
/** The event's title */
|
|
103
|
+
title?: TranslatableString;
|
|
104
|
+
/** A UTC string for event's date and time (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ) */
|
|
105
|
+
dateTime?: string;
|
|
106
|
+
/** The event's description */
|
|
107
|
+
description?: TranslatableRichText;
|
|
108
|
+
/** The event's CTA */
|
|
109
|
+
cta: EnhancedTranslatableCTA;
|
|
110
|
+
};
|
|
111
|
+
/** Data for the FAQSection */
|
|
112
|
+
export type FAQSectionType = {
|
|
113
|
+
faqs: Array<FAQStruct>;
|
|
114
|
+
};
|
|
115
|
+
/** An individual FAQ */
|
|
116
|
+
export type FAQStruct = {
|
|
117
|
+
/** The question (always visible on the page) */
|
|
118
|
+
question: TranslatableString | TranslatableRichText;
|
|
119
|
+
/** The answer (visible when the question is clicked) */
|
|
120
|
+
answer: TranslatableRichText;
|
|
121
|
+
};
|
|
122
|
+
/** Data for the TestimonialSection */
|
|
123
|
+
export type TestimonialSectionType = {
|
|
124
|
+
testimonials: Array<TestimonialStruct>;
|
|
125
|
+
};
|
|
126
|
+
/** An individual testimonial for the TestimonialSection */
|
|
127
|
+
export type TestimonialStruct = {
|
|
128
|
+
/** The testimonial text */
|
|
129
|
+
description?: TranslatableRichText;
|
|
130
|
+
/** The name of the person who contributed the testimonial */
|
|
131
|
+
contributorName?: TranslatableString;
|
|
132
|
+
/** A UTC string for the contribution's date and time (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ) */
|
|
133
|
+
contributionDate?: string;
|
|
134
|
+
};
|
|
135
|
+
/** An individual insight for the InsightSection */
|
|
136
|
+
export type InsightStruct = {
|
|
137
|
+
/**
|
|
138
|
+
* An image representing the insight
|
|
139
|
+
*/
|
|
140
|
+
image?: ImageType | AssetImageType;
|
|
141
|
+
/** The insight's title */
|
|
142
|
+
name?: TranslatableString;
|
|
143
|
+
/**
|
|
144
|
+
* The insight's category
|
|
145
|
+
*/
|
|
146
|
+
category?: TranslatableString | TranslatableRichText;
|
|
147
|
+
/** A UTC string for the insight's publish time (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ) */
|
|
148
|
+
publishTime?: string;
|
|
149
|
+
/** The insight's description */
|
|
150
|
+
description?: TranslatableRichText;
|
|
151
|
+
/** The insight's CTA */
|
|
152
|
+
cta: EnhancedTranslatableCTA;
|
|
153
|
+
};
|
|
154
|
+
/** Data for the InsightSection */
|
|
155
|
+
export type InsightSectionType = {
|
|
156
|
+
insights: Array<InsightStruct>;
|
|
157
|
+
};
|
|
158
|
+
/** Data for the TeamSection */
|
|
159
|
+
export type TeamSectionType = {
|
|
160
|
+
people: Array<PersonStruct>;
|
|
161
|
+
};
|
|
162
|
+
/** An individual person in the TeamSection */
|
|
163
|
+
export type PersonStruct = {
|
|
164
|
+
/**
|
|
165
|
+
* The person's headshot image
|
|
166
|
+
*/
|
|
167
|
+
headshot?: ImageType | AssetImageType;
|
|
168
|
+
/** The person's name */
|
|
169
|
+
name?: TranslatableString;
|
|
170
|
+
/** The person's job title */
|
|
171
|
+
title?: TranslatableString | TranslatableRichText;
|
|
172
|
+
/** The person's phone number. Format: +1234567890 */
|
|
173
|
+
phoneNumber?: string;
|
|
174
|
+
/** The person's email address */
|
|
175
|
+
email?: string;
|
|
176
|
+
/** A call to action for the person */
|
|
177
|
+
cta: EnhancedTranslatableCTA;
|
|
178
|
+
};
|
|
179
|
+
/** Represents a translatable string. The key is the locale (en, es, fr), and the value is the localized string. */
|
|
180
|
+
type LocalizedValues = {
|
|
181
|
+
hasLocalizedValue?: "true";
|
|
182
|
+
defaultValue?: string;
|
|
183
|
+
} & Record<string, string | undefined>;
|
|
184
|
+
/**
|
|
185
|
+
* A string that can be translated for different locales.
|
|
186
|
+
*/
|
|
187
|
+
export type TranslatableString = string | LocalizedValues;
|
|
188
|
+
/**
|
|
189
|
+
* Rich text that can be translated for different locales.
|
|
190
|
+
*/
|
|
191
|
+
export type TranslatableRichText = (string | RichText) | ({
|
|
192
|
+
hasLocalizedValue?: "true";
|
|
193
|
+
defaultValue?: string | RichText;
|
|
194
|
+
} & Record<string, string | RichText | undefined>);
|
|
195
|
+
/**
|
|
196
|
+
* A rich text object with HTML and JSON (LexicalRichText) representations.
|
|
197
|
+
* The HTML representation is used on the live page.
|
|
198
|
+
* The JSON representation is used in the editor for rich text editing.
|
|
199
|
+
*/
|
|
200
|
+
export type RichText = {
|
|
201
|
+
html?: string;
|
|
202
|
+
json?: string;
|
|
203
|
+
};
|
|
204
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type Video = {
|
|
2
|
+
/** The YouTube video URL */
|
|
3
|
+
url: string;
|
|
4
|
+
/** The YouTube video ID */
|
|
5
|
+
id: string;
|
|
6
|
+
/** The YouTube video title */
|
|
7
|
+
title: string;
|
|
8
|
+
/** The YouTube video thumbnail URL */
|
|
9
|
+
thumbnail: string;
|
|
10
|
+
/** The YouTube video duration */
|
|
11
|
+
duration: string;
|
|
12
|
+
/** The embedded YouTube video URL (https://youtube.com/embed/<video_id>) */
|
|
13
|
+
embeddedUrl: string;
|
|
14
|
+
};
|
|
15
|
+
export type AssetVideo = {
|
|
16
|
+
video: Video;
|
|
17
|
+
/** Asset video description field */
|
|
18
|
+
videoDescription?: string;
|
|
19
|
+
/** Asset name (unique) */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Asset internal id */
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** An object mapping translation keys to the translated values. Allows sub-objects. */
|
|
2
|
+
export type TranslationDictionary = {
|
|
3
|
+
[key: string]: string | TranslationDictionary;
|
|
4
|
+
};
|
|
5
|
+
/** A function that loads one complete locale dictionary on request. */
|
|
6
|
+
export type TranslationLoader = () => Promise<TranslationDictionary>;
|
|
7
|
+
/** Maps normalized locales to complete, ready-to-install dictionaries. */
|
|
8
|
+
export type TranslationLoaders = Partial<Record<string, TranslationLoader>>;
|
|
9
|
+
/** The complete translation loaders used by a Section Library runtime. */
|
|
10
|
+
export type SectionLibraryTranslationLoaders = {
|
|
11
|
+
platform: TranslationLoaders;
|
|
12
|
+
page: TranslationLoaders;
|
|
13
|
+
};
|
|
14
|
+
export declare const normalizeTranslationLocale: (locale: string) => string;
|
|
15
|
+
/** Loads a complete generated translation dictionary, falling back to English. */
|
|
16
|
+
export declare const loadTranslationDictionary: (locale: string, loaders: TranslationLoaders) => Promise<TranslationDictionary>;
|
|
17
|
+
/** Represents a collision between the built-in (visual-editor) translations and repo (section library) translations. */
|
|
18
|
+
export type TranslationShapeCollision = {
|
|
19
|
+
/** The translation key that has a conflict */
|
|
20
|
+
path: string;
|
|
21
|
+
/** The type of the built-in (visual-editor) value at this path. */
|
|
22
|
+
builtInType: "object" | "string";
|
|
23
|
+
/** The type of the repo (section library) value at this path. */
|
|
24
|
+
repoType: "object" | "string";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* mergeTranslationDictionaries combines the built-in (visual-editor) translations
|
|
28
|
+
* and repo (section library) translations using a deep merge.
|
|
29
|
+
* If a value is provided in both places, the repo value takes precedence.
|
|
30
|
+
* If there is a type conflict for a key (one source has an object and the other has a string),
|
|
31
|
+
* then the repo value still takes precedence but onShapeCollision is invoked.
|
|
32
|
+
*/
|
|
33
|
+
export declare const mergeTranslationDictionaries: (
|
|
34
|
+
/** The TranslationDictionary from the visual-editor library. */
|
|
35
|
+
builtIn: TranslationDictionary,
|
|
36
|
+
/** The TranslationDictionary from the section library repo. */
|
|
37
|
+
repo: TranslationDictionary,
|
|
38
|
+
/** A callback for when there is a type collision. */
|
|
39
|
+
onShapeCollision?: (collision: TranslationShapeCollision) => void,
|
|
40
|
+
/** Used for recursive merging. */
|
|
41
|
+
parentPath?: string) => TranslationDictionary;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms a locale into BCP-47 language format, e.g., "zh-Hans-HK"
|
|
3
|
+
*/
|
|
4
|
+
export declare const normalizeLocale: (locale: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Safely transforms all "locale" and "locales" fields in an object to BCP-47 format.
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeLocalesInObject(obj: any): any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RichText, TranslatableRichText, TranslatableString } from "../types/types.ts";
|
|
2
|
+
export declare const isRichText: (value: unknown) => value is RichText;
|
|
3
|
+
export declare const richTextHtmlToPlainText: (html?: string) => string;
|
|
4
|
+
export declare const richTextToPlainText: (value: string | RichText | undefined) => string;
|
|
5
|
+
export declare const translatableToPlainText: (value: TranslatableString | TranslatableRichText | undefined) => TranslatableString | undefined;
|
|
6
|
+
export declare const getLocalizedPlainText: (value: TranslatableString | TranslatableRichText | string | RichText | undefined, locale: string) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SectionLibraryLayout } from "../../types/sectionLibrary.ts";
|
|
2
|
+
type CreateLocalEditorArtifactsManagerOptions = {
|
|
3
|
+
localEditorTemplateSource: string;
|
|
4
|
+
localEditorDataTemplateSource: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Creates and removes the generated Local Editor Pages templates.
|
|
8
|
+
*
|
|
9
|
+
* 1. Write the Local Editor shell with one config import for each layout.
|
|
10
|
+
* 2. Write data templates for Entity and Directory layouts.
|
|
11
|
+
* 3. Remove only files that this feature generated.
|
|
12
|
+
*/
|
|
13
|
+
export declare const createLocalEditorArtifactsManager: ({ localEditorTemplateSource, localEditorDataTemplateSource, }: CreateLocalEditorArtifactsManagerOptions) => {
|
|
14
|
+
cleanupGeneratedLocalEditorArtifacts: (rootDir?: string) => void;
|
|
15
|
+
syncLocalEditorDataTemplates: (layouts: SectionLibraryLayout[], rootDir?: string) => void;
|
|
16
|
+
syncLocalEditorTemplate: (layouts: SectionLibraryLayout[], rootDir?: string) => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SectionLibraryLayout } from "../../types/sectionLibrary.ts";
|
|
2
|
+
import type { LocalEditorConfig, ResolvedLocalEditorConfig } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Loads the Local Editor stream settings for the Section Library layouts.
|
|
5
|
+
*
|
|
6
|
+
* 1. Load the root `stream.config.ts` file with tsx.
|
|
7
|
+
* 2. Merge global, page set, and layout settings.
|
|
8
|
+
* 3. Return diagnostics when the file is missing or invalid.
|
|
9
|
+
*/
|
|
10
|
+
export declare const readResolvedLayoutConfigs: (rootDir: string, layouts: SectionLibraryLayout[], diagnostics: string[]) => Promise<ResolvedLocalEditorConfig>;
|
|
11
|
+
export declare const resolveLocalEditorConfigs: (libraryLayouts: SectionLibraryLayout[], streamConfig: LocalEditorConfig) => ResolvedLocalEditorConfig;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SectionLibraryLayout } from "../../types/sectionLibrary.ts";
|
|
2
|
+
import type { LocalEditorDocumentResponse, LocalEditorManifestResponse } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Builds the manifest payload consumed by the `/local-editor` shell.
|
|
5
|
+
*
|
|
6
|
+
* The manifest exposes the available layouts, their entity options, and the
|
|
7
|
+
* effective default selection from layout defaults and snapshot data.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getLocalEditorManifest: (rootDir: string, libraryLayouts: SectionLibraryLayout[]) => Promise<LocalEditorManifestResponse>;
|
|
10
|
+
export declare const getLocalEditorDocument: (rootDir: string, libraryLayouts: SectionLibraryLayout[], layoutId?: string, entityId?: string, locale?: string, directoryChildCount?: number) => Promise<LocalEditorDocumentResponse>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { YextSchemaField } from "../../types/entityFields.ts";
|
|
2
|
+
import type { LocalEditorStreamDefinition } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Infers stream-field schema data from a local-editor snapshot document.
|
|
5
|
+
*
|
|
6
|
+
* This gives the local-editor shell enough entity-field metadata to power
|
|
7
|
+
* field selectors and embedded-field pickers without platform stream schema
|
|
8
|
+
* data.
|
|
9
|
+
*/
|
|
10
|
+
export declare const inferEntityFields: (document: Record<string, unknown> | Record<string, unknown>[], stream?: LocalEditorStreamDefinition) => {
|
|
11
|
+
fields: YextSchemaField[];
|
|
12
|
+
displayNames: Record<string, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedLocalEditorLayoutConfig } from "./types.ts";
|
|
2
|
+
type FixtureDocument = Record<string, unknown>;
|
|
3
|
+
export declare const MAX_LOCAL_EDITOR_DIRECTORY_CHILD_COUNT = 100;
|
|
4
|
+
/**
|
|
5
|
+
* Builds local-only Directory and Locator documents for layouts that cannot
|
|
6
|
+
* get documents from `yext pages generate-test-data`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createLocalEditorFixtureDocuments: (layouts: ResolvedLocalEditorLayoutConfig[], directoryChildCount?: number) => Array<{
|
|
9
|
+
layoutId: string;
|
|
10
|
+
document: FixtureDocument;
|
|
11
|
+
}>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PageSetType } from "../../types/sectionLibrary.ts";
|
|
2
|
+
export declare const DEFAULT_LOCAL_EDITOR_ROUTE = "/local-editor";
|
|
3
|
+
export declare const DEFAULT_LOCAL_EDITOR_STREAM_CONFIG_PATH = "stream.config.ts";
|
|
4
|
+
export declare const LOCAL_EDITOR_API_BASE_PATH = "/__yext_visual_editor/local-editor";
|
|
5
|
+
export declare const LOCAL_EDITOR_DATA_TEMPLATE_PREFIX = "local-editor-data-";
|
|
6
|
+
export declare const LEGACY_LOCAL_EDITOR_DATA_TEMPLATE_PATH = "src/templates/local-editor-data.tsx";
|
|
7
|
+
export declare const GENERATED_LOCAL_EDITOR_TEMPLATE_PREFIX = "/** THIS FILE IS AUTOGENERATED AND SHOULD NOT BE EDITED */";
|
|
8
|
+
/**
|
|
9
|
+
* Builds the generated data-template name used for one local-editor template.
|
|
10
|
+
*/
|
|
11
|
+
export declare const buildLocalEditorDataTemplateName: (layoutId: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the generated `src/templates/*.tsx` path for one local-editor data
|
|
14
|
+
* template.
|
|
15
|
+
*/
|
|
16
|
+
export declare const buildLocalEditorDataTemplatePath: (layoutId: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves a local-editor file path against the consumer root when needed.
|
|
19
|
+
*/
|
|
20
|
+
export declare const toAbsoluteLocalEditorPath: (rootDir: string, filePath: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Creates the default Local Editor stream configuration when a starter does
|
|
23
|
+
* not provide one. The starter owns the generated file after this write.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ensureLocalEditorStreamConfig: (rootDir: string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Injects template-specific placeholders into generated local-editor data
|
|
28
|
+
* template source.
|
|
29
|
+
*/
|
|
30
|
+
export declare const buildLocalEditorDataTemplateSource: (templateSource: string, streamConfigImportPath: string, layoutId: string, pageSetType: PageSetType) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Returns whether a template file was generated by the local-editor flow.
|
|
33
|
+
*/
|
|
34
|
+
export declare const isGeneratedLocalEditorTemplate: (templatePath: string) => boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SectionLibraryLayout } from "../../types/sectionLibrary.ts";
|
|
2
|
+
export type JsonResponseWriter = {
|
|
3
|
+
setHeader: (name: string, value: string) => void;
|
|
4
|
+
end: (chunk?: string) => void;
|
|
5
|
+
statusCode: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Handles requests for the local-editor JSON API endpoints.
|
|
9
|
+
*
|
|
10
|
+
* Returns whether the request was handled so the Vite middleware stack can
|
|
11
|
+
* fall through for non-local-editor routes.
|
|
12
|
+
*/
|
|
13
|
+
export declare const handleLocalEditorRequest: (requestUrl: string, response: JsonResponseWriter, layouts: SectionLibraryLayout[]) => Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Writes a JSON response using the minimal response interface needed by the
|
|
16
|
+
* local-editor server hooks.
|
|
17
|
+
*/
|
|
18
|
+
export declare const sendJsonResponse: (response: JsonResponseWriter, payload: unknown, statusCode?: number) => void;
|