@mohasinac/appkit 4.62.1 → 4.63.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 (261) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/_internal/client/features/layout/DashboardLayoutClient.js +8 -29
  3. package/dist/_internal/client/features/layout/filterNavItems.d.ts +28 -0
  4. package/dist/_internal/client/features/layout/filterNavItems.js +35 -0
  5. package/dist/_internal/server/features/ads/booking.d.ts +118 -0
  6. package/dist/_internal/server/features/ads/booking.js +326 -0
  7. package/dist/_internal/server/features/checkout/actions.d.ts +51 -11
  8. package/dist/_internal/server/features/checkout/actions.js +335 -80
  9. package/dist/_internal/server/features/checkout/expand-order-items.d.ts +1 -2
  10. package/dist/_internal/server/features/checkout/expand-order-items.js +32 -0
  11. package/dist/_internal/server/features/checkout/freeze-parts.d.ts +50 -0
  12. package/dist/_internal/server/features/checkout/freeze-parts.js +94 -0
  13. package/dist/_internal/server/features/checkout/value-otp-gate.d.ts +55 -0
  14. package/dist/_internal/server/features/checkout/value-otp-gate.js +60 -0
  15. package/dist/_internal/server/features/dashboard/attention.d.ts +128 -0
  16. package/dist/_internal/server/features/dashboard/attention.js +183 -0
  17. package/dist/_internal/server/features/dashboard/data.d.ts +47 -0
  18. package/dist/_internal/server/features/dashboard/data.js +82 -0
  19. package/dist/_internal/server/features/inventory/reservations.d.ts +99 -0
  20. package/dist/_internal/server/features/inventory/reservations.js +273 -0
  21. package/dist/_internal/server/features/offers/destinations.d.ts +40 -0
  22. package/dist/_internal/server/features/offers/destinations.js +65 -0
  23. package/dist/_internal/server/features/orders/adapters.js +21 -0
  24. package/dist/_internal/server/features/orders/amend-delivery.d.ts +56 -0
  25. package/dist/_internal/server/features/orders/amend-delivery.js +124 -0
  26. package/dist/_internal/server/features/orders/balance.d.ts +89 -0
  27. package/dist/_internal/server/features/orders/balance.js +256 -0
  28. package/dist/_internal/server/features/pricing/actions.d.ts +58 -0
  29. package/dist/_internal/server/features/pricing/actions.js +144 -0
  30. package/dist/_internal/server/features/shipping/book-split.d.ts +86 -0
  31. package/dist/_internal/server/features/shipping/book-split.js +130 -0
  32. package/dist/_internal/server/features/shipping/book.d.ts +61 -0
  33. package/dist/_internal/server/features/shipping/book.js +176 -0
  34. package/dist/_internal/server/features/shipping/courier-block.js +26 -1
  35. package/dist/_internal/server/features/site-settings/adapters.d.ts +1 -1
  36. package/dist/_internal/server/features/site-settings/adapters.js +14 -0
  37. package/dist/_internal/server/features/stores/adapters.d.ts +1 -1
  38. package/dist/_internal/server/features/stores/adapters.js +14 -0
  39. package/dist/_internal/server/functions/scheduled.d.ts +2 -1
  40. package/dist/_internal/server/functions/scheduled.js +57 -1
  41. package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +2 -0
  42. package/dist/_internal/server/jobs/core/jobRunners.js +45 -0
  43. package/dist/_internal/server/jobs/core/onOrderStatusChange.js +4 -1
  44. package/dist/_internal/server/jobs/core/reservationExpiry.d.ts +17 -0
  45. package/dist/_internal/server/jobs/core/reservationExpiry.js +40 -0
  46. package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +15 -0
  47. package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
  48. package/dist/_internal/server/jobs/handlers/index.js +1 -0
  49. package/dist/_internal/server/jobs/handlers/reservationExpiry.d.ts +2 -0
  50. package/dist/_internal/server/jobs/handlers/reservationExpiry.js +2 -0
  51. package/dist/_internal/shared/actions/action-registry.d.ts +1 -1
  52. package/dist/_internal/shared/actions/action-registry.js +268 -0
  53. package/dist/_internal/shared/checkout/order-math.d.ts +31 -2
  54. package/dist/_internal/shared/checkout/order-math.js +22 -36
  55. package/dist/_internal/shared/checkout/rules/index.d.ts +1 -1
  56. package/dist/_internal/shared/checkout/rules/index.js +1 -1
  57. package/dist/_internal/shared/checkout/rules/payment-gate.d.ts +18 -0
  58. package/dist/_internal/shared/checkout/rules/payment-gate.js +25 -0
  59. package/dist/_internal/shared/checkout/split.d.ts +0 -12
  60. package/dist/_internal/shared/checkout/split.js +22 -2
  61. package/dist/_internal/shared/content/disclaimers.js +7 -7
  62. package/dist/_internal/shared/content/published-values.d.ts +6 -1
  63. package/dist/_internal/shared/content/published-values.js +8 -0
  64. package/dist/_internal/shared/features/admin/integrations.d.ts +32 -2
  65. package/dist/_internal/shared/features/admin/integrations.js +19 -9
  66. package/dist/_internal/shared/features/dashboard/hub-sections.d.ts +72 -0
  67. package/dist/_internal/shared/features/dashboard/hub-sections.js +75 -0
  68. package/dist/_internal/shared/features/emi/choice.d.ts +98 -0
  69. package/dist/_internal/shared/features/emi/choice.js +69 -0
  70. package/dist/_internal/shared/features/emi/group.d.ts +84 -0
  71. package/dist/_internal/shared/features/emi/group.js +126 -0
  72. package/dist/_internal/shared/features/ledger/posting.d.ts +107 -0
  73. package/dist/_internal/shared/features/ledger/posting.js +165 -0
  74. package/dist/_internal/shared/features/ledger/reports.d.ts +76 -0
  75. package/dist/_internal/shared/features/ledger/reports.js +127 -0
  76. package/dist/_internal/shared/features/ledger/rules.d.ts +170 -0
  77. package/dist/_internal/shared/features/ledger/rules.js +221 -0
  78. package/dist/_internal/shared/features/offers/coordination.d.ts +122 -0
  79. package/dist/_internal/shared/features/offers/coordination.js +80 -0
  80. package/dist/_internal/shared/features/orders/delivery-snapshot.d.ts +114 -0
  81. package/dist/_internal/shared/features/orders/delivery-snapshot.js +116 -0
  82. package/dist/_internal/shared/features/payouts/pay-period.d.ts +91 -0
  83. package/dist/_internal/shared/features/payouts/pay-period.js +104 -0
  84. package/dist/_internal/shared/features/points/accepts.d.ts +1 -8
  85. package/dist/_internal/shared/features/points/accepts.js +12 -6
  86. package/dist/_internal/shared/features/pricing/rate-registry.d.ts +150 -0
  87. package/dist/_internal/shared/features/pricing/rate-registry.js +246 -0
  88. package/dist/_internal/shared/features/shipping/parcel.d.ts +123 -0
  89. package/dist/_internal/shared/features/shipping/parcel.js +139 -0
  90. package/dist/_internal/shared/features/site-settings/fees.d.ts +16 -8
  91. package/dist/_internal/shared/features/site-settings/fees.js +12 -8
  92. package/dist/_internal/shared/fees/explain.d.ts +81 -0
  93. package/dist/_internal/shared/fees/explain.js +101 -0
  94. package/dist/_internal/shared/history/index.d.ts +1 -1
  95. package/dist/_internal/shared/history/index.js +1 -1
  96. package/dist/_internal/shared/history/types.d.ts +7 -1
  97. package/dist/_internal/shared/history/types.js +25 -0
  98. package/dist/client.d.ts +11 -1
  99. package/dist/client.js +13 -0
  100. package/dist/constants/api-endpoints.d.ts +72 -0
  101. package/dist/constants/api-endpoints.js +41 -0
  102. package/dist/constants/field-names.d.ts +41 -0
  103. package/dist/constants/field-names.js +47 -0
  104. package/dist/features/account/components/UserOrdersView.js +28 -2
  105. package/dist/features/admin/components/AdminIntegrationsView.d.ts +55 -0
  106. package/dist/features/admin/components/AdminIntegrationsView.js +74 -0
  107. package/dist/features/admin/components/AdminOrderEditorView.d.ts +16 -1
  108. package/dist/features/admin/components/AdminOrderEditorView.js +72 -3
  109. package/dist/features/admin/components/AdminOrdersView.js +20 -1
  110. package/dist/features/admin/schemas/firestore.d.ts +32 -0
  111. package/dist/features/ads/schemas/booking-write.d.ts +120 -0
  112. package/dist/features/ads/schemas/booking-write.js +75 -0
  113. package/dist/features/ads/schemas/creative-form.d.ts +18 -0
  114. package/dist/features/ads/schemas/creative-form.js +51 -0
  115. package/dist/features/ads/schemas/firestore.d.ts +140 -0
  116. package/dist/features/ads/schemas/firestore.js +109 -0
  117. package/dist/features/auctions/repository/bid.repository.js +3 -1
  118. package/dist/features/audit-log/schemas/firestore.d.ts +110 -0
  119. package/dist/features/audit-log/schemas/firestore.js +74 -0
  120. package/dist/features/auth/actions/profile-actions.d.ts +69 -1
  121. package/dist/features/auth/actions/profile-actions.js +62 -1
  122. package/dist/features/auth/schemas/firestore.d.ts +16 -2
  123. package/dist/features/auth/schemas/firestore.js +2 -1
  124. package/dist/features/blog/actions/blog-actions.d.ts +6 -0
  125. package/dist/features/blog/actions/blog-actions.js +17 -2
  126. package/dist/features/blog/api/route.js +4 -1
  127. package/dist/features/blog/columns/index.js +5 -0
  128. package/dist/features/blog/components/BlogIndexPageView.js +2 -1
  129. package/dist/features/blog/repository/blog.repository.d.ts +4 -0
  130. package/dist/features/blog/repository/blog.repository.js +5 -0
  131. package/dist/features/blog/schemas/blog-form.d.ts +3 -0
  132. package/dist/features/blog/schemas/blog-form.js +1 -0
  133. package/dist/features/blog/schemas/firestore.d.ts +38 -1
  134. package/dist/features/blog/schemas/firestore.js +23 -0
  135. package/dist/features/blog/schemas/index.d.ts +6 -0
  136. package/dist/features/blog/schemas/index.js +2 -0
  137. package/dist/features/blog/types/index.d.ts +2 -0
  138. package/dist/features/cart/components/CartPriceBreakdown.d.ts +12 -1
  139. package/dist/features/cart/components/CartPriceBreakdown.js +24 -5
  140. package/dist/features/cart/repository/cart.repository.d.ts +14 -0
  141. package/dist/features/cart/repository/cart.repository.js +20 -0
  142. package/dist/features/cart/schemas/firestore.d.ts +24 -0
  143. package/dist/features/dashboard/components/DashboardHubView.d.ts +83 -0
  144. package/dist/features/dashboard/components/DashboardHubView.js +56 -0
  145. package/dist/features/dashboard/components/DashboardSectionsClient.d.ts +23 -0
  146. package/dist/features/dashboard/components/DashboardSectionsClient.js +66 -0
  147. package/dist/features/dispute-reasons/components/AdminDisputeReasonsView.d.ts +55 -0
  148. package/dist/features/dispute-reasons/components/AdminDisputeReasonsView.js +175 -0
  149. package/dist/features/dispute-reasons/repository/dispute-reasons.repository.d.ts +24 -0
  150. package/dist/features/dispute-reasons/repository/dispute-reasons.repository.js +28 -0
  151. package/dist/features/dispute-reasons/schemas/firestore.d.ts +3 -5
  152. package/dist/features/events/components/EventSaleBanner.js +1 -1
  153. package/dist/features/faq/components/FAQPageContent.js +2 -2
  154. package/dist/features/gateway-events/schemas/index.d.ts +2 -2
  155. package/dist/features/homepage/schemas/index.d.ts +8 -8
  156. package/dist/features/inventory/schemas/stock-reservation.d.ts +114 -0
  157. package/dist/features/inventory/schemas/stock-reservation.js +103 -0
  158. package/dist/features/layout/AppLayoutShell.d.ts +9 -1
  159. package/dist/features/layout/AppLayoutShell.js +12 -4
  160. package/dist/features/layout/BottomActions.js +2 -1
  161. package/dist/features/layout/BottomNavbar.d.ts +10 -2
  162. package/dist/features/layout/SideActionDock.js +52 -2
  163. package/dist/features/layout/TitleBarLayout.js +13 -4
  164. package/dist/features/layout/TitleBarLayout.style.css +59 -0
  165. package/dist/features/layout/useCtaReveal.d.ts +16 -1
  166. package/dist/features/layout/useCtaReveal.js +17 -26
  167. package/dist/features/ledger/repository/journal.repository.d.ts +110 -0
  168. package/dist/features/ledger/repository/journal.repository.js +312 -0
  169. package/dist/features/ledger/schemas/expenses.d.ts +87 -0
  170. package/dist/features/ledger/schemas/expenses.js +27 -0
  171. package/dist/features/ledger/schemas/firestore.d.ts +183 -0
  172. package/dist/features/ledger/schemas/firestore.js +69 -0
  173. package/dist/features/orders/components/BalancePaymentPanel.d.ts +12 -0
  174. package/dist/features/orders/components/BalancePaymentPanel.js +94 -0
  175. package/dist/features/orders/components/RaiseDisputeForm.js +19 -11
  176. package/dist/features/orders/repository/orders.repository.d.ts +28 -1
  177. package/dist/features/orders/repository/orders.repository.js +60 -6
  178. package/dist/features/orders/schemas/balance.d.ts +40 -0
  179. package/dist/features/orders/schemas/balance.js +47 -0
  180. package/dist/features/orders/schemas/firestore.d.ts +202 -0
  181. package/dist/features/orders/schemas/firestore.js +43 -0
  182. package/dist/features/orders/schemas/index.d.ts +2 -2
  183. package/dist/features/orders/types/index.d.ts +21 -0
  184. package/dist/features/payments/repository/payout.repository.js +3 -2
  185. package/dist/features/payments/schemas/firestore.d.ts +92 -1
  186. package/dist/features/payments/schemas/firestore.js +23 -0
  187. package/dist/features/pricing/components/AdminPricingView.d.ts +13 -0
  188. package/dist/features/pricing/components/AdminPricingView.js +157 -0
  189. package/dist/features/products/schemas/firestore.d.ts +26 -1
  190. package/dist/features/products/schemas/firestore.js +2 -0
  191. package/dist/features/products/schemas/index.d.ts +2 -2
  192. package/dist/features/reviews/repository/reviews.repository.d.ts +14 -0
  193. package/dist/features/reviews/repository/reviews.repository.js +16 -0
  194. package/dist/features/scams/repository/scammer.repository.js +2 -1
  195. package/dist/features/scams/schemas/firestore.d.ts +2 -1
  196. package/dist/features/scams/schemas/firestore.js +2 -1
  197. package/dist/features/seller/actions/offer-actions.js +56 -0
  198. package/dist/features/seller/actions/seller-actions.d.ts +1 -1
  199. package/dist/features/seller/actions/seller-actions.js +4 -0
  200. package/dist/features/seller/components/DispatchForm.d.ts +11 -0
  201. package/dist/features/seller/components/DispatchForm.js +190 -0
  202. package/dist/features/seller/components/SellerOrdersView.js +94 -2
  203. package/dist/features/seller/components/index.d.ts +1 -0
  204. package/dist/features/seller/components/index.js +1 -0
  205. package/dist/features/seller/repository/offer.repository.js +4 -3
  206. package/dist/features/seller/schemas/firestore.d.ts +23 -2
  207. package/dist/features/seller/schemas/firestore.js +3 -2
  208. package/dist/features/seller/schemas/index.d.ts +4 -4
  209. package/dist/features/seller/schemas/order-forms.d.ts +61 -4
  210. package/dist/features/seller/schemas/order-forms.js +41 -8
  211. package/dist/features/shipments/schemas/firestore.d.ts +25 -0
  212. package/dist/features/shipping-boxes/repository/shipping-boxes.repository.d.ts +39 -0
  213. package/dist/features/shipping-boxes/repository/shipping-boxes.repository.js +55 -0
  214. package/dist/features/shipping-boxes/schemas/firestore.d.ts +2 -4
  215. package/dist/features/stores/repository/store.repository.d.ts +18 -0
  216. package/dist/features/stores/repository/store.repository.js +27 -1
  217. package/dist/features/stores/schemas/firestore.d.ts +41 -0
  218. package/dist/features/stores/schemas/firestore.js +20 -0
  219. package/dist/features/stores/schemas/index.d.ts +6 -6
  220. package/dist/features/support/repository/support.repository.js +72 -6
  221. package/dist/features/support/schemas/firestore.d.ts +17 -0
  222. package/dist/features/support/schemas/index.d.ts +2 -2
  223. package/dist/index.d.ts +5 -0
  224. package/dist/index.js +19 -0
  225. package/dist/next/routing/route-map.d.ts +92 -0
  226. package/dist/next/routing/route-map.js +53 -0
  227. package/dist/react/contexts/SessionContext.d.ts +17 -1
  228. package/dist/schemas/registry.d.ts +22 -16
  229. package/dist/security/pii-schemas.d.ts +1 -1
  230. package/dist/security/pii-schemas.js +45 -0
  231. package/dist/server.d.ts +27 -1
  232. package/dist/server.js +144 -0
  233. package/dist/styles.css +349 -1
  234. package/dist/tailwind-utilities.css +1 -1
  235. package/dist/ui/components/Button.d.ts +10 -1
  236. package/dist/ui/components/Button.js +25 -3
  237. package/dist/ui/components/Chart.d.ts +63 -0
  238. package/dist/ui/components/Chart.js +169 -0
  239. package/dist/ui/components/Chart.style.css +214 -0
  240. package/dist/ui/components/Disclaimer.js +10 -1
  241. package/dist/ui/components/OverflowRow.js +54 -2
  242. package/dist/ui/components/OverflowRow.style.css +38 -0
  243. package/dist/ui/components/RichTextEditor.js +99 -8
  244. package/dist/ui/components/chart-spec.d.ts +68 -0
  245. package/dist/ui/components/chart-spec.js +140 -0
  246. package/dist/ui/components/index.style.css +1 -0
  247. package/dist/ui/components/surface-tokens.d.ts +1 -1
  248. package/dist/ui/components/surface-tokens.js +9 -0
  249. package/dist/ui/components/toolbar-collapse.d.ts +13 -0
  250. package/dist/ui/components/toolbar-collapse.js +10 -1
  251. package/dist/ui/index.d.ts +6 -0
  252. package/dist/ui/index.js +3 -0
  253. package/dist/ui/rich-text/RichText.d.ts +10 -1
  254. package/dist/ui/rich-text/RichText.js +33 -2
  255. package/dist/ui/rich-text/RichText.style.css +35 -0
  256. package/dist/ui/rich-text/RichTextRenderer.d.ts +30 -1
  257. package/dist/ui/rich-text/RichTextRenderer.js +34 -2
  258. package/dist/ui/rich-text/chart-blocks.d.ts +62 -0
  259. package/dist/ui/rich-text/chart-blocks.js +87 -0
  260. package/package.json +1 -1
  261. package/scripts/seed-cli.mjs +3 -0
