@mohasinac/appkit 4.57.0 → 4.58.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 (134) hide show
  1. package/dist/.build-stamp.json +4 -4
  2. package/dist/_internal/server/features/beys/data.d.ts +44 -0
  3. package/dist/_internal/server/features/beys/data.js +107 -0
  4. package/dist/_internal/server/features/beys/og.d.ts +42 -0
  5. package/dist/_internal/server/features/beys/og.js +89 -0
  6. package/dist/_internal/server/features/parts/data.js +3 -2
  7. package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
  8. package/dist/_internal/shared/actions/action-registry.js +86 -0
  9. package/dist/client.d.ts +2 -0
  10. package/dist/client.js +1 -0
  11. package/dist/constants/api-endpoints.d.ts +12 -0
  12. package/dist/constants/api-endpoints.js +10 -0
  13. package/dist/constants/field-names.d.ts +46 -0
  14. package/dist/constants/field-names.js +46 -0
  15. package/dist/features/admin/components/AdminBeysView.d.ts +27 -0
  16. package/dist/features/admin/components/AdminBeysView.js +178 -0
  17. package/dist/features/admin/components/AdminPartsView.d.ts +27 -0
  18. package/dist/features/admin/components/AdminPartsView.js +160 -0
  19. package/dist/features/admin/components/OwnerQuickActions.d.ts +19 -2
  20. package/dist/features/admin/components/OwnerQuickActions.js +31 -3
  21. package/dist/features/admin/components/RecordOwnerQuickActions.d.ts +31 -0
  22. package/dist/features/admin/components/RecordOwnerQuickActions.js +128 -0
  23. package/dist/features/admin/components/ReferenceRecordEditor.d.ts +45 -0
  24. package/dist/features/admin/components/ReferenceRecordEditor.js +153 -0
  25. package/dist/features/admin/schemas/firestore.d.ts +1 -1
  26. package/dist/features/auctions/components/MarketplaceAuctionCard.js +15 -2
  27. package/dist/features/auth/permissions/constants.d.ts +1 -1
  28. package/dist/features/auth/permissions/constants.js +12 -1
  29. package/dist/features/beys/components/BeyDetailPageView.d.ts +50 -0
  30. package/dist/features/beys/components/BeyDetailPageView.js +98 -0
  31. package/dist/features/beys/schemas/firestore.d.ts +417 -0
  32. package/dist/features/beys/schemas/firestore.js +65 -0
  33. package/dist/features/blog/components/BlogFeaturedCard.js +15 -2
  34. package/dist/features/blog/components/BlogPostView.js +2 -2
  35. package/dist/features/categories/components/BrandDetailPageView.js +4 -2
  36. package/dist/features/categories/components/BundleDetailView.js +2 -2
  37. package/dist/features/categories/components/CategoryDetailPageView.js +36 -3
  38. package/dist/features/categories/components/CategoryGrid.js +24 -2
  39. package/dist/features/categories/components/FranchiseDetailPageView.js +2 -3
  40. package/dist/features/events/components/EventCard.js +15 -2
  41. package/dist/features/grouped/components/GroupedListingDetailView.js +2 -3
  42. package/dist/features/homepage/components/CustomCardsSection.js +67 -50
  43. package/dist/features/homepage/components/ShopByCategorySection.js +23 -10
  44. package/dist/features/homepage/schemas/index.d.ts +10 -10
  45. package/dist/features/parts/components/PartDetailPageView.js +5 -3
  46. package/dist/features/parts/components/PartsSearchBox.js +79 -4
  47. package/dist/features/parts/schemas/admin-edit.d.ts +81 -0
  48. package/dist/features/parts/schemas/admin-edit.js +89 -0
  49. package/dist/features/parts/schemas/firestore.d.ts +2 -1
  50. package/dist/features/pre-orders/components/MarketplacePreorderCard.js +15 -2
  51. package/dist/features/products/components/MarketplaceBundleCard.js +15 -2
  52. package/dist/features/products/components/MarketplacePrizeDrawCard.js +15 -2
  53. package/dist/features/products/components/ProductGrid.js +18 -2
  54. package/dist/features/products/schemas/firestore.d.ts +18 -0
  55. package/dist/features/seller/components/CategoryInlineSelect.d.ts +10 -1
  56. package/dist/features/seller/components/CategoryInlineSelect.js +53 -5
  57. package/dist/features/seller/components/SellerProductShell.d.ts +39 -0
  58. package/dist/features/seller/components/SellerProductShell.js +31 -3
  59. package/dist/index.d.ts +8 -0
  60. package/dist/index.js +13 -0
  61. package/dist/next/routing/route-map.d.ts +13 -1
  62. package/dist/next/routing/route-map.js +37 -0
  63. package/dist/schemas/registry.d.ts +6 -6
  64. package/dist/seed/_helpers/category-parts-glossary-map.js +38 -38
  65. package/dist/seed/_helpers/category-parts.js +39 -39
  66. package/dist/seed/bey-products-seed-data.d.ts +18 -0
  67. package/dist/seed/bey-products-seed-data.js +18011 -0
  68. package/dist/seed/beys/chunk0.d.ts +17 -0
  69. package/dist/seed/beys/chunk0.js +36733 -0
  70. package/dist/seed/beys/chunk1.d.ts +17 -0
  71. package/dist/seed/beys/chunk1.js +35728 -0
  72. package/dist/seed/beys/chunk2.d.ts +17 -0
  73. package/dist/seed/beys/chunk2.js +35857 -0
  74. package/dist/seed/beys/chunk3.d.ts +17 -0
  75. package/dist/seed/beys/chunk3.js +34476 -0
  76. package/dist/seed/beys-seed-data.d.ts +18 -0
  77. package/dist/seed/beys-seed-data.js +11 -0
  78. package/dist/seed/homepage-sections-seed-data.js +16 -0
  79. package/dist/seed/index.d.ts +2 -0
  80. package/dist/seed/index.js +3 -0
  81. package/dist/seed/media-assets-seed-data.js +4 -4
  82. package/dist/seed/products-catalogue/chunk0.d.ts +12 -0
  83. package/dist/seed/products-catalogue/chunk0.js +7262 -0
  84. package/dist/seed/products-catalogue/chunk1.d.ts +12 -0
  85. package/dist/seed/products-catalogue/chunk1.js +7290 -0
  86. package/dist/seed/products-catalogue/chunk10.d.ts +12 -0
  87. package/dist/seed/products-catalogue/chunk10.js +7290 -0
  88. package/dist/seed/products-catalogue/chunk11.d.ts +12 -0
  89. package/dist/seed/products-catalogue/chunk11.js +7005 -0
  90. package/dist/seed/products-catalogue/chunk12.d.ts +12 -0
  91. package/dist/seed/products-catalogue/chunk12.js +7002 -0
  92. package/dist/seed/products-catalogue/chunk13.d.ts +12 -0
  93. package/dist/seed/products-catalogue/chunk13.js +7002 -0
  94. package/dist/seed/products-catalogue/chunk14.d.ts +12 -0
  95. package/dist/seed/products-catalogue/chunk14.js +7002 -0
  96. package/dist/seed/products-catalogue/chunk15.d.ts +12 -0
  97. package/dist/seed/products-catalogue/chunk15.js +7002 -0
  98. package/dist/seed/products-catalogue/chunk16.d.ts +12 -0
  99. package/dist/seed/products-catalogue/chunk16.js +7002 -0
  100. package/dist/seed/products-catalogue/chunk17.d.ts +12 -0
  101. package/dist/seed/products-catalogue/chunk17.js +7002 -0
  102. package/dist/seed/products-catalogue/chunk18.d.ts +12 -0
  103. package/dist/seed/products-catalogue/chunk18.js +4398 -0
  104. package/dist/seed/products-catalogue/chunk2.d.ts +12 -0
  105. package/dist/seed/products-catalogue/chunk2.js +7268 -0
  106. package/dist/seed/products-catalogue/chunk3.d.ts +12 -0
  107. package/dist/seed/products-catalogue/chunk3.js +7264 -0
  108. package/dist/seed/products-catalogue/chunk4.d.ts +12 -0
  109. package/dist/seed/products-catalogue/chunk4.js +7268 -0
  110. package/dist/seed/products-catalogue/chunk5.d.ts +12 -0
  111. package/dist/seed/products-catalogue/chunk5.js +7258 -0
  112. package/dist/seed/products-catalogue/chunk6.d.ts +12 -0
  113. package/dist/seed/products-catalogue/chunk6.js +7268 -0
  114. package/dist/seed/products-catalogue/chunk7.d.ts +12 -0
  115. package/dist/seed/products-catalogue/chunk7.js +7311 -0
  116. package/dist/seed/products-catalogue/chunk8.d.ts +12 -0
  117. package/dist/seed/products-catalogue/chunk8.js +7304 -0
  118. package/dist/seed/products-catalogue/chunk9.d.ts +12 -0
  119. package/dist/seed/products-catalogue/chunk9.js +7309 -0
  120. package/dist/seed/products-catalogue-seed-data.d.ts +2 -22
  121. package/dist/seed/products-catalogue-seed-data.js +58 -86382
  122. package/dist/seed/seed-purpose.js +9 -0
  123. package/dist/server.d.ts +2 -0
  124. package/dist/server.js +8 -0
  125. package/dist/styles.css +468 -1
  126. package/dist/tailwind-utilities.css +1 -1
  127. package/dist/ui/components/PosterCard.d.ts +99 -0
  128. package/dist/ui/components/PosterCard.js +109 -0
  129. package/dist/ui/components/PosterCard.style.css +466 -0
  130. package/dist/ui/components/index.style.css +1 -0
  131. package/dist/ui/index.d.ts +2 -0
  132. package/dist/ui/index.js +2 -0
  133. package/package.json +1 -1
  134. package/scripts/seed-cli.mjs +108 -1
