Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c659bf1
add static content toggles; fix map style refresh
k-gerner Feb 11, 2026
509640c
docs: auto-generate component documentation
github-actions[bot] Feb 11, 2026
cb95740
Update component screenshots for visual-editor
github-actions[bot] Feb 11, 2026
781d494
Update component screenshots for visual-editor
github-actions[bot] Feb 11, 2026
362bd2c
feat: allow styling of Expanded Header links and adjust hamburger log…
asanehisa Feb 11, 2026
d8f56df
chore: update screenshots batch 2 (#1039)
benlife5 Feb 11, 2026
e3f3209
merge main; update version number / test props
k-gerner Feb 11, 2026
50a9105
merge again
k-gerner Feb 11, 2026
e6c62bf
Update component screenshots for visual-editor
github-actions[bot] Feb 11, 2026
c14d08a
use setDeep return val; update test; upgrade search-ui-react version
k-gerner Feb 11, 2026
0b02f0b
Update component screenshots for visual-editor
github-actions[bot] Feb 11, 2026
bf864da
fix heading compression; change field name for image selector in puck…
k-gerner Feb 11, 2026
ce3eb44
merge main
k-gerner Feb 12, 2026
2ac0488
Update component screenshots for visual-editor
github-actions[bot] Feb 12, 2026
5350783
Update component screenshots for visual-editor
github-actions[bot] Feb 12, 2026
0f5b101
remove constant props from v24 in test
k-gerner Feb 12, 2026
ca2d279
Update component screenshots for visual-editor
github-actions[bot] Feb 12, 2026
ab64390
Update component screenshots for visual-editor
github-actions[bot] Feb 12, 2026
5215927
Update component screenshots for visual-editor
github-actions[bot] Feb 12, 2026
2a72428
merge conflicts
k-gerner Feb 23, 2026
420d6ed
docs: auto-generate component documentation
github-actions[bot] Feb 23, 2026
3dba958
Update component screenshots for visual-editor
github-actions[bot] Feb 23, 2026
532b288
Update component screenshots for visual-editor
github-actions[bot] Feb 23, 2026
f81a338
refactor field setting code into helper
k-gerner Feb 23, 2026
dc1d51a
Update component screenshots for visual-editor
github-actions[bot] Feb 23, 2026
fba0169
fix static header test to still show entity name for unit tests
k-gerner Feb 23, 2026
c230946
Update component screenshots for visual-editor
github-actions[bot] Feb 23, 2026
1c67e06
forgot second text comparison
k-gerner Feb 23, 2026
a39279f
scope matcher to first match for static heading test
k-gerner Feb 23, 2026
6300a87
Update component screenshots for visual-editor
github-actions[bot] Feb 23, 2026
5a06159
nits on default constant values
k-gerner Feb 23, 2026
681dcb0
nits
k-gerner Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 241 additions & 0 deletions packages/visual-editor/src/components/Locator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,21 @@ const tests: ComponentTest[] = [
resultCard: {
primaryHeading: {
field: "name",
constantValue: { en: "", hasLocalizedValue: "true" },
constantValueEnabled: false,
headingLevel: 5,
},
secondaryHeading: {
field: "name",
constantValue: { en: "", hasLocalizedValue: "true" },
constantValueEnabled: false,
variant: "base",
liveVisibility: false,
},
tertiaryHeading: {
field: "name",
constantValue: { en: "", hasLocalizedValue: "true" },
constantValueEnabled: false,
variant: "base",
liveVisibility: false,
},
Expand Down Expand Up @@ -160,6 +166,11 @@ const tests: ComponentTest[] = [
},
image: {
field: "headshot",
constantValue: {
en: { url: "", height: 0, width: 0 },
hasLocalizedValue: "true",
},
constantValueEnabled: false,
liveVisibility: false,
},
},
Expand Down Expand Up @@ -575,6 +586,236 @@ const tests: ComponentTest[] = [
},
version: 60,
},
{
name: "version 64 static headings",
document: {
locale: "en",
businessId: "4174974",
__: {
isPrimaryLocale: true,
},
_env: {
YEXT_PUBLIC_VISUAL_EDITOR_APP_API_KEY: import.meta.env
.COMPONENT_TESTS_VISUAL_EDITOR_APP_API_KEY,
YEXT_CLOUD_CHOICE: "GLOBAL-MULTI",
YEXT_CLOUD_REGION: "US",
YEXT_ENVIRONMENT: "PROD",
YEXT_MAPBOX_API_KEY: import.meta.env.COMPONENT_TESTS_MAPBOX_API_KEY,
YEXT_SEARCH_API_KEY: import.meta.env.COMPONENT_TESTS_SEARCH_API_KEY,
},
_pageset: JSON.stringify({
type: "LOCATOR",
typeConfig: {
locatorConfig: {
source: "accounts/4174974/sites/155048/pagesets/locations",
experienceKey: "locator-41",
entityType: "location",
},
},
config: {
urlTemplate: {
primary: "[[address.region]]/[[address.city]]/[[address.line1]]",
},
},
}),
},
props: {
filters: {
openNowButton: false,
showDistanceOptions: false,
},
resultCard: {
primaryHeading: {
field: "name",
constantValue: { en: "", hasLocalizedValue: "true" },
constantValueEnabled: false,
headingLevel: 3,
},
secondaryHeading: {
field: "name",
constantValue: {
en: "Secondary Static",
hasLocalizedValue: "true",
},
constantValueEnabled: true,
variant: "base",
liveVisibility: true,
},
tertiaryHeading: {
field: "name",
constantValue: { en: "Tertiary Static", hasLocalizedValue: "true" },
constantValueEnabled: true,
variant: "base",
liveVisibility: true,
},
icons: true,
hours: {
table: {
startOfWeek: "today",
collapseDays: false,
showAdditionalHoursText: false,
},
liveVisibility: true,
},
address: {
showGetDirectionsLink: true,
liveVisibility: true,
},
phone: {
field: "mainPhone",
phoneFormat: "domestic",
includePhoneHyperlink: true,
liveVisibility: true,
},
email: {
field: "emails",
liveVisibility: false,
},
services: {
field: "services",
liveVisibility: false,
},
primaryCTA: {
variant: "primary",
liveVisibility: true,
},
secondaryCTA: {
label: "Call to Action",
link: "#",
variant: "secondary",
liveVisibility: false,
},
image: {
field: "headshot",
constantValue: {
en: { url: "", height: 0, width: 0 },
hasLocalizedValue: "true",
},
constantValueEnabled: false,
liveVisibility: false,
},
},
},
interactions: async (page) => {
await expect
.element(page.getByText("Secondary Static").first())
.toBeVisible();
},
version: 64,
},
{
name: "version 64 static image",
document: {
locale: "en",
businessId: "4174974",
__: {
isPrimaryLocale: true,
},
_env: {
YEXT_PUBLIC_VISUAL_EDITOR_APP_API_KEY: import.meta.env
.COMPONENT_TESTS_VISUAL_EDITOR_APP_API_KEY,
YEXT_CLOUD_CHOICE: "GLOBAL-MULTI",
YEXT_CLOUD_REGION: "US",
YEXT_ENVIRONMENT: "PROD",
YEXT_MAPBOX_API_KEY: import.meta.env.COMPONENT_TESTS_MAPBOX_API_KEY,
YEXT_SEARCH_API_KEY: import.meta.env.COMPONENT_TESTS_SEARCH_API_KEY,
},
_pageset: JSON.stringify({
type: "LOCATOR",
typeConfig: {
locatorConfig: {
source: "accounts/4174974/sites/155048/pagesets/locations",
experienceKey: "locator-41",
entityType: "location",
},
},
config: {
urlTemplate: {
primary: "[[address.region]]/[[address.city]]/[[address.line1]]",
},
},
}),
},
props: {
filters: {
openNowButton: false,
showDistanceOptions: false,
},
resultCard: {
primaryHeading: {
field: "name",
constantValue: { en: "", hasLocalizedValue: "true" },
constantValueEnabled: false,
headingLevel: 3,
},
secondaryHeading: {
field: "name",
constantValue: { en: "", hasLocalizedValue: "true" },
constantValueEnabled: false,
variant: "base",
liveVisibility: false,
},
tertiaryHeading: {
field: "name",
constantValue: { en: "", hasLocalizedValue: "true" },
constantValueEnabled: false,
variant: "base",
liveVisibility: false,
},
icons: true,
hours: {
table: {
startOfWeek: "today",
collapseDays: false,
showAdditionalHoursText: false,
},
liveVisibility: true,
},
address: {
showGetDirectionsLink: true,
liveVisibility: true,
},
phone: {
field: "mainPhone",
phoneFormat: "domestic",
includePhoneHyperlink: true,
liveVisibility: true,
},
email: {
field: "emails",
liveVisibility: false,
},
services: {
field: "services",
liveVisibility: false,
},
primaryCTA: {
variant: "primary",
liveVisibility: true,
},
secondaryCTA: {
label: "Call to Action",
link: "#",
variant: "secondary",
liveVisibility: false,
},
image: {
field: "headshot",
constantValue: {
en: {
url: "https://placehold.co/80x80",
height: 80,
width: 80,
},
hasLocalizedValue: "true",
},
constantValueEnabled: true,
liveVisibility: true,
},
},
},
version: 64,
},
];

