Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2cf3767
feat: add item sources and per-image links to Photo Gallery
briantstephan Sep 29, 2026
18b0908
fixes
briantstephan Sep 30, 2026
1356c3c
fix image resizing with link
briantstephan Sep 30, 2026
966bd7a
fix photo gallery not appearing in interactive mode
briantstephan Sep 30, 2026
5de8cbc
various fixes
briantstephan Sep 30, 2026
33119c5
fix test
briantstephan Sep 30, 2026
aa2c1d1
block js ctas
briantstephan Sep 30, 2026
9720e0b
address comments
briantstephan Oct 1, 2026
487e842
fix build
briantstephan Oct 1, 2026
4aac91b
Merge branch 'release/1.x' into image-item-source
briantstephan Oct 1, 2026
c983399
Update component screenshots for visual-editor
github-actions[bot] Oct 1, 2026
5eb04d5
update layout version
briantstephan Oct 2, 2026
e89885e
Merge branch 'image-item-source' of https://github.com/yext/visual-ed…
briantstephan Oct 2, 2026
c19e487
Update component screenshots for visual-editor
github-actions[bot] Oct 2, 2026
042cce5
update layout for imageFillType
briantstephan Oct 2, 2026
222e48b
Merge branch 'image-item-source' of https://github.com/yext/visual-ed…
briantstephan Oct 2, 2026
5752dc6
Update component screenshots for visual-editor
github-actions[bot] Oct 2, 2026
9c4f870
remove import from migration
briantstephan Oct 5, 2026
a9c2df0
Merge branch 'image-item-source' of https://github.com/yext/visual-ed…
briantstephan Oct 5, 2026
690f823
Update component screenshots for visual-editor
github-actions[bot] Oct 5, 2026
840675a
rename directItem
briantstephan Oct 5, 2026
53f6daf
Merge branch 'image-item-source' of https://github.com/yext/visual-ed…
briantstephan Oct 5, 2026
660562f
Update component screenshots for visual-editor
github-actions[bot] Oct 5, 2026
0e848fc
Merge branch 'release/1.x' into image-item-source
briantstephan Oct 5, 2026
08cc139
improve itemSource usage
briantstephan Oct 5, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { type Migration } from "../../utils/migrate.ts";

/**
* Gallery item-source migration.
*
* 1. Moves each saved manual image into an image and link item.
* 2. Keeps the linked list field and maps each image item to itself.
* 3. Leaves Gallery styles and section slots unchanged.
*/
export const photoGalleryItemSource: Migration = {
PhotoGalleryWrapper: {
action: "updated",
propTransformation: (props) => {
const images = props.data?.images;
if (!images || images.mappings) {
return props;
}

return {
...props,
data: {
...props.data,
images: {
...images,
constantValue: Array.isArray(images.constantValue)
? images.constantValue.map((item: unknown) => {
const image = item as Record<string, unknown> | null;
const imageValue =
image && "url" in image
? image
: (image?.assetImage ?? image?.image ?? item);
return {
image: {
field: "",
constantValueEnabled: true,
constantValue: imageValue,
},
link: {
field: "",
constantValueEnabled: true,
constantValue: {
defaultValue:
typeof image?.clickthroughUrl === "string"
? image.clickthroughUrl
: "",
},
},
};
})
: [],
mappings: {
image: {
field: images.field ? "$item" : "",
constantValueEnabled: false,
constantValue: undefined,
},
link: {
field: "",
constantValueEnabled: false,
constantValue: undefined,
},
},
},
},
};
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import { imageFillTypeMigration } from "./0079_image_fill_type.ts";
import { directoryCardDisplayProps } from "./0080_directory_card_display_props.ts";
import { headerFooterImageFillTypeMigration } from "./0081_header_footer_image_fill_type.ts";
import { heroPhoneSlotMigration } from "./0082_hero_phone_slot.ts";
import { photoGalleryItemSource } from "./0083_photo_gallery_item_source.ts";

// To add a migration:
// Create a new file in this directory that exports a Migration
Expand Down Expand Up @@ -170,4 +171,5 @@ export const migrationRegistry: MigrationRegistry = [
directoryCardDisplayProps,
headerFooterImageFillTypeMigration,
heroPhoneSlotMigration,
photoGalleryItemSource,
];
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ const directSectionCases: DirectSectionCase[] = [
const props = cloneValue(PhotoGallerySection.defaultProps!);
props.slots.PhotoGalleryWrapper[0].props.data.images.field =
"photoGallery";
props.slots.PhotoGalleryWrapper[0].props.data.images.mappings.image.field =
"$item";
props.slots.PhotoGalleryWrapper[0].props.data.images.constantValueEnabled = false;
props.slots.PhotoGalleryWrapper[0].props.data.images.constantValue = [];
return props;
Expand Down Expand Up @@ -171,7 +173,11 @@ const directSectionCases: DirectSectionCase[] = [
HeadingSlot: createSectionHeadingSlot(),
PhotoGalleryWrapper: createCardsSlot(
isMappedContentEmpty ? (
<EntityFieldSectionEmptyStateBox showEmptyStateMarker />
isEditing ? (
<EntityFieldSectionEmptyStateBox showEmptyStateMarker />
) : (
<EmptyStateMarker />
)
) : (
"Gallery Images"
)
Expand Down Expand Up @@ -255,7 +261,9 @@ describe.each(directSectionCases)(
});

await waitFor(() => {
expect(result.container.childElementCount).toBe(0);
expect(result.queryByText("Section Heading")).toBeNull();
expect(result.queryByText(visibleContentText)).toBeNull();
expect(result.queryByText(/Section hidden for this/i)).toBeNull();
});
});

Expand Down
Loading
Loading