@mohasinac/appkit 4.60.1 → 4.61.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 (119) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/_internal/server/features/auctions/actions.d.ts +1 -1
  3. package/dist/_internal/server/features/auctions/actions.js +12 -1
  4. package/dist/_internal/server/features/blog/actions.d.ts +1 -1
  5. package/dist/_internal/server/features/blog/actions.js +12 -1
  6. package/dist/_internal/server/features/brands/actions.d.ts +1 -1
  7. package/dist/_internal/server/features/brands/actions.js +12 -1
  8. package/dist/_internal/server/features/cart/actions.d.ts +1 -1
  9. package/dist/_internal/server/features/cart/actions.js +12 -1
  10. package/dist/_internal/server/features/checkout/actions.js +0 -1
  11. package/dist/_internal/server/features/events/actions.d.ts +1 -1
  12. package/dist/_internal/server/features/events/actions.js +12 -1
  13. package/dist/_internal/server/features/gateway-events/redact.js +14 -2
  14. package/dist/_internal/server/features/history/actions.d.ts +1 -1
  15. package/dist/_internal/server/features/history/actions.js +12 -1
  16. package/dist/_internal/server/features/lottery/actions.d.ts +1 -1
  17. package/dist/_internal/server/features/lottery/actions.js +12 -1
  18. package/dist/_internal/server/features/orders/actions.d.ts +1 -1
  19. package/dist/_internal/server/features/orders/actions.js +12 -1
  20. package/dist/_internal/server/features/orders/cancellation-refund.js +0 -1
  21. package/dist/_internal/server/features/orders/service.js +31 -1
  22. package/dist/_internal/server/features/payouts/actions.d.ts +1 -1
  23. package/dist/_internal/server/features/payouts/actions.js +12 -1
  24. package/dist/_internal/server/features/points/award.js +9 -1
  25. package/dist/_internal/server/features/pre-orders/actions.d.ts +1 -1
  26. package/dist/_internal/server/features/pre-orders/actions.js +12 -1
  27. package/dist/_internal/server/features/prize-draws/actions.d.ts +1 -1
  28. package/dist/_internal/server/features/prize-draws/actions.js +12 -1
  29. package/dist/_internal/server/features/products/actions.d.ts +1 -1
  30. package/dist/_internal/server/features/products/actions.js +12 -1
  31. package/dist/_internal/server/features/promotions/actions.d.ts +1 -1
  32. package/dist/_internal/server/features/promotions/actions.js +12 -1
  33. package/dist/_internal/server/features/protection-claims/actions.d.ts +2 -2
  34. package/dist/_internal/server/features/protection-claims/actions.js +21 -12
  35. package/dist/_internal/server/features/raffle/actions.d.ts +1 -1
  36. package/dist/_internal/server/features/raffle/actions.js +12 -1
  37. package/dist/_internal/server/features/refunds/actions.d.ts +1 -3
  38. package/dist/_internal/server/features/refunds/actions.js +14 -2
  39. package/dist/_internal/server/features/reviews/actions.d.ts +1 -1
  40. package/dist/_internal/server/features/reviews/actions.js +12 -1
  41. package/dist/_internal/server/features/wishlist/actions.d.ts +1 -1
  42. package/dist/_internal/server/features/wishlist/actions.js +12 -1
  43. package/dist/_internal/server/jobs/core/obligationSweep.js +0 -1
  44. package/dist/_internal/server/jobs/core/paymentReconcile.js +84 -57
  45. package/dist/_internal/server/jobs/core/testDataCleanup.d.ts +1 -1
  46. package/dist/_internal/server/jobs/core/testDataCleanup.js +22 -1
  47. package/dist/_internal/server/jobs/handlers/onShipmentAllocationSync.js +16 -4
  48. package/dist/_internal/shared/features/promotions/schema.d.ts +66 -0
  49. package/dist/_internal/shared/features/promotions/schema.js +7 -0
  50. package/dist/_internal/shared/obligations/deadlines.js +11 -1
  51. package/dist/_internal/shared/tester/window.d.ts +25 -0
  52. package/dist/_internal/shared/tester/window.js +66 -0
  53. package/dist/core/unit-of-work.js +15 -1
  54. package/dist/errors/firestore-codes.d.ts +37 -0
  55. package/dist/errors/firestore-codes.js +52 -0
  56. package/dist/errors/index.d.ts +0 -1
  57. package/dist/errors/index.js +12 -2
  58. package/dist/features/admin/components/AdminCouponEditorView.js +8 -0
  59. package/dist/features/admin/components/AdminGatewayEventsView.js +2 -2
  60. package/dist/features/admin/components/DataListingView.js +2 -0
  61. package/dist/features/admin/components/analytics/AdminStatCard.js +4 -1
  62. package/dist/features/admin/repository/site-settings.repository.d.ts +2 -1
  63. package/dist/features/admin/repository/site-settings.repository.js +7 -0
  64. package/dist/features/auctions/components/MarketplaceAuctionCard.js +1 -1
  65. package/dist/features/catalogue/actions/approve-catalogue-listing.d.ts +1 -1
  66. package/dist/features/catalogue/actions/approve-catalogue-listing.js +12 -1
  67. package/dist/features/catalogue/actions/list-from-catalogue.d.ts +1 -1
  68. package/dist/features/catalogue/actions/list-from-catalogue.js +12 -1
  69. package/dist/features/catalogue/actions/submit-for-approval.d.ts +1 -1
  70. package/dist/features/catalogue/actions/submit-for-approval.js +12 -1
  71. package/dist/features/categories/repository/price-observation.repository.d.ts +19 -0
  72. package/dist/features/categories/repository/price-observation.repository.js +21 -2
  73. package/dist/features/events/actions/event-actions.js +4 -1
  74. package/dist/features/events/components/AdminEventEditorView.js +72 -45
  75. package/dist/features/events/components/EventsListPageView.js +2 -1
  76. package/dist/features/events/schemas/firestore.d.ts +17 -0
  77. package/dist/features/events/schemas/firestore.js +1 -0
  78. package/dist/features/events/utils/sort-pinned.d.ts +33 -0
  79. package/dist/features/events/utils/sort-pinned.js +46 -0
  80. package/dist/features/gateway-events/repository/gateway-events.repository.js +3 -40
  81. package/dist/features/gateway-events/schemas/index.d.ts +2 -2
  82. package/dist/features/inventory/components/AdminStorageBoxesView.js +55 -39
  83. package/dist/features/inventory/components/ReceiveStationView.js +61 -17
  84. package/dist/features/inventory/repository/storage-boxes.repository.d.ts +3 -1
  85. package/dist/features/inventory/repository/storage-boxes.repository.js +36 -3
  86. package/dist/features/obligations/repository/obligations.repository.js +10 -1
  87. package/dist/features/orders/schemas/firestore.d.ts +19 -0
  88. package/dist/features/orders/schemas/firestore.js +19 -0
  89. package/dist/features/payment-cases/repository/payment-cases.repository.d.ts +1 -0
  90. package/dist/features/payment-cases/repository/payment-cases.repository.js +3 -14
  91. package/dist/features/pre-orders/components/MarketplacePreorderCard.js +1 -1
  92. package/dist/features/products/components/MarketplaceBundleCard.js +1 -1
  93. package/dist/features/products/components/MarketplacePrizeDrawCard.js +1 -1
  94. package/dist/features/products/components/ProductForm.js +2 -2
  95. package/dist/features/products/components/ProductGrid.js +1 -1
  96. package/dist/features/promotions/repository/claimed-coupons.repository.js +31 -1
  97. package/dist/features/promotions/schemas/firestore.d.ts +22 -0
  98. package/dist/features/promotions/schemas/firestore.js +22 -0
  99. package/dist/features/promotions/schemas/index.d.ts +479 -6
  100. package/dist/features/promotions/schemas/index.js +153 -0
  101. package/dist/features/protection-claims/repository/protection-claims.repository.js +22 -15
  102. package/dist/features/seller/schemas/coupon-form.d.ts +5 -0
  103. package/dist/features/seller/schemas/coupon-form.js +18 -0
  104. package/dist/features/shell/SectionForm.js +31 -9
  105. package/dist/features/sticker-trace/server.d.ts +2 -0
  106. package/dist/http/api-handler.js +4 -1
  107. package/dist/index.d.ts +3 -3
  108. package/dist/index.js +3 -3
  109. package/dist/next/routing/route-map.d.ts +0 -2
  110. package/dist/next/routing/route-map.js +10 -1
  111. package/dist/schemas/registry.d.ts +11 -6
  112. package/dist/server.d.ts +0 -1
  113. package/dist/server.js +5 -3
  114. package/dist/styles.css +51 -0
  115. package/dist/ui/components/PaginatedSelect.js +0 -0
  116. package/package.json +1 -1
  117. package/scripts/seed-cli.mjs +1822 -1812
  118. package/dist/features/tester/utils/phases.d.ts +0 -48
  119. package/dist/features/tester/utils/phases.js +0 -139
