Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -76,6 +76,7 @@ export const coreInfoSectionSlots: Migration = {
startOfWeek: "today",
collapseDays: false,
showAdditionalHoursText: true,
alignment: "items-start",
};

const services = props.data.services.servicesList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { TestimonialSectionType } from "../../types/types";
import { YextEntityField } from "../../editor/YextEntityFieldSelector";
import { BodyTextProps } from "../contentBlocks/BodyText";
import { resolveComponentData } from "../../utils/resolveComponentData";
import { TimestampProps } from "../contentBlocks";

export const testimonialsSectionSlots: Migration = {
TestimonialSection: {
Expand Down Expand Up @@ -98,18 +99,23 @@ export const testimonialsSectionSlots: Migration = {
constantValueEnabled: true,
constantValue: testimonial.contributionDate ?? "",
},
endDate: {
field: "",
constantValue: "",
constantValueEnabled: true,
},
},
styles: {
option: "DATE",
hideTimeZone: true,
includeRange: false,
includeTime: false,
},
parentData: constantValueEnabled
? undefined
: {
field: props.data.testimonials.field,
date: testimonial.contributionDate,
},
},
} satisfies WithId<TimestampProps>,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,160 @@ const tests: ComponentTest[] = [
},
version: 10,
},
{
name: "version 26 props with mixed values",
document: {
locale: "en",
address: testAddress,
mainPhone: "+18005551010",
emails: ["sumo@yext.com"],
hours: testHours,
services: ["Delivery", "Catering"],
id: "test-id",
description: "test-description",
name: "Galaxy Grill",
},
props: {
styles: {
backgroundColor: {
bgColor: "bg-palette-secondary-light",
textColor: "text-black",
},
},
slots: {
CoreInfoHeadingSlot: [
{
type: "HeadingTextSlot",
props: {
id: "HeadingTextSlot-13c80a69-4194-41a6-86d0-1ded6367ed98",
data: {
text: {
constantValue: {
en: "Information",
hasLocalizedValue: "true",
},
constantValueEnabled: true,
field: "",
},
},
styles: { level: 3, align: "left" },
},
},
],
CoreInfoAddressSlot: [
{
type: "AddressSlot",
props: {
id: "AddressSlot-07cfe7a6-e9c7-41c4-b1ae-03558c90c6b9",
data: {
address: {
constantValue: {
line1: "",
city: "",
postalCode: "",
countryCode: "",
},
field: "address",
},
},
styles: { showGetDirectionsLink: true, ctaVariant: "link" },
},
},
],
CoreInfoPhoneNumbersSlot: [
{
type: "PhoneNumbersSlot",
props: {
id: "PhoneNumbersSlot-c82bd20b-7393-4994-87fb-26a53cd82880",
data: {
phoneNumbers: [
{
number: { field: "mainPhone", constantValue: "" },
label: { en: "Phone", hasLocalizedValue: "true" },
},
],
},
styles: { phoneFormat: "domestic", includePhoneHyperlink: true },
},
},
],
CoreInfoEmailsSlot: [
{
type: "EmailsSlot",
props: {
id: "EmailsSlot-4d584104-463f-4569-86e4-19c137697f60",
data: { list: { field: "emails", constantValue: [] } },
styles: { listLength: 1 },
},
},
],
HoursHeadingSlot: [
{
type: "HeadingTextSlot",
props: {
id: "HeadingTextSlot-383eb893-a76f-4457-bf3b-7909b520a384",
data: {
text: {
constantValue: { en: "Hours", hasLocalizedValue: "true" },
constantValueEnabled: true,
field: "",
},
},
styles: { level: 3, align: "left" },
},
},
],
HoursTableSlot: [
{
type: "HoursTableSlot",
props: {
id: "HoursTableSlot-ada7341a-2420-4ef2-b9e4-1d2e26945e43",
data: { hours: { field: "hours", constantValue: {} } },
styles: {
startOfWeek: "today",
collapseDays: false,
showAdditionalHoursText: true,
alignment: "items-start",
},
},
},
],
ServicesHeadingSlot: [
{
type: "HeadingTextSlot",
props: {
id: "HeadingTextSlot-1b445bc3-cc01-4fa9-9fb8-3c8dc1361ca5",
data: {
text: {
constantValue: { en: "Services", hasLocalizedValue: "true" },
constantValueEnabled: true,
field: "",
},
},
styles: { level: 2, align: "left" },
},
},
],
ServicesListSlot: [
{
type: "ServicesListSlot",
props: {
id: "ServicesListSlot-88d05408-381e-4a03-a5a0-8b8c9781d6fc",
list: { field: "services", constantValue: [] },
},
},
],
},
analytics: { scope: "coreInfoSection" },
liveVisibility: true,
conditionalRender: {
coreInfoCol: true,
hoursCol: true,
servicesCol: true,
},
},
version: 26,
},
];

describe("CoreInfoSection", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ import {
getAnalyticsScopeHash,
resolveComponentData,
TranslatableString,
HeadingTextProps,
HoursTableProps,
TextListProps,
EmailsProps,
AddressProps,
} from "@yext/visual-editor";
import { resolvePhoneNumbers } from "../contentBlocks/PhoneList";
import {
PhoneListProps,
resolvePhoneNumbers,
} from "../contentBlocks/PhoneList";

export interface CoreInfoStyles {
/**
Expand Down Expand Up @@ -201,7 +209,7 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
},
},
styles: { level: 3, align: "left" },
},
} satisfies HeadingTextProps,
},
],
CoreInfoAddressSlot: [
Expand All @@ -223,7 +231,7 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
showGetDirectionsLink: true,
ctaVariant: "link",
},
},
} satisfies AddressProps,
},
],
CoreInfoPhoneNumbersSlot: [
Expand All @@ -248,7 +256,7 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
phoneFormat: "domestic",
includePhoneHyperlink: true,
},
},
} satisfies PhoneListProps,
},
],
CoreInfoEmailsSlot: [
Expand All @@ -264,7 +272,7 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
styles: {
listLength: 1,
},
},
} satisfies EmailsProps,
},
],
HoursHeadingSlot: [
Expand All @@ -282,7 +290,7 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
},
},
styles: { level: 3, align: "left" },
},
} satisfies HeadingTextProps,
},
],
HoursTableSlot: [
Expand All @@ -299,8 +307,9 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
startOfWeek: "today",
collapseDays: false,
showAdditionalHoursText: true,
alignment: "items-start",
},
},
} satisfies HoursTableProps,
},
],
ServicesHeadingSlot: [
Expand All @@ -318,7 +327,7 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
},
},
styles: { level: 3, align: "left" },
},
} satisfies HeadingTextProps,
},
],
ServicesListSlot: [
Expand All @@ -329,7 +338,7 @@ export const CoreInfoSection: ComponentConfig<{ props: CoreInfoSectionProps }> =
field: "services",
constantValue: [],
},
},
} satisfies TextListProps,
},
],
},
Expand Down
Loading