@mohasinac/appkit 4.49.1 → 4.51.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 (44) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/_internal/server/features/franchises/data.d.ts +32 -0
  3. package/dist/_internal/server/features/franchises/data.js +33 -0
  4. package/dist/_internal/server/features/franchises/index.d.ts +2 -0
  5. package/dist/_internal/server/features/franchises/index.js +2 -0
  6. package/dist/_internal/server/features/franchises/og.d.ts +31 -0
  7. package/dist/_internal/server/features/franchises/og.js +11 -0
  8. package/dist/_internal/server/features/products/list-public.d.ts +9 -0
  9. package/dist/_internal/server/features/products/list-public.js +3 -0
  10. package/dist/constants/field-names.d.ts +3 -0
  11. package/dist/constants/field-names.js +11 -0
  12. package/dist/features/categories/components/FranchiseDetailPageView.d.ts +25 -0
  13. package/dist/features/categories/components/FranchiseDetailPageView.js +43 -0
  14. package/dist/features/categories/components/FranchisesIndexView.d.ts +14 -0
  15. package/dist/features/categories/components/FranchisesIndexView.js +33 -0
  16. package/dist/features/categories/repository/categories.repository.d.ts +15 -0
  17. package/dist/features/categories/repository/categories.repository.js +23 -0
  18. package/dist/features/categories/types/index.d.ts +1 -1
  19. package/dist/features/collections/schemas/index.d.ts +2 -2
  20. package/dist/features/pre-orders/schemas/index.d.ts +2 -2
  21. package/dist/features/products/repository/products.repository.d.ts +4 -0
  22. package/dist/features/products/repository/products.repository.js +5 -0
  23. package/dist/features/products/schemas/firestore.d.ts +13 -0
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +3 -0
  26. package/dist/next/routing/route-map.d.ts +4 -0
  27. package/dist/next/routing/route-map.js +9 -0
  28. package/dist/seed/_helpers/category-images-generated.d.ts +21 -1
  29. package/dist/seed/_helpers/category-images-generated.js +330 -1
  30. package/dist/seed/_helpers/franchise-rows.d.ts +43 -0
  31. package/dist/seed/_helpers/franchise-rows.js +181 -0
  32. package/dist/seed/_helpers/part-colours-generated.d.ts +18 -0
  33. package/dist/seed/_helpers/part-colours-generated.js +273 -0
  34. package/dist/seed/categories-seed-data.js +13 -0
  35. package/dist/seed/index.d.ts +2 -0
  36. package/dist/seed/index.js +2 -0
  37. package/dist/seed/media-assets-seed-data.d.ts +1 -1
  38. package/dist/seed/media-assets-seed-data.js +3091 -1
  39. package/dist/seed/products-catalogue-seed-data.d.ts +4 -4
  40. package/dist/seed/products-catalogue-seed-data.js +16796 -8776
  41. package/dist/server.d.ts +1 -0
  42. package/dist/server.js +1 -0
  43. package/package.json +1 -1
  44. package/scripts/seed-cli.mjs +32 -2
package/dist/server.d.ts CHANGED
@@ -509,6 +509,7 @@ export { getPreOrderForDetail, getProductFeaturesForPreOrder } from "./_internal
509
509
  export { getStoreForDetail, listStoreProductsInitial, listStoreAuctionsInitial, listStorePreOrdersInitial, listSitemapStores } from "./_internal/server/features/stores/index";
510
510
  export { toStoreDetail, toStoreListItem, PUBLIC_STORE_FIELDS, PRIVATE_STORE_FIELDS, type ToStoreDetailOptions, type ToStoreListItemOptions, type StoreProjectionSource, } from "./_internal/server/features/stores/adapters";
511
511
  export { getBrandForDetail } from "./_internal/server/features/brands/index";
512
+ export { getFranchiseForDetail, listActiveFranchises, renderFranchiseOg, } from "./_internal/server/features/franchises/index";
512
513
  export { getBlogPostForDetail } from "./_internal/server/features/blog/index";
513
514
  export { getEventForDetail } from "./_internal/server/features/events/index";
514
515
  export { getSublistingCategoryForDetail } from "./_internal/server/features/sublisting-categories/index";