const screenshotThreshold = 30;
Expand Down
86 changes: 78 additions & 8 deletions packages/visual-editor/src/components/Locator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { ComponentConfig, Fields, WithPuckProps } from "@puckeditor/core";
import {
ComponentConfig,
Fields,
WithPuckProps,
setDeep,
} from "@puckeditor/core";
import {
FieldValueFilter,
FieldValueStaticFilter,
Expand Down Expand Up @@ -606,6 +611,64 @@ export const LocatorComponent: ComponentConfig<{ props: LocatorProps }> = {
resultCard: DEFAULT_LOCATOR_RESULT_CARD_PROPS,
},
label: msg("components.locator", "Locator"),
resolveFields: (data) => {
let updatedFields: Fields<LocatorProps> = { ...locatorFields };
const setConstantVaueFieldVisibility = (
fields: Fields<LocatorProps>,
fieldKey:
| "primaryHeading"
| "secondaryHeading"
| "tertiaryHeading"
| "image",
isConstantValueEnabled: boolean
): Fields<LocatorProps> => {
let nextFields = fields;
nextFields = setDeep(
nextFields,
`resultCard.objectFields.${fieldKey}.objectFields.field.visible`,
!isConstantValueEnabled
);
nextFields = setDeep(
nextFields,
`resultCard.objectFields.${fieldKey}.objectFields.constantValue.visible`,
isConstantValueEnabled
);
return nextFields;
};

const constantValueFieldConfigs = [
{
key: "primaryHeading",
enabled:
data.props.resultCard?.primaryHeading?.constantValueEnabled ?? false,
},
{
key: "secondaryHeading",
enabled:
data.props.resultCard?.secondaryHeading?.constantValueEnabled ??
false,
},
{
key: "tertiaryHeading",
enabled:
data.props.resultCard?.tertiaryHeading?.constantValueEnabled ?? false,
},
{
key: "image",
enabled: data.props.resultCard?.image?.constantValueEnabled ?? false,
},
] as const;

constantValueFieldConfigs.forEach(({ key, enabled }) => {
updatedFields = setConstantVaueFieldVisibility(
updatedFields,
key,
enabled
);
});

return updatedFields;
},
render: (props) => <LocatorWrapper {...props} />,
};

