Skip to content

feat: Create Global Sections Settings tab #2845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 19, 2025
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
126 changes: 125 additions & 1 deletion packages/core/cms/faststore/content-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,131 @@
"id": "globalSections",
"name": "Global Sections",
"scopes": ["global"],
"configurationSchemaSets": [],
"configurationSchemaSets": [
{
"name": "Settings",
"configurations": [
{
"name": "regionalization",
"schema": {
"title": "Regionalization",
"description": "Regionalization options",
"type": "object",
"properties": {
"inputField": {
"title": "Postal Code Input Field",
"type": "object",
"properties": {
"label": {
"title": "Label",
"type": "string",
"default": "Postal Code"
},
"errorMessage": {
"title": "Error message",
"type": "string",
"default": "You entered an invalid Postal Code"
},
"noProductsAvailableErrorMessage": {
"title": "Error message for the scenario of no products available for a given location",
"type": "string",
"default": "There are no products available for %s.",
"description": "The '%s' will be replaced by the postal code value."
},
"buttonActionText": {
"title": "Action label to apply the postal code",
"type": "string",
"default": "Apply"
}
}
},
"idkPostalCodeLink": {
"title": "I don't know my postal code link",
"type": "object",
"properties": {
"text": {
"type": "string",
"title": "Link Text",
"default": "I don't know my Postal Code"
},
"to": {
"type": "string",
"title": "Action link"
},
"icon": {
"title": "Icon",
"type": "object",
"properties": {
"icon": {
"title": "Icon",
"type": "string",
"enumNames": ["Arrow Square Out"],
"enum": ["ArrowSquareOut"],
"default": "ArrowSquareOut"
},
"alt": {
"title": "Alternative Label",
"type": "string",
"default": "Arrow Square Out icon"
}
}
}
}
},
"deliverySettings": {
"title": "PLP/Search Filter: Delivery Settings",
"type": "object",
"required": ["title", "description"],
"properties": {
"title": {
"title": "Title",
"type": "string",
"default": "Delivery"
},
"description": {
"title": "Description",
"type": "string",
"default": "Offers and delivery options vary based on region."
},
"setLocationButtonLabel": {
"title": "Call to Action label",
"type": "string",
"default": "Set Location"
},
"deliveryCustomLabels": {
"title": "Filter options labels",
"type": "object",
"properties": {
"delivery": {
"title": "Shipping label",
"type": "string",
"default": "Shipping to"
},
"pickupInPoint": {
"title": "Pickup in point label",
"type": "string",
"default": "Pickup at"
},
"pickupNearby": {
"title": "Pickup Nearby label",
"type": "string",
"default": "Pickup Nearby"
},
"pickupAll": {
"title": "Pickup Anywhere label",
"type": "string",
"default": "Pickup Anywhere"
}
}
}
}
}
}
}
}
]
}
],
"isSingleton": true
},
{
Expand Down
89 changes: 44 additions & 45 deletions packages/core/cms/faststore/sections.json
Original file line number Diff line number Diff line change
Expand Up @@ -1917,46 +1917,45 @@
"deliverySettings": {
"title": "Delivery Settings",
"type": "object",
"required": ["title", "description"],
"properties": {
"title": {
"title": "Delivery section title",
"type": "string",
"default": "Delivery"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"description": {
"title": "Delivery section description",
"type": "string",
"default": "Offers and delivery options vary based on region."
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"setLocationButtonLabel": {
"title": "Call to Action label",
"type": "string",
"default": "Set Location"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"deliveryCustomLabels": {
"title": "Delivery Custom labels",
"type": "object",
"properties": {
"delivery": {
"title": "Shipping label",
"type": "string",
"default": "Shipping to"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"pickupInPoint": {
"title": "Pickup in point label",
"type": "string",
"default": "Pickup at"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"pickupNearby": {
"title": "Pickup Nearby label",
"type": "string",
"default": "Pickup Nearby"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"pickupAll": {
"title": "Pickup Anywhere label",
"type": "string",
"default": "Pickup Anywhere"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
}
}
}
Expand Down Expand Up @@ -2267,24 +2266,23 @@
"properties": {
"label": {
"title": "Input field label",
"type": "string",
"default": "Postal Code"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"errorMessage": {
"title": "Input field error message",
"type": "string",
"default": "You entered an invalid Postal Code"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"noProductsAvailableErrorMessage": {
"title": "Input field error message for the scenario of no products available for a given location",
"type": "string",
"default": "There are no products available for %s.",
"description": "The '%s' will be replaced by the postal code value."
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections The '%s' is replaced by the postal code value.",
"type": "string"
},
"buttonActionText": {
"title": "Input field action button label",
"type": "string",
"default": "Apply"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
}
}
},
Expand All @@ -2295,27 +2293,28 @@
"text": {
"type": "string",
"title": "Link Text",
"default": "I don't know my Postal Code"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections"
},
"to": {
"type": "string",
"title": "Action link"
"title": "Action link",
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections"
},
"icon": {
"title": "Icon",
"type": "object",
"properties": {
"icon": {
"title": "Icon",
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string",
"enumNames": ["Arrow Square Out"],
"enum": ["ArrowSquareOut"],
"default": "ArrowSquareOut"
"enum": ["ArrowSquareOut"]
},
"alt": {
"title": "Alternative Label",
"type": "string",
"default": "Arrow Square Out icon"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
}
}
}
Expand Down Expand Up @@ -2348,24 +2347,23 @@
"properties": {
"label": {
"title": "Input field label",
"type": "string",
"default": "Postal Code"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"errorMessage": {
"title": "Input field error message",
"type": "string",
"default": "You entered an invalid Postal Code"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
},
"noProductsAvailableErrorMessage": {
"title": "Input field error message for the scenario of no products available for a given location",
"type": "string",
"default": "There are no products available for %s.",
"description": "The '%s' will be replaced by the postal code value."
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections The '%s' is replaced by the postal code value.",
"type": "string"
},
"buttonActionText": {
"title": "Input field action button label",
"type": "string",
"default": "Apply"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
}
}
},
Expand Down Expand Up @@ -2393,27 +2391,28 @@
"text": {
"type": "string",
"title": "Link Text",
"default": "I don't know my Postal Code"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections"
},
"to": {
"type": "string",
"title": "Action link"
"title": "Action link",
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections"
},
"icon": {
"title": "Icon",
"type": "object",
"properties": {
"icon": {
"title": "Icon",
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string",
"enumNames": ["Arrow Square Out"],
"enum": ["ArrowSquareOut"],
"default": "ArrowSquareOut"
"enum": ["ArrowSquareOut"]
},
"alt": {
"title": "Alternative Label",
"type": "string",
"default": "Arrow Square Out icon"
"description": "[Deprecated] Use the fields from the Settings tab in Global Sections",
"type": "string"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/cms/GlobalSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const GLOBAL_SECTIONS_FOOTER_CONTENT_TYPE = 'globalFooterSections'

export type GlobalSectionsData = {
sections: Section[]
settings?: Record<string, unknown>
}

export const getGlobalSectionsByType = async (
Expand Down
15 changes: 9 additions & 6 deletions packages/core/src/components/search/Filter/FilterDesktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { useFilter } from 'src/sdk/search/useFilter'
import type { FilterSliderProps } from './FilterSlider'

import { sessionStore } from 'src/sdk/session'
import { getRegionalizationSettings } from 'src/utils/globalSettings'
import FilterDeliveryOption from './FilterDeliveryOption'

interface FilterDesktopProps
Expand All @@ -34,9 +35,11 @@ function FilterDesktop({
}: FilterDesktopProps & ReturnType<typeof useFilter>) {
const { resetInfiniteScroll, state, setState } = useSearch()

const deliveryLabel = deliverySettings?.title ?? 'Delivery'
const { postalCode } = sessionStore.read()
const { deliverySettings: deliverySettingsData } =
getRegionalizationSettings(deliverySettings)
const deliveryLabel = deliverySettingsData?.title ?? 'Delivery'

const { postalCode } = sessionStore.read()
const shouldDisplayDeliveryButton = deliveryPromise.enabled && !postalCode
const filteredFacets = deliveryPromise.enabled
? facets
Expand All @@ -58,7 +61,7 @@ function FilterDesktop({
index={0}
type=""
label={deliveryLabel}
description={deliverySettings?.description}
description={deliverySettingsData?.description}
>
<UIButton
data-fs-filter-list-delivery-button
Expand All @@ -68,7 +71,7 @@ function FilterDesktop({
}}
icon={<UIIcon name="MapPin" />}
>
{deliverySettings?.setLocationButtonLabel ?? 'Set Location'}
{deliverySettingsData?.setLocationButtonLabel ?? 'Set Location'}
</UIButton>
</UIFilterFacets>
)}
Expand All @@ -86,7 +89,7 @@ function FilterDesktop({
type={type}
label={isDeliveryFacet ? deliveryLabel : label}
description={
isDeliveryFacet ? deliverySettings.description : undefined
isDeliveryFacet ? deliverySettingsData.description : undefined
}
>
{type === 'StoreFacetBoolean' && isExpanded && (
Expand Down Expand Up @@ -117,7 +120,7 @@ function FilterDesktop({
<FilterDeliveryOption
item={item}
deliveryCustomLabels={
deliverySettings.deliveryCustomLabels
deliverySettingsData.deliveryCustomLabels
}
/>
) : (
Expand Down
Loading
Loading