@dainamite/cpq 0.2.2

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 (504) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/LICENSE +21 -0
  3. package/MIGRATION.md +236 -0
  4. package/README.md +108 -0
  5. package/dist/modules/cpq/acl.js +30 -0
  6. package/dist/modules/cpq/acl.js.map +7 -0
  7. package/dist/modules/cpq/api/_helpers/handleArcError.js +37 -0
  8. package/dist/modules/cpq/api/_helpers/handleArcError.js.map +7 -0
  9. package/dist/modules/cpq/api/attribute-options/route.js +47 -0
  10. package/dist/modules/cpq/api/attribute-options/route.js.map +7 -0
  11. package/dist/modules/cpq/api/bundle-slots/route.js +101 -0
  12. package/dist/modules/cpq/api/bundle-slots/route.js.map +7 -0
  13. package/dist/modules/cpq/api/bundle-tree/route.js +28 -0
  14. package/dist/modules/cpq/api/bundle-tree/route.js.map +7 -0
  15. package/dist/modules/cpq/api/context.js +29 -0
  16. package/dist/modules/cpq/api/context.js.map +7 -0
  17. package/dist/modules/cpq/api/inventory/assets/route.js +113 -0
  18. package/dist/modules/cpq/api/inventory/assets/route.js.map +7 -0
  19. package/dist/modules/cpq/api/inventory/assets/status/route.js +35 -0
  20. package/dist/modules/cpq/api/inventory/assets/status/route.js.map +7 -0
  21. package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js +30 -0
  22. package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js.map +7 -0
  23. package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js +31 -0
  24. package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js.map +7 -0
  25. package/dist/modules/cpq/api/inventory/subscription-items/route.js +99 -0
  26. package/dist/modules/cpq/api/inventory/subscription-items/route.js.map +7 -0
  27. package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js +57 -0
  28. package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js.map +7 -0
  29. package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js +62 -0
  30. package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js.map +7 -0
  31. package/dist/modules/cpq/api/inventory/subscriptions/route.js +116 -0
  32. package/dist/modules/cpq/api/inventory/subscriptions/route.js.map +7 -0
  33. package/dist/modules/cpq/api/inventory/subscriptions/status/route.js +35 -0
  34. package/dist/modules/cpq/api/inventory/subscriptions/status/route.js.map +7 -0
  35. package/dist/modules/cpq/api/offering-components/route.js +91 -0
  36. package/dist/modules/cpq/api/offering-components/route.js.map +7 -0
  37. package/dist/modules/cpq/api/orders/[orderId]/activate/route.js +39 -0
  38. package/dist/modules/cpq/api/orders/[orderId]/activate/route.js.map +7 -0
  39. package/dist/modules/cpq/api/orders/[orderId]/route.js +28 -0
  40. package/dist/modules/cpq/api/orders/[orderId]/route.js.map +7 -0
  41. package/dist/modules/cpq/api/orders/[orderId]/status/route.js +38 -0
  42. package/dist/modules/cpq/api/orders/[orderId]/status/route.js.map +7 -0
  43. package/dist/modules/cpq/api/orders/route.js +71 -0
  44. package/dist/modules/cpq/api/orders/route.js.map +7 -0
  45. package/dist/modules/cpq/api/price-rules/route.js +180 -0
  46. package/dist/modules/cpq/api/price-rules/route.js.map +7 -0
  47. package/dist/modules/cpq/api/pricing-table-entries/route.js +142 -0
  48. package/dist/modules/cpq/api/pricing-table-entries/route.js.map +7 -0
  49. package/dist/modules/cpq/api/pricing-tables/route.js +179 -0
  50. package/dist/modules/cpq/api/pricing-tables/route.js.map +7 -0
  51. package/dist/modules/cpq/api/product-attributes/route.js +160 -0
  52. package/dist/modules/cpq/api/product-attributes/route.js.map +7 -0
  53. package/dist/modules/cpq/api/product-charges/route.js +166 -0
  54. package/dist/modules/cpq/api/product-charges/route.js.map +7 -0
  55. package/dist/modules/cpq/api/product-offerings/route.js +294 -0
  56. package/dist/modules/cpq/api/product-offerings/route.js.map +7 -0
  57. package/dist/modules/cpq/api/product-relationships/route.js +144 -0
  58. package/dist/modules/cpq/api/product-relationships/route.js.map +7 -0
  59. package/dist/modules/cpq/api/product-specifications/route.js +292 -0
  60. package/dist/modules/cpq/api/product-specifications/route.js.map +7 -0
  61. package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js +71 -0
  62. package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js.map +7 -0
  63. package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js +29 -0
  64. package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js.map +7 -0
  65. package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js +54 -0
  66. package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js.map +7 -0
  67. package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js +27 -0
  68. package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js.map +7 -0
  69. package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js +72 -0
  70. package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js.map +7 -0
  71. package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js +35 -0
  72. package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js.map +7 -0
  73. package/dist/modules/cpq/api/quotes/[quoteId]/route.js +102 -0
  74. package/dist/modules/cpq/api/quotes/[quoteId]/route.js.map +7 -0
  75. package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js +27 -0
  76. package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js.map +7 -0
  77. package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js +79 -0
  78. package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js.map +7 -0
  79. package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js +95 -0
  80. package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js.map +7 -0
  81. package/dist/modules/cpq/api/quotes/attributes/route.js +52 -0
  82. package/dist/modules/cpq/api/quotes/attributes/route.js.map +7 -0
  83. package/dist/modules/cpq/api/quotes/from-subscription/route.js +72 -0
  84. package/dist/modules/cpq/api/quotes/from-subscription/route.js.map +7 -0
  85. package/dist/modules/cpq/api/quotes/price/route.js +69 -0
  86. package/dist/modules/cpq/api/quotes/price/route.js.map +7 -0
  87. package/dist/modules/cpq/api/quotes/route.js +97 -0
  88. package/dist/modules/cpq/api/quotes/route.js.map +7 -0
  89. package/dist/modules/cpq/api/quotes/validate-relationships/route.js +86 -0
  90. package/dist/modules/cpq/api/quotes/validate-relationships/route.js.map +7 -0
  91. package/dist/modules/cpq/api/resolveQuotingService.js +7 -0
  92. package/dist/modules/cpq/api/resolveQuotingService.js.map +7 -0
  93. package/dist/modules/cpq/api/wizards/resolve/route.js +38 -0
  94. package/dist/modules/cpq/api/wizards/resolve/route.js.map +7 -0
  95. package/dist/modules/cpq/api/wizards/route.js +111 -0
  96. package/dist/modules/cpq/api/wizards/route.js.map +7 -0
  97. package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js +136 -0
  98. package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js.map +7 -0
  99. package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js +185 -0
  100. package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js.map +7 -0
  101. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js +343 -0
  102. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js.map +7 -0
  103. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js +13 -0
  104. package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js.map +7 -0
  105. package/dist/modules/cpq/backend/cpq/inventory/page.js +35 -0
  106. package/dist/modules/cpq/backend/cpq/inventory/page.js.map +7 -0
  107. package/dist/modules/cpq/backend/cpq/inventory/page.meta.js +18 -0
  108. package/dist/modules/cpq/backend/cpq/inventory/page.meta.js.map +7 -0
  109. package/dist/modules/cpq/backend/cpq/inventory/shared.js +20 -0
  110. package/dist/modules/cpq/backend/cpq/inventory/shared.js.map +7 -0
  111. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js +794 -0
  112. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js.map +7 -0
  113. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js +13 -0
  114. package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js.map +7 -0
  115. package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js +917 -0
  116. package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js.map +7 -0
  117. package/dist/modules/cpq/backend/cpq/offerings/page.js +405 -0
  118. package/dist/modules/cpq/backend/cpq/offerings/page.js.map +7 -0
  119. package/dist/modules/cpq/backend/cpq/offerings/page.meta.js +18 -0
  120. package/dist/modules/cpq/backend/cpq/offerings/page.meta.js.map +7 -0
  121. package/dist/modules/cpq/backend/cpq/orders/[id]/page.js +677 -0
  122. package/dist/modules/cpq/backend/cpq/orders/[id]/page.js.map +7 -0
  123. package/dist/modules/cpq/backend/cpq/orders/page.js +134 -0
  124. package/dist/modules/cpq/backend/cpq/orders/page.js.map +7 -0
  125. package/dist/modules/cpq/backend/cpq/orders/page.meta.js +18 -0
  126. package/dist/modules/cpq/backend/cpq/orders/page.meta.js.map +7 -0
  127. package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js +272 -0
  128. package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js.map +7 -0
  129. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js +407 -0
  130. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js.map +7 -0
  131. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js +13 -0
  132. package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js.map +7 -0
  133. package/dist/modules/cpq/backend/cpq/price-rules/page.js +211 -0
  134. package/dist/modules/cpq/backend/cpq/price-rules/page.js.map +7 -0
  135. package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js +18 -0
  136. package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js.map +7 -0
  137. package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js +275 -0
  138. package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js.map +7 -0
  139. package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js +112 -0
  140. package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js.map +7 -0
  141. package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js +492 -0
  142. package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js.map +7 -0
  143. package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js +50 -0
  144. package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js.map +7 -0
  145. package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js +249 -0
  146. package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js.map +7 -0
  147. package/dist/modules/cpq/backend/cpq/pricing/page.js +87 -0
  148. package/dist/modules/cpq/backend/cpq/pricing/page.js.map +7 -0
  149. package/dist/modules/cpq/backend/cpq/pricing/page.meta.js +18 -0
  150. package/dist/modules/cpq/backend/cpq/pricing/page.meta.js.map +7 -0
  151. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js +652 -0
  152. package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js.map +7 -0
  153. package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js +1289 -0
  154. package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js.map +7 -0
  155. package/dist/modules/cpq/backend/cpq/quotes/page.js +283 -0
  156. package/dist/modules/cpq/backend/cpq/quotes/page.js.map +7 -0
  157. package/dist/modules/cpq/backend/cpq/quotes/page.meta.js +18 -0
  158. package/dist/modules/cpq/backend/cpq/quotes/page.meta.js.map +7 -0
  159. package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js +214 -0
  160. package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js.map +7 -0
  161. package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js +1399 -0
  162. package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js.map +7 -0
  163. package/dist/modules/cpq/backend/cpq/specifications/page.js +148 -0
  164. package/dist/modules/cpq/backend/cpq/specifications/page.js.map +7 -0
  165. package/dist/modules/cpq/backend/cpq/specifications/page.meta.js +18 -0
  166. package/dist/modules/cpq/backend/cpq/specifications/page.meta.js.map +7 -0
  167. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js +204 -0
  168. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js.map +7 -0
  169. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js +191 -0
  170. package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js.map +7 -0
  171. package/dist/modules/cpq/backend/cpq/wizards/page.js +119 -0
  172. package/dist/modules/cpq/backend/cpq/wizards/page.js.map +7 -0
  173. package/dist/modules/cpq/backend/cpq/wizards/page.meta.js +18 -0
  174. package/dist/modules/cpq/backend/cpq/wizards/page.meta.js.map +7 -0
  175. package/dist/modules/cpq/ce.js +151 -0
  176. package/dist/modules/cpq/ce.js.map +7 -0
  177. package/dist/modules/cpq/cli.js +11 -0
  178. package/dist/modules/cpq/cli.js.map +7 -0
  179. package/dist/modules/cpq/components/CpqListView.js +265 -0
  180. package/dist/modules/cpq/components/CpqListView.js.map +7 -0
  181. package/dist/modules/cpq/components/NumberInput.js +95 -0
  182. package/dist/modules/cpq/components/NumberInput.js.map +7 -0
  183. package/dist/modules/cpq/components/StatusPath.js +60 -0
  184. package/dist/modules/cpq/components/StatusPath.js.map +7 -0
  185. package/dist/modules/cpq/components/statusMaps.js +66 -0
  186. package/dist/modules/cpq/components/statusMaps.js.map +7 -0
  187. package/dist/modules/cpq/components/useCpqRowActions.js +125 -0
  188. package/dist/modules/cpq/components/useCpqRowActions.js.map +7 -0
  189. package/dist/modules/cpq/data/entities.js +1556 -0
  190. package/dist/modules/cpq/data/entities.js.map +7 -0
  191. package/dist/modules/cpq/data/validators.js +575 -0
  192. package/dist/modules/cpq/data/validators.js.map +7 -0
  193. package/dist/modules/cpq/di.js +57 -0
  194. package/dist/modules/cpq/di.js.map +7 -0
  195. package/dist/modules/cpq/events.js +50 -0
  196. package/dist/modules/cpq/events.js.map +7 -0
  197. package/dist/modules/cpq/index.js +16 -0
  198. package/dist/modules/cpq/index.js.map +7 -0
  199. package/dist/modules/cpq/lib/seeds/api.js +32 -0
  200. package/dist/modules/cpq/lib/seeds/api.js.map +7 -0
  201. package/dist/modules/cpq/lib/seeds/tenant-provisioning.js +158 -0
  202. package/dist/modules/cpq/lib/seeds/tenant-provisioning.js.map +7 -0
  203. package/dist/modules/cpq/lib/seeds.js +6 -0
  204. package/dist/modules/cpq/lib/seeds.js.map +7 -0
  205. package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js +40 -0
  206. package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js.map +7 -0
  207. package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js +54 -0
  208. package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js.map +7 -0
  209. package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js +15 -0
  210. package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js.map +7 -0
  211. package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js +62 -0
  212. package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js.map +7 -0
  213. package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js +56 -0
  214. package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js.map +7 -0
  215. package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js +26 -0
  216. package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js.map +7 -0
  217. package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js +37 -0
  218. package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js.map +7 -0
  219. package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js +35 -0
  220. package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js.map +7 -0
  221. package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js +21 -0
  222. package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js.map +7 -0
  223. package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js +46 -0
  224. package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js.map +7 -0
  225. package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js +118 -0
  226. package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js.map +7 -0
  227. package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js +63 -0
  228. package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js.map +7 -0
  229. package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js +28 -0
  230. package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js.map +7 -0
  231. package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js +36 -0
  232. package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js.map +7 -0
  233. package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js +14 -0
  234. package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js.map +7 -0
  235. package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js +14 -0
  236. package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js.map +7 -0
  237. package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js +58 -0
  238. package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js.map +7 -0
  239. package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js +29 -0
  240. package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js.map +7 -0
  241. package/dist/modules/cpq/services/cpqBundleService.js +447 -0
  242. package/dist/modules/cpq/services/cpqBundleService.js.map +7 -0
  243. package/dist/modules/cpq/services/cpqInventoryService.js +1371 -0
  244. package/dist/modules/cpq/services/cpqInventoryService.js.map +7 -0
  245. package/dist/modules/cpq/services/cpqOrderService.js +901 -0
  246. package/dist/modules/cpq/services/cpqOrderService.js.map +7 -0
  247. package/dist/modules/cpq/services/cpqPricingService.js +289 -0
  248. package/dist/modules/cpq/services/cpqPricingService.js.map +7 -0
  249. package/dist/modules/cpq/services/cpqProductService.js +204 -0
  250. package/dist/modules/cpq/services/cpqProductService.js.map +7 -0
  251. package/dist/modules/cpq/services/cpqQuotingService.js +1867 -0
  252. package/dist/modules/cpq/services/cpqQuotingService.js.map +7 -0
  253. package/dist/modules/cpq/services/cpqValidationService.js +234 -0
  254. package/dist/modules/cpq/services/cpqValidationService.js.map +7 -0
  255. package/dist/modules/cpq/services/cpqWizardService.js +137 -0
  256. package/dist/modules/cpq/services/cpqWizardService.js.map +7 -0
  257. package/dist/modules/cpq/services/types.js +114 -0
  258. package/dist/modules/cpq/services/types.js.map +7 -0
  259. package/dist/modules/cpq/setup.js +49 -0
  260. package/dist/modules/cpq/setup.js.map +7 -0
  261. package/dist/modules/cpq/subscribers/subscription-amended-log.js +18 -0
  262. package/dist/modules/cpq/subscribers/subscription-amended-log.js.map +7 -0
  263. package/dist/modules/cpq/subscribers/subscription-cancelled-log.js +19 -0
  264. package/dist/modules/cpq/subscribers/subscription-cancelled-log.js.map +7 -0
  265. package/dist/modules/cpq/subscribers/subscription-merged-log.js +20 -0
  266. package/dist/modules/cpq/subscribers/subscription-merged-log.js.map +7 -0
  267. package/dist/modules/cpq/subscribers/subscription-renewed-log.js +18 -0
  268. package/dist/modules/cpq/subscribers/subscription-renewed-log.js.map +7 -0
  269. package/dist/modules/cpq/subscribers/subscription-superseded-log.js +18 -0
  270. package/dist/modules/cpq/subscribers/subscription-superseded-log.js.map +7 -0
  271. package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js +192 -0
  272. package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js.map +7 -0
  273. package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js +17 -0
  274. package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js.map +7 -0
  275. package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js +79 -0
  276. package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js.map +7 -0
  277. package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js +17 -0
  278. package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js.map +7 -0
  279. package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js +181 -0
  280. package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js.map +7 -0
  281. package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js +17 -0
  282. package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js.map +7 -0
  283. package/dist/modules/cpq/widgets/injection-table.js +44 -0
  284. package/dist/modules/cpq/widgets/injection-table.js.map +7 -0
  285. package/dist/modules/cpq/workflows/WizardRunner.js +113 -0
  286. package/dist/modules/cpq/workflows/WizardRunner.js.map +7 -0
  287. package/dist/modules/cpq/workflows/WizardTrigger.js +116 -0
  288. package/dist/modules/cpq/workflows/WizardTrigger.js.map +7 -0
  289. package/dist/modules/cpq/workflows/engine.js +188 -0
  290. package/dist/modules/cpq/workflows/engine.js.map +7 -0
  291. package/dist/modules/cpq/workflows/registry.js +16 -0
  292. package/dist/modules/cpq/workflows/registry.js.map +7 -0
  293. package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js +119 -0
  294. package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js.map +7 -0
  295. package/dist/modules/cpq/workflows/steps/InventorySelectStep.js +24 -0
  296. package/dist/modules/cpq/workflows/steps/InventorySelectStep.js.map +7 -0
  297. package/dist/modules/cpq/workflows/steps/ItemListStep.js +115 -0
  298. package/dist/modules/cpq/workflows/steps/ItemListStep.js.map +7 -0
  299. package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js +327 -0
  300. package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js.map +7 -0
  301. package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js +231 -0
  302. package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js.map +7 -0
  303. package/dist/modules/cpq/workflows/steps/ReviewStep.js +152 -0
  304. package/dist/modules/cpq/workflows/steps/ReviewStep.js.map +7 -0
  305. package/dist/modules/cpq/workflows/steps/index.js +49 -0
  306. package/dist/modules/cpq/workflows/steps/index.js.map +7 -0
  307. package/dist/modules/cpq/workflows/types.js +1 -0
  308. package/dist/modules/cpq/workflows/types.js.map +7 -0
  309. package/package.json +150 -0
  310. package/src/modules/cpq/__integration__/TC-CPQ-001.spec.ts +177 -0
  311. package/src/modules/cpq/__integration__/TC-CPQ-002.spec.ts +123 -0
  312. package/src/modules/cpq/__integration__/TC-CPQ-003.spec.ts +115 -0
  313. package/src/modules/cpq/__integration__/TC-CPQ-004.spec.ts +184 -0
  314. package/src/modules/cpq/__integration__/TC-CPQ-005.spec.ts +43 -0
  315. package/src/modules/cpq/__integration__/TC-CPQ-006.spec.ts +87 -0
  316. package/src/modules/cpq/__integration__/TC-CPQ-007.spec.ts +79 -0
  317. package/src/modules/cpq/__integration__/TC-CPQ-008.spec.ts +55 -0
  318. package/src/modules/cpq/__integration__/TC-CPQ-009.spec.ts +45 -0
  319. package/src/modules/cpq/__integration__/TC-CPQ-010.spec.ts +54 -0
  320. package/src/modules/cpq/__integration__/TC-CPQ-011.spec.ts +24 -0
  321. package/src/modules/cpq/__integration__/TC-CPQ-012.spec.ts +62 -0
  322. package/src/modules/cpq/__integration__/TC-CPQ-ARC-001.spec.ts +52 -0
  323. package/src/modules/cpq/__integration__/TC-CPQ-ARC-002.spec.ts +65 -0
  324. package/src/modules/cpq/__integration__/TC-CPQ-ARC-003.spec.ts +107 -0
  325. package/src/modules/cpq/__integration__/TC-CPQ-ARC-004.spec.ts +74 -0
  326. package/src/modules/cpq/__integration__/TC-CPQ-ARC-005.spec.ts +86 -0
  327. package/src/modules/cpq/__integration__/TC-CPQ-ARC-006.spec.ts +79 -0
  328. package/src/modules/cpq/__integration__/TC-CPQ-ARC-007.spec.ts +63 -0
  329. package/src/modules/cpq/__integration__/TC-CPQ-ARC-008.spec.ts +62 -0
  330. package/src/modules/cpq/__integration__/TC-CPQ-ARC-009.spec.ts +62 -0
  331. package/src/modules/cpq/__integration__/TC-CPQ-ARC-010.spec.ts +59 -0
  332. package/src/modules/cpq/__integration__/TC-CPQ-ARC-011.spec.ts +128 -0
  333. package/src/modules/cpq/__integration__/_helpers/cpqArcFixtures.ts +208 -0
  334. package/src/modules/cpq/__tests__/package-isolation.test.ts +232 -0
  335. package/src/modules/cpq/acl.ts +26 -0
  336. package/src/modules/cpq/api/_helpers/__tests__/handleArcError.test.ts +117 -0
  337. package/src/modules/cpq/api/_helpers/handleArcError.ts +81 -0
  338. package/src/modules/cpq/api/attribute-options/route.ts +55 -0
  339. package/src/modules/cpq/api/bundle-slots/route.ts +112 -0
  340. package/src/modules/cpq/api/bundle-tree/route.ts +31 -0
  341. package/src/modules/cpq/api/context.ts +39 -0
  342. package/src/modules/cpq/api/inventory/assets/route.ts +123 -0
  343. package/src/modules/cpq/api/inventory/assets/status/route.ts +34 -0
  344. package/src/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.ts +30 -0
  345. package/src/modules/cpq/api/inventory/customer/[customerId]/route.ts +31 -0
  346. package/src/modules/cpq/api/inventory/subscription-items/route.ts +107 -0
  347. package/src/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.ts +64 -0
  348. package/src/modules/cpq/api/inventory/subscriptions/expiring/route.ts +66 -0
  349. package/src/modules/cpq/api/inventory/subscriptions/route.ts +126 -0
  350. package/src/modules/cpq/api/inventory/subscriptions/status/route.ts +34 -0
  351. package/src/modules/cpq/api/offering-components/route.ts +103 -0
  352. package/src/modules/cpq/api/orders/[orderId]/activate/route.ts +48 -0
  353. package/src/modules/cpq/api/orders/[orderId]/route.ts +28 -0
  354. package/src/modules/cpq/api/orders/[orderId]/status/route.ts +38 -0
  355. package/src/modules/cpq/api/orders/route.ts +77 -0
  356. package/src/modules/cpq/api/price-rules/route.ts +210 -0
  357. package/src/modules/cpq/api/pricing-table-entries/route.ts +159 -0
  358. package/src/modules/cpq/api/pricing-tables/route.ts +202 -0
  359. package/src/modules/cpq/api/product-attributes/route.ts +175 -0
  360. package/src/modules/cpq/api/product-charges/route.ts +181 -0
  361. package/src/modules/cpq/api/product-offerings/route.ts +329 -0
  362. package/src/modules/cpq/api/product-relationships/route.ts +156 -0
  363. package/src/modules/cpq/api/product-specifications/route.ts +325 -0
  364. package/src/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.ts +77 -0
  365. package/src/modules/cpq/api/quotes/[quoteId]/clone/route.ts +28 -0
  366. package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.ts +55 -0
  367. package/src/modules/cpq/api/quotes/[quoteId]/items/route.ts +26 -0
  368. package/src/modules/cpq/api/quotes/[quoteId]/merge-meta/route.ts +78 -0
  369. package/src/modules/cpq/api/quotes/[quoteId]/recalculate/route.ts +34 -0
  370. package/src/modules/cpq/api/quotes/[quoteId]/route.ts +109 -0
  371. package/src/modules/cpq/api/quotes/[quoteId]/status/route.ts +26 -0
  372. package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.ts +91 -0
  373. package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.ts +107 -0
  374. package/src/modules/cpq/api/quotes/attributes/route.ts +61 -0
  375. package/src/modules/cpq/api/quotes/from-subscription/route.ts +85 -0
  376. package/src/modules/cpq/api/quotes/price/route.ts +81 -0
  377. package/src/modules/cpq/api/quotes/route.ts +114 -0
  378. package/src/modules/cpq/api/quotes/validate-relationships/route.ts +100 -0
  379. package/src/modules/cpq/api/resolveQuotingService.ts +11 -0
  380. package/src/modules/cpq/api/wizards/resolve/route.ts +39 -0
  381. package/src/modules/cpq/api/wizards/route.ts +127 -0
  382. package/src/modules/cpq/backend/cpq/inventory/AssetsTable.tsx +166 -0
  383. package/src/modules/cpq/backend/cpq/inventory/SubscriptionsTable.tsx +251 -0
  384. package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.ts +9 -0
  385. package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.tsx +440 -0
  386. package/src/modules/cpq/backend/cpq/inventory/page.meta.ts +16 -0
  387. package/src/modules/cpq/backend/cpq/inventory/page.tsx +49 -0
  388. package/src/modules/cpq/backend/cpq/inventory/shared.tsx +32 -0
  389. package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.ts +9 -0
  390. package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.tsx +1085 -0
  391. package/src/modules/cpq/backend/cpq/offerings/[id]/page.tsx +1165 -0
  392. package/src/modules/cpq/backend/cpq/offerings/page.meta.ts +16 -0
  393. package/src/modules/cpq/backend/cpq/offerings/page.tsx +468 -0
  394. package/src/modules/cpq/backend/cpq/orders/[id]/page.tsx +921 -0
  395. package/src/modules/cpq/backend/cpq/orders/page.meta.ts +16 -0
  396. package/src/modules/cpq/backend/cpq/orders/page.tsx +182 -0
  397. package/src/modules/cpq/backend/cpq/price-rules/PriceRuleForm.tsx +310 -0
  398. package/src/modules/cpq/backend/cpq/price-rules/[id]/page.meta.ts +9 -0
  399. package/src/modules/cpq/backend/cpq/price-rules/[id]/page.tsx +472 -0
  400. package/src/modules/cpq/backend/cpq/price-rules/page.meta.ts +16 -0
  401. package/src/modules/cpq/backend/cpq/price-rules/page.tsx +253 -0
  402. package/src/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.tsx +431 -0
  403. package/src/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.tsx +122 -0
  404. package/src/modules/cpq/backend/cpq/pricing/[id]/page.tsx +588 -0
  405. package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.ts +90 -0
  406. package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.ts +338 -0
  407. package/src/modules/cpq/backend/cpq/pricing/page.meta.ts +16 -0
  408. package/src/modules/cpq/backend/cpq/pricing/page.tsx +111 -0
  409. package/src/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.tsx +737 -0
  410. package/src/modules/cpq/backend/cpq/quotes/[id]/page.tsx +1721 -0
  411. package/src/modules/cpq/backend/cpq/quotes/page.meta.ts +16 -0
  412. package/src/modules/cpq/backend/cpq/quotes/page.tsx +370 -0
  413. package/src/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.tsx +300 -0
  414. package/src/modules/cpq/backend/cpq/specifications/[id]/page.tsx +1722 -0
  415. package/src/modules/cpq/backend/cpq/specifications/page.meta.ts +16 -0
  416. package/src/modules/cpq/backend/cpq/specifications/page.tsx +191 -0
  417. package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.tsx +319 -0
  418. package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/page.tsx +234 -0
  419. package/src/modules/cpq/backend/cpq/wizards/page.meta.ts +16 -0
  420. package/src/modules/cpq/backend/cpq/wizards/page.tsx +141 -0
  421. package/src/modules/cpq/ce.ts +150 -0
  422. package/src/modules/cpq/cli.ts +10 -0
  423. package/src/modules/cpq/components/CpqListView.tsx +431 -0
  424. package/src/modules/cpq/components/NumberInput.tsx +166 -0
  425. package/src/modules/cpq/components/StatusPath.tsx +116 -0
  426. package/src/modules/cpq/components/statusMaps.ts +148 -0
  427. package/src/modules/cpq/components/useCpqRowActions.tsx +183 -0
  428. package/src/modules/cpq/data/__tests__/validators.arc.test.ts +271 -0
  429. package/src/modules/cpq/data/__tests__/validators.test.ts +782 -0
  430. package/src/modules/cpq/data/entities.ts +1467 -0
  431. package/src/modules/cpq/data/validators.ts +663 -0
  432. package/src/modules/cpq/di.ts +70 -0
  433. package/src/modules/cpq/events.ts +62 -0
  434. package/src/modules/cpq/index.ts +15 -0
  435. package/src/modules/cpq/lib/seeds/__tests__/api.test.ts +86 -0
  436. package/src/modules/cpq/lib/seeds/__tests__/tenant-provisioning.test.ts +349 -0
  437. package/src/modules/cpq/lib/seeds/api.ts +119 -0
  438. package/src/modules/cpq/lib/seeds/tenant-provisioning.ts +239 -0
  439. package/src/modules/cpq/lib/seeds.ts +18 -0
  440. package/src/modules/cpq/migrations/.snapshot-open-mercato.json +7473 -0
  441. package/src/modules/cpq/migrations/Migration20260220220000_cpq.ts +51 -0
  442. package/src/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.ts +70 -0
  443. package/src/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.ts +15 -0
  444. package/src/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.ts +73 -0
  445. package/src/modules/cpq/migrations/Migration20260402000000_cpq_workflows.ts +59 -0
  446. package/src/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.ts +30 -0
  447. package/src/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.ts +36 -0
  448. package/src/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.ts +33 -0
  449. package/src/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.ts +22 -0
  450. package/src/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.ts +56 -0
  451. package/src/modules/cpq/migrations/Migration20260410100000_cpq_inventory.ts +118 -0
  452. package/src/modules/cpq/migrations/Migration20260411000000_cpq_orders.ts +62 -0
  453. package/src/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.ts +33 -0
  454. package/src/modules/cpq/migrations/Migration20260504064621_cpq_arc.ts +68 -0
  455. package/src/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.ts +30 -0
  456. package/src/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.ts +27 -0
  457. package/src/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.ts +82 -0
  458. package/src/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.ts +52 -0
  459. package/src/modules/cpq/services/__tests__/_helpers/mockEm.ts +59 -0
  460. package/src/modules/cpq/services/__tests__/cpqBundleService.test.ts +661 -0
  461. package/src/modules/cpq/services/__tests__/cpqInventoryService.arc.test.ts +357 -0
  462. package/src/modules/cpq/services/__tests__/cpqInventoryService.test.ts +718 -0
  463. package/src/modules/cpq/services/__tests__/cpqOrderService.test.ts +603 -0
  464. package/src/modules/cpq/services/__tests__/cpqPricingService.test.ts +1012 -0
  465. package/src/modules/cpq/services/__tests__/cpqProductService.test.ts +603 -0
  466. package/src/modules/cpq/services/__tests__/cpqQuotingService.arc.test.ts +143 -0
  467. package/src/modules/cpq/services/__tests__/cpqQuotingService.test.ts +658 -0
  468. package/src/modules/cpq/services/__tests__/cpqValidationService.test.ts +811 -0
  469. package/src/modules/cpq/services/__tests__/cpqWizardService.test.ts +389 -0
  470. package/src/modules/cpq/services/__tests__/types.test.ts +359 -0
  471. package/src/modules/cpq/services/cpqBundleService.ts +671 -0
  472. package/src/modules/cpq/services/cpqInventoryService.ts +1929 -0
  473. package/src/modules/cpq/services/cpqOrderService.ts +1230 -0
  474. package/src/modules/cpq/services/cpqPricingService.ts +412 -0
  475. package/src/modules/cpq/services/cpqProductService.ts +311 -0
  476. package/src/modules/cpq/services/cpqQuotingService.ts +2638 -0
  477. package/src/modules/cpq/services/cpqValidationService.ts +323 -0
  478. package/src/modules/cpq/services/cpqWizardService.ts +204 -0
  479. package/src/modules/cpq/services/types.ts +303 -0
  480. package/src/modules/cpq/setup.ts +63 -0
  481. package/src/modules/cpq/subscribers/subscription-amended-log.ts +20 -0
  482. package/src/modules/cpq/subscribers/subscription-cancelled-log.ts +19 -0
  483. package/src/modules/cpq/subscribers/subscription-merged-log.ts +22 -0
  484. package/src/modules/cpq/subscribers/subscription-renewed-log.ts +18 -0
  485. package/src/modules/cpq/subscribers/subscription-superseded-log.ts +19 -0
  486. package/src/modules/cpq/widgets/injection/customer-inventory/widget.client.tsx +339 -0
  487. package/src/modules/cpq/widgets/injection/customer-inventory/widget.ts +16 -0
  488. package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.client.tsx +96 -0
  489. package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.ts +16 -0
  490. package/src/modules/cpq/widgets/injection/quote-configurator/widget.client.tsx +265 -0
  491. package/src/modules/cpq/widgets/injection/quote-configurator/widget.ts +16 -0
  492. package/src/modules/cpq/widgets/injection-table.ts +42 -0
  493. package/src/modules/cpq/workflows/WizardRunner.tsx +158 -0
  494. package/src/modules/cpq/workflows/WizardTrigger.tsx +142 -0
  495. package/src/modules/cpq/workflows/engine.tsx +278 -0
  496. package/src/modules/cpq/workflows/registry.ts +15 -0
  497. package/src/modules/cpq/workflows/steps/CustomerSelectStep.tsx +136 -0
  498. package/src/modules/cpq/workflows/steps/InventorySelectStep.tsx +34 -0
  499. package/src/modules/cpq/workflows/steps/ItemListStep.tsx +146 -0
  500. package/src/modules/cpq/workflows/steps/OfferingSelectStep.tsx +438 -0
  501. package/src/modules/cpq/workflows/steps/ProductConfigureStep.tsx +287 -0
  502. package/src/modules/cpq/workflows/steps/ReviewStep.tsx +219 -0
  503. package/src/modules/cpq/workflows/steps/index.ts +51 -0
  504. package/src/modules/cpq/workflows/types.ts +102 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/services/cpqValidationService.ts"],
