@mohasinac/appkit 4.11.0 → 4.11.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/dist/_internal/server/features/products/data.d.ts +2 -2
- package/dist/_internal/server/features/products/data.js +5 -23
- package/dist/_internal/shared/features/products/to-product-item.d.ts +25 -0
- package/dist/_internal/shared/features/products/to-product-item.js +45 -0
- package/dist/features/grouped/components/GroupedListingsCarousel.js +4 -1
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { toProductItem } from "../../../shared/features/products/to-product-item";
|
|
2
|
+
export { toProductItem };
|
|
1
3
|
import type { ProductDocument } from "../../../../features/products/schemas/firestore";
|
|
2
4
|
import type { ListingType } from "../../../../features/products/types";
|
|
3
5
|
import type { ProductItem } from "../../../../features/products/types";
|
|
@@ -26,8 +28,6 @@ export interface RelatedItemsResult {
|
|
|
26
28
|
relatedByTags: ProductItem[];
|
|
27
29
|
relatedByStore: ProductItem[];
|
|
28
30
|
}
|
|
29
|
-
/** Firestore doc → card-grid shape. Shared by every related/similar-items carousel. */
|
|
30
|
-
export declare function toProductItem(doc: FirestoreDocument): ProductItem;
|
|
31
31
|
/**
|
|
32
32
|
* Same 4-signal related-items computation used across every listing-type
|
|
33
33
|
* detail page (category / brand / tag-overlap / same-store), each excluding
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { cache } from "react";
|
|
2
|
+
// Imported (not just re-exported) because this module calls it internally.
|
|
3
|
+
// It lives in _internal/shared so `"use client"` components can import it
|
|
4
|
+
// without dragging this file's firebase-admin chain into the client bundle.
|
|
5
|
+
import { toProductItem } from "../../../shared/features/products/to-product-item";
|
|
6
|
+
export { toProductItem };
|
|
2
7
|
import { productRepository } from "../../../../repositories";
|
|
3
8
|
import { reviewRepository } from "../../../../repositories";
|
|
4
9
|
import { getAdminDb } from "../../../../providers/db-firebase";
|
|
@@ -94,29 +99,6 @@ export async function listSitemapProducts() {
|
|
|
94
99
|
const RELATED_QUERY_PAGE_SIZE = 9;
|
|
95
100
|
const RELATED_DISPLAY_LIMIT = 8;
|
|
96
101
|
/** Firestore doc → card-grid shape. Shared by every related/similar-items carousel. */
|
|
97
|
-
export function toProductItem(doc) {
|
|
98
|
-
return {
|
|
99
|
-
id: String(doc.id ?? ""),
|
|
100
|
-
title: String(doc.title ?? doc.name ?? ""),
|
|
101
|
-
price: typeof doc.price === "number" ? doc.price : 0,
|
|
102
|
-
originalPrice: typeof doc.originalPrice === "number" ? doc.originalPrice : undefined,
|
|
103
|
-
mainImage: Array.isArray(doc.images)
|
|
104
|
-
? doc.images[0]
|
|
105
|
-
: typeof doc.mainImage === "string"
|
|
106
|
-
? doc.mainImage
|
|
107
|
-
: undefined,
|
|
108
|
-
status: doc.status ?? "published",
|
|
109
|
-
slug: typeof doc.slug === "string" ? doc.slug : undefined,
|
|
110
|
-
storeName: typeof doc.storeName === "string" ? doc.storeName : undefined,
|
|
111
|
-
rating: typeof doc.rating === "number" ? doc.rating : undefined,
|
|
112
|
-
reviewCount: typeof doc.reviewCount === "number" ? doc.reviewCount : undefined,
|
|
113
|
-
// Without this, every related-item card silently linked to the standard
|
|
114
|
-
// PDP regardless of its real type (pluginFor() defaults to "standard"
|
|
115
|
-
// when listingType is missing) — same bug class as the Phase 1 routing
|
|
116
|
-
// fix, one hop further downstream in the related-items card link path.
|
|
117
|
-
listingType: doc.listingType ?? undefined,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
102
|
/**
|
|
121
103
|
* Excludes the current product plus any listing-type-specific "invalid to
|
|
122
104
|
* surface as related" state: sold/archived/out-of-stock/draft, ended
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toProductItem — Firestore doc → card-grid `ProductItem` mapper.
|
|
3
|
+
*
|
|
4
|
+
* Lives in `_internal/shared/` (client+server safe), NOT in
|
|
5
|
+
* `_internal/server/features/products/data.ts` where it was originally
|
|
6
|
+
* written. It is a pure field mapping with no server dependencies of its
|
|
7
|
+
* own, but `data.ts` transitively reaches `providers/db-firebase/admin.js`
|
|
8
|
+
* (firebase-admin), and `GroupedListingsCarousel.tsx` is a `"use client"`
|
|
9
|
+
* component that imports this function as a VALUE. Turbopack resolves a
|
|
10
|
+
* module's full static import graph before tree-shaking, so that single
|
|
11
|
+
* import dragged the whole firebase-admin chain into the client bundle and
|
|
12
|
+
* failed the production build outright:
|
|
13
|
+
*
|
|
14
|
+
* Module not found: .../providers/db-firebase/admin.js
|
|
15
|
+
* [Client Component Browser] → GroupedListingsCarousel
|
|
16
|
+
* → _internal/server/features/products/data.js
|
|
17
|
+
*
|
|
18
|
+
* This is the Turbopack client-bundle trap from CLAUDE.md's appkit Export
|
|
19
|
+
* Rules / Recurrent Root Cause #6, reached through an ordinary deep import
|
|
20
|
+
* rather than a barrel. Keep this file free of any server-only import so a
|
|
21
|
+
* client component can always call it directly.
|
|
22
|
+
*/
|
|
23
|
+
import type { FirestoreDocument } from "../../../../schemas/types";
|
|
24
|
+
import type { ProductItem } from "../../../../features/products/types";
|
|
25
|
+
export declare function toProductItem(doc: FirestoreDocument): ProductItem;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toProductItem — Firestore doc → card-grid `ProductItem` mapper.
|
|
3
|
+
*
|
|
4
|
+
* Lives in `_internal/shared/` (client+server safe), NOT in
|
|
5
|
+
* `_internal/server/features/products/data.ts` where it was originally
|
|
6
|
+
* written. It is a pure field mapping with no server dependencies of its
|
|
7
|
+
* own, but `data.ts` transitively reaches `providers/db-firebase/admin.js`
|
|
8
|
+
* (firebase-admin), and `GroupedListingsCarousel.tsx` is a `"use client"`
|
|
9
|
+
* component that imports this function as a VALUE. Turbopack resolves a
|
|
10
|
+
* module's full static import graph before tree-shaking, so that single
|
|
11
|
+
* import dragged the whole firebase-admin chain into the client bundle and
|
|
12
|
+
* failed the production build outright:
|
|
13
|
+
*
|
|
14
|
+
* Module not found: .../providers/db-firebase/admin.js
|
|
15
|
+
* [Client Component Browser] → GroupedListingsCarousel
|
|
16
|
+
* → _internal/server/features/products/data.js
|
|
17
|
+
*
|
|
18
|
+
* This is the Turbopack client-bundle trap from CLAUDE.md's appkit Export
|
|
19
|
+
* Rules / Recurrent Root Cause #6, reached through an ordinary deep import
|
|
20
|
+
* rather than a barrel. Keep this file free of any server-only import so a
|
|
21
|
+
* client component can always call it directly.
|
|
22
|
+
*/
|
|
23
|
+
export function toProductItem(doc) {
|
|
24
|
+
return {
|
|
25
|
+
id: String(doc.id ?? ""),
|
|
26
|
+
title: String(doc.title ?? doc.name ?? ""),
|
|
27
|
+
price: typeof doc.price === "number" ? doc.price : 0,
|
|
28
|
+
originalPrice: typeof doc.originalPrice === "number" ? doc.originalPrice : undefined,
|
|
29
|
+
mainImage: Array.isArray(doc.images)
|
|
30
|
+
? doc.images[0]
|
|
31
|
+
: typeof doc.mainImage === "string"
|
|
32
|
+
? doc.mainImage
|
|
33
|
+
: undefined,
|
|
34
|
+
status: doc.status ?? "published",
|
|
35
|
+
slug: typeof doc.slug === "string" ? doc.slug : undefined,
|
|
36
|
+
storeName: typeof doc.storeName === "string" ? doc.storeName : undefined,
|
|
37
|
+
rating: typeof doc.rating === "number" ? doc.rating : undefined,
|
|
38
|
+
reviewCount: typeof doc.reviewCount === "number" ? doc.reviewCount : undefined,
|
|
39
|
+
// Without this, every related-item card silently linked to the standard
|
|
40
|
+
// PDP regardless of its real type (pluginFor() defaults to "standard"
|
|
41
|
+
// when listingType is missing) — same bug class as the Phase 1 routing
|
|
42
|
+
// fix, one hop further downstream in the related-items card link path.
|
|
43
|
+
listingType: doc.listingType ?? undefined,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -3,7 +3,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { pluginFor } from "../../../_internal/shared/listing-types/_registry";
|
|
4
4
|
import { SectionCarousel } from "../../homepage/components/SectionCarousel";
|
|
5
5
|
import { ProductCard } from "../../products/components/ProductGrid";
|
|
6
|
-
|
|
6
|
+
// Must come from _internal/shared — importing this as a VALUE from
|
|
7
|
+
// _internal/server/.../data.ts pulled firebase-admin into the client bundle
|
|
8
|
+
// and failed the Turbopack production build (Root Cause #6).
|
|
9
|
+
import { toProductItem } from "../../../_internal/shared/features/products/to-product-item";
|
|
7
10
|
import { CAROUSEL_PER_VIEW } from "../../homepage/constants/carousel-per-view";
|
|
8
11
|
import { Stack } from "../../../ui";
|
|
9
12
|
const GROUP_THEME_TITLE = {
|