Expand Down Expand Up @@ -892,12 +955,19 @@ const LocatorInternal = ({

const [userLocationRetrieved, setUserLocationRetrieved] =
React.useState<boolean>(false);
const [mapProps, setMapProps] = React.useState<MapProps>({
mapStyle,
onDragHandler: handleDrag,
scrollToResult: scrollToResult,
markerOptionsOverride: markerOptionsOverride,
});
const [centerCoords, setCenterCoords] = React.useState<
[number, number] | undefined
>();
const mapProps = React.useMemo(
() => ({
mapStyle,
centerCoords,
onDragHandler: handleDrag,
scrollToResult: scrollToResult,
markerOptionsOverride: markerOptionsOverride,
}),
[centerCoords, handleDrag, mapStyle, markerOptionsOverride, scrollToResult]
);

React.useEffect(() => {
const resolveLocationAndSearch = async () => {
Expand Down Expand Up @@ -928,7 +998,7 @@ const LocatorInternal = ({
filterValue.lat,
];
if (areValidCoordinates(centerCoords[1], centerCoords[0])) {
setMapProps((prev) => ({ ...prev, centerCoords }));
setCenterCoords(centerCoords);
setMapCenter(mapboxgl.LngLat.convert(centerCoords));
}
}
Expand Down
Loading