package/dist/ui/index.js CHANGED
@@ -86,6 +86,8 @@ export { Breadcrumb } from "./components/Breadcrumb.js";
86
86
  export { ImageMosaic, MOSAIC_MIN } from "./components/ImageMosaic.js";
87
87
  /* D3 — two real branches, side by side with real photos and real counts. */
88
88
  export { SplitTile } from "./components/SplitTile.js";
89
+ /* Image-led tile — artwork fills the card, a scrim carries the type. */
90
+ export { PosterCard, PosterChip, PosterGrid, PlainCard, POSTER_CLASS, PLAIN_CLASS, } from "./components/PosterCard.js";
89
91
  export { ImageLightbox } from "./components/ImageLightbox.js";
90
92
  export { TagInput } from "./components/TagInput.js";
91
93
  export { StepperNav } from "./components/StepperNav.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.57.0",
3
+ "version": "4.58.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -209,6 +209,8 @@ const {
209
209
  scammersSeedData, productFeaturesSeedData, taxCodesSeedData,
210
210
  authenticityKnowledgeSeedData,
211
211
  partGlossarySeedData, modelCompositionSeedData,
212
+ beysSeedData, beyProductsSeedData,
213
+ BEYS_COLLECTION, BEY_PRODUCTS_COLLECTION,
212
214
  testerChecklistSeedData, testerResponsesSeedData,