@@ -41,6 +41,51 @@ export const ORDER_PII_FIELDS = [
41
41
  "userName",
42
42
  "userEmail",
43
43
  "sellerEmail",
44
+ /*
45
+ * ── The delivery snapshot (Part 14) ──────────────────────────────────────
46
+ *
47
+ * 🛑 **CORRECTED 2026-10-23.** These were first written as flat keys on the
48
+ * argument that "`encryptPiiFields` is a flat top-level loop that never
49
+ * descends" — CLAUDE.md's wording, and it is FALSE. Read the function: it
50
+ * handles dotted paths (`lastMessage.body`, already live above) AND
51
+ * `array[].key` via `encryptInArray`, in both directions.
52
+ *
53
+ * Flat keys stay, on a smaller and true argument: city / state / pincode /
54
+ * country must remain unencrypted and QUERYABLE, so a single
55
+ * `deliveryAddress` object would be half-encrypted — and a half-encrypted
56
+ * object is the shape nobody can reason about at a glance. Flat keys make
57
+ * each field's treatment visible in this list.
58
+ *
59
+ * What the encryptor does NOT do is infer. A field is covered only if it is
60
+ * NAMED, in the right notation — and `"fullName"` does not cover
61
+ * `deliveryAmendments[].fullName`. That is the real failure mode, and what
62
+ * `audit-snapshot-integrity` R1 checks.
63
+ *
64
+ * 🛑 `shippingAddress` is deliberately NOT added. It is legacy free text on
65
+ * existing rows; encrypting the field now would encrypt it on the next
66
+ * write of an old order while every other old row stays plaintext, giving
67
+ * one field two formats and no way to tell which a given row holds.
68
+ * Forward-only means the new fields carry the protection.
69
+ *
70
+ * city / state / pincode / country are absent on purpose — they decide tax
71
+ * and serviceability and must stay QUERYABLE.
72
+ */
73
+ "deliveryFullName",
74
+ "deliveryPhone",
75
+ "deliveryAddressLine1",
76
+ "deliveryAddressLine2",
77
+ "deliveryLandmark",
78
+ /*
79
+ * The amendment array, in the `array[].key` notation `encryptInArray`
80
+ * implements. Declared HERE rather than encrypted by hand at the write
81
+ * site: the repository's write hook already runs this list, and a second
82
+ * mechanism doing the same job is the drift this codebase keeps paying for.
83
+ */
84
+ "deliveryAmendments[].fullName",
85
+ "deliveryAmendments[].phone",
86
+ "deliveryAmendments[].addressLine1",
87
+ "deliveryAmendments[].addressLine2",
88
+ "deliveryAmendments[].landmark",
44
89
  ];