package/dist/server.js CHANGED
@@ -1387,6 +1387,7 @@ export { getStoreForDetail, listStoreProductsInitial, listStoreAuctionsInitial,
1387
1387
  // may reach a client component or an HTTP response. See adapters.ts header.
1388
1388
  export { toStoreDetail, toStoreListItem, PUBLIC_STORE_FIELDS, PRIVATE_STORE_FIELDS, } from "./_internal/server/features/stores/adapters.js";
1389
1389
  export { getBrandForDetail } from "./_internal/server/features/brands/index.js";
1390
+ export { getFranchiseForDetail, listActiveFranchises, renderFranchiseOg, } from "./_internal/server/features/franchises/index.js";
1390
1391
  export { getBlogPostForDetail } from "./_internal/server/features/blog/index.js";
1391
1392
  export { getEventForDetail } from "./_internal/server/features/events/index.js";
1392
1393
  export { getSublistingCategoryForDetail } from "./_internal/server/features/sublisting-categories/index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.49.1",
3
+ "version": "4.51.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -195,6 +195,7 @@ const {
195
195
  productsPrizeDrawsSeedData, productsClassifiedsSeedData, productsDigitalCodesSeedData, productsLiveItemsSeedData,
196
196
  productsArtSeedData, productsStickersSeedData,
197
197
  productsCatalogueSeedData,
198
+ FRANCHISE_BY_CATEGORY_ROOT,
198
199
  ordersSeedData, reviewsSeedData, cartsSeedData, bidsSeedData,
199
200
  couponsSeedData, couponUsageSeedData,
200
201
  eventsSeedData, eventEntriesSeedData, payoutsSeedData, offersSeedData,
@@ -369,6 +370,35 @@ const COLLECTION_MAP = {
369
370
  * signal, so a silent 5% here would hide exactly what it is meant to surface —
370
371
  * and a wrong rate on a real invoice is worse than a failed load.
371
372
  */
373
+ /**
374
+ * Stamp `franchise` / `franchiseSlug` from the product's category ROOT.
375
+ *
376
+ * 🛑 Its OWN pass, deliberately NOT folded into `withDerivedCategoryFields`.
377
+ * That function early-returns on `gstRate && hsnCode && authenticity`, which
378
+ * every one of the 1,237 generated catalogue rows already satisfies — so a
379
+ * franchise derived in there would be silently skipped for 95% of the
380
+ * catalogue. That is the exact bug its own comment records happening when
381
+ * `authenticity` was added beside `gstRate`; adding a third field to the same
382
+ * condition is how it happens a third time.
383
+ *
384
+ * A root with no mapping yields NO franchise (living collectibles are not an
385
+ * IP) — see `FRANCHISE_BY_CATEGORY_ROOT`.
386
+ */
387
+ function withFranchise(products) {
388
+ let stamped = 0;
389
+ const out = products.map((p) => {
390
+ if (p.franchiseSlug) return p;
391
+ const chain = Array.isArray(p.categorySlugs) ? p.categorySlugs : [];
392
+ const root = chain.length > 0 ? String(chain[chain.length - 1]) : null;
393
+ const f = root ? FRANCHISE_BY_CATEGORY_ROOT[root] : null;
394
+ if (!f) return p;
395
+ stamped++;
396
+ return { ...p, franchise: f.name, franchiseSlug: f.slug };
397
+ });
398
+ console.log(` • franchise stamped on ${stamped}/${products.length} products`);
399
+ return out;
400
+ }
401
+
372
402
  function withDerivedCategoryFields(products) {
373
403
  const catById = new Map((categoriesSeedData || []).map((c) => [String(c.id), c]));
374
404
  const taxById = new Map((taxCodesSeedData || []).map((t) => [String(t.id), t]));
@@ -461,7 +491,7 @@ const SEED_DATA_MAP = {
461
491
  // standalone brands collection/seed exists anymore.
462
492
  categories: categoriesSeedData,
463
493
  stores: storesSeedData,
464
- products: withDerivedCategoryFields([
494
+ products: withFranchise(withDerivedCategoryFields([
465
495
  ...(productsStandardSeedData || []), ...(productsAuctionsSeedData || []), ...(productsPreordersSeedData || []),
466
496
  ...(productsPrizeDrawsSeedData || []), ...(productsClassifiedsSeedData || []), ...(productsDigitalCodesSeedData || []), ...(productsLiveItemsSeedData || []),
467
497
  // art + stickers were written, exported from the seed barrel, and then never
@@ -474,7 +504,7 @@ const SEED_DATA_MAP = {
474
504
  // reproducible after a full wipe; without it the collection drops from
475
505
  // 1,039 to 71 the moment someone purges it.
476
506
  ...(productsCatalogueSeedData || []),
477
- ]),
507
+ ])),
478
508
  orders: ordersSeedData,
479
509
  reviews: reviewsSeedData,
480
510
  bids: bidsSeedData,