@managesome/eposmatic-toolkit 0.4.9 → 0.4.11

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 (351) hide show
  1. package/esm/constants/MATERIALIZED_REPORTS.js +455 -0
  2. package/esm/constants/enums/delivery.js +8 -0
  3. package/esm/helpers/index.js +3 -0
  4. package/esm/helpers/materialized-reports/index.js +32 -0
  5. package/esm/helpers/materialized-reports/materialized-cash-accumulator-helpers.js +114 -0
  6. package/esm/helpers/materialized-reports/materialized-cash-classification-helpers.js +248 -0
  7. package/esm/helpers/materialized-reports/materialized-cash-close-day-helpers.js +396 -0
  8. package/esm/helpers/materialized-reports/materialized-cash-compile-helpers.js +245 -0
  9. package/esm/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +170 -0
  10. package/esm/helpers/materialized-reports/materialized-delivery-classification-helpers.js +430 -0
  11. package/esm/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +373 -0
  12. package/esm/helpers/materialized-reports/materialized-delivery-compile-helpers.js +216 -0
  13. package/esm/helpers/materialized-reports/materialized-discount-accumulator-helpers.js +319 -0
  14. package/esm/helpers/materialized-reports/materialized-discount-classification-helpers.js +213 -0
  15. package/esm/helpers/materialized-reports/materialized-discount-close-day-helpers.js +604 -0
  16. package/esm/helpers/materialized-reports/materialized-discount-compile-helpers.js +186 -0
  17. package/esm/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.js +155 -0
  18. package/esm/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.js +199 -0
  19. package/esm/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.js +115 -0
  20. package/esm/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.js +89 -0
  21. package/esm/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.js +394 -0
  22. package/esm/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.js +167 -0
  23. package/esm/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +215 -0
  24. package/esm/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +477 -0
  25. package/esm/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +201 -0
  26. package/esm/helpers/materialized-reports/materialized-reports-scope-group-helpers.js +9 -6
  27. package/esm/helpers/materialized-reports/materialized-reports-selection-helpers.js +11 -4
  28. package/esm/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.js +189 -0
  29. package/esm/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.js +156 -0
  30. package/esm/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.js +588 -0
  31. package/esm/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.js +175 -0
  32. package/esm/helpers/materialized-reports/tenant-cash-in-out-formatter.js +157 -0
  33. package/esm/helpers/materialized-reports/tenant-delivery-formatter.js +230 -0
  34. package/esm/helpers/materialized-reports/tenant-discount-formatter.js +427 -0
  35. package/esm/helpers/materialized-reports/tenant-hourly-comparison-formatter.js +238 -0
  36. package/esm/helpers/materialized-reports/tenant-payments-comparison-formatter.js +282 -0
  37. package/esm/helpers/materialized-reports/tenant-prep-time-formatter.js +228 -0
  38. package/esm/helpers/materialized-reports/tenant-sales-comparison-formatter.js +346 -0
  39. package/esm/helpers/reporting-contract/index.js +2 -0
  40. package/esm/helpers/reporting-contract/overview-contract.js +123 -0
  41. package/esm/helpers/reporting-contract/report-contract.js +228 -0
  42. package/esm/helpers/rider-earnings/index.js +1 -0
  43. package/esm/helpers/rider-earnings/rider-earnings.js +53 -0
  44. package/esm/helpers/rider-reports/index.js +2 -0
  45. package/esm/helpers/rider-reports/rider-daily-report.js +90 -0
  46. package/esm/helpers/rider-reports/rider-report.js +67 -0
  47. package/esm/helpers/store/common-order-actions.js +3 -2
  48. package/esm/schemas/models/deliveries.js +82 -1
  49. package/esm/schemas/models/index.js +15 -0
  50. package/esm/schemas/models/materialized_credit_bills.js +1 -1
  51. package/esm/schemas/models/materialized_rider_daily_reports.js +39 -0
  52. package/esm/schemas/models/materialized_tenant_cash_entries.js +95 -0
  53. package/esm/schemas/models/materialized_tenant_cash_reports.js +77 -0
  54. package/esm/schemas/models/materialized_tenant_delivery_entries.js +63 -0
  55. package/esm/schemas/models/materialized_tenant_delivery_reports.js +63 -0
  56. package/esm/schemas/models/materialized_tenant_discount_entries.js +156 -0
  57. package/esm/schemas/models/materialized_tenant_discount_reports.js +333 -0
  58. package/esm/schemas/models/materialized_tenant_hourly_comparison_entries.js +87 -0
  59. package/esm/schemas/models/materialized_tenant_hourly_comparison_reports.js +99 -0
  60. package/esm/schemas/models/materialized_tenant_payments_comparison_entries.js +71 -0
  61. package/esm/schemas/models/materialized_tenant_payments_comparison_reports.js +76 -0
  62. package/esm/schemas/models/materialized_tenant_prep_time_entries.js +130 -0
  63. package/esm/schemas/models/materialized_tenant_prep_time_reports.js +109 -0
  64. package/esm/schemas/models/materialized_tenant_sales_comparison_entries.js +130 -0
  65. package/esm/schemas/models/materialized_tenant_sales_comparison_reports.js +154 -0
  66. package/esm/schemas/models/materialized_tenant_sales_overview_reports.js +1 -1
  67. package/esm/schemas/types/index.js +15 -0
  68. package/esm/schemas/types/materialized_rider_daily_reports.js +1 -0
  69. package/esm/schemas/types/materialized_tenant_cash_entries.js +1 -0
  70. package/esm/schemas/types/materialized_tenant_cash_reports.js +1 -0
  71. package/esm/schemas/types/materialized_tenant_delivery_entries.js +1 -0
  72. package/esm/schemas/types/materialized_tenant_delivery_reports.js +1 -0
  73. package/esm/schemas/types/materialized_tenant_discount_entries.js +1 -0
  74. package/esm/schemas/types/materialized_tenant_discount_reports.js +2 -0
  75. package/esm/schemas/types/materialized_tenant_hourly_comparison_entries.js +1 -0
  76. package/esm/schemas/types/materialized_tenant_hourly_comparison_reports.js +1 -0
  77. package/esm/schemas/types/materialized_tenant_payments_comparison_entries.js +1 -0
  78. package/esm/schemas/types/materialized_tenant_payments_comparison_reports.js +11 -0
  79. package/esm/schemas/types/materialized_tenant_prep_time_entries.js +1 -0
  80. package/esm/schemas/types/materialized_tenant_prep_time_reports.js +1 -0
  81. package/esm/schemas/types/materialized_tenant_sales_comparison_entries.js +1 -0
  82. package/esm/schemas/types/materialized_tenant_sales_comparison_reports.js +14 -0
  83. package/lib/constants/MATERIALIZED_REPORTS.d.ts +345 -2
  84. package/lib/constants/MATERIALIZED_REPORTS.js +457 -1
  85. package/lib/constants/enums/delivery.d.ts +7 -0
  86. package/lib/constants/enums/delivery.js +9 -1
  87. package/lib/helpers/index.d.ts +3 -0
  88. package/lib/helpers/index.js +3 -0
  89. package/lib/helpers/materialized-reports/index.d.ts +32 -0
  90. package/lib/helpers/materialized-reports/index.js +32 -0
  91. package/lib/helpers/materialized-reports/materialized-cash-accumulator-helpers.d.ts +18 -0
  92. package/lib/helpers/materialized-reports/materialized-cash-accumulator-helpers.js +118 -0
  93. package/lib/helpers/materialized-reports/materialized-cash-classification-helpers.d.ts +142 -0
  94. package/lib/helpers/materialized-reports/materialized-cash-classification-helpers.js +257 -0
  95. package/lib/helpers/materialized-reports/materialized-cash-close-day-helpers.d.ts +103 -0
  96. package/lib/helpers/materialized-reports/materialized-cash-close-day-helpers.js +409 -0
  97. package/lib/helpers/materialized-reports/materialized-cash-compile-helpers.d.ts +73 -0
  98. package/lib/helpers/materialized-reports/materialized-cash-compile-helpers.js +252 -0
  99. package/lib/helpers/materialized-reports/materialized-delivery-accumulator-helpers.d.ts +7 -0
  100. package/lib/helpers/materialized-reports/materialized-delivery-accumulator-helpers.js +173 -0
  101. package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.d.ts +113 -0
  102. package/lib/helpers/materialized-reports/materialized-delivery-classification-helpers.js +442 -0
  103. package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.d.ts +98 -0
  104. package/lib/helpers/materialized-reports/materialized-delivery-close-day-helpers.js +386 -0
  105. package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.d.ts +41 -0
  106. package/lib/helpers/materialized-reports/materialized-delivery-compile-helpers.js +220 -0
  107. package/lib/helpers/materialized-reports/materialized-discount-accumulator-helpers.d.ts +52 -0
  108. package/lib/helpers/materialized-reports/materialized-discount-accumulator-helpers.js +325 -0
  109. package/lib/helpers/materialized-reports/materialized-discount-classification-helpers.d.ts +50 -0
  110. package/lib/helpers/materialized-reports/materialized-discount-classification-helpers.js +222 -0
  111. package/lib/helpers/materialized-reports/materialized-discount-close-day-helpers.d.ts +182 -0
  112. package/lib/helpers/materialized-reports/materialized-discount-close-day-helpers.js +615 -0
  113. package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.d.ts +47 -0
  114. package/lib/helpers/materialized-reports/materialized-discount-compile-helpers.js +193 -0
  115. package/lib/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.d.ts +64 -0
  116. package/lib/helpers/materialized-reports/materialized-hourly-comparison-close-day-helpers.js +163 -0
  117. package/lib/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.d.ts +61 -0
  118. package/lib/helpers/materialized-reports/materialized-hourly-comparison-compile-helpers.js +207 -0
  119. package/lib/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.d.ts +23 -0
  120. package/lib/helpers/materialized-reports/materialized-hourly-comparison-selection-helpers.js +120 -0
  121. package/lib/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.d.ts +25 -0
  122. package/lib/helpers/materialized-reports/materialized-payments-comparison-accumulator-helpers.js +99 -0
  123. package/lib/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.d.ts +79 -0
  124. package/lib/helpers/materialized-reports/materialized-payments-comparison-close-day-helpers.js +407 -0
  125. package/lib/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.d.ts +35 -0
  126. package/lib/helpers/materialized-reports/materialized-payments-comparison-compile-helpers.js +173 -0
  127. package/lib/helpers/materialized-reports/materialized-prep-time-classification-helpers.d.ts +98 -0
  128. package/lib/helpers/materialized-reports/materialized-prep-time-classification-helpers.js +224 -0
  129. package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.d.ts +130 -0
  130. package/lib/helpers/materialized-reports/materialized-prep-time-close-day-helpers.js +491 -0
  131. package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.d.ts +47 -0
  132. package/lib/helpers/materialized-reports/materialized-prep-time-compile-helpers.js +208 -0
  133. package/lib/helpers/materialized-reports/materialized-reports-scope-group-helpers.d.ts +6 -3
  134. package/lib/helpers/materialized-reports/materialized-reports-scope-group-helpers.js +8 -5
  135. package/lib/helpers/materialized-reports/materialized-reports-selection-helpers.d.ts +8 -0
  136. package/lib/helpers/materialized-reports/materialized-reports-selection-helpers.js +10 -3
  137. package/lib/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.d.ts +48 -0
  138. package/lib/helpers/materialized-reports/materialized-sales-comparison-accumulator-helpers.js +204 -0
  139. package/lib/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.d.ts +22 -0
  140. package/lib/helpers/materialized-reports/materialized-sales-comparison-baseline-helpers.js +160 -0
  141. package/lib/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.d.ts +163 -0
  142. package/lib/helpers/materialized-reports/materialized-sales-comparison-close-day-helpers.js +603 -0
  143. package/lib/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.d.ts +68 -0
  144. package/lib/helpers/materialized-reports/materialized-sales-comparison-compile-helpers.js +182 -0
  145. package/lib/helpers/materialized-reports/tenant-cash-in-out-formatter.d.ts +98 -0
  146. package/lib/helpers/materialized-reports/tenant-cash-in-out-formatter.js +160 -0
  147. package/lib/helpers/materialized-reports/tenant-delivery-formatter.d.ts +133 -0
  148. package/lib/helpers/materialized-reports/tenant-delivery-formatter.js +233 -0
  149. package/lib/helpers/materialized-reports/tenant-discount-formatter.d.ts +114 -0
  150. package/lib/helpers/materialized-reports/tenant-discount-formatter.js +431 -0
  151. package/lib/helpers/materialized-reports/tenant-hourly-comparison-formatter.d.ts +60 -0
  152. package/lib/helpers/materialized-reports/tenant-hourly-comparison-formatter.js +244 -0
  153. package/lib/helpers/materialized-reports/tenant-payments-comparison-formatter.d.ts +75 -0
  154. package/lib/helpers/materialized-reports/tenant-payments-comparison-formatter.js +289 -0
  155. package/lib/helpers/materialized-reports/tenant-prep-time-formatter.d.ts +98 -0
  156. package/lib/helpers/materialized-reports/tenant-prep-time-formatter.js +232 -0
  157. package/lib/helpers/materialized-reports/tenant-sales-comparison-formatter.d.ts +105 -0
  158. package/lib/helpers/materialized-reports/tenant-sales-comparison-formatter.js +352 -0
  159. package/lib/helpers/reporting-contract/index.d.ts +2 -0
  160. package/lib/helpers/reporting-contract/index.js +18 -0
  161. package/lib/helpers/reporting-contract/overview-contract.d.ts +55 -0
  162. package/lib/helpers/reporting-contract/overview-contract.js +127 -0
  163. package/lib/helpers/reporting-contract/report-contract.d.ts +159 -0
  164. package/lib/helpers/reporting-contract/report-contract.js +239 -0
  165. package/lib/helpers/rider-earnings/index.d.ts +1 -0
  166. package/lib/helpers/rider-earnings/index.js +17 -0
  167. package/lib/helpers/rider-earnings/rider-earnings.d.ts +51 -0
  168. package/lib/helpers/rider-earnings/rider-earnings.js +57 -0
  169. package/lib/helpers/rider-reports/index.d.ts +2 -0
  170. package/lib/helpers/rider-reports/index.js +18 -0
  171. package/lib/helpers/rider-reports/rider-daily-report.d.ts +28 -0
  172. package/lib/helpers/rider-reports/rider-daily-report.js +93 -0
  173. package/lib/helpers/rider-reports/rider-report.d.ts +49 -0
  174. package/lib/helpers/rider-reports/rider-report.js +70 -0
  175. package/lib/helpers/store/common-order-actions.js +3 -2
  176. package/lib/helpers/types/materialized-reports-apis.d.ts +300 -1
  177. package/lib/schemas/models/deliveries.d.ts +58 -1
  178. package/lib/schemas/models/deliveries.js +81 -0
  179. package/lib/schemas/models/expense_details.d.ts +3 -3
  180. package/lib/schemas/models/index.d.ts +15 -0
  181. package/lib/schemas/models/index.js +15 -0
  182. package/lib/schemas/models/materialized_credit_bills.d.ts +3 -3
  183. package/lib/schemas/models/materialized_credit_bills.js +1 -1
  184. package/lib/schemas/models/materialized_rider_daily_reports.d.ts +27 -0
  185. package/lib/schemas/models/materialized_rider_daily_reports.js +42 -0
  186. package/lib/schemas/models/materialized_tenant_cash_entries.d.ts +181 -0
  187. package/lib/schemas/models/materialized_tenant_cash_entries.js +98 -0
  188. package/lib/schemas/models/materialized_tenant_cash_reports.d.ts +111 -0
  189. package/lib/schemas/models/materialized_tenant_cash_reports.js +80 -0
  190. package/lib/schemas/models/materialized_tenant_delivery_entries.d.ts +98 -0
  191. package/lib/schemas/models/materialized_tenant_delivery_entries.js +66 -0
  192. package/lib/schemas/models/materialized_tenant_delivery_reports.d.ts +98 -0
  193. package/lib/schemas/models/materialized_tenant_delivery_reports.js +66 -0
  194. package/lib/schemas/models/materialized_tenant_discount_entries.d.ts +199 -0
  195. package/lib/schemas/models/materialized_tenant_discount_entries.js +159 -0
  196. package/lib/schemas/models/materialized_tenant_discount_reports.d.ts +216 -0
  197. package/lib/schemas/models/materialized_tenant_discount_reports.js +336 -0
  198. package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.d.ts +95 -0
  199. package/lib/schemas/models/materialized_tenant_hourly_comparison_entries.js +82 -0
  200. package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.d.ts +105 -0
  201. package/lib/schemas/models/materialized_tenant_hourly_comparison_reports.js +91 -0
  202. package/lib/schemas/models/materialized_tenant_payments_comparison_entries.d.ts +91 -0
  203. package/lib/schemas/models/materialized_tenant_payments_comparison_entries.js +70 -0
  204. package/lib/schemas/models/materialized_tenant_payments_comparison_reports.d.ts +98 -0
  205. package/lib/schemas/models/materialized_tenant_payments_comparison_reports.js +71 -0
  206. package/lib/schemas/models/materialized_tenant_prep_time_entries.d.ts +181 -0
  207. package/lib/schemas/models/materialized_tenant_prep_time_entries.js +133 -0
  208. package/lib/schemas/models/materialized_tenant_prep_time_reports.d.ts +118 -0
  209. package/lib/schemas/models/materialized_tenant_prep_time_reports.js +112 -0
  210. package/lib/schemas/models/materialized_tenant_sales_comparison_entries.d.ts +139 -0
  211. package/lib/schemas/models/materialized_tenant_sales_comparison_entries.js +120 -0
  212. package/lib/schemas/models/materialized_tenant_sales_comparison_reports.d.ts +167 -0
  213. package/lib/schemas/models/materialized_tenant_sales_comparison_reports.js +137 -0
  214. package/lib/schemas/models/materialized_tenant_sales_overview_reports.d.ts +3 -3
  215. package/lib/schemas/models/materialized_tenant_sales_overview_reports.js +1 -1
  216. package/lib/schemas/models/tenant_purchase_order_vendor_returns.d.ts +3 -3
  217. package/lib/schemas/models/warehouse_internal_movements.d.ts +6 -6
  218. package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +3 -3
  219. package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +3 -3
  220. package/lib/schemas/models/warehouse_sale_deliveries.d.ts +6 -6
  221. package/lib/schemas/models/warehouse_sale_invoices.d.ts +3 -3
  222. package/lib/schemas/types/deliveries.d.ts +40 -1
  223. package/lib/schemas/types/index.d.ts +15 -0
  224. package/lib/schemas/types/index.js +15 -0
  225. package/lib/schemas/types/materialized_rider_daily_reports.d.ts +37 -0
  226. package/lib/schemas/types/materialized_rider_daily_reports.js +2 -0
  227. package/lib/schemas/types/materialized_tenant_cash_entries.d.ts +87 -0
  228. package/lib/schemas/types/materialized_tenant_cash_entries.js +2 -0
  229. package/lib/schemas/types/materialized_tenant_cash_reports.d.ts +144 -0
  230. package/lib/schemas/types/materialized_tenant_cash_reports.js +2 -0
  231. package/lib/schemas/types/materialized_tenant_delivery_entries.d.ts +98 -0
  232. package/lib/schemas/types/materialized_tenant_delivery_entries.js +2 -0
  233. package/lib/schemas/types/materialized_tenant_delivery_reports.d.ts +179 -0
  234. package/lib/schemas/types/materialized_tenant_delivery_reports.js +2 -0
  235. package/lib/schemas/types/materialized_tenant_discount_entries.d.ts +81 -0
  236. package/lib/schemas/types/materialized_tenant_discount_entries.js +2 -0
  237. package/lib/schemas/types/materialized_tenant_discount_reports.d.ts +209 -0
  238. package/lib/schemas/types/materialized_tenant_discount_reports.js +3 -0
  239. package/lib/schemas/types/materialized_tenant_hourly_comparison_entries.d.ts +33 -0
  240. package/lib/schemas/types/materialized_tenant_hourly_comparison_entries.js +2 -0
  241. package/lib/schemas/types/materialized_tenant_hourly_comparison_reports.d.ts +40 -0
  242. package/lib/schemas/types/materialized_tenant_hourly_comparison_reports.js +2 -0
  243. package/lib/schemas/types/materialized_tenant_payments_comparison_entries.d.ts +48 -0
  244. package/lib/schemas/types/materialized_tenant_payments_comparison_entries.js +2 -0
  245. package/lib/schemas/types/materialized_tenant_payments_comparison_reports.d.ts +51 -0
  246. package/lib/schemas/types/materialized_tenant_payments_comparison_reports.js +14 -0
  247. package/lib/schemas/types/materialized_tenant_prep_time_entries.d.ts +88 -0
  248. package/lib/schemas/types/materialized_tenant_prep_time_entries.js +2 -0
  249. package/lib/schemas/types/materialized_tenant_prep_time_reports.d.ts +132 -0
  250. package/lib/schemas/types/materialized_tenant_prep_time_reports.js +2 -0
  251. package/lib/schemas/types/materialized_tenant_sales_comparison_entries.d.ts +43 -0
  252. package/lib/schemas/types/materialized_tenant_sales_comparison_entries.js +2 -0
  253. package/lib/schemas/types/materialized_tenant_sales_comparison_reports.d.ts +74 -0
  254. package/lib/schemas/types/materialized_tenant_sales_comparison_reports.js +17 -0
  255. package/lib/schemas/types/materialized_tenant_sales_overview_reports.d.ts +7 -0
  256. package/lib/tests/deliveries-schema.test.d.ts +1 -0
  257. package/lib/tests/deliveries-schema.test.js +70 -0
  258. package/lib/tests/materialized-reports/analytics-growth-helpers.test.d.ts +1 -0
  259. package/lib/tests/materialized-reports/analytics-overview-helpers.test.d.ts +1 -0
  260. package/lib/tests/materialized-reports/analytics-performance-helpers.test.d.ts +1 -0
  261. package/lib/tests/materialized-reports/fixtures.d.ts +15 -1
  262. package/lib/tests/materialized-reports/fixtures.js +1 -0
  263. package/lib/tests/materialized-reports/materialized-cash-compile.test.d.ts +1 -0
  264. package/lib/tests/materialized-reports/materialized-cash-compile.test.js +197 -0
  265. package/lib/tests/materialized-reports/materialized-cash-fold.test.d.ts +1 -0
  266. package/lib/tests/materialized-reports/materialized-cash-fold.test.js +116 -0
  267. package/lib/tests/materialized-reports/materialized-cash-formatter.test.d.ts +1 -0
  268. package/lib/tests/materialized-reports/materialized-cash-formatter.test.js +153 -0
  269. package/lib/tests/materialized-reports/materialized-cash-plan.test.d.ts +1 -0
  270. package/lib/tests/materialized-reports/materialized-cash-plan.test.js +168 -0
  271. package/lib/tests/materialized-reports/materialized-cash-reconciliation.test.d.ts +1 -0
  272. package/lib/tests/materialized-reports/materialized-cash-reconciliation.test.js +267 -0
  273. package/lib/tests/materialized-reports/materialized-delivery-accumulation.test.d.ts +1 -0
  274. package/lib/tests/materialized-reports/materialized-delivery-accumulation.test.js +147 -0
  275. package/lib/tests/materialized-reports/materialized-delivery-compile.test.d.ts +1 -0
  276. package/lib/tests/materialized-reports/materialized-delivery-compile.test.js +242 -0
  277. package/lib/tests/materialized-reports/materialized-delivery-fold.test.d.ts +1 -0
  278. package/lib/tests/materialized-reports/materialized-delivery-fold.test.js +109 -0
  279. package/lib/tests/materialized-reports/materialized-delivery-formatter.test.d.ts +1 -0
  280. package/lib/tests/materialized-reports/materialized-delivery-formatter.test.js +142 -0
  281. package/lib/tests/materialized-reports/materialized-delivery-plan.test.d.ts +1 -0
  282. package/lib/tests/materialized-reports/materialized-delivery-plan.test.js +198 -0
  283. package/lib/tests/materialized-reports/materialized-discount-aggregated-formatter.test.d.ts +1 -0
  284. package/lib/tests/materialized-reports/materialized-discount-aggregated-formatter.test.js +173 -0
  285. package/lib/tests/materialized-reports/materialized-discount-classification.test.d.ts +1 -0
  286. package/lib/tests/materialized-reports/materialized-discount-classification.test.js +339 -0
  287. package/lib/tests/materialized-reports/materialized-discount-close-day.test.d.ts +1 -0
  288. package/lib/tests/materialized-reports/materialized-discount-close-day.test.js +506 -0
  289. package/lib/tests/materialized-reports/materialized-discount-compile.test.d.ts +1 -0
  290. package/lib/tests/materialized-reports/materialized-discount-compile.test.js +161 -0
  291. package/lib/tests/materialized-reports/materialized-discount-counter-rows.test.d.ts +1 -0
  292. package/lib/tests/materialized-reports/materialized-discount-counter-rows.test.js +107 -0
  293. package/lib/tests/materialized-reports/materialized-discount-entries-accumulation.test.d.ts +1 -0
  294. package/lib/tests/materialized-reports/materialized-discount-entries-accumulation.test.js +125 -0
  295. package/lib/tests/materialized-reports/materialized-hourly-comparison-compile.test.d.ts +1 -0
  296. package/lib/tests/materialized-reports/materialized-hourly-comparison-compile.test.js +146 -0
  297. package/lib/tests/materialized-reports/materialized-hourly-comparison-formatter.test.d.ts +1 -0
  298. package/lib/tests/materialized-reports/materialized-hourly-comparison-formatter.test.js +127 -0
  299. package/lib/tests/materialized-reports/materialized-hourly-comparison-plan.test.d.ts +1 -0
  300. package/lib/tests/materialized-reports/materialized-hourly-comparison-plan.test.js +138 -0
  301. package/lib/tests/materialized-reports/materialized-hourly-comparison-selection.test.d.ts +1 -0
  302. package/lib/tests/materialized-reports/materialized-hourly-comparison-selection.test.js +90 -0
  303. package/lib/tests/materialized-reports/materialized-payments-comparison-compile.test.d.ts +1 -0
  304. package/lib/tests/materialized-reports/materialized-payments-comparison-compile.test.js +164 -0
  305. package/lib/tests/materialized-reports/materialized-payments-comparison-formatter.test.d.ts +1 -0
  306. package/lib/tests/materialized-reports/materialized-payments-comparison-formatter.test.js +117 -0
  307. package/lib/tests/materialized-reports/materialized-payments-comparison-plan.test.d.ts +1 -0
  308. package/lib/tests/materialized-reports/materialized-payments-comparison-plan.test.js +149 -0
  309. package/lib/tests/materialized-reports/materialized-prep-time-classification.test.d.ts +1 -0
  310. package/lib/tests/materialized-reports/materialized-prep-time-classification.test.js +273 -0
  311. package/lib/tests/materialized-reports/materialized-prep-time-close-day.test.d.ts +1 -0
  312. package/lib/tests/materialized-reports/materialized-prep-time-close-day.test.js +271 -0
  313. package/lib/tests/materialized-reports/materialized-prep-time-compile.test.d.ts +1 -0
  314. package/lib/tests/materialized-reports/materialized-prep-time-compile.test.js +217 -0
  315. package/lib/tests/materialized-reports/materialized-prep-time-constants.test.d.ts +1 -0
  316. package/lib/tests/materialized-reports/materialized-prep-time-constants.test.js +84 -0
  317. package/lib/tests/materialized-reports/materialized-prep-time-plan.test.d.ts +1 -0
  318. package/lib/tests/materialized-reports/materialized-prep-time-plan.test.js +176 -0
  319. package/lib/tests/materialized-reports/materialized-reports-scope-group-helpers.test.js +13 -13
  320. package/lib/tests/materialized-reports/materialized-sales-comparison-baseline.test.d.ts +1 -0
  321. package/lib/tests/materialized-reports/materialized-sales-comparison-baseline.test.js +126 -0
  322. package/lib/tests/materialized-reports/materialized-sales-comparison-compile.test.d.ts +1 -0
  323. package/lib/tests/materialized-reports/materialized-sales-comparison-compile.test.js +207 -0
  324. package/lib/tests/materialized-reports/materialized-sales-comparison-formatter.test.d.ts +1 -0
  325. package/lib/tests/materialized-reports/materialized-sales-comparison-formatter.test.js +179 -0
  326. package/lib/tests/materialized-reports/materialized-sales-comparison-parity.test.d.ts +1 -0
  327. package/lib/tests/materialized-reports/materialized-sales-comparison-parity.test.js +196 -0
  328. package/lib/tests/materialized-reports/materialized-sales-comparison-plan.test.d.ts +1 -0
  329. package/lib/tests/materialized-reports/materialized-sales-comparison-plan.test.js +241 -0
  330. package/lib/tests/materialized-reports/materialized-tenant-hourly-comparison-schema.test.d.ts +1 -0
  331. package/lib/tests/materialized-reports/materialized-tenant-hourly-comparison-schema.test.js +96 -0
  332. package/lib/tests/materialized-reports/materialized-tenant-payments-comparison-schema.test.d.ts +1 -0
  333. package/lib/tests/materialized-reports/materialized-tenant-payments-comparison-schema.test.js +112 -0
  334. package/lib/tests/materialized-reports/materialized-tenant-sales-comparison-schema.test.d.ts +1 -0
  335. package/lib/tests/materialized-reports/materialized-tenant-sales-comparison-schema.test.js +142 -0
  336. package/lib/tests/materialized-reports/materialized-tenant-sales-overview-reports-schema.test.js +8 -1
  337. package/lib/tests/materialized-reports/sales-comparison-reference.d.ts +55 -0
  338. package/lib/tests/materialized-reports/sales-comparison-reference.js +86 -0
  339. package/lib/tests/materialized-reports/tenant-discount-formatter.test.d.ts +1 -0
  340. package/lib/tests/materialized-reports/tenant-discount-formatter.test.js +289 -0
  341. package/lib/tests/materialized-reports/tenant-prep-time-formatter.test.d.ts +1 -0
  342. package/lib/tests/materialized-reports/tenant-prep-time-formatter.test.js +354 -0
  343. package/lib/tests/reporting-contract.test.d.ts +1 -0
  344. package/lib/tests/reporting-contract.test.js +267 -0
  345. package/lib/tests/rider-daily-report.test.d.ts +1 -0
  346. package/lib/tests/rider-daily-report.test.js +86 -0
  347. package/lib/tests/rider-earnings.test.d.ts +1 -0
  348. package/lib/tests/rider-earnings.test.js +65 -0
  349. package/lib/tests/rider-report.test.d.ts +1 -0
  350. package/lib/tests/rider-report.test.js +98 -0
  351. package/package.json +10 -1
