@dainamite/cpq 0.5.0 → 0.7.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 (368) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/MIGRATION.md +74 -0
  3. package/dist/modules/cpq/acl.js +1 -0
  4. package/dist/modules/cpq/acl.js.map +2 -2
  5. package/dist/modules/cpq/api/_helpers/adjustmentCommandRoute.js +45 -0
  6. package/dist/modules/cpq/api/_helpers/adjustmentCommandRoute.js.map +7 -0
  7. package/dist/modules/cpq/api/_helpers/quoteMutationGuard.js +23 -0
  8. package/dist/modules/cpq/api/_helpers/quoteMutationGuard.js.map +7 -0
  9. package/dist/modules/cpq/api/_helpers/quoteRouteOpenApi.js +19 -0
  10. package/dist/modules/cpq/api/_helpers/quoteRouteOpenApi.js.map +7 -0
  11. package/dist/modules/cpq/api/orders/[orderId]/route.js +17 -1
  12. package/dist/modules/cpq/api/orders/[orderId]/route.js.map +2 -2
  13. package/dist/modules/cpq/api/orders/route.js +47 -2
  14. package/dist/modules/cpq/api/orders/route.js.map +2 -2
  15. package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/restore/route.js +54 -0
  16. package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/restore/route.js.map +7 -0
  17. package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js +42 -2
  18. package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js.map +2 -2
  19. package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js +27 -2
  20. package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js.map +2 -2
  21. package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/[adjustmentId]/route.js +47 -0
  22. package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/[adjustmentId]/route.js.map +7 -0
  23. package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/preview/route.js +30 -0
  24. package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/preview/route.js.map +7 -0
  25. package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/route.js +47 -0
  26. package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/route.js.map +7 -0
  27. package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js +32 -2
  28. package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js.map +2 -2
  29. package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js +33 -2
  30. package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js.map +2 -2
  31. package/dist/modules/cpq/api/quotes/price/route.js +43 -3
  32. package/dist/modules/cpq/api/quotes/price/route.js.map +2 -2
  33. package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js +3 -9
  34. package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js.map +2 -2
  35. package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js +21 -25
  36. package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js.map +2 -2
  37. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js +48 -47
  38. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js.map +2 -2
  39. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js +1 -1
  40. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js.map +2 -2
  41. package/dist/modules/cpq/backend/cpq/inventory/page.meta.js +3 -3
  42. package/dist/modules/cpq/backend/cpq/inventory/page.meta.js.map +2 -2
  43. package/dist/modules/cpq/backend/cpq/inventory/shared.js +37 -2
  44. package/dist/modules/cpq/backend/cpq/inventory/shared.js.map +2 -2
  45. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js +174 -184
  46. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js.map +2 -2
  47. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js +1 -1
  48. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js.map +2 -2
  49. package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js +168 -143
  50. package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js.map +2 -2
  51. package/dist/modules/cpq/backend/cpq/offerings/page.js +36 -34
  52. package/dist/modules/cpq/backend/cpq/offerings/page.js.map +2 -2
  53. package/dist/modules/cpq/backend/cpq/orders/[id]/page.js +140 -280
  54. package/dist/modules/cpq/backend/cpq/orders/[id]/page.js.map +2 -2
  55. package/dist/modules/cpq/backend/cpq/orders/page.js +6 -6
  56. package/dist/modules/cpq/backend/cpq/orders/page.js.map +2 -2
  57. package/dist/modules/cpq/backend/cpq/orders/page.meta.js +1 -1
  58. package/dist/modules/cpq/backend/cpq/orders/page.meta.js.map +1 -1
  59. package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js +41 -36
  60. package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js.map +2 -2
  61. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js +76 -72
  62. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js.map +2 -2
  63. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js +1 -1
  64. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js.map +2 -2
  65. package/dist/modules/cpq/backend/cpq/price-rules/page.js +18 -15
  66. package/dist/modules/cpq/backend/cpq/price-rules/page.js.map +2 -2
  67. package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js +23 -21
  68. package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js.map +2 -2
  69. package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js +22 -50
  70. package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js.map +2 -2
  71. package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js +74 -52
  72. package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js.map +2 -2
  73. package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js +20 -17
  74. package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js.map +2 -2
  75. package/dist/modules/cpq/backend/cpq/pricing/page.js +1 -1
  76. package/dist/modules/cpq/backend/cpq/pricing/page.js.map +2 -2
  77. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js +115 -123
  78. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js.map +2 -2
  79. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentDialog.js +208 -0
  80. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentDialog.js.map +7 -0
  81. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentsPanel.js +79 -0
  82. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentsPanel.js.map +7 -0
  83. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/arcLineRemoval.js +53 -0
  84. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/arcLineRemoval.js.map +7 -0
  85. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/priceAdjustmentContext.js +107 -0
  86. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/priceAdjustmentContext.js.map +7 -0
  87. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/usePriceAdjustments.js +130 -0
  88. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/usePriceAdjustments.js.map +7 -0
  89. package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js +269 -311
  90. package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js.map +3 -3
  91. package/dist/modules/cpq/backend/cpq/quotes/page.js +23 -19
  92. package/dist/modules/cpq/backend/cpq/quotes/page.js.map +2 -2
  93. package/dist/modules/cpq/backend/cpq/quotes/page.meta.js +1 -1
  94. package/dist/modules/cpq/backend/cpq/quotes/page.meta.js.map +1 -1
  95. package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js +19 -15
  96. package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js.map +2 -2
  97. package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js +171 -178
  98. package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js.map +2 -2
  99. package/dist/modules/cpq/backend/cpq/specifications/page.js +2 -2
  100. package/dist/modules/cpq/backend/cpq/specifications/page.js.map +2 -2
  101. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js +60 -50
  102. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js.map +2 -2
  103. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js +22 -18
  104. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js.map +2 -2
  105. package/dist/modules/cpq/backend/cpq/wizards/page.js +1 -1
  106. package/dist/modules/cpq/backend/cpq/wizards/page.js.map +2 -2
  107. package/dist/modules/cpq/ce.js +8 -0
  108. package/dist/modules/cpq/ce.js.map +2 -2
  109. package/dist/modules/cpq/cli.js +34 -1
  110. package/dist/modules/cpq/cli.js.map +2 -2
  111. package/dist/modules/cpq/commands/price-adjustments.js +107 -0
  112. package/dist/modules/cpq/commands/price-adjustments.js.map +7 -0
  113. package/dist/modules/cpq/components/ArcLineDiff.js +53 -0
  114. package/dist/modules/cpq/components/ArcLineDiff.js.map +7 -0
  115. package/dist/modules/cpq/components/ChargeBreakdownTable.js +148 -0
  116. package/dist/modules/cpq/components/ChargeBreakdownTable.js.map +7 -0
  117. package/dist/modules/cpq/components/PriceWaterfall.js +68 -0
  118. package/dist/modules/cpq/components/PriceWaterfall.js.map +7 -0
  119. package/dist/modules/cpq/components/PricingSummaryCard.js +112 -0
  120. package/dist/modules/cpq/components/PricingSummaryCard.js.map +7 -0
  121. package/dist/modules/cpq/components/StatusPath.js +5 -3
  122. package/dist/modules/cpq/components/StatusPath.js.map +2 -2
  123. package/dist/modules/cpq/components/useCpqRowActions.js +10 -22
  124. package/dist/modules/cpq/components/useCpqRowActions.js.map +2 -2
  125. package/dist/modules/cpq/components/useGrantedFeatures.js +27 -0
  126. package/dist/modules/cpq/components/useGrantedFeatures.js.map +7 -0
  127. package/dist/modules/cpq/data/entities.js +97 -0
  128. package/dist/modules/cpq/data/entities.js.map +2 -2
  129. package/dist/modules/cpq/data/price-adjustments.js +70 -0
  130. package/dist/modules/cpq/data/price-adjustments.js.map +7 -0
  131. package/dist/modules/cpq/data/validators.js +4 -0
  132. package/dist/modules/cpq/data/validators.js.map +2 -2
  133. package/dist/modules/cpq/di.js +6 -0
  134. package/dist/modules/cpq/di.js.map +2 -2
  135. package/dist/modules/cpq/events.js +47 -0
  136. package/dist/modules/cpq/events.js.map +2 -2
  137. package/dist/modules/cpq/i18n/de.json +1220 -0
  138. package/dist/modules/cpq/i18n/en.json +1220 -0
  139. package/dist/modules/cpq/i18n/es.json +1220 -0
  140. package/dist/modules/cpq/i18n/pl.json +1220 -0
  141. package/dist/modules/cpq/index.js +1 -1
  142. package/dist/modules/cpq/index.js.map +2 -2
  143. package/dist/modules/cpq/lib/auditActor.js +10 -0
  144. package/dist/modules/cpq/lib/auditActor.js.map +7 -0
  145. package/dist/modules/cpq/lib/formatMoney.js +7 -0
  146. package/dist/modules/cpq/lib/formatMoney.js.map +7 -0
  147. package/dist/modules/cpq/lib/priceAdjustmentDefaults.js +60 -0
  148. package/dist/modules/cpq/lib/priceAdjustmentDefaults.js.map +7 -0
  149. package/dist/modules/cpq/lib/priceAdjustmentView.js +169 -0
  150. package/dist/modules/cpq/lib/priceAdjustmentView.js.map +7 -0
  151. package/dist/modules/cpq/lib/quotePermissions.js +13 -0
  152. package/dist/modules/cpq/lib/quotePermissions.js.map +7 -0
  153. package/dist/modules/cpq/lib/quoteSummaryView.js +28 -0
  154. package/dist/modules/cpq/lib/quoteSummaryView.js.map +7 -0
  155. package/dist/modules/cpq/migrations/Migration20261110213052.js +22 -0
  156. package/dist/modules/cpq/migrations/Migration20261110213052.js.map +7 -0
  157. package/dist/modules/cpq/services/arcLineRemoval.js +53 -0
  158. package/dist/modules/cpq/services/arcLineRemoval.js.map +7 -0
  159. package/dist/modules/cpq/services/arcPriceFreeze.js +79 -0
  160. package/dist/modules/cpq/services/arcPriceFreeze.js.map +7 -0
  161. package/dist/modules/cpq/services/cpqOrderService.js +25 -28
  162. package/dist/modules/cpq/services/cpqOrderService.js.map +2 -2
  163. package/dist/modules/cpq/services/cpqPricingService.js +7 -0
  164. package/dist/modules/cpq/services/cpqPricingService.js.map +2 -2
  165. package/dist/modules/cpq/services/cpqQuotingService.js +330 -109
  166. package/dist/modules/cpq/services/cpqQuotingService.js.map +2 -2
  167. package/dist/modules/cpq/services/orderPricingSummary.js +26 -0
  168. package/dist/modules/cpq/services/orderPricingSummary.js.map +7 -0
  169. package/dist/modules/cpq/services/priceAdjustments/adjustmentService.js +264 -0
  170. package/dist/modules/cpq/services/priceAdjustments/adjustmentService.js.map +7 -0
  171. package/dist/modules/cpq/services/priceAdjustments/chargeWaterfall.js +25 -0
  172. package/dist/modules/cpq/services/priceAdjustments/chargeWaterfall.js.map +7 -0
  173. package/dist/modules/cpq/services/priceAdjustments/loadQuoteAdjustments.js +38 -0
  174. package/dist/modules/cpq/services/priceAdjustments/loadQuoteAdjustments.js.map +7 -0
  175. package/dist/modules/cpq/services/priceAdjustments/pricingSnapshot.js +104 -0
  176. package/dist/modules/cpq/services/priceAdjustments/pricingSnapshot.js.map +7 -0
  177. package/dist/modules/cpq/services/priceAdjustments/quoteAdjustmentLifecycle.js +102 -0
  178. package/dist/modules/cpq/services/priceAdjustments/quoteAdjustmentLifecycle.js.map +7 -0
  179. package/dist/modules/cpq/services/priceAdjustments/quotePricingEvents.js +52 -0
  180. package/dist/modules/cpq/services/priceAdjustments/quotePricingEvents.js.map +7 -0
  181. package/dist/modules/cpq/services/priceAdjustments/quotePricingWrite.js +37 -0
  182. package/dist/modules/cpq/services/priceAdjustments/quotePricingWrite.js.map +7 -0
  183. package/dist/modules/cpq/services/priceAdjustments/resolveManualAdjustments.js +107 -0
  184. package/dist/modules/cpq/services/priceAdjustments/resolveManualAdjustments.js.map +7 -0
  185. package/dist/modules/cpq/services/priceAdjustments/storedAdjustmentFailure.js +30 -0
  186. package/dist/modules/cpq/services/priceAdjustments/storedAdjustmentFailure.js.map +7 -0
  187. package/dist/modules/cpq/services/types.js.map +2 -2
  188. package/dist/modules/cpq/setup.js +6 -0
  189. package/dist/modules/cpq/setup.js.map +2 -2
  190. package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js +39 -31
  191. package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js.map +2 -2
  192. package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js +13 -5
  193. package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js.map +2 -2
  194. package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js +41 -21
  195. package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js.map +2 -2
  196. package/dist/modules/cpq/widgets/injection-table.js +2 -2
  197. package/dist/modules/cpq/widgets/injection-table.js.map +2 -2
  198. package/dist/modules/cpq/workflows/WizardRunner.js +10 -8
  199. package/dist/modules/cpq/workflows/WizardRunner.js.map +2 -2
  200. package/dist/modules/cpq/workflows/WizardTrigger.js +15 -9
  201. package/dist/modules/cpq/workflows/WizardTrigger.js.map +2 -2
  202. package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js +9 -7
  203. package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js.map +2 -2
  204. package/dist/modules/cpq/workflows/steps/InventorySelectStep.js +9 -4
  205. package/dist/modules/cpq/workflows/steps/InventorySelectStep.js.map +2 -2
  206. package/dist/modules/cpq/workflows/steps/ItemListStep.js +16 -19
  207. package/dist/modules/cpq/workflows/steps/ItemListStep.js.map +2 -2
  208. package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js +19 -32
  209. package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js.map +2 -2
  210. package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js +8 -6
  211. package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js.map +2 -2
  212. package/dist/modules/cpq/workflows/steps/ReviewStep.js +32 -30
  213. package/dist/modules/cpq/workflows/steps/ReviewStep.js.map +2 -2
  214. package/dist/modules/cpq/workflows/steps/index.js +12 -0
  215. package/dist/modules/cpq/workflows/steps/index.js.map +2 -2
  216. package/package.json +1 -1
  217. package/src/modules/cpq/__integration__/TC-CPQ-ARC-012.spec.ts +134 -0
  218. package/src/modules/cpq/__tests__/i18n/dictionaries.test.ts +62 -0
  219. package/src/modules/cpq/__tests__/i18n/hardcodedStrings.test.ts +35 -0
  220. package/src/modules/cpq/__tests__/i18n/sourceScan.ts +109 -0
  221. package/src/modules/cpq/acl.ts +1 -0
  222. package/src/modules/cpq/api/__tests__/adjustmentRoutes.test.ts +79 -0
  223. package/src/modules/cpq/api/__tests__/quoteWriteGuards.test.ts +100 -0
  224. package/src/modules/cpq/api/_helpers/__tests__/quoteMutationGuard.test.ts +48 -0
  225. package/src/modules/cpq/api/_helpers/adjustmentCommandRoute.ts +45 -0
  226. package/src/modules/cpq/api/_helpers/quoteMutationGuard.ts +38 -0
  227. package/src/modules/cpq/api/_helpers/quoteRouteOpenApi.ts +19 -0
  228. package/src/modules/cpq/api/orders/[orderId]/route.ts +18 -0
  229. package/src/modules/cpq/api/orders/route.ts +51 -1
  230. package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/restore/route.ts +56 -0
  231. package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.ts +48 -1
  232. package/src/modules/cpq/api/quotes/[quoteId]/items/route.ts +31 -1
  233. package/src/modules/cpq/api/quotes/[quoteId]/price-adjustments/[adjustmentId]/route.ts +39 -0
  234. package/src/modules/cpq/api/quotes/[quoteId]/price-adjustments/preview/route.ts +24 -0
  235. package/src/modules/cpq/api/quotes/[quoteId]/price-adjustments/route.ts +40 -0
  236. package/src/modules/cpq/api/quotes/[quoteId]/recalculate/__tests__/route.test.ts +95 -0
  237. package/src/modules/cpq/api/quotes/[quoteId]/recalculate/route.ts +40 -1
  238. package/src/modules/cpq/api/quotes/[quoteId]/status/__tests__/route.test.ts +74 -0
  239. package/src/modules/cpq/api/quotes/[quoteId]/status/route.ts +37 -1
  240. package/src/modules/cpq/api/quotes/price/__tests__/route.test.ts +37 -0
  241. package/src/modules/cpq/api/quotes/price/route.ts +28 -2
  242. package/src/modules/cpq/backend/cpq/inventory/AssetsTable.tsx +3 -9
  243. package/src/modules/cpq/backend/cpq/inventory/SubscriptionsTable.tsx +22 -26
  244. package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.ts +1 -1
  245. package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.tsx +43 -46
  246. package/src/modules/cpq/backend/cpq/inventory/page.meta.ts +3 -3
  247. package/src/modules/cpq/backend/cpq/inventory/shared.tsx +37 -1
  248. package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.ts +1 -1
  249. package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.tsx +164 -120
  250. package/src/modules/cpq/backend/cpq/offerings/[id]/page.tsx +169 -130
  251. package/src/modules/cpq/backend/cpq/offerings/page.tsx +34 -24
  252. package/src/modules/cpq/backend/cpq/orders/[id]/page.tsx +122 -308
  253. package/src/modules/cpq/backend/cpq/orders/page.meta.ts +1 -1
  254. package/src/modules/cpq/backend/cpq/orders/page.tsx +6 -6
  255. package/src/modules/cpq/backend/cpq/price-rules/PriceRuleForm.tsx +48 -34
  256. package/src/modules/cpq/backend/cpq/price-rules/[id]/page.meta.ts +1 -1
  257. package/src/modules/cpq/backend/cpq/price-rules/[id]/page.tsx +76 -70
  258. package/src/modules/cpq/backend/cpq/price-rules/page.tsx +25 -16
  259. package/src/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.tsx +24 -18
  260. package/src/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.tsx +29 -19
  261. package/src/modules/cpq/backend/cpq/pricing/[id]/page.tsx +95 -47
  262. package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.ts +23 -15
  263. package/src/modules/cpq/backend/cpq/pricing/page.tsx +1 -1
  264. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.tsx +111 -88
  265. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentDialog.tsx +260 -0
  266. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentsPanel.tsx +124 -0
  267. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/__tests__/PriceAdjustmentsPanel.test.tsx +76 -0
  268. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/arcLineRemoval.tsx +76 -0
  269. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/priceAdjustmentContext.tsx +133 -0
  270. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/usePriceAdjustments.tsx +165 -0
  271. package/src/modules/cpq/backend/cpq/quotes/[id]/page.tsx +304 -348
  272. package/src/modules/cpq/backend/cpq/quotes/page.meta.ts +1 -1
  273. package/src/modules/cpq/backend/cpq/quotes/page.tsx +29 -21
  274. package/src/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.tsx +19 -15
  275. package/src/modules/cpq/backend/cpq/specifications/[id]/page.tsx +171 -171
  276. package/src/modules/cpq/backend/cpq/specifications/page.tsx +2 -2
  277. package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.tsx +51 -41
  278. package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/page.tsx +17 -13
  279. package/src/modules/cpq/backend/cpq/wizards/page.tsx +1 -1
  280. package/src/modules/cpq/ce.ts +8 -0
  281. package/src/modules/cpq/cli.ts +48 -1
  282. package/src/modules/cpq/commands/__tests__/price-adjustments.test.ts +54 -0
  283. package/src/modules/cpq/commands/price-adjustments.ts +90 -0
  284. package/src/modules/cpq/components/ArcLineDiff.tsx +87 -0
  285. package/src/modules/cpq/components/ChargeBreakdownTable.tsx +203 -0
  286. package/src/modules/cpq/components/PriceWaterfall.tsx +96 -0
  287. package/src/modules/cpq/components/PricingSummaryCard.tsx +128 -0
  288. package/src/modules/cpq/components/StatusPath.tsx +7 -4
  289. package/src/modules/cpq/components/__tests__/PriceWaterfall.test.tsx +38 -0
  290. package/src/modules/cpq/components/useCpqRowActions.tsx +17 -25
  291. package/src/modules/cpq/components/useGrantedFeatures.ts +35 -0
  292. package/src/modules/cpq/data/__tests__/price-adjustment-migration.test.ts +11 -0
  293. package/src/modules/cpq/data/__tests__/price-adjustments.test.ts +26 -0
  294. package/src/modules/cpq/data/entities.ts +83 -0
  295. package/src/modules/cpq/data/price-adjustments.ts +67 -0
  296. package/src/modules/cpq/data/validators.ts +3 -0
  297. package/src/modules/cpq/di.ts +6 -0
  298. package/src/modules/cpq/events.ts +53 -2
  299. package/src/modules/cpq/i18n/de.json +1220 -0
  300. package/src/modules/cpq/i18n/en.json +1220 -0
  301. package/src/modules/cpq/i18n/es.json +1220 -0
  302. package/src/modules/cpq/i18n/pl.json +1220 -0
  303. package/src/modules/cpq/index.ts +1 -1
  304. package/src/modules/cpq/lib/__tests__/auditActor.test.ts +12 -0
  305. package/src/modules/cpq/lib/__tests__/priceAdjustmentDefaults.test.ts +37 -0
  306. package/src/modules/cpq/lib/__tests__/priceAdjustmentView.test.ts +152 -0
  307. package/src/modules/cpq/lib/__tests__/quotePermissions.test.ts +30 -0
  308. package/src/modules/cpq/lib/__tests__/quoteSummaryView.test.ts +56 -0
  309. package/src/modules/cpq/lib/auditActor.ts +13 -0
  310. package/src/modules/cpq/lib/formatMoney.ts +4 -0
  311. package/src/modules/cpq/lib/priceAdjustmentDefaults.ts +36 -0
  312. package/src/modules/cpq/lib/priceAdjustmentView.ts +259 -0
  313. package/src/modules/cpq/lib/quotePermissions.ts +22 -0
  314. package/src/modules/cpq/lib/quoteSummaryView.ts +51 -0
  315. package/src/modules/cpq/migrations/.snapshot-open-mercato.json +3298 -2423
  316. package/src/modules/cpq/migrations/Migration20261110213052.ts +22 -0
  317. package/src/modules/cpq/services/__tests__/_helpers/mockEm.ts +9 -2
  318. package/src/modules/cpq/services/__tests__/adjustmentService.test.ts +183 -0
  319. package/src/modules/cpq/services/__tests__/arcLineRemoval.test.ts +109 -0
  320. package/src/modules/cpq/services/__tests__/arcPriceFreeze.test.ts +141 -0
  321. package/src/modules/cpq/services/__tests__/chargeWaterfall.test.ts +28 -0
  322. package/src/modules/cpq/services/__tests__/cpqOrderService.test.ts +35 -2
  323. package/src/modules/cpq/services/__tests__/cpqPricingService.test.ts +57 -0
  324. package/src/modules/cpq/services/__tests__/cpqQuotingService.arc.test.ts +237 -0
  325. package/src/modules/cpq/services/__tests__/cpqQuotingService.test.ts +58 -3
  326. package/src/modules/cpq/services/__tests__/orderPricingSummary.test.ts +50 -0
  327. package/src/modules/cpq/services/__tests__/pricingSnapshot.test.ts +62 -0
  328. package/src/modules/cpq/services/__tests__/quoteAdjustmentLifecycle.test.ts +35 -0
  329. package/src/modules/cpq/services/__tests__/quoteAdjustmentPricing.test.ts +65 -0
  330. package/src/modules/cpq/services/__tests__/quoteCloneAdjustments.test.ts +45 -0
  331. package/src/modules/cpq/services/__tests__/quoteDetachTargetAdjustments.test.ts +54 -0
  332. package/src/modules/cpq/services/__tests__/quoteEventsService.test.ts +72 -0
  333. package/src/modules/cpq/services/__tests__/quotePricingEvents.test.ts +126 -0
  334. package/src/modules/cpq/services/__tests__/quotePricingIsolation.test.ts +52 -0
  335. package/src/modules/cpq/services/__tests__/quotePricingWrite.test.ts +74 -0
  336. package/src/modules/cpq/services/__tests__/resolveManualAdjustments.test.ts +90 -0
  337. package/src/modules/cpq/services/__tests__/storedAdjustmentFailure.test.ts +9 -0
  338. package/src/modules/cpq/services/arcLineRemoval.ts +87 -0
  339. package/src/modules/cpq/services/arcPriceFreeze.ts +165 -0
  340. package/src/modules/cpq/services/cpqOrderService.ts +22 -28
  341. package/src/modules/cpq/services/cpqPricingService.ts +8 -0
  342. package/src/modules/cpq/services/cpqQuotingService.ts +374 -125
  343. package/src/modules/cpq/services/orderPricingSummary.ts +47 -0
  344. package/src/modules/cpq/services/priceAdjustments/adjustmentService.ts +249 -0
  345. package/src/modules/cpq/services/priceAdjustments/chargeWaterfall.ts +28 -0
  346. package/src/modules/cpq/services/priceAdjustments/loadQuoteAdjustments.ts +25 -0
  347. package/src/modules/cpq/services/priceAdjustments/pricingSnapshot.ts +86 -0
  348. package/src/modules/cpq/services/priceAdjustments/quoteAdjustmentLifecycle.ts +68 -0
  349. package/src/modules/cpq/services/priceAdjustments/quotePricingEvents.ts +94 -0
  350. package/src/modules/cpq/services/priceAdjustments/quotePricingWrite.ts +51 -0
  351. package/src/modules/cpq/services/priceAdjustments/resolveManualAdjustments.ts +116 -0
  352. package/src/modules/cpq/services/priceAdjustments/storedAdjustmentFailure.ts +31 -0
  353. package/src/modules/cpq/services/types.ts +34 -1
  354. package/src/modules/cpq/setup.ts +7 -1
  355. package/src/modules/cpq/widgets/injection/customer-inventory/widget.client.tsx +38 -31
  356. package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.client.tsx +7 -5
  357. package/src/modules/cpq/widgets/injection/quote-configurator/widget.client.tsx +36 -21
  358. package/src/modules/cpq/widgets/injection-table.ts +8 -2
  359. package/src/modules/cpq/workflows/WizardRunner.tsx +8 -5
  360. package/src/modules/cpq/workflows/WizardTrigger.tsx +15 -9
  361. package/src/modules/cpq/workflows/steps/CustomerSelectStep.tsx +11 -7
  362. package/src/modules/cpq/workflows/steps/InventorySelectStep.tsx +9 -5
  363. package/src/modules/cpq/workflows/steps/ItemListStep.tsx +18 -12
  364. package/src/modules/cpq/workflows/steps/OfferingSelectStep.tsx +20 -16
  365. package/src/modules/cpq/workflows/steps/ProductConfigureStep.tsx +8 -6
  366. package/src/modules/cpq/workflows/steps/ReviewStep.tsx +33 -18
  367. package/src/modules/cpq/workflows/steps/index.ts +12 -0
  368. package/src/modules/cpq/workflows/types.ts +4 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/cpq/components/useCpqRowActions.tsx"],
