@pradip1995/storefront-controllers 1.0.1 → 1.1.5
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/package.json +7 -7
- package/src/home/load-home-data.ts +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pradip1995/storefront-controllers",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Medusa storefront page controllers — data loading and composition",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"./product/product-actions-wrapper": "./src/product/product-actions-wrapper.tsx"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
+
"@pradip1995/commerce-core": "^1.1.5",
|
|
37
|
+
"@pradip1995/storefront-registry": "^1.1.5",
|
|
36
38
|
"next": ">=15",
|
|
37
|
-
"react": ">=19"
|
|
38
|
-
"@pradip1995/commerce-core": "1.0.1",
|
|
39
|
-
"@pradip1995/storefront-registry": "1.0.1"
|
|
39
|
+
"react": ">=19"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@pradip1995/commerce-core": "^1.1.5",
|
|
43
|
+
"@pradip1995/storefront-registry": "^1.1.5",
|
|
42
44
|
"@medusajs/types": "latest",
|
|
43
45
|
"@types/react": "^19",
|
|
44
46
|
"eslint": "^8.57.0",
|
|
45
47
|
"next": "15.3.8",
|
|
46
48
|
"react": "19.0.3",
|
|
47
|
-
"typescript": "^5.7.2"
|
|
48
|
-
"@pradip1995/commerce-core": "1.0.1",
|
|
49
|
-
"@pradip1995/storefront-registry": "1.0.1"
|
|
49
|
+
"typescript": "^5.7.2"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
@@ -8,32 +8,38 @@ import {
|
|
|
8
8
|
getAppBannersFromConfig,
|
|
9
9
|
getFeaturesFromConfig,
|
|
10
10
|
} from "@core/data/dynamic-config"
|
|
11
|
+
import { getThemeDefaultAssets } from "@core/util/theme-default-assets"
|
|
11
12
|
import { fetchRatings } from "@core/data/reviews"
|
|
12
13
|
import type { HomePageData, BannerData } from "@core/types/home"
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
function buildDefaultBanner(): BannerData {
|
|
16
|
+
const assets = getThemeDefaultAssets()
|
|
17
|
+
return {
|
|
18
|
+
image: assets.heroDesktop,
|
|
19
|
+
title: "Premium Kids Shop",
|
|
20
|
+
subtitle: "Little Trends, Quality Kids Wear",
|
|
21
|
+
description:
|
|
22
|
+
"Shop stylish kids wear for little ones and children of all years—from newborn up to 15 years. Crafted for play, absolute comfort, and everyday magic.",
|
|
23
|
+
buttonName: "Shop Kids Wear",
|
|
24
|
+
buttonLink: "/store",
|
|
25
|
+
}
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
function buildBannerData(
|
|
25
29
|
homeBanners: BannerData[] | null | undefined,
|
|
26
30
|
appBanners: BannerData[] | null | undefined
|
|
27
31
|
): HomePageData["hero"] {
|
|
32
|
+
const assets = getThemeDefaultAssets()
|
|
33
|
+
const defaultBanner = buildDefaultBanner()
|
|
28
34
|
const homeBanner =
|
|
29
35
|
homeBanners && homeBanners.length > 0 ? homeBanners[0] : defaultBanner
|
|
30
|
-
const homeBannerImage = homeBanner.image ||
|
|
36
|
+
const homeBannerImage = homeBanner.image || assets.heroDesktop
|
|
31
37
|
const firstAppBanner = appBanners && appBanners.length > 0 ? appBanners[0] : null
|
|
32
38
|
|
|
33
39
|
return {
|
|
34
40
|
homeBanner: { ...homeBanner, image: homeBannerImage },
|
|
35
41
|
appBanner: {
|
|
36
|
-
image: firstAppBanner?.image ||
|
|
42
|
+
image: firstAppBanner?.image || assets.heroMobile,
|
|
37
43
|
title: firstAppBanner?.title || homeBanner.title,
|
|
38
44
|
subtitle: firstAppBanner?.subtitle || homeBanner.subtitle,
|
|
39
45
|
description: firstAppBanner?.description || homeBanner.description,
|