@mohasinac/appkit 4.71.2 → 4.72.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 (43) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/constants/api-endpoints.d.ts +3 -0
  3. package/dist/constants/api-endpoints.js +6 -0
  4. package/dist/features/classified/components/ClassifiedDetailPageView.js +2 -2
  5. package/dist/features/digital-codes/components/DigitalCodeDetailPageView.js +2 -2
  6. package/dist/features/events/components/EntryVoteButtons.d.ts +19 -0
  7. package/dist/features/events/components/EntryVoteButtons.js +65 -0
  8. package/dist/features/events/repository/entry-votes.repository.d.ts +45 -0
  9. package/dist/features/events/repository/entry-votes.repository.js +154 -0
  10. package/dist/features/events/schemas/entry-votes.d.ts +134 -0
  11. package/dist/features/events/schemas/entry-votes.js +114 -0
  12. package/dist/features/events/schemas/index.d.ts +29 -7
  13. package/dist/features/events/schemas/index.js +29 -2
  14. package/dist/features/inventory/components/AdminMoveLedgerView.d.ts +1 -1
  15. package/dist/features/live/components/LiveItemDetailPageView.js +2 -2
  16. package/dist/features/pre-orders/components/PreOrderDetailPageView.js +3 -3
  17. package/dist/features/products/components/ClearanceDetailPageView.js +2 -2
  18. package/dist/features/products/components/index.d.ts +0 -2
  19. package/dist/features/products/components/index.js +0 -1
  20. package/dist/features/products/schemas/index.d.ts +6 -7
  21. package/dist/features/products/schemas/index.js +20 -2
  22. package/dist/features/promotions/schemas/firestore.d.ts +17 -1
  23. package/dist/features/promotions/schemas/firestore.js +22 -0
  24. package/dist/features/promotions/schemas/index.d.ts +45 -21
  25. package/dist/features/promotions/schemas/index.js +37 -8
  26. package/dist/features/promotions/types/index.d.ts +1 -1
  27. package/dist/features/reviews/schemas/index.d.ts +3 -0
  28. package/dist/features/reviews/schemas/index.js +25 -0
  29. package/dist/index.d.ts +0 -2
  30. package/dist/index.js +0 -3
  31. package/dist/next/routing/portals.d.ts +22 -0
  32. package/dist/next/routing/portals.js +43 -0
  33. package/dist/providers/db-firebase/admin.d.ts +2 -0
  34. package/dist/providers/db-firebase/admin.js +25 -2
  35. package/dist/schemas/registry.d.ts +11 -8
  36. package/dist/styles.css +1 -1
  37. package/dist/tailwind-utilities.css +1 -1
  38. package/dist/ui/components/ListingDetailShell.d.ts +68 -0
  39. package/dist/ui/components/ListingDetailShell.js +32 -0
  40. package/package.json +533 -525
  41. package/scripts/seed-cli.mjs +32 -2
  42. package/dist/features/products/components/PreOrderDetailView.d.ts +0 -18
  43. package/dist/features/products/components/PreOrderDetailView.js +0 -12
@@ -168,9 +168,26 @@ if (!admin.apps.length) {
168
168
  });
169
169
  }
170
170
  }
171
- const db = admin.firestore();
171
+ /*
172
+ * 🛑 WHICH DATABASE THIS WRITES TO.
173
+ *
174
+ * Owner, 2026-11-08: seeding and local work must not touch live data — seeds
175
+ * go to a dev database while the live site keeps using `(default)`.
176
+ *
177
+ * `FIREBASE_SHOP_DATABASE_ID` is the same variable the app's provider reads, so
178
+ * the CLI and the running app can never disagree about where "the database" is.
179
+ *
180
+ * UNSET MEANS PRODUCTION, deliberately: the safe default for a deploy is the
181
+ * real database, and the dangerous direction — a developer silently wiping live
182
+ * data — is the one that requires an explicit variable. That is also why the
183
+ * resolved name is PRINTED on every run, loudly, before any command touches
184
+ * anything. `appkit-seed delete` against the wrong database is unrecoverable.
185
+ */
186
+ const SHOP_DATABASE_ID = process.env.FIREBASE_SHOP_DATABASE_ID || "";
187
+ const db = SHOP_DATABASE_ID ? admin.firestore(admin.app(), SHOP_DATABASE_ID) : admin.firestore();
172
188
  const auth = admin.auth();