@@ -10,7 +10,8 @@
10
10
  * explicitly-enabled step.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.ALL_MATERIALIZED_REPORT_TYPES = exports.MATERIALIZED_REPORT_TYPE_ENUM = exports.ALL_MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPES = exports.MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = exports.MATERIALIZED_CREDIT_SETTLEMENT_PAYMENT_TYPE = exports.SALES_OVERVIEW_KEY_FILTERS = exports.ALL_MATERIALIZED_REPORT_KEY_FILTERS = exports.MATERIALIZED_REPORT_KEY_FILTER_ENUM = exports.MATERIALIZED_CREDIT_BILLS_SCOPES = exports.MATERIALIZED_REPORT_SCOPES_WITH_DAY_INDEX = exports.ALL_MATERIALIZED_REPORT_SCOPES = exports.MATERIALIZED_REPORT_SCOPE_ENUM = void 0;
13
+ exports.MATERIALIZED_SALES_COMPARISON_REPORT_SCOPES = exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME = exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME = exports.ALL_MATERIALIZED_REPORT_TYPES = exports.MATERIALIZED_REPORT_TYPE_ENUM = exports.ALL_MATERIALIZED_PREP_TIME_TARGETS = exports.MATERIALIZED_PREP_TIME_TARGET_ENUM = exports.MATERIALIZED_PREP_TIME_ON_TIME_MAX_DELTA = exports.MATERIALIZED_PREP_TIME_TOP_BUCKET = exports.MATERIALIZED_PREP_TIME_MAX_MINUTES = exports.ALL_MATERIALIZED_PREP_TIME_BUCKET_LABELS = exports.MATERIALIZED_PREP_TIME_BUCKETS = exports.ALL_MATERIALIZED_PREP_TIME_ANCHORS = exports.MATERIALIZED_PREP_TIME_ANCHOR_ENUM = exports.PREP_TIME_KEY_FILTERS = exports.MATERIALIZED_PREP_TIME_REPORT_SCOPES = exports.MATERIALIZED_DELIVERY_AREA_LIMIT = exports.MATERIALIZED_DELIVERY_RIDER_LIMIT = exports.MATERIALIZED_DELIVERY_DISTANCE_BUCKETS = exports.DELIVERY_KEY_FILTERS = exports.MATERIALIZED_DELIVERY_REPORT_SCOPES = exports.MATERIALIZED_CASH_SOURCE_LIMIT = exports.CASH_KEY_FILTERS = exports.MATERIALIZED_CASH_REPORT_SCOPES = exports.ALL_MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPES = exports.MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = exports.MATERIALIZED_CREDIT_SETTLEMENT_PAYMENT_TYPE = exports.MATERIALIZED_DISCOUNT_PRICE_OVERRIDE_PREFIX = exports.MATERIALIZED_DISCOUNT_MANUAL_PREFIX = exports.MATERIALIZED_DISCOUNT_SPECIAL_DISCOUNT_ID = exports.MATERIALIZED_DISCOUNT_SOURCE_LIMIT = exports.ALL_MATERIALIZED_DISCOUNT_LEVELS = exports.MATERIALIZED_DISCOUNT_LEVEL_ENUM = exports.ALL_MATERIALIZED_DISCOUNT_ENTRY_KINDS = exports.MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM = exports.ALL_MATERIALIZED_DISCOUNT_SUB_KINDS = exports.MATERIALIZED_DISCOUNT_SUB_KIND_ENUM = exports.ALL_MATERIALIZED_DISCOUNT_SLOTS = exports.MATERIALIZED_DISCOUNT_SLOT_ENUM = exports.DISCOUNTS_KEY_FILTERS = exports.MATERIALIZED_DISCOUNT_REPORT_SCOPES = exports.SALES_OVERVIEW_KEY_FILTERS = exports.ALL_MATERIALIZED_REPORT_KEY_FILTERS = exports.MATERIALIZED_REPORT_KEY_FILTER_ENUM = exports.MATERIALIZED_CREDIT_BILLS_SCOPES = exports.MATERIALIZED_REPORT_SCOPES_WITH_DAY_INDEX = exports.ALL_MATERIALIZED_REPORT_WINDOW_KINDS = exports.MATERIALIZED_REPORT_WINDOW_KIND_ENUM = exports.ALL_MATERIALIZED_REPORT_SCOPES = exports.MATERIALIZED_REPORT_SCOPE_ENUM = void 0;
14
+ exports.ALL_PAYMENTS_COMPARISON_METRICS = exports.PAYMENTS_COMPARISON_METRIC_ENUM = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_SCHEMA_VERSION = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_SCHEMA_VERSION = exports.PAYMENTS_COMPARISON_KEY_FILTERS = exports.MATERIALIZED_PAYMENTS_COMPARISON_REPORT_SCOPES = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME = exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_SCHEMA_VERSION = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_SCHEMA_VERSION = exports.HOURLY_COMPARISON_KEY_FILTERS = exports.MATERIALIZED_HOURLY_COMPARISON_REPORT_SCOPES = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME = exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME = exports.ALL_SALES_COMPARISON_METRICS = exports.SALES_COMPARISON_METRIC_ENUM = exports.ALL_SALES_COMPARISON_BASELINES = exports.SALES_COMPARISON_BASELINE_ENUM = exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_SCHEMA_VERSION = exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_SCHEMA_VERSION = exports.SALES_COMPARISON_KEY_FILTERS = void 0;
14
15
  /**
15
16
  * Time-scope of a materialized report document. Every document covers exactly
16
17
  * one tenant × one scope context × one scope value (`scope_field`), and the
@@ -55,6 +56,13 @@ var MATERIALIZED_REPORT_SCOPE_ENUM;
55
56
  MATERIALIZED_REPORT_SCOPE_ENUM["LOCAL_YEAR"] = "localYear";
56
57
  })(MATERIALIZED_REPORT_SCOPE_ENUM || (exports.MATERIALIZED_REPORT_SCOPE_ENUM = MATERIALIZED_REPORT_SCOPE_ENUM = {}));
57
58
  exports.ALL_MATERIALIZED_REPORT_SCOPES = Object.values(MATERIALIZED_REPORT_SCOPE_ENUM);
59
+ /** Time-window refinement used when compiling/reading a report scope. */
60
+ var MATERIALIZED_REPORT_WINDOW_KIND_ENUM;
61
+ (function (MATERIALIZED_REPORT_WINDOW_KIND_ENUM) {
62
+ MATERIALIZED_REPORT_WINDOW_KIND_ENUM["RECURRING"] = "RECURRING";
63
+ MATERIALIZED_REPORT_WINDOW_KIND_ENUM["SPAN"] = "SPAN";
64
+ })(MATERIALIZED_REPORT_WINDOW_KIND_ENUM || (exports.MATERIALIZED_REPORT_WINDOW_KIND_ENUM = MATERIALIZED_REPORT_WINDOW_KIND_ENUM = {}));
65
+ exports.ALL_MATERIALIZED_REPORT_WINDOW_KINDS = Object.values(MATERIALIZED_REPORT_WINDOW_KIND_ENUM);
58
66
  /**
59
67
  * Scopes whose documents carry the denormalized `day_index` weekday field
60
68
  * (derived from `scope_field` by the materializer, `DAY_INDEX_ENUM`). All
@@ -92,6 +100,20 @@ var MATERIALIZED_REPORT_KEY_FILTER_ENUM;
92
100
  (function (MATERIALIZED_REPORT_KEY_FILTER_ENUM) {
93
101
  MATERIALIZED_REPORT_KEY_FILTER_ENUM["ORDER_STATUS"] = "ORDER_STATUS";
94
102
  MATERIALIZED_REPORT_KEY_FILTER_ENUM["PLATFORM"] = "PLATFORM";
103
+ // Cash in/out (M3) has neither an order status nor a platform - its two
104
+ // operator questions are "which drawer" and "what kind of movement", so the
105
+ // cash report encodes <DRAWER_ID>:<REF_TYPE> instead. Adding members here is
106
+ // additive: the envelope merely declares which dimensions a key encodes.
107
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["DRAWER_ID"] = "DRAWER_ID";
108
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["REF_TYPE"] = "REF_TYPE";
109
+ // Delivery (M4) encodes <PLATFORM>:<CITY>, both joined from the ORDER - a delivery
110
+ // document carries neither, so the report joins by order_id and keys on the
111
+ // order's dimensions. CITY is a new dimension here.
112
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["CITY"] = "CITY";
113
+ // Payments Comparison encodes <PAYMENT_METHOD>:<ORDER_STATUS>. The method is an
114
+ // OPEN string (live stores carry values outside the enum) and is normalized only
115
+ // for the PAY_LATER -> UNPAID remap.
116
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM["PAYMENT_METHOD"] = "PAYMENT_METHOD";
95
117
  })(MATERIALIZED_REPORT_KEY_FILTER_ENUM || (exports.MATERIALIZED_REPORT_KEY_FILTER_ENUM = MATERIALIZED_REPORT_KEY_FILTER_ENUM = {}));
96
118
  exports.ALL_MATERIALIZED_REPORT_KEY_FILTERS = Object.values(MATERIALIZED_REPORT_KEY_FILTER_ENUM);
97
119
  /** Ordered key filters of the tenant sales overview report (`PLACED:POS_WALK-IN`). */