4
+ "sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport {\n CpqProductAttribute,\n CpqProductOffering,\n CpqProductSpecification,\n CpqProductRelationship,\n CpqPricingTable,\n CpqPricingTableEntry,\n} from '../data/entities'\nimport type { ValidationError, TenantScope } from './types'\n\nexport interface ValidationResult {\n valid: boolean\n errors: ValidationError[]\n}\n\nexport interface AttributeOption {\n value: string\n label: string\n}\n\nexport class DefaultCpqValidationService {\n private em: EntityManager\n\n constructor(em: EntityManager) {\n this.em = em\n }\n\n /**\n * Validate a configuration against an offering's specification attributes (v2).\n * Loads the spec via offering -> spec relationship, then validates run-time attributes.\n */\n async validateOfferingConfiguration(params: {\n offeringId: string\n configuration: Record<string, unknown>\n scope: TenantScope\n }): Promise<ValidationResult> {\n const { offeringId, configuration, scope } = params\n const dbScope = { ...scope, deletedAt: null }\n\n const offering = await this.em.findOne(CpqProductOffering, { id: offeringId, ...dbScope })\n if (!offering) {\n return { valid: false, errors: [{ type: 'attribute', message: `Offering ${offeringId} not found` }] }\n }\n\n // Merge design-time values into evaluation context\n const evalContext = { ...(offering.designTimeValues ?? {}), ...configuration }\n\n // Load run-time attributes from spec\n const attributes = await this.em.find(\n CpqProductAttribute,\n { specId: offering.specId, resolutionTime: 'run_time', isActive: true, ...dbScope },\n { orderBy: { sortOrder: 'asc' } },\n )\n\n return this.validateAttributes(attributes, evalContext)\n }\n\n /**\n * Validate a configuration against a product's attributes (v1 compat).\n */\n async validateProductConfiguration(params: {\n productId: string\n configuration: Record<string, unknown>\n tenantId: string\n organizationId: string\n }): Promise<ValidationResult> {\n const { productId, configuration, tenantId, organizationId } = params\n\n const attributes = await this.em.find(CpqProductAttribute, {\n productId,\n tenantId,\n organizationId,\n isActive: true,\n deletedAt: null,\n })\n\n return this.validateAttributes(attributes, configuration)\n }\n\n /**\n * Validate relationships between offerings on a quote.\n * Checks requires, excludes, and parent_child constraints.\n */\n async validateRelationships(params: {\n lines: Array<{\n lineId: string\n specId: string | null\n parentLineId: string | null\n }>\n scope: TenantScope\n }): Promise<ValidationError[]> {\n const { lines, scope } = params\n const errors: ValidationError[] = []\n const dbScope = { ...scope, deletedAt: null, isActive: true }\n\n // Collect all specIds present in the quote\n const specIds = lines.map((l) => l.specId).filter((s): s is string => !!s)\n const specIdSet = new Set(specIds)\n\n if (specIds.length === 0) return errors\n\n // Load all outgoing relationships for specs in the quote\n const relationships = await this.em.find(CpqProductRelationship, {\n sourceSpecId: { $in: specIds },\n ...dbScope,\n })\n\n // Load spec code/name for error messages\n const specs = await this.em.find(CpqProductSpecification, {\n id: { $in: specIds },\n ...scope,\n deletedAt: null,\n })\n const specMap = new Map(specs.map((s) => [s.id, s]))\n\n for (const line of lines) {\n if (!line.specId) continue\n\n const lineRelationships = relationships.filter((r) => r.sourceSpecId === line.specId)\n\n for (const rel of lineRelationships) {\n const sourceSpec = specMap.get(rel.sourceSpecId)\n const targetSpec = specMap.get(rel.targetSpecId)\n const sourceCode = sourceSpec?.code ?? rel.sourceSpecId\n const targetCode = targetSpec?.code ?? rel.targetSpecId\n\n if (rel.relationshipType === 'requires') {\n if (!specIdSet.has(rel.targetSpecId)) {\n errors.push({\n type: 'relationship',\n relationshipType: 'requires',\n sourceSpec: sourceCode,\n targetSpec: targetCode,\n message: `${sourceCode} requires ${targetCode} to be present on the quote`,\n })\n }\n }\n\n if (rel.relationshipType === 'excludes') {\n if (specIdSet.has(rel.targetSpecId)) {\n errors.push({\n type: 'relationship',\n relationshipType: 'excludes',\n sourceSpec: sourceCode,\n targetSpec: targetCode,\n message: `${sourceCode} cannot co-exist with ${targetCode} on the same quote`,\n })\n }\n }\n\n if (rel.relationshipType === 'parent_child') {\n // Count children of this type under this parent\n const childrenOfType = lines.filter(\n (l) => l.specId === rel.targetSpecId && l.parentLineId === line.lineId,\n )\n const count = childrenOfType.length\n\n if (rel.cardinalityMin > 0 && count < rel.cardinalityMin) {\n errors.push({\n type: 'relationship',\n relationshipType: 'parent_child',\n sourceSpec: sourceCode,\n targetSpec: targetCode,\n message: `${sourceCode} requires at least ${rel.cardinalityMin} child item(s) of type ${targetCode}`,\n })\n }\n\n if (rel.cardinalityMax != null && count > rel.cardinalityMax) {\n errors.push({\n type: 'relationship',\n relationshipType: 'parent_child',\n sourceSpec: sourceCode,\n targetSpec: targetCode,\n message: `${sourceCode} allows at most ${rel.cardinalityMax} child item(s) of type ${targetCode}`,\n })\n }\n }\n }\n }\n\n return errors\n }\n\n /**\n * Get dynamic attribute options. Supports reference-type attributes\n * and dynamic option sources from pricing tables.\n */\n async getAttributeOptions(params: {\n productId?: string\n specId?: string\n attributeCode: string\n currentConfiguration: Record<string, unknown>\n tenantId: string\n organizationId: string\n }): Promise<AttributeOption[]> {\n const { attributeCode, currentConfiguration, tenantId, organizationId } = params\n\n const filter: Record<string, unknown> = {\n code: attributeCode,\n tenantId,\n organizationId,\n isActive: true,\n deletedAt: null,\n }\n if (params.specId) filter.specId = params.specId\n else if (params.productId) filter.productId = params.productId\n\n const attribute = await this.em.findOne(CpqProductAttribute, filter)\n if (!attribute) return []\n\n const constraints = (attribute.constraints ?? {}) as Record<string, unknown>\n if (constraints.dynamicOptionsSource) {\n const source = constraints.dynamicOptionsSource as {\n type?: string\n tableCode: string\n dimensionKey: string\n filterByDimension?: Record<string, string>\n }\n const table = await this.em.findOne(CpqPricingTable, {\n code: source.tableCode,\n tenantId,\n organizationId,\n })\n if (table) {\n const entries = await this.em.find(CpqPricingTableEntry, {\n pricingTableId: table.id,\n tenantId,\n organizationId,\n isActive: true,\n })\n let filtered = entries\n if (source.filterByDimension) {\n for (const [dimKey, configRef] of Object.entries(source.filterByDimension)) {\n const configKey = configRef.startsWith('$') ? configRef.slice(1) : configRef\n const filterValue = String(currentConfiguration[configKey] ?? '')\n if (filterValue) {\n filtered = filtered.filter(\n (e) => String(e.dimensionValues[dimKey] ?? '').toLowerCase() === filterValue.toLowerCase(),\n )\n }\n }\n }\n const unique = new Set<string>()\n for (const entry of filtered) {\n const val = entry.dimensionValues[source.dimensionKey]\n if (val) unique.add(val)\n }\n return Array.from(unique)\n .sort()\n .map((v) => ({ value: v, label: v }))\n }\n }\n\n return attribute.options ?? []\n }\n\n // \u2500\u2500\u2500 Private helpers \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\n private validateAttributes(\n attributes: CpqProductAttribute[],\n configuration: Record<string, unknown>,\n ): ValidationResult {\n const errors: ValidationError[] = []\n\n for (const attr of attributes) {\n const value = configuration[attr.code]\n\n // Check dependency visibility \u2014 if attribute depends on another and the dependency\n // isn't met, skip validation (attribute is hidden)\n if (attr.dependsOn) {\n const dep = attr.dependsOn as { attributeCode?: string; rules?: Array<{ when?: { operator?: string; value?: unknown } }> }\n if (dep.attributeCode) {\n const parentValue = configuration[dep.attributeCode]\n if (parentValue === undefined || parentValue === null) continue\n }\n }\n\n if (attr.isRequired && (value === undefined || value === null || value === '')) {\n errors.push({ type: 'attribute', attribute: attr.code, message: `${attr.name} is required.` })\n continue\n }\n\n if (value === undefined || value === null || value === '') continue\n\n if (attr.attributeType === 'number') {\n const numValue = Number(value)\n if (isNaN(numValue)) {\n errors.push({ type: 'attribute', attribute: attr.code, message: `${attr.name} must be a number.` })\n continue\n }\n const constraints = (attr.constraints ?? {}) as Record<string, unknown>\n if (constraints.min !== undefined && numValue < Number(constraints.min)) {\n errors.push({ type: 'attribute', attribute: attr.code, message: `${attr.name} must be at least ${constraints.min}.` })\n }\n if (constraints.max !== undefined && numValue > Number(constraints.max)) {\n errors.push({ type: 'attribute', attribute: attr.code, message: `${attr.name} must be at most ${constraints.max}.` })\n }\n if (constraints.step !== undefined) {\n const step = Number(constraints.step)\n const min = Number(constraints.min ?? 0)\n if (step > 0 && (numValue - min) % step !== 0) {\n errors.push({ type: 'attribute', attribute: attr.code, message: `${attr.name} must be in increments of ${step}.` })\n }\n }\n }\n\n // Validate select/enum against allowed options\n if ((attr.attributeType === 'select' || attr.attributeType === 'enum') && attr.options && attr.options.length > 0) {\n const validValues = attr.options.map((o) => o.value)\n if (typeof value === 'string' && !validValues.includes(value)) {\n errors.push({\n type: 'attribute',\n attribute: attr.code,\n message: `${attr.name} must be one of: ${validValues.join(', ')}`,\n })\n }\n }\n }\n\n return { valid: errors.length === 0, errors }\n }\n}\n"],
5
+ "mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaA,MAAM,4BAA4B;AAAA,EAGvC,YAAY,IAAmB;AAC7B,SAAK,KAAK;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,8BAA8B,QAIN;AAC5B,UAAM,EAAE,YAAY,eAAe,MAAM,IAAI;AAC7C,UAAM,UAAU,EAAE,GAAG,OAAO,WAAW,KAAK;AAE5C,UAAM,WAAW,MAAM,KAAK,GAAG,QAAQ,oBAAoB,EAAE,IAAI,YAAY,GAAG,QAAQ,CAAC;AACzF,QAAI,CAAC,UAAU;AACb,aAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,EAAE,MAAM,aAAa,SAAS,YAAY,UAAU,aAAa,CAAC,EAAE;AAAA,IACtG;AAGA,UAAM,cAAc,EAAE,GAAI,SAAS,oBAAoB,CAAC,GAAI,GAAG,cAAc;AAG7E,UAAM,aAAa,MAAM,KAAK,GAAG;AAAA,MAC/B;AAAA,MACA,EAAE,QAAQ,SAAS,QAAQ,gBAAgB,YAAY,UAAU,MAAM,GAAG,QAAQ;AAAA,MAClF,EAAE,SAAS,EAAE,WAAW,MAAM,EAAE;AAAA,IAClC;AAEA,WAAO,KAAK,mBAAmB,YAAY,WAAW;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,6BAA6B,QAKL;AAC5B,UAAM,EAAE,WAAW,eAAe,UAAU,eAAe,IAAI;AAE/D,UAAM,aAAa,MAAM,KAAK,GAAG,KAAK,qBAAqB;AAAA,MACzD;AAAA,MACA;A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I,oBAAoB,YAAY,GAAG,IAAI,CAAC;AAAA,QACtH;AACA,YAAI,YAAY,SAAS,QAAW;AAClC,gBAAM,OAAO,OAAO,YAAY,IAAI;AACpC,gBAAM,MAAM,OAAO,YAAY,OAAO,CAAC;AACvC,cAAI,OAAO,MAAM,WAAW,OAAO,SAAS,GAAG;AAC7C,mBAAO,KAAK,EAAE,MAAM,aAAa,WAAW,KAAK,MAAM,SAAS,GAAG,KAAK,IAAI,6BAA6B,IAAI,IAAI,CAAC;AAAA,UACpH;AAAA,QACF;AAAA,MACF;AAGA,WAAK,KAAK,kBAAkB,YAAY,KAAK,kBAAkB,WAAW,KAAK,WAAW,KAAK,QAAQ,SAAS,GAAG;AACjH,cAAM,cAAc,KAAK,QAAQ,IAAI,CAAC,MAAM,EAAE,KAAK;AACnD,YAAI,OAAO,UAAU,YAAY,CAAC,YAAY,SAAS,KAAK,GAAG;AAC7D,iBAAO,KAAK;AAAA,YACV,MAAM;AAAA,YACN,WAAW,KAAK;AAAA,YAChB,SAAS,GAAG,KAAK,IAAI,oBAAoB,YAAY,KAAK,IAAI,CAAC;AAAA,UACjE,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAEA,WAAO,EAAE,OAAO,OAAO,WAAW,GAAG,OAAO;AAAA,EAC9C;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,137 @@
1
+ import { CpqWizardDefinition } from "../data/entities.js";
2
+ function toDefinitionResult(entity) {
3
+ return {
4
+ id: entity.id,
5
+ code: entity.code,
6
+ name: entity.name,
7
+ description: entity.description ?? null,
8
+ version: entity.version,
9
+ steps: entity.steps,
10
+ applicability: entity.applicability ?? null,
11
+ paramsSchema: entity.paramsSchema ?? null,
12
+ surface: entity.surface,
13
+ isActive: entity.isActive,
14
+ metadata: entity.metadata ?? null,
15
+ createdAt: entity.createdAt.toISOString(),
16
+ updatedAt: entity.updatedAt.toISOString()
17
+ };
18
+ }
19
+ class DefaultCpqWizardService {
20
+ constructor(em) {
21
+ this.em = em;
22
+ }
23
+ // ─── Definitions ────────────────────────────────────────────
24
+ async listDefinitions(filter, scope, page = 1, pageSize = 50) {
25
+ const where = {
26
+ organizationId: scope.organizationId,
27
+ tenantId: scope.tenantId,
28
+ deletedAt: null
29
+ };
30
+ if (filter.surface && filter.surface !== "any") where.surface = filter.surface;
31
+ if (filter.isActive !== void 0) where.isActive = filter.isActive;
32
+ const search = filter.search?.trim();
33
+ if (search) {
34
+ where.$or = [
35
+ { code: { $ilike: `%${search}%` } },
36
+ { name: { $ilike: `%${search}%` } },
37
+ { description: { $ilike: `%${search}%` } }
38
+ ];
39
+ }
40
+ const sortField = filter.sortField ?? "createdAt";
41
+ const sortDir = filter.sortDir === "asc" ? "asc" : "desc";
42
+ const [items, total] = await this.em.findAndCount(CpqWizardDefinition, where, {
43
+ limit: pageSize,
44
+ offset: (page - 1) * pageSize,
45
+ orderBy: { [sortField]: sortDir }
46
+ });
47
+ return {
48
+ items: items.map(toDefinitionResult),
49
+ total,
50
+ page,
51
+ pageSize,
52
+ totalPages: Math.ceil(total / pageSize)
53
+ };
54
+ }
55
+ async getDefinition(idOrCode, scope) {
56
+ const baseWhere = {
57
+ organizationId: scope.organizationId,
58
+ tenantId: scope.tenantId,
59
+ deletedAt: null
60
+ };
61
+ const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(idOrCode);
62
+ const entity = await this.em.findOne(CpqWizardDefinition, {
63
+ ...baseWhere,
64
+ ...isUuid ? { id: idOrCode } : { code: idOrCode }
65
+ });
66
+ return entity ? toDefinitionResult(entity) : null;
67
+ }
68
+ async createDefinition(input, scope) {
69
+ const entity = this.em.create(CpqWizardDefinition, {
70
+ ...input,
71
+ organizationId: scope.organizationId,
72
+ tenantId: scope.tenantId
73
+ });
74
+ await this.em.flush();
75
+ return toDefinitionResult(entity);
76
+ }
77
+ async updateDefinition(id, updates, scope) {
78
+ const entity = await this.em.findOne(CpqWizardDefinition, {
79
+ id,
80
+ organizationId: scope.organizationId,
81
+ tenantId: scope.tenantId,
82
+ deletedAt: null
83
+ });
84
+ if (!entity) return null;
85
+ if (updates.steps || updates.applicability) {
86
+ updates.version = entity.version + 1;
87
+ }
88
+ this.em.assign(entity, updates);
89
+ await this.em.flush();
90
+ return toDefinitionResult(entity);
91
+ }
92
+ async deleteDefinition(id, scope) {
93
+ const entity = await this.em.findOne(CpqWizardDefinition, {
94
+ id,
95
+ organizationId: scope.organizationId,
96
+ tenantId: scope.tenantId,
97
+ deletedAt: null
98
+ });
99
+ if (!entity) return false;
100
+ entity.deletedAt = /* @__PURE__ */ new Date();
101
+ await this.em.flush();
102
+ return true;
103
+ }
104
+ // ─── Resolution ─────────────────────────────────────────────
105
+ async resolveWizard(context, scope) {
106
+ const where = {
107
+ organizationId: scope.organizationId,
108
+ tenantId: scope.tenantId,
109
+ isActive: true,
110
+ deletedAt: null
111
+ };
112
+ where.surface = { $in: [context.surface, "any"] };
113
+ const definitions = await this.em.find(CpqWizardDefinition, where);
114
+ if (definitions.length === 0) return null;
115
+ let bestMatch = null;
116
+ let bestPriority = -Infinity;
117
+ for (const def of definitions) {
118
+ const app = def.applicability;
119
+ const priority = app?.priority ?? 0;
120
+ if (app) {
121
+ if (app.surface && app.surface !== context.surface) continue;
122
+ if (app.specCodes?.length && context.specCode && !app.specCodes.includes(context.specCode)) continue;
123
+ if (app.offeringCodes?.length && context.offeringCode && !app.offeringCodes.includes(context.offeringCode)) continue;
124
+ if (app.customerSegments?.length && context.customerSegment && !app.customerSegments.includes(context.customerSegment)) continue;
125
+ }
126
+ if (priority > bestPriority) {
127
+ bestPriority = priority;
128
+ bestMatch = def;
129
+ }
130
+ }
131
+ return bestMatch ? toDefinitionResult(bestMatch) : null;
132
+ }
133
+ }
134
+ export {
135
+ DefaultCpqWizardService
136
+ };
137
+ //# sourceMappingURL=cpqWizardService.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/services/cpqWizardService.ts"],
4
+ "sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport { CpqWizardDefinition } from '../data/entities'\nimport type { TenantScope } from './types'\nimport type {\n WizardDefinitionResult,\n WizardResolveContext,\n WizardDefinitionFilter,\n WizardApplicability,\n WizardStepDefinition,\n} from '../workflows/types'\n\n// \u2500\u2500\u2500 Helpers \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\nfunction toDefinitionResult(entity: CpqWizardDefinition): WizardDefinitionResult {\n return {\n id: entity.id,\n code: entity.code,\n name: entity.name,\n description: entity.description ?? null,\n version: entity.version,\n steps: entity.steps as unknown as WizardStepDefinition[],\n applicability: (entity.applicability as WizardApplicability) ?? null,\n paramsSchema: entity.paramsSchema ?? null,\n surface: entity.surface,\n isActive: entity.isActive,\n metadata: entity.metadata ?? null,\n createdAt: entity.createdAt.toISOString(),\n updatedAt: entity.updatedAt.toISOString(),\n }\n}\n\n// \u2500\u2500\u2500 Service \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 class DefaultCpqWizardService {\n constructor(private em: EntityManager) {}\n\n // \u2500\u2500\u2500 Definitions \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\n async listDefinitions(\n filter: WizardDefinitionFilter & {\n search?: string | null\n sortField?: 'createdAt' | 'updatedAt' | 'name' | 'code' | 'surface'\n sortDir?: 'asc' | 'desc'\n },\n scope: TenantScope,\n page = 1,\n pageSize = 50,\n ) {\n const where: Record<string, unknown> = {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n }\n if (filter.surface && filter.surface !== 'any') where.surface = filter.surface\n if (filter.isActive !== undefined) where.isActive = filter.isActive\n\n const search = filter.search?.trim()\n if (search) {\n where.$or = [\n { code: { $ilike: `%${search}%` } },\n { name: { $ilike: `%${search}%` } },\n { description: { $ilike: `%${search}%` } },\n ]\n }\n\n const sortField = filter.sortField ?? 'createdAt'\n const sortDir = filter.sortDir === 'asc' ? 'asc' : 'desc'\n\n const [items, total] = await this.em.findAndCount(CpqWizardDefinition, where, {\n limit: pageSize,\n offset: (page - 1) * pageSize,\n orderBy: { [sortField]: sortDir },\n })\n\n return {\n items: items.map(toDefinitionResult),\n total,\n page,\n pageSize,\n totalPages: Math.ceil(total / pageSize),\n }\n }\n\n async getDefinition(idOrCode: string, scope: TenantScope): Promise<WizardDefinitionResult | null> {\n const baseWhere = {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n }\n\n // Try by UUID first, then by code\n const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(idOrCode)\n const entity = await this.em.findOne(CpqWizardDefinition, {\n ...baseWhere,\n ...(isUuid ? { id: idOrCode } : { code: idOrCode }),\n })\n\n return entity ? toDefinitionResult(entity) : null\n }\n\n async createDefinition(\n input: {\n code: string\n name: string\n description?: string | null\n steps: Array<Record<string, unknown>>\n applicability?: Record<string, unknown> | null\n paramsSchema?: Record<string, unknown> | null\n surface?: string\n isActive?: boolean\n metadata?: Record<string, unknown> | null\n },\n scope: TenantScope,\n ): Promise<WizardDefinitionResult> {\n const entity = this.em.create(CpqWizardDefinition, {\n ...input,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n })\n await this.em.flush()\n return toDefinitionResult(entity)\n }\n\n async updateDefinition(\n id: string,\n updates: Record<string, unknown>,\n scope: TenantScope,\n ): Promise<WizardDefinitionResult | null> {\n const entity = await this.em.findOne(CpqWizardDefinition, {\n id,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n })\n if (!entity) return null\n\n // Increment version when steps or applicability change\n if (updates.steps || updates.applicability) {\n updates.version = entity.version + 1\n }\n\n this.em.assign(entity, updates)\n await this.em.flush()\n return toDefinitionResult(entity)\n }\n\n async deleteDefinition(id: string, scope: TenantScope): Promise<boolean> {\n const entity = await this.em.findOne(CpqWizardDefinition, {\n id,\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n deletedAt: null,\n })\n if (!entity) return false\n\n entity.deletedAt = new Date()\n await this.em.flush()\n return true\n }\n\n // \u2500\u2500\u2500 Resolution \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\n async resolveWizard(\n context: WizardResolveContext,\n scope: TenantScope,\n ): Promise<WizardDefinitionResult | null> {\n const where: Record<string, unknown> = {\n organizationId: scope.organizationId,\n tenantId: scope.tenantId,\n isActive: true,\n deletedAt: null,\n }\n\n // Filter by surface: match exact or 'any'\n where.surface = { $in: [context.surface, 'any'] }\n\n const definitions = await this.em.find(CpqWizardDefinition, where)\n if (definitions.length === 0) return null\n\n // Score each definition by applicability match\n let bestMatch: CpqWizardDefinition | null = null\n let bestPriority = -Infinity\n\n for (const def of definitions) {\n const app = def.applicability as WizardApplicability | null\n const priority = app?.priority ?? 0\n\n // Check applicability conditions\n if (app) {\n if (app.surface && app.surface !== context.surface) continue\n if (app.specCodes?.length && context.specCode && !app.specCodes.includes(context.specCode)) continue\n if (app.offeringCodes?.length && context.offeringCode && !app.offeringCodes.includes(context.offeringCode)) continue\n if (app.customerSegments?.length && context.customerSegment && !app.customerSegments.includes(context.customerSegment)) continue\n }\n\n if (priority > bestPriority) {\n bestPriority = priority\n bestMatch = def\n }\n }\n\n return bestMatch ? toDefinitionResult(bestMatch) : null\n }\n}\n"],
5
+ "mappings": "AACA,SAAS,2BAA2B;AAYpC,SAAS,mBAAmB,QAAqD;AAC/E,SAAO;AAAA,IACL,IAAI,OAAO;AAAA,IACX,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,IACb,aAAa,OAAO,eAAe;AAAA,IACnC,SAAS,OAAO;AAAA,IAChB,OAAO,OAAO;AAAA,IACd,eAAgB,OAAO,iBAAyC;AAAA,IAChE,cAAc,OAAO,gBAAgB;AAAA,IACrC,SAAS,OAAO;AAAA,IAChB,UAAU,OAAO;AAAA,IACjB,UAAU,OAAO,YAAY;AAAA,IAC7B,WAAW,OAAO,UAAU,YAAY;AAAA,IACxC,WAAW,OAAO,UAAU,YAAY;AAAA,EAC1C;AACF;AAIO,MAAM,wBAAwB;AAAA,EACnC,YAAoB,IAAmB;AAAnB;AAAA,EAAoB;AAAA;AAAA,EAIxC,MAAM,gBACJ,QAKA,OACA,OAAO,GACP,WAAW,IACX;AACA,UAAM,QAAiC;AAAA,MACrC,gBAAgB,MAAM;AAAA,MACtB,UAAU,MAAM;AAAA,MAChB,WAAW;AAAA,IACb;AACA,QAAI,OAAO,WAAW,OAAO,YAAY,MAAO,OAAM,UAAU,OAAO;AACvE,QAAI,OAAO,aAAa,OAAW,OAAM,WAAW,OAAO;AAE3D,UAAM,SAAS,OAAO,QAAQ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AAW,IAAI,YAAY,QAAQ,QAAS;AACpD,YAAI,IAAI,WAAW,UAAU,QAAQ,YAAY,CAAC,IAAI,UAAU,SAAS,QAAQ,QAAQ,EAAG;AAC5F,YAAI,IAAI,eAAe,UAAU,QAAQ,gBAAgB,CAAC,IAAI,cAAc,SAAS,QAAQ,YAAY,EAAG;AAC5G,YAAI,IAAI,kBAAkB,UAAU,QAAQ,mBAAmB,CAAC,IAAI,iBAAiB,SAAS,QAAQ,eAAe,EAAG;AAAA,MAC1H;AAEA,UAAI,WAAW,cAAc;AAC3B,uBAAe;AACf,oBAAY;AAAA,MACd;AAAA,IACF;AAEA,WAAO,YAAY,mBAAmB,SAAS,IAAI;AAAA,EACrD;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,114 @@
1
+ const DEFAULT_CURRENCY = "USD";
2
+ async function getBaseCurrencyCode(em, scope) {
3
+ try {
4
+ const { Currency } = await import("@open-mercato/core/modules/currencies/data/entities");
5
+ const base = await em.findOne(Currency, {
6
+ tenantId: scope.tenantId,
7
+ organizationId: scope.organizationId,
8
+ isBase: true,
9
+ deletedAt: null
10
+ });
11
+ return base?.code ?? DEFAULT_CURRENCY;
12
+ } catch {
13
+ return DEFAULT_CURRENCY;
14
+ }
15
+ }
16
+ const CPQ_STATUSES = [
17
+ "new",
18
+ "incomplete",
19
+ "ready",
20
+ "in_approval",
21
+ "pre_approved",
22
+ "approved",
23
+ "with_customer",
24
+ "accepted",
25
+ "rejected",
26
+ "cancelled"
27
+ ];
28
+ const TERMINAL_STATUSES = ["accepted", "rejected", "cancelled"];
29
+ const ALLOWED_TRANSITIONS = Object.fromEntries(
30
+ CPQ_STATUSES.map((from) => [from, CPQ_STATUSES.filter((to) => to !== from)])
31
+ );
32
+ const INVENTORY_SUBSCRIPTION_STATUSES = [
33
+ "pending",
34
+ "active",
35
+ "suspended",
36
+ "terminated",
37
+ "expired",
38
+ "superseded"
39
+ ];
40
+ const INVENTORY_SUBSCRIPTION_TRANSITIONS = {
41
+ pending: ["active", "terminated"],
42
+ active: ["suspended", "terminated", "expired", "superseded"],
43
+ suspended: ["active", "terminated", "superseded"],
44
+ terminated: [],
45
+ expired: [],
46
+ superseded: []
47
+ };
48
+ const INVENTORY_SUBSCRIPTION_ITEM_STATUSES = [
49
+ "pending",
50
+ "active",
51
+ "suspended",
52
+ "terminated",
53
+ "expired",
54
+ "superseded"
55
+ ];
56
+ const INVENTORY_ASSET_STATUSES = ["pending", "delivered", "active", "returned", "cancelled"];
57
+ const INVENTORY_ASSET_TRANSITIONS = {
58
+ pending: ["delivered", "active", "cancelled"],
59
+ delivered: ["active", "returned"],
60
+ active: ["returned"],
61
+ returned: [],
62
+ cancelled: []
63
+ };
64
+ const CPQ_ORDER_STATUSES = ["draft", "pending_activation", "active", "cancelled", "fulfilled"];
65
+ const CPQ_ORDER_TRANSITIONS = {
66
+ draft: ["pending_activation", "active", "cancelled"],
67
+ pending_activation: ["active", "cancelled"],
68
+ active: ["fulfilled", "cancelled"],
69
+ cancelled: [],
70
+ fulfilled: []
71
+ };
72
+ const CPQ_QUOTE_TYPES = ["new", "amend", "renew", "cancel"];
73
+ const ARC_QUOTE_TYPES = ["amend", "renew", "cancel"];
74
+ const CHANGE_LOG_TYPES = [
75
+ "created",
76
+ "amend",
77
+ "renew",
78
+ "cancel",
79
+ "merge-result",
80
+ "merge-source"
81
+ ];
82
+ const MERGE_ACTIONS = ["standalone", "absorb"];
83
+ const ARC_REASON_CODES = [
84
+ "upgrade",
85
+ "downgrade",
86
+ "config-change",
87
+ "price-adjustment",
88
+ "term-extension",
89
+ "term-reduction",
90
+ "consolidation",
91
+ "customer-request",
92
+ "non-payment",
93
+ "contract-breach",
94
+ "other"
95
+ ];
96
+ export {
97
+ ALLOWED_TRANSITIONS,
98
+ ARC_QUOTE_TYPES,
99
+ ARC_REASON_CODES,
100
+ CHANGE_LOG_TYPES,
101
+ CPQ_ORDER_STATUSES,
102
+ CPQ_ORDER_TRANSITIONS,
103
+ CPQ_QUOTE_TYPES,
104
+ CPQ_STATUSES,
105
+ INVENTORY_ASSET_STATUSES,
106
+ INVENTORY_ASSET_TRANSITIONS,
107
+ INVENTORY_SUBSCRIPTION_ITEM_STATUSES,
108
+ INVENTORY_SUBSCRIPTION_STATUSES,
109
+ INVENTORY_SUBSCRIPTION_TRANSITIONS,
110
+ MERGE_ACTIONS,
111
+ TERMINAL_STATUSES,
112
+ getBaseCurrencyCode
113
+ };
114
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/services/types.ts"],
4
+ "sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\n\n// \u2500\u2500\u2500 Shared types for CPQ Quoting v2 \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 interface TenantScope {\n organizationId: string\n tenantId: string\n}\n\nconst DEFAULT_CURRENCY = 'USD'\n\n/**\n * Returns the base currency code for a given tenant scope.\n * Falls back to 'USD' if no base currency is found.\n */\nexport async function getBaseCurrencyCode(\n em: EntityManager,\n scope: TenantScope,\n): Promise<string> {\n try {\n const { Currency } = await import(\n '@open-mercato/core/modules/currencies/data/entities'\n )\n const base = await em.findOne(Currency, {\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n isBase: true,\n deletedAt: null,\n })\n return base?.code ?? DEFAULT_CURRENCY\n } catch {\n return DEFAULT_CURRENCY\n }\n}\n\n// \u2500\u2500\u2500 Quote lifecycle \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 const CPQ_STATUSES = [\n 'new',\n 'incomplete',\n 'ready',\n 'in_approval',\n 'pre_approved',\n 'approved',\n 'with_customer',\n 'accepted',\n 'rejected',\n 'cancelled',\n] as const\n\nexport type CpqStatus = (typeof CPQ_STATUSES)[number]\n\nexport const TERMINAL_STATUSES: CpqStatus[] = ['accepted', 'rejected', 'cancelled']\n\n// Per product decision: the CPQ status path is operator-driven and can\n// jump between any pair of statuses. Self-transitions are excluded\n// because they're no-ops. ARC-specific guards (`validateArcQuote`,\n// concurrent-ARC checks) still run inside `transitionStatus` and are\n// the real safety net \u2014 this table only enforces the \"no self loop\"\n// invariant.\nexport const ALLOWED_TRANSITIONS: Record<CpqStatus, CpqStatus[]> = Object.fromEntries(\n CPQ_STATUSES.map((from) => [from, CPQ_STATUSES.filter((to) => to !== from)]),\n) as Record<CpqStatus, CpqStatus[]>\n\n// \u2500\u2500\u2500 Service input/output 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\n\nexport interface CreateQuoteInput {\n customerId: string\n quoteId?: string // Link to existing SalesQuote instead of creating a new one\n dealId?: string\n currencyCode?: string\n quoteContext?: Record<string, string | number | boolean>\n}\n\nexport interface QuoteItemInput {\n offeringId?: string\n productId?: string\n configuration: Record<string, unknown>\n quantity?: number\n usageEstimates?: Array<{ chargeCode: string; estimatedQuantity: number }>\n action?: 'add' | 'modify' | 'cancel'\n parentLineId?: string\n startDate?: string\n termMonths?: number\n endDate?: string\n /** XD-250 ARC: target subscription this line acts on. Auto-inherited from\n * the quote's single attached target when omitted. Required when the ARC\n * quote has multiple non-merge targets (operator must pick). */\n targetSubscriptionId?: string | null\n}\n\nexport interface ValidationError {\n type?: 'attribute' | 'relationship'\n attribute?: string\n relationshipType?: string\n sourceSpec?: string\n targetSpec?: string\n message: string\n}\n\n/** XD-250 ARC: snapshot of the source subscription item's *current* state.\n * Surfaced on quote / order lines so the operator can compare \"before\" (this\n * snapshot) vs \"after\" (the line's current configuration). Null for lines\n * that aren't ARC-mirrored (e.g. a fresh `add` line on an amend quote). */\nexport interface ArcLineSource {\n subscriptionItemId: string\n name: string\n mrcAmount: number\n nrcAmount: number\n quantity: number\n}\n\nexport interface QuoteLineResult {\n lineId: string\n offeringId: string | null\n offeringName: string\n offeringType: string | null\n productId: string | null\n action: string\n parentLineId: string | null\n quantity: number\n configuration: Record<string, unknown>\n startDate: string | null\n termMonths: number | null\n endDate: string | null\n nrcTotal: number\n mrcTotal: number\n usageEstimates: Array<{ chargeCode: string; estimatedQuantity: number; estimatedTotal: number }> | null\n usageTotalEstimated: number | null\n charges: ResolvedCharge[]\n isConfigured: boolean\n validationErrors: ValidationError[] | null\n arcSource: ArcLineSource | null\n /** XD-250 multi-target ARC: which target subscription this line acts on. */\n targetSubscriptionId: string | null\n}\n\nexport interface PricingSummary {\n nrcTotal: number\n mrcTotal: number\n usageCharges: Array<{\n chargeCode: string\n chargeName: string\n unitPrice: number\n note: string | null\n }>\n usageTotalEstimated: number | null\n discountTotal: number\n surchargeTotal: number\n currencyCode: string\n}\n\nexport interface QuoteResult {\n id: string\n quoteId: string\n quoteNumber: string\n customerId: string\n /** Resolved customer display name (CustomerEntity.displayName). */\n customerName: string | null\n cpqStatus: string\n version: number\n parentQuoteId: string | null\n currencyCode: string\n /**\n * Set when this quote has been converted to a CPQ order. UI uses this\n * to lock editing and surface a \"Go to order\" entry point instead of\n * the Convert button. Backed by `CpqOrderConfiguration.sourceQuoteId`.\n */\n convertedOrderId: string | null\n validationResult: {\n valid: boolean\n errors: ValidationError[]\n }\n pricingSummary: PricingSummary\n lines: QuoteLineResult[]\n}\n\n// \u2500\u2500\u2500 Resolved charge (extended for v2) \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 interface RuleAdjustment {\n ruleCode: string\n ruleName: string\n ruleType: string\n value: number\n unitPriceBefore: number\n unitPriceAfter: number\n delta: number\n}\n\nexport interface TierBreakdown {\n tiers: Array<{\n tier: number\n from: number\n to: number\n pricePerUnit: number\n quantity: number\n subtotal: number\n }>\n}\n\nexport interface ResolvedCharge {\n chargeCode: string\n chargeName: string\n chargeType: 'nrc' | 'mrc' | 'usage'\n pricingMethod: 'flat' | 'tiered' | 'per_unit'\n unitPrice: number\n quantity: number | null\n totalPrice: number | null\n currencyCode: string\n breakdown?: TierBreakdown | null\n note?: string | null\n adjustments?: RuleAdjustment[] | null\n}\n\n// \u2500\u2500\u2500 Inventory status constants \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 const INVENTORY_SUBSCRIPTION_STATUSES = [\n 'pending',\n 'active',\n 'suspended',\n 'terminated',\n 'expired',\n 'superseded',\n] as const\nexport type InventorySubscriptionStatus = (typeof INVENTORY_SUBSCRIPTION_STATUSES)[number]\n\nexport const INVENTORY_SUBSCRIPTION_TRANSITIONS: Record<InventorySubscriptionStatus, InventorySubscriptionStatus[]> = {\n pending: ['active', 'terminated'],\n active: ['suspended', 'terminated', 'expired', 'superseded'],\n suspended: ['active', 'terminated', 'superseded'],\n terminated: [],\n expired: [],\n superseded: [],\n}\n\nexport const INVENTORY_SUBSCRIPTION_ITEM_STATUSES = [\n 'pending',\n 'active',\n 'suspended',\n 'terminated',\n 'expired',\n 'superseded',\n] as const\nexport type InventorySubscriptionItemStatus = (typeof INVENTORY_SUBSCRIPTION_ITEM_STATUSES)[number]\n\nexport const INVENTORY_ASSET_STATUSES = ['pending', 'delivered', 'active', 'returned', 'cancelled'] as const\nexport type InventoryAssetStatus = (typeof INVENTORY_ASSET_STATUSES)[number]\n\nexport const INVENTORY_ASSET_TRANSITIONS: Record<InventoryAssetStatus, InventoryAssetStatus[]> = {\n pending: ['delivered', 'active', 'cancelled'],\n delivered: ['active', 'returned'],\n active: ['returned'],\n returned: [],\n cancelled: [],\n}\n\n// \u2500\u2500\u2500 Order status constants \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 const CPQ_ORDER_STATUSES = ['draft', 'pending_activation', 'active', 'cancelled', 'fulfilled'] as const\nexport type CpqOrderStatus = (typeof CPQ_ORDER_STATUSES)[number]\n\nexport const CPQ_ORDER_TRANSITIONS: Record<CpqOrderStatus, CpqOrderStatus[]> = {\n draft: ['pending_activation', 'active', 'cancelled'],\n pending_activation: ['active', 'cancelled'],\n active: ['fulfilled', 'cancelled'],\n cancelled: [],\n fulfilled: [],\n}\n\n// \u2500\u2500\u2500 ARC (Amend / Renew / Cancel) constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const CPQ_QUOTE_TYPES = ['new', 'amend', 'renew', 'cancel'] as const\nexport type CpqQuoteType = (typeof CPQ_QUOTE_TYPES)[number]\n\nexport const ARC_QUOTE_TYPES: ReadonlyArray<Exclude<CpqQuoteType, 'new'>> = ['amend', 'renew', 'cancel']\n\nexport const CHANGE_LOG_TYPES = [\n 'created',\n 'amend',\n 'renew',\n 'cancel',\n 'merge-result',\n 'merge-source',\n] as const\nexport type ChangeLogType = (typeof CHANGE_LOG_TYPES)[number]\n\nexport const MERGE_ACTIONS = ['standalone', 'absorb'] as const\nexport type MergeAction = (typeof MERGE_ACTIONS)[number]\n\nexport const ARC_REASON_CODES = [\n 'upgrade',\n 'downgrade',\n 'config-change',\n 'price-adjustment',\n 'term-extension',\n 'term-reduction',\n 'consolidation',\n 'customer-request',\n 'non-payment',\n 'contract-breach',\n 'other',\n] as const\nexport type ArcReasonCode = (typeof ARC_REASON_CODES)[number]\n"],
5
+ "mappings": "AASA,MAAM,mBAAmB;AAMzB,eAAsB,oBACpB,IACA,OACiB;AACjB,MAAI;AACF,UAAM,EAAE,SAAS,IAAI,MAAM,OACzB,qDACF;AACA,UAAM,OAAO,MAAM,GAAG,QAAQ,UAAU;AAAA,MACtC,UAAU,MAAM;AAAA,MAChB,gBAAgB,MAAM;AAAA,MACtB,QAAQ;AAAA,MACR,WAAW;AAAA,IACb,CAAC;AACD,WAAO,MAAM,QAAQ;AAAA,EACvB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAIO,MAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIO,MAAM,oBAAiC,CAAC,YAAY,YAAY,WAAW;AAQ3E,MAAM,sBAAsD,OAAO;AAAA,EACxE,aAAa,IAAI,CAAC,SAAS,CAAC,MAAM,aAAa,OAAO,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC;AAC7E;AA0JO,MAAM,kCAAkC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,qCAAyG;AAAA,EACpH,SAAS,CAAC,UAAU,YAAY;AAAA,EAChC,QAAQ,CAAC,aAAa,cAAc,WAAW,YAAY;AAAA,EAC3D,WAAW,CAAC,UAAU,cAAc,YAAY;AAAA,EAChD,YAAY,CAAC;AAAA,EACb,SAAS,CAAC;AAAA,EACV,YAAY,CAAC;AACf;AAEO,MAAM,uCAAuC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,2BAA2B,CAAC,WAAW,aAAa,UAAU,YAAY,WAAW;AAG3F,MAAM,8BAAoF;AAAA,EAC/F,SAAS,CAAC,aAAa,UAAU,WAAW;AAAA,EAC5C,WAAW,CAAC,UAAU,UAAU;AAAA,EAChC,QAAQ,CAAC,UAAU;AAAA,EACnB,UAAU,CAAC;AAAA,EACX,WAAW,CAAC;AACd;AAIO,MAAM,qBAAqB,CAAC,SAAS,sBAAsB,UAAU,aAAa,WAAW;AAG7F,MAAM,wBAAkE;AAAA,EAC7E,OAAO,CAAC,sBAAsB,UAAU,WAAW;AAAA,EACnD,oBAAoB,CAAC,UAAU,WAAW;AAAA,EAC1C,QAAQ,CAAC,aAAa,WAAW;AAAA,EACjC,WAAW,CAAC;AAAA,EACZ,WAAW,CAAC;AACd;AAIO,MAAM,kBAAkB,CAAC,OAAO,SAAS,SAAS,QAAQ;AAG1D,MAAM,kBAA+D,CAAC,SAAS,SAAS,QAAQ;AAEhG,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,MAAM,gBAAgB,CAAC,cAAc,QAAQ;AAG7C,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ const setup = {
2
+ defaultRoleFeatures: {
3
+ admin: [
4
+ "cpq.quotes.view",
5
+ "cpq.quotes.manage",
6
+ "cpq.pricing.view",
7
+ "cpq.pricing.manage",
8
+ "cpq.products.view",
9
+ "cpq.products.manage",
10
+ "cpq.specifications.view",
11
+ "cpq.specifications.manage",
12
+ "cpq.offerings.view",
13
+ "cpq.offerings.manage",
14
+ "cpq.wizards.view",
15
+ "cpq.wizards.manage",
16
+ "cpq.inventory.view",
17
+ "cpq.inventory.manage",
18
+ "cpq.orders.view",
19
+ "cpq.orders.manage",
20
+ // XD-250 ARC features — admins can drive every ARC flow.
21
+ "cpq.arc.amend.manage",
22
+ "cpq.arc.renew.manage",
23
+ "cpq.arc.cancel.manage",
24
+ "cpq.arc.changelog.view"
25
+ ],
26
+ employee: [
27
+ "cpq.quotes.view",
28
+ "cpq.quotes.manage",
29
+ "cpq.pricing.view",
30
+ "cpq.products.view",
31
+ "cpq.specifications.view",
32
+ "cpq.offerings.view",
33
+ "cpq.wizards.view",
34
+ "cpq.inventory.view",
35
+ "cpq.orders.view",
36
+ // XD-250 ARC: anyone with cpq.quotes.manage drives ARC quotes.
37
+ "cpq.arc.amend.manage",
38
+ "cpq.arc.renew.manage",
39
+ "cpq.arc.cancel.manage",
40
+ "cpq.arc.changelog.view"
41
+ ]
42
+ }
43
+ };
44
+ var setup_default = setup;
45
+ export {
46
+ setup_default as default,
47
+ setup
48
+ };
49
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/modules/cpq/setup.ts"],
4
+ "sourcesContent": ["import type { ModuleSetupConfig } from '@open-mercato/shared/modules/setup'\n\n/**\n * CPQ module setup. After XD-276 the cpq module ships with NO customer\n * demo data \u2014 that lives in app-level demo modules (`src/modules/demo_<x>/`)\n * which register use-case bundles via `cpq/lib/seeds/api.ts`. This keeps\n * `@dainamite/cpq` clean of vertical-specific seeds when it extracts to a\n * standalone npm package per SPEC-001.\n *\n * What still lives here:\n * - `defaultRoleFeatures` \u2014 required for any tenant that has cpq enabled\n * - structural defaults (currently none beyond role features)\n *\n * What used to live here and moved out:\n * - GIX product/pricing/charge/rule/bundle/wizard seed \u2192 `src/modules/demo_gix/`\n * - Acme/Globex demo customers + quotes \u2192 `src/modules/demo_gix/seeds/examples.ts`\n * - GIX wizard definition \u2192 `src/modules/demo_gix/seeds/wizards.ts`\n */\nexport const setup: ModuleSetupConfig = {\n defaultRoleFeatures: {\n admin: [\n 'cpq.quotes.view',\n 'cpq.quotes.manage',\n 'cpq.pricing.view',\n 'cpq.pricing.manage',\n 'cpq.products.view',\n 'cpq.products.manage',\n 'cpq.specifications.view',\n 'cpq.specifications.manage',\n 'cpq.offerings.view',\n 'cpq.offerings.manage',\n 'cpq.wizards.view',\n 'cpq.wizards.manage',\n 'cpq.inventory.view',\n 'cpq.inventory.manage',\n 'cpq.orders.view',\n 'cpq.orders.manage',\n // XD-250 ARC features \u2014 admins can drive every ARC flow.\n 'cpq.arc.amend.manage',\n 'cpq.arc.renew.manage',\n 'cpq.arc.cancel.manage',\n 'cpq.arc.changelog.view',\n ],\n employee: [\n 'cpq.quotes.view',\n 'cpq.quotes.manage',\n 'cpq.pricing.view',\n 'cpq.products.view',\n 'cpq.specifications.view',\n 'cpq.offerings.view',\n 'cpq.wizards.view',\n 'cpq.inventory.view',\n 'cpq.orders.view',\n // XD-250 ARC: anyone with cpq.quotes.manage drives ARC quotes.\n 'cpq.arc.amend.manage',\n 'cpq.arc.renew.manage',\n 'cpq.arc.cancel.manage',\n 'cpq.arc.changelog.view',\n ],\n },\n}\n\nexport default setup\n"],
5
+ "mappings": "AAkBO,MAAM,QAA2B;AAAA,EACtC,qBAAqB;AAAA,IACnB,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ const metadata = {
2
+ event: "cpq.subscription.amended",
3
+ persistent: true,
4
+ id: "cpq-subscription-amended-log"
5
+ };
6
+ async function handler(payload) {
7
+ console.info(
8
+ "[cpq.arc] amended",
9
+ payload.subscriptionId,
10
+ "changeLog=" + payload.changeLogId,
11
+ "order=" + payload.sourceOrderId
12
+ );
13
+ }
14
+ export {
15
+ handler as default,
16
+ metadata
17
+ };
18
+ //# sourceMappingURL=subscription-amended-log.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/subscribers/subscription-amended-log.ts"],
4
+ "sourcesContent": ["/**\n * Placeholder persistent subscriber for `cpq.subscription.amended`.\n *\n * Logs the payload for human review until downstream billing /\n * notification modules subscribe with real handlers (XD-250).\n */\nexport const metadata = {\n event: 'cpq.subscription.amended',\n persistent: true,\n id: 'cpq-subscription-amended-log',\n}\n\nexport default async function handler(payload: Record<string, unknown>): Promise<void> {\n console.info(\n '[cpq.arc] amended',\n payload.subscriptionId,\n 'changeLog=' + payload.changeLogId,\n 'order=' + payload.sourceOrderId,\n )\n}\n"],
5
+ "mappings": "AAMO,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAEA,eAAO,QAA+B,SAAiD;AACrF,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,IACR,eAAe,QAAQ;AAAA,IACvB,WAAW,QAAQ;AAAA,EACrB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ const metadata = {
2
+ event: "cpq.subscription.cancelled",
3
+ persistent: true,
4
+ id: "cpq-subscription-cancelled-log"
5
+ };
6
+ async function handler(payload) {
7
+ console.info(
8
+ "[cpq.arc] cancelled",
9
+ payload.subscriptionId,
10
+ "reason=" + (payload.reasonCode ?? "none"),
11
+ "etf=" + (payload.etfAmount ?? "none"),
12
+ "changeLog=" + payload.changeLogId
13
+ );
14
+ }
15
+ export {
16
+ handler as default,
17
+ metadata
18
+ };
19
+ //# sourceMappingURL=subscription-cancelled-log.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/subscribers/subscription-cancelled-log.ts"],
4
+ "sourcesContent": ["/**\n * Placeholder persistent subscriber for `cpq.subscription.cancelled`.\n * Cancel quote payload includes ETF + reason metadata.\n */\nexport const metadata = {\n event: 'cpq.subscription.cancelled',\n persistent: true,\n id: 'cpq-subscription-cancelled-log',\n}\n\nexport default async function handler(payload: Record<string, unknown>): Promise<void> {\n console.info(\n '[cpq.arc] cancelled',\n payload.subscriptionId,\n 'reason=' + (payload.reasonCode ?? 'none'),\n 'etf=' + (payload.etfAmount ?? 'none'),\n 'changeLog=' + payload.changeLogId,\n )\n}\n"],
5
+ "mappings": "AAIO,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAEA,eAAO,QAA+B,SAAiD;AACrF,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,IACR,aAAa,QAAQ,cAAc;AAAA,IACnC,UAAU,QAAQ,aAAa;AAAA,IAC/B,eAAe,QAAQ;AAAA,EACzB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,20 @@
1
+ const metadata = {
2
+ event: "cpq.subscription.merged",
3
+ persistent: true,
4
+ id: "cpq-subscription-merged-log"
5
+ };
6
+ async function handler(payload) {
7
+ const sources = Array.isArray(payload.mergedFromSubscriptionIds) ? payload.mergedFromSubscriptionIds.length : 0;
8
+ console.info(
9
+ "[cpq.arc] merged",
10
+ payload.subscriptionId,
11
+ `from ${sources} sources`,
12
+ "changeLog=" + payload.changeLogId,
13
+ "order=" + payload.sourceOrderId
14
+ );
15
+ }
16
+ export {
17
+ handler as default,
18
+ metadata
19
+ };
20
+ //# sourceMappingURL=subscription-merged-log.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/subscribers/subscription-merged-log.ts"],
4
+ "sourcesContent": ["/**\n * Placeholder persistent subscriber for `cpq.subscription.merged`.\n * Fires once per merge group, on the new merge sub M.\n */\nexport const metadata = {\n event: 'cpq.subscription.merged',\n persistent: true,\n id: 'cpq-subscription-merged-log',\n}\n\nexport default async function handler(payload: Record<string, unknown>): Promise<void> {\n const sources = Array.isArray(payload.mergedFromSubscriptionIds)\n ? payload.mergedFromSubscriptionIds.length\n : 0\n console.info(\n '[cpq.arc] merged',\n payload.subscriptionId,\n `from ${sources} sources`,\n 'changeLog=' + payload.changeLogId,\n 'order=' + payload.sourceOrderId,\n )\n}\n"],
5
+ "mappings": "AAIO,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAEA,eAAO,QAA+B,SAAiD;AACrF,QAAM,UAAU,MAAM,QAAQ,QAAQ,yBAAyB,IAC3D,QAAQ,0BAA0B,SAClC;AACJ,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ,OAAO;AAAA,IACf,eAAe,QAAQ;AAAA,IACvB,WAAW,QAAQ;AAAA,EACrB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ const metadata = {
2
+ event: "cpq.subscription.renewed",
3
+ persistent: true,
4
+ id: "cpq-subscription-renewed-log"
5
+ };
6
+ async function handler(payload) {
7
+ console.info(
8
+ "[cpq.arc] renewed",
9
+ payload.subscriptionId,
10
+ "changeLog=" + payload.changeLogId,
11
+ "order=" + payload.sourceOrderId
12
+ );
13
+ }
14
+ export {
15
+ handler as default,
16
+ metadata
17
+ };
18
+ //# sourceMappingURL=subscription-renewed-log.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/subscribers/subscription-renewed-log.ts"],
4
+ "sourcesContent": ["/**\n * Placeholder persistent subscriber for `cpq.subscription.renewed`.\n * Standalone-renew only \u2014 merge-renew fires `cpq.subscription.merged`.\n */\nexport const metadata = {\n event: 'cpq.subscription.renewed',\n persistent: true,\n id: 'cpq-subscription-renewed-log',\n}\n\nexport default async function handler(payload: Record<string, unknown>): Promise<void> {\n console.info(\n '[cpq.arc] renewed',\n payload.subscriptionId,\n 'changeLog=' + payload.changeLogId,\n 'order=' + payload.sourceOrderId,\n )\n}\n"],
5
+ "mappings": "AAIO,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAEA,eAAO,QAA+B,SAAiD;AACrF,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,IACR,eAAe,QAAQ;AAAA,IACvB,WAAW,QAAQ;AAAA,EACrB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ const metadata = {
2
+ event: "cpq.subscription.superseded",
3
+ persistent: true,
4
+ id: "cpq-subscription-superseded-log"
5
+ };
6
+ async function handler(payload) {
7
+ console.info(
8
+ "[cpq.arc] superseded",
9
+ payload.subscriptionId,
10
+ "mergedInto=" + payload.mergedIntoSubscriptionId,
11
+ "changeLog=" + payload.changeLogId
12
+ );
13
+ }
14
+ export {
15
+ handler as default,
16
+ metadata
17
+ };
18
+ //# sourceMappingURL=subscription-superseded-log.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/cpq/subscribers/subscription-superseded-log.ts"],
4
+ "sourcesContent": ["/**\n * Placeholder persistent subscriber for `cpq.subscription.superseded`.\n * Fires once per merge source \u2014 payload carries `mergedIntoSubscriptionId`\n * pointing at the new merge sub M.\n */\nexport const metadata = {\n event: 'cpq.subscription.superseded',\n persistent: true,\n id: 'cpq-subscription-superseded-log',\n}\n\nexport default async function handler(payload: Record<string, unknown>): Promise<void> {\n console.info(\n '[cpq.arc] superseded',\n payload.subscriptionId,\n 'mergedInto=' + payload.mergedIntoSubscriptionId,\n 'changeLog=' + payload.changeLogId,\n )\n}\n"],
5
+ "mappings": "AAKO,MAAM,WAAW;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,IAAI;AACN;AAEA,eAAO,QAA+B,SAAiD;AACrF,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ;AAAA,IACR,gBAAgB,QAAQ;AAAA,IACxB,eAAe,QAAQ;AAAA,EACzB;AACF;",
6
+ "names": []
7
+ }