4
- "sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { type RowActionItem } from '@open-mercato/ui/backend/RowActions'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\n\n// \u2500\u2500\u2500 Types \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport type UseCpqRowActionsOptions<T extends { id: string }> = {\n /** DELETE endpoint that accepts `{ id }` body (e.g. `/api/cpq/product-offerings`). */\n endpoint: string\n /**\n * Singular noun for the entity, used in confirm + flash messages.\n * E.g. `'offering'`, `'pricing table'`, `'price rule'`.\n */\n entityName: string\n /**\n * Build the href for the row's edit/detail page (e.g. `(row) =>\n * `/backend/cpq/offerings/${row.id}`).\n */\n editHref: (row: T) => string\n /** Reload the table after a successful delete. */\n onReload: () => void\n /**\n * Override the row-deletion guard. Returning `false` skips the\n * delete request without flashing an error (e.g. when the row is in a\n * lifecycle state that disallows deletion).\n */\n canDelete?: (row: T) => boolean\n}\n\nexport type CpqRowActionsApi<T extends { id: string }> = {\n /**\n * Items for `<RowActions>` for a single row. Always returns\n * `Edit` + `Delete` \u2014 extras can be prepended / appended.\n */\n buildItems: (row: T, extras?: { prepend?: RowActionItem[]; append?: RowActionItem[] }) => RowActionItem[]\n /**\n * Bulk-delete handler suitable for `<DataTable bulkActions>`. Confirms once\n * for the whole selection, then issues `DELETE` requests sequentially so\n * a partial failure stops cleanly. Reports per-row failures via `flash`.\n *\n * Note: sequential by design \u2014 DELETE on the same table from N parallel\n * requests can deadlock at the row-lock level under load. Chunked\n * parallelism would be the next step if selection counts grow > ~200.\n */\n bulkDelete: (rows: T[]) => Promise<{ ok: boolean; affectedCount?: number }>\n /**\n * Render this element somewhere in the page (typically as the\n * `footerContent` slot of `<CpqListView>`) so the confirm dialog\n * portal mounts.\n */\n ConfirmDialogElement: React.ReactNode\n}\n\n// \u2500\u2500\u2500 Implementation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function useCpqRowActions<T extends { id: string }>(\n options: UseCpqRowActionsOptions<T>,\n): CpqRowActionsApi<T> {\n const { endpoint, entityName, editHref, onReload, canDelete } = options\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n\n const deleteOne = React.useCallback(\n async (id: string) => {\n const res = await fetch(endpoint, {\n method: 'DELETE',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ id }),\n })\n return res.ok\n },\n [endpoint],\n )\n\n const singleDelete = React.useCallback(\n async (row: T) => {\n if (canDelete && !canDelete(row)) return\n const confirmed = await confirm({\n title: t(\n 'cpq.rowActions.deleteOne.confirm',\n `Delete this ${entityName}?`,\n ),\n variant: 'destructive',\n })\n if (!confirmed) return\n const ok = await deleteOne(row.id)\n if (!ok) {\n flash(\n t('cpq.rowActions.deleteOne.error', `Failed to delete ${entityName}`),\n 'error',\n )\n return\n }\n flash(t('cpq.rowActions.deleteOne.success', `${entityName} deleted`), 'success')\n onReload()\n },\n [canDelete, confirm, deleteOne, entityName, onReload, t],\n )\n\n const bulkDelete = React.useCallback(\n async (rows: T[]) => {\n if (!rows.length) return { ok: false }\n const eligible = canDelete ? rows.filter(canDelete) : rows\n if (!eligible.length) {\n flash(\n t(\n 'cpq.rowActions.deleteBulk.noEligible',\n `None of the selected ${entityName}s can be deleted in their current state.`,\n ),\n 'error',\n )\n return { ok: false }\n }\n const confirmed = await confirm({\n title: t(\n 'cpq.rowActions.deleteBulk.confirm',\n `Delete ${eligible.length} ${entityName}${eligible.length > 1 ? 's' : ''}?`,\n ),\n variant: 'destructive',\n })\n if (!confirmed) return { ok: false }\n\n let failed = 0\n for (const row of eligible) {\n const ok = await deleteOne(row.id)\n if (!ok) failed += 1\n }\n\n if (failed > 0) {\n flash(\n t(\n 'cpq.rowActions.deleteBulk.partialError',\n `Failed to delete ${failed} ${entityName}${failed > 1 ? 's' : ''}`,\n ),\n 'error',\n )\n } else {\n flash(\n t('cpq.rowActions.deleteBulk.success', `${entityName}s deleted`),\n 'success',\n )\n }\n onReload()\n return { ok: failed === 0, affectedCount: eligible.length - failed }\n },\n [canDelete, confirm, deleteOne, entityName, onReload, t],\n )\n\n const buildItems = React.useCallback(\n (row: T, extras?: { prepend?: RowActionItem[]; append?: RowActionItem[] }): RowActionItem[] => {\n const items: RowActionItem[] = []\n if (extras?.prepend) items.push(...extras.prepend)\n items.push({\n id: 'edit',\n label: t('cpq.rowActions.edit', 'Edit'),\n href: editHref(row),\n })\n if (extras?.append) items.push(...extras.append)\n const deletable = !canDelete || canDelete(row)\n if (deletable) {\n items.push({\n id: 'delete',\n label: t('cpq.rowActions.delete', 'Delete'),\n destructive: true,\n onSelect: () => {\n void singleDelete(row)\n },\n })\n }\n return items\n },\n [canDelete, editHref, singleDelete, t],\n )\n\n return {\n buildItems,\n bulkDelete,\n ConfirmDialogElement,\n }\n}\n"],
5
- "mappings": ";AACA,YAAY,WAAW;AACvB,SAAS,aAAa;AAEtB,SAAS,YAAY;AACrB,SAAS,wBAAwB;AAqD1B,SAAS,iBACd,SACqB;AACrB,QAAM,EAAE,UAAU,YAAY,UAAU,UAAU,UAAU,IAAI;AAChE,QAAM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AAAA,UACvB;AAAA,QACF,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT;AAAA,IACA,CAAC,WAAW,UAAU,cAAc,CAAC;AAAA,EACvC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { type RowActionItem } from '@open-mercato/ui/backend/RowActions'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\n\n// \u2500\u2500\u2500 Types \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport type UseCpqRowActionsOptions<T extends { id: string }> = {\n /** DELETE endpoint that accepts `{ id }` body (e.g. `/api/cpq/product-offerings`). */\n endpoint: string\n /**\n * Singular noun for the entity (e.g. `'offering'`).\n *\n * @deprecated Not used in messages any more: splicing a noun into a\n * sentence cannot produce correct grammar in ES / DE / PL (gender, case).\n * Confirm and flash messages are noun-free and count-based\n * (spec 2026-11-15-cpq-multi-language). Kept for API compatibility.\n */\n entityName?: string\n /**\n * Build the href for the row's edit/detail page (e.g. `(row) =>\n * `/backend/cpq/offerings/${row.id}`).\n */\n editHref: (row: T) => string\n /** Reload the table after a successful delete. */\n onReload: () => void\n /**\n * Override the row-deletion guard. Returning `false` skips the\n * delete request without flashing an error (e.g. when the row is in a\n * lifecycle state that disallows deletion).\n */\n canDelete?: (row: T) => boolean\n}\n\nexport type CpqRowActionsApi<T extends { id: string }> = {\n /**\n * Items for `<RowActions>` for a single row. Always returns\n * `Edit` + `Delete` \u2014 extras can be prepended / appended.\n */\n buildItems: (row: T, extras?: { prepend?: RowActionItem[]; append?: RowActionItem[] }) => RowActionItem[]\n /**\n * Bulk-delete handler suitable for `<DataTable bulkActions>`. Confirms once\n * for the whole selection, then issues `DELETE` requests sequentially so\n * a partial failure stops cleanly. Reports per-row failures via `flash`.\n *\n * Note: sequential by design \u2014 DELETE on the same table from N parallel\n * requests can deadlock at the row-lock level under load. Chunked\n * parallelism would be the next step if selection counts grow > ~200.\n */\n bulkDelete: (rows: T[]) => Promise<{ ok: boolean; affectedCount?: number }>\n /**\n * Render this element somewhere in the page (typically as the\n * `footerContent` slot of `<CpqListView>`) so the confirm dialog\n * portal mounts.\n */\n ConfirmDialogElement: React.ReactNode\n}\n\n// \u2500\u2500\u2500 Implementation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function useCpqRowActions<T extends { id: string }>(\n options: UseCpqRowActionsOptions<T>,\n): CpqRowActionsApi<T> {\n const { endpoint, editHref, onReload, canDelete } = options\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n\n const deleteOne = React.useCallback(\n async (id: string) => {\n const res = await fetch(endpoint, {\n method: 'DELETE',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ id }),\n })\n return res.ok\n },\n [endpoint],\n )\n\n const singleDelete = React.useCallback(\n async (row: T) => {\n if (canDelete && !canDelete(row)) return\n const confirmed = await confirm({\n title: t('cpq.rowActions.deleteOne.confirm', 'Delete this item?'),\n variant: 'destructive',\n })\n if (!confirmed) return\n const ok = await deleteOne(row.id)\n if (!ok) {\n flash(\n t('cpq.rowActions.deleteOne.error', 'Failed to delete the item'),\n 'error',\n )\n return\n }\n flash(t('cpq.rowActions.deleteOne.success', 'Item deleted'), 'success')\n onReload()\n },\n [canDelete, confirm, deleteOne, onReload, t],\n )\n\n const bulkDelete = React.useCallback(\n async (rows: T[]) => {\n if (!rows.length) return { ok: false }\n const eligible = canDelete ? rows.filter(canDelete) : rows\n if (!eligible.length) {\n flash(\n t('cpq.rowActions.deleteBulk.noEligible', 'None of the selected items can be deleted in their current state.'),\n 'error',\n )\n return { ok: false }\n }\n const confirmed = await confirm({\n title: t('cpq.rowActions.deleteBulk.confirm', 'Delete selected items ({count})?', { count: eligible.length }),\n variant: 'destructive',\n })\n if (!confirmed) return { ok: false }\n\n let failed = 0\n for (const row of eligible) {\n const ok = await deleteOne(row.id)\n if (!ok) failed += 1\n }\n\n if (failed > 0) {\n flash(\n t('cpq.rowActions.deleteBulk.partialError', 'Failed to delete {count} of the selected items', { count: failed }),\n 'error',\n )\n } else {\n flash(\n t('cpq.rowActions.deleteBulk.success', 'Selected items deleted ({count})', { count: eligible.length }),\n 'success',\n )\n }\n onReload()\n return { ok: failed === 0, affectedCount: eligible.length - failed }\n },\n [canDelete, confirm, deleteOne, onReload, t],\n )\n\n const buildItems = React.useCallback(\n (row: T, extras?: { prepend?: RowActionItem[]; append?: RowActionItem[] }): RowActionItem[] => {\n const items: RowActionItem[] = []\n if (extras?.prepend) items.push(...extras.prepend)\n items.push({\n id: 'edit',\n label: t('cpq.rowActions.edit', 'Edit'),\n href: editHref(row),\n })\n if (extras?.append) items.push(...extras.append)\n const deletable = !canDelete || canDelete(row)\n if (deletable) {\n items.push({\n id: 'delete',\n label: t('cpq.rowActions.delete', 'Delete'),\n destructive: true,\n onSelect: () => {\n void singleDelete(row)\n },\n })\n }\n return items\n },\n [canDelete, editHref, singleDelete, t],\n )\n\n return {\n buildItems,\n bulkDelete,\n ConfirmDialogElement,\n }\n}\n"],
5
+ "mappings": ";AACA,YAAY,WAAW;AACvB,SAAS,aAAa;AAEtB,SAAS,YAAY;AAC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,aAAO;AAAA,IACT;AAAA,IACA,CAAC,WAAW,UAAU,cAAc,CAAC;AAAA,EACvC;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { apiCall } from "@open-mercato/ui/backend/utils/apiCall";
4
+ function useGrantedFeatures(features) {
5
+ const [granted, setGranted] = React.useState([]);
6
+ const key = features.join("|");
7
+ React.useEffect(() => {
8
+ if (!key) return;
9
+ let cancelled = false;
10
+ void (async () => {
11
+ const call = await apiCall("/api/auth/feature-check", {
12
+ method: "POST",
13
+ headers: { "content-type": "application/json" },
14
+ body: JSON.stringify({ features: key.split("|") })
15
+ });
16
+ if (!cancelled && call.ok && call.result?.granted) setGranted(call.result.granted);
17
+ })();
18
+ return () => {
19
+ cancelled = true;
20
+ };
21
+ }, [key]);
22
+ return granted;
23
+ }
24
+ export {
25
+ useGrantedFeatures
26
+ };
27
+ //# sourceMappingURL=useGrantedFeatures.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/components/useGrantedFeatures.ts"],
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\n\ntype FeatureCheckResponse = { granted: string[] }\n\n/**\n * Resolve which of `features` the current user holds, through the framework's\n * `POST /api/auth/feature-check` endpoint (the same one the component-override\n * provider uses). Returns an empty list until the check completes, so callers\n * hide privileged actions by default.\n */\nexport function useGrantedFeatures(features: readonly string[]): readonly string[] {\n const [granted, setGranted] = React.useState<readonly string[]>([])\n const key = features.join('|')\n\n React.useEffect(() => {\n if (!key) return\n let cancelled = false\n void (async () => {\n const call = await apiCall<FeatureCheckResponse>('/api/auth/feature-check', {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ features: key.split('|') }),\n })\n if (!cancelled && call.ok && call.result?.granted) setGranted(call.result.granted)\n })()\n return () => {\n cancelled = true\n }\n }, [key])\n\n return granted\n}\n"],
5
+ "mappings": ";AAEA,YAAY,WAAW;AACvB,SAAS,eAAe;AAUjB,SAAS,mBAAmB,UAAgD;AACjF,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAA4B,CAAC,CAAC;AAClE,QAAM,MAAM,SAAS,KAAK,GAAG;AAE7B,QAAM,UAAU,MAAM;AACpB,QAAI,CAAC,IAAK;AACV,QAAI,YAAY;AAChB,UAAM,YAAY;AAChB,YAAM,OAAO,MAAM,QAA8B,2BAA2B;AAAA,QAC1E,QAAQ;AAAA,QACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,QAC9C,MAAM,KAAK,UAAU,EAAE,UAAU,IAAI,MAAM,GAAG,EAAE,CAAC;AAAA,MACnD,CAAC;AACD,UAAI,CAAC,aAAa,KAAK,MAAM,KAAK,QAAQ,QAAS,YAAW,KAAK,OAAO,OAAO;AAAA,IACnF,GAAG;AACH,WAAO,MAAM;AACX,kBAAY;AAAA,IACd;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -678,6 +678,7 @@ CpqPriceRule = __decorateClass([
678
678
  OptionalProps;
