@yext/visual-editor 2.0.0-beta.7 → 2.0.0-beta.9
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-DKUR2CCF.js → SectionLibraryVisualEditorProvider-Czy5e9wB.js} +28549 -24804
- package/dist/cli/assets/directory-locator-source/sectionLibrarySupport.ts +4 -0
- package/dist/cli/yextve.js +2 -2
- package/dist/{locatorEntityTypes-CBKnACVV.d.ts → createYextFieldTransforms-CPEwasy9.d.ts} +239 -26
- package/dist/index.d.ts +26 -65
- package/dist/plugin/plugin.js +1151 -1109
- package/dist/section-library-support.js +107 -105
- package/dist/sectionLibrarySupport.d.ts +2 -2
- package/dist/visual-editor.css +1 -1
- package/dist/visual-editor.js +8838 -12194
- package/package.json +2 -2
|
@@ -100,6 +100,8 @@ export {
|
|
|
100
100
|
toPuckFields,
|
|
101
101
|
type YextArrayField,
|
|
102
102
|
type YextComponentConfig,
|
|
103
|
+
type YextTransformedProps,
|
|
104
|
+
type ResolvedComprehensiveCTAValue,
|
|
103
105
|
type YextCustomFieldRenderProps,
|
|
104
106
|
type YextFieldDefinition,
|
|
105
107
|
type YextFieldMap,
|
|
@@ -108,6 +110,8 @@ export {
|
|
|
108
110
|
type YextPuckField,
|
|
109
111
|
} from "./fields/fields.ts";
|
|
110
112
|
export { YextAutoField } from "./fields/YextAutoField.tsx";
|
|
113
|
+
export { MaybeRTF } from "./components/helpers/maybeRTF.tsx";
|
|
114
|
+
export { createYextFieldTransforms } from "./fields/fieldTransforms/index.ts";
|
|
111
115
|
export { BackgroundProvider, useBackground } from "./hooks/useBackground.tsx";
|
|
112
116
|
export {
|
|
113
117
|
CardContextProvider,
|
package/dist/cli/yextve.js
CHANGED
|
@@ -12231,7 +12231,7 @@ import { fileURLToPath as fileURLToPath3 } from "url";
|
|
|
12231
12231
|
var package_default = {
|
|
12232
12232
|
name: "@yext/visual-editor",
|
|
12233
12233
|
description: "Component library for Yext Pages Visual Editor",
|
|
12234
|
-
version: "2.0.0-beta.
|
|
12234
|
+
version: "2.0.0-beta.9",
|
|
12235
12235
|
author: "sprumo@yext.com",
|
|
12236
12236
|
repository: {
|
|
12237
12237
|
type: "git",
|
|
@@ -12343,7 +12343,7 @@ var package_default = {
|
|
|
12343
12343
|
tsx: "^4.22.4",
|
|
12344
12344
|
typescript: "^5.5.4",
|
|
12345
12345
|
uuid: "11.0.3",
|
|
12346
|
-
zod: "^4.6.
|
|
12346
|
+
zod: "^4.6.7"
|
|
12347
12347
|
},
|
|
12348
12348
|
engines: {
|
|
12349
12349
|
node: "^20.6.0 || ^22 || ^24"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode, CSSProperties } from 'react';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
import { ImageType, CTA as CTA$1, LinkType, HoursType, HoursTableProps, ComplexImageType } from '@yext/pages-components';
|
|
5
|
-
import { BaseField, FieldProps, DefaultComponentProps, ComponentConfig, Field, ArrayField, ObjectField, Fields, CustomField, Config, ComponentData } from '@puckeditor/core';
|
|
6
|
-
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
|
-
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { BaseField, FieldProps, DefaultComponentProps, ComponentConfig, Field, ArrayField, ObjectField, Fields, CustomField, Config, ComponentData, FieldTransformFn } from '@puckeditor/core';
|
|
8
6
|
import * as _yext_search_headless_react from '@yext/search-headless-react';
|
|
9
7
|
import { SearchAnalyticsConfig } from '@yext/search-ui-react';
|
|
10
8
|
import { z } from 'zod';
|
|
11
9
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
10
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
11
|
+
import { VariantProps } from 'class-variance-authority';
|
|
12
12
|
import * as react_i18next from 'react-i18next';
|
|
13
13
|
import { TOptions } from 'i18next';
|
|
14
14
|
|
|
@@ -786,6 +786,11 @@ declare const isNonNormalizableLinkType: (linkType?: LinkType | string | null) =
|
|
|
786
786
|
*/
|
|
787
787
|
declare const normalizeLink: (content?: string, linkType?: LinkType) => string;
|
|
788
788
|
|
|
789
|
+
/** An authored theme color with render-ready CSS for both selected and contrasting colors. */
|
|
790
|
+
type ResolvedThemeColor = ThemeColor & {
|
|
791
|
+
selectedColorCss: string;
|
|
792
|
+
contrastingColorCss: string;
|
|
793
|
+
};
|
|
789
794
|
/**
|
|
790
795
|
* hexToRGB converts a hex color to rgb
|
|
791
796
|
* @param H hex string beginning with '#'
|
|
@@ -834,11 +839,11 @@ declare const getSurfaceColorStyle: (surfaceColor?: ThemeColor | string, streamD
|
|
|
834
839
|
*/
|
|
835
840
|
declare const getBackgroundColorClasses: (color?: ThemeColor) => string;
|
|
836
841
|
/**
|
|
837
|
-
* Resolves inline styles for bracketed custom colors in background contexts.
|
|
838
|
-
* @param color a ThemeColor object
|
|
842
|
+
* Resolves inline styles for resolved colors and bracketed custom colors in background contexts.
|
|
843
|
+
* @param color a ThemeColor or ResolvedThemeColor object
|
|
839
844
|
* @returns inline background/text color styles, e.g. `{ backgroundColor: "#FF6D66" }`
|
|
840
845
|
*/
|
|
841
|
-
declare const getBackgroundColorStyle: (color?: ThemeColor) => {
|
|
846
|
+
declare const getBackgroundColorStyle: (color?: ThemeColor | ResolvedThemeColor) => {
|
|
842
847
|
backgroundColor?: string;
|
|
843
848
|
color?: string;
|
|
844
849
|
} | undefined;
|
|
@@ -955,11 +960,27 @@ type BasicSelectorFieldWithGroups = BasicSelectorFieldBase & {
|
|
|
955
960
|
optionGroups: ComboboxOptionGroup[];
|
|
956
961
|
};
|
|
957
962
|
type BasicSelectorField = BasicSelectorFieldWithOptions | BasicSelectorFieldWithGroups;
|
|
958
|
-
|
|
959
|
-
declare const BasicSelectorFieldOverride: (
|
|
963
|
+
/** Keeps shipped color selectors editable while new configs use themeColor. */
|
|
964
|
+
declare const BasicSelectorFieldOverride: (props: FieldProps<BasicSelectorField>) => React__default.JSX.Element;
|
|
965
|
+
|
|
966
|
+
/** Theme colors always retain authored tokens and resolve both CSS colors. */
|
|
967
|
+
type ThemeColorField = BaseField & {
|
|
968
|
+
type: "themeColor";
|
|
969
|
+
/** Selects site or background palette choices. */
|
|
970
|
+
options: "SITE_COLOR" | "BACKGROUND_COLOR";
|
|
971
|
+
label?: string | MsgString;
|
|
972
|
+
visible?: boolean;
|
|
973
|
+
translateOptions?: boolean;
|
|
974
|
+
noOptionsPlaceholder?: string | MsgString;
|
|
975
|
+
noOptionsMessage?: string | MsgString;
|
|
976
|
+
disableSearch?: boolean;
|
|
977
|
+
};
|
|
978
|
+
/** Edits palette and custom ThemeColor values without changing their authored shape. */
|
|
979
|
+
declare const ThemeColorFieldOverride: ({ field, value, onChange, }: FieldProps<ThemeColorField, ThemeColor | undefined>) => React__default.JSX.Element;
|
|
960
980
|
|
|
961
981
|
type CodeLanguageOptions = "html" | "css" | "json" | "shell" | "java" | "javascript" | "jsx" | "markdown" | "typescript";
|
|
962
982
|
type CodeField = BaseField & {
|
|
983
|
+
/** Processes HTML templates and JavaScript embedded fields; other code stays authored. */
|
|
963
984
|
type: "code";
|
|
964
985
|
label?: string | MsgString;
|
|
965
986
|
visible?: boolean;
|
|
@@ -1022,12 +1043,18 @@ type YextCTAField = YextEntityField<EnhancedTranslatableCTA> & {
|
|
|
1022
1043
|
};
|
|
1023
1044
|
type CTASelectorField = BaseField & {
|
|
1024
1045
|
type: "ctaSelector";
|
|
1046
|
+
/** Resolves the CTA source, localized text, and directions URL before rendering. */
|
|
1047
|
+
transform?: boolean;
|
|
1025
1048
|
label?: string | MsgString;
|
|
1026
1049
|
visible?: boolean;
|
|
1027
1050
|
disableConstantValueToggle?: boolean;
|
|
1028
1051
|
};
|
|
1029
1052
|
type CTASelectorFieldProps = FieldProps<CTASelectorField>;
|
|
1030
|
-
|
|
1053
|
+
/**
|
|
1054
|
+
* Renders CTA source controls. Its declaration is available when the field
|
|
1055
|
+
* registry initializes.
|
|
1056
|
+
*/
|
|
1057
|
+
declare function CTASelectorFieldOverride({ field, value, onChange, }: CTASelectorFieldProps): React__default.JSX.Element;
|
|
1031
1058
|
|
|
1032
1059
|
type MultiSelectorOptionValue = string | number | boolean;
|
|
1033
1060
|
type MultiSelectorOptionSelection<T extends MultiSelectorOptionValue> = {
|
|
@@ -1070,18 +1097,25 @@ type MultiSelectorOptions<T extends MultiSelectorOptionValue> = MultiSelectorOpt
|
|
|
1070
1097
|
*/
|
|
1071
1098
|
type MultiSelectorField<T extends MultiSelectorOptionValue = any> = BaseField & {
|
|
1072
1099
|
type: "multiSelector";
|
|
1100
|
+
/** Returns the selected values as an array before rendering. */
|
|
1101
|
+
transform?: boolean;
|
|
1073
1102
|
label: string | MsgString;
|
|
1074
1103
|
dropdownLabel: string | MsgString;
|
|
1075
1104
|
options: MultiSelectorOptions<T>;
|
|
1076
1105
|
placeholderOptionLabel?: string | MsgString;
|
|
1077
1106
|
};
|
|
1078
1107
|
type MultiSelectorFieldProps<T extends MultiSelectorOptionValue> = FieldProps<MultiSelectorField<T>, MultiSelectorValue<T> | undefined>;
|
|
1079
|
-
/**
|
|
1080
|
-
|
|
1108
|
+
/**
|
|
1109
|
+
* A multi-select field whose options may be static or loaded from a function.
|
|
1110
|
+
* Its declaration is available when the field registry initializes.
|
|
1111
|
+
*/
|
|
1112
|
+
declare function MultiSelectorFieldOverride<T extends MultiSelectorOptionValue>({ field, value, onChange, id, readOnly, }: MultiSelectorFieldProps<T>): React.JSX.Element;
|
|
1081
1113
|
|
|
1082
1114
|
type OptionalNumberValue = number | string | null | undefined;
|
|
1083
1115
|
type OptionalNumberField = BaseField & {
|
|
1084
1116
|
type: "optionalNumber";
|
|
1117
|
+
/** Returns a number or undefined before rendering. */
|
|
1118
|
+
transform?: boolean;
|
|
1085
1119
|
label?: string | MsgString;
|
|
1086
1120
|
hideNumberFieldRadioLabel: string | MsgString;
|
|
1087
1121
|
showNumberFieldRadioLabel: string | MsgString;
|
|
@@ -1206,6 +1240,8 @@ type ImagePayload = {
|
|
|
1206
1240
|
};
|
|
1207
1241
|
type ImageField = BaseField & {
|
|
1208
1242
|
type: "image";
|
|
1243
|
+
/** Localizes the asset image and resolves its alt text before rendering. */
|
|
1244
|
+
transform?: boolean;
|
|
1209
1245
|
label?: string | MsgString;
|
|
1210
1246
|
visible?: boolean;
|
|
1211
1247
|
hideAltTextField?: boolean;
|
|
@@ -1214,7 +1250,11 @@ type ImageField = BaseField & {
|
|
|
1214
1250
|
};
|
|
1215
1251
|
type ImageFieldOverrideProps = FieldProps<ImageField>;
|
|
1216
1252
|
declare const buildLocatorDisplayOptions: (locatorDisplayFields?: Record<string, FieldTypeData>) => EmbeddedStringOption[];
|
|
1217
|
-
|
|
1253
|
+
/**
|
|
1254
|
+
* Renders image field controls. Its declaration is available when the field
|
|
1255
|
+
* registry initializes.
|
|
1256
|
+
*/
|
|
1257
|
+
declare function ImageFieldOverride({ field, onChange, value, }: ImageFieldOverrideProps): React__default.JSX.Element;
|
|
1218
1258
|
|
|
1219
1259
|
/**
|
|
1220
1260
|
* Defines the core typography styling properties shared across text-based components.
|
|
@@ -1233,6 +1273,8 @@ type StyledButtonValue = BaseTextStyles & {
|
|
|
1233
1273
|
};
|
|
1234
1274
|
type StyledButtonField = BaseField & {
|
|
1235
1275
|
type: "styledButton";
|
|
1276
|
+
/** Converts authored button typography into CSS styles. */
|
|
1277
|
+
transform?: boolean;
|
|
1236
1278
|
label?: string | MsgString;
|
|
1237
1279
|
visible?: boolean;
|
|
1238
1280
|
};
|
|
@@ -1244,6 +1286,8 @@ type StyledImageValue = {
|
|
|
1244
1286
|
};
|
|
1245
1287
|
type StyledImageField = BaseField & {
|
|
1246
1288
|
type: "styledImage";
|
|
1289
|
+
/** Converts the authored border radius into CSS styles. */
|
|
1290
|
+
transform?: boolean;
|
|
1247
1291
|
label?: string | MsgString;
|
|
1248
1292
|
visible?: boolean;
|
|
1249
1293
|
};
|
|
@@ -1256,6 +1300,8 @@ type StyledLinkValue = BaseTextStyles & {
|
|
|
1256
1300
|
};
|
|
1257
1301
|
type StyledLinkField = BaseField & {
|
|
1258
1302
|
type: "styledLink";
|
|
1303
|
+
/** Converts authored link typography and caret choice into CSS styles. */
|
|
1304
|
+
transform?: boolean;
|
|
1259
1305
|
label?: string | MsgString;
|
|
1260
1306
|
visible?: boolean;
|
|
1261
1307
|
showIncludeCaretField?: boolean;
|
|
@@ -1275,6 +1321,8 @@ type ContentWidthValue = "default" | "768px" | "960px" | "1024px" | "1280px" | "
|
|
|
1275
1321
|
type VerticalPaddingValue = "default" | "0px" | "2px" | "4px" | "6px" | "8px" | "10px" | "12px" | "14px" | "16px" | "20px" | "24px" | "28px" | "32px" | "36px" | "40px" | "44px" | "48px" | "56px" | "64px" | "80px" | "96px";
|
|
1276
1322
|
type StyledPageSectionField = BaseField & {
|
|
1277
1323
|
type: "styledPageSection";
|
|
1324
|
+
/** Converts authored width and padding choices into CSS styles. */
|
|
1325
|
+
transform?: boolean;
|
|
1278
1326
|
label?: string | MsgString;
|
|
1279
1327
|
visible?: boolean;
|
|
1280
1328
|
};
|
|
@@ -1286,6 +1334,8 @@ type StyledTextValue = BaseTextStyles & {
|
|
|
1286
1334
|
};
|
|
1287
1335
|
type StyledTextField = BaseField & {
|
|
1288
1336
|
type: "styledText";
|
|
1337
|
+
/** Converts authored typography and color choices into CSS styles. */
|
|
1338
|
+
transform?: boolean;
|
|
1289
1339
|
label?: string | MsgString;
|
|
1290
1340
|
visible?: boolean;
|
|
1291
1341
|
includeColor?: boolean;
|
|
@@ -1296,6 +1346,8 @@ declare const StyledTextFieldOverride: ({ field, value, onChange, }: StyledTextF
|
|
|
1296
1346
|
|
|
1297
1347
|
type TranslatableStringField = BaseField & {
|
|
1298
1348
|
type: "translatableString";
|
|
1349
|
+
/** Localizes and interpolates this field before rendering. */
|
|
1350
|
+
transform?: boolean;
|
|
1299
1351
|
label?: string | MsgString;
|
|
1300
1352
|
visible?: boolean;
|
|
1301
1353
|
filter?: RenderEntityFieldFilter<any>;
|
|
@@ -1310,6 +1362,8 @@ declare const TranslatableStringFieldOverride: ({ field, onChange, value, }: Tra
|
|
|
1310
1362
|
|
|
1311
1363
|
type VideoField = BaseField & {
|
|
1312
1364
|
type: "video";
|
|
1365
|
+
/** Resolves embedded fields in the video asset before rendering. */
|
|
1366
|
+
transform?: boolean;
|
|
1313
1367
|
label?: string | MsgString;
|
|
1314
1368
|
visible?: boolean;
|
|
1315
1369
|
};
|
|
@@ -1414,15 +1468,131 @@ type ComprehensiveCTAValue = {
|
|
|
1414
1468
|
};
|
|
1415
1469
|
type ComprehensiveCTAField = BaseField & {
|
|
1416
1470
|
type: "comprehensiveCTA";
|
|
1471
|
+
/** Resolves CTA bindings and translated text before rendering. */
|
|
1472
|
+
transform?: boolean;
|
|
1417
1473
|
label?: string | MsgString;
|
|
1418
1474
|
visible?: boolean;
|
|
1419
1475
|
disableConstantValueToggle?: boolean;
|
|
1420
1476
|
};
|
|
1421
1477
|
type ComprehensiveCTAFieldProps = FieldProps<ComprehensiveCTAField, ComprehensiveCTAValue>;
|
|
1422
|
-
|
|
1478
|
+
/**
|
|
1479
|
+
* ComprehensiveCTAField imports YextAutoField, which uses the field override registry.
|
|
1480
|
+
* A function declaration lets the registry reference this override during module initialization.
|
|
1481
|
+
*/
|
|
1482
|
+
declare function ComprehensiveCTAFieldOverride({ field, value, onChange, }: ComprehensiveCTAFieldProps): React__default.JSX.Element;
|
|
1423
1483
|
|
|
1484
|
+
type FieldTransformContext = {
|
|
1485
|
+
streamDocument: StreamDocument;
|
|
1486
|
+
locale: string;
|
|
1487
|
+
/** The complete linked item, including primitive list items. */
|
|
1488
|
+
itemDocument?: unknown;
|
|
1489
|
+
};
|
|
1490
|
+
|
|
1491
|
+
declare const alwaysTransformedFieldTypes: readonly ["code", "themeColor"];
|
|
1492
|
+
|
|
1493
|
+
/** Maps explicit entity-field formats to their render-value conversion. */
|
|
1494
|
+
declare const entityFieldFormatters: {
|
|
1495
|
+
price: (value: ProductPrice | undefined, context: FieldTransformContext) => string | undefined;
|
|
1496
|
+
};
|
|
1497
|
+
|
|
1498
|
+
type LocalizedRenderValue<Value> = Value extends readonly (infer Item)[] ? LocalizedRenderValue<Item>[] : Value extends object ? "defaultValue" extends keyof Value ? LocalizedRenderValue<Value["defaultValue"]> : {
|
|
1499
|
+
[Key in keyof Value]: LocalizedRenderValue<Value[Key]>;
|
|
1500
|
+
} : Value;
|
|
1501
|
+
/** CTA data after localized text and links are resolved for rendering. */
|
|
1502
|
+
type ResolvedCTAValue = {
|
|
1503
|
+
link: string;
|
|
1504
|
+
label?: string;
|
|
1505
|
+
linkType?: LinkType;
|
|
1506
|
+
normalizeLink?: boolean;
|
|
1507
|
+
openInNewTab?: boolean;
|
|
1508
|
+
ctaType?: "textAndLink" | "getDirections" | "presetImage";
|
|
1509
|
+
};
|
|
1510
|
+
/** The presentation component consumes this data contract without resolving authored bindings. */
|
|
1511
|
+
type ResolvedComprehensiveCTAValue = Omit<ComprehensiveCTAValue, "data"> & {
|
|
1512
|
+
data: Omit<ComprehensiveCTAValue["data"], "cta" | "buttonText" | "ariaLabel"> & {
|
|
1513
|
+
cta: ResolvedCTAValue | undefined;
|
|
1514
|
+
buttonText?: string;
|
|
1515
|
+
ariaLabel?: string;
|
|
1516
|
+
};
|
|
1517
|
+
};
|
|
1518
|
+
/** Retains value-based inference for item sources with widened field definitions. */
|
|
1519
|
+
type ResolvedRepeatedValue<Value> = Value extends {
|
|
1520
|
+
constantValue: infer Constant;
|
|
1521
|
+
} ? LocalizedRenderValue<Constant> | undefined : Value extends ComprehensiveCTAValue ? ResolvedComprehensiveCTAValue : Value extends {
|
|
1522
|
+
selections: {
|
|
1523
|
+
value: infer Selection;
|
|
1524
|
+
}[];
|
|
1525
|
+
} ? Exclude<Selection, undefined>[] : Value extends readonly (infer Item)[] ? ResolvedRepeatedValue<Item>[] : Value extends object ? {
|
|
1526
|
+
[Key in keyof Value]: ResolvedRepeatedValue<Value[Key]>;
|
|
1527
|
+
} : Value;
|
|
1528
|
+
/** Repeated sources transform all mapped fields, even without a child opt-in. */
|
|
1529
|
+
type ResolvedRepeatedItem<Value, Definitions> = Value extends readonly (infer Item)[] ? ResolvedRepeatedItem<Item, Definitions>[] : {
|
|
1530
|
+
[Key in keyof Value]: Key extends keyof Definitions ? ResolvedRepeatedFieldValue<Value[Key], Definitions[Key]> : LocalizedRenderValue<Value[Key]>;
|
|
1531
|
+
};
|
|
1532
|
+
type ResolvedRepeatedFieldValue<Value, Definition> = YextFieldDefinition["type"] extends (Definition extends {
|
|
1533
|
+
type: infer FieldType;
|
|
1534
|
+
} ? FieldType : never) ? ResolvedRepeatedValue<Value> : Definition extends {
|
|
1535
|
+
type: "object";
|
|
1536
|
+
objectFields: infer Fields;
|
|
1537
|
+
} ? ResolvedRepeatedItem<Value, Fields> : Definition extends {
|
|
1538
|
+
type: "array";
|
|
1539
|
+
arrayFields: infer Fields;
|
|
1540
|
+
} ? ResolvedRepeatedItem<Value, Fields> : Definition extends {
|
|
1541
|
+
type: infer FieldType;
|
|
1542
|
+
} ? FieldType extends keyof TransformedFieldValues<Value, Definition> ? TransformedFieldValues<Value, Definition>[FieldType] : LocalizedRenderValue<Value> : LocalizedRenderValue<Value>;
|
|
1543
|
+
type TransformedFieldValues<Value, Definition> = {
|
|
1544
|
+
themeColor: ResolvedThemeColor | undefined;
|
|
1545
|
+
code: string;
|
|
1546
|
+
styledText: CSSProperties;
|
|
1547
|
+
styledButton: CSSProperties;
|
|
1548
|
+
styledLink: CSSProperties;
|
|
1549
|
+
styledImage: CSSProperties;
|
|
1550
|
+
styledPageSection: CSSProperties;
|
|
1551
|
+
translatableString: string;
|
|
1552
|
+
image: LocalizedRenderValue<Value>;
|
|
1553
|
+
video: LocalizedRenderValue<Value>;
|
|
1554
|
+
comprehensiveCTA: ResolvedComprehensiveCTAValue;
|
|
1555
|
+
multiSelector: Value extends {
|
|
1556
|
+
selections: {
|
|
1557
|
+
value: infer Selection;
|
|
1558
|
+
}[];
|
|
1559
|
+
} ? Exclude<Selection, undefined>[] : never;
|
|
1560
|
+
optionalNumber: number | undefined;
|
|
1561
|
+
ctaSelector: LocalizedRenderValue<EnhancedTranslatableCTA> | undefined;
|
|
1562
|
+
entityField: Definition extends {
|
|
1563
|
+
format: infer Format;
|
|
1564
|
+
} ? Format extends keyof typeof entityFieldFormatters ? ReturnType<(typeof entityFieldFormatters)[Format]> : never : Definition extends {
|
|
1565
|
+
repeated: {
|
|
1566
|
+
mappingFields: infer Fields;
|
|
1567
|
+
};
|
|
1568
|
+
} ? Value extends {
|
|
1569
|
+
constantValue: infer Constant;
|
|
1570
|
+
} ? ResolvedRepeatedItem<Constant, Fields> : never : Value extends {
|
|
1571
|
+
constantValue: infer Constant;
|
|
1572
|
+
} ? LocalizedRenderValue<Constant> | undefined : never;
|
|
1573
|
+
};
|
|
1574
|
+
/** Derives render prop types for nested object fields and array items; leaves other values unchanged. */
|
|
1575
|
+
type NestedFieldValue<Value, Definition> = Definition extends {
|
|
1576
|
+
type: "object";
|
|
1577
|
+
objectFields: object;
|
|
1578
|
+
} ? YextTransformedProps<Value, Definition["objectFields"]> : Definition extends {
|
|
1579
|
+
type: "array";
|
|
1580
|
+
arrayFields: object;
|
|
1581
|
+
} ? Value extends unknown[] ? YextTransformedProps<Value[number], Definition["arrayFields"]>[] : Value : Value;
|
|
1582
|
+
type TransformedFieldValue<Value, Definition> = Definition extends {
|
|
1583
|
+
transform: true;
|
|
1584
|
+
} | {
|
|
1585
|
+
type: (typeof alwaysTransformedFieldTypes)[number];
|
|
1586
|
+
} ? Definition extends {
|
|
1587
|
+
type: infer FieldType;
|
|
1588
|
+
} ? FieldType extends keyof TransformedFieldValues<Value, Definition> ? TransformedFieldValues<Value, Definition>[FieldType] : Value : Value : NestedFieldValue<Value, Definition>;
|
|
1589
|
+
/** Derives render values from authored props and supported field definitions. */
|
|
1590
|
+
type YextTransformedProps<Props, Definitions> = {
|
|
1591
|
+
[Key in keyof Props]: Key extends keyof Definitions ? TransformedFieldValue<Props[Key], Definitions[Key]> : Props[Key];
|
|
1592
|
+
};
|
|
1424
1593
|
type YextPuckFields = {
|
|
1425
1594
|
basicSelector: BasicSelectorField;
|
|
1595
|
+
themeColor: ThemeColorField;
|
|
1426
1596
|
ctaSelector: CTASelectorField;
|
|
1427
1597
|
code: CodeField;
|
|
1428
1598
|
comprehensiveCTA: ComprehensiveCTAField;
|
|
@@ -1464,10 +1634,14 @@ type LayoutGenerationMetadata = {
|
|
|
1464
1634
|
resolvedProps?: string[];
|
|
1465
1635
|
slottedItemSource?: SlottedItemSourceGenerationMetadata;
|
|
1466
1636
|
};
|
|
1467
|
-
type YextComponentConfig<Props extends DefaultComponentProps = DefaultComponentProps> = Omit<ComponentConfig<{
|
|
1637
|
+
type YextComponentConfig<Props extends DefaultComponentProps = DefaultComponentProps, TransformFields = {}> = Omit<ComponentConfig<{
|
|
1468
1638
|
props: Props;
|
|
1469
1639
|
fields: YextPuckFields;
|
|
1470
|
-
}>, "fields" | "resolveFields"> & {
|
|
1640
|
+
}>, "fields" | "resolveFields" | "render"> & {
|
|
1641
|
+
render: ComponentConfig<{
|
|
1642
|
+
props: YextTransformedProps<Props, TransformFields>;
|
|
1643
|
+
fields: YextPuckFields;
|
|
1644
|
+
}>["render"];
|
|
1471
1645
|
fields?: YextFields<Props>;
|
|
1472
1646
|
layoutGenerationMetadata?: LayoutGenerationMetadata;
|
|
1473
1647
|
resolveFields?: ComponentConfig<{
|
|
@@ -1500,7 +1674,7 @@ declare const toPuckFields: <Props extends DefaultComponentProps = DefaultCompon
|
|
|
1500
1674
|
* 2. Define the repeated entity-field value shape returned to consumers.
|
|
1501
1675
|
* 3. Define the resolved item shape returned by `resolveItems(...)`.
|
|
1502
1676
|
*/
|
|
1503
|
-
type CreateItemSourceOptions<TItemProps extends Record<string, unknown>> = {
|
|
1677
|
+
type CreateItemSourceOptions<TItemProps extends Record<string, unknown>, MappingFields extends YextFieldMap<TItemProps> = YextFieldMap<TItemProps>> = {
|
|
1504
1678
|
/** Label shown above the item source controls. */
|
|
1505
1679
|
label: string;
|
|
1506
1680
|
/**
|
|
@@ -1509,18 +1683,21 @@ type CreateItemSourceOptions<TItemProps extends Record<string, unknown>> = {
|
|
|
1509
1683
|
* A list can be selected when its item type or a child field matches any
|
|
1510
1684
|
* mapping field filter.
|
|
1511
1685
|
*/
|
|
1512
|
-
mappingFields:
|
|
1686
|
+
mappingFields: MappingFields;
|
|
1513
1687
|
/** Initial manual items. The first item is also the template for new items. */
|
|
1514
1688
|
defaultValues?: TItemProps[];
|
|
1515
1689
|
};
|
|
1516
1690
|
type RepeatedEntityFieldValue<TItemProps extends Record<string, unknown>> = YextEntityField<TItemProps[], TItemProps>;
|
|
1517
|
-
type RepeatedEntityFieldMetadata<TItemProps extends Record<string, unknown>> = {
|
|
1518
|
-
mappingFields:
|
|
1691
|
+
type RepeatedEntityFieldMetadata<TItemProps extends Record<string, unknown>, MappingFields extends YextFieldMap<TItemProps> = YextFieldMap<TItemProps>> = {
|
|
1692
|
+
mappingFields: MappingFields;
|
|
1519
1693
|
manualItemFields: YextFieldMap<TItemProps>;
|
|
1520
1694
|
defaultItemValue: TItemProps;
|
|
1521
1695
|
defaultMappings: TItemProps;
|
|
1522
1696
|
manualItemSummary?: (item: unknown, index?: number) => string;
|
|
1523
1697
|
};
|
|
1698
|
+
type RepeatedEntityFieldDefinition<TItemProps extends Record<string, unknown>, MappingFields extends YextFieldMap<TItemProps> = YextFieldMap<TItemProps>> = EntityFieldSelectorField<RepeatedEntityFieldValue<TItemProps>> & {
|
|
1699
|
+
repeated: RepeatedEntityFieldMetadata<TItemProps, MappingFields>;
|
|
1700
|
+
};
|
|
1524
1701
|
/**
|
|
1525
1702
|
* Resolves authored item fields into the render-ready value shape returned
|
|
1526
1703
|
* from `ItemSourceInstance.resolveItems(...)`.
|
|
@@ -1531,8 +1708,8 @@ type ResolvedItemField<TValue> = TValue extends YextEntityField<infer TResolved,
|
|
|
1531
1708
|
/**
|
|
1532
1709
|
* Public contract returned by `createItemSource(...)`.
|
|
1533
1710
|
*/
|
|
1534
|
-
type ItemSourceInstance<TItemProps extends Record<string, unknown>> = {
|
|
1535
|
-
field:
|
|
1711
|
+
type ItemSourceInstance<TItemProps extends Record<string, unknown>, MappingFields extends YextFieldMap<TItemProps> = YextFieldMap<TItemProps>> = {
|
|
1712
|
+
field: RepeatedEntityFieldDefinition<TItemProps, MappingFields>;
|
|
1536
1713
|
defaultValue: RepeatedEntityFieldValue<TItemProps>;
|
|
1537
1714
|
value: RepeatedEntityFieldValue<TItemProps>;
|
|
1538
1715
|
resolveItems: (value: RepeatedEntityFieldValue<TItemProps> | undefined, streamDocument: StreamDocument) => ResolvedItemField<TItemProps>[];
|
|
@@ -1583,6 +1760,10 @@ type SlottedItemSourceInstance<TMappings extends Record<string, unknown>> = {
|
|
|
1583
1760
|
|
|
1584
1761
|
type EntityFieldSelectorField<T extends Record<string, any> = Record<string, any>> = BaseField & {
|
|
1585
1762
|
type: "entityField";
|
|
1763
|
+
/** Resolves this field before rendering. Repeated sources are not supported. */
|
|
1764
|
+
transform?: boolean;
|
|
1765
|
+
/** Formats a resolved structured price as localized currency when transformed. */
|
|
1766
|
+
format?: "price";
|
|
1586
1767
|
label?: string | MsgString;
|
|
1587
1768
|
visible?: boolean;
|
|
1588
1769
|
filter: MappedSourceFieldFilter<T>;
|
|
@@ -1603,7 +1784,11 @@ type EntityFieldSelectorField<T extends Record<string, any> = Record<string, any
|
|
|
1603
1784
|
repeated?: RepeatedEntityFieldMetadata<any>;
|
|
1604
1785
|
};
|
|
1605
1786
|
type EntityFieldSelectorFieldProps = FieldProps<EntityFieldSelectorField>;
|
|
1606
|
-
|
|
1787
|
+
/**
|
|
1788
|
+
* Renders entity field controls. Its declaration is available when the field
|
|
1789
|
+
* registry initializes.
|
|
1790
|
+
*/
|
|
1791
|
+
declare function EntityFieldSelectorFieldOverride({ field, value, onChange, }: EntityFieldSelectorFieldProps): React__default.JSX.Element;
|
|
1607
1792
|
declare const ConstantValueModeToggler: ({ fieldTypeFilter, constantValueEnabled, toggleConstantValueEnabled, disableConstantValue, label, showLocale, infoTooltipRequirements, }: {
|
|
1608
1793
|
fieldTypeFilter: EntityFieldTypes[];
|
|
1609
1794
|
constantValueEnabled: boolean;
|
|
@@ -1750,7 +1935,7 @@ declare const AccordionTrigger: React__default.ForwardRefExoticComponent<React__
|
|
|
1750
1935
|
declare const AccordionContent: React__default.ForwardRefExoticComponent<React__default.HTMLAttributes<HTMLDivElement> & React__default.RefAttributes<HTMLDivElement>>;
|
|
1751
1936
|
|
|
1752
1937
|
interface BackgroundProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1753
|
-
background?: ThemeColor;
|
|
1938
|
+
background?: ThemeColor | ResolvedThemeColor;
|
|
1754
1939
|
as?: "div" | "section" | "nav" | "header" | "footer" | "main" | "aside";
|
|
1755
1940
|
}
|
|
1756
1941
|
declare const Background: React.ForwardRefExoticComponent<BackgroundProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1849,7 +2034,7 @@ declare const maxWidthVariants: (props?: ({
|
|
|
1849
2034
|
maxWidth?: "768px" | "960px" | "1024px" | "1280px" | "1440px" | "theme" | "fullWidth" | null | undefined;
|
|
1850
2035
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1851
2036
|
interface PageSectionProps extends VariantProps<typeof maxWidthVariants>, React.HTMLAttributes<HTMLDivElement> {
|
|
1852
|
-
background?: ThemeColor;
|
|
2037
|
+
background?: ThemeColor | ResolvedThemeColor;
|
|
1853
2038
|
verticalPadding?: VariantProps<typeof pageSectionVariants>["verticalPadding"];
|
|
1854
2039
|
as?: "div" | "section" | "nav" | "header" | "footer" | "main" | "aside";
|
|
1855
2040
|
outerClassName?: string;
|
|
@@ -1914,4 +2099,32 @@ declare function isLocatorEntityType(value: string): value is LocatorEntityType;
|
|
|
1914
2099
|
declare const getLocatorEntityTypeSourceMap: (streamDocument?: StreamDocument) => Partial<Record<LocatorEntityType, string | undefined>>;
|
|
1915
2100
|
declare const getEntityTypeLabel: (entityType: LocatorEntityType) => string;
|
|
1916
2101
|
|
|
1917
|
-
|
|
2102
|
+
type RichTextStyleOverrides = Partial<BaseTextStyles> & {
|
|
2103
|
+
color?: ThemeColor | string;
|
|
2104
|
+
};
|
|
2105
|
+
interface MaybeRTFProps extends Record<string, any> {
|
|
2106
|
+
data: RichText | string | undefined;
|
|
2107
|
+
bodyVariant?: BodyProps["variant"];
|
|
2108
|
+
/** Override the theme's styling */
|
|
2109
|
+
richTextStyleOverrides?: RichTextStyleOverrides;
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Renders plain strings through the shared `Body` component and rich text HTML
|
|
2113
|
+
* through the standard `rtf-wrapper` container while applying shared rich-text
|
|
2114
|
+
* typography and color overrides.
|
|
2115
|
+
*/
|
|
2116
|
+
declare const MaybeRTF: ({ data, bodyVariant, richTextStyleOverrides, style, className, ...props }: MaybeRTFProps) => React.JSX.Element;
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Creates render transforms for one page and locale.
|
|
2120
|
+
*
|
|
2121
|
+
* 1. Identify always-transformed and opted-in authored fields, including fields adapted to `custom`.
|
|
2122
|
+
* 2. Dispatch source resolution to the field handler, sharing localization and interpolation.
|
|
2123
|
+
* 3. Register handlers with Puck while preserving resolved data shapes for their renderers.
|
|
2124
|
+
* Authored values are never mutated or replaced in saved Puck data.
|
|
2125
|
+
*/
|
|
2126
|
+
declare function createYextFieldTransforms(streamDocument: StreamDocument, locale: string): Record<string, FieldTransformFn<BaseField & {
|
|
2127
|
+
type: string;
|
|
2128
|
+
}>>;
|
|
2129
|
+
|
|
2130
|
+
export { type StyledPageSectionValue as $, type AiPageGeneration as A, type BasicSelectorField as B, type CreateItemSourceOptions as C, type DateTimeSelectorField as D, type EntityFieldTypes as E, type FontRegistry as F, EntityFieldSelectorFieldOverride as G, type HeadingProps as H, type ItemSourceInstance as I, MultiSelectorFieldOverride as J, type FontSizeSelectorField as K, type LocatorEntityType as L, type MsgString as M, ImageFieldOverride as N, type OptionalNumberField as O, type ProductPrice as P, type StyledButtonField as Q, type RichText as R, type StreamFields as S, type TranslationDictionary as T, type StyledButtonValue as U, type StyledImageField as V, type StyledImageValue as W, type StyledLinkField as X, type YextFieldMap as Y, type StyledLinkValue as Z, type StyledPageSectionField as _, type StreamDocument as a, type MultiSelectorOptionValue as a$, type StyledTextField as a0, type TranslatableStringField as a1, type VideoField as a2, type AssetVideo as a3, type SectionLibraryTranslationLoaders as a4, Accordion as a5, AccordionContent as a6, AccordionItem as a7, AccordionTrigger as a8, type AssetImageType as a9, type FAQStruct as aA, FOOD_DELIVERY_SERVICES as aB, type Font as aC, FontSizeSelectorFieldOverride as aD, type FoodDeliveryServiceType as aE, type GenerationPromptBundle as aF, type GenerationSettings as aG, Heading as aH, type HeroSectionType as aI, HoursStatusAtom as aJ, type HoursStatusAtomProps as aK, HoursTableAtom as aL, type HoursTableAtomProps as aM, Image as aN, type ImageContentData as aO, type ImageField as aP, type ImageProps as aQ, type InsightSectionType as aR, type InsightStruct as aS, type LayoutGenerationMetadata as aT, type LocalizedAssetImage as aU, MaybeLink as aV, type MaybeLinkProps as aW, MaybeRTF as aX, type MaybeRTFProps as aY, type MultiSelectorField as aZ, type MultiSelectorOption as a_, Background as aa, type BackgroundProps as ab, BackgroundProvider as ac, BasicSelectorFieldOverride as ad, Body as ae, type BreadcrumbLink as af, Button as ag, type ButtonProps as ah, CTA as ai, type CTASelectorField as aj, CodeFieldOverride as ak, type ComprehensiveCTAField as al, type CreateSlottedItemSourceOptions as am, DateTimeSelectorFieldOverride as an, DropdownMenu as ao, DropdownMenuContent as ap, DropdownMenuItem as aq, DropdownMenuTrigger as ar, EmbeddedFieldStringInputFromEntity as as, EmbeddedFieldStringInputFromOptions as at, type EnhancedTranslatableCTA as au, EntityField as av, type EntityFieldSelectorField as aw, type EventSectionType as ax, type EventStruct as ay, type FAQSectionType as az, type ThemeConfig as b, generationPromptBundleSchema as b$, type MultiSelectorOptions as b0, OptionalNumberFieldOverride as b1, PageSection as b2, type PageSectionProps as b3, type PersonStruct as b4, PhoneAtom as b5, type PhoneAtomProps as b6, type PresetImageType as b7, type ProductSectionType as b8, type ProductStruct as b9, VisualEditorComponentsContentPath as bA, VisualEditorThemeClassSafelist as bB, type YextArrayField as bC, YextAutoField as bD, type YextCTAField as bE, type YextCustomFieldRenderProps as bF, YextEntityFieldSelector as bG, type YextFieldDefinition as bH, type YextFields as bI, type YextObjectField as bJ, type YextPuckField as bK, type YextSchemaField as bL, type YextSchemaFieldDefinition as bM, type YextTransformedProps as bN, backgroundColors as bO, bindSlots as bP, bodyVariants as bQ, buttonVariants as bR, constructFontSelectOptions as bS, createSearchAnalyticsConfig as bT, createSearchHeadlessConfig as bU, createSlottedItemSource as bV, createYextFieldTransforms as bW, deepMerge as bX, defaultFonts as bY, defaultThemeTailwindExtensions as bZ, fetchLocalesToPathsForEntity as b_, type PromoSectionType as ba, type RenderYextEntityFieldSelectorProps as bb, type ResolvedThemeColor as bc, type RichTextStyleOverrides as bd, type SlottedItemSourceGenerationMetadata as be, StyledButtonFieldOverride as bf, StyledImageFieldOverride as bg, StyledLinkFieldOverride as bh, StyledPageSectionFieldOverride as bi, StyledTextFieldOverride as bj, type TeamSectionType as bk, TemplatePropsContext as bl, type TestimonialSectionType as bm, type TestimonialStruct as bn, ThemeColorFieldOverride as bo, TimestampAtom as bp, type TimestampAtomProps as bq, TimestampOption as br, type TranslatableCTA as bs, TranslatableStringFieldOverride as bt, type TranslationLoader as bu, type TranslationLoaders as bv, VideoAtom as bw, type VideoAtomProps as bx, VideoFieldOverride as by, VisibilityWrapper as bz, type TailwindConfig as c, isNonNormalizableLinkType as c$, generationSettingsSchema as c0, getDefaultForegroundColor as c1, getFontWeightOptions as c2, getFontWeightOverrideOptions as c3, getPageMetadata as c4, getPreferredDistanceUnit as c5, getSurfaceColorStyle as c6, getThemeColorCssValue as c7, getThemeColorHexValue as c8, headingVariants as c9, ConstantValueModeToggler as cA, DEFAULT_ENTITY_TYPE as cB, type EmbeddedStringOption as cC, EntityTooltipsProvider as cD, type FieldResolution as cE, type FieldTypeData as cF, type ImagePayload as cG, type LocatorConfig as cH, type RootConfig as cI, buildLocatorDisplayOptions as cJ, findField as cK, formatDistance as cL, formatPhoneNumber as cM, fromMeters as cN, getBackgroundColorClasses as cO, getBackgroundColorStyle as cP, getCTAType as cQ, getDisplayValue as cR, getEntityTypeLabel as cS, getImageAltText as cT, getLocatorEntityTypeSourceMap as cU, getTextColorClass as cV, getTextColorStyle as cW, hexToRGB as cX, isColorContrastWcagCompliant as cY, isCtaVariantWithColor as cZ, isLocatorEntityType as c_, imgSizesHelper as ca, isDarkColor as cb, isLocalizedAssetImage as cc, mergeMeta as cd, msg as ce, normalizeLink as cf, normalizeSlug as cg, normalizeThemeColorToken as ch, pt as ci, resolveBreadcrumbs as cj, resolveComponentData as ck, resolveDataFromParent as cl, resolveLocalizedAssetImage as cm, resolveUrlTemplate as cn, resolveUrlTemplateOfChild as co, resolveYextEntityField as cp, themeManagerCn as cq, themeManagerTwMergeConfiguration as cr, themeResolver as cs, toKilometers as ct, toPuckFields as cu, useBackground as cv, useDocument as cw, usePlatformTranslation as cx, useTemplateProps as cy, type SlotMappedCardsData as cz, type ComponentRegistry as d, loadTranslationDictionary as d0, resolveDirectoryRootProps as d1, resolveField as d2, toMeters as d3, toMiles as d4, useEntityTooltips as d5, useTemplateMetadata as d6, type TranslatableRichText as e, ThemeOptions as f, type ThemeColor as g, type YextComponentConfig as h, type YextEntityField as i, type CTAVariant as j, type TranslatableString as k, type HeadingLevel as l, type ImageFillType as m, type TranslatableAssetImage as n, type ImgSizesByBreakpoint as o, type SlottedItemSourceInstance as p, type BodyProps as q, type MultiSelectorValue as r, type StyledTextValue as s, type ComprehensiveCTAValue as t, type ResolvedComprehensiveCTAValue as u, type CTAProps as v, type ThemeColorField as w, CTASelectorFieldOverride as x, type CodeField as y, ComprehensiveCTAFieldOverride as z };
|