@mohasinac/appkit 4.66.0 β†’ 4.67.0

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.
Files changed (33) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/_internal/client/features/maintenance/index.d.ts +1 -0
  3. package/dist/_internal/client/features/maintenance/index.js +1 -0
  4. package/dist/_internal/client/features/maintenance/views/CacheInvalidationPanel.d.ts +33 -0
  5. package/dist/_internal/client/features/maintenance/views/CacheInvalidationPanel.js +96 -0
  6. package/dist/_internal/client/features/maintenance/views/MaintenanceDashboardView.js +2 -1
  7. package/dist/_internal/server/features/products/surface-counts.d.ts +26 -0
  8. package/dist/_internal/server/features/products/surface-counts.js +60 -0
  9. package/dist/_internal/server/features/seo/sitemap.js +37 -3
  10. package/dist/_internal/server/features/site-settings/adapters.d.ts +16 -0
  11. package/dist/_internal/server/features/site-settings/adapters.js +11 -0
  12. package/dist/_internal/server/jobs/core/onProductWrite.js +33 -0
  13. package/dist/_internal/server/jobs/core/surfaceCountsRollup.d.ts +55 -0
  14. package/dist/_internal/server/jobs/core/surfaceCountsRollup.js +128 -0
  15. package/dist/_internal/server/jobs/handlers/countersReconcile.js +54 -1
  16. package/dist/_internal/shared/actions/action-registry.js +28 -0
  17. package/dist/_internal/shared/cache/revalidate-targets.js +66 -47
  18. package/dist/_internal/shared/features/site-settings/types.d.ts +17 -0
  19. package/dist/_internal/shared/listing-types/feature-flags.d.ts +45 -0
  20. package/dist/_internal/shared/listing-types/feature-flags.js +51 -0
  21. package/dist/client.d.ts +4 -2
  22. package/dist/client.js +10 -1
  23. package/dist/constants/api-endpoints.d.ts +3 -0
  24. package/dist/constants/api-endpoints.js +11 -0
  25. package/dist/features/products/schemas/surface-counts.d.ts +83 -0
  26. package/dist/features/products/schemas/surface-counts.js +58 -0
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +3 -1
  29. package/dist/react/hooks/useListingSurfaceVisibility.d.ts +44 -0
  30. package/dist/react/hooks/useListingSurfaceVisibility.js +20 -0
  31. package/dist/server.d.ts +2 -0
  32. package/dist/server.js +12 -0
  33. package/package.json +33 -1
