medusa-storefront-data 2.3.0 → 2.5.1
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 +133 -0
- package/dist/segment-data/default-page-input.json +191 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/cookies.d.ts.map +1 -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.map +1 -0
- package/dist/src/middleware.d.ts.map +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.map +1 -0
- package/dist/{server → src/server}/cart.js +20 -20
- package/dist/src/server/categories.d.ts.map +1 -0
- package/dist/src/server/collections.d.ts.map +1 -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.map +1 -0
- package/dist/src/server/customer-registration.d.ts.map +1 -0
- package/dist/src/server/customer.d.ts.map +1 -0
- package/dist/{server → src/server}/customer.js +11 -11
- 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 +157 -0
- package/dist/src/server/dynamic-config.d.ts.map +1 -0
- package/dist/src/server/dynamic-config.js +573 -0
- package/dist/src/server/fulfillment.d.ts.map +1 -0
- package/dist/{server → src/server}/fulfillment.js +3 -3
- package/dist/src/server/guest.d.ts.map +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 +7 -0
- package/dist/src/server/home-sections/promo-announcements.d.ts.map +1 -0
- package/dist/src/server/home-sections/promo-announcements.js +7 -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/{server → src/server}/home.d.ts +18 -9
- 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 +274 -0
- package/dist/src/server/homepage-config.types.d.ts.map +1 -0
- package/dist/src/server/homepage-config.types.js +33 -0
- package/dist/{server → src/server}/homepage-section-defaults.d.ts +35 -2
- package/dist/src/server/homepage-section-defaults.d.ts.map +1 -0
- package/dist/{server → src/server}/homepage-section-defaults.js +41 -2
- package/dist/{server → src/server}/index.d.ts +2 -0
- package/dist/src/server/index.d.ts.map +1 -0
- package/dist/{server → src/server}/index.js +2 -0
- package/dist/src/server/locale-actions.d.ts.map +1 -0
- package/dist/src/server/locales.d.ts.map +1 -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 +213 -0
- package/dist/src/server/notifications.d.ts.map +1 -0
- package/dist/src/server/onboarding.d.ts.map +1 -0
- package/dist/src/server/orders.d.ts.map +1 -0
- package/dist/{server → src/server}/orders.js +6 -6
- package/dist/src/server/page-input.d.ts +19 -0
- package/dist/src/server/page-input.d.ts.map +1 -0
- package/dist/src/server/page-input.js +42 -0
- package/dist/src/server/payment-details.d.ts.map +1 -0
- package/dist/{server → src/server}/payment-details.js +5 -5
- package/dist/src/server/payment.d.ts.map +1 -0
- package/dist/{server → src/server}/payment.js +2 -2
- package/dist/src/server/pincode.d.ts.map +1 -0
- package/dist/src/server/products.d.ts.map +1 -0
- package/dist/src/server/regions.d.ts.map +1 -0
- package/dist/{server → src/server}/regions.js +2 -2
- 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.map +1 -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.map +1 -0
- package/dist/src/server/variants.d.ts.map +1 -0
- package/dist/src/server/wishlist.d.ts.map +1 -0
- package/dist/src/util/get-locale-header.d.ts.map +1 -0
- package/dist/src/util/medusa-error.d.ts.map +1 -0
- package/dist/src/util/revalidate-cart.d.ts.map +1 -0
- package/dist/src/util/sort-products.d.ts.map +1 -0
- package/dist/{util → src/util}/store-client.d.ts +0 -2
- package/dist/src/util/store-client.d.ts.map +1 -0
- package/dist/{util → src/util}/store-client.js +0 -2
- package/homepage-config.example.json +209 -0
- package/homepage-sections.example.json +55 -0
- package/package.json +120 -156
- package/segment-data/default-page-input.json +191 -0
- package/src/server/brand-pillars-from-categories.ts +156 -0
- package/src/server/cart.ts +20 -20
- package/src/server/config-merge.ts +31 -0
- package/src/server/customer.ts +11 -11
- package/src/server/dynamic-config.ts +507 -566
- package/src/server/fulfillment.ts +3 -3
- package/src/server/home-sections/about-brand.ts +24 -0
- package/src/server/home-sections/baptism-picks.ts +46 -0
- package/src/server/home-sections/baptism.ts +64 -0
- package/src/server/home-sections/blog-posts.ts +23 -0
- package/src/server/home-sections/brand-marquee.ts +17 -0
- package/src/server/home-sections/brand-pillars.ts +23 -0
- package/src/server/home-sections/category-pills.ts +32 -0
- package/src/server/home-sections/celebrity-trust.ts +42 -0
- package/src/server/home-sections/features.ts +23 -0
- package/src/server/home-sections/hero.ts +24 -0
- package/src/server/home-sections/instagram-posts.ts +23 -0
- package/src/server/home-sections/loved-by-moms.ts +34 -0
- package/src/server/home-sections/luxe-favourites.ts +30 -0
- package/src/server/home-sections/new-arrivals-classic.ts +21 -0
- package/src/server/home-sections/new-arrivals.ts +47 -0
- package/src/server/home-sections/promo-announcements.ts +17 -0
- package/src/server/home-sections/promo-countdown.ts +15 -0
- package/src/server/home-sections/shared.ts +44 -0
- package/src/server/home-sections/shop-by-age.ts +26 -0
- package/src/server/home-sections/shop-by-category.ts +28 -0
- package/src/server/home-sections/testimonials.ts +23 -0
- package/src/server/home-sections/theme-dresses.ts +49 -0
- package/src/server/home-sections/video-stories.ts +23 -0
- package/src/server/home-sections/why-choose-us.ts +23 -0
- package/src/server/home.ts +46 -207
- package/src/server/homepage-config.types.ts +335 -0
- package/src/server/homepage-section-defaults.ts +41 -2
- package/src/server/index.ts +2 -0
- package/src/server/normalize-homepage-config.ts +240 -0
- package/src/server/orders.ts +6 -6
- package/src/server/page-input.ts +66 -0
- package/src/server/payment-details.ts +5 -5
- package/src/server/payment.ts +2 -2
- package/src/server/regions.ts +2 -2
- package/src/server/resolve-home-segment-data.ts +63 -0
- package/src/server/shoppable-looks.ts +178 -0
- package/src/util/store-client.ts +0 -3
- package/dist/config.d.ts.map +0 -1
- package/dist/cookies.d.ts.map +0 -1
- package/dist/edge.d.ts.map +0 -1
- package/dist/middleware.d.ts.map +0 -1
- package/dist/server/cart.d.ts.map +0 -1
- package/dist/server/categories.d.ts.map +0 -1
- package/dist/server/collections.d.ts.map +0 -1
- package/dist/server/contact.d.ts.map +0 -1
- package/dist/server/customer-registration.d.ts.map +0 -1
- package/dist/server/customer.d.ts.map +0 -1
- package/dist/server/dynamic-config.d.ts +0 -202
- package/dist/server/dynamic-config.d.ts.map +0 -1
- package/dist/server/dynamic-config.js +0 -675
- package/dist/server/fulfillment.d.ts.map +0 -1
- package/dist/server/guest.d.ts.map +0 -1
- package/dist/server/home.d.ts.map +0 -1
- package/dist/server/home.js +0 -124
- package/dist/server/homepage-section-defaults.d.ts.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/locale-actions.d.ts.map +0 -1
- package/dist/server/locales.d.ts.map +0 -1
- package/dist/server/notifications.d.ts.map +0 -1
- package/dist/server/onboarding.d.ts.map +0 -1
- package/dist/server/orders.d.ts.map +0 -1
- package/dist/server/payment-details.d.ts.map +0 -1
- package/dist/server/payment.d.ts.map +0 -1
- package/dist/server/pincode.d.ts.map +0 -1
- package/dist/server/products.d.ts.map +0 -1
- package/dist/server/regions.d.ts.map +0 -1
- package/dist/server/returns.d.ts.map +0 -1
- package/dist/server/swaps.d.ts.map +0 -1
- package/dist/server/variants.d.ts.map +0 -1
- package/dist/server/wishlist.d.ts.map +0 -1
- package/dist/util/get-locale-header.d.ts.map +0 -1
- package/dist/util/medusa-error.d.ts.map +0 -1
- package/dist/util/revalidate-cart.d.ts.map +0 -1
- package/dist/util/sort-products.d.ts.map +0 -1
- package/dist/util/store-client.d.ts.map +0 -1
- /package/dist/{config.d.ts → src/config.d.ts} +0 -0
- /package/dist/{config.js → src/config.js} +0 -0
- /package/dist/{cookies.d.ts → src/cookies.d.ts} +0 -0
- /package/dist/{cookies.js → src/cookies.js} +0 -0
- /package/dist/{edge.d.ts → src/edge.d.ts} +0 -0
- /package/dist/{edge.js → src/edge.js} +0 -0
- /package/dist/{middleware.d.ts → src/middleware.d.ts} +0 -0
- /package/dist/{middleware.js → src/middleware.js} +0 -0
- /package/dist/{server → src/server}/cart.d.ts +0 -0
- /package/dist/{server → src/server}/categories.d.ts +0 -0
- /package/dist/{server → src/server}/categories.js +0 -0
- /package/dist/{server → src/server}/collections.d.ts +0 -0
- /package/dist/{server → src/server}/collections.js +0 -0
- /package/dist/{server → src/server}/contact.d.ts +0 -0
- /package/dist/{server → src/server}/contact.js +0 -0
- /package/dist/{server → src/server}/customer-registration.d.ts +0 -0
- /package/dist/{server → src/server}/customer-registration.js +0 -0
- /package/dist/{server → src/server}/customer.d.ts +0 -0
- /package/dist/{server → src/server}/fulfillment.d.ts +0 -0
- /package/dist/{server → src/server}/guest.d.ts +0 -0
- /package/dist/{server → src/server}/guest.js +0 -0
- /package/dist/{server → src/server}/locale-actions.d.ts +0 -0
- /package/dist/{server → src/server}/locale-actions.js +0 -0
- /package/dist/{server → src/server}/locales.d.ts +0 -0
- /package/dist/{server → src/server}/locales.js +0 -0
- /package/dist/{server → src/server}/notifications.d.ts +0 -0
- /package/dist/{server → src/server}/notifications.js +0 -0
- /package/dist/{server → src/server}/onboarding.d.ts +0 -0
- /package/dist/{server → src/server}/onboarding.js +0 -0
- /package/dist/{server → src/server}/orders.d.ts +0 -0
- /package/dist/{server → src/server}/payment-details.d.ts +0 -0
- /package/dist/{server → src/server}/payment.d.ts +0 -0
- /package/dist/{server → src/server}/pincode.d.ts +0 -0
- /package/dist/{server → src/server}/pincode.js +0 -0
- /package/dist/{server → src/server}/products.d.ts +0 -0
- /package/dist/{server → src/server}/products.js +0 -0
- /package/dist/{server → src/server}/regions.d.ts +0 -0
- /package/dist/{server → src/server}/returns.d.ts +0 -0
- /package/dist/{server → src/server}/returns.js +0 -0
- /package/dist/{server → src/server}/swaps.d.ts +0 -0
- /package/dist/{server → src/server}/swaps.js +0 -0
- /package/dist/{server → src/server}/variants.d.ts +0 -0
- /package/dist/{server → src/server}/variants.js +0 -0
- /package/dist/{server → src/server}/wishlist.d.ts +0 -0
- /package/dist/{server → src/server}/wishlist.js +0 -0
- /package/dist/{util → src/util}/get-locale-header.d.ts +0 -0
- /package/dist/{util → src/util}/get-locale-header.js +0 -0
- /package/dist/{util → src/util}/medusa-error.d.ts +0 -0
- /package/dist/{util → src/util}/medusa-error.js +0 -0
- /package/dist/{util → src/util}/revalidate-cart.d.ts +0 -0
- /package/dist/{util → src/util}/revalidate-cart.js +0 -0
- /package/dist/{util → src/util}/sort-products.d.ts +0 -0
- /package/dist/{util → src/util}/sort-products.js +0 -0
package/src/server/cart.ts
CHANGED
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
medusaCustomerUpdateAddress,
|
|
56
56
|
} from "medusa-services/customer"
|
|
57
57
|
import { medusaPaymentSessionInitiate } from "medusa-services/payment"
|
|
58
|
-
import {
|
|
58
|
+
import { getStoreClientOptions } from "../util/store-client"
|
|
59
59
|
import { revalidateCartTags } from "../util/revalidate-cart"
|
|
60
60
|
|
|
61
61
|
import { cache } from "react"
|
|
@@ -86,7 +86,7 @@ export const retrieveCart = cache(
|
|
|
86
86
|
|
|
87
87
|
// Skip metadata check if we are clearly in checkout to avoid extra API call
|
|
88
88
|
if (!pathname.includes("/checkout")) {
|
|
89
|
-
const options = await
|
|
89
|
+
const options = await getStoreClientOptions()
|
|
90
90
|
const currentCart = await medusaCartRetrieve(id, options, { fields: "metadata" })
|
|
91
91
|
.then(({ cart }) => cart)
|
|
92
92
|
.catch(() => null)
|
|
@@ -143,7 +143,7 @@ export async function getOrSetCart(countryCode: string) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
let cart = await retrieveCart(undefined, "id,region_id")
|
|
146
|
-
const options = await
|
|
146
|
+
const options = await getStoreClientOptions()
|
|
147
147
|
|
|
148
148
|
if (!cart) {
|
|
149
149
|
const locale = await getLocale()
|
|
@@ -176,7 +176,7 @@ export async function updateCart(data: HttpTypes.StoreUpdateCart) {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
try {
|
|
179
|
-
const options = await
|
|
179
|
+
const options = await getStoreClientOptions()
|
|
180
180
|
const { cart } = await medusaCartUpdate(cartId, data as Record<string, unknown>, options)
|
|
181
181
|
await revalidateCartTags()
|
|
182
182
|
return cart as unknown as HttpTypes.StoreCart
|
|
@@ -205,7 +205,7 @@ export async function addToCart({
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
try {
|
|
208
|
-
const options = await
|
|
208
|
+
const options = await getStoreClientOptions()
|
|
209
209
|
await medusaCartAddLineItem(cart.id, { variant_id: variantId, quantity }, options)
|
|
210
210
|
await revalidateCartTags()
|
|
211
211
|
} catch (e) {
|
|
@@ -232,7 +232,7 @@ export async function buyNow({
|
|
|
232
232
|
throw new Error(`Region not found for country code: ${countryCode}`)
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
const options = await
|
|
235
|
+
const options = await getStoreClientOptions()
|
|
236
236
|
const locale = await getLocale()
|
|
237
237
|
|
|
238
238
|
// 1. Create a NEW cart regardless of existing one
|
|
@@ -343,7 +343,7 @@ export async function updateLineItem({
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
try {
|
|
346
|
-
const options = await
|
|
346
|
+
const options = await getStoreClientOptions()
|
|
347
347
|
await medusaCartUpdateLineItem(cartId, lineId, { quantity }, options)
|
|
348
348
|
await revalidateCartTags()
|
|
349
349
|
} catch (e) {
|
|
@@ -363,7 +363,7 @@ export async function deleteLineItem(lineId: string) {
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
try {
|
|
366
|
-
const options = await
|
|
366
|
+
const options = await getStoreClientOptions()
|
|
367
367
|
await medusaCartRemoveLineItem(cartId, lineId, options)
|
|
368
368
|
await revalidateCartTags()
|
|
369
369
|
} catch (e) {
|
|
@@ -409,7 +409,7 @@ export async function setShippingMethod({
|
|
|
409
409
|
shippingMethodId: string
|
|
410
410
|
}) {
|
|
411
411
|
try {
|
|
412
|
-
const options = await
|
|
412
|
+
const options = await getStoreClientOptions()
|
|
413
413
|
await medusaCartAddShippingMethod(cartId, shippingMethodId, options)
|
|
414
414
|
const cartCacheTag = await getCacheTag("carts")
|
|
415
415
|
revalidateTag(cartCacheTag)
|
|
@@ -429,7 +429,7 @@ export async function setShippingMethodSilently({
|
|
|
429
429
|
shippingMethodId: string
|
|
430
430
|
}) {
|
|
431
431
|
try {
|
|
432
|
-
const options = await
|
|
432
|
+
const options = await getStoreClientOptions()
|
|
433
433
|
await medusaCartAddShippingMethod(cartId, shippingMethodId, options)
|
|
434
434
|
return { success: true }
|
|
435
435
|
} catch (e) {
|
|
@@ -490,13 +490,13 @@ export async function initiatePaymentSession(
|
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
if (Object.keys(addressUpdates).length > 0) {
|
|
493
|
-
const options = await
|
|
493
|
+
const options = await getStoreClientOptions()
|
|
494
494
|
await medusaCartUpdate(latestCart.id, addressUpdates, options)
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
|
|
498
498
|
// 3. Final re-fetch (direct call to bypass any lib-level cache)
|
|
499
|
-
const options = await
|
|
499
|
+
const options = await getStoreClientOptions()
|
|
500
500
|
const { cart: finalCartRaw } = await medusaCartRetrieve(cart.id, options, {
|
|
501
501
|
fields: "*shipping_address,*billing_address",
|
|
502
502
|
})
|
|
@@ -552,7 +552,7 @@ export async function applyPromotions(codes: string[]) {
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
try {
|
|
555
|
-
const options = await
|
|
555
|
+
const options = await getStoreClientOptions()
|
|
556
556
|
const { cart } = await medusaCartApplyPromotions(cartId, codes, options)
|
|
557
557
|
await revalidateCartTags()
|
|
558
558
|
return cart as unknown as HttpTypes.StoreCart
|
|
@@ -668,7 +668,7 @@ export async function setAddresses(currentState: unknown, formData: FormData) {
|
|
|
668
668
|
const authHeaders = await getAuthHeaders()
|
|
669
669
|
if (authHeaders && "authorization" in authHeaders) {
|
|
670
670
|
try {
|
|
671
|
-
const options = await
|
|
671
|
+
const options = await getStoreClientOptions()
|
|
672
672
|
const { customer } = await medusaCustomerRetrieve(options, { fields: "*addresses" })
|
|
673
673
|
|
|
674
674
|
const addressExists = customer?.addresses?.some((a: any) =>
|
|
@@ -731,7 +731,7 @@ export async function placeOrder(cartId?: string) {
|
|
|
731
731
|
|
|
732
732
|
let cartRes
|
|
733
733
|
try {
|
|
734
|
-
const options = await
|
|
734
|
+
const options = await getStoreClientOptions()
|
|
735
735
|
cartRes = await medusaCartComplete(id, options)
|
|
736
736
|
const cartCacheTag = await getCacheTag("carts")
|
|
737
737
|
revalidateTag(cartCacheTag)
|
|
@@ -840,7 +840,7 @@ export async function addCustomerAddressToCart(currentState: unknown, formData:
|
|
|
840
840
|
// 1. Add/Update Customer Address Book
|
|
841
841
|
// We try/catch this separately so if it fails (e.g. user not logged in), we still try to proceed with checkout
|
|
842
842
|
try {
|
|
843
|
-
const options = await
|
|
843
|
+
const options = await getStoreClientOptions()
|
|
844
844
|
if (addressId) {
|
|
845
845
|
await medusaCustomerUpdateAddress(addressId, addressData, options)
|
|
846
846
|
} else {
|
|
@@ -916,7 +916,7 @@ export async function updateAddressSilently(data: any) {
|
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
-
const options = await
|
|
919
|
+
const options = await getStoreClientOptions()
|
|
920
920
|
await medusaCartUpdate(cartId, payload, options)
|
|
921
921
|
|
|
922
922
|
// Revalidate tags to ensure CartTotals gets new shipping info
|
|
@@ -935,7 +935,7 @@ export async function updateCartMetadataSilently(metadata: any) {
|
|
|
935
935
|
if (!cartId) return
|
|
936
936
|
|
|
937
937
|
try {
|
|
938
|
-
const options = await
|
|
938
|
+
const options = await getStoreClientOptions()
|
|
939
939
|
await medusaCartUpdate(cartId, { metadata }, options)
|
|
940
940
|
// We intentionally DO NOT call revalidateTag here to prevent page refresh loops
|
|
941
941
|
return { success: true }
|
|
@@ -953,7 +953,7 @@ export async function getAbandonedCarts() {
|
|
|
953
953
|
}
|
|
954
954
|
|
|
955
955
|
try {
|
|
956
|
-
const options = await
|
|
956
|
+
const options = await getStoreClientOptions()
|
|
957
957
|
const res = await medusaCartList(options, {
|
|
958
958
|
fields: "*items, *items.product, *items.product.thumbnail, *items.variant, *items.metadata, +total",
|
|
959
959
|
}).catch(() => null)
|
|
@@ -989,7 +989,7 @@ export async function resumeAbandonedCart(cartId: string, countryCode: string) {
|
|
|
989
989
|
|
|
990
990
|
export async function deleteCart(cartId: string) {
|
|
991
991
|
try {
|
|
992
|
-
const options = await
|
|
992
|
+
const options = await getStoreClientOptions()
|
|
993
993
|
await medusaCartDelete(cartId, options)
|
|
994
994
|
|
|
995
995
|
revalidateTag("carts")
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Merge CMS section block onto package defaults (override wins when set). */
|
|
2
|
+
export function mergeSectionBlock(
|
|
3
|
+
defaults: Record<string, unknown>,
|
|
4
|
+
override: Record<string, unknown> | null
|
|
5
|
+
): Record<string, unknown> {
|
|
6
|
+
if (!override) return { ...defaults }
|
|
7
|
+
const merged = { ...defaults }
|
|
8
|
+
for (const [key, value] of Object.entries(override)) {
|
|
9
|
+
if (value === undefined || value === null) continue
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
if (value.length > 0) merged[key] = value
|
|
12
|
+
continue
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === "string") {
|
|
15
|
+
if (value.trim()) merged[key] = value.trim()
|
|
16
|
+
continue
|
|
17
|
+
}
|
|
18
|
+
if (typeof value === "boolean" || typeof value === "number") {
|
|
19
|
+
merged[key] = value
|
|
20
|
+
continue
|
|
21
|
+
}
|
|
22
|
+
if (typeof value === "object") {
|
|
23
|
+
const base =
|
|
24
|
+
merged[key] && typeof merged[key] === "object" && !Array.isArray(merged[key])
|
|
25
|
+
? (merged[key] as Record<string, unknown>)
|
|
26
|
+
: {}
|
|
27
|
+
merged[key] = mergeSectionBlock(base, value as Record<string, unknown>)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return merged
|
|
31
|
+
}
|
package/src/server/customer.ts
CHANGED
|
@@ -33,7 +33,7 @@ import { medusaCartMerge, medusaCartTransfer } from "medusa-services/cart"
|
|
|
33
33
|
import {
|
|
34
34
|
getAuthClientOptions,
|
|
35
35
|
getMedusaBackendUrl,
|
|
36
|
-
|
|
36
|
+
getStoreClientOptions,
|
|
37
37
|
} from "../util/store-client"
|
|
38
38
|
|
|
39
39
|
import { cache } from "react"
|
|
@@ -52,7 +52,7 @@ export const retrieveCustomer = cache(
|
|
|
52
52
|
if (!("authorization" in authHeaders)) return null
|
|
53
53
|
|
|
54
54
|
try {
|
|
55
|
-
const options = await
|
|
55
|
+
const options = await getStoreClientOptions()
|
|
56
56
|
const { customer } = await medusaCustomerRetrieve(options, { fields: "*addresses" })
|
|
57
57
|
return customer as unknown as HttpTypes.StoreCustomer
|
|
58
58
|
} catch (error: unknown) {
|
|
@@ -68,7 +68,7 @@ export const retrieveCustomer = cache(
|
|
|
68
68
|
|
|
69
69
|
export const updateCustomer = async (body: HttpTypes.StoreUpdateCustomer) => {
|
|
70
70
|
try {
|
|
71
|
-
const options = await
|
|
71
|
+
const options = await getStoreClientOptions()
|
|
72
72
|
const { customer } = await medusaCustomerUpdate(body as Record<string, unknown>, options)
|
|
73
73
|
|
|
74
74
|
const cacheTag = await getCacheTag("customers")
|
|
@@ -98,7 +98,7 @@ export async function signup(_currentState: unknown, formData: FormData) {
|
|
|
98
98
|
|
|
99
99
|
await setAuthToken(token)
|
|
100
100
|
|
|
101
|
-
const options = await
|
|
101
|
+
const options = await getStoreClientOptions()
|
|
102
102
|
const { customer: createdCustomer } = await medusaCustomerCreate(customerForm, options)
|
|
103
103
|
|
|
104
104
|
const loginToken = await medusaAuthLogin(
|
|
@@ -142,7 +142,7 @@ export async function login(
|
|
|
142
142
|
cookieStore.set("_medusa_customer_email", email, { maxAge: 60 * 60 * 24 * 7, path: "/" })
|
|
143
143
|
|
|
144
144
|
try {
|
|
145
|
-
const options = await
|
|
145
|
+
const options = await getStoreClientOptions()
|
|
146
146
|
await medusaCustomerRetrieve({
|
|
147
147
|
...options,
|
|
148
148
|
authorization: `Bearer ${token}`,
|
|
@@ -219,7 +219,7 @@ export async function signout(countryCode: string) {
|
|
|
219
219
|
|
|
220
220
|
export async function transferCart(token?: string) {
|
|
221
221
|
const cartId = await getCartId()
|
|
222
|
-
const options = await
|
|
222
|
+
const options = await getStoreClientOptions()
|
|
223
223
|
const mergeOptions = token
|
|
224
224
|
? { ...options, authorization: `Bearer ${token}` }
|
|
225
225
|
: options
|
|
@@ -285,7 +285,7 @@ export const addCustomerAddress = async (
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
try {
|
|
288
|
-
const options = await
|
|
288
|
+
const options = await getStoreClientOptions()
|
|
289
289
|
await medusaCustomerCreateAddress(address, options)
|
|
290
290
|
|
|
291
291
|
const customerCacheTag = await getCacheTag("customers")
|
|
@@ -300,7 +300,7 @@ export const deleteCustomerAddress = async (
|
|
|
300
300
|
addressId: string
|
|
301
301
|
): Promise<void> => {
|
|
302
302
|
try {
|
|
303
|
-
const options = await
|
|
303
|
+
const options = await getStoreClientOptions()
|
|
304
304
|
await medusaCustomerDeleteAddress(addressId, options)
|
|
305
305
|
|
|
306
306
|
const customerCacheTag = await getCacheTag("customers")
|
|
@@ -344,7 +344,7 @@ export const updateCustomerAddress = async (
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
try {
|
|
347
|
-
const options = await
|
|
347
|
+
const options = await getStoreClientOptions()
|
|
348
348
|
await medusaCustomerUpdateAddress(addressId, address, options)
|
|
349
349
|
|
|
350
350
|
const customerCacheTag = await getCacheTag("customers")
|
|
@@ -357,7 +357,7 @@ export const updateCustomerAddress = async (
|
|
|
357
357
|
|
|
358
358
|
export const setDefaultAddress = async (addressId: string) => {
|
|
359
359
|
try {
|
|
360
|
-
const options = await
|
|
360
|
+
const options = await getStoreClientOptions()
|
|
361
361
|
await medusaCustomerUpdateAddress(addressId, { is_default_shipping: true }, options)
|
|
362
362
|
|
|
363
363
|
const customerCacheTag = await getCacheTag("customers")
|
|
@@ -469,7 +469,7 @@ export async function handleGoogleCallback(token: string, email?: string, first_
|
|
|
469
469
|
const cookieStore = await cookies()
|
|
470
470
|
cookieStore.set("_medusa_customer_email", email, { maxAge: 60 * 60 * 24 * 7, path: "/" })
|
|
471
471
|
|
|
472
|
-
const options = await
|
|
472
|
+
const options = await getStoreClientOptions()
|
|
473
473
|
if (options.authorization) {
|
|
474
474
|
try {
|
|
475
475
|
await medusaCustomerCreate(
|