medusa-storefront-data 2.5.5 → 2.5.7
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/HOMEPAGE_CONFIG.md +2 -2
- package/dist/segment-data/default-page-input.json +191 -0
- package/dist/src/config.d.ts +3 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +31 -0
- package/dist/src/cookies.d.ts +23 -0
- package/dist/src/cookies.d.ts.map +1 -0
- package/dist/src/cookies.js +140 -0
- package/dist/src/dynamic-config-schema/index.d.ts +103 -0
- package/dist/src/dynamic-config-schema/index.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/index.js +172 -0
- package/dist/src/dynamic-config-schema/sections/about-brand.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/about-brand.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/about-brand.js +30 -0
- package/dist/src/dynamic-config-schema/sections/baptism-picks.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/baptism-picks.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/baptism-picks.js +17 -0
- package/dist/src/dynamic-config-schema/sections/baptism.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/baptism.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/baptism.js +4 -0
- package/dist/src/dynamic-config-schema/sections/blog-posts.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/blog-posts.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/blog-posts.js +31 -0
- package/dist/src/dynamic-config-schema/sections/brand-marquee.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/brand-marquee.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/brand-marquee.js +9 -0
- package/dist/src/dynamic-config-schema/sections/brand-pillars.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/brand-pillars.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/brand-pillars.js +29 -0
- package/dist/src/dynamic-config-schema/sections/category-pills.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/category-pills.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/category-pills.js +4 -0
- package/dist/src/dynamic-config-schema/sections/celebrity-trust.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/celebrity-trust.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/celebrity-trust.js +4 -0
- package/dist/src/dynamic-config-schema/sections/features.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/features.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/features.js +12 -0
- package/dist/src/dynamic-config-schema/sections/hero.d.ts +6 -0
- package/dist/src/dynamic-config-schema/sections/hero.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/hero.js +9 -0
- package/dist/src/dynamic-config-schema/sections/index.d.ts +24 -0
- package/dist/src/dynamic-config-schema/sections/index.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/index.js +23 -0
- package/dist/src/dynamic-config-schema/sections/instagram-posts.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/instagram-posts.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/instagram-posts.js +30 -0
- package/dist/src/dynamic-config-schema/sections/loved-by-moms.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/loved-by-moms.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/loved-by-moms.js +4 -0
- package/dist/src/dynamic-config-schema/sections/luxe-favourites.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/luxe-favourites.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/luxe-favourites.js +4 -0
- package/dist/src/dynamic-config-schema/sections/new-arrivals-classic.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/new-arrivals-classic.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/new-arrivals-classic.js +12 -0
- package/dist/src/dynamic-config-schema/sections/new-arrivals.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/new-arrivals.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/new-arrivals.js +12 -0
- package/dist/src/dynamic-config-schema/sections/promo-announcements.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/promo-announcements.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/promo-announcements.js +16 -0
- package/dist/src/dynamic-config-schema/sections/promo-countdown.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/promo-countdown.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/promo-countdown.js +16 -0
- package/dist/src/dynamic-config-schema/sections/shop-by-age.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/shop-by-age.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/shop-by-age.js +4 -0
- package/dist/src/dynamic-config-schema/sections/shop-by-category.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/shop-by-category.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/shop-by-category.js +4 -0
- package/dist/src/dynamic-config-schema/sections/testimonials.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/testimonials.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/testimonials.js +9 -0
- package/dist/src/dynamic-config-schema/sections/theme-dresses.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/theme-dresses.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/theme-dresses.js +4 -0
- package/dist/src/dynamic-config-schema/sections/video-stories.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/video-stories.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/video-stories.js +24 -0
- package/dist/src/dynamic-config-schema/sections/why-choose-us.d.ts +5 -0
- package/dist/src/dynamic-config-schema/sections/why-choose-us.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/sections/why-choose-us.js +9 -0
- package/dist/src/dynamic-config-schema/shared.d.ts +35 -0
- package/dist/src/dynamic-config-schema/shared.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/shared.js +99 -0
- package/dist/src/dynamic-config-schema/site-configs.d.ts +11 -0
- package/dist/src/dynamic-config-schema/site-configs.d.ts.map +1 -0
- package/dist/src/dynamic-config-schema/site-configs.js +70 -0
- package/dist/src/edge.d.ts +3 -0
- package/dist/src/edge.d.ts.map +1 -0
- package/dist/src/edge.js +1 -0
- package/dist/src/middleware.d.ts +3 -0
- package/dist/src/middleware.d.ts.map +1 -0
- package/dist/src/middleware.js +1 -0
- package/dist/src/server/brand-pillars-from-categories.d.ts +8 -0
- package/dist/src/server/brand-pillars-from-categories.d.ts.map +1 -0
- package/dist/src/server/brand-pillars-from-categories.js +92 -0
- package/dist/src/server/cart.d.ts +96 -0
- package/dist/src/server/cart.d.ts.map +1 -0
- package/dist/src/server/cart.js +797 -0
- package/dist/src/server/categories.d.ts +4 -0
- package/dist/src/server/categories.d.ts.map +1 -0
- package/dist/src/server/categories.js +34 -0
- package/dist/src/server/collections.d.ts +8 -0
- package/dist/src/server/collections.d.ts.map +1 -0
- package/dist/src/server/collections.js +39 -0
- package/dist/src/server/config-merge.d.ts +3 -0
- package/dist/src/server/config-merge.d.ts.map +1 -0
- package/dist/src/server/config-merge.js +31 -0
- package/dist/src/server/contact.d.ts +34 -0
- package/dist/src/server/contact.d.ts.map +1 -0
- package/dist/src/server/contact.js +57 -0
- package/dist/src/server/customer-registration.d.ts +142 -0
- package/dist/src/server/customer-registration.d.ts.map +1 -0
- package/dist/src/server/customer-registration.js +295 -0
- package/dist/src/server/customer.d.ts +48 -0
- package/dist/src/server/customer.d.ts.map +1 -0
- package/dist/src/server/customer.js +413 -0
- package/dist/src/server/dynamic-config-api.d.ts +11 -0
- package/dist/src/server/dynamic-config-api.d.ts.map +1 -0
- package/dist/src/server/dynamic-config-api.js +46 -0
- package/dist/src/server/dynamic-config.d.ts +186 -0
- package/dist/src/server/dynamic-config.d.ts.map +1 -0
- package/dist/src/server/dynamic-config.js +694 -0
- package/dist/src/server/fulfillment.d.ts +5 -0
- package/dist/src/server/fulfillment.d.ts.map +1 -0
- package/dist/src/server/fulfillment.js +47 -0
- package/dist/src/server/guest.d.ts +81 -0
- package/dist/src/server/guest.d.ts.map +1 -0
- package/dist/src/server/guest.js +183 -0
- package/dist/src/server/help-faq-section-defaults.json +92 -0
- package/dist/src/server/help-sections/help-faq.d.ts +11 -0
- package/dist/src/server/help-sections/help-faq.d.ts.map +1 -0
- package/dist/src/server/help-sections/help-faq.js +6 -0
- package/dist/src/server/help-sections/index.d.ts +2 -0
- package/dist/src/server/help-sections/index.d.ts.map +1 -0
- package/dist/src/server/help-sections/index.js +1 -0
- package/dist/src/server/home-sections/about-brand.d.ts +9 -0
- package/dist/src/server/home-sections/about-brand.d.ts.map +1 -0
- package/dist/src/server/home-sections/about-brand.js +9 -0
- package/dist/src/server/home-sections/baptism-picks.d.ts +10 -0
- package/dist/src/server/home-sections/baptism-picks.d.ts.map +1 -0
- package/dist/src/server/home-sections/baptism-picks.js +27 -0
- package/dist/src/server/home-sections/baptism.d.ts +13 -0
- package/dist/src/server/home-sections/baptism.d.ts.map +1 -0
- package/dist/src/server/home-sections/baptism.js +43 -0
- package/dist/src/server/home-sections/blog-posts.d.ts +9 -0
- package/dist/src/server/home-sections/blog-posts.d.ts.map +1 -0
- package/dist/src/server/home-sections/blog-posts.js +9 -0
- package/dist/src/server/home-sections/brand-marquee.d.ts +8 -0
- package/dist/src/server/home-sections/brand-marquee.d.ts.map +1 -0
- package/dist/src/server/home-sections/brand-marquee.js +7 -0
- package/dist/src/server/home-sections/brand-pillars.d.ts +9 -0
- package/dist/src/server/home-sections/brand-pillars.d.ts.map +1 -0
- package/dist/src/server/home-sections/brand-pillars.js +9 -0
- package/dist/src/server/home-sections/category-pills.d.ts +9 -0
- package/dist/src/server/home-sections/category-pills.d.ts.map +1 -0
- package/dist/src/server/home-sections/category-pills.js +19 -0
- package/dist/src/server/home-sections/celebrity-trust.d.ts +12 -0
- package/dist/src/server/home-sections/celebrity-trust.d.ts.map +1 -0
- package/dist/src/server/home-sections/celebrity-trust.js +27 -0
- package/dist/src/server/home-sections/features.d.ts +9 -0
- package/dist/src/server/home-sections/features.d.ts.map +1 -0
- package/dist/src/server/home-sections/features.js +9 -0
- package/dist/src/server/home-sections/hero.d.ts +9 -0
- package/dist/src/server/home-sections/hero.d.ts.map +1 -0
- package/dist/src/server/home-sections/hero.js +9 -0
- package/dist/src/server/home-sections/instagram-posts.d.ts +9 -0
- package/dist/src/server/home-sections/instagram-posts.d.ts.map +1 -0
- package/dist/src/server/home-sections/instagram-posts.js +9 -0
- package/dist/src/server/home-sections/loved-by-moms.d.ts +12 -0
- package/dist/src/server/home-sections/loved-by-moms.d.ts.map +1 -0
- package/dist/src/server/home-sections/loved-by-moms.js +20 -0
- package/dist/src/server/home-sections/luxe-favourites.d.ts +11 -0
- package/dist/src/server/home-sections/luxe-favourites.d.ts.map +1 -0
- package/dist/src/server/home-sections/luxe-favourites.js +19 -0
- package/dist/src/server/home-sections/new-arrivals-classic.d.ts +8 -0
- package/dist/src/server/home-sections/new-arrivals-classic.d.ts.map +1 -0
- package/dist/src/server/home-sections/new-arrivals-classic.js +10 -0
- package/dist/src/server/home-sections/new-arrivals.d.ts +12 -0
- package/dist/src/server/home-sections/new-arrivals.d.ts.map +1 -0
- package/dist/src/server/home-sections/new-arrivals.js +28 -0
- package/dist/src/server/home-sections/promo-announcements.d.ts +11 -0
- package/dist/src/server/home-sections/promo-announcements.d.ts.map +1 -0
- package/dist/src/server/home-sections/promo-announcements.js +5 -0
- package/dist/src/server/home-sections/promo-countdown.d.ts +6 -0
- package/dist/src/server/home-sections/promo-countdown.d.ts.map +1 -0
- package/dist/src/server/home-sections/promo-countdown.js +5 -0
- package/dist/src/server/home-sections/shared.d.ts +10 -0
- package/dist/src/server/home-sections/shared.d.ts.map +1 -0
- package/dist/src/server/home-sections/shared.js +29 -0
- package/dist/src/server/home-sections/shop-by-age.d.ts +9 -0
- package/dist/src/server/home-sections/shop-by-age.d.ts.map +1 -0
- package/dist/src/server/home-sections/shop-by-age.js +17 -0
- package/dist/src/server/home-sections/shop-by-category.d.ts +10 -0
- package/dist/src/server/home-sections/shop-by-category.d.ts.map +1 -0
- package/dist/src/server/home-sections/shop-by-category.js +17 -0
- package/dist/src/server/home-sections/testimonials.d.ts +9 -0
- package/dist/src/server/home-sections/testimonials.d.ts.map +1 -0
- package/dist/src/server/home-sections/testimonials.js +9 -0
- package/dist/src/server/home-sections/theme-dresses.d.ts +12 -0
- package/dist/src/server/home-sections/theme-dresses.d.ts.map +1 -0
- package/dist/src/server/home-sections/theme-dresses.js +27 -0
- package/dist/src/server/home-sections/video-stories.d.ts +9 -0
- package/dist/src/server/home-sections/video-stories.d.ts.map +1 -0
- package/dist/src/server/home-sections/video-stories.js +9 -0
- package/dist/src/server/home-sections/why-choose-us.d.ts +9 -0
- package/dist/src/server/home-sections/why-choose-us.d.ts.map +1 -0
- package/dist/src/server/home-sections/why-choose-us.js +9 -0
- package/dist/src/server/home.d.ts +54 -0
- package/dist/src/server/home.d.ts.map +1 -0
- package/dist/src/server/home.js +1 -0
- package/dist/src/server/homepage-config.types.d.ts +390 -0
- package/dist/src/server/homepage-config.types.d.ts.map +1 -0
- package/dist/src/server/homepage-config.types.js +34 -0
- package/dist/src/server/homepage-section-defaults.d.ts +189 -0
- package/dist/src/server/homepage-section-defaults.d.ts.map +1 -0
- package/dist/src/server/homepage-section-defaults.js +190 -0
- package/dist/src/server/index.d.ts +25 -0
- package/dist/src/server/index.d.ts.map +1 -0
- package/dist/src/server/index.js +24 -0
- package/dist/src/server/locale-actions.d.ts +14 -0
- package/dist/src/server/locale-actions.d.ts.map +1 -0
- package/dist/src/server/locale-actions.js +58 -0
- package/dist/src/server/locales.d.ts +8 -0
- package/dist/src/server/locales.d.ts.map +1 -0
- package/dist/src/server/locales.js +12 -0
- package/dist/src/server/normalize-homepage-config.d.ts +7 -0
- package/dist/src/server/normalize-homepage-config.d.ts.map +1 -0
- package/dist/src/server/normalize-homepage-config.js +281 -0
- package/dist/src/server/notifications.d.ts +2 -0
- package/dist/src/server/notifications.d.ts.map +1 -0
- package/dist/src/server/notifications.js +20 -0
- package/dist/src/server/onboarding.d.ts +2 -0
- package/dist/src/server/onboarding.d.ts.map +1 -0
- package/dist/src/server/onboarding.js +8 -0
- package/dist/src/server/orders.d.ts +63 -0
- package/dist/src/server/orders.d.ts.map +1 -0
- package/dist/src/server/orders.js +230 -0
- package/dist/src/server/page-input.d.ts +23 -0
- package/dist/src/server/page-input.d.ts.map +1 -0
- package/dist/src/server/page-input.js +89 -0
- package/dist/src/server/payment-details.d.ts +5 -0
- package/dist/src/server/payment-details.d.ts.map +1 -0
- package/dist/src/server/payment-details.js +28 -0
- package/dist/src/server/payment.d.ts +3 -0
- package/dist/src/server/payment.d.ts.map +1 -0
- package/dist/src/server/payment.js +13 -0
- package/dist/src/server/pincode.d.ts +7 -0
- package/dist/src/server/pincode.d.ts.map +1 -0
- package/dist/src/server/pincode.js +30 -0
- package/dist/src/server/products.d.ts +54 -0
- package/dist/src/server/products.d.ts.map +1 -0
- package/dist/src/server/products.js +154 -0
- package/dist/src/server/regions.d.ts +5 -0
- package/dist/src/server/regions.d.ts.map +1 -0
- package/dist/src/server/regions.js +57 -0
- package/dist/src/server/resolve-home-segment-data.d.ts +25 -0
- package/dist/src/server/resolve-home-segment-data.d.ts.map +1 -0
- package/dist/src/server/resolve-home-segment-data.js +20 -0
- package/dist/src/server/returns.d.ts +29 -0
- package/dist/src/server/returns.d.ts.map +1 -0
- package/dist/src/server/returns.js +132 -0
- package/dist/src/server/shoppable-looks.d.ts +17 -0
- package/dist/src/server/shoppable-looks.d.ts.map +1 -0
- package/dist/src/server/shoppable-looks.js +136 -0
- package/dist/src/server/swaps.d.ts +15 -0
- package/dist/src/server/swaps.d.ts.map +1 -0
- package/dist/src/server/swaps.js +89 -0
- package/dist/src/server/variants.d.ts +3 -0
- package/dist/src/server/variants.d.ts.map +1 -0
- package/dist/src/server/variants.js +15 -0
- package/dist/src/server/wishlist.d.ts +11 -0
- package/dist/src/server/wishlist.d.ts.map +1 -0
- package/dist/src/server/wishlist.js +49 -0
- package/dist/src/util/get-locale-header.d.ts +4 -0
- package/dist/src/util/get-locale-header.d.ts.map +1 -0
- package/dist/src/util/get-locale-header.js +7 -0
- package/dist/src/util/medusa-error.d.ts +2 -0
- package/dist/src/util/medusa-error.d.ts.map +1 -0
- package/dist/src/util/medusa-error.js +18 -0
- package/dist/src/util/revalidate-cart.d.ts +2 -0
- package/dist/src/util/revalidate-cart.d.ts.map +1 -0
- package/dist/src/util/revalidate-cart.js +8 -0
- package/dist/src/util/sort-products.d.ts +3 -0
- package/dist/src/util/sort-products.d.ts.map +1 -0
- package/dist/src/util/sort-products.js +1 -0
- package/dist/src/util/store-client.d.ts +11 -0
- package/dist/src/util/store-client.d.ts.map +1 -0
- package/dist/src/util/store-client.js +75 -0
- package/package.json +6 -1
- package/src/server/dynamic-config.ts +77 -10
- package/src/server/home-sections/promo-announcements.ts +6 -4
- package/src/server/home.ts +5 -1
- package/src/server/homepage-config.types.ts +113 -0
- package/src/server/index.ts +2 -1
- package/src/server/normalize-homepage-config.ts +38 -0
- package/src/server/page-input.ts +1 -0
- package/src/server/storefront-cms.ts +46 -0
- package/src/server/resolve-home-segment-data.ts +0 -63
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "medusa-storefront-data",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Medusa storefront server data layer extracted from Next.js storefront",
|
|
6
6
|
"license": "MIT",
|
|
@@ -172,6 +172,11 @@
|
|
|
172
172
|
"types": "./dist/server/help-sections/help-faq.d.ts",
|
|
173
173
|
"import": "./src/server/help-sections/help-faq.ts",
|
|
174
174
|
"default": "./src/server/help-sections/help-faq.ts"
|
|
175
|
+
},
|
|
176
|
+
"./storefront-cms": {
|
|
177
|
+
"types": "./src/server/storefront-cms.ts",
|
|
178
|
+
"import": "./src/server/storefront-cms.ts",
|
|
179
|
+
"default": "./src/server/storefront-cms.ts"
|
|
175
180
|
}
|
|
176
181
|
},
|
|
177
182
|
"main": "./dist/server/index.js",
|
|
@@ -675,11 +675,64 @@ export function getFaqsFromPageInput(
|
|
|
675
675
|
}
|
|
676
676
|
|
|
677
677
|
|
|
678
|
+
export type PromoAnnouncementsConfig = {
|
|
679
|
+
messages: string[]
|
|
680
|
+
icon?: string
|
|
681
|
+
iconAlt?: string
|
|
682
|
+
ariaLabel: string
|
|
683
|
+
separator?: string
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function parsePromoAnnouncementsUi(
|
|
687
|
+
...sources: Array<Record<string, unknown> | null | undefined>
|
|
688
|
+
): Pick<PromoAnnouncementsConfig, "icon" | "iconAlt" | "ariaLabel" | "separator"> {
|
|
689
|
+
const pick = (key: string, alt?: string) => {
|
|
690
|
+
for (const src of sources) {
|
|
691
|
+
if (!src) continue
|
|
692
|
+
const value = normalizeCmsText(src[key] ?? (alt ? src[alt] : undefined))
|
|
693
|
+
if (value) return value
|
|
694
|
+
}
|
|
695
|
+
return undefined
|
|
696
|
+
}
|
|
697
|
+
return {
|
|
698
|
+
icon: pick("icon", "ticker-icon"),
|
|
699
|
+
iconAlt: pick("iconAlt", "icon-alt"),
|
|
700
|
+
ariaLabel: pick("ariaLabel", "aria-label") ?? "Store announcements",
|
|
701
|
+
separator: pick("separator", "message-separator"),
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/** Promo ticker messages + UI copy (icon, aria label, separator). */
|
|
706
|
+
export function getPromoAnnouncementsFromPageInput(
|
|
707
|
+
pageInput?: HomepageConfig | null
|
|
708
|
+
): PromoAnnouncementsConfig {
|
|
709
|
+
const homepageConfig = resolvePageInput(pageInput)
|
|
710
|
+
const block = getMergedSectionBlock("promoAnnouncements", pageInput)
|
|
711
|
+
const promoUi =
|
|
712
|
+
(homepageConfig.promoUi as Record<string, unknown> | undefined) ??
|
|
713
|
+
(homepageConfig["promo-ui"] as Record<string, unknown> | undefined)
|
|
714
|
+
|
|
715
|
+
let messages = parseAnnouncementMessages(block)
|
|
716
|
+
if (messages.length === 0) {
|
|
717
|
+
const legacy =
|
|
718
|
+
homepageConfig["announcement-messages"] ??
|
|
719
|
+
homepageConfig["announcement-bar"]
|
|
720
|
+
if (Array.isArray(legacy)) {
|
|
721
|
+
messages = legacy
|
|
722
|
+
.map((m) => (typeof m === "string" ? m.trim() : ""))
|
|
723
|
+
.filter(Boolean)
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
const ui = parsePromoAnnouncementsUi(promoUi, block)
|
|
728
|
+
return { messages, ...ui }
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** @deprecated Use {@link getPromoAnnouncementsFromPageInput}. */
|
|
678
732
|
export function getAnnouncementMessagesFromPageInput(
|
|
679
733
|
pageInput?: HomepageConfig | null
|
|
680
734
|
): string[] {
|
|
681
|
-
|
|
682
|
-
return parseAnnouncementMessages(block)
|
|
735
|
+
return getPromoAnnouncementsFromPageInput(pageInput).messages
|
|
683
736
|
}
|
|
684
737
|
|
|
685
738
|
|
|
@@ -734,14 +787,11 @@ export type BrandPillarConfig = {
|
|
|
734
787
|
href?: string
|
|
735
788
|
}
|
|
736
789
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
):
|
|
740
|
-
const block = getMergedSectionBlock("brandPillars", pageInput)
|
|
741
|
-
const copy = parseSectionCopy(block)
|
|
742
|
-
const sectionTitle = copy.title ?? copy.name ?? ""
|
|
790
|
+
function parseBrandPillarsFromBlock(
|
|
791
|
+
block: Record<string, unknown>
|
|
792
|
+
): BrandPillarConfig[] {
|
|
743
793
|
const raw = block.pillars ?? block["brand-pillars"] ?? []
|
|
744
|
-
|
|
794
|
+
return (Array.isArray(raw) ? raw : [])
|
|
745
795
|
.map((item: unknown) => {
|
|
746
796
|
if (!item || typeof item !== "object") return null
|
|
747
797
|
const row = (item as Record<string, unknown>)["pillar"] ?? item
|
|
@@ -749,9 +799,26 @@ export function getBrandPillarsFromPageInput(
|
|
|
749
799
|
const title = String(p.title ?? p.name ?? "").trim()
|
|
750
800
|
const description = String(p.description ?? p.text ?? "").trim()
|
|
751
801
|
const image = (p.image ?? p.icon) as string | undefined
|
|
752
|
-
|
|
802
|
+
const href = (p.href ?? p.link ?? p.url) as string | undefined
|
|
803
|
+
return title && description
|
|
804
|
+
? { title, description, image, href: href ? String(href) : undefined }
|
|
805
|
+
: null
|
|
753
806
|
})
|
|
754
807
|
.filter(Boolean) as BrandPillarConfig[]
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
export function getBrandPillarsFromPageInput(
|
|
811
|
+
pageInput?: HomepageConfig | null
|
|
812
|
+
): { sectionTitle: string; pillars: BrandPillarConfig[] } {
|
|
813
|
+
const block = getMergedSectionBlock("brandPillars", pageInput)
|
|
814
|
+
const copy = parseSectionCopy(block)
|
|
815
|
+
const sectionTitle = copy.title ?? copy.name ?? ""
|
|
816
|
+
let pillars = parseBrandPillarsFromBlock(block)
|
|
817
|
+
if (pillars.length === 0) {
|
|
818
|
+
pillars = parseBrandPillarsFromBlock(
|
|
819
|
+
DEFAULT_HOMEPAGE_SECTIONS.brandPillars as Record<string, unknown>
|
|
820
|
+
)
|
|
821
|
+
}
|
|
755
822
|
return { sectionTitle, pillars }
|
|
756
823
|
}
|
|
757
824
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import "server-only"
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getPromoAnnouncementsFromPageInput } from "../dynamic-config"
|
|
4
4
|
import type { SectionLoaderOptions } from "./shared"
|
|
5
5
|
|
|
6
6
|
export type PromoAnnouncementsSectionData = {
|
|
7
7
|
messages: string[]
|
|
8
|
+
icon?: string
|
|
9
|
+
iconAlt?: string
|
|
10
|
+
ariaLabel: string
|
|
11
|
+
separator?: string
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
export async function loadPromoAnnouncementsSectionData(
|
|
11
15
|
_countryCode: string,
|
|
12
16
|
options?: SectionLoaderOptions
|
|
13
17
|
): Promise<PromoAnnouncementsSectionData> {
|
|
14
|
-
return
|
|
15
|
-
messages: getAnnouncementMessagesFromPageInput(options?.pageInput ?? null),
|
|
16
|
-
}
|
|
18
|
+
return getPromoAnnouncementsFromPageInput(options?.pageInput ?? null)
|
|
17
19
|
}
|
package/src/server/home.ts
CHANGED
|
@@ -10,7 +10,10 @@ import type {
|
|
|
10
10
|
} from "./dynamic-config"
|
|
11
11
|
import type { ShoppableLook } from "./shoppable-looks"
|
|
12
12
|
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Shared homepage data shape used by `medusa-storefront-compose`.
|
|
15
|
+
* This is a type-only module (no runtime loaders).
|
|
16
|
+
*/
|
|
14
17
|
export type HomePageData = {
|
|
15
18
|
region: HttpTypes.StoreRegion | null
|
|
16
19
|
collections: Array<Record<string, unknown>>
|
|
@@ -48,3 +51,4 @@ export type HomePageData = {
|
|
|
48
51
|
features: Array<{ name: string; icon: string }>
|
|
49
52
|
}
|
|
50
53
|
}
|
|
54
|
+
|
|
@@ -23,6 +23,18 @@ export type HomepagePromoAnnouncementsSection = HomepageSectionCopyFields & {
|
|
|
23
23
|
messages?: string[]
|
|
24
24
|
items?: Array<string | { message?: string; text?: string }>
|
|
25
25
|
"announcement-messages"?: string[]
|
|
26
|
+
/** Optional icon shown before the ticker. */
|
|
27
|
+
icon?: string
|
|
28
|
+
iconAlt?: string
|
|
29
|
+
ariaLabel?: string
|
|
30
|
+
separator?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type HomepagePromoUiConfig = {
|
|
34
|
+
icon?: string
|
|
35
|
+
iconAlt?: string
|
|
36
|
+
ariaLabel?: string
|
|
37
|
+
separator?: string
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
export type HomepagePromoCountdownSection = HomepageSectionCopyFields & {
|
|
@@ -277,6 +289,84 @@ export type HomepagePromoBarConfig = {
|
|
|
277
289
|
"promo-active"?: boolean
|
|
278
290
|
}
|
|
279
291
|
|
|
292
|
+
export type HomepageHeaderNavStaticItem = {
|
|
293
|
+
type?: "static"
|
|
294
|
+
label?: string
|
|
295
|
+
href?: string
|
|
296
|
+
icon?: string
|
|
297
|
+
iconSrc?: string
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export type HomepageHeaderNavCategoriesItem = {
|
|
301
|
+
type: "categories"
|
|
302
|
+
/** Limit how many categories to include (after filtering). */
|
|
303
|
+
limit?: number
|
|
304
|
+
/** Show only these category handles (in this exact order). */
|
|
305
|
+
handles?: string[]
|
|
306
|
+
/** Only include top-level categories (no parent). Default: true */
|
|
307
|
+
topLevelOnly?: boolean
|
|
308
|
+
/** Optional prefix label like "Shop by category" (not used in desktop links). */
|
|
309
|
+
label?: string
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export type HomepageHeaderNavItem =
|
|
313
|
+
| HomepageHeaderNavStaticItem
|
|
314
|
+
| HomepageHeaderNavCategoriesItem
|
|
315
|
+
|
|
316
|
+
export type HomepageHeaderNavConfig = {
|
|
317
|
+
items?: HomepageHeaderNavItem[]
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export type HomepageFooterNavLink = {
|
|
321
|
+
label?: string
|
|
322
|
+
href?: string
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export type HomepageFooterNavColumn = {
|
|
326
|
+
title?: string
|
|
327
|
+
links?: HomepageFooterNavLink[]
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export type HomepageFooterNavConfig = {
|
|
331
|
+
columns?: HomepageFooterNavColumn[]
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export type HomepageFooterUiConfig = {
|
|
335
|
+
shopColumnTitle?: string
|
|
336
|
+
contactTitle?: string
|
|
337
|
+
newsletterBlurb?: string
|
|
338
|
+
newsletterPlaceholder?: string
|
|
339
|
+
newsletterSubmitLabel?: string
|
|
340
|
+
newsletterInvalidEmail?: string
|
|
341
|
+
newsletterErrorMessage?: string
|
|
342
|
+
/** Supports `{siteName}` token. */
|
|
343
|
+
copyrightText?: string
|
|
344
|
+
icons?: {
|
|
345
|
+
phone?: string
|
|
346
|
+
email?: string
|
|
347
|
+
address?: string
|
|
348
|
+
}
|
|
349
|
+
social?: {
|
|
350
|
+
facebook?: string
|
|
351
|
+
linkedin?: string
|
|
352
|
+
instagram?: string
|
|
353
|
+
youtube?: string
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export type HomepageHeaderUiConfig = {
|
|
358
|
+
icons?: {
|
|
359
|
+
cart?: string
|
|
360
|
+
account?: string
|
|
361
|
+
search?: string
|
|
362
|
+
}
|
|
363
|
+
search?: {
|
|
364
|
+
placeholder?: string
|
|
365
|
+
title?: string
|
|
366
|
+
emptyStateText?: string
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
280
370
|
export type HomepageFaqEntry = {
|
|
281
371
|
"faq-category"?: string
|
|
282
372
|
"faq-question"?: string
|
|
@@ -292,6 +382,29 @@ export type HomepageConfig = {
|
|
|
292
382
|
"website-description"?: string
|
|
293
383
|
website_description?: string
|
|
294
384
|
|
|
385
|
+
/**
|
|
386
|
+
* Header navigation (desktop + mobile).
|
|
387
|
+
* Use `type: "static"` for hardcoded links, or `type: "categories"` to auto-populate from product categories.
|
|
388
|
+
*/
|
|
389
|
+
headerNav?: HomepageHeaderNavConfig
|
|
390
|
+
"header-nav"?: HomepageHeaderNavConfig
|
|
391
|
+
|
|
392
|
+
/** Footer navigation columns + links. */
|
|
393
|
+
footerNav?: HomepageFooterNavConfig
|
|
394
|
+
"footer-nav"?: HomepageFooterNavConfig
|
|
395
|
+
|
|
396
|
+
/** Footer static copy + icon overrides. */
|
|
397
|
+
footerUi?: HomepageFooterUiConfig
|
|
398
|
+
"footer-ui"?: HomepageFooterUiConfig
|
|
399
|
+
|
|
400
|
+
/** Header icons + search copy. */
|
|
401
|
+
headerUi?: HomepageHeaderUiConfig
|
|
402
|
+
"header-ui"?: HomepageHeaderUiConfig
|
|
403
|
+
|
|
404
|
+
/** Promo ticker icon + accessibility copy (merged with `sections.promoAnnouncements`). */
|
|
405
|
+
promoUi?: HomepagePromoUiConfig
|
|
406
|
+
"promo-ui"?: HomepagePromoUiConfig
|
|
407
|
+
|
|
295
408
|
/** Hero carousel — used by `hero` section (not `sections.hero`). */
|
|
296
409
|
"homepage-banner-array"?: HomepageBannerEntry[]
|
|
297
410
|
|
package/src/server/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from "./customer-registration"
|
|
|
5
5
|
export * from "./customer"
|
|
6
6
|
export * from "./dynamic-config"
|
|
7
7
|
export * from "./page-input"
|
|
8
|
-
export * from "./resolve-home-segment-data"
|
|
9
8
|
export * from "./fulfillment"
|
|
10
9
|
export * from "./guest"
|
|
11
10
|
export * from "./locale-actions"
|
|
@@ -22,3 +21,5 @@ export * from "./swaps"
|
|
|
22
21
|
export * from "./variants"
|
|
23
22
|
export * from "./wishlist"
|
|
24
23
|
export * from "./home"
|
|
24
|
+
export * from "./shoppable-looks"
|
|
25
|
+
export * from "./storefront-cms"
|
|
@@ -263,6 +263,44 @@ export function normalizeHomepageConfig(input: unknown): HomepageConfig {
|
|
|
263
263
|
sections: sections as HomepageConfig["sections"],
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
const headerNav =
|
|
267
|
+
asObject(site?.headerNav) ?? asObject(site?.["header-nav"]) ?? asObject(site?.nav)
|
|
268
|
+
if (headerNav) {
|
|
269
|
+
legacy.headerNav = headerNav as never
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const footerNav =
|
|
273
|
+
asObject(site?.footerNav) ??
|
|
274
|
+
asObject(site?.["footer-nav"]) ??
|
|
275
|
+
asObject(site?.footer)
|
|
276
|
+
if (footerNav) {
|
|
277
|
+
legacy.footerNav = footerNav as never
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const footerUi =
|
|
281
|
+
asObject(site?.footerUi) ??
|
|
282
|
+
asObject(site?.["footer-ui"]) ??
|
|
283
|
+
asObject(site?.footer)
|
|
284
|
+
if (footerUi) {
|
|
285
|
+
legacy.footerUi = footerUi as never
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const headerUi =
|
|
289
|
+
asObject(site?.headerUi) ??
|
|
290
|
+
asObject(site?.["header-ui"]) ??
|
|
291
|
+
asObject(site?.header)
|
|
292
|
+
if (headerUi) {
|
|
293
|
+
legacy.headerUi = headerUi as never
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const promoUi =
|
|
297
|
+
asObject(site?.promoUi) ??
|
|
298
|
+
asObject(site?.["promo-ui"]) ??
|
|
299
|
+
asObject(site?.promo)
|
|
300
|
+
if (promoUi) {
|
|
301
|
+
legacy.promoUi = promoUi as never
|
|
302
|
+
}
|
|
303
|
+
|
|
266
304
|
if (desktop.length) legacy["homepage-banner-array"] = desktop as never
|
|
267
305
|
if (mobile.length) legacy["app-banner-array"] = mobile as never
|
|
268
306
|
|
package/src/server/page-input.ts
CHANGED
|
@@ -86,6 +86,7 @@ export function simplifiedHomepageConfigFromDynamicResponse(
|
|
|
86
86
|
const site: Loose = {}
|
|
87
87
|
if (siteBranding) {
|
|
88
88
|
if (siteBranding.logo != null) site.logo = siteBranding.logo
|
|
89
|
+
if (siteBranding.brandName != null) site.brandName = siteBranding.brandName
|
|
89
90
|
if (siteBranding.description != null) {
|
|
90
91
|
site.description = siteBranding.description
|
|
91
92
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "server-only"
|
|
2
|
+
|
|
3
|
+
import { cache } from "react"
|
|
4
|
+
import type { StorefrontPageInput } from "./page-input"
|
|
5
|
+
import {
|
|
6
|
+
getContactInfoFromPageInput,
|
|
7
|
+
getHelpFaqFromPageInput,
|
|
8
|
+
} from "./dynamic-config"
|
|
9
|
+
import { getDynamicConfig, homepageConfigFromDynamicResponse } from "./dynamic-config"
|
|
10
|
+
|
|
11
|
+
type Maybe<T> = T | null | undefined
|
|
12
|
+
|
|
13
|
+
/** Cached CMS merge for the storefront (fetch once per request). */
|
|
14
|
+
export const loadStorefrontPageInput = cache(
|
|
15
|
+
async (): Promise<StorefrontPageInput> => {
|
|
16
|
+
const raw = await getDynamicConfig()
|
|
17
|
+
return homepageConfigFromDynamicResponse(raw)
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export async function resolveStorefrontPageInput(
|
|
22
|
+
pageInput?: Maybe<StorefrontPageInput>
|
|
23
|
+
): Promise<StorefrontPageInput> {
|
|
24
|
+
return (pageInput ?? (await loadStorefrontPageInput())) as StorefrontPageInput
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function loadContactInfoFromStorefrontInput(
|
|
28
|
+
pageInput?: Maybe<StorefrontPageInput>
|
|
29
|
+
) {
|
|
30
|
+
const resolved = await resolveStorefrontPageInput(pageInput)
|
|
31
|
+
return getContactInfoFromPageInput(resolved)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function loadContactEmailFromStorefrontInput(
|
|
35
|
+
pageInput?: Maybe<StorefrontPageInput>
|
|
36
|
+
): Promise<string> {
|
|
37
|
+
const info = await loadContactInfoFromStorefrontInput(pageInput)
|
|
38
|
+
return info?.email ?? ""
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function loadHelpFaqFromStorefrontInput(
|
|
42
|
+
pageInput?: Maybe<StorefrontPageInput>
|
|
43
|
+
) {
|
|
44
|
+
const resolved = await resolveStorefrontPageInput(pageInput)
|
|
45
|
+
return getHelpFaqFromPageInput(resolved)
|
|
46
|
+
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import "server-only"
|
|
2
|
-
|
|
3
|
-
import type { HomepageConfig } from "./homepage-config.types"
|
|
4
|
-
import {
|
|
5
|
-
getAboutBrandFromPageInput,
|
|
6
|
-
getAnnouncementMessagesFromPageInput,
|
|
7
|
-
getAppBannersFromPageInput,
|
|
8
|
-
getBlogPostsFromPageInput,
|
|
9
|
-
getBrandPillarsFromPageInput,
|
|
10
|
-
getFeaturesFromPageInput,
|
|
11
|
-
getHomeBannersFromPageInput,
|
|
12
|
-
getHomeSectionsCopyFromPageInput,
|
|
13
|
-
getInstagramPostsFromPageInput,
|
|
14
|
-
getPromoCountdownFromPageInput,
|
|
15
|
-
getTestimonialsFromPageInput,
|
|
16
|
-
getTrustFeaturesFromPageInput,
|
|
17
|
-
getVideoStoriesFromPageInput,
|
|
18
|
-
type AboutBrandConfig,
|
|
19
|
-
type BlogPostConfig,
|
|
20
|
-
type BrandPillarConfig,
|
|
21
|
-
type HomepageBanner,
|
|
22
|
-
type HomeSectionsCopy,
|
|
23
|
-
type InstagramPostsData,
|
|
24
|
-
type TrustFeaturesConfig,
|
|
25
|
-
} from "./dynamic-config"
|
|
26
|
-
|
|
27
|
-
/** Config-driven homepage fields (no Medusa catalog APIs). */
|
|
28
|
-
export type HomeSegmentConfigData = {
|
|
29
|
-
homeBanners: HomepageBanner[] | null
|
|
30
|
-
appBanners: HomepageBanner[] | null
|
|
31
|
-
whyChooseUsFeatures: ReturnType<typeof getFeaturesFromPageInput>
|
|
32
|
-
testimonials: ReturnType<typeof getTestimonialsFromPageInput>
|
|
33
|
-
videoStories: ReturnType<typeof getVideoStoriesFromPageInput>
|
|
34
|
-
announcementMessages: string[]
|
|
35
|
-
promoCountdown: ReturnType<typeof getPromoCountdownFromPageInput>
|
|
36
|
-
aboutBrand: AboutBrandConfig
|
|
37
|
-
brandPillars: { sectionTitle: string; pillars: BrandPillarConfig[] }
|
|
38
|
-
blogPosts: BlogPostConfig[]
|
|
39
|
-
instagramPosts: InstagramPostsData
|
|
40
|
-
sectionsCopy: HomeSectionsCopy
|
|
41
|
-
trustFeatures: TrustFeaturesConfig
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Resolve all segment JSON from `pageInput` (package defaults when omitted). */
|
|
45
|
-
export function resolveHomeSegmentConfigData(
|
|
46
|
-
pageInput?: HomepageConfig | null
|
|
47
|
-
): HomeSegmentConfigData {
|
|
48
|
-
return {
|
|
49
|
-
homeBanners: getHomeBannersFromPageInput(pageInput),
|
|
50
|
-
appBanners: getAppBannersFromPageInput(pageInput),
|
|
51
|
-
whyChooseUsFeatures: getFeaturesFromPageInput(pageInput),
|
|
52
|
-
testimonials: getTestimonialsFromPageInput(pageInput),
|
|
53
|
-
videoStories: getVideoStoriesFromPageInput(pageInput),
|
|
54
|
-
announcementMessages: getAnnouncementMessagesFromPageInput(pageInput),
|
|
55
|
-
promoCountdown: getPromoCountdownFromPageInput(pageInput),
|
|
56
|
-
aboutBrand: getAboutBrandFromPageInput(pageInput),
|
|
57
|
-
brandPillars: getBrandPillarsFromPageInput(pageInput),
|
|
58
|
-
blogPosts: getBlogPostsFromPageInput(pageInput),
|
|
59
|
-
instagramPosts: getInstagramPostsFromPageInput(pageInput),
|
|
60
|
-
sectionsCopy: getHomeSectionsCopyFromPageInput(pageInput),
|
|
61
|
-
trustFeatures: getTrustFeaturesFromPageInput(pageInput),
|
|
62
|
-
}
|
|
63
|
-
}
|