213
215
  supportTicketsSeedData, catalogueSeedData,
214
216
  shipmentsSeedData, shipmentLotsSeedData, shipmentItemsSeedData,
@@ -322,6 +324,14 @@ const COLLECTION_MAP = {
322
324
  taxCodes: TAX_CODES_COLLECTION,
323
325
  // E4/D12 — extracted from the local corpus, generated into the seed.
324
326
  partGlossary: PART_GLOSSARY_COLLECTION,
327
+ /*
328
+ * The BEY reference database. Mirrors `partGlossary`: extracted from a
329
+ * corpus by committed scripts, shares its id with the paired category leaf,
330
+ * and keeps measured data OFF `categories` so a reseed cannot drop every
331
+ * bey page's ISR entry.
332
+ */
333
+ beys: BEYS_COLLECTION,
334
+ beyProducts: BEY_PRODUCTS_COLLECTION,
325
335
  modelComposition: MODEL_COMPOSITION_COLLECTION,
326
336
  testerChecklistItems: TESTER_CHECKLIST_ITEM_COLLECTION,
327
337
  /*
@@ -686,6 +696,10 @@ const SEED_DATA_MAP = {
686
696
  authenticityKnowledge: authenticityKnowledgeSeedData,
687
697
  taxCodes: taxCodesSeedData,
688
698
  partGlossary: partGlossarySeedData,
699
+ // 🛑 Both halves are mandatory: load() short-circuits on an empty array, so a
700
+ // COLLECTION_MAP entry alone logs "no seed data, skipping" and exits 0.
701
+ beys: beysSeedData,
702
+ beyProducts: beyProductsSeedData,
689
703
  modelComposition: modelCompositionSeedData,
690
704
  testerChecklistItems: testerChecklistSeedData,
691
705
  testerChecklistResponses: testerResponsesSeedData,
@@ -1022,7 +1036,88 @@ async function loadOneDocPerUser(seed, coll, stats) {
1022
1036
  }
1023
1037
  }
1024
1038
 
1039
+ /**
1040
+ * Collections whose rows a human may hand-correct, with the correction
1041
+ * protected from the next reseed.
1042
+ *
1043
+ * 🛑 AN EXPLICIT LIST, not "every collection". Protection costs one query per
1044
+ * load, and more importantly it is only meaningful for GENERATED data: a row
1045
+ * an admin authored from scratch (a coupon, an event) is not competing with a
1046
+ * generator for ownership of its fields, so there is nothing to protect it
1047
+ * from. Adding a collection here is a statement that a generator owns the row
1048
+ * and a human may override named fields of it.
1049
+ */
1050
+ /**
1051
+ * Drop the keys a human owns from one payload.
1052
+ *
1053
+ * 🛑 A LOCAL copy of `stripAdminOwnedFields` from
1054
+ * `appkit/src/features/parts/schemas/admin-edit.ts`, and the duplication is
1055
+ * deliberate: this CLI must run without a built appkit. Importing it from
1056
+ * `dist` would reintroduce exactly the build dependency the catalogue
1057
+ * generator just shed, and would make a reseed impossible under a memory cap.
1058
+ * The function is five lines; the dependency would not be.
1059
+ */
1060
+ function stripAdminOwned(payload, ownedFields) {
1061
+ if (!ownedFields?.length) return payload;
1062
+ const out = {};
1063
+ for (const [k, v] of Object.entries(payload)) {
1064
+ if (ownedFields.includes(k)) continue;
1065
+ out[k] = v;
1066
+ }
1067
+ return out;
1068
+ }
1069
+
1070
+ const ADMIN_EDIT_PROTECTED = new Set(["partGlossary", "beys"]);
1071
+
1072
+ /**
1073
+ * The fields a human owns, per document id, for one collection.
1074
+ *
1075
+ * 🛑 ONE INDEXED EQUALITY, not a read per document. The alternative is
1076
+ * fetching all 2,488 parts and 1,988 beys to discover the handful that are
1077
+ * protected — 4,476 reads against a 50,000/day free tier, every load, to find
1078
+ * what is usually a dozen rows.
1079
+ *
1080
+ * 🛑 It must be an EQUALITY on a boolean, not an `orderBy` or `!=` on
1081
+ * `adminEditedFields`. Both of those silently exclude every document that
1082
+ * LACKS the field, which is nearly all of them — the trap that made a store's
1083
+ * whole review set return zero (Root Cause #100) and the one `isTestData`
1084
+ * warning in the Known TS Patterns table.
1085
+ *
1086
+ * Fails OPEN to an empty map: if this query errors the load proceeds
1087
+ * unprotected, which loses a hand-edit. The alternative — aborting the load —
1088
+ * loses the entire reseed. A warning names the collection either way.
1089
+ */
1090
+ async function fetchAdminOwnedFields(colName, firestoreCollection) {
1091
+ if (!ADMIN_EDIT_PROTECTED.has(colName)) return new Map();
1092
+ try {
1093
+ const snap = await db
1094
+ .collection(firestoreCollection)
1095
+ .where("adminEdited", "==", true)
1096
+ .select("adminEditedFields")
1097
+ .get();
1098
+ const map = new Map();
1099
+ for (const d of snap.docs) {
1100
+ const fields = d.get("adminEditedFields");
1101
+ if (Array.isArray(fields) && fields.length > 0) map.set(d.id, fields);
1102
+ }
1103
+ if (map.size > 0) {
1104
+ console.log(
1105
+ ` ${map.size} row(s) carry admin-owned fields — those keys will not be overwritten`,
1106
+ );
1107
+ }
1108
+ return map;
1109
+ } catch (err) {
1110
+ console.warn(
1111
+ ` ⚠ could not read admin-owned fields for ${colName} (${err?.message ?? err}).
1112
+ ` +
1113
+ ` Proceeding WITHOUT protection — a hand-correction in this collection may be lost.`,
1114
+ );
1115
+ return new Map();
1116
+ }
1117
+ }
1118
+
1025
1119
  async function loadGeneric(colName, seed, firestoreCollection, stats) {
1120
+ const adminOwned = await fetchAdminOwnedFields(colName, firestoreCollection);
1026
1121
  if (REPLACE_ON_LOAD.has(colName)) {
1027
1122
  const removed = await purgeCollection(firestoreCollection);
1028
1123
  if (VERBOSE) console.log(` purged ${removed} pre-existing docs`);
@@ -1064,7 +1159,19 @@ async function loadGeneric(colName, seed, firestoreCollection, stats) {
1064
1159
  * `store-letitrip-official` loaded as `test` — the platform's own store,
1065
1160
  * which is one of exactly two rows the keep-list exists to protect.
1066
1161
  */
1067
- data: encryptSeedPii(colName, stripUndefined(stampSeedPurpose(colName, data, docId))),
1162
+ /*
1163
+ * 🛑 Admin-owned keys dropped LAST, after every other transform.
1164
+ *
1165
+ * Stripping earlier would let `stampSeedPurpose` or `encryptSeedPii`
1166
+ * re-add a key a human owns — both of them write fields — and the whole
1167
+ * point is that what reaches Firestore carries none of them. A
1168
+ * merge-write leaves an absent key exactly as it was, which is how the
1169
+ * correction survives.
1170
+ */
1171
+ data: stripAdminOwned(
1172
+ encryptSeedPii(colName, stripUndefined(stampSeedPurpose(colName, data, docId))),
1173
+ adminOwned.get(docId),
1174
+ ),
1068
1175
  });
1069
1176
  }
1070
1177
  /*