medusa-storefront-data 2.4.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 +38 -4
- 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/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.js +20 -20
- package/dist/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 +1 -84
- package/dist/src/server/dynamic-config.d.ts.map +1 -1
- package/dist/src/server/dynamic-config.js +0 -130
- package/dist/src/server/fulfillment.js +3 -3
- package/dist/src/server/home.d.ts +4 -15
- package/dist/src/server/home.d.ts.map +1 -1
- package/dist/src/server/home.js +1 -122
- 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/orders.js +6 -6
- package/dist/src/server/page-input.d.ts.map +1 -1
- package/dist/src/server/page-input.js +3 -1
- package/dist/src/server/payment-details.js +5 -5
- package/dist/src/server/payment.js +2 -2
- package/dist/src/server/regions.js +2 -2
- package/dist/src/server/shoppable-looks.js +1 -1
- package/dist/src/util/store-client.d.ts +0 -2
- package/dist/src/util/store-client.d.ts.map +1 -1
- package/dist/src/util/store-client.js +0 -2
- package/package.json +1 -156
- package/src/server/brand-pillars-from-categories.ts +156 -0
- package/src/server/cart.ts +20 -20
- package/src/server/customer.ts +11 -11
- package/src/server/dynamic-config.ts +1 -172
- package/src/server/fulfillment.ts +3 -3
- package/src/server/home.ts +36 -211
- package/src/server/normalize-homepage-config.ts +240 -0
- package/src/server/orders.ts +6 -6
- package/src/server/page-input.ts +3 -1
- 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/shoppable-looks.ts +1 -1
- package/src/util/store-client.ts +0 -3
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
function normalizeKey(value) {
|
|
2
|
+
return value
|
|
3
|
+
.toLowerCase()
|
|
4
|
+
.trim()
|
|
5
|
+
.replace(/&/g, "and")
|
|
6
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
7
|
+
.replace(/^-+|-+$/g, "");
|
|
8
|
+
}
|
|
9
|
+
function collectionImageForCategory(collections, category) {
|
|
10
|
+
if (!collections?.length)
|
|
11
|
+
return null;
|
|
12
|
+
const handleKey = category.handle ? normalizeKey(category.handle) : "";
|
|
13
|
+
const nameKey = category.name ? normalizeKey(category.name) : "";
|
|
14
|
+
for (const entry of collections) {
|
|
15
|
+
const meta = entry.metadata ?? {};
|
|
16
|
+
const image = meta.category_image || meta.image || meta.thumbnail;
|
|
17
|
+
if (!image)
|
|
18
|
+
continue;
|
|
19
|
+
const cHandle = entry.handle ?? "";
|
|
20
|
+
const cTitle = entry.title ?? "";
|
|
21
|
+
if ((handleKey && normalizeKey(cHandle) === handleKey) ||
|
|
22
|
+
(nameKey && normalizeKey(cTitle) === nameKey)) {
|
|
23
|
+
return image;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function imageFromCategory(category) {
|
|
29
|
+
const meta = category.metadata ?? {};
|
|
30
|
+
return (meta.category_image ||
|
|
31
|
+
meta.image ||
|
|
32
|
+
meta.thumbnail ||
|
|
33
|
+
category.thumbnail ||
|
|
34
|
+
null);
|
|
35
|
+
}
|
|
36
|
+
function resolveCategoryImage(category, collections) {
|
|
37
|
+
const fromCategory = imageFromCategory(category);
|
|
38
|
+
if (fromCategory)
|
|
39
|
+
return fromCategory;
|
|
40
|
+
const parent = category.parent_category;
|
|
41
|
+
if (parent) {
|
|
42
|
+
const fromParent = imageFromCategory(parent);
|
|
43
|
+
if (fromParent)
|
|
44
|
+
return fromParent;
|
|
45
|
+
}
|
|
46
|
+
return collectionImageForCategory(collections, category);
|
|
47
|
+
}
|
|
48
|
+
function categoryDescription(category) {
|
|
49
|
+
const meta = category.metadata ?? {};
|
|
50
|
+
const native = category.description;
|
|
51
|
+
return String(native ?? meta.category_description ?? meta.description ?? "").trim();
|
|
52
|
+
}
|
|
53
|
+
function categoryHref(category) {
|
|
54
|
+
const meta = category.metadata ?? {};
|
|
55
|
+
const custom = meta.category_link?.trim();
|
|
56
|
+
if (custom)
|
|
57
|
+
return custom;
|
|
58
|
+
if (category.handle)
|
|
59
|
+
return `/categories/${category.handle}`;
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
function pickBrandPillarCategories(categories, collections, limit = 4) {
|
|
63
|
+
const valid = (categories ?? []).filter((c) => c.name && c.handle);
|
|
64
|
+
const topLevel = valid.filter((c) => !c.parent_category_id);
|
|
65
|
+
const withImage = topLevel.filter((c) => Boolean(resolveCategoryImage(c, collections)));
|
|
66
|
+
const pool = withImage.length >= 2 ? withImage : topLevel;
|
|
67
|
+
return [...pool]
|
|
68
|
+
.sort((a, b) => Number(Boolean(resolveCategoryImage(b, collections))) -
|
|
69
|
+
Number(Boolean(resolveCategoryImage(a, collections))) ||
|
|
70
|
+
(a.name ?? "").localeCompare(b.name ?? ""))
|
|
71
|
+
.slice(0, limit);
|
|
72
|
+
}
|
|
73
|
+
/** Brand pillar cards from top-level product categories (not CMS pillars array). */
|
|
74
|
+
export function buildBrandPillarsFromCategories(categories, collections, sectionTitle) {
|
|
75
|
+
const pillars = pickBrandPillarCategories(categories, collections).flatMap((category) => {
|
|
76
|
+
const title = (category.name ?? "").trim();
|
|
77
|
+
const image = resolveCategoryImage(category, collections) ?? undefined;
|
|
78
|
+
if (!title || !image)
|
|
79
|
+
return [];
|
|
80
|
+
const description = categoryDescription(category);
|
|
81
|
+
const href = categoryHref(category);
|
|
82
|
+
return [
|
|
83
|
+
{
|
|
84
|
+
title,
|
|
85
|
+
description,
|
|
86
|
+
image,
|
|
87
|
+
...(href ? { href } : {}),
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
});
|
|
91
|
+
return { sectionTitle, pillars };
|
|
92
|
+
}
|
package/dist/src/server/cart.js
CHANGED
|
@@ -20,7 +20,7 @@ import { retrieveCustomer } from "./customer";
|
|
|
20
20
|
import { medusaCartCreate, medusaCartRetrieve, medusaCartUpdate, medusaCartAddLineItem, medusaCartUpdateLineItem, medusaCartRemoveLineItem, medusaCartApplyPromotions, medusaCartAddShippingMethod, medusaCartComplete, medusaCartSkipMerge, medusaCartDelete, medusaCartList, medusaShippingOptionsList, MEDUSA_STORE_CART_DETAIL_FIELDS, } from "medusa-services/cart";
|
|
21
21
|
import { medusaCustomerCreateAddress, medusaCustomerRetrieve, medusaCustomerUpdateAddress, } from "medusa-services/customer";
|
|
22
22
|
import { medusaPaymentSessionInitiate } from "medusa-services/payment";
|
|
23
|
-
import {
|
|
23
|
+
import { getStoreClientOptions } from "../util/store-client";
|
|
24
24
|
import { revalidateCartTags } from "../util/revalidate-cart";
|
|
25
25
|
import { cache } from "react";
|
|
26
26
|
function throwCartError(error) {
|
|
@@ -45,7 +45,7 @@ export const retrieveCart = cache(async (cartId, fields) => {
|
|
|
45
45
|
const pathname = headerList.get("x-pathname") || headerList.get("referer") || "";
|
|
46
46
|
// Skip metadata check if we are clearly in checkout to avoid extra API call
|
|
47
47
|
if (!pathname.includes("/checkout")) {
|
|
48
|
-
const options = await
|
|
48
|
+
const options = await getStoreClientOptions();
|
|
49
49
|
const currentCart = await medusaCartRetrieve(id, options, { fields: "metadata" })
|
|
50
50
|
.then(({ cart }) => cart)
|
|
51
51
|
.catch(() => null);
|
|
@@ -92,7 +92,7 @@ export async function getOrSetCart(countryCode) {
|
|
|
92
92
|
throw new Error(`Region not found for country code: ${countryCode}`);
|
|
93
93
|
}
|
|
94
94
|
let cart = await retrieveCart(undefined, "id,region_id");
|
|
95
|
-
const options = await
|
|
95
|
+
const options = await getStoreClientOptions();
|
|
96
96
|
if (!cart) {
|
|
97
97
|
const locale = await getLocale();
|
|
98
98
|
const { cart: createdCart } = await medusaCartCreate(options, {
|
|
@@ -117,7 +117,7 @@ export async function updateCart(data) {
|
|
|
117
117
|
throw new Error("No existing cart found, please create one before updating");
|
|
118
118
|
}
|
|
119
119
|
try {
|
|
120
|
-
const options = await
|
|
120
|
+
const options = await getStoreClientOptions();
|
|
121
121
|
const { cart } = await medusaCartUpdate(cartId, data, options);
|
|
122
122
|
await revalidateCartTags();
|
|
123
123
|
return cart;
|
|
@@ -135,7 +135,7 @@ export async function addToCart({ variantId, quantity, countryCode, }) {
|
|
|
135
135
|
throw new Error("Error retrieving or creating cart");
|
|
136
136
|
}
|
|
137
137
|
try {
|
|
138
|
-
const options = await
|
|
138
|
+
const options = await getStoreClientOptions();
|
|
139
139
|
await medusaCartAddLineItem(cart.id, { variant_id: variantId, quantity }, options);
|
|
140
140
|
await revalidateCartTags();
|
|
141
141
|
}
|
|
@@ -151,7 +151,7 @@ export async function buyNow({ variantId, quantity, countryCode, }) {
|
|
|
151
151
|
if (!region) {
|
|
152
152
|
throw new Error(`Region not found for country code: ${countryCode}`);
|
|
153
153
|
}
|
|
154
|
-
const options = await
|
|
154
|
+
const options = await getStoreClientOptions();
|
|
155
155
|
const locale = await getLocale();
|
|
156
156
|
// 1. Create a NEW cart regardless of existing one
|
|
157
157
|
const { cart } = await medusaCartCreate(options, {
|
|
@@ -238,7 +238,7 @@ export async function updateLineItem({ lineId, quantity, }) {
|
|
|
238
238
|
throw new Error("Missing cart ID when updating line item");
|
|
239
239
|
}
|
|
240
240
|
try {
|
|
241
|
-
const options = await
|
|
241
|
+
const options = await getStoreClientOptions();
|
|
242
242
|
await medusaCartUpdateLineItem(cartId, lineId, { quantity }, options);
|
|
243
243
|
await revalidateCartTags();
|
|
244
244
|
}
|
|
@@ -255,7 +255,7 @@ export async function deleteLineItem(lineId) {
|
|
|
255
255
|
throw new Error("Missing cart ID when deleting line item");
|
|
256
256
|
}
|
|
257
257
|
try {
|
|
258
|
-
const options = await
|
|
258
|
+
const options = await getStoreClientOptions();
|
|
259
259
|
await medusaCartRemoveLineItem(cartId, lineId, options);
|
|
260
260
|
await revalidateCartTags();
|
|
261
261
|
}
|
|
@@ -281,7 +281,7 @@ export async function updateLineItemVariant({ lineId, variantId, quantity, count
|
|
|
281
281
|
}
|
|
282
282
|
export async function setShippingMethod({ cartId, shippingMethodId, }) {
|
|
283
283
|
try {
|
|
284
|
-
const options = await
|
|
284
|
+
const options = await getStoreClientOptions();
|
|
285
285
|
await medusaCartAddShippingMethod(cartId, shippingMethodId, options);
|
|
286
286
|
const cartCacheTag = await getCacheTag("carts");
|
|
287
287
|
revalidateTag(cartCacheTag);
|
|
@@ -295,7 +295,7 @@ export async function setShippingMethod({ cartId, shippingMethodId, }) {
|
|
|
295
295
|
*/
|
|
296
296
|
export async function setShippingMethodSilently({ cartId, shippingMethodId, }) {
|
|
297
297
|
try {
|
|
298
|
-
const options = await
|
|
298
|
+
const options = await getStoreClientOptions();
|
|
299
299
|
await medusaCartAddShippingMethod(cartId, shippingMethodId, options);
|
|
300
300
|
return { success: true };
|
|
301
301
|
}
|
|
@@ -350,12 +350,12 @@ export async function initiatePaymentSession(cart, data) {
|
|
|
350
350
|
addressUpdates.billing_address = cleanAddress(latestCart.billing_address) || cleanAddress(latestCart.shipping_address);
|
|
351
351
|
}
|
|
352
352
|
if (Object.keys(addressUpdates).length > 0) {
|
|
353
|
-
const options = await
|
|
353
|
+
const options = await getStoreClientOptions();
|
|
354
354
|
await medusaCartUpdate(latestCart.id, addressUpdates, options);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
// 3. Final re-fetch (direct call to bypass any lib-level cache)
|
|
358
|
-
const options = await
|
|
358
|
+
const options = await getStoreClientOptions();
|
|
359
359
|
const { cart: finalCartRaw } = await medusaCartRetrieve(cart.id, options, {
|
|
360
360
|
fields: "*shipping_address,*billing_address",
|
|
361
361
|
});
|
|
@@ -404,7 +404,7 @@ export async function applyPromotions(codes) {
|
|
|
404
404
|
throw new Error("No existing cart found");
|
|
405
405
|
}
|
|
406
406
|
try {
|
|
407
|
-
const options = await
|
|
407
|
+
const options = await getStoreClientOptions();
|
|
408
408
|
const { cart } = await medusaCartApplyPromotions(cartId, codes, options);
|
|
409
409
|
await revalidateCartTags();
|
|
410
410
|
return cart;
|
|
@@ -506,7 +506,7 @@ export async function setAddresses(currentState, formData) {
|
|
|
506
506
|
const authHeaders = await getAuthHeaders();
|
|
507
507
|
if (authHeaders && "authorization" in authHeaders) {
|
|
508
508
|
try {
|
|
509
|
-
const options = await
|
|
509
|
+
const options = await getStoreClientOptions();
|
|
510
510
|
const { customer } = await medusaCustomerRetrieve(options, { fields: "*addresses" });
|
|
511
511
|
const addressExists = customer?.addresses?.some((a) => a.address_1 === shippingAddress.address_1 &&
|
|
512
512
|
a.postal_code === shippingAddress.postal_code &&
|
|
@@ -561,7 +561,7 @@ export async function placeOrder(cartId) {
|
|
|
561
561
|
}
|
|
562
562
|
let cartRes;
|
|
563
563
|
try {
|
|
564
|
-
const options = await
|
|
564
|
+
const options = await getStoreClientOptions();
|
|
565
565
|
cartRes = await medusaCartComplete(id, options);
|
|
566
566
|
const cartCacheTag = await getCacheTag("carts");
|
|
567
567
|
revalidateTag(cartCacheTag);
|
|
@@ -652,7 +652,7 @@ export async function addCustomerAddressToCart(currentState, formData) {
|
|
|
652
652
|
// 1. Add/Update Customer Address Book
|
|
653
653
|
// We try/catch this separately so if it fails (e.g. user not logged in), we still try to proceed with checkout
|
|
654
654
|
try {
|
|
655
|
-
const options = await
|
|
655
|
+
const options = await getStoreClientOptions();
|
|
656
656
|
if (addressId) {
|
|
657
657
|
await medusaCustomerUpdateAddress(addressId, addressData, options);
|
|
658
658
|
}
|
|
@@ -722,7 +722,7 @@ export async function updateAddressSilently(data) {
|
|
|
722
722
|
return { success: false, error: "Invalid email address." };
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
|
-
const options = await
|
|
725
|
+
const options = await getStoreClientOptions();
|
|
726
726
|
await medusaCartUpdate(cartId, payload, options);
|
|
727
727
|
// Revalidate tags to ensure CartTotals gets new shipping info
|
|
728
728
|
await revalidateCartTags();
|
|
@@ -740,7 +740,7 @@ export async function updateCartMetadataSilently(metadata) {
|
|
|
740
740
|
if (!cartId)
|
|
741
741
|
return;
|
|
742
742
|
try {
|
|
743
|
-
const options = await
|
|
743
|
+
const options = await getStoreClientOptions();
|
|
744
744
|
await medusaCartUpdate(cartId, { metadata }, options);
|
|
745
745
|
// We intentionally DO NOT call revalidateTag here to prevent page refresh loops
|
|
746
746
|
return { success: true };
|
|
@@ -756,7 +756,7 @@ export async function getAbandonedCarts() {
|
|
|
756
756
|
return { buyNowCarts: [], reorderCarts: [] };
|
|
757
757
|
}
|
|
758
758
|
try {
|
|
759
|
-
const options = await
|
|
759
|
+
const options = await getStoreClientOptions();
|
|
760
760
|
const res = await medusaCartList(options, {
|
|
761
761
|
fields: "*items, *items.product, *items.product.thumbnail, *items.variant, *items.metadata, +total",
|
|
762
762
|
}).catch(() => null);
|
|
@@ -785,7 +785,7 @@ export async function resumeAbandonedCart(cartId, countryCode) {
|
|
|
785
785
|
}
|
|
786
786
|
export async function deleteCart(cartId) {
|
|
787
787
|
try {
|
|
788
|
-
const options = await
|
|
788
|
+
const options = await getStoreClientOptions();
|
|
789
789
|
await medusaCartDelete(cartId, options);
|
|
790
790
|
revalidateTag("carts");
|
|
791
791
|
return { success: true };
|
|
@@ -7,7 +7,7 @@ import { getAuthHeaders, getCacheTag, getCartId, removeAuthToken, removeCartId,
|
|
|
7
7
|
import { medusaAuthLogin, medusaAuthLogout, medusaAuthRegister, } from "medusa-services/auth";
|
|
8
8
|
import { isAccountDeletionPendingError, medusaCustomerCreate, medusaCustomerCreateAddress, medusaCustomerDeleteAddress, medusaCustomerRetrieve, medusaCustomerUpdate, medusaCustomerUpdateAddress, } from "medusa-services/customer";
|
|
9
9
|
import { medusaCartMerge, medusaCartTransfer } from "medusa-services/cart";
|
|
10
|
-
import { getAuthClientOptions, getMedusaBackendUrl,
|
|
10
|
+
import { getAuthClientOptions, getMedusaBackendUrl, getStoreClientOptions, } from "../util/store-client";
|
|
11
11
|
import { cache } from "react";
|
|
12
12
|
function throwCustomerError(error) {
|
|
13
13
|
if (error && typeof error === "object" && "response" in error) {
|
|
@@ -20,7 +20,7 @@ export const retrieveCustomer = cache(async () => {
|
|
|
20
20
|
if (!("authorization" in authHeaders))
|
|
21
21
|
return null;
|
|
22
22
|
try {
|
|
23
|
-
const options = await
|
|
23
|
+
const options = await getStoreClientOptions();
|
|
24
24
|
const { customer } = await medusaCustomerRetrieve(options, { fields: "*addresses" });
|
|
25
25
|
return customer;
|
|
26
26
|
}
|
|
@@ -35,7 +35,7 @@ export const retrieveCustomer = cache(async () => {
|
|
|
35
35
|
});
|
|
36
36
|
export const updateCustomer = async (body) => {
|
|
37
37
|
try {
|
|
38
|
-
const options = await
|
|
38
|
+
const options = await getStoreClientOptions();
|
|
39
39
|
const { customer } = await medusaCustomerUpdate(body, options);
|
|
40
40
|
const cacheTag = await getCacheTag("customers");
|
|
41
41
|
revalidateTag(cacheTag);
|
|
@@ -57,7 +57,7 @@ export async function signup(_currentState, formData) {
|
|
|
57
57
|
const authOptions = await getAuthClientOptions();
|
|
58
58
|
const token = await medusaAuthRegister({ email: customerForm.email, password }, authOptions);
|
|
59
59
|
await setAuthToken(token);
|
|
60
|
-
const options = await
|
|
60
|
+
const options = await getStoreClientOptions();
|
|
61
61
|
const { customer: createdCustomer } = await medusaCustomerCreate(customerForm, options);
|
|
62
62
|
const loginToken = await medusaAuthLogin({ email: customerForm.email, password }, authOptions);
|
|
63
63
|
await setAuthToken(loginToken);
|
|
@@ -85,7 +85,7 @@ export async function login(_currentState, formData) {
|
|
|
85
85
|
const cookieStore = await cookies();
|
|
86
86
|
cookieStore.set("_medusa_customer_email", email, { maxAge: 60 * 60 * 24 * 7, path: "/" });
|
|
87
87
|
try {
|
|
88
|
-
const options = await
|
|
88
|
+
const options = await getStoreClientOptions();
|
|
89
89
|
await medusaCustomerRetrieve({
|
|
90
90
|
...options,
|
|
91
91
|
authorization: `Bearer ${token}`,
|
|
@@ -152,7 +152,7 @@ export async function signout(countryCode) {
|
|
|
152
152
|
}
|
|
153
153
|
export async function transferCart(token) {
|
|
154
154
|
const cartId = await getCartId();
|
|
155
|
-
const options = await
|
|
155
|
+
const options = await getStoreClientOptions();
|
|
156
156
|
const mergeOptions = token
|
|
157
157
|
? { ...options, authorization: `Bearer ${token}` }
|
|
158
158
|
: options;
|
|
@@ -207,7 +207,7 @@ export const addCustomerAddress = async (currentState, formData) => {
|
|
|
207
207
|
},
|
|
208
208
|
};
|
|
209
209
|
try {
|
|
210
|
-
const options = await
|
|
210
|
+
const options = await getStoreClientOptions();
|
|
211
211
|
await medusaCustomerCreateAddress(address, options);
|
|
212
212
|
const customerCacheTag = await getCacheTag("customers");
|
|
213
213
|
revalidateTag(customerCacheTag);
|
|
@@ -219,7 +219,7 @@ export const addCustomerAddress = async (currentState, formData) => {
|
|
|
219
219
|
};
|
|
220
220
|
export const deleteCustomerAddress = async (addressId) => {
|
|
221
221
|
try {
|
|
222
|
-
const options = await
|
|
222
|
+
const options = await getStoreClientOptions();
|
|
223
223
|
await medusaCustomerDeleteAddress(addressId, options);
|
|
224
224
|
const customerCacheTag = await getCacheTag("customers");
|
|
225
225
|
revalidateTag(customerCacheTag);
|
|
@@ -253,7 +253,7 @@ export const updateCustomerAddress = async (currentState, formData) => {
|
|
|
253
253
|
address.phone = phone;
|
|
254
254
|
}
|
|
255
255
|
try {
|
|
256
|
-
const options = await
|
|
256
|
+
const options = await getStoreClientOptions();
|
|
257
257
|
await medusaCustomerUpdateAddress(addressId, address, options);
|
|
258
258
|
const customerCacheTag = await getCacheTag("customers");
|
|
259
259
|
revalidateTag(customerCacheTag);
|
|
@@ -265,7 +265,7 @@ export const updateCustomerAddress = async (currentState, formData) => {
|
|
|
265
265
|
};
|
|
266
266
|
export const setDefaultAddress = async (addressId) => {
|
|
267
267
|
try {
|
|
268
|
-
const options = await
|
|
268
|
+
const options = await getStoreClientOptions();
|
|
269
269
|
await medusaCustomerUpdateAddress(addressId, { is_default_shipping: true }, options);
|
|
270
270
|
const customerCacheTag = await getCacheTag("customers");
|
|
271
271
|
revalidateTag(customerCacheTag);
|
|
@@ -356,7 +356,7 @@ export async function handleGoogleCallback(token, email, first_name, last_name)
|
|
|
356
356
|
if (email && typeof email === "string") {
|
|
357
357
|
const cookieStore = await cookies();
|
|
358
358
|
cookieStore.set("_medusa_customer_email", email, { maxAge: 60 * 60 * 24 * 7, path: "/" });
|
|
359
|
-
const options = await
|
|
359
|
+
const options = await getStoreClientOptions();
|
|
360
360
|
if (options.authorization) {
|
|
361
361
|
try {
|
|
362
362
|
await medusaCustomerCreate({ email, ...(first_name && { first_name }), ...(last_name && { last_name }) }, options);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DynamicConfigResponse, HomepageConfig } from "./homepage-config.types";
|
|
2
|
+
type Loose = Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Medusa split keys (`site-branding`, `homepage-sections`, …) → simplified shape
|
|
5
|
+
* consumed by `normalizeHomepageConfig`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mergeStorefrontDynamicConfig(dynamicConfigResponse: Record<string, unknown>): Loose;
|
|
8
|
+
/** Full `GET /store/dynamic-config` body → legacy `homepage-config`. */
|
|
9
|
+
export declare function homepageConfigFromApiResponse(response: Record<string, unknown> | DynamicConfigResponse | null | undefined): HomepageConfig;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=dynamic-config-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-config-api.d.ts","sourceRoot":"","sources":["../../../src/server/dynamic-config-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAGpF,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAUpC;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7C,KAAK,CA6BP;AAED,wEAAwE;AACxE,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,qBAAqB,GAAG,IAAI,GAAG,SAAS,GAC3E,cAAc,CAShB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { normalizeHomepageConfig } from "./normalize-homepage-config";
|
|
2
|
+
function asObject(v) {
|
|
3
|
+
return v && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
4
|
+
}
|
|
5
|
+
function asArray(v) {
|
|
6
|
+
return Array.isArray(v) ? v : [];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Medusa split keys (`site-branding`, `homepage-sections`, …) → simplified shape
|
|
10
|
+
* consumed by `normalizeHomepageConfig`.
|
|
11
|
+
*/
|
|
12
|
+
export function mergeStorefrontDynamicConfig(dynamicConfigResponse) {
|
|
13
|
+
const legacy = asObject(dynamicConfigResponse["homepage-config"]);
|
|
14
|
+
if (legacy)
|
|
15
|
+
return legacy;
|
|
16
|
+
const branding = asObject(dynamicConfigResponse["site-branding"]);
|
|
17
|
+
const contact = asObject(dynamicConfigResponse["contact"]);
|
|
18
|
+
const socialRoot = asObject(dynamicConfigResponse["social-links"]);
|
|
19
|
+
const faqsRoot = asObject(dynamicConfigResponse["faqs"]);
|
|
20
|
+
const promoBar = asObject(dynamicConfigResponse["promo-bar"]);
|
|
21
|
+
const social = asArray(socialRoot?.links) ||
|
|
22
|
+
asArray(dynamicConfigResponse["social-links"]) ||
|
|
23
|
+
[];
|
|
24
|
+
const faqs = asArray(faqsRoot?.items) || asArray(dynamicConfigResponse["faqs"]) || [];
|
|
25
|
+
return {
|
|
26
|
+
site: {
|
|
27
|
+
...branding,
|
|
28
|
+
contact,
|
|
29
|
+
social,
|
|
30
|
+
faqs,
|
|
31
|
+
},
|
|
32
|
+
banners: asObject(dynamicConfigResponse["hero-banners"]),
|
|
33
|
+
sections: asObject(dynamicConfigResponse["homepage-sections"]),
|
|
34
|
+
promoBar,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Full `GET /store/dynamic-config` body → legacy `homepage-config`. */
|
|
38
|
+
export function homepageConfigFromApiResponse(response) {
|
|
39
|
+
if (!response || typeof response !== "object")
|
|
40
|
+
return {};
|
|
41
|
+
const row = response;
|
|
42
|
+
if (row["homepage-config"]) {
|
|
43
|
+
return normalizeHomepageConfig(row["homepage-config"]);
|
|
44
|
+
}
|
|
45
|
+
return normalizeHomepageConfig(mergeStorefrontDynamicConfig(row));
|
|
46
|
+
}
|
|
@@ -2,17 +2,8 @@ import "server-only";
|
|
|
2
2
|
import { type DefaultHomeSectionId } from "./homepage-section-defaults";
|
|
3
3
|
import type { DynamicConfigResponse, HomepageConfig } from "./homepage-config.types";
|
|
4
4
|
export { DEFAULT_PAGE_INPUT, mergePageInputWithDefaults, resolvePageInput, homepageConfigFromDynamicResponse, type StorefrontPageInput, } from "./page-input";
|
|
5
|
-
/** @deprecated Use `DynamicConfigResponse` from `medusa-storefront-data/homepage-config-schema`. */
|
|
6
|
-
export type DynamicConfig = DynamicConfigResponse;
|
|
7
5
|
export declare const getDynamicConfig: () => Promise<DynamicConfigResponse | null>;
|
|
8
6
|
export declare function getLogoFromPageInput(pageInput?: HomepageConfig | null): string | null;
|
|
9
|
-
/** @deprecated Fetch in main project; pass `pageInput` into layout/pages instead. */
|
|
10
|
-
export declare const getLogoFromConfig: () => Promise<string | null>;
|
|
11
|
-
export declare const getBannerImageFromConfig: () => Promise<string | null>;
|
|
12
|
-
export declare const getMobileBannerFromConfig: () => Promise<{
|
|
13
|
-
image: string | null;
|
|
14
|
-
link: string | null;
|
|
15
|
-
}>;
|
|
16
7
|
export type HomepageBanner = {
|
|
17
8
|
image?: string;
|
|
18
9
|
title?: string;
|
|
@@ -23,14 +14,7 @@ export type HomepageBanner = {
|
|
|
23
14
|
};
|
|
24
15
|
export declare function getHomeBannersFromPageInput(pageInput?: HomepageConfig | null): HomepageBanner[] | null;
|
|
25
16
|
export declare function getAppBannersFromPageInput(pageInput?: HomepageConfig | null): HomepageBanner[] | null;
|
|
26
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
27
|
-
export declare const getHomeBannersFromConfig: () => Promise<HomepageBanner[] | null>;
|
|
28
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
29
|
-
export declare const getAppBannersFromConfig: () => Promise<HomepageBanner[] | null>;
|
|
30
|
-
export declare const getMobileBannerImageFromConfig: () => Promise<string | null>;
|
|
31
17
|
export declare function getWebsiteDescriptionFromPageInput(pageInput?: HomepageConfig | null): string | null;
|
|
32
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
33
|
-
export declare const getWebsiteDescriptionFromConfig: () => Promise<string | null>;
|
|
34
18
|
/** Why choose us — defaults + `sections.whyChooseUs` override. */
|
|
35
19
|
export declare function getFeaturesFromPageInput(pageInput?: HomepageConfig | null): {
|
|
36
20
|
title: string;
|
|
@@ -39,14 +23,6 @@ export declare function getFeaturesFromPageInput(pageInput?: HomepageConfig | nu
|
|
|
39
23
|
icon: string;
|
|
40
24
|
}>;
|
|
41
25
|
};
|
|
42
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
43
|
-
export declare const getFeaturesFromConfig: () => Promise<{
|
|
44
|
-
title: string;
|
|
45
|
-
features: Array<{
|
|
46
|
-
name: string;
|
|
47
|
-
icon: string;
|
|
48
|
-
}>;
|
|
49
|
-
}>;
|
|
50
26
|
/** CMS copy for a homepage section (title, name, text, description, etc.). */
|
|
51
27
|
export type SectionCopy = {
|
|
52
28
|
title: string | null;
|
|
@@ -68,8 +44,6 @@ export declare function getMergedSectionBlock(id: HomeSectionCopyId, pageInput?:
|
|
|
68
44
|
* Merged section copy: package defaults + `homepage-config.sections` overrides.
|
|
69
45
|
*/
|
|
70
46
|
export declare function getHomeSectionsCopyFromPageInput(pageInput?: HomepageConfig | null): HomeSectionsCopy;
|
|
71
|
-
/** @deprecated Pass `pageInput` from main project instead of fetching here. */
|
|
72
|
-
export declare const getHomeSectionsCopyFromConfig: () => Promise<HomeSectionsCopy>;
|
|
73
47
|
export type TrustFeaturesConfig = {
|
|
74
48
|
title: string | null;
|
|
75
49
|
description: string | null;
|
|
@@ -80,16 +54,12 @@ export type TrustFeaturesConfig = {
|
|
|
80
54
|
};
|
|
81
55
|
/** Trust badge row — defaults + `sections.features` override. */
|
|
82
56
|
export declare function getTrustFeaturesFromPageInput(pageInput?: HomepageConfig | null): TrustFeaturesConfig;
|
|
83
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
84
|
-
export declare const getTrustFeaturesFromConfig: () => Promise<TrustFeaturesConfig>;
|
|
85
57
|
export type ContactInfo = {
|
|
86
58
|
phone?: string;
|
|
87
59
|
email?: string;
|
|
88
60
|
address?: string;
|
|
89
61
|
};
|
|
90
62
|
export declare function getContactInfoFromPageInput(pageInput?: HomepageConfig | null): ContactInfo | null;
|
|
91
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
92
|
-
export declare const getContactInfoFromConfig: () => Promise<ContactInfo | null>;
|
|
93
63
|
/**
|
|
94
64
|
* Homepage video stories/reviews carousel (`homepage-config.video-stories`).
|
|
95
65
|
*/
|
|
@@ -97,11 +67,6 @@ export declare function getVideoStoriesFromPageInput(pageInput?: HomepageConfig
|
|
|
97
67
|
title: string;
|
|
98
68
|
videoUrls: string[];
|
|
99
69
|
};
|
|
100
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
101
|
-
export declare const getVideoStoriesFromConfig: () => Promise<{
|
|
102
|
-
title: string;
|
|
103
|
-
videoUrls: string[];
|
|
104
|
-
} | null>;
|
|
105
70
|
export type TestimonialItem = {
|
|
106
71
|
id: string;
|
|
107
72
|
text: string;
|
|
@@ -114,23 +79,11 @@ export declare function getTestimonialsFromPageInput(pageInput?: HomepageConfig
|
|
|
114
79
|
subtitle: string | null;
|
|
115
80
|
testimonials: TestimonialItem[];
|
|
116
81
|
};
|
|
117
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
118
|
-
export declare const getTestimonialsFromConfig: () => Promise<{
|
|
119
|
-
title: string;
|
|
120
|
-
subtitle: string | null;
|
|
121
|
-
testimonials: TestimonialItem[];
|
|
122
|
-
}>;
|
|
123
82
|
export declare function getSocialLinksFromPageInput(pageInput?: HomepageConfig | null): Array<{
|
|
124
83
|
name: string;
|
|
125
84
|
url: string;
|
|
126
85
|
icon?: string;
|
|
127
86
|
}> | null;
|
|
128
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
129
|
-
export declare const getSocialLinksFromConfig: () => Promise<Array<{
|
|
130
|
-
name: string;
|
|
131
|
-
url: string;
|
|
132
|
-
icon?: string;
|
|
133
|
-
}> | null>;
|
|
134
87
|
export declare function getFaqsFromPageInput(pageInput?: HomepageConfig | null): Array<{
|
|
135
88
|
category: string;
|
|
136
89
|
items: Array<{
|
|
@@ -138,17 +91,7 @@ export declare function getFaqsFromPageInput(pageInput?: HomepageConfig | null):
|
|
|
138
91
|
a: string;
|
|
139
92
|
}>;
|
|
140
93
|
}> | null;
|
|
141
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
142
|
-
export declare const getFaqsFromConfig: () => Promise<Array<{
|
|
143
|
-
category: string;
|
|
144
|
-
items: Array<{
|
|
145
|
-
q: string;
|
|
146
|
-
a: string;
|
|
147
|
-
}>;
|
|
148
|
-
}> | null>;
|
|
149
94
|
export declare function getAnnouncementMessagesFromPageInput(pageInput?: HomepageConfig | null): string[];
|
|
150
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
151
|
-
export declare const getAnnouncementMessagesFromConfig: () => Promise<string[]>;
|
|
152
95
|
export type AboutBrandConfig = {
|
|
153
96
|
eyebrow: string;
|
|
154
97
|
title: string;
|
|
@@ -160,22 +103,16 @@ export type AboutBrandConfig = {
|
|
|
160
103
|
}>;
|
|
161
104
|
};
|
|
162
105
|
export declare function getAboutBrandFromPageInput(pageInput?: HomepageConfig | null): AboutBrandConfig;
|
|
163
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
164
|
-
export declare const getAboutBrandFromConfig: () => Promise<AboutBrandConfig>;
|
|
165
106
|
export type BrandPillarConfig = {
|
|
166
107
|
title: string;
|
|
167
108
|
description: string;
|
|
168
109
|
image?: string;
|
|
110
|
+
href?: string;
|
|
169
111
|
};
|
|
170
112
|
export declare function getBrandPillarsFromPageInput(pageInput?: HomepageConfig | null): {
|
|
171
113
|
sectionTitle: string;
|
|
172
114
|
pillars: BrandPillarConfig[];
|
|
173
115
|
};
|
|
174
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
175
|
-
export declare const getBrandPillarsFromConfig: () => Promise<{
|
|
176
|
-
sectionTitle: string;
|
|
177
|
-
pillars: BrandPillarConfig[];
|
|
178
|
-
}>;
|
|
179
116
|
export type BlogPostConfig = {
|
|
180
117
|
title: string;
|
|
181
118
|
excerpt?: string;
|
|
@@ -185,8 +122,6 @@ export type BlogPostConfig = {
|
|
|
185
122
|
image?: string;
|
|
186
123
|
};
|
|
187
124
|
export declare function getBlogPostsFromPageInput(pageInput?: HomepageConfig | null): BlogPostConfig[];
|
|
188
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
189
|
-
export declare const getBlogPostsFromConfig: () => Promise<BlogPostConfig[]>;
|
|
190
125
|
/** Promo countdown — defaults + `sections.promoCountdown` override. */
|
|
191
126
|
export declare function getPromoCountdownFromPageInput(pageInput?: HomepageConfig | null): {
|
|
192
127
|
code: string | null;
|
|
@@ -196,15 +131,6 @@ export declare function getPromoCountdownFromPageInput(pageInput?: HomepageConfi
|
|
|
196
131
|
ctaLabel: string | null;
|
|
197
132
|
ctaHref: string | null;
|
|
198
133
|
};
|
|
199
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
200
|
-
export declare const getPromoCountdownFromConfig: () => Promise<{
|
|
201
|
-
code: string | null;
|
|
202
|
-
message: string | null;
|
|
203
|
-
endAt: string | null;
|
|
204
|
-
active: boolean;
|
|
205
|
-
ctaLabel: string | null;
|
|
206
|
-
ctaHref: string | null;
|
|
207
|
-
}>;
|
|
208
134
|
export type InstagramPostConfig = {
|
|
209
135
|
id: string;
|
|
210
136
|
image: string;
|
|
@@ -219,8 +145,6 @@ export type InstagramPostsData = {
|
|
|
219
145
|
};
|
|
220
146
|
/** Instagram feed — `sections.instagramPosts` + optional social-links fallback. */
|
|
221
147
|
export declare function getInstagramPostsFromPageInput(pageInput?: HomepageConfig | null): InstagramPostsData;
|
|
222
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
223
|
-
export declare const getInstagramPostsFromConfig: () => Promise<InstagramPostsData>;
|
|
224
148
|
export { DEFAULT_HOMEPAGE_SECTIONS, type DefaultHomeSectionId, } from "./homepage-section-defaults";
|
|
225
149
|
export type { DynamicConfigResponse, HomepageConfig, HomepageSectionsConfig, HomepageSectionId, HomepageSectionCopyFields, HomepageNewArrivalsSection, } from "./homepage-config.types";
|
|
226
150
|
export { HOMEPAGE_SECTION_IDS } from "./homepage-config.types";
|
|
@@ -230,11 +154,4 @@ export declare function getPromoBarFromPageInput(pageInput?: HomepageConfig | nu
|
|
|
230
154
|
value: string | null;
|
|
231
155
|
active: boolean;
|
|
232
156
|
};
|
|
233
|
-
/** @deprecated Pass `pageInput` from main project. */
|
|
234
|
-
export declare const getPromoBarConfig: () => Promise<{
|
|
235
|
-
text: string | null;
|
|
236
|
-
code: string | null;
|
|
237
|
-
value: string | null;
|
|
238
|
-
active: boolean;
|
|
239
|
-
}>;
|
|
240
157
|
//# sourceMappingURL=dynamic-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-config.d.ts","sourceRoot":"","sources":["../../../src/server/dynamic-config.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,yBAAy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