45
90
  /** PII fields in payouts */
46
91
  export const PAYOUT_PII_FIELDS = ["sellerEmail", "upiId"];
package/dist/server.d.ts CHANGED
@@ -429,6 +429,8 @@ export { piiBlindIndex } from "./security/index";
429
429
  export { piiIndicesFor } from "./security/index";
430
430
  export { reserveUserSlug, userSlugBase, USER_SLUGS_COLLECTION } from "./features/auth/actions/user-slug";
431
431
  export { resolveProfileUser } from "./features/auth/actions/profile-actions";
432
+ export { getBuyerActivityStats, getProfileStats, } from "./features/auth/actions/profile-actions";
433
+ export type { BuyerActivityStats } from "./features/auth/actions/profile-actions";
432
434
  export { getPiiConfigError } from "./security/index";
433
435
  export { encryptPayoutDetails } from "./security/index";
434
436
  export { decryptPayoutDetails } from "./security/index";
@@ -574,7 +576,7 @@ export { REFUND_COPY } from "./_internal/shared/features/orders/refund-copy";
574
576
  export { RETURN_REASON, FINAL_SALE_EXEMPT_REASONS, RETURN_REASON_LABEL, RETURN_REASON_GROUP_LABEL, isFinalSaleExempt, isReturnReason, selectableReturnReasons, } from "./_internal/shared/features/orders/return-reasons";