@@ -1,48 +0,0 @@
1
- /**
2
- * Computes default `phase` numbers for the tester checklist catalog.
3
- *
4
- * `phase` is a real, stored, admin-editable field on `TesterChecklistItemDocument`
5
- * (see schemas/firestore.ts) — not something recomputed on every read. This
6
- * module only supplies the INITIAL assignment: given the catalog in its
7
- * existing groupKey/pageKey/order sequence, bucket whole pages together into
8
- * phases of roughly `targetPhaseSize` items each (never splitting a single
9
- * page's items across two phases), so a tester works through ~10-50 cases
10
- * per session instead of the full catalog at once.
11
- *
12
- * Used once at seed-authoring time (tester-checklist-seed-data.ts) and by
13
- * the one-off Firestore backfill for already-seeded items that predate the
14
- * `phase` field. After that, every read path (TesterHubView, admin results
15
- * views, the markdown report) just groups by the stored `item.phase` value —
16
- * no chunking logic at read time.
17
- */
18
- export interface TesterPhaseAssignable {
19
- groupKey: string;
20
- pageKey: string;
21
- }
22
- /** Target item count per phase — real phase sizes vary a little around this
23
- * since a page's items are never split across two phases. */
24
- export declare const DEFAULT_TESTER_PHASE_SIZE = 25;
25
- /**
26
- * Groups that take the earliest phases, ahead of the round-robin.
27
- *
28
- * 🛑 THE ROUND-ROBIN BELOW IS RIGHT FOR EVERYTHING ELSE AND WRONG FOR THIS.
29
- * Interleaving exists so an early stop costs a proportional slice of every
30
- * group rather than the whole tail — a fair outcome when no group matters more
31
- * than another. But `happy-path` is not one group among fourteen: it is the
32
- * question "can anyone buy anything on this site", and a run that covered 7% of
33
- * it alongside 7% of SEO metadata has answered nothing.
34
- *
35
- * So these groups are packed FIRST, in their own catalogue order, and the
36
- * round-robin then runs over the remainder exactly as before.
37
- *
38
- * Adding a group here is a real cost: every group after it loses its early
39
- * proportional slice. Two entries is the intended size of this list.
40
- */
41
- export declare const PRIORITY_GROUPS: readonly string[];
42
- /**
43
- * Returns a same-length array of 1-based phase numbers, one per input item,
44
- * computed by greedily packing whole pages (consecutive runs of the same
45
- * groupKey+pageKey) into phases of ~`targetPhaseSize` items. `items` MUST
46
- * already be in catalog order (e.g. sorted by the `order` field).
47
- */
48
- export declare function assignDefaultPhases<T extends TesterPhaseAssignable>(itemsInCatalogOrder: T[], targetPhaseSize?: number): number[];
@@ -1,139 +0,0 @@
1
- /**
2
- * Computes default `phase` numbers for the tester checklist catalog.
3
- *
4
- * `phase` is a real, stored, admin-editable field on `TesterChecklistItemDocument`
5
- * (see schemas/firestore.ts) — not something recomputed on every read. This
6
- * module only supplies the INITIAL assignment: given the catalog in its
7
- * existing groupKey/pageKey/order sequence, bucket whole pages together into
8
- * phases of roughly `targetPhaseSize` items each (never splitting a single
9
- * page's items across two phases), so a tester works through ~10-50 cases
10
- * per session instead of the full catalog at once.
11
- *
12
- * Used once at seed-authoring time (tester-checklist-seed-data.ts) and by
13
- * the one-off Firestore backfill for already-seeded items that predate the
14
- * `phase` field. After that, every read path (TesterHubView, admin results
15
- * views, the markdown report) just groups by the stored `item.phase` value —
16
- * no chunking logic at read time.
17
- */
18
- /** Target item count per phase — real phase sizes vary a little around this
19
- * since a page's items are never split across two phases. */
20
- export const DEFAULT_TESTER_PHASE_SIZE = 25;
21
- /**
22
- * Groups that take the earliest phases, ahead of the round-robin.
23
- *
24
- * 🛑 THE ROUND-ROBIN BELOW IS RIGHT FOR EVERYTHING ELSE AND WRONG FOR THIS.
25
- * Interleaving exists so an early stop costs a proportional slice of every
26
- * group rather than the whole tail — a fair outcome when no group matters more
27
- * than another. But `happy-path` is not one group among fourteen: it is the
28
- * question "can anyone buy anything on this site", and a run that covered 7% of
29
- * it alongside 7% of SEO metadata has answered nothing.
30
- *
31
- * So these groups are packed FIRST, in their own catalogue order, and the
32
- * round-robin then runs over the remainder exactly as before.
33
- *
34
- * Adding a group here is a real cost: every group after it loses its early
35
- * proportional slice. Two entries is the intended size of this list.
36
- */
37
- export const PRIORITY_GROUPS = ["happy-path"];
38
- /**
39
- * Returns a same-length array of 1-based phase numbers, one per input item,
40
- * computed by greedily packing whole pages (consecutive runs of the same
41
- * groupKey+pageKey) into phases of ~`targetPhaseSize` items. `items` MUST
42
- * already be in catalog order (e.g. sorted by the `order` field).
43
- */
44
- export function assignDefaultPhases(itemsInCatalogOrder, targetPhaseSize = DEFAULT_TESTER_PHASE_SIZE) {
45
- /*
46
- * 🛑 PAGES ARE INTERLEAVED ACROSS GROUPS, NOT PACKED IN CATALOGUE ORDER.
47
- *
48
- * This used to walk the catalogue straight through, so a group's phase number
49
- * was an accident of where its `...group(...)` spread sat in a 6,200-line
50
- * literal. `admin` is the 9th spread, so its 231 cases landed at phases
51
- * **25–32** — and any run that stops early is therefore GUARANTEED to lose
52
- * the largest, most privileged group in its entirety. The same held for every
53
- * infrastructure group in the tail: page-wiring (32–33), cta-layout (33),
54
- * addresses and search-and-nav (34).
55
- *
56
- * That is not hypothetical. Run run-1789300124915 stopped at phase 17 of 34
57
- * and ten of fourteen groups had ZERO coverage — 527 cases, including all 233
58
- * admin ones — while the run looked about half done.
59
- *
60
- * Round-robin over groups fixes the shape rather than the symptom: an early
61
- * stop now costs a proportional slice of every group instead of the whole
62
- * tail. Groups are visited largest-first within each round so the big ones do
63
- * not bunch up at the end as the small ones run out.
64
- *
65
- * A phase may now span several groups. That is fine for a tester session —
66
- * it is ~25 cases either way — and every read path already groups by the
67
- * STORED `item.phase`, never by position.
68
- *
69
- * 🛑 The RETURN IS STILL POSITIONAL. Items keep their catalogue order and
70
- * their `order` field; only the phase LABEL changes. Nothing downstream
71
- * reorders, and `fetch-cases` still sorts by (phase, order) to build batches.
72
- */
73
- const pageOrder = [];
74
- const pageSize = new Map();
75
- const pageGroup = new Map();
76
- for (const item of itemsInCatalogOrder) {
77
- const pageId = `${item.groupKey}␟${item.pageKey}`;
78
- if (!pageSize.has(pageId)) {
79
- pageOrder.push(pageId);
80
- pageSize.set(pageId, 0);
81
- pageGroup.set(pageId, item.groupKey);
82
- }
83
- pageSize.set(pageId, pageSize.get(pageId) + 1);
84
- }
85
- // Queues of pages per group, each still in catalogue order within its group.
86
- const byGroup = new Map();
87
- for (const pageId of pageOrder) {
88
- const g = pageGroup.get(pageId);
89
- if (!byGroup.has(g))
90
- byGroup.set(g, []);
91
- byGroup.get(g).push(pageId);
92
- }
93
- /*
94
- * Priority groups first, whole, in catalogue order — then the round-robin over
95
- * everything else. See PRIORITY_GROUPS for why this one group is exempt from
96
- * the interleaving the rest depends on.
97
- */
98
- const interleaved = [];
99
- for (const g of PRIORITY_GROUPS) {
100
- for (const pageId of byGroup.get(g) ?? [])
101
- interleaved.push(pageId);
102
- }
103
- const groupsLargestFirst = [...byGroup.entries()]
104
- .filter(([g]) => !PRIORITY_GROUPS.includes(g))
105
- .map(([g, pages]) => ({
106
- g,
107
- pages,
108
- cases: pages.reduce((n, p) => n + pageSize.get(p), 0),
109
- }))
110
- .sort((a, b) => b.cases - a.cases || a.g.localeCompare(b.g))
111
- .map((e) => e.g);
112
- const cursor = new Map(groupsLargestFirst.map((g) => [g, 0]));
113
- let remaining = pageOrder.length - interleaved.length;
114
- while (remaining > 0) {
115
- for (const g of groupsLargestFirst) {
116
- const i = cursor.get(g);
117
- const pages = byGroup.get(g);
118
- if (i >= pages.length)
119
- continue;
120
- interleaved.push(pages[i]);
121
- cursor.set(g, i + 1);
122
- remaining--;
123
- }
124
- }
125
- // Pack the interleaved page sequence into phases, never splitting a page.
126
- const phaseOfPage = new Map();
127
- let currentPhase = 1;
128
- let currentPhaseCount = 0;
129
- for (const pageId of interleaved) {
130
- const size = pageSize.get(pageId);
131
- if (currentPhaseCount > 0 && currentPhaseCount >= targetPhaseSize) {
132
- currentPhase += 1;
133
- currentPhaseCount = 0;
134
- }
135
- phaseOfPage.set(pageId, currentPhase);
136
- currentPhaseCount += size;
137
- }
138
- return itemsInCatalogOrder.map((item) => phaseOfPage.get(`${item.groupKey}␟${item.pageKey}`));
139
- }