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
|
@@ -6,7 +6,7 @@ import { listReturnReasons } from "./returns";
|
|
|
6
6
|
import { revalidateTag } from "next/cache";
|
|
7
7
|
import { extractReorderCartId, medusaGuestOrderCancel, medusaGuestOrderReorder, medusaOrderAcceptTransfer, medusaOrderCancel, medusaOrderDeclineTransfer, medusaOrderDownloadInvoice, medusaOrderList, medusaOrderReorder, medusaOrderRequestTransfer, medusaOrderRetrieve, MEDUSA_ORDER_DETAIL_FIELDS, } from "medusa-services/orders";
|
|
8
8
|
import { medusaCartRemoveLineItem, medusaCartRetrieve, medusaCartSkipMerge, medusaCartUpdate, } from "medusa-services/cart";
|
|
9
|
-
import { getGuestStoreClientOptions,
|
|
9
|
+
import { getGuestStoreClientOptions, getStoreClientOptions, getStoreClientOptionsWithToken, } from "../util/store-client";
|
|
10
10
|
function throwOrderError(error) {
|
|
11
11
|
if (error && typeof error === "object" && "response" in error) {
|
|
12
12
|
medusaError(error);
|
|
@@ -31,7 +31,7 @@ export const retrieveOrder = async (id) => {
|
|
|
31
31
|
}
|
|
32
32
|
return order;
|
|
33
33
|
}
|
|
34
|
-
const options = await
|
|
34
|
+
const options = await getStoreClientOptions();
|
|
35
35
|
const { order } = await medusaOrderRetrieve(id, options, {
|
|
36
36
|
fields: MEDUSA_ORDER_DETAIL_FIELDS,
|
|
37
37
|
});
|
|
@@ -43,7 +43,7 @@ export const retrieveOrder = async (id) => {
|
|
|
43
43
|
};
|
|
44
44
|
export const listOrders = async (limit = 10, offset = 0, filters) => {
|
|
45
45
|
try {
|
|
46
|
-
const options = await
|
|
46
|
+
const options = await getStoreClientOptions();
|
|
47
47
|
const { orders } = await medusaOrderList(options, {
|
|
48
48
|
limit,
|
|
49
49
|
offset,
|
|
@@ -62,7 +62,7 @@ export const createTransferRequest = async (state, formData) => {
|
|
|
62
62
|
return { success: false, error: "Order ID is required", order: null };
|
|
63
63
|
}
|
|
64
64
|
try {
|
|
65
|
-
const options = await
|
|
65
|
+
const options = await getStoreClientOptions();
|
|
66
66
|
const { order } = await medusaOrderRequestTransfer(id, options, {
|
|
67
67
|
fields: "id, email",
|
|
68
68
|
});
|
|
@@ -78,7 +78,7 @@ export const createTransferRequest = async (state, formData) => {
|
|
|
78
78
|
};
|
|
79
79
|
export const acceptTransferRequest = async (id, token) => {
|
|
80
80
|
try {
|
|
81
|
-
const options = await
|
|
81
|
+
const options = await getStoreClientOptions();
|
|
82
82
|
const { order } = await medusaOrderAcceptTransfer(id, token, options);
|
|
83
83
|
return {
|
|
84
84
|
success: true,
|
|
@@ -92,7 +92,7 @@ export const acceptTransferRequest = async (id, token) => {
|
|
|
92
92
|
};
|
|
93
93
|
export const declineTransferRequest = async (id, token) => {
|
|
94
94
|
try {
|
|
95
|
-
const options = await
|
|
95
|
+
const options = await getStoreClientOptions();
|
|
96
96
|
const { order } = await medusaOrderDeclineTransfer(id, token, options);
|
|
97
97
|
return {
|
|
98
98
|
success: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-input.d.ts","sourceRoot":"","sources":["../../../src/server/page-input.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"page-input.d.ts","sourceRoot":"","sources":["../../../src/server/page-input.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAI7D,sFAAsF;AACtF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAA;AAEhD,eAAO,MAAM,kBAAkB,EACM,mBAAmB,CAAA;AAExD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,GAC/B,mBAAmB,CA6BrB;AAED,kEAAkE;AAClE,wBAAgB,gBAAgB,CAC9B,SAAS,CAAC,EAAE,cAAc,GAAG,IAAI,GAChC,mBAAmB,CAErB;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE;IAAE,iBAAiB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GACzE,mBAAmB,CAGrB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import defaultPageInputJson from "../../segment-data/default-page-input.json";
|
|
3
3
|
import { mergeSectionBlock } from "./config-merge";
|
|
4
|
+
import { normalizeHomepageConfig } from "./normalize-homepage-config";
|
|
4
5
|
export const DEFAULT_PAGE_INPUT = defaultPageInputJson;
|
|
5
6
|
/**
|
|
6
7
|
* Merge CMS / main-project overrides onto package JSON defaults.
|
|
@@ -36,5 +37,6 @@ export function resolvePageInput(pageInput) {
|
|
|
36
37
|
* Build `homepage-config` from Medusa `GET /store/dynamic-config` (main project only).
|
|
37
38
|
*/
|
|
38
39
|
export function homepageConfigFromDynamicResponse(response) {
|
|
39
|
-
|
|
40
|
+
const normalized = normalizeHomepageConfig(response?.["homepage-config"] ?? null);
|
|
41
|
+
return mergePageInputWithDefaults(normalized);
|
|
40
42
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { medusaPaymentDetailCreate, medusaPaymentDetailDelete, medusaPaymentDetailMakeDefault, medusaPaymentDetailsList, } from "medusa-services/payment";
|
|
3
|
-
import {
|
|
3
|
+
import { getStoreClientOptions } from "../util/store-client";
|
|
4
4
|
export const listPaymentDetails = async () => {
|
|
5
5
|
try {
|
|
6
|
-
const options = await
|
|
6
|
+
const options = await getStoreClientOptions();
|
|
7
7
|
if (!options.authorization) {
|
|
8
8
|
return [];
|
|
9
9
|
}
|
|
@@ -15,14 +15,14 @@ export const listPaymentDetails = async () => {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
export const createPaymentDetail = async (type, detail_json) => {
|
|
18
|
-
const options = await
|
|
18
|
+
const options = await getStoreClientOptions();
|
|
19
19
|
return medusaPaymentDetailCreate(type, detail_json, options);
|
|
20
20
|
};
|
|
21
21
|
export const makeDefaultPaymentDetail = async (id) => {
|
|
22
|
-
const options = await
|
|
22
|
+
const options = await getStoreClientOptions();
|
|
23
23
|
return medusaPaymentDetailMakeDefault(id, options);
|
|
24
24
|
};
|
|
25
25
|
export const deletePaymentDetail = async (id) => {
|
|
26
|
-
const options = await
|
|
26
|
+
const options = await getStoreClientOptions();
|
|
27
27
|
return medusaPaymentDetailDelete(id, options);
|
|
28
28
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use server";
|
|
2
2
|
import { medusaPaymentProvidersList } from "medusa-services/payment";
|
|
3
|
-
import {
|
|
3
|
+
import { getStoreClientOptions } from "../util/store-client";
|
|
4
4
|
export const listCartPaymentMethods = async (regionId) => {
|
|
5
5
|
try {
|
|
6
|
-
const options = await
|
|
6
|
+
const options = await getStoreClientOptions();
|
|
7
7
|
const { payment_providers } = await medusaPaymentProvidersList(regionId, options);
|
|
8
8
|
return payment_providers.sort((a, b) => (a.id > b.id ? 1 : -1));
|
|
9
9
|
}
|
|
@@ -3,7 +3,7 @@ import { sdk } from "../config";
|
|
|
3
3
|
import medusaError from "../util/medusa-error";
|
|
4
4
|
import { getCacheOptions } from "../cookies";
|
|
5
5
|
import { medusaRegionList } from "medusa-services/regions";
|
|
6
|
-
import {
|
|
6
|
+
import { getStoreClientOptions } from "../util/store-client";
|
|
7
7
|
export const listRegions = async () => {
|
|
8
8
|
const next = {
|
|
9
9
|
...(await getCacheOptions("regions")),
|
|
@@ -36,7 +36,7 @@ export const getRegion = async (countryCode) => {
|
|
|
36
36
|
if (regionMap.has(countryCode)) {
|
|
37
37
|
return regionMap.get(countryCode);
|
|
38
38
|
}
|
|
39
|
-
const options = await
|
|
39
|
+
const options = await getStoreClientOptions();
|
|
40
40
|
const { regions } = await medusaRegionList(options);
|
|
41
41
|
if (!regions?.length) {
|
|
42
42
|
return null;
|
|
@@ -88,7 +88,7 @@ async function fetchProductsForLook(countryCode, productIds, productHandles) {
|
|
|
88
88
|
ordered.push(p);
|
|
89
89
|
}
|
|
90
90
|
for (const handle of productHandles) {
|
|
91
|
-
const p =
|
|
91
|
+
const p = Array.from(byId.values()).find((x) => x.handle === handle);
|
|
92
92
|
if (p && !ordered.some((o) => o.id === p.id))
|
|
93
93
|
ordered.push(p);
|
|
94
94
|
}
|
|
@@ -4,8 +4,6 @@ import { type MedusaAuthClientOptions } from "medusa-services/auth";
|
|
|
4
4
|
* Builds portable Medusa store client options from Next.js cookies and env.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getStoreClientOptions(): Promise<MedusaStoreClientOptions>;
|
|
7
|
-
/** @deprecated Use getStoreClientOptions */
|
|
8
|
-
export declare const getStoreCartClientOptions: typeof getStoreClientOptions;
|
|
9
7
|
export declare function getMedusaBackendUrl(): string;
|
|
10
8
|
export declare function getGuestStoreClientOptions(): Promise<MedusaStoreClientOptions | null>;
|
|
11
9
|
export declare function getStoreClientOptionsWithToken(token: string): Promise<MedusaStoreClientOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-client.d.ts","sourceRoot":"","sources":["../../../src/util/store-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,EAAuB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAqBxF;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAY/E;AAED,
|
|
1
|
+
{"version":3,"file":"store-client.d.ts","sourceRoot":"","sources":["../../../src/util/store-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,EAAuB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAqBxF;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAY/E;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAuB3F;AAED,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,wBAAwB,CAAC,CAMnC;AAED,wBAAsB,oBAAoB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAWnG"}
|
|
@@ -29,8 +29,6 @@ export async function getStoreClientOptions() {
|
|
|
29
29
|
: undefined,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
/** @deprecated Use getStoreClientOptions */
|
|
33
|
-
export const getStoreCartClientOptions = getStoreClientOptions;
|
|
34
32
|
export function getMedusaBackendUrl() {
|
|
35
33
|
return getBackendUrl();
|
|
36
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "medusa-storefront-data",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Medusa storefront server data layer extracted from Next.js storefront",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,161 +53,6 @@
|
|
|
53
53
|
"import": "./src/server/index.ts",
|
|
54
54
|
"default": "./src/server/index.ts"
|
|
55
55
|
},
|
|
56
|
-
"./cookies": {
|
|
57
|
-
"types": "./dist/cookies.d.ts",
|
|
58
|
-
"import": "./src/cookies.ts",
|
|
59
|
-
"default": "./src/cookies.ts"
|
|
60
|
-
},
|
|
61
|
-
"./config": {
|
|
62
|
-
"types": "./dist/config.d.ts",
|
|
63
|
-
"import": "./src/config.ts",
|
|
64
|
-
"default": "./src/config.ts"
|
|
65
|
-
},
|
|
66
|
-
"./locale-header": {
|
|
67
|
-
"types": "./dist/util/get-locale-header.d.ts",
|
|
68
|
-
"import": "./src/util/get-locale-header.ts",
|
|
69
|
-
"default": "./src/util/get-locale-header.ts"
|
|
70
|
-
},
|
|
71
|
-
"./medusa-error": {
|
|
72
|
-
"types": "./dist/util/medusa-error.d.ts",
|
|
73
|
-
"import": "./src/util/medusa-error.ts",
|
|
74
|
-
"default": "./src/util/medusa-error.ts"
|
|
75
|
-
},
|
|
76
|
-
"./sort-products": {
|
|
77
|
-
"types": "./dist/util/sort-products.d.ts",
|
|
78
|
-
"import": "./src/util/sort-products.ts",
|
|
79
|
-
"default": "./src/util/sort-products.ts"
|
|
80
|
-
},
|
|
81
|
-
"./middleware": {
|
|
82
|
-
"types": "./dist/middleware.d.ts",
|
|
83
|
-
"import": "./src/middleware.ts",
|
|
84
|
-
"default": "./src/middleware.ts"
|
|
85
|
-
},
|
|
86
|
-
"./edge": {
|
|
87
|
-
"types": "./dist/edge.d.ts",
|
|
88
|
-
"import": "./src/edge.ts",
|
|
89
|
-
"default": "./src/edge.ts"
|
|
90
|
-
},
|
|
91
|
-
"./cart": {
|
|
92
|
-
"types": "./dist/server/cart.d.ts",
|
|
93
|
-
"import": "./src/server/cart.ts",
|
|
94
|
-
"default": "./src/server/cart.ts"
|
|
95
|
-
},
|
|
96
|
-
"./categories": {
|
|
97
|
-
"types": "./dist/server/categories.d.ts",
|
|
98
|
-
"import": "./src/server/categories.ts",
|
|
99
|
-
"default": "./src/server/categories.ts"
|
|
100
|
-
},
|
|
101
|
-
"./collections": {
|
|
102
|
-
"types": "./dist/server/collections.d.ts",
|
|
103
|
-
"import": "./src/server/collections.ts",
|
|
104
|
-
"default": "./src/server/collections.ts"
|
|
105
|
-
},
|
|
106
|
-
"./contact": {
|
|
107
|
-
"types": "./dist/server/contact.d.ts",
|
|
108
|
-
"import": "./src/server/contact.ts",
|
|
109
|
-
"default": "./src/server/contact.ts"
|
|
110
|
-
},
|
|
111
|
-
"./customer": {
|
|
112
|
-
"types": "./dist/server/customer.d.ts",
|
|
113
|
-
"import": "./src/server/customer.ts",
|
|
114
|
-
"default": "./src/server/customer.ts"
|
|
115
|
-
},
|
|
116
|
-
"./customer-registration": {
|
|
117
|
-
"types": "./dist/server/customer-registration.d.ts",
|
|
118
|
-
"import": "./src/server/customer-registration.ts",
|
|
119
|
-
"default": "./src/server/customer-registration.ts"
|
|
120
|
-
},
|
|
121
|
-
"./dynamic-config": {
|
|
122
|
-
"types": "./dist/server/dynamic-config.d.ts",
|
|
123
|
-
"import": "./src/server/dynamic-config.ts",
|
|
124
|
-
"default": "./src/server/dynamic-config.ts"
|
|
125
|
-
},
|
|
126
|
-
"./fulfillment": {
|
|
127
|
-
"types": "./dist/server/fulfillment.d.ts",
|
|
128
|
-
"import": "./src/server/fulfillment.ts",
|
|
129
|
-
"default": "./src/server/fulfillment.ts"
|
|
130
|
-
},
|
|
131
|
-
"./guest": {
|
|
132
|
-
"types": "./dist/server/guest.d.ts",
|
|
133
|
-
"import": "./src/server/guest.ts",
|
|
134
|
-
"default": "./src/server/guest.ts"
|
|
135
|
-
},
|
|
136
|
-
"./home": {
|
|
137
|
-
"types": "./dist/server/home.d.ts",
|
|
138
|
-
"import": "./src/server/home.ts",
|
|
139
|
-
"default": "./src/server/home.ts"
|
|
140
|
-
},
|
|
141
|
-
"./locale-actions": {
|
|
142
|
-
"types": "./dist/server/locale-actions.d.ts",
|
|
143
|
-
"import": "./src/server/locale-actions.ts",
|
|
144
|
-
"default": "./src/server/locale-actions.ts"
|
|
145
|
-
},
|
|
146
|
-
"./locales": {
|
|
147
|
-
"types": "./dist/server/locales.d.ts",
|
|
148
|
-
"import": "./src/server/locales.ts",
|
|
149
|
-
"default": "./src/server/locales.ts"
|
|
150
|
-
},
|
|
151
|
-
"./notifications": {
|
|
152
|
-
"types": "./dist/server/notifications.d.ts",
|
|
153
|
-
"import": "./src/server/notifications.ts",
|
|
154
|
-
"default": "./src/server/notifications.ts"
|
|
155
|
-
},
|
|
156
|
-
"./onboarding": {
|
|
157
|
-
"types": "./dist/server/onboarding.d.ts",
|
|
158
|
-
"import": "./src/server/onboarding.ts",
|
|
159
|
-
"default": "./src/server/onboarding.ts"
|
|
160
|
-
},
|
|
161
|
-
"./orders": {
|
|
162
|
-
"types": "./dist/server/orders.d.ts",
|
|
163
|
-
"import": "./src/server/orders.ts",
|
|
164
|
-
"default": "./src/server/orders.ts"
|
|
165
|
-
},
|
|
166
|
-
"./payment": {
|
|
167
|
-
"types": "./dist/server/payment.d.ts",
|
|
168
|
-
"import": "./src/server/payment.ts",
|
|
169
|
-
"default": "./src/server/payment.ts"
|
|
170
|
-
},
|
|
171
|
-
"./payment-details": {
|
|
172
|
-
"types": "./dist/server/payment-details.d.ts",
|
|
173
|
-
"import": "./src/server/payment-details.ts",
|
|
174
|
-
"default": "./src/server/payment-details.ts"
|
|
175
|
-
},
|
|
176
|
-
"./pincode": {
|
|
177
|
-
"types": "./dist/server/pincode.d.ts",
|
|
178
|
-
"import": "./src/server/pincode.ts",
|
|
179
|
-
"default": "./src/server/pincode.ts"
|
|
180
|
-
},
|
|
181
|
-
"./products": {
|
|
182
|
-
"types": "./dist/server/products.d.ts",
|
|
183
|
-
"import": "./src/server/products.ts",
|
|
184
|
-
"default": "./src/server/products.ts"
|
|
185
|
-
},
|
|
186
|
-
"./regions": {
|
|
187
|
-
"types": "./dist/server/regions.d.ts",
|
|
188
|
-
"import": "./src/server/regions.ts",
|
|
189
|
-
"default": "./src/server/regions.ts"
|
|
190
|
-
},
|
|
191
|
-
"./returns": {
|
|
192
|
-
"types": "./dist/server/returns.d.ts",
|
|
193
|
-
"import": "./src/server/returns.ts",
|
|
194
|
-
"default": "./src/server/returns.ts"
|
|
195
|
-
},
|
|
196
|
-
"./swaps": {
|
|
197
|
-
"types": "./dist/server/swaps.d.ts",
|
|
198
|
-
"import": "./src/server/swaps.ts",
|
|
199
|
-
"default": "./src/server/swaps.ts"
|
|
200
|
-
},
|
|
201
|
-
"./variants": {
|
|
202
|
-
"types": "./dist/server/variants.d.ts",
|
|
203
|
-
"import": "./src/server/variants.ts",
|
|
204
|
-
"default": "./src/server/variants.ts"
|
|
205
|
-
},
|
|
206
|
-
"./wishlist": {
|
|
207
|
-
"types": "./dist/server/wishlist.d.ts",
|
|
208
|
-
"import": "./src/server/wishlist.ts",
|
|
209
|
-
"default": "./src/server/wishlist.ts"
|
|
210
|
-
},
|
|
211
56
|
"./home/sections/promoAnnouncements": {
|
|
212
57
|
"types": "./dist/server/home-sections/promo-announcements.d.ts",
|
|
213
58
|
"import": "./src/server/home-sections/promo-announcements.ts",
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { HttpTypes } from "@medusajs/types"
|
|
2
|
+
import type { BrandPillarConfig } from "./dynamic-config"
|
|
3
|
+
|
|
4
|
+
type CategoryMetadata = {
|
|
5
|
+
category_image?: string
|
|
6
|
+
category_description?: string
|
|
7
|
+
category_link?: string
|
|
8
|
+
image?: string
|
|
9
|
+
thumbnail?: string
|
|
10
|
+
description?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type CollectionMetadata = {
|
|
14
|
+
category_image?: string
|
|
15
|
+
image?: string
|
|
16
|
+
thumbnail?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function normalizeKey(value: string): string {
|
|
20
|
+
return value
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.trim()
|
|
23
|
+
.replace(/&/g, "and")
|
|
24
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
25
|
+
.replace(/^-+|-+$/g, "")
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function collectionImageForCategory(
|
|
29
|
+
collections: Array<Record<string, unknown>> | undefined,
|
|
30
|
+
category: HttpTypes.StoreProductCategory
|
|
31
|
+
): string | null {
|
|
32
|
+
if (!collections?.length) return null
|
|
33
|
+
|
|
34
|
+
const handleKey = category.handle ? normalizeKey(category.handle) : ""
|
|
35
|
+
const nameKey = category.name ? normalizeKey(category.name) : ""
|
|
36
|
+
|
|
37
|
+
for (const entry of collections) {
|
|
38
|
+
const meta = (entry.metadata as CollectionMetadata | undefined) ?? {}
|
|
39
|
+
const image = meta.category_image || meta.image || meta.thumbnail
|
|
40
|
+
if (!image) continue
|
|
41
|
+
|
|
42
|
+
const cHandle = (entry.handle as string | undefined) ?? ""
|
|
43
|
+
const cTitle = (entry.title as string | undefined) ?? ""
|
|
44
|
+
if (
|
|
45
|
+
(handleKey && normalizeKey(cHandle) === handleKey) ||
|
|
46
|
+
(nameKey && normalizeKey(cTitle) === nameKey)
|
|
47
|
+
) {
|
|
48
|
+
return image
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function imageFromCategory(
|
|
56
|
+
category: HttpTypes.StoreProductCategory
|
|
57
|
+
): string | null {
|
|
58
|
+
const meta = (category.metadata as CategoryMetadata | undefined) ?? {}
|
|
59
|
+
return (
|
|
60
|
+
meta.category_image ||
|
|
61
|
+
meta.image ||
|
|
62
|
+
meta.thumbnail ||
|
|
63
|
+
(category as { thumbnail?: string }).thumbnail ||
|
|
64
|
+
null
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function resolveCategoryImage(
|
|
69
|
+
category: HttpTypes.StoreProductCategory,
|
|
70
|
+
collections?: Array<Record<string, unknown>>
|
|
71
|
+
): string | null {
|
|
72
|
+
const fromCategory = imageFromCategory(category)
|
|
73
|
+
if (fromCategory) return fromCategory
|
|
74
|
+
|
|
75
|
+
const parent = (
|
|
76
|
+
category as HttpTypes.StoreProductCategory & {
|
|
77
|
+
parent_category?: HttpTypes.StoreProductCategory
|
|
78
|
+
}
|
|
79
|
+
).parent_category
|
|
80
|
+
if (parent) {
|
|
81
|
+
const fromParent = imageFromCategory(parent)
|
|
82
|
+
if (fromParent) return fromParent
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return collectionImageForCategory(collections, category)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function categoryDescription(
|
|
89
|
+
category: HttpTypes.StoreProductCategory
|
|
90
|
+
): string {
|
|
91
|
+
const meta = (category.metadata as CategoryMetadata | undefined) ?? {}
|
|
92
|
+
const native = (category as { description?: string | null }).description
|
|
93
|
+
return String(
|
|
94
|
+
native ?? meta.category_description ?? meta.description ?? ""
|
|
95
|
+
).trim()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function categoryHref(category: HttpTypes.StoreProductCategory): string | undefined {
|
|
99
|
+
const meta = (category.metadata as CategoryMetadata | undefined) ?? {}
|
|
100
|
+
const custom = meta.category_link?.trim()
|
|
101
|
+
if (custom) return custom
|
|
102
|
+
if (category.handle) return `/categories/${category.handle}`
|
|
103
|
+
return undefined
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function pickBrandPillarCategories(
|
|
107
|
+
categories: HttpTypes.StoreProductCategory[],
|
|
108
|
+
collections: Array<Record<string, unknown>> | undefined,
|
|
109
|
+
limit = 4
|
|
110
|
+
): HttpTypes.StoreProductCategory[] {
|
|
111
|
+
const valid = (categories ?? []).filter((c) => c.name && c.handle)
|
|
112
|
+
const topLevel = valid.filter((c) => !c.parent_category_id)
|
|
113
|
+
const withImage = topLevel.filter((c) =>
|
|
114
|
+
Boolean(resolveCategoryImage(c, collections))
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
const pool = withImage.length >= 2 ? withImage : topLevel
|
|
118
|
+
|
|
119
|
+
return [...pool]
|
|
120
|
+
.sort(
|
|
121
|
+
(a, b) =>
|
|
122
|
+
Number(Boolean(resolveCategoryImage(b, collections))) -
|
|
123
|
+
Number(Boolean(resolveCategoryImage(a, collections))) ||
|
|
124
|
+
(a.name ?? "").localeCompare(b.name ?? "")
|
|
125
|
+
)
|
|
126
|
+
.slice(0, limit)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Brand pillar cards from top-level product categories (not CMS pillars array). */
|
|
130
|
+
export function buildBrandPillarsFromCategories(
|
|
131
|
+
categories: HttpTypes.StoreProductCategory[],
|
|
132
|
+
collections: Array<Record<string, unknown>> | undefined,
|
|
133
|
+
sectionTitle: string
|
|
134
|
+
): { sectionTitle: string; pillars: BrandPillarConfig[] } {
|
|
135
|
+
const pillars = pickBrandPillarCategories(categories, collections).flatMap(
|
|
136
|
+
(category) => {
|
|
137
|
+
const title = (category.name ?? "").trim()
|
|
138
|
+
const image = resolveCategoryImage(category, collections) ?? undefined
|
|
139
|
+
if (!title || !image) return []
|
|
140
|
+
|
|
141
|
+
const description = categoryDescription(category)
|
|
142
|
+
const href = categoryHref(category)
|
|
143
|
+
|
|
144
|
+
return [
|
|
145
|
+
{
|
|
146
|
+
title,
|
|
147
|
+
description,
|
|
148
|
+
image,
|
|
149
|
+
...(href ? { href } : {}),
|
|
150
|
+
},
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
return { sectionTitle, pillars }
|
|
156
|
+
}
|
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")
|