@@ -99,6 +121,112 @@ exports.SALES_OVERVIEW_KEY_FILTERS = [
99
121
  MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
100
122
  MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
101
123
  ];
124
+ /* ======================================================================== */
125
+ /* Discounts report (M1) */
126
+ /* ======================================================================== */
127
+ /**
128
+ * Scopes materialized by `materialized_tenant_discount_reports` — the same
129
+ * month-capped set as the credit ledger, for the same reason: the itemized
130
+ * discount rows live in the SIBLING entries collection
131
+ * (`materialized_tenant_discount_entries`), capped at `LOCAL_MONTH` so a
132
+ * document can never grow unboundedly.
133
+ *
134
+ * The report documents themselves are COUNTERS ONLY (see
135
+ * `schemas/types/materialized_tenant_discount_reports.ts`).
136
+ */
137
+ exports.MATERIALIZED_DISCOUNT_REPORT_SCOPES = [
138
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_HOUR,
139
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
140
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
141
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
142
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
143
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
144
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
145
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
146
+ ];
147
+ /** Ordered key filters of the discounts report (`COMPLETED:POS_WALK-IN`). */
148
+ exports.DISCOUNTS_KEY_FILTERS = [
149
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
150
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
151
+ ];
152
+ /**
153
+ * Discount SLOT of one row — mirrors the three slots of the order/item
154
+ * `IDiscountDetails` (`special_`, `loyalty_`, `voucher_`).
155
+ */
156
+ var MATERIALIZED_DISCOUNT_SLOT_ENUM;
157
+ (function (MATERIALIZED_DISCOUNT_SLOT_ENUM) {
158
+ MATERIALIZED_DISCOUNT_SLOT_ENUM["SPECIAL"] = "SPECIAL";
159
+ MATERIALIZED_DISCOUNT_SLOT_ENUM["LOYALTY"] = "LOYALTY";
160
+ MATERIALIZED_DISCOUNT_SLOT_ENUM["VOUCHER"] = "VOUCHER";
161
+ })(MATERIALIZED_DISCOUNT_SLOT_ENUM || (exports.MATERIALIZED_DISCOUNT_SLOT_ENUM = MATERIALIZED_DISCOUNT_SLOT_ENUM = {}));
162
+ exports.ALL_MATERIALIZED_DISCOUNT_SLOTS = Object.values(MATERIALIZED_DISCOUNT_SLOT_ENUM);
163
+ /**
164
+ * Sub-kind of a discount row, derived from the slot's ID SHAPE (the only
165
+ * discriminator the write path stores — verified against live fixtures):
166
+ *
167
+ * - `COLLECTION` — `special_discount_id` is a 24-hex ObjectId (a
168
+ * `discounts` collection document).
169
+ * - `MANUAL` — id starts `MANUAL_` (quick % / custom amount /
170
+ * payment-type discounts). NOT `MANUAL_SINGLE_`.
171
+ * - `PRICE_OVERRIDE` — id starts `MANUAL_SINGLE_` (item price override).
172
+ * - `CATALOG_ITEM` — id is an item id or `SPECIAL_DISCOUNT` (a catalog
173
+ * item's own configured discount).
174
+ * - `OFFER` — loyalty/voucher slot whose id is an offer ObjectId.
175
+ * - `GIFT_CARD` — loyalty slot whose id is a gift-card ObjectId (the
176
+ * reference number carries the code).
177
+ * - `WALLET_CASHBACK` — the sentinel id `wallet_cashback_redemption`.
178
+ * - `UNATTRIBUTED` — no usable slot id, or order-level money the slots
179
+ * cannot explain (see the counter type).
180
+ */
181
+ var MATERIALIZED_DISCOUNT_SUB_KIND_ENUM;
182
+ (function (MATERIALIZED_DISCOUNT_SUB_KIND_ENUM) {
183
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["COLLECTION"] = "COLLECTION";
184
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["MANUAL"] = "MANUAL";
185
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["PRICE_OVERRIDE"] = "PRICE_OVERRIDE";
186
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["CATALOG_ITEM"] = "CATALOG_ITEM";
187
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["OFFER"] = "OFFER";
188
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["GIFT_CARD"] = "GIFT_CARD";
189
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["WALLET_CASHBACK"] = "WALLET_CASHBACK";
190
+ MATERIALIZED_DISCOUNT_SUB_KIND_ENUM["UNATTRIBUTED"] = "UNATTRIBUTED";
191
+ })(MATERIALIZED_DISCOUNT_SUB_KIND_ENUM || (exports.MATERIALIZED_DISCOUNT_SUB_KIND_ENUM = MATERIALIZED_DISCOUNT_SUB_KIND_ENUM = {}));
192
+ exports.ALL_MATERIALIZED_DISCOUNT_SUB_KINDS = Object.values(MATERIALIZED_DISCOUNT_SUB_KIND_ENUM);
193
+ /**
194
+ * Kind of one itemized discount row in
195
+ * `materialized_tenant_discount_entries`.
196
+ *
197
+ * - `DISCOUNT` — a slot on the order or on one item.
198
+ * - `FREE_ITEM` — a 100 % item row (also present as a `DISCOUNT` row; the
199
+ * drill-down decides which view lists it).
200
+ * - `COMPLIMENTARY` — a `COMPLIMENTARY` payment (no discount slot required).
201
+ */
202
+ var MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM;
203
+ (function (MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM) {
204
+ MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM["DISCOUNT"] = "DISCOUNT";
205
+ MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM["FREE_ITEM"] = "FREE_ITEM";
206
+ MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM["COMPLIMENTARY"] = "COMPLIMENTARY";
207
+ })(MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM || (exports.MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM = MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM = {}));
208
+ exports.ALL_MATERIALIZED_DISCOUNT_ENTRY_KINDS = Object.values(MATERIALIZED_DISCOUNT_ENTRY_KIND_ENUM);
209
+ /** Level a discount applies at — the order, one item, or a payment. */
210
+ var MATERIALIZED_DISCOUNT_LEVEL_ENUM;
211
+ (function (MATERIALIZED_DISCOUNT_LEVEL_ENUM) {
212
+ MATERIALIZED_DISCOUNT_LEVEL_ENUM["ORDER"] = "ORDER";
213
+ MATERIALIZED_DISCOUNT_LEVEL_ENUM["ITEM"] = "ITEM";
214
+ MATERIALIZED_DISCOUNT_LEVEL_ENUM["PAYMENT"] = "PAYMENT";
215
+ })(MATERIALIZED_DISCOUNT_LEVEL_ENUM || (exports.MATERIALIZED_DISCOUNT_LEVEL_ENUM = MATERIALIZED_DISCOUNT_LEVEL_ENUM = {}));
216
+ exports.ALL_MATERIALIZED_DISCOUNT_LEVELS = Object.values(MATERIALIZED_DISCOUNT_LEVEL_ENUM);
217
+ /**
218
+ * Cap of a discount report document's `top_sources` leaderboard. Display-only:
219
+ * every number in that list is also derivable from `discount_counters`, so a
220
+ * truncated list can never change a total.
221
+ */
222
+ exports.MATERIALIZED_DISCOUNT_SOURCE_LIMIT = 12;
223
+ /**
224
+ * The gift-card / wallet sentinel ids the toolkit writes into discount slots.
225
+ * Kept here so the classifier and the writers cannot drift apart.
226
+ */
227
+ exports.MATERIALIZED_DISCOUNT_SPECIAL_DISCOUNT_ID = 'SPECIAL_DISCOUNT';
228
+ exports.MATERIALIZED_DISCOUNT_MANUAL_PREFIX = 'MANUAL_';
229
+ exports.MATERIALIZED_DISCOUNT_PRICE_OVERRIDE_PREFIX = 'MANUAL_SINGLE_';
102
230
  /**
103
231
  * Payment-type label used by the frontend report formatter for the derived
104
232
  * credit-settlement line in a collection day's payments breakdown (a
@@ -125,6 +253,189 @@ var MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM;
125
253
  MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM["WRITE_OFF"] = "WRITE_OFF";
126
254
  })(MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM || (exports.MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM = {}));
127
255
  exports.ALL_MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPES = Object.values(MATERIALIZED_REPORT_CREDIT_BILL_EVENT_TYPE_ENUM);
256
+ /* ======================================================================== */
257
+ /* Cash in/out report (M3) */
258
+ /* ======================================================================== */
259
+ /**
260
+ * Scopes materialized by `materialized_tenant_cash_in_out_reports`.
261
+ *
262
+ * NO `localHour`: cash is a close-of-shift concern, the same reasoning that keeps
263
+ * the hour scope out of the prep time report. Day + periods, capped at
264
+ * `LOCAL_MONTH` because the statement rows live in the SIBLING entries collection
265
+ * (`materialized_tenant_cash_in_out_entries`).
266
+ */
267
+ exports.MATERIALIZED_CASH_REPORT_SCOPES = [
268
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
269
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
270
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
271
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
272
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
273
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
274
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
275
+ ];
276
+ /**
277
+ * Ordered key filters of the cash report - `<DRAWER_ID>:<REF_TYPE>` (decision
278
+ * (b3)). Shift ids are deliberately NOT a key dimension: they are
279
+ * high-cardinality and belong in a breakdown table, not in the key.
280
+ */
281
+ exports.CASH_KEY_FILTERS = [
282
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.DRAWER_ID,
283
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.REF_TYPE,
284
+ ];
285
+ /** Cap of the per-document drawer leaderboard (bounded, display-only). */
286
+ exports.MATERIALIZED_CASH_SOURCE_LIMIT = 12;
287
+ /* ======================================================================== */
288
+ /* Delivery report (M4) */
289
+ /* ======================================================================== */
290
+ /**
291
+ * Scopes materialized by `materialized_tenant_delivery_reports`.
292
+ *
293
+ * NO `localHour`: the hour dimension appears as an AREA HEAT MAP inside the document
294
+ * (`areas[city].by_hour`), which is the shape the page actually renders. Materializing
295
+ * a full hour scope as well would multiply documents for a view nobody opens.
296
+ */
297
+ exports.MATERIALIZED_DELIVERY_REPORT_SCOPES = [
298
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
299
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
300
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
301
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
302
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
303
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
304
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
305
+ ];
306
+ /**
307
+ * Ordered key filters of the delivery report - `<PLATFORM>:<CITY>` (decision (b4)).
308
+ *
309
+ * Rider is deliberately NOT a key dimension: rider ids are high-cardinality, so rider
310
+ * analysis is a bounded `riders` map INSIDE each document rather than a partition of
311
+ * the key space.
312
+ */
313
+ exports.DELIVERY_KEY_FILTERS = [
314
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
315
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.CITY,
316
+ ];
317
+ /**
318
+ * Distance histogram of the delivery report, in METRES: inclusive lower, EXCLUSIVE
319
+ * upper, with an open-ended top bucket.
320
+ *
321
+ * Fixed buckets rather than a raw array, for the same reason as the prep time report: a
322
+ * bounded shape keeps a document small and makes a period fold exact.
323
+ */
324
+ exports.MATERIALIZED_DELIVERY_DISTANCE_BUCKETS = [
325
+ { key: 'under_2km', min: 0, max: 2000 },
326
+ { key: 'between_2_5km', min: 2000, max: 5000 },
327
+ { key: 'between_5_10km', min: 5000, max: 10000 },
328
+ { key: 'between_10_15km', min: 10000, max: 15000 },
329
+ { key: 'between_15_25km', min: 15000, max: 25000 },
330
+ { key: 'over_25km', min: 25000, max: null },
331
+ ];
332
+ /** Cap of the per-document rider leaderboard (bounded, display-only). */
333
+ exports.MATERIALIZED_DELIVERY_RIDER_LIMIT = 50;
334
+ /** Cap of the per-document area leaderboard (bounded, display-only). */
335
+ exports.MATERIALIZED_DELIVERY_AREA_LIMIT = 50;
336
+ /* ======================================================================== */
337
+ /* Prep time report (M2) */
338
+ /* ======================================================================== */
339
+ /**
340
+ * Scopes materialized by `materialized_tenant_prep_time_reports`.
341
+ *
342
+ * NO `localHour` (decision h2): the tracked population per hour is 2-3 items in
343
+ * the dev stores, so an hourly prep time would be noise. Day + periods only,
344
+ * capped at `LOCAL_MONTH` because the itemized rows live in the SIBLING entries
345
+ * collection (`materialized_tenant_prep_time_entries`).
346
+ */
347
+ exports.MATERIALIZED_PREP_TIME_REPORT_SCOPES = [
348
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
349
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
350
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK_OF_YEAR,
351
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
352
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
353
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
354
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
355
+ ];
356
+ /** Ordered key filters of the prep time report (`COMPLETED:POS_WALK-IN`). */
357
+ exports.PREP_TIME_KEY_FILTERS = [
358
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
359
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
360
+ ];
361
+ /**
362
+ * ANCHOR PROVENANCE of one tracked item - the split that makes this report
363
+ * correct (decision b2, section 3.2.1 of the concept doc).
364
+ *
365
+ * `ready_minutes` is written from the chain
366
+ * `prep_started_at ?? order_status_updated_at ?? createdAt`, and the two
367
+ * populations behave completely differently:
368
+ *
369
+ * - MEASURED - `prep_started_at` AND `ready_minutes` both present. The item owns
370
+ * its prep clock, so the ready instant is reconstructible
371
+ * (`prep_started_at + ready_minutes`). Two independent stores AGREE here
372
+ * (avg ~9.3 min, median 5-8, p90 23, ~30% instant).
373
+ * - UNMEASURED - everything else, including `ready_minutes` with NO
374
+ * `prep_started_at`: the anchor fell back to the order stage and the value is
375
+ * degenerate (bruzo: avg 0.0, 99.8% zeros). Counted in COVERAGE only.
376
+ *
377
+ * Blending them under-reports the average by ~13x in the store with the MOST
378
+ * data (0.7 vs 9.2 min) - the single mistake this design exists to prevent.
379
+ */
380
+ var MATERIALIZED_PREP_TIME_ANCHOR_ENUM;
381
+ (function (MATERIALIZED_PREP_TIME_ANCHOR_ENUM) {
382
+ MATERIALIZED_PREP_TIME_ANCHOR_ENUM["MEASURED"] = "MEASURED";
383
+ MATERIALIZED_PREP_TIME_ANCHOR_ENUM["UNMEASURED"] = "UNMEASURED";
384
+ })(MATERIALIZED_PREP_TIME_ANCHOR_ENUM || (exports.MATERIALIZED_PREP_TIME_ANCHOR_ENUM = MATERIALIZED_PREP_TIME_ANCHOR_ENUM = {}));
385
+ exports.ALL_MATERIALIZED_PREP_TIME_ANCHORS = Object.values(MATERIALIZED_PREP_TIME_ANCHOR_ENUM);
386
+ /**
387
+ * Fixed duration histogram of the MEASURED bucket, in minutes.
388
+ *
389
+ * A fixed histogram (decision d2) keeps documents small and is exactly what the
390
+ * UI renders; `median` / `p90` are derived from it and are therefore
391
+ * BUCKET-APPROXIMATE (the exact `avg` comes from `sum / count`). Storing every
392
+ * duration to get exact percentiles is the expensive option this avoids.
393
+ */
394
+ exports.MATERIALIZED_PREP_TIME_BUCKETS = [
395
+ { label: '0', min: 0, max: 0 },
396
+ { label: '1-5', min: 1, max: 5 },
397
+ { label: '6-10', min: 6, max: 10 },
398
+ { label: '11-15', min: 11, max: 15 },
399
+ { label: '16-30', min: 16, max: 30 },
400
+ { label: '31-60', min: 31, max: 60 },
401
+ { label: '60+', min: 61, max: null },
402
+ ];
403
+ exports.ALL_MATERIALIZED_PREP_TIME_BUCKET_LABELS = exports.MATERIALIZED_PREP_TIME_BUCKETS.map((bucket) => bucket.label);
404
+ /**
405
+ * Longest prep duration (minutes) trusted as a real prep time. A stored
406
+ * `ready_minutes` beyond this is a clock/backfill artefact rather than a prep
407
+ * time, so it still lands in the top bucket (the counts stay honest) but is kept
408
+ * out of `sum` / `min` / `max` - the same defensive posture the other reports
409
+ * take with outlier inputs.
410
+ */
411
+ exports.MATERIALIZED_PREP_TIME_MAX_MINUTES = 60 * 24;
412
+ /** Label of the top histogram bucket (everything at or above its `min`). */
413
+ exports.MATERIALIZED_PREP_TIME_TOP_BUCKET = '60+';
414
+ /**
415
+ * On-time tolerance (decision f2): ready instant <= target counts as ON TIME
416
+ * (`delta <= 0`) for v1. The signed `delta_sum` is kept so a grace window can be
417
+ * applied later WITHOUT re-materializing.
418
+ */
419
+ exports.MATERIALIZED_PREP_TIME_ON_TIME_MAX_DELTA = 0;
420
+ /**
421
+ * WHERE an item's on-time target came from (decision e2).
422
+ *
423
+ * Promise-only grading would leave 63-97% of items ungraded (measured: only
424
+ * 2.7% / 36.2% of orders carry an explicit estimate), so an item with no promise
425
+ * is graded against the TENANT DEFAULT - the documented
426
+ * `getDeliveryExpectedTime` fallback chain. The baseline is labelled per row so
427
+ * a reader can always tell the two apart.
428
+ */
429
+ var MATERIALIZED_PREP_TIME_TARGET_ENUM;
430
+ (function (MATERIALIZED_PREP_TIME_TARGET_ENUM) {
431
+ /** The order carried an explicit estimate. */
432
+ MATERIALIZED_PREP_TIME_TARGET_ENUM["PROMISE"] = "PROMISE";
433
+ /** The order was ASAP and is graded against the tenant default. */
434
+ MATERIALIZED_PREP_TIME_TARGET_ENUM["TENANT_DEFAULT"] = "TENANT_DEFAULT";
435
+ /** Neither exists - the row cannot be graded. */
436
+ MATERIALIZED_PREP_TIME_TARGET_ENUM["NONE"] = "NONE";
437
+ })(MATERIALIZED_PREP_TIME_TARGET_ENUM || (exports.MATERIALIZED_PREP_TIME_TARGET_ENUM = MATERIALIZED_PREP_TIME_TARGET_ENUM = {}));
438
+ exports.ALL_MATERIALIZED_PREP_TIME_TARGETS = Object.values(MATERIALIZED_PREP_TIME_TARGET_ENUM);
128
439
  /**
129
440
  * Materialized report kinds — the discriminator stored on
130
441
  * `materialized_tenant_reports_iterations` rows. A single shared history collection records
@@ -137,5 +448,150 @@ var MATERIALIZED_REPORT_TYPE_ENUM;
137
448
  (function (MATERIALIZED_REPORT_TYPE_ENUM) {
138
449
  MATERIALIZED_REPORT_TYPE_ENUM["TENANT_SALES_OVERVIEW"] = "TENANT_SALES_OVERVIEW";
139
450
  MATERIALIZED_REPORT_TYPE_ENUM["TENANT_CREDIT_BILLS"] = "TENANT_CREDIT_BILLS";
451
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DISCOUNT_REPORTS"] = "TENANT_DISCOUNT_REPORTS";
452
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DISCOUNT_ENTRIES"] = "TENANT_DISCOUNT_ENTRIES";
453
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PREP_TIME_REPORTS"] = "TENANT_PREP_TIME_REPORTS";
454
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PREP_TIME_ENTRIES"] = "TENANT_PREP_TIME_ENTRIES";
455
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_CASH_REPORTS"] = "TENANT_CASH_REPORTS";
456
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_CASH_ENTRIES"] = "TENANT_CASH_ENTRIES";
457
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DELIVERY_REPORTS"] = "TENANT_DELIVERY_REPORTS";
458
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_DELIVERY_ENTRIES"] = "TENANT_DELIVERY_ENTRIES";
459
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_SALES_COMPARISON_REPORTS"] = "TENANT_SALES_COMPARISON_REPORTS";
460
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_SALES_COMPARISON_ENTRIES"] = "TENANT_SALES_COMPARISON_ENTRIES";
461
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_HOURLY_COMPARISON_REPORTS"] = "TENANT_HOURLY_COMPARISON_REPORTS";
462
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_HOURLY_COMPARISON_ENTRIES"] = "TENANT_HOURLY_COMPARISON_ENTRIES";
463
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PAYMENTS_COMPARISON_REPORTS"] = "TENANT_PAYMENTS_COMPARISON_REPORTS";
464
+ MATERIALIZED_REPORT_TYPE_ENUM["TENANT_PAYMENTS_COMPARISON_ENTRIES"] = "TENANT_PAYMENTS_COMPARISON_ENTRIES";
140
465
  })(MATERIALIZED_REPORT_TYPE_ENUM || (exports.MATERIALIZED_REPORT_TYPE_ENUM = MATERIALIZED_REPORT_TYPE_ENUM = {}));
141
466
  exports.ALL_MATERIALIZED_REPORT_TYPES = Object.values(MATERIALIZED_REPORT_TYPE_ENUM);
467
+ /* =====================> Sales Comparison report <===================== */
468
+ /**
469
+ * Sales Comparison (see console/admin-panel/docs/report-sales-comparison-concept.md).
470
+ *
471
+ * A REPORT, not Analytics: it lives under Reports - New -> Comparisons and its numbers are
472
+ * decimal-exact. The comparison itself is never stored - `current` and `comparison` are two
473
+ * ordinary reads, subtracted in the formatter.
474
+ *
475
+ * Fixes no time bias: a complete business day (localDate) is the anchor, because the day
476
+ * close defines it. A range-based bias is meaningless once the business day exists.
477
+ */
478
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_COLLECTION_NAME = 'materialized_tenant_sales_comparison_reports';
479
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_COLLECTION_NAME = 'materialized_tenant_sales_comparison_entries';
480
+ /** Six grains. NO ISO week (owner decision) and NO hour - this is not the hourly report. */
481
+ exports.MATERIALIZED_SALES_COMPARISON_REPORT_SCOPES = [
482
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
483
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
484
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
485
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
486
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
487
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
488
+ ];
489
+ /** Key grammar: `COMPLETED:POS_DINE-IN`. No sale-type dimension (owner decision). */
490
+ exports.SALES_COMPARISON_KEY_FILTERS = [
491
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
492
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
493
+ ];
494
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_REPORTS_SCHEMA_VERSION = 1;
495
+ exports.MATERIALIZED_TENANT_SALES_COMPARISON_ENTRIES_SCHEMA_VERSION = 1;
496
+ /**
497
+ * The baseline a Sales Comparison read is compared against (owner decision:
498
+ * Toast/Square behaviour). The user picks ONE range; the comparison range is
499
+ * DERIVED server-side:
500
+ * - `NONE` — no comparison series;
501
+ * - `PREVIOUS_PERIOD` — an EQUAL-LENGTH range immediately preceding the primary
502
+ * range (never "the previous calendar month" — that is the classic
503
+ * off-by-one-day bug);
504
+ * - `PREVIOUS_YEAR` — the primary range shifted back 12 months, same length.
505
+ */
506
+ var SALES_COMPARISON_BASELINE_ENUM;
507
+ (function (SALES_COMPARISON_BASELINE_ENUM) {
508
+ SALES_COMPARISON_BASELINE_ENUM["NONE"] = "NONE";
509
+ SALES_COMPARISON_BASELINE_ENUM["PREVIOUS_PERIOD"] = "PREVIOUS_PERIOD";
510
+ SALES_COMPARISON_BASELINE_ENUM["PREVIOUS_YEAR"] = "PREVIOUS_YEAR";
511
+ })(SALES_COMPARISON_BASELINE_ENUM || (exports.SALES_COMPARISON_BASELINE_ENUM = SALES_COMPARISON_BASELINE_ENUM = {}));
512
+ exports.ALL_SALES_COMPARISON_BASELINES = Object.values(SALES_COMPARISON_BASELINE_ENUM);
513
+ /**
514
+ * The metric the page charts / headlines (concept §9, `Select Field`).
515
+ *
516
+ * CLIENT-SIDE ONLY: the document already carries every additive counter, so
517
+ * changing this selection must NOT refetch. `AVERAGE_TICKET` is DERIVED
518
+ * (`net_amount / order_count`) and is never stored.
519
+ */
520
+ var SALES_COMPARISON_METRIC_ENUM;
521
+ (function (SALES_COMPARISON_METRIC_ENUM) {
522
+ SALES_COMPARISON_METRIC_ENUM["NET_SALES"] = "NET_SALES";
523
+ SALES_COMPARISON_METRIC_ENUM["GROSS_SALES"] = "GROSS_SALES";
524
+ SALES_COMPARISON_METRIC_ENUM["DISCOUNTS"] = "DISCOUNTS";
525
+ SALES_COMPARISON_METRIC_ENUM["ORDER_COUNT"] = "ORDER_COUNT";
526
+ SALES_COMPARISON_METRIC_ENUM["AVERAGE_TICKET"] = "AVERAGE_TICKET";
527
+ SALES_COMPARISON_METRIC_ENUM["ITEMS_SOLD"] = "ITEMS_SOLD";
528
+ })(SALES_COMPARISON_METRIC_ENUM || (exports.SALES_COMPARISON_METRIC_ENUM = SALES_COMPARISON_METRIC_ENUM = {}));
529
+ exports.ALL_SALES_COMPARISON_METRICS = Object.values(SALES_COMPARISON_METRIC_ENUM);
530
+ /* =====================> Hourly Comparison report <===================== */
531
+ /**
532
+ * Hourly Comparison (see console/admin-panel/docs/report-hourly-comparison-concept.md).
533
+ *
534
+ * ONE hourly PROFILE compared against the same profile in a derived baseline range
535
+ * (decision A: one profile pair, not a per-day matrix). The comparison is never stored -
536
+ * `current` and `comparison` are two ordinary reads of HOUR documents, aligned and
537
+ * subtracted in the formatter.
538
+ *
539
+ * Anchor: `order_settled_at` -> the tenant-local settled day AND hour. No time bias.
540
+ *
541
+ * No period documents are written: the profile read only needs hour buckets. The period
542
+ * comparison report already owns the day/period materialization.
543
+ */
544
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_COLLECTION_NAME = 'materialized_tenant_hourly_comparison_reports';
545
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_COLLECTION_NAME = 'materialized_tenant_hourly_comparison_entries';
546
+ /** Hour documents only. This is an HOURLY report; no day or period documents. */
547
+ exports.MATERIALIZED_HOURLY_COMPARISON_REPORT_SCOPES = [
548
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_HOUR,
549
+ ];
550
+ /** The same key grammar as Sales Comparison: `COMPLETED:POS_DINE-IN`. */
551
+ exports.HOURLY_COMPARISON_KEY_FILTERS = [
552
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
553
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PLATFORM,
554
+ ];
555
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_REPORTS_SCHEMA_VERSION = 1;
556
+ exports.MATERIALIZED_TENANT_HOURLY_COMPARISON_ENTRIES_SCHEMA_VERSION = 1;
557
+ /* =====================> Payments Comparison report <===================== */
558
+ /**
559
+ * Payments Comparison (see console/admin-panel/docs/report-payments-comparison-concept.md).
560
+ *
561
+ * Payment ROWS, not orders: a split order contributes one row per payment, so this
562
+ * report can never be merged with Sales Comparison (which sums orders). The key is
563
+ * `<PAYMENT_METHOD>:<ORDER_STATUS>` (decision B); the method is the normalized,
564
+ * OPEN-string payment type.
565
+ */
566
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_COLLECTION_NAME = 'materialized_tenant_payments_comparison_reports';
567
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_COLLECTION_NAME = 'materialized_tenant_payments_comparison_entries';
568
+ /** The same six comparison grains; no hour / ISO week. */
569
+ exports.MATERIALIZED_PAYMENTS_COMPARISON_REPORT_SCOPES = [
570
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_DATE,
571
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_WEEK,
572
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_MONTH,
573
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_QUARTER,
574
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_SEMESTER,
575
+ MATERIALIZED_REPORT_SCOPE_ENUM.LOCAL_YEAR,
576
+ ];
577
+ /** Ordered key filters: `<PAYMENT_METHOD>:<ORDER_STATUS>`. */
578
+ exports.PAYMENTS_COMPARISON_KEY_FILTERS = [
579
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.PAYMENT_METHOD,
580
+ MATERIALIZED_REPORT_KEY_FILTER_ENUM.ORDER_STATUS,
581
+ ];
582
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_REPORTS_SCHEMA_VERSION = 1;
583
+ exports.MATERIALIZED_TENANT_PAYMENTS_COMPARISON_ENTRIES_SCHEMA_VERSION = 1;
584
+ /**
585
+ * The metric the Payments Comparison page charts (client-side).
586
+ * `AVERAGE_PAYMENT` is derived (`payment_amount / payment_count`), never stored.
587
+ */
588
+ var PAYMENTS_COMPARISON_METRIC_ENUM;
589
+ (function (PAYMENTS_COMPARISON_METRIC_ENUM) {
590
+ PAYMENTS_COMPARISON_METRIC_ENUM["PAYMENT_AMOUNT"] = "PAYMENT_AMOUNT";
591
+ PAYMENTS_COMPARISON_METRIC_ENUM["PAYMENT_COUNT"] = "PAYMENT_COUNT";
592
+ PAYMENTS_COMPARISON_METRIC_ENUM["AVERAGE_PAYMENT"] = "AVERAGE_PAYMENT";
593
+ PAYMENTS_COMPARISON_METRIC_ENUM["CARD_CHARGES"] = "CARD_CHARGES";
594
+ PAYMENTS_COMPARISON_METRIC_ENUM["REFUNDED_AMOUNT"] = "REFUNDED_AMOUNT";
595
+ PAYMENTS_COMPARISON_METRIC_ENUM["AMOUNT_DUE"] = "AMOUNT_DUE";
596
+ })(PAYMENTS_COMPARISON_METRIC_ENUM || (exports.PAYMENTS_COMPARISON_METRIC_ENUM = PAYMENTS_COMPARISON_METRIC_ENUM = {}));
597
+ exports.ALL_PAYMENTS_COMPARISON_METRICS = Object.values(PAYMENTS_COMPARISON_METRIC_ENUM);
@@ -16,6 +16,13 @@ export declare enum RIDER_FEE_TYPE_ENUM {
16
16
  DISTANCE_RETURN = "DISTANCE_RETURN"
17
17
  }
