@mohasinac/appkit 4.32.4 → 4.32.6

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.
@@ -4,6 +4,7 @@ import { mediaUrlSchema } from "../../../validation/schemas";
4
4
  import { serverLogger } from "../../../monitoring";
5
5
  import { blogRepository } from "../repository/blog.repository";
6
6
  import { coerceMediaField, getMediaUrl } from "../../../utils";
7
+ import { hidePublicTestData } from "../../../_internal/server/features/tester/visibility";
7
8
  import { finalizeStagedMediaField, finalizeStagedMediaObject, finalizeStagedMediaObjectArray, } from "../../media/finalize";
8
9
  // --- Schemas --------------------------------------------------------------
9
10
  const singleImageMediaSchema = z
@@ -104,7 +105,7 @@ export async function listBlogPosts(params) {
104
105
  }
105
106
  export async function getFeaturedBlogPosts(count = 3) {
106
107
  const result = await blogRepository.listPublished({ featuredOnly: true }, { sorts: sortBy("publishedAt", "DESC"), page: 1, pageSize: count });
107
- return result.items;
108
+ return hidePublicTestData(result.items);
108
109
  }
109
110
  export async function getLatestBlogPosts(count = 5) {
110
111
  const result = await blogRepository.listPublished({}, { sorts: sortBy("publishedAt", "DESC"), page: 1, pageSize: count });
@@ -1,5 +1,6 @@
1
1
  import { serverLogger } from "../../../monitoring";
2
2
  import { categoriesRepository } from "../repository/categories.repository";
3
+ import { hidePublicTestData } from "../../../_internal/server/features/tester/visibility";
3
4
  export async function createCategory(input, createdBy) {
4
5
  const categoryData = {
5
6
  ...input,
@@ -40,14 +41,16 @@ export async function listCategories(params) {
40
41
  }
41
42
  export async function listTopLevelCategories(limit = 12) {
42
43
  const all = await categoriesRepository.getCategoriesByTier(0);
43
- return all
44
+ return hidePublicTestData(all)
44
45
  .filter((c) => c.isActive !== false)
45
46
  .sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
46
47
  .slice(0, limit);
47
48
  }
48
49
  export async function listBrandCategories(limit = 12) {
49
50
  const brands = await categoriesRepository.getBrandCategories();
50
- return brands.filter((c) => c.isActive !== false).slice(0, limit);
51
+ return hidePublicTestData(brands)
52
+ .filter((c) => c.isActive !== false)
53
+ .slice(0, limit);
51
54
  }
52
55
  export async function getCategoryById(id) {
53
56
  return categoriesRepository.findById(id);
@@ -26,6 +26,6 @@ export async function BundlesListView({ searchParams = {}, onBuyNow, }) {
26
26
  const visible = hidePublicTestData(all);
27
27
  const bundles = storeId
28
28
  ? visible.filter((c) => c.createdByStoreId === storeId)
29
- : all;
29
+ : visible;
30
30
  return (_jsx(Main, { children: _jsx(Section, { padding: "y-2xl", children: _jsxs(Container, { size: "xl", children: [_jsx(Heading, { level: 1, className: "mb-2", color: "primary", size: "3xl", weight: "semibold", children: "Collectible Bundles" }), _jsx(Text, { className: "mb-6 text-[var(--appkit-color-text-muted)]", size: "sm", children: "Curated multi-product bundles \u2014 Pok\u00E9mon starter sets, Beyblade tournament packs, Hot Wheels collector boxes and more. One price, one checkout, one shipment." }), _jsx(AdSlot, { id: "listing-sidebar-top", className: "mb-6" }), _jsx(CategoryBundlesListing, { initialBundles: bundles, onBuyNow: onBuyNow }), _jsx(AdSlot, { id: "listing-sidebar-bottom", className: "mt-8" })] }) }) }));
31
31
  }
@@ -15,6 +15,7 @@ import { hashGuestIdentity } from "../../../security/rate-limit";
15
15
  const ERR_EVENT_NOT_FOUND = "Event not found";
16
16
  import { coerceMediaField, getMediaUrl } from "../../../utils";
17
17
  import { finalizeStagedMediaField, finalizeStagedMediaObject, finalizeStagedMediaObjectArray, } from "../../media/finalize";
18
+ import { hidePublicTestData } from "../../../_internal/server/features/tester/visibility";
18
19
  // --- Admin: Create Event --------------------------------------------------
19
20
  export async function createEvent(adminId, input) {
20
21
  const finalizedCoverUrl = await finalizeStagedMediaField(getMediaUrl(input.coverImage) ??
@@ -130,12 +131,14 @@ export async function listPublicEvents(params) {
130
131
  pageSize = params.pageSize ?? 20;
131
132
  }
132
133
  const base = "status==active";
133
- return eventRepository.list({
134
+ const result = await eventRepository.list({
134
135
  filters: filters ? `${base},${filters}` : base,
135
136
  sorts: sorts ?? "startsAt",
136
137
  page,
137
138
  pageSize,
138
139
  });
140
+ // PUBLIC by name — it backs the homepage strip and /events.
141
+ return { ...result, items: hidePublicTestData(result.items) };
139
142
  }
140
143
  export async function getPublicEventById(id) {
141
144
  const event = await eventRepository.findByIdOrSlug(id);
@@ -11,6 +11,7 @@ import { sortBy } from "../../../constants/sort";
11
11
  import { Container, Grid, Heading, Section, Stack, Text } from "../../../ui";
12
12
  import { eventRepository } from "../repository/events.repository";
13
13
  import { EventCard } from "./EventCard";
14
+ import { hidePublicTestData } from "../../../_internal/server/features/tester/visibility";
14
15
  /**
15
16
  * Renders a live-raffle/spin-wheel strip on the homepage.
16
17
  * W1-38 (2026-05-23): fetches events with hasRaffle=true and renders the EventCard grid.
@@ -26,7 +27,7 @@ export async function EventRafflesSection({ config, }) {
26
27
  sorts: sortBy("startsAt", "DESC"),
27
28
  pageSize: limit,
28
29
  });
29
- events = (result.items ?? []);
30
+ events = hidePublicTestData(result.items ?? []);
30
31
  }
31
32
  catch (_err) {
32
33
  void normalizeError(_err);
@@ -4,6 +4,7 @@ import { listPublicProducts } from "../../../_internal/server/features/products/
4
4
  import { AVAILABILITY_VALUES, PRODUCT_FIELDS } from "../../../constants/field-names";
5
5
  import { productRepository } from "../repository/products.repository";
6
6
  import { ProductStatusValues } from "../schemas";
7
+ import { hidePublicTestData } from "../../../_internal/server/features/tester/visibility";
7
8
  /**
8
9
  * Reusable Sieve clauses. Single source of truth for the listing-type
9
10
  * discriminator across every action helper in this file. SB1-G (S21 2026-05-12)
@@ -31,7 +32,14 @@ export async function listProducts(params = {}) {
31
32
  page,
32
33
  pageSize,
33
34
  };
34
- return productRepository.list(sieve, { categoriesIn });
35
+ /*
36
+ * Fail-closed. This is reachable as a SERVER ACTION — invocable straight from
37
+ * a browser — so it is a public surface whoever happens to call it today.
38
+ * `getFeaturedProducts` and friends already route through
39
+ * `listPublicProducts`, which filters; this generic path did not.
40
+ */
41
+ const result = await productRepository.list(sieve, { categoriesIn });
42
+ return { ...result, items: hidePublicTestData(result.items) };
35
43
  }
36
44
  export async function getProductById(id) {
37
45
  return productRepository.findById(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.32.4",
3
+ "version": "4.32.6",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"