173
189
  console.log(`✓ Connected to project: ${process.env.FIREBASE_ADMIN_PROJECT_ID || "(service-account)"}`);
190
+ console.log(`✓ Database: ${SHOP_DATABASE_ID || "(default) ← LIVE"}`);
174
191
 
175
192
  // ---------------------------------------------------------------------------
176
193
  // Pull seed data + helpers from @mohasinac/appkit
@@ -941,7 +958,20 @@ async function countExisting(colName) {
941
958
  const snap = await db.collection(COLLECTION_MAP[colName]).doc("global").get();
942
959
  return snap.exists ? 1 : 0;
943
960
  }
944
- if (colName === "users") {
961
+ /*
962
+ * 🛑 UID-KEYED COLLECTIONS. The document id is `uid`, not `id`.
963
+ *
964
+ * `sellerProfiles` was missing from this branch and fell through to the
965
+ * generic `d.id` lookup, which matches nothing because the seed rows carry
966
+ * no `id` — so `status` reported "2 seed, 0 in db" immediately after a load
967
+ * that had just written both rows successfully.
968
+ *
969
+ * That is the worst kind of reporting bug: it does not fail, it under-counts,
970
+ * and it makes every seed verification afterwards untrustworthy. Anyone
971
+ * reading it would have re-run the load, seen the same 0, and gone looking
972
+ * for a write problem that does not exist.
973
+ */
974
+ if (colName === "users" || colName === "sellerProfiles") {
945
975
  const refs = seed.filter((d) => d.uid).map((d) => db.collection(COLLECTION_MAP[colName]).doc(d.uid));
946
976
  if (refs.length === 0) return 0;
947
977
  const snaps = await db.getAll(...refs);
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import type { DetailViewShellProps } from "../../../ui/components/DetailViewShell";
3
- /**
4
- * PreOrderDetailView — shell for pre-order product detail pages.
5
- * Uses grid-2 layout (gallery | info+buyBar).
6
- */
7
- export interface PreOrderDetailViewProps extends Omit<DetailViewShellProps, "mainSlots" | "belowFold" | "layout" | "afterMain"> {
8
- renderGallery?: (isLoading: boolean) => React.ReactNode;
9
- renderInfo?: (isLoading: boolean) => React.ReactNode;
10
- renderBuyBar?: () => React.ReactNode;
11
- /** Rendered between the main grid and the below-fold tabs (e.g. sub-listing carousel). */
12
- renderSublistingSection?: () => React.ReactNode;
13
- /** Rendered below the sub-listing section and above the tabs (e.g. group carousel). */
14
- renderGroupSection?: () => React.ReactNode;
15
- renderTabs?: () => React.ReactNode;
16
- renderRelated?: () => React.ReactNode;
17
- }
18
- export declare function PreOrderDetailView({ renderGallery, renderInfo, renderBuyBar, renderSublistingSection, renderGroupSection, renderTabs, renderRelated, isLoading, ...rest }: PreOrderDetailViewProps): React.JSX.Element;
@@ -1,12 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- import { DetailViewShell } from "../../../ui/components/DetailViewShell.js";
4
- export function PreOrderDetailView({ renderGallery, renderInfo, renderBuyBar, renderSublistingSection, renderGroupSection, renderTabs, renderRelated, isLoading = false, ...rest }) {
5
- const sublistingNode = renderSublistingSection?.();
6
- const groupNode = renderGroupSection?.();
7
- const afterMainNode = sublistingNode || groupNode ? (_jsxs(React.Fragment, { children: [sublistingNode, groupNode] })) : undefined;
8
- return (_jsx(DetailViewShell, { portal: "public", ...rest, layout: "grid-2", isLoading: isLoading, mainSlots: [
9
- renderGallery?.(isLoading),
10
- _jsxs(React.Fragment, { children: [renderInfo?.(isLoading), renderBuyBar?.()] }, "info"),
11
- ], afterMain: afterMainNode, belowFold: [renderTabs?.(), renderRelated?.()] }));
12
- }