@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.
- package/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +236 -0
- package/README.md +108 -0
- package/dist/modules/cpq/acl.js +30 -0
- package/dist/modules/cpq/acl.js.map +7 -0
- package/dist/modules/cpq/api/_helpers/handleArcError.js +37 -0
- package/dist/modules/cpq/api/_helpers/handleArcError.js.map +7 -0
- package/dist/modules/cpq/api/attribute-options/route.js +47 -0
- package/dist/modules/cpq/api/attribute-options/route.js.map +7 -0
- package/dist/modules/cpq/api/bundle-slots/route.js +101 -0
- package/dist/modules/cpq/api/bundle-slots/route.js.map +7 -0
- package/dist/modules/cpq/api/bundle-tree/route.js +28 -0
- package/dist/modules/cpq/api/bundle-tree/route.js.map +7 -0
- package/dist/modules/cpq/api/context.js +29 -0
- package/dist/modules/cpq/api/context.js.map +7 -0
- package/dist/modules/cpq/api/inventory/assets/route.js +113 -0
- package/dist/modules/cpq/api/inventory/assets/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/assets/status/route.js +35 -0
- package/dist/modules/cpq/api/inventory/assets/status/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js +30 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js +31 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscription-items/route.js +99 -0
- package/dist/modules/cpq/api/inventory/subscription-items/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js +57 -0
- package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js +62 -0
- package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/route.js +116 -0
- package/dist/modules/cpq/api/inventory/subscriptions/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/status/route.js +35 -0
- package/dist/modules/cpq/api/inventory/subscriptions/status/route.js.map +7 -0
- package/dist/modules/cpq/api/offering-components/route.js +91 -0
- package/dist/modules/cpq/api/offering-components/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js +39 -0
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/route.js +28 -0
- package/dist/modules/cpq/api/orders/[orderId]/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js +38 -0
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/route.js +71 -0
- package/dist/modules/cpq/api/orders/route.js.map +7 -0
- package/dist/modules/cpq/api/price-rules/route.js +180 -0
- package/dist/modules/cpq/api/price-rules/route.js.map +7 -0
- package/dist/modules/cpq/api/pricing-table-entries/route.js +142 -0
- package/dist/modules/cpq/api/pricing-table-entries/route.js.map +7 -0
- package/dist/modules/cpq/api/pricing-tables/route.js +179 -0
- package/dist/modules/cpq/api/pricing-tables/route.js.map +7 -0
- package/dist/modules/cpq/api/product-attributes/route.js +160 -0
- package/dist/modules/cpq/api/product-attributes/route.js.map +7 -0
- package/dist/modules/cpq/api/product-charges/route.js +166 -0
- package/dist/modules/cpq/api/product-charges/route.js.map +7 -0
- package/dist/modules/cpq/api/product-offerings/route.js +294 -0
- package/dist/modules/cpq/api/product-offerings/route.js.map +7 -0
- package/dist/modules/cpq/api/product-relationships/route.js +144 -0
- package/dist/modules/cpq/api/product-relationships/route.js.map +7 -0
- package/dist/modules/cpq/api/product-specifications/route.js +292 -0
- package/dist/modules/cpq/api/product-specifications/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js +71 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js +29 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js +54 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js +27 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js +72 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js +35 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js +102 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js +27 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js +79 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js +95 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/attributes/route.js +52 -0
- package/dist/modules/cpq/api/quotes/attributes/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/from-subscription/route.js +72 -0
- package/dist/modules/cpq/api/quotes/from-subscription/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/price/route.js +69 -0
- package/dist/modules/cpq/api/quotes/price/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/route.js +97 -0
- package/dist/modules/cpq/api/quotes/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/validate-relationships/route.js +86 -0
- package/dist/modules/cpq/api/quotes/validate-relationships/route.js.map +7 -0
- package/dist/modules/cpq/api/resolveQuotingService.js +7 -0
- package/dist/modules/cpq/api/resolveQuotingService.js.map +7 -0
- package/dist/modules/cpq/api/wizards/resolve/route.js +38 -0
- package/dist/modules/cpq/api/wizards/resolve/route.js.map +7 -0
- package/dist/modules/cpq/api/wizards/route.js +111 -0
- package/dist/modules/cpq/api/wizards/route.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js +136 -0
- package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js +185 -0
- package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js +343 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.js +35 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/shared.js +20 -0
- package/dist/modules/cpq/backend/cpq/inventory/shared.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js +794 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js +917 -0
- package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.js +405 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js +677 -0
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/page.js +134 -0
- package/dist/modules/cpq/backend/cpq/orders/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js +272 -0
- package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js +407 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.js +211 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js +275 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js +112 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js +492 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js +50 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js +249 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.js +87 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js +652 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js +1289 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.js +283 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js +214 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js +1399 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.js +148 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js +204 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js +191 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.js +119 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.meta.js.map +7 -0
- package/dist/modules/cpq/ce.js +151 -0
- package/dist/modules/cpq/ce.js.map +7 -0
- package/dist/modules/cpq/cli.js +11 -0
- package/dist/modules/cpq/cli.js.map +7 -0
- package/dist/modules/cpq/components/CpqListView.js +265 -0
- package/dist/modules/cpq/components/CpqListView.js.map +7 -0
- package/dist/modules/cpq/components/NumberInput.js +95 -0
- package/dist/modules/cpq/components/NumberInput.js.map +7 -0
- package/dist/modules/cpq/components/StatusPath.js +60 -0
- package/dist/modules/cpq/components/StatusPath.js.map +7 -0
- package/dist/modules/cpq/components/statusMaps.js +66 -0
- package/dist/modules/cpq/components/statusMaps.js.map +7 -0
- package/dist/modules/cpq/components/useCpqRowActions.js +125 -0
- package/dist/modules/cpq/components/useCpqRowActions.js.map +7 -0
- package/dist/modules/cpq/data/entities.js +1556 -0
- package/dist/modules/cpq/data/entities.js.map +7 -0
- package/dist/modules/cpq/data/validators.js +575 -0
- package/dist/modules/cpq/data/validators.js.map +7 -0
- package/dist/modules/cpq/di.js +57 -0
- package/dist/modules/cpq/di.js.map +7 -0
- package/dist/modules/cpq/events.js +50 -0
- package/dist/modules/cpq/events.js.map +7 -0
- package/dist/modules/cpq/index.js +16 -0
- package/dist/modules/cpq/index.js.map +7 -0
- package/dist/modules/cpq/lib/seeds/api.js +32 -0
- package/dist/modules/cpq/lib/seeds/api.js.map +7 -0
- package/dist/modules/cpq/lib/seeds/tenant-provisioning.js +158 -0
- package/dist/modules/cpq/lib/seeds/tenant-provisioning.js.map +7 -0
- package/dist/modules/cpq/lib/seeds.js +6 -0
- package/dist/modules/cpq/lib/seeds.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js +40 -0
- package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js +54 -0
- package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js +15 -0
- package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js +62 -0
- package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js +56 -0
- package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js +26 -0
- package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js +37 -0
- package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js +35 -0
- package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js +21 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js +46 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js +118 -0
- package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js +63 -0
- package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js +28 -0
- package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js +36 -0
- package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js +14 -0
- package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js +14 -0
- package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js +58 -0
- package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js +29 -0
- package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js.map +7 -0
- package/dist/modules/cpq/services/cpqBundleService.js +447 -0
- package/dist/modules/cpq/services/cpqBundleService.js.map +7 -0
- package/dist/modules/cpq/services/cpqInventoryService.js +1371 -0
- package/dist/modules/cpq/services/cpqInventoryService.js.map +7 -0
- package/dist/modules/cpq/services/cpqOrderService.js +901 -0
- package/dist/modules/cpq/services/cpqOrderService.js.map +7 -0
- package/dist/modules/cpq/services/cpqPricingService.js +289 -0
- package/dist/modules/cpq/services/cpqPricingService.js.map +7 -0
- package/dist/modules/cpq/services/cpqProductService.js +204 -0
- package/dist/modules/cpq/services/cpqProductService.js.map +7 -0
- package/dist/modules/cpq/services/cpqQuotingService.js +1867 -0
- package/dist/modules/cpq/services/cpqQuotingService.js.map +7 -0
- package/dist/modules/cpq/services/cpqValidationService.js +234 -0
- package/dist/modules/cpq/services/cpqValidationService.js.map +7 -0
- package/dist/modules/cpq/services/cpqWizardService.js +137 -0
- package/dist/modules/cpq/services/cpqWizardService.js.map +7 -0
- package/dist/modules/cpq/services/types.js +114 -0
- package/dist/modules/cpq/services/types.js.map +7 -0
- package/dist/modules/cpq/setup.js +49 -0
- package/dist/modules/cpq/setup.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-amended-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-amended-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-cancelled-log.js +19 -0
- package/dist/modules/cpq/subscribers/subscription-cancelled-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-merged-log.js +20 -0
- package/dist/modules/cpq/subscribers/subscription-merged-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-renewed-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-renewed-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-superseded-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-superseded-log.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js +192 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js +79 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js +181 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection-table.js +44 -0
- package/dist/modules/cpq/widgets/injection-table.js.map +7 -0
- package/dist/modules/cpq/workflows/WizardRunner.js +113 -0
- package/dist/modules/cpq/workflows/WizardRunner.js.map +7 -0
- package/dist/modules/cpq/workflows/WizardTrigger.js +116 -0
- package/dist/modules/cpq/workflows/WizardTrigger.js.map +7 -0
- package/dist/modules/cpq/workflows/engine.js +188 -0
- package/dist/modules/cpq/workflows/engine.js.map +7 -0
- package/dist/modules/cpq/workflows/registry.js +16 -0
- package/dist/modules/cpq/workflows/registry.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js +119 -0
- package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/InventorySelectStep.js +24 -0
- package/dist/modules/cpq/workflows/steps/InventorySelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ItemListStep.js +115 -0
- package/dist/modules/cpq/workflows/steps/ItemListStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js +327 -0
- package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js +231 -0
- package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ReviewStep.js +152 -0
- package/dist/modules/cpq/workflows/steps/ReviewStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/index.js +49 -0
- package/dist/modules/cpq/workflows/steps/index.js.map +7 -0
- package/dist/modules/cpq/workflows/types.js +1 -0
- package/dist/modules/cpq/workflows/types.js.map +7 -0
- package/package.json +150 -0
- package/src/modules/cpq/__integration__/TC-CPQ-001.spec.ts +177 -0
- package/src/modules/cpq/__integration__/TC-CPQ-002.spec.ts +123 -0
- package/src/modules/cpq/__integration__/TC-CPQ-003.spec.ts +115 -0
- package/src/modules/cpq/__integration__/TC-CPQ-004.spec.ts +184 -0
- package/src/modules/cpq/__integration__/TC-CPQ-005.spec.ts +43 -0
- package/src/modules/cpq/__integration__/TC-CPQ-006.spec.ts +87 -0
- package/src/modules/cpq/__integration__/TC-CPQ-007.spec.ts +79 -0
- package/src/modules/cpq/__integration__/TC-CPQ-008.spec.ts +55 -0
- package/src/modules/cpq/__integration__/TC-CPQ-009.spec.ts +45 -0
- package/src/modules/cpq/__integration__/TC-CPQ-010.spec.ts +54 -0
- package/src/modules/cpq/__integration__/TC-CPQ-011.spec.ts +24 -0
- package/src/modules/cpq/__integration__/TC-CPQ-012.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-001.spec.ts +52 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-002.spec.ts +65 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-003.spec.ts +107 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-004.spec.ts +74 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-005.spec.ts +86 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-006.spec.ts +79 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-007.spec.ts +63 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-008.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-009.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-010.spec.ts +59 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-011.spec.ts +128 -0
- package/src/modules/cpq/__integration__/_helpers/cpqArcFixtures.ts +208 -0
- package/src/modules/cpq/__tests__/package-isolation.test.ts +232 -0
- package/src/modules/cpq/acl.ts +26 -0
- package/src/modules/cpq/api/_helpers/__tests__/handleArcError.test.ts +117 -0
- package/src/modules/cpq/api/_helpers/handleArcError.ts +81 -0
- package/src/modules/cpq/api/attribute-options/route.ts +55 -0
- package/src/modules/cpq/api/bundle-slots/route.ts +112 -0
- package/src/modules/cpq/api/bundle-tree/route.ts +31 -0
- package/src/modules/cpq/api/context.ts +39 -0
- package/src/modules/cpq/api/inventory/assets/route.ts +123 -0
- package/src/modules/cpq/api/inventory/assets/status/route.ts +34 -0
- package/src/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.ts +30 -0
- package/src/modules/cpq/api/inventory/customer/[customerId]/route.ts +31 -0
- package/src/modules/cpq/api/inventory/subscription-items/route.ts +107 -0
- package/src/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.ts +64 -0
- package/src/modules/cpq/api/inventory/subscriptions/expiring/route.ts +66 -0
- package/src/modules/cpq/api/inventory/subscriptions/route.ts +126 -0
- package/src/modules/cpq/api/inventory/subscriptions/status/route.ts +34 -0
- package/src/modules/cpq/api/offering-components/route.ts +103 -0
- package/src/modules/cpq/api/orders/[orderId]/activate/route.ts +48 -0
- package/src/modules/cpq/api/orders/[orderId]/route.ts +28 -0
- package/src/modules/cpq/api/orders/[orderId]/status/route.ts +38 -0
- package/src/modules/cpq/api/orders/route.ts +77 -0
- package/src/modules/cpq/api/price-rules/route.ts +210 -0
- package/src/modules/cpq/api/pricing-table-entries/route.ts +159 -0
- package/src/modules/cpq/api/pricing-tables/route.ts +202 -0
- package/src/modules/cpq/api/product-attributes/route.ts +175 -0
- package/src/modules/cpq/api/product-charges/route.ts +181 -0
- package/src/modules/cpq/api/product-offerings/route.ts +329 -0
- package/src/modules/cpq/api/product-relationships/route.ts +156 -0
- package/src/modules/cpq/api/product-specifications/route.ts +325 -0
- package/src/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.ts +77 -0
- package/src/modules/cpq/api/quotes/[quoteId]/clone/route.ts +28 -0
- package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.ts +55 -0
- package/src/modules/cpq/api/quotes/[quoteId]/items/route.ts +26 -0
- package/src/modules/cpq/api/quotes/[quoteId]/merge-meta/route.ts +78 -0
- package/src/modules/cpq/api/quotes/[quoteId]/recalculate/route.ts +34 -0
- package/src/modules/cpq/api/quotes/[quoteId]/route.ts +109 -0
- package/src/modules/cpq/api/quotes/[quoteId]/status/route.ts +26 -0
- package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.ts +91 -0
- package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.ts +107 -0
- package/src/modules/cpq/api/quotes/attributes/route.ts +61 -0
- package/src/modules/cpq/api/quotes/from-subscription/route.ts +85 -0
- package/src/modules/cpq/api/quotes/price/route.ts +81 -0
- package/src/modules/cpq/api/quotes/route.ts +114 -0
- package/src/modules/cpq/api/quotes/validate-relationships/route.ts +100 -0
- package/src/modules/cpq/api/resolveQuotingService.ts +11 -0
- package/src/modules/cpq/api/wizards/resolve/route.ts +39 -0
- package/src/modules/cpq/api/wizards/route.ts +127 -0
- package/src/modules/cpq/backend/cpq/inventory/AssetsTable.tsx +166 -0
- package/src/modules/cpq/backend/cpq/inventory/SubscriptionsTable.tsx +251 -0
- package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.tsx +440 -0
- package/src/modules/cpq/backend/cpq/inventory/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/inventory/page.tsx +49 -0
- package/src/modules/cpq/backend/cpq/inventory/shared.tsx +32 -0
- package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.tsx +1085 -0
- package/src/modules/cpq/backend/cpq/offerings/[id]/page.tsx +1165 -0
- package/src/modules/cpq/backend/cpq/offerings/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/offerings/page.tsx +468 -0
- package/src/modules/cpq/backend/cpq/orders/[id]/page.tsx +921 -0
- package/src/modules/cpq/backend/cpq/orders/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/orders/page.tsx +182 -0
- package/src/modules/cpq/backend/cpq/price-rules/PriceRuleForm.tsx +310 -0
- package/src/modules/cpq/backend/cpq/price-rules/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/price-rules/[id]/page.tsx +472 -0
- package/src/modules/cpq/backend/cpq/price-rules/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/price-rules/page.tsx +253 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.tsx +431 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.tsx +122 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/page.tsx +588 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.ts +90 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.ts +338 -0
- package/src/modules/cpq/backend/cpq/pricing/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/pricing/page.tsx +111 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.tsx +737 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/page.tsx +1721 -0
- package/src/modules/cpq/backend/cpq/quotes/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/quotes/page.tsx +370 -0
- package/src/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.tsx +300 -0
- package/src/modules/cpq/backend/cpq/specifications/[id]/page.tsx +1722 -0
- package/src/modules/cpq/backend/cpq/specifications/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/specifications/page.tsx +191 -0
- package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.tsx +319 -0
- package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/page.tsx +234 -0
- package/src/modules/cpq/backend/cpq/wizards/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/wizards/page.tsx +141 -0
- package/src/modules/cpq/ce.ts +150 -0
- package/src/modules/cpq/cli.ts +10 -0
- package/src/modules/cpq/components/CpqListView.tsx +431 -0
- package/src/modules/cpq/components/NumberInput.tsx +166 -0
- package/src/modules/cpq/components/StatusPath.tsx +116 -0
- package/src/modules/cpq/components/statusMaps.ts +148 -0
- package/src/modules/cpq/components/useCpqRowActions.tsx +183 -0
- package/src/modules/cpq/data/__tests__/validators.arc.test.ts +271 -0
- package/src/modules/cpq/data/__tests__/validators.test.ts +782 -0
- package/src/modules/cpq/data/entities.ts +1467 -0
- package/src/modules/cpq/data/validators.ts +663 -0
- package/src/modules/cpq/di.ts +70 -0
- package/src/modules/cpq/events.ts +62 -0
- package/src/modules/cpq/index.ts +15 -0
- package/src/modules/cpq/lib/seeds/__tests__/api.test.ts +86 -0
- package/src/modules/cpq/lib/seeds/__tests__/tenant-provisioning.test.ts +349 -0
- package/src/modules/cpq/lib/seeds/api.ts +119 -0
- package/src/modules/cpq/lib/seeds/tenant-provisioning.ts +239 -0
- package/src/modules/cpq/lib/seeds.ts +18 -0
- package/src/modules/cpq/migrations/.snapshot-open-mercato.json +7473 -0
- package/src/modules/cpq/migrations/Migration20260220220000_cpq.ts +51 -0
- package/src/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.ts +70 -0
- package/src/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.ts +15 -0
- package/src/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.ts +73 -0
- package/src/modules/cpq/migrations/Migration20260402000000_cpq_workflows.ts +59 -0
- package/src/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.ts +30 -0
- package/src/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.ts +36 -0
- package/src/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.ts +33 -0
- package/src/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.ts +22 -0
- package/src/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.ts +56 -0
- package/src/modules/cpq/migrations/Migration20260410100000_cpq_inventory.ts +118 -0
- package/src/modules/cpq/migrations/Migration20260411000000_cpq_orders.ts +62 -0
- package/src/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.ts +33 -0
- package/src/modules/cpq/migrations/Migration20260504064621_cpq_arc.ts +68 -0
- package/src/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.ts +30 -0
- package/src/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.ts +27 -0
- package/src/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.ts +82 -0
- package/src/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.ts +52 -0
- package/src/modules/cpq/services/__tests__/_helpers/mockEm.ts +59 -0
- package/src/modules/cpq/services/__tests__/cpqBundleService.test.ts +661 -0
- package/src/modules/cpq/services/__tests__/cpqInventoryService.arc.test.ts +357 -0
- package/src/modules/cpq/services/__tests__/cpqInventoryService.test.ts +718 -0
- package/src/modules/cpq/services/__tests__/cpqOrderService.test.ts +603 -0
- package/src/modules/cpq/services/__tests__/cpqPricingService.test.ts +1012 -0
- package/src/modules/cpq/services/__tests__/cpqProductService.test.ts +603 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.arc.test.ts +143 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.test.ts +658 -0
- package/src/modules/cpq/services/__tests__/cpqValidationService.test.ts +811 -0
- package/src/modules/cpq/services/__tests__/cpqWizardService.test.ts +389 -0
- package/src/modules/cpq/services/__tests__/types.test.ts +359 -0
- package/src/modules/cpq/services/cpqBundleService.ts +671 -0
- package/src/modules/cpq/services/cpqInventoryService.ts +1929 -0
- package/src/modules/cpq/services/cpqOrderService.ts +1230 -0
- package/src/modules/cpq/services/cpqPricingService.ts +412 -0
- package/src/modules/cpq/services/cpqProductService.ts +311 -0
- package/src/modules/cpq/services/cpqQuotingService.ts +2638 -0
- package/src/modules/cpq/services/cpqValidationService.ts +323 -0
- package/src/modules/cpq/services/cpqWizardService.ts +204 -0
- package/src/modules/cpq/services/types.ts +303 -0
- package/src/modules/cpq/setup.ts +63 -0
- package/src/modules/cpq/subscribers/subscription-amended-log.ts +20 -0
- package/src/modules/cpq/subscribers/subscription-cancelled-log.ts +19 -0
- package/src/modules/cpq/subscribers/subscription-merged-log.ts +22 -0
- package/src/modules/cpq/subscribers/subscription-renewed-log.ts +18 -0
- package/src/modules/cpq/subscribers/subscription-superseded-log.ts +19 -0
- package/src/modules/cpq/widgets/injection/customer-inventory/widget.client.tsx +339 -0
- package/src/modules/cpq/widgets/injection/customer-inventory/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.client.tsx +96 -0
- package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection/quote-configurator/widget.client.tsx +265 -0
- package/src/modules/cpq/widgets/injection/quote-configurator/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection-table.ts +42 -0
- package/src/modules/cpq/workflows/WizardRunner.tsx +158 -0
- package/src/modules/cpq/workflows/WizardTrigger.tsx +142 -0
- package/src/modules/cpq/workflows/engine.tsx +278 -0
- package/src/modules/cpq/workflows/registry.ts +15 -0
- package/src/modules/cpq/workflows/steps/CustomerSelectStep.tsx +136 -0
- package/src/modules/cpq/workflows/steps/InventorySelectStep.tsx +34 -0
- package/src/modules/cpq/workflows/steps/ItemListStep.tsx +146 -0
- package/src/modules/cpq/workflows/steps/OfferingSelectStep.tsx +438 -0
- package/src/modules/cpq/workflows/steps/ProductConfigureStep.tsx +287 -0
- package/src/modules/cpq/workflows/steps/ReviewStep.tsx +219 -0
- package/src/modules/cpq/workflows/steps/index.ts +51 -0
- package/src/modules/cpq/workflows/types.ts +102 -0
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRouter, useParams } from "next/navigation";
|
|
5
|
+
import { ArrowRight, ExternalLink, Play, X } from "lucide-react";
|
|
6
|
+
import { Alert } from "@open-mercato/ui/primitives/alert";
|
|
7
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
8
|
+
import { Tag } from "@open-mercato/ui/primitives/tag";
|
|
9
|
+
import { FormHeader } from "@open-mercato/ui/backend/forms";
|
|
10
|
+
import {
|
|
11
|
+
formatStatusLabel,
|
|
12
|
+
orderCpqStatusMap
|
|
13
|
+
} from "../../../../components/statusMaps.js";
|
|
14
|
+
import { StatusPath } from "../../../../components/StatusPath.js";
|
|
15
|
+
const ARC_BADGE_VARIANTS = {
|
|
16
|
+
amend: "brand",
|
|
17
|
+
renew: "success",
|
|
18
|
+
cancel: "error"
|
|
19
|
+
};
|
|
20
|
+
const RULE_TYPE_LABELS = {
|
|
21
|
+
discount_percent: "% discount",
|
|
22
|
+
discount_absolute: "fixed discount",
|
|
23
|
+
surcharge_percent: "% surcharge",
|
|
24
|
+
surcharge_absolute: "fixed surcharge",
|
|
25
|
+
price_override: "override"
|
|
26
|
+
};
|
|
27
|
+
function fmtRuleValue(adj, currency) {
|
|
28
|
+
if (adj.ruleType === "discount_percent" || adj.ruleType === "surcharge_percent") return `${adj.value}%`;
|
|
29
|
+
if (currency) return fmt(adj.value, currency);
|
|
30
|
+
return String(adj.value);
|
|
31
|
+
}
|
|
32
|
+
function fmt(amount, currency) {
|
|
33
|
+
return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(amount);
|
|
34
|
+
}
|
|
35
|
+
async function apiJson(url, init) {
|
|
36
|
+
const res = await fetch(url, init);
|
|
37
|
+
const json = await res.json();
|
|
38
|
+
if (!res.ok) throw new Error(json?.error ?? `Request failed (${res.status})`);
|
|
39
|
+
return json;
|
|
40
|
+
}
|
|
41
|
+
function CpqOrderDetailPage(props) {
|
|
42
|
+
const router = useRouter();
|
|
43
|
+
const urlParams = useParams();
|
|
44
|
+
const cpqOrderId = props.params?.id ?? urlParams?.id;
|
|
45
|
+
const [order, setOrder] = React.useState(null);
|
|
46
|
+
const [loading, setLoading] = React.useState(true);
|
|
47
|
+
const [error, setError] = React.useState(null);
|
|
48
|
+
const [activating, setActivating] = React.useState(false);
|
|
49
|
+
const [expandedLines, setExpandedLines] = React.useState(/* @__PURE__ */ new Set());
|
|
50
|
+
const [pricingDetail, setPricingDetail] = React.useState(null);
|
|
51
|
+
const [customerName, setCustomerName] = React.useState(null);
|
|
52
|
+
const [linkedSubscriptions, setLinkedSubscriptions] = React.useState([]);
|
|
53
|
+
const fetchLinkedSubscriptions = React.useCallback(
|
|
54
|
+
async (orderConfigId, sourceQuoteId) => {
|
|
55
|
+
const byOrderId = fetch(
|
|
56
|
+
`/api/cpq/inventory/subscriptions?sourceOrderId=${orderConfigId}&pageSize=10`
|
|
57
|
+
).then((r) => r.ok ? r.json() : null).then((d) => d?.items ?? (Array.isArray(d) ? d : [])).catch(() => []);
|
|
58
|
+
const byTargets = sourceQuoteId ? fetch(`/api/cpq/quotes/${sourceQuoteId}/target-subscriptions`).then((r) => r.ok ? r.json() : null).then(async (d) => {
|
|
59
|
+
const targets = d?.items ?? [];
|
|
60
|
+
const fetched = await Promise.all(
|
|
61
|
+
targets.map(
|
|
62
|
+
(t) => fetch(`/api/cpq/inventory/subscriptions?id=${t.subscriptionId}`).then((r) => r.ok ? r.json() : null).catch(() => null)
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
return fetched.filter(Boolean);
|
|
66
|
+
}).catch(() => []) : Promise.resolve([]);
|
|
67
|
+
const [a, b] = await Promise.all([byOrderId, byTargets]);
|
|
68
|
+
const seen = /* @__PURE__ */ new Set();
|
|
69
|
+
const merged = [];
|
|
70
|
+
for (const sub of [...a, ...b]) {
|
|
71
|
+
if (!sub || seen.has(sub.id)) continue;
|
|
72
|
+
seen.add(sub.id);
|
|
73
|
+
merged.push({ id: sub.id, name: sub.name, code: sub.code, status: sub.status });
|
|
74
|
+
}
|
|
75
|
+
setLinkedSubscriptions(merged);
|
|
76
|
+
},
|
|
77
|
+
[]
|
|
78
|
+
);
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
let cancelled = false;
|
|
81
|
+
async function load() {
|
|
82
|
+
try {
|
|
83
|
+
const result = await apiJson(`/api/cpq/orders/${cpqOrderId}`);
|
|
84
|
+
if (!cancelled) {
|
|
85
|
+
setOrder(result);
|
|
86
|
+
fetch(`/api/customers/companies?id=${result.customerId}&pageSize=1`).then((r) => r.json()).then((data) => {
|
|
87
|
+
const items = data.items ?? data ?? [];
|
|
88
|
+
const c = items[0];
|
|
89
|
+
if (c && !cancelled) setCustomerName(c.display_name || c.displayName || c.name || null);
|
|
90
|
+
}).catch(() => {
|
|
91
|
+
});
|
|
92
|
+
if (result.cpqStatus === "active" || result.cpqStatus === "fulfilled") {
|
|
93
|
+
void fetchLinkedSubscriptions(result.id, result.sourceQuoteId);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} catch (err) {
|
|
97
|
+
if (!cancelled) setError(err.message);
|
|
98
|
+
} finally {
|
|
99
|
+
if (!cancelled) setLoading(false);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
load();
|
|
103
|
+
return () => {
|
|
104
|
+
cancelled = true;
|
|
105
|
+
};
|
|
106
|
+
}, [cpqOrderId, fetchLinkedSubscriptions]);
|
|
107
|
+
const activateOrder = async () => {
|
|
108
|
+
if (!order) return;
|
|
109
|
+
try {
|
|
110
|
+
setActivating(true);
|
|
111
|
+
setError(null);
|
|
112
|
+
const result = await apiJson(`/api/cpq/orders/${order.id}/activate`, {
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: { "Content-Type": "application/json" },
|
|
115
|
+
body: JSON.stringify({})
|
|
116
|
+
});
|
|
117
|
+
setOrder(result);
|
|
118
|
+
void fetchLinkedSubscriptions(result.id, result.sourceQuoteId);
|
|
119
|
+
} catch (err) {
|
|
120
|
+
setError(err.message);
|
|
121
|
+
} finally {
|
|
122
|
+
setActivating(false);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const cancelOrder = async () => {
|
|
126
|
+
if (!order) return;
|
|
127
|
+
try {
|
|
128
|
+
setError(null);
|
|
129
|
+
const result = await apiJson(`/api/cpq/orders/${order.id}/status`, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: { "Content-Type": "application/json" },
|
|
132
|
+
body: JSON.stringify({ targetStatus: "cancelled" })
|
|
133
|
+
});
|
|
134
|
+
setOrder(result);
|
|
135
|
+
} catch (err) {
|
|
136
|
+
setError(err.message);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const toggleLine = (id) => {
|
|
140
|
+
setExpandedLines((prev) => {
|
|
141
|
+
const n = new Set(prev);
|
|
142
|
+
n.has(id) ? n.delete(id) : n.add(id);
|
|
143
|
+
return n;
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
if (loading) {
|
|
147
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-12 justify-center text-sm text-muted-foreground", children: [
|
|
148
|
+
/* @__PURE__ */ jsx(Spinner, {}),
|
|
149
|
+
" Loading\u2026"
|
|
150
|
+
] });
|
|
151
|
+
}
|
|
152
|
+
if (!order) {
|
|
153
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
154
|
+
/* @__PURE__ */ jsx("button", { onClick: () => router.push("/backend/cpq/orders"), className: "text-sm text-muted-foreground hover:text-foreground", children: "\u2190 Back to Orders" }),
|
|
155
|
+
error && /* @__PURE__ */ jsx(ErrorBanner, { message: error }),
|
|
156
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground", children: "Order not found." })
|
|
157
|
+
] });
|
|
158
|
+
}
|
|
159
|
+
const canActivate = order.cpqStatus === "draft" || order.cpqStatus === "pending_activation";
|
|
160
|
+
const canCancel = order.cpqStatus === "draft" || order.cpqStatus === "pending_activation" || order.cpqStatus === "active";
|
|
161
|
+
const currency = order.currencyCode;
|
|
162
|
+
const togglePricingDetail = (lineIdx, chargeIdx) => {
|
|
163
|
+
setPricingDetail(
|
|
164
|
+
(prev) => prev?.lineIdx === lineIdx && prev?.chargeIdx === chargeIdx ? null : { lineIdx, chargeIdx }
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
FormHeader,
|
|
170
|
+
{
|
|
171
|
+
mode: "detail",
|
|
172
|
+
backHref: "/backend/cpq/orders",
|
|
173
|
+
backLabel: "Back to CPQ Orders",
|
|
174
|
+
entityTypeLabel: "CPQ Order",
|
|
175
|
+
title: order.orderNumber || order.orderId.slice(0, 8),
|
|
176
|
+
statusBadge: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 pt-1", children: [
|
|
177
|
+
/* @__PURE__ */ jsx(Tag, { variant: orderCpqStatusMap[order.cpqStatus] ?? "neutral", dot: true, children: formatStatusLabel(order.cpqStatus) }),
|
|
178
|
+
order.quoteType && order.quoteType !== "new" && /* @__PURE__ */ jsx(Tag, { variant: ARC_BADGE_VARIANTS[order.quoteType] ?? "neutral", className: "uppercase", children: order.quoteType })
|
|
179
|
+
] }),
|
|
180
|
+
actionsContent: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
181
|
+
/* @__PURE__ */ jsxs(
|
|
182
|
+
Button,
|
|
183
|
+
{
|
|
184
|
+
type: "button",
|
|
185
|
+
variant: "outline",
|
|
186
|
+
onClick: () => router.push(`/backend/sales/orders/${order.orderId}`),
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3.5 w-3.5" }),
|
|
189
|
+
"View Sales Order"
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
order.sourceQuoteId && /* @__PURE__ */ jsx(
|
|
194
|
+
Button,
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
variant: "outline",
|
|
198
|
+
onClick: () => router.push(`/backend/cpq/quotes/${order.sourceQuoteId}`),
|
|
199
|
+
children: "Source Quote"
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
canActivate && /* @__PURE__ */ jsxs(Button, { type: "button", onClick: activateOrder, disabled: activating, children: [
|
|
203
|
+
activating ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(Play, { className: "h-4 w-4" }),
|
|
204
|
+
"Activate"
|
|
205
|
+
] }),
|
|
206
|
+
canCancel && /* @__PURE__ */ jsxs(Button, { type: "button", variant: "destructive-outline", onClick: cancelOrder, children: [
|
|
207
|
+
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
208
|
+
"Cancel"
|
|
209
|
+
] })
|
|
210
|
+
] })
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 flex-wrap", children: /* @__PURE__ */ jsx(
|
|
214
|
+
StatusPath,
|
|
215
|
+
{
|
|
216
|
+
current: order.cpqStatus,
|
|
217
|
+
path: ["draft", "pending_activation", "active", "fulfilled"],
|
|
218
|
+
terminals: ["cancelled"],
|
|
219
|
+
statusMap: orderCpqStatusMap,
|
|
220
|
+
ariaLabel: "Order status path"
|
|
221
|
+
}
|
|
222
|
+
) }),
|
|
223
|
+
error && /* @__PURE__ */ jsx(ErrorBanner, { message: error, onDismiss: () => setError(null) }),
|
|
224
|
+
linkedSubscriptions.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: linkedSubscriptions.map((sub) => /* @__PURE__ */ jsxs(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
className: "rounded-lg border bg-card p-4 flex items-center gap-4",
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 space-y-1", children: [
|
|
230
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
231
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Linked Subscription" }),
|
|
232
|
+
/* @__PURE__ */ jsx(
|
|
233
|
+
Tag,
|
|
234
|
+
{
|
|
235
|
+
variant: sub.status === "active" ? "success" : "info",
|
|
236
|
+
dot: true,
|
|
237
|
+
className: "text-[10px] px-1.5",
|
|
238
|
+
children: sub.status
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm font-medium", children: [
|
|
243
|
+
sub.name,
|
|
244
|
+
" ",
|
|
245
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
246
|
+
"(",
|
|
247
|
+
sub.code,
|
|
248
|
+
")"
|
|
249
|
+
] })
|
|
250
|
+
] }),
|
|
251
|
+
order.activatedAt && /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
252
|
+
"Activated on ",
|
|
253
|
+
new Date(order.activatedAt).toLocaleString()
|
|
254
|
+
] })
|
|
255
|
+
] }),
|
|
256
|
+
/* @__PURE__ */ jsxs(
|
|
257
|
+
Button,
|
|
258
|
+
{
|
|
259
|
+
type: "button",
|
|
260
|
+
variant: "outline",
|
|
261
|
+
onClick: () => router.push(`/backend/cpq/inventory/subscriptions/${sub.id}`),
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "h-3.5 w-3.5" }),
|
|
264
|
+
"Open"
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
sub.id
|
|
271
|
+
)) }),
|
|
272
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3", children: [
|
|
273
|
+
/* @__PURE__ */ jsx(MetaCard, { label: "Customer", children: customerName ? /* @__PURE__ */ jsx("span", { className: "font-medium", children: customerName }) : /* @__PURE__ */ jsxs("span", { className: "font-mono text-xs text-muted-foreground", children: [
|
|
274
|
+
order.customerId.slice(0, 8),
|
|
275
|
+
"\u2026"
|
|
276
|
+
] }) }),
|
|
277
|
+
/* @__PURE__ */ jsx(MetaCard, { label: "Created", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: new Date(order.createdAt).toLocaleDateString() }) }),
|
|
278
|
+
/* @__PURE__ */ jsx(MetaCard, { label: "Currency", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: currency }) })
|
|
279
|
+
] }),
|
|
280
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-4", children: [
|
|
281
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium mb-3", children: "Pricing Summary" }),
|
|
282
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
283
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
284
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Non-Recurring (NRC)" }),
|
|
285
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold font-mono", children: fmt(order.pricingSummary.nrcTotal, currency) })
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
288
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Monthly Recurring (MRC)" }),
|
|
289
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold font-mono", children: fmt(order.pricingSummary.mrcTotal, currency) })
|
|
290
|
+
] })
|
|
291
|
+
] })
|
|
292
|
+
] }),
|
|
293
|
+
/* @__PURE__ */ jsx(
|
|
294
|
+
OrderLineTree,
|
|
295
|
+
{
|
|
296
|
+
lines: order.lines,
|
|
297
|
+
currency,
|
|
298
|
+
expandedLines,
|
|
299
|
+
pricingDetail,
|
|
300
|
+
onToggleLine: toggleLine,
|
|
301
|
+
onTogglePricingDetail: togglePricingDetail
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
] });
|
|
305
|
+
}
|
|
306
|
+
function MetaCard({ label, children }) {
|
|
307
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-4", children: [
|
|
308
|
+
/* @__PURE__ */ jsx("div", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: label }),
|
|
309
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1 text-sm", children })
|
|
310
|
+
] });
|
|
311
|
+
}
|
|
312
|
+
function OrderLineTree({
|
|
313
|
+
lines,
|
|
314
|
+
currency,
|
|
315
|
+
expandedLines,
|
|
316
|
+
pricingDetail,
|
|
317
|
+
onToggleLine,
|
|
318
|
+
onTogglePricingDetail
|
|
319
|
+
}) {
|
|
320
|
+
const rootLines = lines.filter((l) => !l.parentLineId);
|
|
321
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
322
|
+
for (const line of lines) {
|
|
323
|
+
if (line.parentLineId) {
|
|
324
|
+
const arr = childrenByParent.get(line.parentLineId) ?? [];
|
|
325
|
+
arr.push(line);
|
|
326
|
+
childrenByParent.set(line.parentLineId, arr);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const indexOf = /* @__PURE__ */ new Map();
|
|
330
|
+
lines.forEach((l, i) => indexOf.set(l.lineId, i));
|
|
331
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
332
|
+
/* @__PURE__ */ jsxs("h3", { className: "text-sm font-medium mb-2 px-1", children: [
|
|
333
|
+
"Line Items (",
|
|
334
|
+
lines.length,
|
|
335
|
+
")"
|
|
336
|
+
] }),
|
|
337
|
+
lines.length === 0 ? /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card py-8 text-center text-sm text-muted-foreground", children: "No line items." }) : /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card divide-y", children: rootLines.map((line) => {
|
|
338
|
+
const isBundle = line.offeringType === "bundle";
|
|
339
|
+
const children = childrenByParent.get(line.lineId) ?? [];
|
|
340
|
+
const isExpanded = expandedLines.has(line.lineId);
|
|
341
|
+
const lineIdx = indexOf.get(line.lineId) ?? 0;
|
|
342
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
343
|
+
/* @__PURE__ */ jsx(
|
|
344
|
+
OrderLineRow,
|
|
345
|
+
{
|
|
346
|
+
line,
|
|
347
|
+
lineIdx,
|
|
348
|
+
currency,
|
|
349
|
+
isExpanded,
|
|
350
|
+
isBundle,
|
|
351
|
+
childCount: children.length,
|
|
352
|
+
indent: 0,
|
|
353
|
+
pricingDetail,
|
|
354
|
+
onToggle: () => onToggleLine(line.lineId),
|
|
355
|
+
onTogglePricingDetail
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
isBundle && isExpanded && children.length > 0 && /* @__PURE__ */ jsxs("div", { className: "border-t border-dashed border-brand-violet/30 bg-brand-violet/5", children: [
|
|
359
|
+
/* @__PURE__ */ jsx("div", { className: "px-6 py-1.5", children: /* @__PURE__ */ jsxs("span", { className: "text-[10px] font-medium text-brand-violet uppercase tracking-wider", children: [
|
|
360
|
+
"Bundle Components (",
|
|
361
|
+
children.length,
|
|
362
|
+
")"
|
|
363
|
+
] }) }),
|
|
364
|
+
children.map((child) => {
|
|
365
|
+
const childIdx = indexOf.get(child.lineId) ?? 0;
|
|
366
|
+
return /* @__PURE__ */ jsx(
|
|
367
|
+
OrderLineRow,
|
|
368
|
+
{
|
|
369
|
+
line: child,
|
|
370
|
+
lineIdx: childIdx,
|
|
371
|
+
currency,
|
|
372
|
+
isExpanded: expandedLines.has(child.lineId),
|
|
373
|
+
isBundle: false,
|
|
374
|
+
childCount: 0,
|
|
375
|
+
indent: 1,
|
|
376
|
+
pricingDetail,
|
|
377
|
+
onToggle: () => onToggleLine(child.lineId),
|
|
378
|
+
onTogglePricingDetail
|
|
379
|
+
},
|
|
380
|
+
child.lineId
|
|
381
|
+
);
|
|
382
|
+
})
|
|
383
|
+
] })
|
|
384
|
+
] }, line.lineId);
|
|
385
|
+
}) })
|
|
386
|
+
] });
|
|
387
|
+
}
|
|
388
|
+
function OrderLineRow({ line, lineIdx, currency, isExpanded, isBundle, childCount, indent, pricingDetail, onToggle, onTogglePricingDetail }) {
|
|
389
|
+
const paddingLeft = indent > 0 ? `${indent * 2 + 1}rem` : void 0;
|
|
390
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
391
|
+
/* @__PURE__ */ jsxs(
|
|
392
|
+
"div",
|
|
393
|
+
{
|
|
394
|
+
className: "flex items-center gap-3 px-4 py-3 hover:bg-muted/30 transition-colors cursor-pointer",
|
|
395
|
+
style: paddingLeft ? { paddingLeft } : void 0,
|
|
396
|
+
onClick: onToggle,
|
|
397
|
+
children: [
|
|
398
|
+
/* @__PURE__ */ jsx("button", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx("svg", { className: `h-4 w-4 transition-transform ${isExpanded ? "rotate-90" : ""}`, fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }) }),
|
|
399
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
400
|
+
indent > 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: "\u2514" }),
|
|
401
|
+
isBundle && /* @__PURE__ */ jsx(Tag, { variant: "brand", className: "px-1.5 text-xs", children: "bundle" }),
|
|
402
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: line.offeringName }),
|
|
403
|
+
line.quantity > 1 && /* @__PURE__ */ jsxs("span", { className: "rounded bg-muted px-1.5 py-0.5 text-xs font-medium", children: [
|
|
404
|
+
"\xD7",
|
|
405
|
+
line.quantity
|
|
406
|
+
] }),
|
|
407
|
+
/* @__PURE__ */ jsx(Tag, { variant: "info", className: "px-1.5 text-xs", children: line.action }),
|
|
408
|
+
isBundle && /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
409
|
+
childCount,
|
|
410
|
+
" component",
|
|
411
|
+
childCount !== 1 ? "s" : ""
|
|
412
|
+
] })
|
|
413
|
+
] }) }),
|
|
414
|
+
/* @__PURE__ */ jsxs("div", { className: "shrink-0 text-right text-xs space-y-0.5", children: [
|
|
415
|
+
line.nrcTotal > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
416
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "NRC " }),
|
|
417
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: fmt(line.nrcTotal, currency) })
|
|
418
|
+
] }),
|
|
419
|
+
line.mrcTotal > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
420
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "MRC " }),
|
|
421
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: fmt(line.mrcTotal, currency) })
|
|
422
|
+
] })
|
|
423
|
+
] })
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
isExpanded && (() => {
|
|
428
|
+
const internalKeys = /* @__PURE__ */ new Set(["_arcMirroredName", "_arcMirroredFromItemId", "offeringName"]);
|
|
429
|
+
const visibleConfigEntries = Object.entries(line.configuration).filter(
|
|
430
|
+
([key]) => !internalKeys.has(key)
|
|
431
|
+
);
|
|
432
|
+
const hasConfig = visibleConfigEntries.length > 0;
|
|
433
|
+
const hasCharges = line.charges.length > 0;
|
|
434
|
+
const hasTerm = !!(line.startDate || line.termMonths || line.endDate);
|
|
435
|
+
const hasArcDiff = !!line.arcSource;
|
|
436
|
+
const mirroredFromItemId = line.configuration?._arcMirroredFromItemId ?? null;
|
|
437
|
+
const isEmpty = !hasConfig && !hasCharges && !hasTerm && !hasArcDiff;
|
|
438
|
+
return /* @__PURE__ */ jsxs(
|
|
439
|
+
"div",
|
|
440
|
+
{
|
|
441
|
+
className: "border-t bg-muted/10 px-12 py-3 space-y-3",
|
|
442
|
+
style: paddingLeft ? { paddingLeft: `calc(${paddingLeft} + 2rem)` } : void 0,
|
|
443
|
+
children: [
|
|
444
|
+
hasArcDiff && /* @__PURE__ */ jsx(ArcLineDiff, { line, currency }),
|
|
445
|
+
isEmpty ? /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground space-y-1", children: [
|
|
446
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
447
|
+
"No detailed breakdown for this line.",
|
|
448
|
+
mirroredFromItemId && " Mirrored from existing subscription item."
|
|
449
|
+
] }),
|
|
450
|
+
(line.nrcTotal > 0 || line.mrcTotal > 0) && /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
451
|
+
line.nrcTotal > 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
452
|
+
"NRC ",
|
|
453
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-foreground", children: fmt(line.nrcTotal, currency) })
|
|
454
|
+
] }),
|
|
455
|
+
line.mrcTotal > 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
456
|
+
"MRC ",
|
|
457
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-foreground", children: fmt(line.mrcTotal, currency) })
|
|
458
|
+
] })
|
|
459
|
+
] })
|
|
460
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
461
|
+
hasConfig && /* @__PURE__ */ jsxs("div", { children: [
|
|
462
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Configuration" }),
|
|
463
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1", children: visibleConfigEntries.map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "text-xs", children: [
|
|
464
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
465
|
+
key,
|
|
466
|
+
": "
|
|
467
|
+
] }),
|
|
468
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: String(value) })
|
|
469
|
+
] }, key)) })
|
|
470
|
+
] }),
|
|
471
|
+
hasCharges && /* @__PURE__ */ jsxs("div", { children: [
|
|
472
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Charges" }),
|
|
473
|
+
/* @__PURE__ */ jsx(
|
|
474
|
+
ChargeBreakdown,
|
|
475
|
+
{
|
|
476
|
+
line,
|
|
477
|
+
lineIdx,
|
|
478
|
+
currency,
|
|
479
|
+
pricingDetail,
|
|
480
|
+
onTogglePricingDetail
|
|
481
|
+
}
|
|
482
|
+
)
|
|
483
|
+
] }),
|
|
484
|
+
hasTerm && /* @__PURE__ */ jsxs("div", { className: "flex gap-4 text-xs text-muted-foreground", children: [
|
|
485
|
+
line.startDate && /* @__PURE__ */ jsxs("span", { children: [
|
|
486
|
+
"Start: ",
|
|
487
|
+
new Date(line.startDate).toLocaleDateString()
|
|
488
|
+
] }),
|
|
489
|
+
line.termMonths && /* @__PURE__ */ jsxs("span", { children: [
|
|
490
|
+
"Term: ",
|
|
491
|
+
line.termMonths,
|
|
492
|
+
"mo"
|
|
493
|
+
] }),
|
|
494
|
+
line.endDate && /* @__PURE__ */ jsxs("span", { children: [
|
|
495
|
+
"End: ",
|
|
496
|
+
new Date(line.endDate).toLocaleDateString()
|
|
497
|
+
] })
|
|
498
|
+
] })
|
|
499
|
+
] })
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
})()
|
|
504
|
+
] });
|
|
505
|
+
}
|
|
506
|
+
function ChargeBreakdown({ line, lineIdx, currency, pricingDetail, onTogglePricingDetail }) {
|
|
507
|
+
return /* @__PURE__ */ jsxs("table", { className: "w-full text-xs", children: [
|
|
508
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
509
|
+
/* @__PURE__ */ jsx("th", { className: "text-left py-1 font-medium", children: "Charge" }),
|
|
510
|
+
/* @__PURE__ */ jsx("th", { className: "text-left py-1 font-medium", children: "Type" }),
|
|
511
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-1 font-medium", children: "Unit Price" }),
|
|
512
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-1 font-medium", children: "Qty" }),
|
|
513
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-1 font-medium", children: "Total" }),
|
|
514
|
+
/* @__PURE__ */ jsx("th", { className: "w-8" })
|
|
515
|
+
] }) }),
|
|
516
|
+
/* @__PURE__ */ jsx("tbody", { children: line.charges.map((c, i) => {
|
|
517
|
+
const hasDetail = !!(c.breakdown?.tiers?.length || c.adjustments?.length);
|
|
518
|
+
const isDetailOpen = pricingDetail?.lineIdx === lineIdx && pricingDetail?.chargeIdx === i;
|
|
519
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
520
|
+
/* @__PURE__ */ jsxs("tr", { className: "border-t border-dashed border-border/50", children: [
|
|
521
|
+
/* @__PURE__ */ jsx("td", { className: "py-1", children: c.chargeName ?? "\u2014" }),
|
|
522
|
+
/* @__PURE__ */ jsx("td", { className: "py-1 uppercase", children: c.chargeType ?? "\u2014" }),
|
|
523
|
+
/* @__PURE__ */ jsx("td", { className: "py-1 text-right font-mono", children: c.unitPrice != null ? fmt(c.unitPrice, currency) : "\u2014" }),
|
|
524
|
+
/* @__PURE__ */ jsx("td", { className: "py-1 text-right font-mono", children: c.quantity ?? "\u2014" }),
|
|
525
|
+
/* @__PURE__ */ jsx("td", { className: "py-1 text-right font-mono", children: c.totalPrice != null ? fmt(c.totalPrice, currency) : c.note ?? "\u2014" }),
|
|
526
|
+
/* @__PURE__ */ jsx("td", { className: "py-1 text-center", children: hasDetail && /* @__PURE__ */ jsx(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
onClick: () => onTogglePricingDetail(lineIdx, i),
|
|
530
|
+
className: "inline-flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
531
|
+
title: "Show pricing breakdown",
|
|
532
|
+
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) })
|
|
533
|
+
}
|
|
534
|
+
) })
|
|
535
|
+
] }),
|
|
536
|
+
isDetailOpen && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 6, className: "pb-3 pt-1", children: /* @__PURE__ */ jsxs("div", { className: "rounded border bg-background p-3 space-y-3 text-xs", children: [
|
|
537
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
538
|
+
/* @__PURE__ */ jsxs("span", { className: "font-semibold text-sm", children: [
|
|
539
|
+
"Pricing Details \u2014 ",
|
|
540
|
+
c.chargeName
|
|
541
|
+
] }),
|
|
542
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: c.pricingMethod ?? "flat" })
|
|
543
|
+
] }),
|
|
544
|
+
c.breakdown?.tiers && c.breakdown.tiers.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
545
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-muted-foreground mb-1", children: "Tier Breakdown" }),
|
|
546
|
+
/* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
547
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
548
|
+
/* @__PURE__ */ jsx("th", { className: "text-left py-0.5 font-medium", children: "Tier" }),
|
|
549
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Range" }),
|
|
550
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Price/Unit" }),
|
|
551
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Qty" }),
|
|
552
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Subtotal" })
|
|
553
|
+
] }) }),
|
|
554
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
555
|
+
c.breakdown.tiers.map((t) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-border/30", children: [
|
|
556
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5", children: t.tier }),
|
|
557
|
+
/* @__PURE__ */ jsxs("td", { className: "py-0.5 text-right font-mono", children: [
|
|
558
|
+
t.from,
|
|
559
|
+
"\u2013",
|
|
560
|
+
t.to
|
|
561
|
+
] }),
|
|
562
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(t.pricePerUnit, currency) }),
|
|
563
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: t.quantity }),
|
|
564
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(t.subtotal, currency) })
|
|
565
|
+
] }, t.tier)),
|
|
566
|
+
/* @__PURE__ */ jsxs("tr", { className: "border-t font-medium", children: [
|
|
567
|
+
/* @__PURE__ */ jsx("td", { colSpan: 4, className: "py-0.5 text-right", children: "Tiered Total" }),
|
|
568
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(c.breakdown.tiers.reduce((s, t) => s + t.subtotal, 0), currency) })
|
|
569
|
+
] })
|
|
570
|
+
] })
|
|
571
|
+
] })
|
|
572
|
+
] }),
|
|
573
|
+
c.adjustments && c.adjustments.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
574
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium text-muted-foreground mb-1", children: "Applied Price Rules" }),
|
|
575
|
+
/* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
576
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
577
|
+
/* @__PURE__ */ jsx("th", { className: "text-left py-0.5 font-medium", children: "Rule" }),
|
|
578
|
+
/* @__PURE__ */ jsx("th", { className: "text-left py-0.5 font-medium", children: "Type" }),
|
|
579
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Value" }),
|
|
580
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Before" }),
|
|
581
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "After" }),
|
|
582
|
+
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Delta" })
|
|
583
|
+
] }) }),
|
|
584
|
+
/* @__PURE__ */ jsx("tbody", { children: c.adjustments.map((adj, ai) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-border/30", children: [
|
|
585
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5", children: adj.ruleName }),
|
|
586
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5", children: RULE_TYPE_LABELS[adj.ruleType] ?? adj.ruleType }),
|
|
587
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmtRuleValue(adj, currency) }),
|
|
588
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(adj.unitPriceBefore, currency) }),
|
|
589
|
+
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(adj.unitPriceAfter, currency) }),
|
|
590
|
+
/* @__PURE__ */ jsxs("td", { className: `py-0.5 text-right font-mono ${adj.delta < 0 ? "text-destructive" : adj.delta > 0 ? "text-status-success-text" : ""}`, children: [
|
|
591
|
+
adj.delta > 0 ? "+" : "",
|
|
592
|
+
fmt(adj.delta, currency)
|
|
593
|
+
] })
|
|
594
|
+
] }, ai)) })
|
|
595
|
+
] })
|
|
596
|
+
] }),
|
|
597
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-1 border-t text-sm font-semibold", children: [
|
|
598
|
+
/* @__PURE__ */ jsx("span", { children: "Final Total" }),
|
|
599
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: c.totalPrice != null ? fmt(c.totalPrice, currency) : "\u2014" })
|
|
600
|
+
] })
|
|
601
|
+
] }) }) })
|
|
602
|
+
] }, i);
|
|
603
|
+
}) })
|
|
604
|
+
] });
|
|
605
|
+
}
|
|
606
|
+
function Spinner() {
|
|
607
|
+
return /* @__PURE__ */ jsxs("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", children: [
|
|
608
|
+
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
609
|
+
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" })
|
|
610
|
+
] });
|
|
611
|
+
}
|
|
612
|
+
function ErrorBanner({ message, onDismiss }) {
|
|
613
|
+
return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", className: "flex items-start gap-2", children: [
|
|
614
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: message }),
|
|
615
|
+
onDismiss && /* @__PURE__ */ jsx(
|
|
616
|
+
"button",
|
|
617
|
+
{
|
|
618
|
+
onClick: onDismiss,
|
|
619
|
+
className: "text-destructive/70 hover:text-destructive text-sm font-bold",
|
|
620
|
+
"aria-label": "Dismiss",
|
|
621
|
+
children: "\xD7"
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
] });
|
|
625
|
+
}
|
|
626
|
+
function ArcLineDiff({ line, currency }) {
|
|
627
|
+
const src = line.arcSource;
|
|
628
|
+
if (!src) return null;
|
|
629
|
+
const isCancel = line.action === "cancel";
|
|
630
|
+
const beforeMrc = src.mrcAmount;
|
|
631
|
+
const beforeNrc = src.nrcAmount;
|
|
632
|
+
const beforeQty = src.quantity;
|
|
633
|
+
const afterMrc = isCancel ? 0 : line.mrcTotal;
|
|
634
|
+
const afterNrc = isCancel ? 0 : line.nrcTotal;
|
|
635
|
+
const afterQty = isCancel ? 0 : line.quantity;
|
|
636
|
+
const mrcDelta = afterMrc - beforeMrc;
|
|
637
|
+
const nrcDelta = afterNrc - beforeNrc;
|
|
638
|
+
const qtyDelta = afterQty - beforeQty;
|
|
639
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
640
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1.5", children: "Change Preview" }),
|
|
641
|
+
/* @__PURE__ */ jsx("div", { className: "rounded border bg-background overflow-hidden", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-xs", children: [
|
|
642
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-muted/40", children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
643
|
+
/* @__PURE__ */ jsx("th", { className: "text-left px-3 py-1.5 font-medium" }),
|
|
644
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium", children: "Before" }),
|
|
645
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium", children: "After" }),
|
|
646
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium", children: "\u0394" })
|
|
647
|
+
] }) }),
|
|
648
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
649
|
+
/* @__PURE__ */ jsx(ArcDiffRow, { label: "Quantity", before: beforeQty, after: afterQty, delta: qtyDelta, currency: null, dimAfter: isCancel }),
|
|
650
|
+
/* @__PURE__ */ jsx(ArcDiffRow, { label: "MRC", before: beforeMrc, after: afterMrc, delta: mrcDelta, currency, dimAfter: isCancel }),
|
|
651
|
+
/* @__PURE__ */ jsx(ArcDiffRow, { label: "NRC", before: beforeNrc, after: afterNrc, delta: nrcDelta, currency, dimAfter: isCancel })
|
|
652
|
+
] })
|
|
653
|
+
] }) }),
|
|
654
|
+
isCancel && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1 italic", children: "Cancellation \u2014 item will be terminated on activation." })
|
|
655
|
+
] });
|
|
656
|
+
}
|
|
657
|
+
function ArcDiffRow({
|
|
658
|
+
label,
|
|
659
|
+
before,
|
|
660
|
+
after,
|
|
661
|
+
delta,
|
|
662
|
+
currency,
|
|
663
|
+
dimAfter
|
|
664
|
+
}) {
|
|
665
|
+
const fmtVal = (v) => currency ? fmt(v, currency) : String(v);
|
|
666
|
+
const showDelta = delta !== 0;
|
|
667
|
+
return /* @__PURE__ */ jsxs("tr", { className: "border-t border-dashed border-border/40", children: [
|
|
668
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-1 text-muted-foreground", children: label }),
|
|
669
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-1 text-right font-mono", children: fmtVal(before) }),
|
|
670
|
+
/* @__PURE__ */ jsx("td", { className: `px-3 py-1 text-right font-mono ${dimAfter ? "text-muted-foreground line-through" : ""}`, children: fmtVal(after) }),
|
|
671
|
+
/* @__PURE__ */ jsx("td", { className: `px-3 py-1 text-right font-mono font-medium ${showDelta ? delta > 0 ? "text-status-success-text" : "text-destructive" : "text-muted-foreground"}`, children: showDelta ? `${delta > 0 ? "+" : ""}${fmtVal(delta)}` : "\u2014" })
|
|
672
|
+
] });
|
|
673
|
+
}
|
|
674
|
+
export {
|
|
675
|
+
CpqOrderDetailPage as default
|
|
676
|
+
};
|
|
677
|
+
//# sourceMappingURL=page.js.map
|