18
18
  export declare const ALL_RIDER_FEE_TYPES: RIDER_FEE_TYPE_ENUM[];
19
+ /** Server-owned rider payout lifecycle. */
20
+ export declare enum RIDER_EARNINGS_STATUS_ENUM {
21
+ PENDING = "PENDING",
22
+ FINAL = "FINAL",
23
+ VOID = "VOID"
24
+ }
25
+ export declare const ALL_RIDER_EARNINGS_STATUS: RIDER_EARNINGS_STATUS_ENUM[];
19
26
  export declare enum DELIVERY_STATUS_ENUM {
20
27
  PENDING = "PENDING",
21
28
  ASSIGNED = "ASSIGNED",
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Auto-split from constants/ENUMS.ts — see ENUMS.ts barrel for exports.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ALL_DELIVERY_STATUS = exports.DELIVERY_STATUS_ENUM = exports.ALL_RIDER_FEE_TYPES = exports.RIDER_FEE_TYPE_ENUM = exports.ALL_DELIVERY_AREAS_SEARCH_TYPES = exports.DELIVERY_AREAS_SEARCH_TYPE_ENUM = exports.ALL_RESERVATION_STATUS_TYPES = exports.RESERVATION_STATUS_ENUM = void 0;
4
+ exports.ALL_DELIVERY_STATUS = exports.DELIVERY_STATUS_ENUM = exports.ALL_RIDER_EARNINGS_STATUS = exports.RIDER_EARNINGS_STATUS_ENUM = exports.ALL_RIDER_FEE_TYPES = exports.RIDER_FEE_TYPE_ENUM = exports.ALL_DELIVERY_AREAS_SEARCH_TYPES = exports.DELIVERY_AREAS_SEARCH_TYPE_ENUM = exports.ALL_RESERVATION_STATUS_TYPES = exports.RESERVATION_STATUS_ENUM = void 0;
5
5
  var RESERVATION_STATUS_ENUM;
6
6
  (function (RESERVATION_STATUS_ENUM) {
7
7
  RESERVATION_STATUS_ENUM["PENDING"] = "PENDING";
@@ -25,6 +25,14 @@ var RIDER_FEE_TYPE_ENUM;
25
25
  RIDER_FEE_TYPE_ENUM["DISTANCE_RETURN"] = "DISTANCE_RETURN";
26
26
  })(RIDER_FEE_TYPE_ENUM || (exports.RIDER_FEE_TYPE_ENUM = RIDER_FEE_TYPE_ENUM = {}));
27
27
  exports.ALL_RIDER_FEE_TYPES = Object.values(RIDER_FEE_TYPE_ENUM);
28
+ /** Server-owned rider payout lifecycle. */
29
+ var RIDER_EARNINGS_STATUS_ENUM;
30
+ (function (RIDER_EARNINGS_STATUS_ENUM) {
31
+ RIDER_EARNINGS_STATUS_ENUM["PENDING"] = "PENDING";
32
+ RIDER_EARNINGS_STATUS_ENUM["FINAL"] = "FINAL";
33
+ RIDER_EARNINGS_STATUS_ENUM["VOID"] = "VOID";
34
+ })(RIDER_EARNINGS_STATUS_ENUM || (exports.RIDER_EARNINGS_STATUS_ENUM = RIDER_EARNINGS_STATUS_ENUM = {}));
35
+ exports.ALL_RIDER_EARNINGS_STATUS = Object.values(RIDER_EARNINGS_STATUS_ENUM);
28
36
  // ======================>> <<====================== //
29
37
  var DELIVERY_STATUS_ENUM;
30
38
  (function (DELIVERY_STATUS_ENUM) {
@@ -2,6 +2,9 @@ export * from './fbr';
2
2
  export * from './hubrise';
3
3
  export * from './kpra';
4
4
  export * from './materialized-reports';
5
+ export * from './reporting-contract';
6
+ export * from './rider-earnings';
7
+ export * from './rider-reports';
5
8
  export * from './order';
6
9
  export * from './pra';
7
10
  export * from './srb';
@@ -18,6 +18,9 @@ __exportStar(require("./fbr"), exports);
18
18
  __exportStar(require("./hubrise"), exports);
19
19
  __exportStar(require("./kpra"), exports);
20
20
  __exportStar(require("./materialized-reports"), exports);
21
+ __exportStar(require("./reporting-contract"), exports);
22
+ __exportStar(require("./rider-earnings"), exports);
23
+ __exportStar(require("./rider-reports"), exports);
21
24
  __exportStar(require("./order"), exports);
22
25
  __exportStar(require("./pra"), exports);
23
26
  __exportStar(require("./srb"), exports);
@@ -1,10 +1,42 @@
1
1
  export * from './key-helpers';
2
2
  export * from './materialized-credit-bills-helpers';
3
+ export * from './materialized-discount-accumulator-helpers';
4
+ export * from './materialized-discount-classification-helpers';
5
+ export * from './materialized-discount-close-day-helpers';
6
+ export * from './materialized-discount-compile-helpers';
7
+ export * from './materialized-hourly-comparison-close-day-helpers';
8
+ export * from './materialized-hourly-comparison-compile-helpers';
9
+ export * from './materialized-hourly-comparison-selection-helpers';
10
+ export * from './materialized-payments-comparison-accumulator-helpers';
11
+ export * from './materialized-payments-comparison-close-day-helpers';
12
+ export * from './materialized-payments-comparison-compile-helpers';
13
+ export * from './materialized-cash-accumulator-helpers';
14
+ export * from './materialized-delivery-accumulator-helpers';
15
+ export * from './materialized-delivery-compile-helpers';
16
+ export * from './materialized-delivery-classification-helpers';
17
+ export * from './materialized-delivery-close-day-helpers';
18
+ export * from './materialized-cash-classification-helpers';
19
+ export * from './materialized-cash-close-day-helpers';
20
+ export * from './materialized-cash-compile-helpers';
21
+ export * from './materialized-prep-time-classification-helpers';
22
+ export * from './materialized-prep-time-close-day-helpers';
23
+ export * from './materialized-prep-time-compile-helpers';
3
24
  export * from './materialized-reports-read-helpers';
4
25
  export * from './materialized-reports-scope-group-helpers';
5
26
  export * from './materialized-reports-selection-helpers';
27
+ export * from './materialized-sales-comparison-accumulator-helpers';
28
+ export * from './materialized-sales-comparison-baseline-helpers';
29
+ export * from './materialized-sales-comparison-close-day-helpers';
30
+ export * from './materialized-sales-comparison-compile-helpers';
6
31
  export * from './materialized-tenant-reports-iterations-helpers';
7
32
  export * from './scope-helpers';
33
+ export * from './tenant-hourly-comparison-formatter';
34
+ export * from './tenant-payments-comparison-formatter';
35
+ export * from './tenant-sales-comparison-formatter';
8
36
  export * from './tenant-sales-overview-close-day-helpers';
37
+ export * from './tenant-discount-formatter';
38
+ export * from './tenant-cash-in-out-formatter';
39
+ export * from './tenant-delivery-formatter';
40
+ export * from './tenant-prep-time-formatter';
9
41
  export * from './tenant-sales-overview-formatter';
10
42
  export * from './tenant-sales-overview-helpers';
@@ -16,11 +16,43 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./key-helpers"), exports);
18
18
  __exportStar(require("./materialized-credit-bills-helpers"), exports);
19
+ __exportStar(require("./materialized-discount-accumulator-helpers"), exports);
20
+ __exportStar(require("./materialized-discount-classification-helpers"), exports);
21
+ __exportStar(require("./materialized-discount-close-day-helpers"), exports);
22
+ __exportStar(require("./materialized-discount-compile-helpers"), exports);
23
+ __exportStar(require("./materialized-hourly-comparison-close-day-helpers"), exports);
24
+ __exportStar(require("./materialized-hourly-comparison-compile-helpers"), exports);
25
+ __exportStar(require("./materialized-hourly-comparison-selection-helpers"), exports);
26
+ __exportStar(require("./materialized-payments-comparison-accumulator-helpers"), exports);
27
+ __exportStar(require("./materialized-payments-comparison-close-day-helpers"), exports);
28
+ __exportStar(require("./materialized-payments-comparison-compile-helpers"), exports);
29
+ __exportStar(require("./materialized-cash-accumulator-helpers"), exports);
30
+ __exportStar(require("./materialized-delivery-accumulator-helpers"), exports);
31
+ __exportStar(require("./materialized-delivery-compile-helpers"), exports);
32
+ __exportStar(require("./materialized-delivery-classification-helpers"), exports);
33
+ __exportStar(require("./materialized-delivery-close-day-helpers"), exports);
34
+ __exportStar(require("./materialized-cash-classification-helpers"), exports);
35
+ __exportStar(require("./materialized-cash-close-day-helpers"), exports);
36
+ __exportStar(require("./materialized-cash-compile-helpers"), exports);
37
+ __exportStar(require("./materialized-prep-time-classification-helpers"), exports);
38
+ __exportStar(require("./materialized-prep-time-close-day-helpers"), exports);
39
+ __exportStar(require("./materialized-prep-time-compile-helpers"), exports);
19
40
  __exportStar(require("./materialized-reports-read-helpers"), exports);
20
41
  __exportStar(require("./materialized-reports-scope-group-helpers"), exports);
21
42
  __exportStar(require("./materialized-reports-selection-helpers"), exports);
43
+ __exportStar(require("./materialized-sales-comparison-accumulator-helpers"), exports);
44
+ __exportStar(require("./materialized-sales-comparison-baseline-helpers"), exports);
45
+ __exportStar(require("./materialized-sales-comparison-close-day-helpers"), exports);
46
+ __exportStar(require("./materialized-sales-comparison-compile-helpers"), exports);
22
47
  __exportStar(require("./materialized-tenant-reports-iterations-helpers"), exports);
23
48
  __exportStar(require("./scope-helpers"), exports);
49
+ __exportStar(require("./tenant-hourly-comparison-formatter"), exports);
50
+ __exportStar(require("./tenant-payments-comparison-formatter"), exports);
51
+ __exportStar(require("./tenant-sales-comparison-formatter"), exports);
24
52
  __exportStar(require("./tenant-sales-overview-close-day-helpers"), exports);
53
+ __exportStar(require("./tenant-discount-formatter"), exports);
54
+ __exportStar(require("./tenant-cash-in-out-formatter"), exports);
55
+ __exportStar(require("./tenant-delivery-formatter"), exports);
56
+ __exportStar(require("./tenant-prep-time-formatter"), exports);
25
57
  __exportStar(require("./tenant-sales-overview-formatter"), exports);
26
58
  __exportStar(require("./tenant-sales-overview-helpers"), exports);