575
577
  export type { ReturnReason } from "./_internal/shared/features/orders/return-reasons";
576
578
  export { INTEGRATIONS, INTEGRATION_ORDER, readIntegrationStates, integrationPatch, allIntegrationsPatch, } from "./_internal/shared/features/admin/integrations";
577
- export type { IntegrationId, IntegrationDescriptor, IntegrationState, } from "./_internal/shared/features/admin/integrations";
579
+ export type { IntegrationId, IntegrationDescriptor, IntegrationState, IntegrationPatch, } from "./_internal/shared/features/admin/integrations";
578
580
  export { draftToProductInput, productToDraft, } from "./features/seller/utils/product-draft-mapping";
579
581
  export { RETURN_CUSTODY_STATES, RETURN_CUSTODY_COPY, isTerminalCustody, canAdvanceCustody, nextCustodyState, custodyOwner, isActionableBy, } from "./_internal/shared/features/returns/custody";
580
582
  export type { ReturnCustodyState } from "./_internal/shared/features/returns/custody";
@@ -613,3 +615,27 @@ export { financialYearLabel, formatSeriesNumber, INVOICE_PREFIX, CREDIT_NOTE_PRE
613
615
  export type { InvoiceCounterDocument, InvoiceAllocationDocument, InvoiceSeriesKind, } from "./features/invoicing/schemas/firestore";
614
616
  export { buildGstr1Export, gstr1ToCsv, type Gstr1Export, type Gstr1Row, } from "./_internal/server/features/invoicing/gstr1";
615
617
  export { quoteSharedPurchase, countDestinations, type SharedPurchaseRates, type SharedPurchaseQuote, type SharedPurchaseQuoteInput, } from "./_internal/shared/features/shipping/shared-purchase";
618
+ export { RATE_REGISTRY, RATE_TIER_ORDER, rateByPath, canEditRate, rejectRateChange, type RateDescriptor, type RateTier, type RateUnit, type RateChange, } from "./_internal/shared/features/pricing/rate-registry";
619
+ export { applyRateChange, RATE_CHANGE_LOG_MAX, type ApplyRateChangeInput, type ApplyRateChangeResult, } from "./_internal/server/features/pricing/actions";
620
+ export { SHARED_PURCHASE_MAX_MEMBERS, rejectCoordination, destinationIds, type CoordinationMember, type OfferCoordination, } from "./_internal/shared/features/offers/coordination";
621
+ export { assertOwnedAddresses } from "./_internal/server/features/offers/destinations";
622
+ export { checkDestinations, assertAllServiceable, planParcels, type DestinationCheck, type ParcelPlan, } from "./_internal/server/features/shipping/book-split";
623
+ export { snapshotDeliveryAddress, deliveryPartyFor, placeOfSupplyFrom, type DeliverySnapshot, type DeliveryParty, } from "./_internal/shared/features/orders/delivery-snapshot";
624
+ export { amendDeliveryAddress, revealAmendments, DELIVERY_AMENDMENT_MAX, type AmendDeliveryInput, } from "./_internal/server/features/orders/amend-delivery";
625
+ export { bookShipment, type BookShipmentInput, type BookShipmentResult, } from "./_internal/server/features/shipping/book";
626
+ export { journalRepository, JournalRepository, JOURNAL_PERIOD_SCAN_LIMIT } from "./features/ledger/repository/journal.repository";
627
+ export { assertBalanced, buildReversal, resolvePostingPeriod, periodOf, UnbalancedEntryError, BALANCE_TOLERANCE, type PostingInput, type BalancedPosting, } from "./_internal/shared/features/ledger/posting";
628
+ export { trialBalance, profitAndLoss, signedBalance, type TrialBalance, type ProfitAndLoss, type AccountTotals, } from "./_internal/shared/features/ledger/reports";
629
+ export { ACCOUNT, orderPlacedPosting, settlementPosting, payoutPosting, refundPosting, type OrderPostingInput, type SettlementPostingInput, type PayoutPostingInput, type RefundPostingInput, expensePosting, type ExpensePostingInput, } from "./_internal/shared/features/ledger/rules";
630
+ export { VENDORS_COLLECTION, EXPENSES_COLLECTION, EXPENSE_FIELDS, type VendorDocument, type ExpenseDocument, type ExpenseCategory, } from "./features/ledger/schemas/expenses";
631
+ export { BALANCE_WINDOW_DAYS, balanceDueOn, openBalanceCollection, submitBalanceProof, reviewBalanceProof, } from "./_internal/server/features/orders/balance";
632
+ export { reserveStock, releaseReservation, releaseReservationsForHolder, consumeReservation, expireDueReservations, activeReservationsForProduct, } from "./_internal/server/features/inventory/reservations";
633
+ export type { ReserveStockInput } from "./_internal/server/features/inventory/reservations";
634
+ export { RESERVATION_DEFAULT_TTL_HOURS, RESERVATION_MAX_TTL_HOURS, RESERVATION_HOLDER_KINDS, RESERVATION_STATUSES, STOCK_RESERVATION_COLLECTION, isReservationActive, } from "./features/inventory/schemas/stock-reservation";
635
+ export type { ReservationHolderKind, ReservationStatus, StockReservationDocument, } from "./features/inventory/schemas/stock-reservation";
636
+ export { assertCheckoutValueOtp } from "./_internal/server/features/checkout/value-otp-gate";
637
+ export type { CheckoutValueOtpGateInput } from "./_internal/server/features/checkout/value-otp-gate";
638
+ export { bookAdSlot, moderateAdCreative, resubmitAdCreative, cancelAdBooking, releaseAdSlot, liveBookingForPlacement, pendingAdBookings, adBookingsForAdvertiser, adSlotOffers, } from "./_internal/server/features/ads/booking";
639
+ export type { BookAdSlotInput, AdSlotOffer } from "./_internal/server/features/ads/booking";
640
+ export { AD_BOOKING_COLLECTION, AD_BOOKING_PAYMENT_STATES, AD_MODERATION_STATES, adBookingId, adPeriodOf, adPeriodStart, adPeriodEnd, isAdPeriod, isAdBookingLive, } from "./features/ads/schemas/firestore";
641
+ export type { AdBookingDocument, AdBookingCreative, AdBookingPaymentState, AdModerationState, AdPeriod, } from "./features/ads/schemas/firestore";
package/dist/server.js CHANGED
@@ -1327,6 +1327,7 @@ export { piiBlindIndex } from "./security/index.js";
1327
1327
  export { piiIndicesFor } from "./security/index.js";
1328
1328
  export { reserveUserSlug, userSlugBase, USER_SLUGS_COLLECTION } from "./features/auth/actions/user-slug.js";
1329
1329
  export { resolveProfileUser } from "./features/auth/actions/profile-actions.js";
1330
+ export { getBuyerActivityStats, getProfileStats, } from "./features/auth/actions/profile-actions.js";
1330
1331
  export { getPiiConfigError } from "./security/index.js";
1331
1332
  export { encryptPayoutDetails } from "./security/index.js";
1332
1333
  export { decryptPayoutDetails } from "./security/index.js";
@@ -1676,3 +1677,146 @@ export { buildGstr1Export, gstr1ToCsv, } from "./_internal/server/features/invoi
1676
1677
  * settings read; the rates are passed in snapshotted.
1677
1678
  */
1678
1679
  export { quoteSharedPurchase, countDestinations, } from "./_internal/shared/features/shipping/shared-purchase.js";
1680
+ /*
1681
+ * [SERVER-ONLY] The pricing registry and its one write path.
1682
+ *
1683
+ * 🛑 The REGISTRY is pure data with no Firestore and no `node:` import, so it
1684
+ * could sit in the main barrel — and deliberately does not. Its only consumer
1685
+ * outside appkit is `/api/admin/pricing`, and putting it in `index.ts` would
1686
+ * add sixteen descriptors and four symbols to every client bundle that imports
1687
+ * anything at all, to serve one route (Root Cause #18 — a re-export is a
1688
+ * public API contract, not a convenience).
1689
+ *
1690
+ * `applyRateChange` belongs here regardless: it reaches firebase-admin.
1691
+ */
1692
+ export { RATE_REGISTRY, RATE_TIER_ORDER, rateByPath, canEditRate, rejectRateChange, } from "./_internal/shared/features/pricing/rate-registry.js";
1693
+ export { applyRateChange, RATE_CHANGE_LOG_MAX, } from "./_internal/server/features/pricing/actions.js";
1694
+ /*
1695
+ * [SERVER-ONLY] Coordinated purchase — a SPECIALISED OFFER, not a new flow.
1696
+ *
1697
+ * `assertOwnedAddresses` is the one piece that must run server-side: a
1698
+ * destination is a REFERENCE, and an id is guessable in a way an address is
1699
+ * not, so an unverified one ships a parcel to a stranger's house with nothing
1700
+ * erroring. The shared half (the member shape, the member-count rule) is pure
1701
+ * and could sit in the main barrel — it stays here beside its checker so a
1702
+ * caller cannot reach for one without meeting the other.
1703
+ */
1704
+ export { SHARED_PURCHASE_MAX_MEMBERS, rejectCoordination, destinationIds, } from "./_internal/shared/features/offers/coordination.js";
1705
+ export { assertOwnedAddresses } from "./_internal/server/features/offers/destinations.js";
1706
+ /*
1707
+ * S5a — N destinations is N parcels, so N carrier quotes.
1708
+ *
1709
+ * 🛑 `checkDestinations` + `assertAllServiceable` are a PRE-FLIGHT and are
1710
+ * exported as a pair for that reason: booking as you go and failing on the
1711
+ * fourth leaves three parcels the carrier has already accepted and the
1712
+ * coordinator cannot undo. It is not a transaction — a booking has no
1713
+ * rollback — it just moves the common failure to the point where rolling
1714
+ * back is still free.
1715
+ */
1716
+ export { checkDestinations, assertAllServiceable, planParcels, } from "./_internal/server/features/shipping/book-split.js";
1717
+ /*
1718
+ * [SERVER-ONLY] Part 14 — the delivery snapshot and its corrections.
1719
+ *
1720
+ * `amendDeliveryAddress` is server-only (Firestore + the addresses
1721
+ * repository). The pure readers ship with it rather than from the main
1722
+ * barrel so a caller cannot reach `deliveryPartyFor` without the module that
1723
+ * explains why it reads the amendment while `placeOfSupplyFrom` reads the
1724
+ * snapshot — getting those two the wrong way round sends a parcel to the old
1725
+ * address, or restates tax on a filed invoice.
1726
+ */
1727
+ export { snapshotDeliveryAddress, deliveryPartyFor, placeOfSupplyFrom, } from "./_internal/shared/features/orders/delivery-snapshot.js";
1728
+ export { amendDeliveryAddress, revealAmendments, DELIVERY_AMENDMENT_MAX, } from "./_internal/server/features/orders/amend-delivery.js";
1729
+ /*
1730
+ * [SERVER-ONLY] Part 1′ — parcel booking.
1731
+ *
1732
+ * 🛑 Exported for the ENQUEUE route only. The booking itself runs in the
1733
+ * `bookShipment` job runner, because a carrier call on a 10s sync ceiling
1734
+ * times out in the one way that cannot be retried safely: the carrier may
1735
+ * have accepted, so a retry double-books and a non-retry leaves a parcel
1736
+ * nobody collects.
1737
+ */
1738
+ export { bookShipment, } from "./_internal/server/features/shipping/book.js";
1739
+ /*
1740
+ * [SERVER-ONLY] Part 4 — the double-entry books.
1741
+ *
1742
+ * 🛑 The repository is server-only (Firestore), and the posting rules ship
1743
+ * beside it rather than from the main barrel even though they are pure: a
1744
+ * caller who can reach `assertBalanced` without reaching `journalRepository`
1745
+ * can compute a balanced entry and write it some other way, which is exactly
1746
+ * the "every entry is machine-generated through one path" constraint the
1747
+ * whole design rests on. Same stance `assertOwnedAddresses` takes.
1748
+ *
1749
+ * 🛑 The LEDGER IS A PROJECTION. Orders, payouts and expenses are truth —
1750
+ * never read a balance to make an operational decision.
1751
+ */
1752
+ export { journalRepository, JournalRepository, JOURNAL_PERIOD_SCAN_LIMIT } from "./features/ledger/repository/journal.repository.js";
1753
+ export { assertBalanced, buildReversal, resolvePostingPeriod, periodOf, UnbalancedEntryError, BALANCE_TOLERANCE, } from "./_internal/shared/features/ledger/posting.js";
1754
+ export { trialBalance, profitAndLoss, signedBalance, } from "./_internal/shared/features/ledger/reports.js";
1755
+ /*
1756
+ * The per-event posting rules. These are WHERE the "every entry is
1757
+ * machine-generated" constraint lives — a caller posts an order by handing
1758
+ * `orderPlacedPosting(order)` to `journalRepository.post`, never by writing
1759
+ * legs. A backwards entry balances, so nothing downstream would object;
1760
+ * `verify-posting-rules` R7 checks the SIDES, with controls proving it
1761
+ * catches a credited bank, an un-reclaimed refund GST and an inverted
1762
+ * output-GST liability.
1763
+ */
1764
+ export { ACCOUNT, orderPlacedPosting, settlementPosting, payoutPosting, refundPosting, expensePosting, } from "./_internal/shared/features/ledger/rules.js";
1765
+ /*
1766
+ * Vendors and expenses. `ShipmentDocument.supplierId` joins to a vendor row;
1767
+ * `supplierName` stays as typed, because deriving the name on read would let
1768
+ * a vendor rename rewrite what every past shipment says it was bought from.
1769
+ */
1770
+ export { VENDORS_COLLECTION, EXPENSES_COLLECTION, EXPENSE_FIELDS, } from "./features/ledger/schemas/expenses.js";
1771
+ /*
1772
+ * [SERVER-ONLY] D55 — the pre-order balance collector.
1773
+ *
1774
+ * `balanceDue` has been computed and rendered since Part 2 with nothing to
1775
+ * collect it. These three are the whole collection path: the seller opens it
1776
+ * when stock lands, the buyer submits a proof, staff review it. Manual only —
1777
+ * the auto path is blocked on RBI mandate requirements, not on effort.
1778
+ */
1779
+ export { BALANCE_WINDOW_DAYS, balanceDueOn, openBalanceCollection, submitBalanceProof, reviewBalanceProof, } from "./_internal/server/features/orders/balance.js";
1780
+ /*
1781
+ * [SERVER-ONLY] Stock reservation with a TTL.
1782
+ *
1783
+ * A hold on units that is NOT an order. The only mechanism before this was
1784
+ * `onOrderCreate`'s decrement plus `pendingOrderTimeout`'s 15-minute restore,
1785
+ * both keyed to an order — which cannot serve a multi-day shared purchase
1786
+ * without either starting a payment clock on day one or letting an ordinary
1787
+ * buyer take the item out from under the arrangement.
1788
+ *
1789
+ * 🛑 Every one of these moves the reservation row and `availableQuantity`
1790
+ * inside ONE transaction. A caller that writes either half itself has
1791
+ * reintroduced exactly the drift this primitive exists to remove.
1792
+ */
1793
+ export { reserveStock, releaseReservation, releaseReservationsForHolder, consumeReservation, expireDueReservations, activeReservationsForProduct, } from "./_internal/server/features/inventory/reservations.js";
1794
+ export { RESERVATION_DEFAULT_TTL_HOURS, RESERVATION_MAX_TTL_HOURS, RESERVATION_HOLDER_KINDS, RESERVATION_STATUSES, STOCK_RESERVATION_COLLECTION, isReservationActive, } from "./features/inventory/schemas/stock-reservation.js";
1795
+ /*
1796
+ * [SERVER-ONLY] The high-value checkout OTP gate.
1797
+ *
1798
+ * 🛑 It takes the AMOUNT it judges. There were two hand-rolled copies of
1799
+ * this rule — `createOrderForGroup` summing the cart, the gateway route
1800
+ * using its own `subtotalRs` — which is Root Cause #75's shape, and they
1801
+ * had already drifted on what they measured.
1802
+ *
1803
+ * Taking the amount is also Part 6's prerequisite: `otpCheckoutThreshold`
1804
+ * is per CHECKOUT, so an N-party arrangement clears ₹12,000 in three
1805
+ * ₹4,000 pieces with no OTP unless it can present its own total.
1806
+ */
1807
+ export { assertCheckoutValueOtp } from "./_internal/server/features/checkout/value-otp-gate.js";
1808
+ /*
1809
+ * [SERVER-ONLY] D56 — self-serve ad bookings.
1810
+ *
1811
+ * 🛑 Availability is a DOCUMENT COLLISION, never a query. The booking id
1812
+ * is `${placementId}__${period}` and creation uses `tx.create`, so a second
1813
+ * booking of the same slot fails on an existing document inside its own
1814
+ * transaction. Query-then-write would let two concurrent requests both read
1815
+ * "free" and sell the slot twice, with nothing erroring.
1816
+ *
1817
+ * 🛑 Flat fee per period, explicitly NOT CPM — impression counting is a
1818
+ * write per page view, which is the cost pattern that suspended this
1819
+ * project (Root Cause #104).
1820
+ */
1821
+ export { bookAdSlot, moderateAdCreative, resubmitAdCreative, cancelAdBooking, releaseAdSlot, liveBookingForPlacement, pendingAdBookings, adBookingsForAdvertiser, adSlotOffers, } from "./_internal/server/features/ads/booking.js";
1822
+ export { AD_BOOKING_COLLECTION, AD_BOOKING_PAYMENT_STATES, AD_MODERATION_STATES, adBookingId, adPeriodOf, adPeriodStart, adPeriodEnd, isAdPeriod, isAdBookingLive, } from "./features/ads/schemas/firestore.js";