@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,343 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRouter, useParams } from "next/navigation";
|
|
5
|
+
import { Alert } from "@open-mercato/ui/primitives/alert";
|
|
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
|
+
} from "../../../../../components/statusMaps.js";
|
|
12
|
+
import { StatusPath } from "../../../../../components/StatusPath.js";
|
|
13
|
+
const ALLOWED_TRANSITIONS = {
|
|
14
|
+
pending: ["delivered", "active", "cancelled"],
|
|
15
|
+
delivered: ["active", "returned"],
|
|
16
|
+
active: ["returned"],
|
|
17
|
+
returned: [],
|
|
18
|
+
cancelled: []
|
|
19
|
+
};
|
|
20
|
+
const STATUS_LABELS = {
|
|
21
|
+
pending: "Pending",
|
|
22
|
+
delivered: "Delivered",
|
|
23
|
+
active: "Active",
|
|
24
|
+
returned: "Returned",
|
|
25
|
+
cancelled: "Cancelled"
|
|
26
|
+
};
|
|
27
|
+
function fmt(amount, currency) {
|
|
28
|
+
return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(Number(amount));
|
|
29
|
+
}
|
|
30
|
+
function AssetDetailPage(props) {
|
|
31
|
+
const router = useRouter();
|
|
32
|
+
const urlParams = useParams();
|
|
33
|
+
const assetId = props.params?.id ?? urlParams?.id;
|
|
34
|
+
const [asset, setAsset] = React.useState(null);
|
|
35
|
+
const [loading, setLoading] = React.useState(true);
|
|
36
|
+
const [error, setError] = React.useState(null);
|
|
37
|
+
const [customerName, setCustomerName] = React.useState(null);
|
|
38
|
+
const [subscriptionName, setSubscriptionName] = React.useState(null);
|
|
39
|
+
const [productName, setProductName] = React.useState(null);
|
|
40
|
+
const [offeringName, setOfferingName] = React.useState(null);
|
|
41
|
+
const [specName, setSpecName] = React.useState(null);
|
|
42
|
+
const [sourceQuoteNumber, setSourceQuoteNumber] = React.useState(null);
|
|
43
|
+
const [sourceOrderNumber, setSourceOrderNumber] = React.useState(null);
|
|
44
|
+
const [transitioning, setTransitioning] = React.useState(false);
|
|
45
|
+
const transitionStatus = async (targetStatus) => {
|
|
46
|
+
if (!asset) return;
|
|
47
|
+
try {
|
|
48
|
+
setTransitioning(true);
|
|
49
|
+
setError(null);
|
|
50
|
+
const res = await fetch("/api/cpq/inventory/assets/status", {
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: { "Content-Type": "application/json" },
|
|
53
|
+
body: JSON.stringify({ id: asset.id, targetStatus })
|
|
54
|
+
});
|
|
55
|
+
const data = await res.json();
|
|
56
|
+
if (!res.ok) throw new Error(data?.error ?? "Status transition failed");
|
|
57
|
+
setAsset((prev) => prev ? { ...prev, ...data } : prev);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
setError(err.message);
|
|
60
|
+
} finally {
|
|
61
|
+
setTransitioning(false);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
let cancelled = false;
|
|
66
|
+
async function load() {
|
|
67
|
+
try {
|
|
68
|
+
const res = await fetch(`/api/cpq/inventory/assets?id=${assetId}`);
|
|
69
|
+
if (!res.ok) throw new Error("Asset not found");
|
|
70
|
+
const data = await res.json();
|
|
71
|
+
if (!cancelled) {
|
|
72
|
+
setAsset(data);
|
|
73
|
+
fetch(`/api/customers/companies?id=${data.customerId}&pageSize=1`).then((r) => r.json()).then((result) => {
|
|
74
|
+
const items = result.items ?? result ?? [];
|
|
75
|
+
const c = items[0];
|
|
76
|
+
if (c && !cancelled) setCustomerName(c.display_name || c.displayName || c.name || null);
|
|
77
|
+
}).catch(() => {
|
|
78
|
+
});
|
|
79
|
+
if (data.subscriptionId) {
|
|
80
|
+
fetch(`/api/cpq/inventory/subscriptions?id=${data.subscriptionId}`).then((r) => r.json()).then((sub) => {
|
|
81
|
+
if (sub && !cancelled) setSubscriptionName(sub.name || sub.code || null);
|
|
82
|
+
}).catch(() => {
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (data.offeringId) {
|
|
86
|
+
fetch(`/api/cpq/product-offerings?id=${data.offeringId}`).then((r) => r.ok ? r.json() : null).then((o) => {
|
|
87
|
+
if (!o || cancelled) return;
|
|
88
|
+
if (o.name) setOfferingName(o.name);
|
|
89
|
+
if (o.specification?.name) setSpecName(o.specification.name);
|
|
90
|
+
}).catch(() => {
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (data.specId) {
|
|
94
|
+
fetch(`/api/cpq/product-specifications?id=${data.specId}`).then((r) => r.ok ? r.json() : null).then((s) => {
|
|
95
|
+
if (s?.name && !cancelled) setSpecName(s.name);
|
|
96
|
+
}).catch(() => {
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (data.productId) {
|
|
100
|
+
fetch(`/api/catalog/products?id=${data.productId}`).then((r) => r.ok ? r.json() : null).then((res2) => {
|
|
101
|
+
if (!res2 || cancelled) return;
|
|
102
|
+
const p = (res2.items ?? res2)[0] ?? res2;
|
|
103
|
+
const name = p?.title ?? p?.name ?? p?.handle ?? null;
|
|
104
|
+
if (name) setProductName(name);
|
|
105
|
+
}).catch(() => {
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (data.sourceQuoteId) {
|
|
109
|
+
fetch(`/api/cpq/quotes/${data.sourceQuoteId}`).then((r) => r.ok ? r.json() : null).then((q) => {
|
|
110
|
+
if (q?.quoteNumber && !cancelled) setSourceQuoteNumber(q.quoteNumber);
|
|
111
|
+
}).catch(() => {
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (data.sourceOrderId) {
|
|
115
|
+
fetch(`/api/cpq/orders/${data.sourceOrderId}`).then((r) => r.ok ? r.json() : null).then((o) => {
|
|
116
|
+
if (o?.orderNumber && !cancelled) setSourceOrderNumber(o.orderNumber);
|
|
117
|
+
}).catch(() => {
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} catch (err) {
|
|
122
|
+
if (!cancelled) setError(err.message);
|
|
123
|
+
} finally {
|
|
124
|
+
if (!cancelled) setLoading(false);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
load();
|
|
128
|
+
return () => {
|
|
129
|
+
cancelled = true;
|
|
130
|
+
};
|
|
131
|
+
}, [assetId]);
|
|
132
|
+
if (loading) {
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-12 justify-center text-sm text-muted-foreground", children: [
|
|
134
|
+
/* @__PURE__ */ jsx(Spinner, {}),
|
|
135
|
+
" Loading\u2026"
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
138
|
+
if (!asset) {
|
|
139
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
140
|
+
/* @__PURE__ */ jsx("button", { onClick: () => router.push("/backend/cpq/inventory"), className: "text-sm text-muted-foreground hover:text-foreground", children: "\u2190 Back" }),
|
|
141
|
+
error && /* @__PURE__ */ jsx(ErrorBanner, { message: error }),
|
|
142
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground", children: "Asset not found." })
|
|
143
|
+
] });
|
|
144
|
+
}
|
|
145
|
+
const currency = asset.currencyCode || "USD";
|
|
146
|
+
const statusTransitions = ALLOWED_TRANSITIONS[asset.status] ?? [];
|
|
147
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
FormHeader,
|
|
150
|
+
{
|
|
151
|
+
mode: "detail",
|
|
152
|
+
backHref: "/backend/cpq/inventory",
|
|
153
|
+
backLabel: "Back to Customer Inventory",
|
|
154
|
+
entityTypeLabel: "Asset",
|
|
155
|
+
title: asset.name,
|
|
156
|
+
statusBadge: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 pt-1", children: [
|
|
157
|
+
/* @__PURE__ */ jsx(Tag, { variant: assetStatusMap[asset.status] ?? "neutral", dot: true, children: STATUS_LABELS[asset.status] ?? formatStatusLabel(asset.status) }),
|
|
158
|
+
/* @__PURE__ */ jsx(Tag, { variant: "brand", className: "capitalize", children: asset.assetType.replace(/_/g, " ") }),
|
|
159
|
+
transitioning && /* @__PURE__ */ jsx(Spinner, {})
|
|
160
|
+
] })
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 flex-wrap", children: [
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
165
|
+
StatusPath,
|
|
166
|
+
{
|
|
167
|
+
current: asset.status,
|
|
168
|
+
path: ["pending", "delivered", "active", "returned"],
|
|
169
|
+
terminals: ["cancelled"],
|
|
170
|
+
statusMap: assetStatusMap,
|
|
171
|
+
labels: STATUS_LABELS,
|
|
172
|
+
onTransition: transitionStatus,
|
|
173
|
+
allowedTransitions: statusTransitions,
|
|
174
|
+
disabled: transitioning,
|
|
175
|
+
ariaLabel: "Asset status path"
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
transitioning && /* @__PURE__ */ jsx(Spinner, {})
|
|
179
|
+
] }),
|
|
180
|
+
error && /* @__PURE__ */ jsx(ErrorBanner, { message: error }),
|
|
181
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
|
|
183
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "Asset Details" }),
|
|
184
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: [
|
|
185
|
+
/* @__PURE__ */ jsx(Field, { label: "Code", value: asset.code, mono: true }),
|
|
186
|
+
/* @__PURE__ */ jsx(Field, { label: "Status", value: asset.status }),
|
|
187
|
+
/* @__PURE__ */ jsx(Field, { label: "Asset Type", value: asset.assetType.replace(/_/g, " ") }),
|
|
188
|
+
/* @__PURE__ */ jsx(Field, { label: "Currency", value: currency }),
|
|
189
|
+
/* @__PURE__ */ jsx(Field, { label: "Quantity", value: String(asset.quantity) }),
|
|
190
|
+
asset.purchaseDate && /* @__PURE__ */ jsx(Field, { label: "Purchase Date", value: new Date(asset.purchaseDate).toLocaleDateString() }),
|
|
191
|
+
asset.deliveryDate && /* @__PURE__ */ jsx(Field, { label: "Delivery Date", value: new Date(asset.deliveryDate).toLocaleDateString() })
|
|
192
|
+
] }),
|
|
193
|
+
asset.description && /* @__PURE__ */ jsxs("div", { className: "pt-1", children: [
|
|
194
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Description" }),
|
|
195
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: asset.description })
|
|
196
|
+
] })
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-4 space-y-3", children: [
|
|
199
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: "Pricing & References" }),
|
|
200
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
201
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Purchase Price" }),
|
|
202
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold font-mono", children: fmt(asset.purchasePrice, currency) })
|
|
203
|
+
] }),
|
|
204
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-2 pt-1", children: [
|
|
205
|
+
/* @__PURE__ */ jsx(Field, { label: "Customer", value: customerName ?? `${asset.customerId.slice(0, 12)}\u2026` }),
|
|
206
|
+
/* @__PURE__ */ jsx(Field, { label: "Created", value: new Date(asset.createdAt).toLocaleString() }),
|
|
207
|
+
asset.subscriptionId && /* @__PURE__ */ jsx(
|
|
208
|
+
RefField,
|
|
209
|
+
{
|
|
210
|
+
label: "Linked Subscription",
|
|
211
|
+
name: subscriptionName ?? void 0,
|
|
212
|
+
fallback: asset.subscriptionId,
|
|
213
|
+
onClick: () => router.push(`/backend/cpq/inventory/subscriptions/${asset.subscriptionId}`)
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
asset.offeringId && /* @__PURE__ */ jsx(
|
|
217
|
+
RefField,
|
|
218
|
+
{
|
|
219
|
+
label: "Offering",
|
|
220
|
+
name: offeringName ?? void 0,
|
|
221
|
+
fallback: asset.offeringId,
|
|
222
|
+
onClick: () => router.push(`/backend/cpq/offerings/${asset.offeringId}`)
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
asset.specId && /* @__PURE__ */ jsx(
|
|
226
|
+
RefField,
|
|
227
|
+
{
|
|
228
|
+
label: "Specification",
|
|
229
|
+
name: specName ?? void 0,
|
|
230
|
+
fallback: asset.specId,
|
|
231
|
+
onClick: () => router.push(`/backend/cpq/specifications/${asset.specId}`)
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
asset.productId && /* @__PURE__ */ jsx(
|
|
235
|
+
RefField,
|
|
236
|
+
{
|
|
237
|
+
label: "Product",
|
|
238
|
+
name: productName ?? void 0,
|
|
239
|
+
fallback: asset.productId,
|
|
240
|
+
onClick: () => router.push(`/backend/catalog/products/${asset.productId}`)
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
asset.sourceQuoteId && /* @__PURE__ */ jsx(
|
|
244
|
+
RefField,
|
|
245
|
+
{
|
|
246
|
+
label: "Source Quote",
|
|
247
|
+
name: sourceQuoteNumber ?? void 0,
|
|
248
|
+
fallback: asset.sourceQuoteId,
|
|
249
|
+
onClick: () => router.push(`/backend/cpq/quotes/${asset.sourceQuoteId}`)
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
asset.sourceOrderId && /* @__PURE__ */ jsx(
|
|
253
|
+
RefField,
|
|
254
|
+
{
|
|
255
|
+
label: "Source Order",
|
|
256
|
+
name: sourceOrderNumber ?? void 0,
|
|
257
|
+
fallback: asset.sourceOrderId,
|
|
258
|
+
onClick: () => router.push(`/backend/cpq/orders/${asset.sourceOrderId}`)
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
] })
|
|
262
|
+
] })
|
|
263
|
+
] }),
|
|
264
|
+
asset.configuration && Object.keys(asset.configuration).length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-4", children: [
|
|
265
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium mb-2", children: "Configuration" }),
|
|
266
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1", children: Object.entries(asset.configuration).map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "text-xs", children: [
|
|
267
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
268
|
+
key,
|
|
269
|
+
": "
|
|
270
|
+
] }),
|
|
271
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: String(value) })
|
|
272
|
+
] }, key)) })
|
|
273
|
+
] }),
|
|
274
|
+
asset.charges && asset.charges.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-4", children: [
|
|
275
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium mb-2", children: "Charges" }),
|
|
276
|
+
/* @__PURE__ */ jsxs("table", { className: "w-full text-sm", children: [
|
|
277
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b bg-muted/50 text-muted-foreground", children: [
|
|
278
|
+
/* @__PURE__ */ jsx("th", { className: "text-left px-3 py-2 font-medium", children: "Charge" }),
|
|
279
|
+
/* @__PURE__ */ jsx("th", { className: "text-left px-3 py-2 font-medium", children: "Type" }),
|
|
280
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium", children: "Unit Price" }),
|
|
281
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium", children: "Qty" }),
|
|
282
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium", children: "Total" })
|
|
283
|
+
] }) }),
|
|
284
|
+
/* @__PURE__ */ jsx("tbody", { children: asset.charges.map((c, i) => /* @__PURE__ */ jsxs("tr", { className: "border-b", children: [
|
|
285
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: c.chargeName ?? "\u2014" }),
|
|
286
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 uppercase", children: c.chargeType ?? "\u2014" }),
|
|
287
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-mono", children: c.unitPrice != null ? fmt(c.unitPrice, currency) : "\u2014" }),
|
|
288
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-mono", children: c.quantity ?? "\u2014" }),
|
|
289
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-mono", children: c.totalPrice != null ? fmt(c.totalPrice, currency) : "\u2014" })
|
|
290
|
+
] }, i)) })
|
|
291
|
+
] })
|
|
292
|
+
] }),
|
|
293
|
+
asset.metadata && Object.keys(asset.metadata).length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-4", children: [
|
|
294
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-medium mb-2", children: "Metadata" }),
|
|
295
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1", children: Object.entries(asset.metadata).map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "text-xs", children: [
|
|
296
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
297
|
+
key,
|
|
298
|
+
": "
|
|
299
|
+
] }),
|
|
300
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: String(value) })
|
|
301
|
+
] }, key)) })
|
|
302
|
+
] })
|
|
303
|
+
] });
|
|
304
|
+
}
|
|
305
|
+
function Field({ label, value, mono }) {
|
|
306
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
307
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: label }),
|
|
308
|
+
/* @__PURE__ */ jsx("p", { className: `text-sm ${mono ? "font-mono" : ""}`, children: value })
|
|
309
|
+
] });
|
|
310
|
+
}
|
|
311
|
+
function RefField({
|
|
312
|
+
label,
|
|
313
|
+
name,
|
|
314
|
+
fallback,
|
|
315
|
+
onClick
|
|
316
|
+
}) {
|
|
317
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
318
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: label }),
|
|
319
|
+
/* @__PURE__ */ jsx(
|
|
320
|
+
"button",
|
|
321
|
+
{
|
|
322
|
+
type: "button",
|
|
323
|
+
onClick,
|
|
324
|
+
className: "text-sm text-primary hover:underline text-left truncate max-w-full",
|
|
325
|
+
title: name ?? fallback,
|
|
326
|
+
children: name ?? `${fallback.slice(0, 12)}\u2026`
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
] });
|
|
330
|
+
}
|
|
331
|
+
function Spinner() {
|
|
332
|
+
return /* @__PURE__ */ jsxs("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", children: [
|
|
333
|
+
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
334
|
+
/* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" })
|
|
335
|
+
] });
|
|
336
|
+
}
|
|
337
|
+
function ErrorBanner({ message }) {
|
|
338
|
+
return /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: message });
|
|
339
|
+
}
|
|
340
|
+
export {
|
|
341
|
+
AssetDetailPage as default
|
|
342
|
+
};
|
|
343
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/modules/cpq/backend/cpq/inventory/assets/%5Bid%5D/page.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { useRouter, useParams } from 'next/navigation'\nimport { Alert } from '@open-mercato/ui/primitives/alert'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Tag } from '@open-mercato/ui/primitives/tag'\nimport { FormHeader } from '@open-mercato/ui/backend/forms'\nimport {\n assetStatusMap,\n formatStatusLabel,\n type AssetStatus,\n} from '../../../../../components/statusMaps'\nimport { StatusPath } from '../../../../../components/StatusPath'\n\ntype AssetDetail = {\n id: string\n customerId: string\n subscriptionId: string | null\n subscriptionItemId: string | null\n productId: string | null\n offeringId: string | null\n specId: string | null\n code: string\n name: string\n description: string | null\n status: string\n assetType: string\n currencyCode: string\n purchasePrice: number\n quantity: number\n purchaseDate: string | null\n deliveryDate: string | null\n configuration: Record<string, unknown>\n charges: Array<Record<string, unknown>> | null\n sourceQuoteId: string | null\n sourceOrderId: string | null\n sourceQuoteLineId: string | null\n metadata: Record<string, unknown> | null\n createdAt: string\n updatedAt: string\n}\n\nconst ALLOWED_TRANSITIONS: Record<string, string[]> = {\n pending: ['delivered', 'active', 'cancelled'],\n delivered: ['active', 'returned'],\n active: ['returned'],\n returned: [],\n cancelled: [],\n}\n\nconst STATUS_LABELS: Record<string, string> = {\n pending: 'Pending',\n delivered: 'Delivered',\n active: 'Active',\n returned: 'Returned',\n cancelled: 'Cancelled',\n}\n\nfunction fmt(amount: number | string, currency: string): string {\n return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(Number(amount))\n}\n\nexport default function AssetDetailPage(props: { params?: { id?: string } }) {\n const router = useRouter()\n const urlParams = useParams()\n const assetId = (props.params?.id ?? urlParams?.id) as string\n\n const [asset, setAsset] = React.useState<AssetDetail | null>(null)\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [customerName, setCustomerName] = React.useState<string | null>(null)\n const [subscriptionName, setSubscriptionName] = React.useState<string | null>(null)\n // Resolved names for the other ID references on the page.\n const [productName, setProductName] = React.useState<string | null>(null)\n const [offeringName, setOfferingName] = React.useState<string | null>(null)\n const [specName, setSpecName] = React.useState<string | null>(null)\n const [sourceQuoteNumber, setSourceQuoteNumber] = React.useState<string | null>(null)\n const [sourceOrderNumber, setSourceOrderNumber] = React.useState<string | null>(null)\n const [transitioning, setTransitioning] = React.useState(false)\n\n const transitionStatus = async (targetStatus: string) => {\n if (!asset) return\n try {\n setTransitioning(true)\n setError(null)\n const res = await fetch('/api/cpq/inventory/assets/status', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ id: asset.id, targetStatus }),\n })\n const data = await res.json()\n if (!res.ok) throw new Error(data?.error ?? 'Status transition failed')\n setAsset((prev) => prev ? { ...prev, ...data } : prev)\n } catch (err) {\n setError((err as Error).message)\n } finally {\n setTransitioning(false)\n }\n }\n\n React.useEffect(() => {\n let cancelled = false\n async function load() {\n try {\n const res = await fetch(`/api/cpq/inventory/assets?id=${assetId}`)\n if (!res.ok) throw new Error('Asset not found')\n const data: AssetDetail = await res.json()\n if (!cancelled) {\n setAsset(data)\n\n // Resolve names for every FK reference. Each lookup is fire-and-\n // forget; the UI falls back to a short UUID until the name lands.\n fetch(`/api/customers/companies?id=${data.customerId}&pageSize=1`)\n .then((r) => r.json())\n .then((result) => {\n const items = result.items ?? result ?? []\n const c = items[0]\n if (c && !cancelled) setCustomerName(c.display_name || c.displayName || c.name || null)\n })\n .catch(() => {})\n\n if (data.subscriptionId) {\n fetch(`/api/cpq/inventory/subscriptions?id=${data.subscriptionId}`)\n .then((r) => r.json())\n .then((sub) => {\n if (sub && !cancelled) setSubscriptionName(sub.name || sub.code || null)\n })\n .catch(() => {})\n }\n if (data.offeringId) {\n fetch(`/api/cpq/product-offerings?id=${data.offeringId}`)\n .then((r) => (r.ok ? r.json() : null))\n .then((o) => {\n if (!o || cancelled) return\n if (o.name) setOfferingName(o.name)\n if (o.specification?.name) setSpecName(o.specification.name)\n })\n .catch(() => {})\n }\n if (data.specId) {\n fetch(`/api/cpq/product-specifications?id=${data.specId}`)\n .then((r) => (r.ok ? r.json() : null))\n .then((s) => {\n if (s?.name && !cancelled) setSpecName(s.name)\n })\n .catch(() => {})\n }\n if (data.productId) {\n // Catalog products route is paginated; `?id=\u2026` returns one row.\n fetch(`/api/catalog/products?id=${data.productId}`)\n .then((r) => (r.ok ? r.json() : null))\n .then((res2) => {\n if (!res2 || cancelled) return\n const p = (res2.items ?? res2)[0] ?? res2\n const name = p?.title ?? p?.name ?? p?.handle ?? null\n if (name) setProductName(name)\n })\n .catch(() => {})\n }\n if (data.sourceQuoteId) {\n fetch(`/api/cpq/quotes/${data.sourceQuoteId}`)\n .then((r) => (r.ok ? r.json() : null))\n .then((q) => {\n if (q?.quoteNumber && !cancelled) setSourceQuoteNumber(q.quoteNumber)\n })\n .catch(() => {})\n }\n if (data.sourceOrderId) {\n fetch(`/api/cpq/orders/${data.sourceOrderId}`)\n .then((r) => (r.ok ? r.json() : null))\n .then((o) => {\n if (o?.orderNumber && !cancelled) setSourceOrderNumber(o.orderNumber)\n })\n .catch(() => {})\n }\n }\n } catch (err) {\n if (!cancelled) setError((err as Error).message)\n } finally {\n if (!cancelled) setLoading(false)\n }\n }\n load()\n return () => { cancelled = true }\n }, [assetId])\n\n if (loading) {\n return (\n <div className=\"flex items-center gap-2 py-12 justify-center text-sm text-muted-foreground\">\n <Spinner /> Loading\u2026\n </div>\n )\n }\n\n if (!asset) {\n return (\n <div className=\"space-y-4\">\n <button onClick={() => router.push('/backend/cpq/inventory')} className=\"text-sm text-muted-foreground hover:text-foreground\">\u2190 Back</button>\n {error && <ErrorBanner message={error} />}\n <div className=\"rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground\">Asset not found.</div>\n </div>\n )\n }\n\n const currency = asset.currencyCode || 'USD'\n const statusTransitions = ALLOWED_TRANSITIONS[asset.status] ?? []\n\n return (\n <div className=\"space-y-6\">\n {/* Header \u2014 standard FormHeader detail mode, matches the rest of the\n CPQ admin (quote / order / subscription). The asset code lives\n in the Asset Details card; here we show only the human name +\n status / type tags. */}\n <FormHeader\n mode=\"detail\"\n backHref=\"/backend/cpq/inventory\"\n backLabel=\"Back to Customer Inventory\"\n entityTypeLabel=\"Asset\"\n title={asset.name}\n statusBadge={\n <div className=\"flex flex-wrap items-center gap-2 pt-1\">\n <Tag variant={assetStatusMap[asset.status as AssetStatus] ?? 'neutral'} dot>\n {STATUS_LABELS[asset.status] ?? formatStatusLabel(asset.status)}\n </Tag>\n <Tag variant=\"brand\" className=\"capitalize\">{asset.assetType.replace(/_/g, ' ')}</Tag>\n {transitioning && <Spinner />}\n </div>\n }\n />\n\n {/* Status path \u2014 interactive: clicking a non-current step in the\n breadcrumb invokes /api/cpq/inventory/assets/status. */}\n <div className=\"flex items-center gap-3 flex-wrap\">\n <StatusPath\n current={asset.status}\n path={['pending', 'delivered', 'active', 'returned']}\n terminals={['cancelled']}\n statusMap={assetStatusMap}\n labels={STATUS_LABELS}\n onTransition={transitionStatus}\n allowedTransitions={statusTransitions}\n disabled={transitioning}\n ariaLabel=\"Asset status path\"\n />\n {transitioning && <Spinner />}\n </div>\n\n {error && <ErrorBanner message={error} />}\n\n {/* Detail Cards */}\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n <div className=\"rounded-lg border bg-card p-4 space-y-3\">\n <h3 className=\"text-sm font-medium\">Asset Details</h3>\n <div className=\"grid grid-cols-2 gap-x-4 gap-y-2\">\n <Field label=\"Code\" value={asset.code} mono />\n <Field label=\"Status\" value={asset.status} />\n <Field label=\"Asset Type\" value={asset.assetType.replace(/_/g, ' ')} />\n <Field label=\"Currency\" value={currency} />\n <Field label=\"Quantity\" value={String(asset.quantity)} />\n {asset.purchaseDate && <Field label=\"Purchase Date\" value={new Date(asset.purchaseDate).toLocaleDateString()} />}\n {asset.deliveryDate && <Field label=\"Delivery Date\" value={new Date(asset.deliveryDate).toLocaleDateString()} />}\n </div>\n {asset.description && (\n <div className=\"pt-1\">\n <p className=\"text-xs text-muted-foreground\">Description</p>\n <p className=\"text-sm\">{asset.description}</p>\n </div>\n )}\n </div>\n\n <div className=\"rounded-lg border bg-card p-4 space-y-3\">\n <h3 className=\"text-sm font-medium\">Pricing & References</h3>\n <div>\n <p className=\"text-xs text-muted-foreground\">Purchase Price</p>\n <p className=\"text-lg font-semibold font-mono\">{fmt(asset.purchasePrice, currency)}</p>\n </div>\n <div className=\"grid grid-cols-2 gap-x-4 gap-y-2 pt-1\">\n <Field label=\"Customer\" value={customerName ?? `${asset.customerId.slice(0, 12)}\u2026`} />\n <Field label=\"Created\" value={new Date(asset.createdAt).toLocaleString()} />\n {asset.subscriptionId && (\n <RefField\n label=\"Linked Subscription\"\n name={subscriptionName ?? undefined}\n fallback={asset.subscriptionId}\n onClick={() => router.push(`/backend/cpq/inventory/subscriptions/${asset.subscriptionId}`)}\n />\n )}\n {asset.offeringId && (\n <RefField\n label=\"Offering\"\n name={offeringName ?? undefined}\n fallback={asset.offeringId}\n onClick={() => router.push(`/backend/cpq/offerings/${asset.offeringId}`)}\n />\n )}\n {asset.specId && (\n <RefField\n label=\"Specification\"\n name={specName ?? undefined}\n fallback={asset.specId}\n onClick={() => router.push(`/backend/cpq/specifications/${asset.specId}`)}\n />\n )}\n {asset.productId && (\n <RefField\n label=\"Product\"\n name={productName ?? undefined}\n fallback={asset.productId}\n onClick={() => router.push(`/backend/catalog/products/${asset.productId}`)}\n />\n )}\n {asset.sourceQuoteId && (\n <RefField\n label=\"Source Quote\"\n name={sourceQuoteNumber ?? undefined}\n fallback={asset.sourceQuoteId}\n onClick={() => router.push(`/backend/cpq/quotes/${asset.sourceQuoteId}`)}\n />\n )}\n {asset.sourceOrderId && (\n <RefField\n label=\"Source Order\"\n name={sourceOrderNumber ?? undefined}\n fallback={asset.sourceOrderId}\n onClick={() => router.push(`/backend/cpq/orders/${asset.sourceOrderId}`)}\n />\n )}\n </div>\n </div>\n </div>\n\n {/* Configuration */}\n {asset.configuration && Object.keys(asset.configuration).length > 0 && (\n <div className=\"rounded-lg border bg-card p-4\">\n <h3 className=\"text-sm font-medium mb-2\">Configuration</h3>\n <div className=\"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1\">\n {Object.entries(asset.configuration).map(([key, value]) => (\n <div key={key} className=\"text-xs\">\n <span className=\"text-muted-foreground\">{key}: </span>\n <span className=\"font-medium\">{String(value)}</span>\n </div>\n ))}\n </div>\n </div>\n )}\n\n {/* Charges */}\n {asset.charges && asset.charges.length > 0 && (\n <div className=\"rounded-lg border bg-card p-4\">\n <h3 className=\"text-sm font-medium mb-2\">Charges</h3>\n <table className=\"w-full text-sm\">\n <thead>\n <tr className=\"border-b bg-muted/50 text-muted-foreground\">\n <th className=\"text-left px-3 py-2 font-medium\">Charge</th>\n <th className=\"text-left px-3 py-2 font-medium\">Type</th>\n <th className=\"text-right px-3 py-2 font-medium\">Unit Price</th>\n <th className=\"text-right px-3 py-2 font-medium\">Qty</th>\n <th className=\"text-right px-3 py-2 font-medium\">Total</th>\n </tr>\n </thead>\n <tbody>\n {asset.charges.map((c, i) => (\n <tr key={i} className=\"border-b\">\n <td className=\"px-3 py-2\">{(c as any).chargeName ?? '\u2014'}</td>\n <td className=\"px-3 py-2 uppercase\">{(c as any).chargeType ?? '\u2014'}</td>\n <td className=\"px-3 py-2 text-right font-mono\">{(c as any).unitPrice != null ? fmt((c as any).unitPrice, currency) : '\u2014'}</td>\n <td className=\"px-3 py-2 text-right font-mono\">{(c as any).quantity ?? '\u2014'}</td>\n <td className=\"px-3 py-2 text-right font-mono\">{(c as any).totalPrice != null ? fmt((c as any).totalPrice, currency) : '\u2014'}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n\n {/* Metadata */}\n {asset.metadata && Object.keys(asset.metadata).length > 0 && (\n <div className=\"rounded-lg border bg-card p-4\">\n <h3 className=\"text-sm font-medium mb-2\">Metadata</h3>\n <div className=\"grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1\">\n {Object.entries(asset.metadata).map(([key, value]) => (\n <div key={key} className=\"text-xs\">\n <span className=\"text-muted-foreground\">{key}: </span>\n <span className=\"font-medium\">{String(value)}</span>\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n}\n\nfunction Field({ label, value, mono }: { label: string; value: string; mono?: boolean }) {\n return (\n <div>\n <p className=\"text-xs text-muted-foreground\">{label}</p>\n <p className={`text-sm ${mono ? 'font-mono' : ''}`}>{value}</p>\n </div>\n )\n}\n\nfunction RefField({\n label,\n name,\n fallback,\n onClick,\n}: {\n label: string\n name: string | undefined\n fallback: string\n onClick: () => void\n}) {\n return (\n <div>\n <p className=\"text-xs text-muted-foreground\">{label}</p>\n <button\n type=\"button\"\n onClick={onClick}\n className=\"text-sm text-primary hover:underline text-left truncate max-w-full\"\n title={name ?? fallback}\n >\n {name ?? `${fallback.slice(0, 12)}\u2026`}\n </button>\n </div>\n )\n}\n\nfunction Spinner() {\n return (\n <svg className=\"h-4 w-4 animate-spin\" viewBox=\"0 0 24 24\" fill=\"none\">\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z\" />\n </svg>\n )\n}\n\nfunction ErrorBanner({ message }: { message: string }) {\n return <Alert variant=\"destructive\">{message}</Alert>\n}\n"],
|
|
5
|
+
"mappings": ";AA4LM,SACE,KADF;AA3LN,YAAY,WAAW;AACvB,SAAS,WAAW,iBAAiB;AACrC,SAAS,aAAa;AAEtB,SAAS,WAAW;AACpB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AA8B3B,MAAM,sBAAgD;AAAA,EACpD,SAAS,CAAC,aAAa,UAAU,WAAW;AAAA,EAC5C,WAAW,CAAC,UAAU,UAAU;AAAA,EAChC,QAAQ,CAAC,UAAU;AAAA,EACnB,UAAU,CAAC;AAAA,EACX,WAAW,CAAC;AACd;AAEA,MAAM,gBAAwC;AAAA,EAC5C,SAAS;AAAA,EACT,WAAW;AAA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AE,WAAW,WAAW,OAAO,cAAc,EAAE,IAAK,iBAAM;AAAA,KAC7D;AAEJ;AAEA,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,SACE,qBAAC,SACC;AAAA,wBAAC,OAAE,WAAU,iCAAiC,iBAAM;AAAA,IACpD;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA,WAAU;AAAA,QACV,OAAO,QAAQ;AAAA,QAEd,kBAAQ,GAAG,SAAS,MAAM,GAAG,EAAE,CAAC;AAAA;AAAA,IACnC;AAAA,KACF;AAEJ;AAEA,SAAS,UAAU;AACjB,SACE,qBAAC,SAAI,WAAU,wBAAuB,SAAQ,aAAY,MAAK,QAC7D;AAAA,wBAAC,YAAO,WAAU,cAAa,IAAG,MAAK,IAAG,MAAK,GAAE,MAAK,QAAO,gBAAe,aAAY,KAAI;AAAA,IAC5F,oBAAC,UAAK,WAAU,cAAa,MAAK,gBAAe,GAAE,uCAAsC;AAAA,KAC3F;AAEJ;AAEA,SAAS,YAAY,EAAE,QAAQ,GAAwB;AACrD,SAAO,oBAAC,SAAM,SAAQ,eAAe,mBAAQ;AAC/C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
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: "Asset Detail" }
|
|
8
|
+
]
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
metadata
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=page.meta.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/modules/cpq/backend/cpq/inventory/assets/%5Bid%5D/page.meta.ts"],
|
|
4
|
+
"sourcesContent": ["export const metadata = {\n requireAuth: true,\n requireFeatures: ['cpq.inventory.view'],\n navHidden: true,\n breadcrumb: [\n { label: 'Customer Inventory', labelKey: 'cpq.inventory.title', href: '/backend/cpq/inventory' },\n { label: 'Asset Detail' },\n ],\n} as const\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,oBAAoB;AAAA,EACtC,WAAW;AAAA,EACX,YAAY;AAAA,IACV,EAAE,OAAO,sBAAsB,UAAU,uBAAuB,MAAM,yBAAyB;AAAA,IAC/F,EAAE,OAAO,eAAe;AAAA,EAC1B;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
5
|
+
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
6
|
+
import { CpqInteractionStyles } from "../../../components/CpqListView.js";
|
|
7
|
+
import { SubscriptionsTable } from "./SubscriptionsTable.js";
|
|
8
|
+
import { AssetsTable } from "./AssetsTable.js";
|
|
9
|
+
function InventoryPage() {
|
|
10
|
+
const t = useT();
|
|
11
|
+
const [activeTab, setActiveTab] = React.useState("subscriptions");
|
|
12
|
+
const tabs = [
|
|
13
|
+
{ key: "subscriptions", label: t("cpq.inventory.subscriptions", "Subscriptions") },
|
|
14
|
+
{ key: "assets", label: t("cpq.inventory.assets", "Assets") }
|
|
15
|
+
];
|
|
16
|
+
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsxs(PageBody, { className: "cpq-list-view space-y-6", children: [
|
|
17
|
+
/* @__PURE__ */ jsx(CpqInteractionStyles, {}),
|
|
18
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold", children: t("cpq.inventory.title", "Customer Inventory") }) }),
|
|
19
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-1 border-b", children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
20
|
+
"button",
|
|
21
|
+
{
|
|
22
|
+
type: "button",
|
|
23
|
+
onClick: () => setActiveTab(tab.key),
|
|
24
|
+
className: `cursor-pointer px-3 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${activeTab === tab.key ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"}`,
|
|
25
|
+
children: tab.label
|
|
26
|
+
},
|
|
27
|
+
tab.key
|
|
28
|
+
)) }),
|
|
29
|
+
activeTab === "subscriptions" ? /* @__PURE__ */ jsx(SubscriptionsTable, {}) : /* @__PURE__ */ jsx(AssetsTable, {})
|
|
30
|
+
] }) });
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
InventoryPage as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/cpq/backend/cpq/inventory/page.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CpqInteractionStyles } from '../../../components/CpqListView'\nimport { SubscriptionsTable } from './SubscriptionsTable'\nimport { AssetsTable } from './AssetsTable'\n\ntype TabKey = 'subscriptions' | 'assets'\n\nexport default function InventoryPage() {\n const t = useT()\n const [activeTab, setActiveTab] = React.useState<TabKey>('subscriptions')\n\n const tabs: { key: TabKey; label: string }[] = [\n { key: 'subscriptions', label: t('cpq.inventory.subscriptions', 'Subscriptions') },\n { key: 'assets', label: t('cpq.inventory.assets', 'Assets') },\n ]\n\n return (\n <Page>\n <PageBody className=\"cpq-list-view space-y-6\">\n <CpqInteractionStyles />\n <div className=\"flex items-center justify-between\">\n <h1 className=\"text-2xl font-bold\">{t('cpq.inventory.title', 'Customer Inventory')}</h1>\n </div>\n\n <div className=\"flex gap-1 border-b\">\n {tabs.map((tab) => (\n <button\n key={tab.key}\n type=\"button\"\n onClick={() => setActiveTab(tab.key)}\n className={`cursor-pointer px-3 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${\n activeTab === tab.key\n ? 'border-primary text-primary'\n : 'border-transparent text-muted-foreground hover:text-foreground'\n }`}\n >\n {tab.label}\n </button>\n ))}\n </div>\n\n {activeTab === 'subscriptions' ? <SubscriptionsTable /> : <AssetsTable />}\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAqBM,SACE,KADF;AApBN,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAIb,SAAR,gBAAiC;AACtC,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAiB,eAAe;AAExE,QAAM,OAAyC;AAAA,IAC7C,EAAE,KAAK,iBAAiB,OAAO,EAAE,+BAA+B,eAAe,EAAE;AAAA,IACjF,EAAE,KAAK,UAAU,OAAO,EAAE,wBAAwB,QAAQ,EAAE;AAAA,EAC9D;AAEA,SACE,oBAAC,QACC,+BAAC,YAAS,WAAU,2BAClB;AAAA,wBAAC,wBAAqB;AAAA,IACtB,oBAAC,SAAI,WAAU,qCACb,8BAAC,QAAG,WAAU,sBAAsB,YAAE,uBAAuB,oBAAoB,GAAE,GACrF;AAAA,IAEA,oBAAC,SAAI,WAAU,uBACZ,eAAK,IAAI,CAAC,QACT;AAAA,MAAC;AAAA;AAAA,QAEC,MAAK;AAAA,QACL,SAAS,MAAM,aAAa,IAAI,GAAG;AAAA,QACnC,WAAW,oFACT,cAAc,IAAI,MACd,gCACA,gEACN;AAAA,QAEC,cAAI;AAAA;AAAA,MATA,IAAI;AAAA,IAUX,CACD,GACH;AAAA,IAEC,cAAc,kBAAkB,oBAAC,sBAAmB,IAAK,oBAAC,eAAY;AAAA,KACzE,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Package } from "lucide-react";
|
|
3
|
+
const inventoryIcon = React.createElement(Package, { size: 16 });
|
|
4
|
+
const metadata = {
|
|
5
|
+
requireAuth: true,
|
|
6
|
+
requireFeatures: ["cpq.inventory.view"],
|
|
7
|
+
pageTitle: "CPQ Subscriptions",
|
|
8
|
+
pageTitleKey: "cpq.inventory.title",
|
|
9
|
+
pageGroup: "CPQ",
|
|
10
|
+
pageGroupKey: "customers~sales~cpq.nav.group",
|
|
11
|
+
pageOrder: 92,
|
|
12
|
+
icon: inventoryIcon,
|
|
13
|
+
breadcrumb: [{ label: "CPQ Subscriptions", labelKey: "cpq.inventory.title" }]
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
metadata
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=page.meta.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/cpq/backend/cpq/inventory/page.meta.ts"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\nimport { Package } from 'lucide-react'\n\nconst inventoryIcon = React.createElement(Package, { size: 16 })\n\nexport const metadata = {\n requireAuth: true,\n requireFeatures: ['cpq.inventory.view'],\n pageTitle: 'CPQ Subscriptions',\n pageTitleKey: 'cpq.inventory.title',\n pageGroup: 'CPQ',\n pageGroupKey: 'customers~sales~cpq.nav.group',\n pageOrder: 92,\n icon: inventoryIcon,\n breadcrumb: [{ label: 'CPQ Subscriptions', labelKey: 'cpq.inventory.title' }],\n} as const\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,eAAe;AAExB,MAAM,gBAAgB,MAAM,cAAc,SAAS,EAAE,MAAM,GAAG,CAAC;AAExD,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,oBAAoB;AAAA,EACtC,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,MAAM;AAAA,EACN,YAAY,CAAC,EAAE,OAAO,qBAAqB,UAAU,sBAAsB,CAAC;AAC9E;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Tag } from "@open-mercato/ui/primitives/tag";
|
|
4
|
+
import {
|
|
5
|
+
assetStatusMap,
|
|
6
|
+
formatStatusLabel,
|
|
7
|
+
subscriptionStatusMap
|
|
8
|
+
} from "../../../components/statusMaps.js";
|
|
9
|
+
function StatusBadge({ status }) {
|
|
10
|
+
const variant = subscriptionStatusMap[status] ?? assetStatusMap[status] ?? "neutral";
|
|
11
|
+
return /* @__PURE__ */ jsx(Tag, { variant, dot: true, children: formatStatusLabel(status) });
|
|
12
|
+
}
|
|
13
|
+
function formatCurrency(amount, currency) {
|
|
14
|
+
return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(amount);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
StatusBadge,
|
|
18
|
+
formatCurrency
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/cpq/backend/cpq/inventory/shared.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { Tag } from '@open-mercato/ui/primitives/tag'\nimport {\n assetStatusMap,\n formatStatusLabel,\n subscriptionStatusMap,\n type AssetStatus,\n type SubscriptionStatus,\n} from '../../../components/statusMaps'\n\n/**\n * Subscription / asset status pill. Looks up the OM Tag variant from the\n * shared maps so palettes stay consistent with the rest of the CPQ surface.\n * Falls back to `neutral` for unknown values so a renamed enum value still\n * renders without crashing.\n */\nexport function StatusBadge({ status }: { status: string }) {\n const variant =\n subscriptionStatusMap[status as SubscriptionStatus] ??\n assetStatusMap[status as AssetStatus] ??\n 'neutral'\n return (\n <Tag variant={variant} dot>\n {formatStatusLabel(status)}\n </Tag>\n )\n}\n\nexport function formatCurrency(amount: number, currency: string): string {\n return new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(amount)\n}\n"],
|
|
5
|
+
"mappings": ";AAuBI;AArBJ,SAAS,WAAW;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAQA,SAAS,YAAY,EAAE,OAAO,GAAuB;AAC1D,QAAM,UACJ,sBAAsB,MAA4B,KAClD,eAAe,MAAqB,KACpC;AACF,SACE,oBAAC,OAAI,SAAkB,KAAG,MACvB,4BAAkB,MAAM,GAC3B;AAEJ;AAEO,SAAS,eAAe,QAAgB,UAA0B;AACvE,SAAO,IAAI,KAAK,aAAa,SAAS,EAAE,OAAO,YAAY,SAAS,CAAC,EAAE,OAAO,MAAM;AACtF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|