@@ -0,0 +1,44 @@
1
+ import type { ListingType } from "../../features/products/types/index";
2
+ /**
3
+ * Which public browse surfaces should be LINKED β€” the admin flag, minus the
4
+ * ones measured as having nothing in them.
5
+ *
6
+ * ## πŸ›‘ Why this is not a change to `useListingTypeFlags`
7
+ *
8
+ * That hook answers a different question β€” *"does this marketplace sell X?"* β€”
9
+ * and its main consumer is the seller's type dropdown. A seller must still be
10
+ * able to list the first spare part when there are zero spares, so folding
11
+ * emptiness into it would make the catalogue unfillable the moment it emptied:
12
+ * the only control that could add stock would disappear for want of stock.
13
+ * Same split as `enabledListingTypes` vs `visibleListingTypes`.
14
+ *
15
+ * So: `useListingTypeFlags` for anything AUTHORING, this for anything
16
+ * BROWSING.
17
+ *
18
+ * ## πŸ›‘ Defaults to VISIBLE while settings load
19
+ *
20
+ * Same reasoning as `useBrowsePageFlags`, and it bites harder here. This hook
21
+ * decides whether a nav entry renders, and `surfaceCounts` is absent from the
22
+ * payload until the rollup has run at least once β€” so a restrictive default
23
+ * would blank most of the navbar on every cold load, and would blank it
24
+ * permanently on an install whose job has never run.
25
+ *
26
+ * `isListingSurfaceVisible` encodes the rule (absent count β†’ visible); this
27
+ * hook only supplies it with data. Do not re-derive the comparison here.
28
+ */
29
+ export type ListingSurfaceVisibility = Record<ListingType, boolean> & {
30
+ /** True when the type's browse surface should be linked. */
31
+ isVisible: (type: ListingType) => boolean;
32
+ /**
33
+ * True when a non-listing-type surface (`"reviews"`) should be linked.
34
+ * Absent measurement β†’ true.
35
+ */
36
+ isSurfaceVisible: (surface: string) => boolean;
37
+ /**
38
+ * True when a link may be shown β€” it points at no listing-type surface, or
39
+ * at one that is visible. Pass an href straight from a nav/footer constant,
40
+ * together with the href→types map the caller owns.
41
+ */
42
+ allowsTypes: (types: readonly ListingType[] | undefined) => boolean;
43
+ };
44
+ export declare function useListingSurfaceVisibility(): ListingSurfaceVisibility;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { useSiteSettings } from "../../core/hooks/useSiteSettings.js";
3
+ import { ALL_LISTING_TYPES, isListingSurfaceVisible, isCountedSurfaceVisible, } from "../../_internal/shared/listing-types/feature-flags.js";
4
+ export function useListingSurfaceVisibility() {
5
+ const { data } = useSiteSettings();
6
+ const settings = { listings: { listingTypes: data?.listings?.listingTypes } };
7
+ const counts = data?.surfaceCounts;
8
+ const flags = Object.fromEntries(ALL_LISTING_TYPES.map((t) => [t, isListingSurfaceVisible(t, settings, counts)]));
9
+ return {
10
+ ...flags,
11
+ isVisible: (type) => flags[type],
12
+ isSurfaceVisible: (surface) => isCountedSurfaceVisible(surface, counts),
13
+ /*
14
+ * ANY of the types, not every β€” matching the existing footer rule, whose
15
+ * comment states it: "/art stays reachable when stickers are off and art
16
+ * is on." A shared page is empty only when every type it spans is.
17
+ */
18
+ allowsTypes: (types) => !types || types.length === 0 || types.some((t) => flags[t]),
19
+ };
20
+ }
package/dist/server.d.ts CHANGED
@@ -662,3 +662,5 @@ export { AD_BOOKING_COLLECTION, AD_BOOKING_PAYMENT_STATES, AD_MODERATION_STATES,
662
662
  export type { AdBookingDocument, AdBookingCreative, AdBookingPaymentState, AdModerationState, AdPeriod, } from "./features/ads/schemas/firestore";
663
663
  export { getDashboardHubData } from "./_internal/server/features/dashboard/data";
664
664
  export type { DashboardHubData } from "./_internal/server/features/dashboard/data";
665
+ export { getSurfaceCounts } from "./_internal/server/features/products/surface-counts";
666
+ export type { PublicSurfaceCounts } from "./_internal/server/features/products/surface-counts";
package/dist/server.js CHANGED
@@ -1872,3 +1872,15 @@ export { AD_BOOKING_COLLECTION, AD_BOOKING_PAYMENT_STATES, AD_MODERATION_STATES,
1872
1872
  * above reaches a consumer route.
1873
1873
  */
1874
1874
  export { getDashboardHubData } from "./_internal/server/features/dashboard/data.js";
1875
+ // Auto-hide: the measured "does this browse surface hold anything" document.
1876
+ // Server-only (firebase-admin via getAdminDb); the PREDICATE that reads it is
1877
+ // client-safe and lives in client.ts/index.ts beside the other visibility gates.
1878
+ export { getSurfaceCounts } from "./_internal/server/features/products/surface-counts.js";
1879
+ /*
1880
+ * πŸ›‘ `runSurfaceCountsRollup` / `computeSurfaceCounts` are deliberately NOT
1881
+ * exported. They live under `_internal/server/jobs/core/` and their only
1882
+ * caller is `countersReconcileHandler`, which imports them directly β€” so a
1883
+ * barrel entry would leak an `_internal/` symbol for no consumer, which
1884
+ * `audit-appkit-reexports` correctly blocks. Add one only if a consumer
1885
+ * genuinely needs to trigger a rollup from outside appkit.
1886
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.66.0",
3
+ "version": "4.67.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,6 +23,18 @@
23
23
  "types": "./dist/client.d.ts",
24
24
  "import": "./dist/client.js"
25
25
  },
26
+ "./client/*": {
27
+ "types": "./dist/client/*.d.ts",
28
+ "import": "./dist/client/*.js"
29
+ },
30
+ "./hand-mode": {
31
+ "types": "./dist/hand-mode/index.d.ts",
32
+ "import": "./dist/hand-mode/index.js"
33
+ },
34
+ "./theme": {
35
+ "types": "./dist/theme/index.d.ts",
36
+ "import": "./dist/theme/index.js"
37
+ },
26
38
  "./next": {
27
39
  "types": "./dist/next/index.d.ts",
28
40
  "import": "./dist/next/index.js"
@@ -281,6 +293,26 @@
281
293
  "./views/tour-provider": {
282
294
  "types": "./dist/_internal/client/features/tour/TourProvider.d.ts",
283
295
  "import": "./dist/_internal/client/features/tour/TourProvider.js"
296
+ },
297
+ "./shipping/quote": {
298
+ "types": "./dist/_internal/shared/shipping/quote.d.ts",
299
+ "import": "./dist/_internal/shared/shipping/quote.js"
300
+ },
301
+ "./fees/calculator": {
302
+ "types": "./dist/_internal/shared/fees/calculator.d.ts",
303
+ "import": "./dist/_internal/shared/fees/calculator.js"
304
+ },
305
+ "./emi/choice": {
306
+ "types": "./dist/_internal/shared/features/emi/choice.d.ts",
307
+ "import": "./dist/_internal/shared/features/emi/choice.js"
308
+ },
309
+ "./layout/nav-portal": {
310
+ "types": "./dist/_internal/shared/features/layout/types.d.ts",
311
+ "import": "./dist/_internal/shared/features/layout/types.js"
312
+ },
313
+ "./views/digital-content-pool": {
314
+ "types": "./dist/_internal/client/features/digital-code/DigitalContentPoolManager.d.ts",
315
+ "import": "./dist/_internal/client/features/digital-code/DigitalContentPoolManager.js"
284
316
  }
285
317
  },
286
318
  "files": [