679
679
  let CpqQuoteConfiguration = class {
680
680
  constructor() {
681
+ this.pricingRevision = 0;
681
682
  this.cpqStatus = "new";
682
683
  this.version = 1;
683
684
  this.currencyCode = "USD";
@@ -701,6 +702,9 @@ __decorateClass([
701
702
  __decorateClass([
702
703
  Property({ name: "customer_id", type: "uuid" })
703
704
  ], CpqQuoteConfiguration.prototype, "customerId", 2);
705
+ __decorateClass([
706
+ Property({ name: "pricing_revision", type: "integer", default: 0 })
707
+ ], CpqQuoteConfiguration.prototype, "pricingRevision", 2);
704
708
  __decorateClass([
705
709
  Property({ name: "cpq_status", type: "text", default: "new" })
706
710
  ], CpqQuoteConfiguration.prototype, "cpqStatus", 2);
@@ -1534,6 +1538,98 @@ CpqSubscriptionChangeLog = __decorateClass([
1534
1538
  properties: ["sourceOrderId", "subscriptionId"]
1535
1539
  })
1536
1540
  ], CpqSubscriptionChangeLog);
1541
+ OptionalProps;
1542
+ let CpqQuotePriceAdjustment = class {
1543
+ constructor() {
1544
+ this.chargeCode = null;
1545
+ this.chargeTypeFilter = null;
1546
+ this.currencyCode = null;
1547
+ this.windowKind = "relative";
1548
+ this.fromMonth = 1;
1549
+ this.toMonth = null;
1550
+ this.reasonNote = null;
1551
+ this.updatedByUserId = null;
1552
+ this.isActive = true;
1553
+ this.createdAt = /* @__PURE__ */ new Date();
1554
+ this.updatedAt = /* @__PURE__ */ new Date();
1555
+ this.deletedAt = null;
1556
+ }
1557
+ };
1558
+ __decorateClass([
1559
+ PrimaryKey({ type: "uuid", defaultRaw: "gen_random_uuid()" })
1560
+ ], CpqQuotePriceAdjustment.prototype, "id", 2);
1561
+ __decorateClass([
1562
+ Property({ name: "organization_id", type: "uuid" })
1563
+ ], CpqQuotePriceAdjustment.prototype, "organizationId", 2);
1564
+ __decorateClass([
1565
+ Property({ name: "tenant_id", type: "uuid" })
1566
+ ], CpqQuotePriceAdjustment.prototype, "tenantId", 2);
1567
+ __decorateClass([
1568
+ Property({ name: "quote_configuration_id", type: "uuid" })
1569
+ ], CpqQuotePriceAdjustment.prototype, "quoteConfigurationId", 2);
1570
+ __decorateClass([
1571
+ Property({ name: "quote_id", type: "uuid" })
1572
+ ], CpqQuotePriceAdjustment.prototype, "quoteId", 2);
1573
+ __decorateClass([
1574
+ Property({ name: "quote_line_id", type: "uuid" })
1575
+ ], CpqQuotePriceAdjustment.prototype, "quoteLineId", 2);
1576
+ __decorateClass([
1577
+ Property({ type: "text" })
1578
+ ], CpqQuotePriceAdjustment.prototype, "level", 2);
1579
+ __decorateClass([
1580
+ Property({ name: "charge_code", type: "text", nullable: true })
1581
+ ], CpqQuotePriceAdjustment.prototype, "chargeCode", 2);
1582
+ __decorateClass([
1583
+ Property({ name: "charge_type_filter", type: "text", nullable: true })
1584
+ ], CpqQuotePriceAdjustment.prototype, "chargeTypeFilter", 2);
1585
+ __decorateClass([
1586
+ Property({ name: "adjustment_type", type: "text" })
1587
+ ], CpqQuotePriceAdjustment.prototype, "adjustmentType", 2);
1588
+ __decorateClass([
1589
+ Property({ type: "numeric", columnType: "numeric(18, 4)" })
1590
+ ], CpqQuotePriceAdjustment.prototype, "value", 2);
1591
+ __decorateClass([
1592
+ Property({ name: "currency_code", type: "text", nullable: true })
1593
+ ], CpqQuotePriceAdjustment.prototype, "currencyCode", 2);
1594
+ __decorateClass([
1595
+ Property({ name: "window_kind", type: "text", default: "relative" })
1596
+ ], CpqQuotePriceAdjustment.prototype, "windowKind", 2);
1597
+ __decorateClass([
1598
+ Property({ name: "from_month", type: "integer", default: 1 })
1599
+ ], CpqQuotePriceAdjustment.prototype, "fromMonth", 2);
1600
+ __decorateClass([
1601
+ Property({ name: "to_month", type: "integer", nullable: true })
1602
+ ], CpqQuotePriceAdjustment.prototype, "toMonth", 2);
1603
+ __decorateClass([
1604
+ Property({ name: "reason_code", type: "text" })
1605
+ ], CpqQuotePriceAdjustment.prototype, "reasonCode", 2);
1606
+ __decorateClass([
1607
+ Property({ name: "reason_note", type: "text", nullable: true })
1608
+ ], CpqQuotePriceAdjustment.prototype, "reasonNote", 2);
1609
+ __decorateClass([
1610
+ Property({ name: "created_by_user_id", type: "uuid" })
1611
+ ], CpqQuotePriceAdjustment.prototype, "createdByUserId", 2);
1612
+ __decorateClass([
1613
+ Property({ name: "updated_by_user_id", type: "uuid", nullable: true })
1614
+ ], CpqQuotePriceAdjustment.prototype, "updatedByUserId", 2);
1615
+ __decorateClass([
1616
+ Property({ name: "is_active", type: "boolean", default: true })
1617
+ ], CpqQuotePriceAdjustment.prototype, "isActive", 2);
1618
+ __decorateClass([
1619
+ Property({ name: "created_at", type: Date, onCreate: () => /* @__PURE__ */ new Date() })
1620
+ ], CpqQuotePriceAdjustment.prototype, "createdAt", 2);
1621
+ __decorateClass([
1622
+ Property({ name: "updated_at", type: Date, onUpdate: () => /* @__PURE__ */ new Date() })
1623
+ ], CpqQuotePriceAdjustment.prototype, "updatedAt", 2);
1624
+ __decorateClass([
1625
+ Property({ name: "deleted_at", type: Date, nullable: true })
1626
+ ], CpqQuotePriceAdjustment.prototype, "deletedAt", 2);
1627
+ CpqQuotePriceAdjustment = __decorateClass([
1628
+ Entity({ tableName: "cpq_quote_price_adjustments" }),
1629
+ Index({ name: "cpq_qpa_quote_config_idx", properties: ["organizationId", "tenantId", "quoteConfigurationId"] }),
1630
+ Index({ name: "cpq_qpa_quote_line_idx", properties: ["organizationId", "tenantId", "quoteLineId"] }),
1631
+ Index({ name: "cpq_qpa_quote_idx", properties: ["organizationId", "tenantId", "quoteId"] })
1632
+ ], CpqQuotePriceAdjustment);
1537
1633
  export {
1538
1634
  CpqBundleSlot,
1539
1635
  CpqInventoryAsset,
@@ -1552,6 +1648,7 @@ export {
1552
1648
  CpqProductSpecification,
1553
1649
  CpqQuoteConfiguration,
1554
1650
  CpqQuoteLineConfiguration,
1651
+ CpqQuotePriceAdjustment,
1555
1652
  CpqQuoteTargetSubscription,
1556
1653
  CpqSubscriptionChangeLog,
1557
1654
  CpqWizardDefinition