@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,440 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { useRouter, useParams } from 'next/navigation'
|
|
4
|
+
import { Alert } from '@open-mercato/ui/primitives/alert'
|
|
5
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
6
|
+
import { Tag } from '@open-mercato/ui/primitives/tag'
|
|
7
|
+
import { FormHeader } from '@open-mercato/ui/backend/forms'
|
|
8
|
+
import {
|
|
9
|
+
assetStatusMap,
|
|
10
|
+
formatStatusLabel,
|
|
11
|
+
type AssetStatus,
|
|
12
|
+
} from '../../../../../components/statusMaps'
|
|
13
|
+
import { StatusPath } from '../../../../../components/StatusPath'
|
|
14
|
+
|
|
15
|
+
type AssetDetail = {
|
|
16
|
+
id: string
|
|
17
|
+
customerId: string
|
|
18
|
+
subscriptionId: string | null
|
|
19
|
+
subscriptionItemId: string | null
|
|
20
|
+
productId: string | null
|
|
21
|
+
offeringId: string | null
|
|
22
|
+
specId: string | null
|
|
23
|
+
code: string
|
|
24
|
+
name: string
|
|
25
|
+
description: string | null
|
|
26
|
+
status: string
|
|
27
|
+
assetType: string
|
|
28
|
+
currencyCode: string
|
|
29
|
+
purchasePrice: number
|
|
30
|
+
quantity: number
|
|
31
|
+
purchaseDate: string | null
|
|
32
|
+
deliveryDate: string | null
|
|
33
|
+
configuration: Record<string, unknown>
|
|
34
|
+
charges: Array<Record<string, unknown>> | null
|
|
35
|
+
sourceQuoteId: string | null
|
|
36
|
+
sourceOrderId: string | null
|
|
37
|
+
sourceQuoteLineId: string | null
|
|
38
|
+
metadata: Record<string, unknown> | null
|
|
39
|
+
createdAt: string
|
|
40
|
+
updatedAt: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const ALLOWED_TRANSITIONS: Record<string, string[]> = {
|
|
44
|
+
pending: ['delivered', 'active', 'cancelled'],
|
|
45
|
+
delivered: ['active', 'returned'],
|
|
46
|
+
active: ['returned'],
|
|
47
|
+
returned: [],
|
|
48
|
+
cancelled: [],
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const STATUS_LABELS: Record<string, string> = {
|
|
52
|
+
pending: 'Pending',
|
|
53
|
+
delivered: 'Delivered',
|
|
54
|
+
active: 'Active',
|
|
55
|
+
returned: 'Returned',
|
|
56
|
+
cancelled: 'Cancelled',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function fmt(amount: number | string, currency: string): string {
|
|
60
|
+
return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(Number(amount))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default function AssetDetailPage(props: { params?: { id?: string } }) {
|
|
64
|
+
const router = useRouter()
|
|
65
|
+
const urlParams = useParams()
|
|
66
|
+
const assetId = (props.params?.id ?? urlParams?.id) as string
|
|
67
|
+
|
|
68
|
+
const [asset, setAsset] = React.useState<AssetDetail | null>(null)
|
|
69
|
+
const [loading, setLoading] = React.useState(true)
|
|
70
|
+
const [error, setError] = React.useState<string | null>(null)
|
|
71
|
+
const [customerName, setCustomerName] = React.useState<string | null>(null)
|
|
72
|
+
const [subscriptionName, setSubscriptionName] = React.useState<string | null>(null)
|
|
73
|
+
// Resolved names for the other ID references on the page.
|
|
74
|
+
const [productName, setProductName] = React.useState<string | null>(null)
|
|
75
|
+
const [offeringName, setOfferingName] = React.useState<string | null>(null)
|
|
76
|
+
const [specName, setSpecName] = React.useState<string | null>(null)
|
|
77
|
+
const [sourceQuoteNumber, setSourceQuoteNumber] = React.useState<string | null>(null)
|
|
78
|
+
const [sourceOrderNumber, setSourceOrderNumber] = React.useState<string | null>(null)
|
|
79
|
+
const [transitioning, setTransitioning] = React.useState(false)
|
|
80
|
+
|
|
81
|
+
const transitionStatus = async (targetStatus: string) => {
|
|
82
|
+
if (!asset) return
|
|
83
|
+
try {
|
|
84
|
+
setTransitioning(true)
|
|
85
|
+
setError(null)
|
|
86
|
+
const res = await fetch('/api/cpq/inventory/assets/status', {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers: { 'Content-Type': 'application/json' },
|
|
89
|
+
body: JSON.stringify({ id: asset.id, targetStatus }),
|
|
90
|
+
})
|
|
91
|
+
const data = await res.json()
|
|
92
|
+
if (!res.ok) throw new Error(data?.error ?? 'Status transition failed')
|
|
93
|
+
setAsset((prev) => prev ? { ...prev, ...data } : prev)
|
|
94
|
+
} catch (err) {
|
|
95
|
+
setError((err as Error).message)
|
|
96
|
+
} finally {
|
|
97
|
+
setTransitioning(false)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
let cancelled = false
|
|
103
|
+
async function load() {
|
|
104
|
+
try {
|
|
105
|
+
const res = await fetch(`/api/cpq/inventory/assets?id=${assetId}`)
|
|
106
|
+
if (!res.ok) throw new Error('Asset not found')
|
|
107
|
+
const data: AssetDetail = await res.json()
|
|
108
|
+
if (!cancelled) {
|
|
109
|
+
setAsset(data)
|
|
110
|
+
|
|
111
|
+
// Resolve names for every FK reference. Each lookup is fire-and-
|
|
112
|
+
// forget; the UI falls back to a short UUID until the name lands.
|
|
113
|
+
fetch(`/api/customers/companies?id=${data.customerId}&pageSize=1`)
|
|
114
|
+
.then((r) => r.json())
|
|
115
|
+
.then((result) => {
|
|
116
|
+
const items = result.items ?? result ?? []
|
|
117
|
+
const c = items[0]
|
|
118
|
+
if (c && !cancelled) setCustomerName(c.display_name || c.displayName || c.name || null)
|
|
119
|
+
})
|
|
120
|
+
.catch(() => {})
|
|
121
|
+
|
|
122
|
+
if (data.subscriptionId) {
|
|
123
|
+
fetch(`/api/cpq/inventory/subscriptions?id=${data.subscriptionId}`)
|
|
124
|
+
.then((r) => r.json())
|
|
125
|
+
.then((sub) => {
|
|
126
|
+
if (sub && !cancelled) setSubscriptionName(sub.name || sub.code || null)
|
|
127
|
+
})
|
|
128
|
+
.catch(() => {})
|
|
129
|
+
}
|
|
130
|
+
if (data.offeringId) {
|
|
131
|
+
fetch(`/api/cpq/product-offerings?id=${data.offeringId}`)
|
|
132
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
133
|
+
.then((o) => {
|
|
134
|
+
if (!o || cancelled) return
|
|
135
|
+
if (o.name) setOfferingName(o.name)
|
|
136
|
+
if (o.specification?.name) setSpecName(o.specification.name)
|
|
137
|
+
})
|
|
138
|
+
.catch(() => {})
|
|
139
|
+
}
|
|
140
|
+
if (data.specId) {
|
|
141
|
+
fetch(`/api/cpq/product-specifications?id=${data.specId}`)
|
|
142
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
143
|
+
.then((s) => {
|
|
144
|
+
if (s?.name && !cancelled) setSpecName(s.name)
|
|
145
|
+
})
|
|
146
|
+
.catch(() => {})
|
|
147
|
+
}
|
|
148
|
+
if (data.productId) {
|
|
149
|
+
// Catalog products route is paginated; `?id=…` returns one row.
|
|
150
|
+
fetch(`/api/catalog/products?id=${data.productId}`)
|
|
151
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
152
|
+
.then((res2) => {
|
|
153
|
+
if (!res2 || cancelled) return
|
|
154
|
+
const p = (res2.items ?? res2)[0] ?? res2
|
|
155
|
+
const name = p?.title ?? p?.name ?? p?.handle ?? null
|
|
156
|
+
if (name) setProductName(name)
|
|
157
|
+
})
|
|
158
|
+
.catch(() => {})
|
|
159
|
+
}
|
|
160
|
+
if (data.sourceQuoteId) {
|
|
161
|
+
fetch(`/api/cpq/quotes/${data.sourceQuoteId}`)
|
|
162
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
163
|
+
.then((q) => {
|
|
164
|
+
if (q?.quoteNumber && !cancelled) setSourceQuoteNumber(q.quoteNumber)
|
|
165
|
+
})
|
|
166
|
+
.catch(() => {})
|
|
167
|
+
}
|
|
168
|
+
if (data.sourceOrderId) {
|
|
169
|
+
fetch(`/api/cpq/orders/${data.sourceOrderId}`)
|
|
170
|
+
.then((r) => (r.ok ? r.json() : null))
|
|
171
|
+
.then((o) => {
|
|
172
|
+
if (o?.orderNumber && !cancelled) setSourceOrderNumber(o.orderNumber)
|
|
173
|
+
})
|
|
174
|
+
.catch(() => {})
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
} catch (err) {
|
|
178
|
+
if (!cancelled) setError((err as Error).message)
|
|
179
|
+
} finally {
|
|
180
|
+
if (!cancelled) setLoading(false)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
load()
|
|
184
|
+
return () => { cancelled = true }
|
|
185
|
+
}, [assetId])
|
|
186
|
+
|
|
187
|
+
if (loading) {
|
|
188
|
+
return (
|
|
189
|
+
<div className="flex items-center gap-2 py-12 justify-center text-sm text-muted-foreground">
|
|
190
|
+
<Spinner /> Loading…
|
|
191
|
+
</div>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!asset) {
|
|
196
|
+
return (
|
|
197
|
+
<div className="space-y-4">
|
|
198
|
+
<button onClick={() => router.push('/backend/cpq/inventory')} className="text-sm text-muted-foreground hover:text-foreground">← Back</button>
|
|
199
|
+
{error && <ErrorBanner message={error} />}
|
|
200
|
+
<div className="rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground">Asset not found.</div>
|
|
201
|
+
</div>
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const currency = asset.currencyCode || 'USD'
|
|
206
|
+
const statusTransitions = ALLOWED_TRANSITIONS[asset.status] ?? []
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
<div className="space-y-6">
|
|
210
|
+
{/* Header — standard FormHeader detail mode, matches the rest of the
|
|
211
|
+
CPQ admin (quote / order / subscription). The asset code lives
|
|
212
|
+
in the Asset Details card; here we show only the human name +
|
|
213
|
+
status / type tags. */}
|
|
214
|
+
<FormHeader
|
|
215
|
+
mode="detail"
|
|
216
|
+
backHref="/backend/cpq/inventory"
|
|
217
|
+
backLabel="Back to Customer Inventory"
|
|
218
|
+
entityTypeLabel="Asset"
|
|
219
|
+
title={asset.name}
|
|
220
|
+
statusBadge={
|
|
221
|
+
<div className="flex flex-wrap items-center gap-2 pt-1">
|
|
222
|
+
<Tag variant={assetStatusMap[asset.status as AssetStatus] ?? 'neutral'} dot>
|
|
223
|
+
{STATUS_LABELS[asset.status] ?? formatStatusLabel(asset.status)}
|
|
224
|
+
</Tag>
|
|
225
|
+
<Tag variant="brand" className="capitalize">{asset.assetType.replace(/_/g, ' ')}</Tag>
|
|
226
|
+
{transitioning && <Spinner />}
|
|
227
|
+
</div>
|
|
228
|
+
}
|
|
229
|
+
/>
|
|
230
|
+
|
|
231
|
+
{/* Status path — interactive: clicking a non-current step in the
|
|
232
|
+
breadcrumb invokes /api/cpq/inventory/assets/status. */}
|
|
233
|
+
<div className="flex items-center gap-3 flex-wrap">
|
|
234
|
+
<StatusPath
|
|
235
|
+
current={asset.status}
|
|
236
|
+
path={['pending', 'delivered', 'active', 'returned']}
|
|
237
|
+
terminals={['cancelled']}
|
|
238
|
+
statusMap={assetStatusMap}
|
|
239
|
+
labels={STATUS_LABELS}
|
|
240
|
+
onTransition={transitionStatus}
|
|
241
|
+
allowedTransitions={statusTransitions}
|
|
242
|
+
disabled={transitioning}
|
|
243
|
+
ariaLabel="Asset status path"
|
|
244
|
+
/>
|
|
245
|
+
{transitioning && <Spinner />}
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
{error && <ErrorBanner message={error} />}
|
|
249
|
+
|
|
250
|
+
{/* Detail Cards */}
|
|
251
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
252
|
+
<div className="rounded-lg border bg-card p-4 space-y-3">
|
|
253
|
+
<h3 className="text-sm font-medium">Asset Details</h3>
|
|
254
|
+
<div className="grid grid-cols-2 gap-x-4 gap-y-2">
|
|
255
|
+
<Field label="Code" value={asset.code} mono />
|
|
256
|
+
<Field label="Status" value={asset.status} />
|
|
257
|
+
<Field label="Asset Type" value={asset.assetType.replace(/_/g, ' ')} />
|
|
258
|
+
<Field label="Currency" value={currency} />
|
|
259
|
+
<Field label="Quantity" value={String(asset.quantity)} />
|
|
260
|
+
{asset.purchaseDate && <Field label="Purchase Date" value={new Date(asset.purchaseDate).toLocaleDateString()} />}
|
|
261
|
+
{asset.deliveryDate && <Field label="Delivery Date" value={new Date(asset.deliveryDate).toLocaleDateString()} />}
|
|
262
|
+
</div>
|
|
263
|
+
{asset.description && (
|
|
264
|
+
<div className="pt-1">
|
|
265
|
+
<p className="text-xs text-muted-foreground">Description</p>
|
|
266
|
+
<p className="text-sm">{asset.description}</p>
|
|
267
|
+
</div>
|
|
268
|
+
)}
|
|
269
|
+
</div>
|
|
270
|
+
|
|
271
|
+
<div className="rounded-lg border bg-card p-4 space-y-3">
|
|
272
|
+
<h3 className="text-sm font-medium">Pricing & References</h3>
|
|
273
|
+
<div>
|
|
274
|
+
<p className="text-xs text-muted-foreground">Purchase Price</p>
|
|
275
|
+
<p className="text-lg font-semibold font-mono">{fmt(asset.purchasePrice, currency)}</p>
|
|
276
|
+
</div>
|
|
277
|
+
<div className="grid grid-cols-2 gap-x-4 gap-y-2 pt-1">
|
|
278
|
+
<Field label="Customer" value={customerName ?? `${asset.customerId.slice(0, 12)}…`} />
|
|
279
|
+
<Field label="Created" value={new Date(asset.createdAt).toLocaleString()} />
|
|
280
|
+
{asset.subscriptionId && (
|
|
281
|
+
<RefField
|
|
282
|
+
label="Linked Subscription"
|
|
283
|
+
name={subscriptionName ?? undefined}
|
|
284
|
+
fallback={asset.subscriptionId}
|
|
285
|
+
onClick={() => router.push(`/backend/cpq/inventory/subscriptions/${asset.subscriptionId}`)}
|
|
286
|
+
/>
|
|
287
|
+
)}
|
|
288
|
+
{asset.offeringId && (
|
|
289
|
+
<RefField
|
|
290
|
+
label="Offering"
|
|
291
|
+
name={offeringName ?? undefined}
|
|
292
|
+
fallback={asset.offeringId}
|
|
293
|
+
onClick={() => router.push(`/backend/cpq/offerings/${asset.offeringId}`)}
|
|
294
|
+
/>
|
|
295
|
+
)}
|
|
296
|
+
{asset.specId && (
|
|
297
|
+
<RefField
|
|
298
|
+
label="Specification"
|
|
299
|
+
name={specName ?? undefined}
|
|
300
|
+
fallback={asset.specId}
|
|
301
|
+
onClick={() => router.push(`/backend/cpq/specifications/${asset.specId}`)}
|
|
302
|
+
/>
|
|
303
|
+
)}
|
|
304
|
+
{asset.productId && (
|
|
305
|
+
<RefField
|
|
306
|
+
label="Product"
|
|
307
|
+
name={productName ?? undefined}
|
|
308
|
+
fallback={asset.productId}
|
|
309
|
+
onClick={() => router.push(`/backend/catalog/products/${asset.productId}`)}
|
|
310
|
+
/>
|
|
311
|
+
)}
|
|
312
|
+
{asset.sourceQuoteId && (
|
|
313
|
+
<RefField
|
|
314
|
+
label="Source Quote"
|
|
315
|
+
name={sourceQuoteNumber ?? undefined}
|
|
316
|
+
fallback={asset.sourceQuoteId}
|
|
317
|
+
onClick={() => router.push(`/backend/cpq/quotes/${asset.sourceQuoteId}`)}
|
|
318
|
+
/>
|
|
319
|
+
)}
|
|
320
|
+
{asset.sourceOrderId && (
|
|
321
|
+
<RefField
|
|
322
|
+
label="Source Order"
|
|
323
|
+
name={sourceOrderNumber ?? undefined}
|
|
324
|
+
fallback={asset.sourceOrderId}
|
|
325
|
+
onClick={() => router.push(`/backend/cpq/orders/${asset.sourceOrderId}`)}
|
|
326
|
+
/>
|
|
327
|
+
)}
|
|
328
|
+
</div>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
{/* Configuration */}
|
|
333
|
+
{asset.configuration && Object.keys(asset.configuration).length > 0 && (
|
|
334
|
+
<div className="rounded-lg border bg-card p-4">
|
|
335
|
+
<h3 className="text-sm font-medium mb-2">Configuration</h3>
|
|
336
|
+
<div className="grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1">
|
|
337
|
+
{Object.entries(asset.configuration).map(([key, value]) => (
|
|
338
|
+
<div key={key} className="text-xs">
|
|
339
|
+
<span className="text-muted-foreground">{key}: </span>
|
|
340
|
+
<span className="font-medium">{String(value)}</span>
|
|
341
|
+
</div>
|
|
342
|
+
))}
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
)}
|
|
346
|
+
|
|
347
|
+
{/* Charges */}
|
|
348
|
+
{asset.charges && asset.charges.length > 0 && (
|
|
349
|
+
<div className="rounded-lg border bg-card p-4">
|
|
350
|
+
<h3 className="text-sm font-medium mb-2">Charges</h3>
|
|
351
|
+
<table className="w-full text-sm">
|
|
352
|
+
<thead>
|
|
353
|
+
<tr className="border-b bg-muted/50 text-muted-foreground">
|
|
354
|
+
<th className="text-left px-3 py-2 font-medium">Charge</th>
|
|
355
|
+
<th className="text-left px-3 py-2 font-medium">Type</th>
|
|
356
|
+
<th className="text-right px-3 py-2 font-medium">Unit Price</th>
|
|
357
|
+
<th className="text-right px-3 py-2 font-medium">Qty</th>
|
|
358
|
+
<th className="text-right px-3 py-2 font-medium">Total</th>
|
|
359
|
+
</tr>
|
|
360
|
+
</thead>
|
|
361
|
+
<tbody>
|
|
362
|
+
{asset.charges.map((c, i) => (
|
|
363
|
+
<tr key={i} className="border-b">
|
|
364
|
+
<td className="px-3 py-2">{(c as any).chargeName ?? '—'}</td>
|
|
365
|
+
<td className="px-3 py-2 uppercase">{(c as any).chargeType ?? '—'}</td>
|
|
366
|
+
<td className="px-3 py-2 text-right font-mono">{(c as any).unitPrice != null ? fmt((c as any).unitPrice, currency) : '—'}</td>
|
|
367
|
+
<td className="px-3 py-2 text-right font-mono">{(c as any).quantity ?? '—'}</td>
|
|
368
|
+
<td className="px-3 py-2 text-right font-mono">{(c as any).totalPrice != null ? fmt((c as any).totalPrice, currency) : '—'}</td>
|
|
369
|
+
</tr>
|
|
370
|
+
))}
|
|
371
|
+
</tbody>
|
|
372
|
+
</table>
|
|
373
|
+
</div>
|
|
374
|
+
)}
|
|
375
|
+
|
|
376
|
+
{/* Metadata */}
|
|
377
|
+
{asset.metadata && Object.keys(asset.metadata).length > 0 && (
|
|
378
|
+
<div className="rounded-lg border bg-card p-4">
|
|
379
|
+
<h3 className="text-sm font-medium mb-2">Metadata</h3>
|
|
380
|
+
<div className="grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1">
|
|
381
|
+
{Object.entries(asset.metadata).map(([key, value]) => (
|
|
382
|
+
<div key={key} className="text-xs">
|
|
383
|
+
<span className="text-muted-foreground">{key}: </span>
|
|
384
|
+
<span className="font-medium">{String(value)}</span>
|
|
385
|
+
</div>
|
|
386
|
+
))}
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
)}
|
|
390
|
+
</div>
|
|
391
|
+
)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function Field({ label, value, mono }: { label: string; value: string; mono?: boolean }) {
|
|
395
|
+
return (
|
|
396
|
+
<div>
|
|
397
|
+
<p className="text-xs text-muted-foreground">{label}</p>
|
|
398
|
+
<p className={`text-sm ${mono ? 'font-mono' : ''}`}>{value}</p>
|
|
399
|
+
</div>
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function RefField({
|
|
404
|
+
label,
|
|
405
|
+
name,
|
|
406
|
+
fallback,
|
|
407
|
+
onClick,
|
|
408
|
+
}: {
|
|
409
|
+
label: string
|
|
410
|
+
name: string | undefined
|
|
411
|
+
fallback: string
|
|
412
|
+
onClick: () => void
|
|
413
|
+
}) {
|
|
414
|
+
return (
|
|
415
|
+
<div>
|
|
416
|
+
<p className="text-xs text-muted-foreground">{label}</p>
|
|
417
|
+
<button
|
|
418
|
+
type="button"
|
|
419
|
+
onClick={onClick}
|
|
420
|
+
className="text-sm text-primary hover:underline text-left truncate max-w-full"
|
|
421
|
+
title={name ?? fallback}
|
|
422
|
+
>
|
|
423
|
+
{name ?? `${fallback.slice(0, 12)}…`}
|
|
424
|
+
</button>
|
|
425
|
+
</div>
|
|
426
|
+
)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function Spinner() {
|
|
430
|
+
return (
|
|
431
|
+
<svg className="h-4 w-4 animate-spin" viewBox="0 0 24 24" fill="none">
|
|
432
|
+
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
|
|
433
|
+
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" />
|
|
434
|
+
</svg>
|
|
435
|
+
)
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function ErrorBanner({ message }: { message: string }) {
|
|
439
|
+
return <Alert variant="destructive">{message}</Alert>
|
|
440
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Package } from 'lucide-react'
|
|
3
|
+
|
|
4
|
+
const inventoryIcon = React.createElement(Package, { size: 16 })
|
|
5
|
+
|
|
6
|
+
export const metadata = {
|
|
7
|
+
requireAuth: true,
|
|
8
|
+
requireFeatures: ['cpq.inventory.view'],
|
|
9
|
+
pageTitle: 'CPQ Subscriptions',
|
|
10
|
+
pageTitleKey: 'cpq.inventory.title',
|
|
11
|
+
pageGroup: 'CPQ',
|
|
12
|
+
pageGroupKey: 'customers~sales~cpq.nav.group',
|
|
13
|
+
pageOrder: 92,
|
|
14
|
+
icon: inventoryIcon,
|
|
15
|
+
breadcrumb: [{ label: 'CPQ Subscriptions', labelKey: 'cpq.inventory.title' }],
|
|
16
|
+
} as const
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
4
|
+
import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
5
|
+
import { CpqInteractionStyles } from '../../../components/CpqListView'
|
|
6
|
+
import { SubscriptionsTable } from './SubscriptionsTable'
|
|
7
|
+
import { AssetsTable } from './AssetsTable'
|
|
8
|
+
|
|
9
|
+
type TabKey = 'subscriptions' | 'assets'
|
|
10
|
+
|
|
11
|
+
export default function InventoryPage() {
|
|
12
|
+
const t = useT()
|
|
13
|
+
const [activeTab, setActiveTab] = React.useState<TabKey>('subscriptions')
|
|
14
|
+
|
|
15
|
+
const tabs: { key: TabKey; label: string }[] = [
|
|
16
|
+
{ key: 'subscriptions', label: t('cpq.inventory.subscriptions', 'Subscriptions') },
|
|
17
|
+
{ key: 'assets', label: t('cpq.inventory.assets', 'Assets') },
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Page>
|
|
22
|
+
<PageBody className="cpq-list-view space-y-6">
|
|
23
|
+
<CpqInteractionStyles />
|
|
24
|
+
<div className="flex items-center justify-between">
|
|
25
|
+
<h1 className="text-2xl font-bold">{t('cpq.inventory.title', 'Customer Inventory')}</h1>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<div className="flex gap-1 border-b">
|
|
29
|
+
{tabs.map((tab) => (
|
|
30
|
+
<button
|
|
31
|
+
key={tab.key}
|
|
32
|
+
type="button"
|
|
33
|
+
onClick={() => setActiveTab(tab.key)}
|
|
34
|
+
className={`cursor-pointer px-3 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${
|
|
35
|
+
activeTab === tab.key
|
|
36
|
+
? 'border-primary text-primary'
|
|
37
|
+
: 'border-transparent text-muted-foreground hover:text-foreground'
|
|
38
|
+
}`}
|
|
39
|
+
>
|
|
40
|
+
{tab.label}
|
|
41
|
+
</button>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
{activeTab === 'subscriptions' ? <SubscriptionsTable /> : <AssetsTable />}
|
|
46
|
+
</PageBody>
|
|
47
|
+
</Page>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { Tag } from '@open-mercato/ui/primitives/tag'
|
|
4
|
+
import {
|
|
5
|
+
assetStatusMap,
|
|
6
|
+
formatStatusLabel,
|
|
7
|
+
subscriptionStatusMap,
|
|
8
|
+
type AssetStatus,
|
|
9
|
+
type SubscriptionStatus,
|
|
10
|
+
} from '../../../components/statusMaps'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Subscription / asset status pill. Looks up the OM Tag variant from the
|
|
14
|
+
* shared maps so palettes stay consistent with the rest of the CPQ surface.
|
|
15
|
+
* Falls back to `neutral` for unknown values so a renamed enum value still
|
|
16
|
+
* renders without crashing.
|
|
17
|
+
*/
|
|
18
|
+
export function StatusBadge({ status }: { status: string }) {
|
|
19
|
+
const variant =
|
|
20
|
+
subscriptionStatusMap[status as SubscriptionStatus] ??
|
|
21
|
+
assetStatusMap[status as AssetStatus] ??
|
|
22
|
+
'neutral'
|
|
23
|
+
return (
|
|
24
|
+
<Tag variant={variant} dot>
|
|
25
|
+
{formatStatusLabel(status)}
|
|
26
|
+
</Tag>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function formatCurrency(amount: number, currency: string): string {
|
|
31
|
+
return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(amount)
|
|
32
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const metadata = {
|
|
2
|
+
requireAuth: true,
|
|
3
|
+
requireFeatures: ['cpq.inventory.view'],
|
|
4
|
+
navHidden: true,
|
|
5
|
+
breadcrumb: [
|
|
6
|
+
{ label: 'Customer Inventory', labelKey: 'cpq.inventory.title', href: '/backend/cpq/inventory' },
|
|
7
|
+
{ label: 'Subscription Detail' },
|
|
8
|
+
],
|
|
9
|
+
} as const
|