@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,204 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
import { Alert } from "@open-mercato/ui/primitives/alert";
|
|
6
|
+
import { RowActions } from "@open-mercato/ui/backend/RowActions";
|
|
7
|
+
import { Tag } from "@open-mercato/ui/primitives/tag";
|
|
8
|
+
async function apiJson(url) {
|
|
9
|
+
const res = await fetch(url);
|
|
10
|
+
if (!res.ok) throw new Error(`API error ${res.status}`);
|
|
11
|
+
return res.json();
|
|
12
|
+
}
|
|
13
|
+
function Badge({ children, variant = "default" }) {
|
|
14
|
+
const tagVariant = variant === "success" ? "success" : variant === "muted" ? "neutral" : "info";
|
|
15
|
+
return /* @__PURE__ */ jsx(Tag, { variant: tagVariant, children });
|
|
16
|
+
}
|
|
17
|
+
function Section({ title, children }) {
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
19
|
+
/* @__PURE__ */ jsx("h2", { className: "text-base font-semibold", children: title }),
|
|
20
|
+
children
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
function KV({ label, children }) {
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
25
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: label }),
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children })
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
function JsonBlock({ data }) {
|
|
30
|
+
if (data == null) return /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "none" });
|
|
31
|
+
return /* @__PURE__ */ jsx("pre", { className: "rounded-md bg-muted/50 p-3 text-xs overflow-x-auto max-h-48", children: JSON.stringify(data, null, 2) });
|
|
32
|
+
}
|
|
33
|
+
function TransitionRow({ t, index }) {
|
|
34
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 text-xs", children: [
|
|
35
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-muted-foreground w-4 shrink-0", children: [
|
|
36
|
+
index + 1,
|
|
37
|
+
"."
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
41
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
42
|
+
"-> ",
|
|
43
|
+
t.targetStepId
|
|
44
|
+
] }),
|
|
45
|
+
t.isDefault && /* @__PURE__ */ jsx(Badge, { variant: "muted", children: "default" }),
|
|
46
|
+
t.label && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
47
|
+
"(",
|
|
48
|
+
t.label,
|
|
49
|
+
")"
|
|
50
|
+
] })
|
|
51
|
+
] }),
|
|
52
|
+
t.condition && /* @__PURE__ */ jsxs("div", { className: "font-mono text-muted-foreground", children: [
|
|
53
|
+
"when ",
|
|
54
|
+
t.condition.field,
|
|
55
|
+
" ",
|
|
56
|
+
t.condition.operator,
|
|
57
|
+
t.condition.value !== void 0 ? ` ${JSON.stringify(t.condition.value)}` : ""
|
|
58
|
+
] })
|
|
59
|
+
] })
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
function StepCard({ step, index }) {
|
|
63
|
+
const [open, setOpen] = React.useState(false);
|
|
64
|
+
const configKeys = Object.keys(step.config);
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border", children: [
|
|
66
|
+
/* @__PURE__ */ jsxs(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
onClick: () => setOpen((v) => !v),
|
|
71
|
+
className: "w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-muted/30 transition-colors",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx("span", { className: "flex items-center justify-center rounded-full bg-primary/10 text-primary text-xs font-bold w-7 h-7 shrink-0", children: index + 1 }),
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
76
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: step.title }),
|
|
77
|
+
/* @__PURE__ */ jsx(Badge, { children: step.type }),
|
|
78
|
+
step.isOptional && /* @__PURE__ */ jsx(Badge, { variant: "muted", children: "optional" })
|
|
79
|
+
] }),
|
|
80
|
+
step.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate mt-0.5", children: step.description })
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground shrink-0", children: open ? "\u25B2" : "\u25BC" })
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
open && /* @__PURE__ */ jsxs("div", { className: "border-t px-4 py-3 space-y-4", children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
88
|
+
/* @__PURE__ */ jsx(KV, { label: "Step ID", children: /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: step.stepId }) }),
|
|
89
|
+
/* @__PURE__ */ jsx(KV, { label: "Type", children: /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: step.type }) })
|
|
90
|
+
] }),
|
|
91
|
+
configKeys.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Config" }),
|
|
93
|
+
/* @__PURE__ */ jsx(JsonBlock, { data: step.config })
|
|
94
|
+
] }),
|
|
95
|
+
step.transitions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
96
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-muted-foreground", children: [
|
|
97
|
+
"Transitions (",
|
|
98
|
+
step.transitions.length,
|
|
99
|
+
")"
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: step.transitions.map((t, i) => /* @__PURE__ */ jsx(TransitionRow, { t, index: i }, `${t.targetStepId}-${i}`)) })
|
|
102
|
+
] }),
|
|
103
|
+
step.transitions.length === 0 && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: "No transitions (terminal step)" }),
|
|
104
|
+
step.validationRules && step.validationRules.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
105
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Validation Rules" }),
|
|
106
|
+
/* @__PURE__ */ jsx(JsonBlock, { data: step.validationRules })
|
|
107
|
+
] })
|
|
108
|
+
] })
|
|
109
|
+
] });
|
|
110
|
+
}
|
|
111
|
+
function ApplicabilityPanel({ applicability }) {
|
|
112
|
+
if (!applicability) {
|
|
113
|
+
return /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "No applicability constraints" });
|
|
114
|
+
}
|
|
115
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
116
|
+
applicability.priority != null && /* @__PURE__ */ jsx(KV, { label: "Priority", children: applicability.priority }),
|
|
117
|
+
applicability.specCodes?.length ? /* @__PURE__ */ jsx(KV, { label: "Spec Codes", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: applicability.specCodes.map((c) => /* @__PURE__ */ jsx("span", { className: "font-mono text-xs rounded bg-muted px-1.5 py-0.5", children: c }, c)) }) }) : null,
|
|
118
|
+
applicability.offeringCodes?.length ? /* @__PURE__ */ jsx(KV, { label: "Offering Codes", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: applicability.offeringCodes.map((c) => /* @__PURE__ */ jsx("span", { className: "font-mono text-xs rounded bg-muted px-1.5 py-0.5", children: c }, c)) }) }) : null,
|
|
119
|
+
applicability.customerSegments?.length ? /* @__PURE__ */ jsx(KV, { label: "Customer Segments", children: /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: applicability.customerSegments.map((c) => /* @__PURE__ */ jsx("span", { className: "font-mono text-xs rounded bg-muted px-1.5 py-0.5", children: c }, c)) }) }) : null
|
|
120
|
+
] });
|
|
121
|
+
}
|
|
122
|
+
function CpqWizardDetailPage({ params }) {
|
|
123
|
+
const router = useRouter();
|
|
124
|
+
const definitionCode = params.definitionCode;
|
|
125
|
+
const [definition, setDefinition] = React.useState(null);
|
|
126
|
+
const [loading, setLoading] = React.useState(true);
|
|
127
|
+
const [error, setError] = React.useState(null);
|
|
128
|
+
React.useEffect(() => {
|
|
129
|
+
async function load() {
|
|
130
|
+
if (!definitionCode) return;
|
|
131
|
+
setLoading(true);
|
|
132
|
+
setError(null);
|
|
133
|
+
try {
|
|
134
|
+
const def = await apiJson(
|
|
135
|
+
`/api/cpq/wizards?code=${encodeURIComponent(definitionCode)}`
|
|
136
|
+
);
|
|
137
|
+
setDefinition(def);
|
|
138
|
+
} catch (err) {
|
|
139
|
+
setError(err instanceof Error ? err.message : "Failed to load wizard");
|
|
140
|
+
} finally {
|
|
141
|
+
setLoading(false);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
load();
|
|
145
|
+
}, [definitionCode]);
|
|
146
|
+
if (loading) {
|
|
147
|
+
return /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Loading..." });
|
|
148
|
+
}
|
|
149
|
+
if (error) {
|
|
150
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
151
|
+
/* @__PURE__ */ jsx(Alert, { variant: "destructive", children: error }),
|
|
152
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => router.push("/backend/cpq/wizards"), className: "text-sm text-muted-foreground hover:text-foreground", children: "\u2190 Back to Wizards" })
|
|
153
|
+
] });
|
|
154
|
+
}
|
|
155
|
+
if (!definition) {
|
|
156
|
+
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground", children: "Wizard not found." });
|
|
157
|
+
}
|
|
158
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-6 max-w-[900px] mx-auto", children: [
|
|
159
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
onClick: () => router.push("/backend/cpq/wizards"),
|
|
164
|
+
className: "text-sm text-muted-foreground hover:text-foreground",
|
|
165
|
+
children: "\u2190 All Wizards"
|
|
166
|
+
}
|
|
167
|
+
) }),
|
|
168
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
|
|
169
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
170
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold", children: definition.name }),
|
|
171
|
+
definition.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: definition.description })
|
|
172
|
+
] }),
|
|
173
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
174
|
+
RowActions,
|
|
175
|
+
{
|
|
176
|
+
items: [
|
|
177
|
+
{
|
|
178
|
+
id: "preview",
|
|
179
|
+
label: "Preview",
|
|
180
|
+
onSelect: () => router.push(`/backend/cpq/wizards/${definitionCode}`)
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
) })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ jsx(Section, { title: "General", children: /* @__PURE__ */ jsx("div", { className: "rounded-lg border p-4", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: [
|
|
187
|
+
/* @__PURE__ */ jsx(KV, { label: "Code", children: /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: definition.code }) }),
|
|
188
|
+
/* @__PURE__ */ jsxs(KV, { label: "Version", children: [
|
|
189
|
+
"v",
|
|
190
|
+
definition.version
|
|
191
|
+
] }),
|
|
192
|
+
/* @__PURE__ */ jsx(KV, { label: "Surface", children: definition.surface }),
|
|
193
|
+
/* @__PURE__ */ jsx(KV, { label: "Active", children: /* @__PURE__ */ jsx(Badge, { variant: definition.isActive ? "success" : "muted", children: definition.isActive ? "Yes" : "No" }) })
|
|
194
|
+
] }) }) }),
|
|
195
|
+
/* @__PURE__ */ jsx(Section, { title: "Applicability", children: /* @__PURE__ */ jsx("div", { className: "rounded-lg border p-4", children: /* @__PURE__ */ jsx(ApplicabilityPanel, { applicability: definition.applicability }) }) }),
|
|
196
|
+
definition.paramsSchema && Object.keys(definition.paramsSchema).length > 0 && /* @__PURE__ */ jsx(Section, { title: "Parameters Schema", children: /* @__PURE__ */ jsx(JsonBlock, { data: definition.paramsSchema }) }),
|
|
197
|
+
/* @__PURE__ */ jsx(Section, { title: `Steps (${definition.steps.length})`, children: /* @__PURE__ */ jsx("div", { className: "space-y-2", children: definition.steps.map((step, i) => /* @__PURE__ */ jsx(StepCard, { step, index: i }, step.stepId)) }) }),
|
|
198
|
+
definition.metadata && Object.keys(definition.metadata).length > 0 && /* @__PURE__ */ jsx(Section, { title: "Metadata", children: /* @__PURE__ */ jsx(JsonBlock, { data: definition.metadata }) })
|
|
199
|
+
] });
|
|
200
|
+
}
|
|
201
|
+
export {
|
|
202
|
+
CpqWizardDetailPage as default
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../../src/modules/cpq/backend/cpq/wizards/%5BdefinitionCode%5D/detail/page.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { useRouter } from 'next/navigation'\nimport { Alert } from '@open-mercato/ui/primitives/alert'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Tag } from '@open-mercato/ui/primitives/tag'\nimport type {\n WizardDefinitionResult,\n WizardStepDefinition,\n WizardTransition,\n WizardApplicability,\n} from '../../../../../workflows/types'\n\nasync function apiJson<T>(url: string): Promise<T> {\n const res = await fetch(url)\n if (!res.ok) throw new Error(`API error ${res.status}`)\n return res.json() as Promise<T>\n}\n\n// \u2500\u2500\u2500 Sub-components \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction Badge({ children, variant = 'default' }: { children: React.ReactNode; variant?: 'default' | 'success' | 'muted' }) {\n const tagVariant = variant === 'success' ? 'success' : variant === 'muted' ? 'neutral' : 'info'\n return <Tag variant={tagVariant}>{children}</Tag>\n}\n\nfunction Section({ title, children }: { title: string; children: React.ReactNode }) {\n return (\n <div className=\"space-y-3\">\n <h2 className=\"text-base font-semibold\">{title}</h2>\n {children}\n </div>\n )\n}\n\nfunction KV({ label, children }: { label: string; children: React.ReactNode }) {\n return (\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-xs font-medium text-muted-foreground\">{label}</span>\n <span className=\"text-sm\">{children}</span>\n </div>\n )\n}\n\nfunction JsonBlock({ data }: { data: unknown }) {\n if (data == null) return <span className=\"text-xs text-muted-foreground\">none</span>\n return (\n <pre className=\"rounded-md bg-muted/50 p-3 text-xs overflow-x-auto max-h-48\">\n {JSON.stringify(data, null, 2)}\n </pre>\n )\n}\n\nfunction TransitionRow({ t, index }: { t: WizardTransition; index: number }) {\n return (\n <div className=\"flex items-start gap-3 text-xs\">\n <span className=\"font-mono text-muted-foreground w-4 shrink-0\">{index + 1}.</span>\n <div className=\"space-y-0.5\">\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium\">-> {t.targetStepId}</span>\n {t.isDefault && <Badge variant=\"muted\">default</Badge>}\n {t.label && <span className=\"text-muted-foreground\">({t.label})</span>}\n </div>\n {t.condition && (\n <div className=\"font-mono text-muted-foreground\">\n when {t.condition.field} {t.condition.operator}\n {t.condition.value !== undefined ? ` ${JSON.stringify(t.condition.value)}` : ''}\n </div>\n )}\n </div>\n </div>\n )\n}\n\nfunction StepCard({ step, index }: { step: WizardStepDefinition; index: number }) {\n const [open, setOpen] = React.useState(false)\n const configKeys = Object.keys(step.config)\n\n return (\n <div className=\"rounded-lg border\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n className=\"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-muted/30 transition-colors\"\n >\n <span className=\"flex items-center justify-center rounded-full bg-primary/10 text-primary text-xs font-bold w-7 h-7 shrink-0\">\n {index + 1}\n </span>\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium truncate\">{step.title}</span>\n <Badge>{step.type}</Badge>\n {step.isOptional && <Badge variant=\"muted\">optional</Badge>}\n </div>\n {step.description && (\n <p className=\"text-xs text-muted-foreground truncate mt-0.5\">{step.description}</p>\n )}\n </div>\n <span className=\"text-xs text-muted-foreground shrink-0\">{open ? '\\u25B2' : '\\u25BC'}</span>\n </button>\n\n {open && (\n <div className=\"border-t px-4 py-3 space-y-4\">\n <div className=\"grid grid-cols-2 gap-4\">\n <KV label=\"Step ID\"><span className=\"font-mono text-xs\">{step.stepId}</span></KV>\n <KV label=\"Type\"><span className=\"font-mono text-xs\">{step.type}</span></KV>\n </div>\n\n {configKeys.length > 0 && (\n <div className=\"space-y-1\">\n <span className=\"text-xs font-medium text-muted-foreground\">Config</span>\n <JsonBlock data={step.config} />\n </div>\n )}\n\n {step.transitions.length > 0 && (\n <div className=\"space-y-2\">\n <span className=\"text-xs font-medium text-muted-foreground\">\n Transitions ({step.transitions.length})\n </span>\n <div className=\"space-y-1.5\">\n {step.transitions.map((t, i) => (\n <TransitionRow key={`${t.targetStepId}-${i}`} t={t} index={i} />\n ))}\n </div>\n </div>\n )}\n\n {step.transitions.length === 0 && (\n <div className=\"text-xs text-muted-foreground\">No transitions (terminal step)</div>\n )}\n\n {step.validationRules && step.validationRules.length > 0 && (\n <div className=\"space-y-1\">\n <span className=\"text-xs font-medium text-muted-foreground\">Validation Rules</span>\n <JsonBlock data={step.validationRules} />\n </div>\n )}\n </div>\n )}\n </div>\n )\n}\n\nfunction ApplicabilityPanel({ applicability }: { applicability: WizardApplicability | null }) {\n if (!applicability) {\n return <span className=\"text-sm text-muted-foreground\">No applicability constraints</span>\n }\n return (\n <div className=\"grid grid-cols-2 gap-4\">\n {applicability.priority != null && (\n <KV label=\"Priority\">{applicability.priority}</KV>\n )}\n {applicability.specCodes?.length ? (\n <KV label=\"Spec Codes\">\n <div className=\"flex flex-wrap gap-1\">\n {applicability.specCodes.map((c) => (\n <span key={c} className=\"font-mono text-xs rounded bg-muted px-1.5 py-0.5\">{c}</span>\n ))}\n </div>\n </KV>\n ) : null}\n {applicability.offeringCodes?.length ? (\n <KV label=\"Offering Codes\">\n <div className=\"flex flex-wrap gap-1\">\n {applicability.offeringCodes.map((c) => (\n <span key={c} className=\"font-mono text-xs rounded bg-muted px-1.5 py-0.5\">{c}</span>\n ))}\n </div>\n </KV>\n ) : null}\n {applicability.customerSegments?.length ? (\n <KV label=\"Customer Segments\">\n <div className=\"flex flex-wrap gap-1\">\n {applicability.customerSegments.map((c) => (\n <span key={c} className=\"font-mono text-xs rounded bg-muted px-1.5 py-0.5\">{c}</span>\n ))}\n </div>\n </KV>\n ) : null}\n </div>\n )\n}\n\n// \u2500\u2500\u2500 Main Page \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport default function CpqWizardDetailPage({ params }: { params: Record<string, string | string[]> }) {\n const router = useRouter()\n const definitionCode = params.definitionCode as string\n\n const [definition, setDefinition] = React.useState<WizardDefinitionResult | null>(null)\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n async function load() {\n if (!definitionCode) return\n setLoading(true)\n setError(null)\n try {\n const def = await apiJson<WizardDefinitionResult>(\n `/api/cpq/wizards?code=${encodeURIComponent(definitionCode)}`,\n )\n setDefinition(def)\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load wizard')\n } finally {\n setLoading(false)\n }\n }\n load()\n }, [definitionCode])\n\n if (loading) {\n return <div className=\"text-sm text-muted-foreground\">Loading...</div>\n }\n\n if (error) {\n return (\n <div className=\"space-y-4\">\n <Alert variant=\"destructive\">{error}</Alert>\n <button type=\"button\" onClick={() => router.push('/backend/cpq/wizards')} className=\"text-sm text-muted-foreground hover:text-foreground\">\n ← Back to Wizards\n </button>\n </div>\n )\n }\n\n if (!definition) {\n return (\n <div className=\"rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground\">\n Wizard not found.\n </div>\n )\n }\n\n return (\n <div className=\"space-y-6 max-w-[900px] mx-auto\">\n {/* Header */}\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => router.push('/backend/cpq/wizards')}\n className=\"text-sm text-muted-foreground hover:text-foreground\"\n >\n ← All Wizards\n </button>\n </div>\n\n <div className=\"flex items-start justify-between gap-4\">\n <div>\n <h1 className=\"text-2xl font-bold\">{definition.name}</h1>\n {definition.description && (\n <p className=\"text-sm text-muted-foreground mt-1\">{definition.description}</p>\n )}\n </div>\n {/* Actions live in a 3-dot menu \u2014 wizards are read-only in admin UI\n for the time being, so only `Preview` is exposed. */}\n <div className=\"shrink-0\">\n <RowActions\n items={[\n {\n id: 'preview',\n label: 'Preview',\n onSelect: () => router.push(`/backend/cpq/wizards/${definitionCode}`),\n },\n ]}\n />\n </div>\n </div>\n\n {/* General Info */}\n <Section title=\"General\">\n <div className=\"rounded-lg border p-4\">\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n <KV label=\"Code\"><span className=\"font-mono text-xs\">{definition.code}</span></KV>\n <KV label=\"Version\">v{definition.version}</KV>\n <KV label=\"Surface\">{definition.surface}</KV>\n <KV label=\"Active\">\n <Badge variant={definition.isActive ? 'success' : 'muted'}>\n {definition.isActive ? 'Yes' : 'No'}\n </Badge>\n </KV>\n </div>\n </div>\n </Section>\n\n {/* Applicability */}\n <Section title=\"Applicability\">\n <div className=\"rounded-lg border p-4\">\n <ApplicabilityPanel applicability={definition.applicability} />\n </div>\n </Section>\n\n {/* Params Schema */}\n {definition.paramsSchema && Object.keys(definition.paramsSchema).length > 0 && (\n <Section title=\"Parameters Schema\">\n <JsonBlock data={definition.paramsSchema} />\n </Section>\n )}\n\n {/* Steps */}\n <Section title={`Steps (${definition.steps.length})`}>\n <div className=\"space-y-2\">\n {definition.steps.map((step, i) => (\n <StepCard key={step.stepId} step={step} index={i} />\n ))}\n </div>\n </Section>\n\n {/* Metadata */}\n {definition.metadata && Object.keys(definition.metadata).length > 0 && (\n <Section title=\"Metadata\">\n <JsonBlock data={definition.metadata} />\n </Section>\n )}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAuBS,cAKL,YALK;AAtBT,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AAQpB,eAAe,QAAW,KAAyB;AACjD,QAAM,MAAM,MAAM,MAAM,GAAG;AAC3B,MAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,aAAa,IAAI,MAAM,EAAE;AACtD,SAAO,IAAI,KAAK;AAClB;AAIA,SAAS,MAAM,EAAE,UAAU,UAAU,UAAU,GAA6E;AAC1H,QAAM,aAAa,YAAY,YAAY,YAAY,YAAY,UAAU,YAAY;AACzF,SAAO,oBAAC,OAAI,SAAS,YAAa,UAAS;AAC7C;AAEA,SAAS,QAAQ,EAAE,OAAO,SAAS,GAAiD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CACnD,GACH,GACF;AAAA,IAGC,WAAW,YAAY,OAAO,KAAK,WAAW,QAAQ,EAAE,SAAS,KAChE,oBAAC,WAAQ,OAAM,YACb,8BAAC,aAAU,MAAM,WAAW,UAAU,GACxC;AAAA,KAEJ;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
5
|
+
import { Alert } from "@open-mercato/ui/primitives/alert";
|
|
6
|
+
import { WizardRunner } from "../../../../workflows/WizardRunner.js";
|
|
7
|
+
import { registerBuiltInStepTypes } from "../../../../workflows/steps/index.js";
|
|
8
|
+
registerBuiltInStepTypes();
|
|
9
|
+
async function apiJson(url) {
|
|
10
|
+
const res = await fetch(url);
|
|
11
|
+
if (!res.ok) throw new Error(`API error ${res.status}`);
|
|
12
|
+
return res.json();
|
|
13
|
+
}
|
|
14
|
+
function ParamsForm({
|
|
15
|
+
schema,
|
|
16
|
+
onStart
|
|
17
|
+
}) {
|
|
18
|
+
const properties = schema.properties ?? {};
|
|
19
|
+
const requiredFields = schema.required ?? [];
|
|
20
|
+
const fieldNames = Object.keys(properties);
|
|
21
|
+
const [values, setValues] = React.useState(() => {
|
|
22
|
+
const init = {};
|
|
23
|
+
for (const key of fieldNames) init[key] = "";
|
|
24
|
+
return init;
|
|
25
|
+
});
|
|
26
|
+
const isValid = requiredFields.every((key) => values[key]?.trim());
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-muted/30 p-4 space-y-1", children: [
|
|
29
|
+
/* @__PURE__ */ jsx("h4", { className: "text-sm font-medium", children: "This wizard requires input parameters" }),
|
|
30
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Fill in the required fields before starting." })
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-3", children: fieldNames.map((key) => {
|
|
33
|
+
const prop = properties[key];
|
|
34
|
+
const isRequired = requiredFields.includes(key);
|
|
35
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
36
|
+
/* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium mb-1", children: [
|
|
37
|
+
prop?.description || key,
|
|
38
|
+
isRequired && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-0.5", children: "*" })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
"input",
|
|
42
|
+
{
|
|
43
|
+
type: "text",
|
|
44
|
+
value: values[key] ?? "",
|
|
45
|
+
onChange: (e) => setValues((prev) => ({ ...prev, [key]: e.target.value })),
|
|
46
|
+
placeholder: prop?.format === "uuid" ? "UUID" : key,
|
|
47
|
+
className: "w-full rounded-md border px-3 py-2 text-sm font-mono"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
prop?.format && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground mt-0.5", children: [
|
|
51
|
+
"Format: ",
|
|
52
|
+
prop.format
|
|
53
|
+
] })
|
|
54
|
+
] }, key);
|
|
55
|
+
}) }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
type: "button",
|
|
60
|
+
onClick: () => onStart(values),
|
|
61
|
+
disabled: !isValid,
|
|
62
|
+
className: "inline-flex items-center justify-center rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
63
|
+
children: "Preview Wizard"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
function CpqWizardRunnerPage({ params }) {
|
|
69
|
+
const router = useRouter();
|
|
70
|
+
const searchParams = useSearchParams();
|
|
71
|
+
const definitionCode = params.definitionCode;
|
|
72
|
+
const [definition, setDefinition] = React.useState(null);
|
|
73
|
+
const [loading, setLoading] = React.useState(true);
|
|
74
|
+
const [error, setError] = React.useState(null);
|
|
75
|
+
const [started, setStarted] = React.useState(false);
|
|
76
|
+
const queryParams = React.useMemo(() => {
|
|
77
|
+
const raw = searchParams.get("params");
|
|
78
|
+
if (!raw) return {};
|
|
79
|
+
try {
|
|
80
|
+
return JSON.parse(raw);
|
|
81
|
+
} catch {
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
}, [searchParams]);
|
|
85
|
+
const [launchParams, setLaunchParams] = React.useState(queryParams);
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
async function load() {
|
|
88
|
+
if (!definitionCode || definitionCode === "undefined") {
|
|
89
|
+
setError("Invalid wizard definition code");
|
|
90
|
+
setLoading(false);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
setLoading(true);
|
|
94
|
+
setError(null);
|
|
95
|
+
try {
|
|
96
|
+
const def = await apiJson(
|
|
97
|
+
`/api/cpq/wizards?code=${encodeURIComponent(definitionCode)}`
|
|
98
|
+
);
|
|
99
|
+
setDefinition(def);
|
|
100
|
+
const schema = def.paramsSchema;
|
|
101
|
+
const hasRequiredParams = schema?.required?.length;
|
|
102
|
+
if (!hasRequiredParams || Object.keys(queryParams).length > 0) {
|
|
103
|
+
setStarted(true);
|
|
104
|
+
}
|
|
105
|
+
} catch (err) {
|
|
106
|
+
setError(err instanceof Error ? err.message : "Failed to load wizard");
|
|
107
|
+
} finally {
|
|
108
|
+
setLoading(false);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
load();
|
|
112
|
+
}, [definitionCode, queryParams]);
|
|
113
|
+
const handleComplete = React.useCallback((stepData) => {
|
|
114
|
+
let orderId;
|
|
115
|
+
let quoteId;
|
|
116
|
+
for (const data of Object.values(stepData)) {
|
|
117
|
+
if (data.orderId && !orderId) orderId = data.orderId;
|
|
118
|
+
if (data.quoteId && !quoteId) quoteId = data.quoteId;
|
|
119
|
+
}
|
|
120
|
+
if (orderId) {
|
|
121
|
+
router.push(`/backend/cpq/orders/${orderId}`);
|
|
122
|
+
} else if (quoteId) {
|
|
123
|
+
router.push(`/backend/cpq/quotes/${quoteId}`);
|
|
124
|
+
} else {
|
|
125
|
+
router.push("/backend/cpq/wizards");
|
|
126
|
+
}
|
|
127
|
+
}, [router]);
|
|
128
|
+
const handleParamsSubmit = React.useCallback((params2) => {
|
|
129
|
+
setLaunchParams(params2);
|
|
130
|
+
setStarted(true);
|
|
131
|
+
}, []);
|
|
132
|
+
if (loading) {
|
|
133
|
+
return /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Loading wizard..." });
|
|
134
|
+
}
|
|
135
|
+
if (error) {
|
|
136
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
137
|
+
/* @__PURE__ */ jsx(Alert, { variant: "destructive", children: error }),
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
onClick: () => router.push("/backend/cpq/wizards"),
|
|
143
|
+
className: "inline-flex items-center justify-center rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",
|
|
144
|
+
children: "Back to Wizards"
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] });
|
|
148
|
+
}
|
|
149
|
+
if (!definition) {
|
|
150
|
+
return /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground", children: "Wizard not found." });
|
|
151
|
+
}
|
|
152
|
+
const scope = { organizationId: "", tenantId: "" };
|
|
153
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4 max-w-[900px] mx-auto", children: [
|
|
154
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsx(
|
|
155
|
+
"button",
|
|
156
|
+
{
|
|
157
|
+
type: "button",
|
|
158
|
+
onClick: () => router.push("/backend/cpq/wizards"),
|
|
159
|
+
className: "text-sm text-muted-foreground hover:text-foreground",
|
|
160
|
+
children: "\u2190 All Wizards"
|
|
161
|
+
}
|
|
162
|
+
) }),
|
|
163
|
+
!started ? /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
164
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
165
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: definition.name }),
|
|
166
|
+
definition.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: definition.description })
|
|
167
|
+
] }),
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
ParamsForm,
|
|
170
|
+
{
|
|
171
|
+
schema: definition.paramsSchema ?? {},
|
|
172
|
+
onStart: handleParamsSubmit
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] }) : /* @__PURE__ */ jsx(
|
|
176
|
+
WizardRunner,
|
|
177
|
+
{
|
|
178
|
+
definition,
|
|
179
|
+
params: launchParams,
|
|
180
|
+
initialQuoteId: launchParams.quoteId,
|
|
181
|
+
initialCustomerId: launchParams.customerId,
|
|
182
|
+
scope,
|
|
183
|
+
onComplete: handleComplete
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] });
|
|
187
|
+
}
|
|
188
|
+
export {
|
|
189
|
+
CpqWizardRunnerPage as default
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/modules/cpq/backend/cpq/wizards/%5BdefinitionCode%5D/page.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { useRouter, useSearchParams } from 'next/navigation'\nimport { Alert } from '@open-mercato/ui/primitives/alert'\nimport { WizardRunner } from '../../../../workflows/WizardRunner'\nimport { registerBuiltInStepTypes } from '../../../../workflows/steps'\nimport type { WizardDefinitionResult } from '../../../../workflows/types'\n\n// Register built-in step types once on module load\nregisterBuiltInStepTypes()\n\nasync function apiJson<T>(url: string): Promise<T> {\n const res = await fetch(url)\n if (!res.ok) throw new Error(`API error ${res.status}`)\n return res.json() as Promise<T>\n}\n\n// \u2500\u2500\u2500 Params form shown before starting a wizard with required params \u2500\u2500\n\ntype ParamsSchema = {\n type?: string\n required?: string[]\n properties?: Record<string, { type?: string; format?: string; description?: string }>\n}\n\nfunction ParamsForm({\n schema,\n onStart,\n}: {\n schema: ParamsSchema\n onStart: (params: Record<string, string>) => void\n}) {\n const properties = schema.properties ?? {}\n const requiredFields = schema.required ?? []\n const fieldNames = Object.keys(properties)\n\n const [values, setValues] = React.useState<Record<string, string>>(() => {\n const init: Record<string, string> = {}\n for (const key of fieldNames) init[key] = ''\n return init\n })\n\n const isValid = requiredFields.every((key) => values[key]?.trim())\n\n return (\n <div className=\"space-y-4\">\n <div className=\"rounded-lg border bg-muted/30 p-4 space-y-1\">\n <h4 className=\"text-sm font-medium\">This wizard requires input parameters</h4>\n <p className=\"text-xs text-muted-foreground\">Fill in the required fields before starting.</p>\n </div>\n\n <div className=\"space-y-3\">\n {fieldNames.map((key) => {\n const prop = properties[key]\n const isRequired = requiredFields.includes(key)\n return (\n <div key={key}>\n <label className=\"block text-sm font-medium mb-1\">\n {prop?.description || key}\n {isRequired && <span className=\"text-destructive ml-0.5\">*</span>}\n </label>\n <input\n type=\"text\"\n value={values[key] ?? ''}\n onChange={(e) => setValues((prev) => ({ ...prev, [key]: e.target.value }))}\n placeholder={prop?.format === 'uuid' ? 'UUID' : key}\n className=\"w-full rounded-md border px-3 py-2 text-sm font-mono\"\n />\n {prop?.format && (\n <p className=\"text-xs text-muted-foreground mt-0.5\">Format: {prop.format}</p>\n )}\n </div>\n )\n })}\n </div>\n\n <button\n type=\"button\"\n onClick={() => onStart(values)}\n disabled={!isValid}\n className=\"inline-flex items-center justify-center rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Preview Wizard\n </button>\n </div>\n )\n}\n\n// \u2500\u2500\u2500 Main page \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport default function CpqWizardRunnerPage({ params }: { params: Record<string, string | string[]> }) {\n const router = useRouter()\n const searchParams = useSearchParams()\n const definitionCode = params.definitionCode as string\n\n const [definition, setDefinition] = React.useState<WizardDefinitionResult | null>(null)\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [started, setStarted] = React.useState(false)\n\n // Parse launch params from query string\n const queryParams = React.useMemo(() => {\n const raw = searchParams.get('params')\n if (!raw) return {}\n try {\n return JSON.parse(raw) as Record<string, unknown>\n } catch {\n return {}\n }\n }, [searchParams])\n\n const [launchParams, setLaunchParams] = React.useState<Record<string, unknown>>(queryParams)\n\n React.useEffect(() => {\n async function load() {\n if (!definitionCode || definitionCode === 'undefined') {\n setError('Invalid wizard definition code')\n setLoading(false)\n return\n }\n setLoading(true)\n setError(null)\n try {\n const def = await apiJson<WizardDefinitionResult>(\n `/api/cpq/wizards?code=${encodeURIComponent(definitionCode)}`,\n )\n setDefinition(def)\n\n // Auto-start if params were provided via query string or wizard has no required params\n const schema = def.paramsSchema as ParamsSchema | null\n const hasRequiredParams = schema?.required?.length\n if (!hasRequiredParams || Object.keys(queryParams).length > 0) {\n setStarted(true)\n }\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to load wizard')\n } finally {\n setLoading(false)\n }\n }\n load()\n }, [definitionCode, queryParams])\n\n const handleComplete = React.useCallback((stepData: Record<string, Record<string, unknown>>) => {\n // Check for orderId first (e.g. purchasing wizard creates an order)\n let orderId: string | undefined\n let quoteId: string | undefined\n for (const data of Object.values(stepData)) {\n if (data.orderId && !orderId) orderId = data.orderId as string\n if (data.quoteId && !quoteId) quoteId = data.quoteId as string\n }\n if (orderId) {\n router.push(`/backend/cpq/orders/${orderId}`)\n } else if (quoteId) {\n router.push(`/backend/cpq/quotes/${quoteId}`)\n } else {\n router.push('/backend/cpq/wizards')\n }\n }, [router])\n\n const handleParamsSubmit = React.useCallback((params: Record<string, string>) => {\n setLaunchParams(params)\n setStarted(true)\n }, [])\n\n if (loading) {\n return <div className=\"text-sm text-muted-foreground\">Loading wizard...</div>\n }\n\n if (error) {\n return (\n <div className=\"space-y-4\">\n <Alert variant=\"destructive\">{error}</Alert>\n <button\n type=\"button\"\n onClick={() => router.push('/backend/cpq/wizards')}\n className=\"inline-flex items-center justify-center rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted\"\n >\n Back to Wizards\n </button>\n </div>\n )\n }\n\n if (!definition) {\n return (\n <div className=\"rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground\">\n Wizard not found.\n </div>\n )\n }\n\n // Extract scope from auth context (will be provided by the framework at runtime)\n // For now, use empty strings \u2014 the API routes resolve scope from the auth session\n const scope = { organizationId: '', tenantId: '' }\n\n return (\n <div className=\"space-y-4 max-w-[900px] mx-auto\">\n <div className=\"flex items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => router.push('/backend/cpq/wizards')}\n className=\"text-sm text-muted-foreground hover:text-foreground\"\n >\n ← All Wizards\n </button>\n </div>\n\n {!started ? (\n <div className=\"space-y-4\">\n <div>\n <h2 className=\"text-lg font-semibold\">{definition.name}</h2>\n {definition.description && (\n <p className=\"text-sm text-muted-foreground mt-1\">{definition.description}</p>\n )}\n </div>\n <ParamsForm\n schema={(definition.paramsSchema as ParamsSchema) ?? {}}\n onStart={handleParamsSubmit}\n />\n </div>\n ) : (\n <WizardRunner\n definition={definition}\n params={launchParams}\n initialQuoteId={launchParams.quoteId as string | undefined}\n initialCustomerId={launchParams.customerId as string | undefined}\n scope={scope}\n onComplete={handleComplete}\n />\n )}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AA8CM,SACE,KADF;AA7CN,YAAY,WAAW;AACvB,SAAS,WAAW,uBAAuB;AAC3C,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAIzC,yBAAyB;AAEzB,eAAe,QAAW,KAAyB;AACjD,QAAM,MAAM,MAAM,MAAM,GAAG;AAC3B,MAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,aAAa,IAAI,MAAM,EAAE;AACtD,SAAO,IAAI,KAAK;AAClB;AAUA,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AACF,GAGG;AACD,QAAM,aAAa,OAAO,cAAc,CAAC;AACzC,QAAM,iBAAiB,OAAO,YAAY,CAAC;AAC3C,QAAM,aAAa,OAAO,KAAK,UAAU;AAEzC,QAAM,CAAC,QAAQ,SAAS,IAAI,MAAM,SAAiC,MAAM;AACvE,UAAM,OAA+B,CAAC;AACtC,eAAW,OAAO,WAAY,MAAK,GAAG,IAAI;AAC1C,WAAO;AAAA,EACT,CAAC;AAED,QAAM,UAAU,eAAe,MAAM,CAAC,QAAQ,OAAO,GAAG,GAAG,KAAK,CAAC;AAEjE,SACE,qBAAC,SAAI,WAAU,aACb;AAAA,yBAAC,SAAI,WAAU,+CACb;AAAA,0BAAC,QAAG,WAAU,uBAAsB,mDAAqC;AAAA,MACzE,oBAAC,OAAE,WAAU,iCAAgC,0DAA4C;AAAA,OAC3F;AAAA,IAEA,oBAAC,SAAI,WAAU,aACZ,qBAAW,IAAI,CAAC,QAAQ;AACvB,YAAM,OAAO,WAAW,GAAG;AAC3B,YAAM,aAAa,eAAe,SAAS,GAAG;AAC9C,aACE,qBAAC,SACC;AAAA,6BAAC,WAAM,WAAU,kCACd;AAAA,gBAAM,eAAe;AAAA,UACrB,cA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* as React from "react";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
6
|
+
import { RowActions } from "@open-mercato/ui/backend/RowActions";
|
|
7
|
+
import { Tag } from "@open-mercato/ui/primitives/tag";
|
|
8
|
+
import { CpqListView, useCpqListData } from "../../../components/CpqListView.js";
|
|
9
|
+
const PAGE_SIZE = 50;
|
|
10
|
+
function buildFilterParams(values, params) {
|
|
11
|
+
if (typeof values.surface === "string" && values.surface.trim()) {
|
|
12
|
+
params.set("surface", values.surface.trim());
|
|
13
|
+
}
|
|
14
|
+
if (values.isActive === true) params.set("isActive", "true");
|
|
15
|
+
if (values.isActive === false) params.set("isActive", "false");
|
|
16
|
+
}
|
|
17
|
+
function CpqWizardsPage() {
|
|
18
|
+
const router = useRouter();
|
|
19
|
+
const t = useT();
|
|
20
|
+
const data = useCpqListData({
|
|
21
|
+
endpoint: "/api/cpq/wizards",
|
|
22
|
+
pageSize: PAGE_SIZE,
|
|
23
|
+
buildFilterParams,
|
|
24
|
+
loadErrorMessage: t("cpq.wizards.list.error.load", "Failed to load wizards")
|
|
25
|
+
});
|
|
26
|
+
const filters = React.useMemo(
|
|
27
|
+
() => [
|
|
28
|
+
{
|
|
29
|
+
id: "surface",
|
|
30
|
+
label: t("cpq.wizards.filters.surface", "Surface"),
|
|
31
|
+
type: "text"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "isActive",
|
|
35
|
+
label: t("cpq.wizards.filters.isActive", "Active"),
|
|
36
|
+
type: "checkbox"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
[t]
|
|
40
|
+
);
|
|
41
|
+
const handlePreviewWizard = React.useCallback(
|
|
42
|
+
(definitionCode) => {
|
|
43
|
+
router.push(`/backend/cpq/wizards/${definitionCode}`);
|
|
44
|
+
},
|
|
45
|
+
[router]
|
|
46
|
+
);
|
|
47
|
+
const columns = React.useMemo(
|
|
48
|
+
() => [
|
|
49
|
+
{
|
|
50
|
+
accessorKey: "name",
|
|
51
|
+
header: t("cpq.wizards.table.name", "Name"),
|
|
52
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "font-medium", children: row.original.name })
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
accessorKey: "code",
|
|
56
|
+
header: t("cpq.wizards.table.code", "Code"),
|
|
57
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: row.original.code })
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
accessorKey: "surface",
|
|
61
|
+
header: t("cpq.wizards.table.surface", "Surface")
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "steps",
|
|
65
|
+
header: t("cpq.wizards.table.steps", "Steps"),
|
|
66
|
+
cell: ({ row }) => /* @__PURE__ */ jsx("span", { children: row.original.steps.length })
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "version",
|
|
70
|
+
header: t("cpq.wizards.table.version", "Version"),
|
|
71
|
+
cell: ({ row }) => /* @__PURE__ */ jsxs("span", { children: [
|
|
72
|
+
"v",
|
|
73
|
+
row.original.version
|
|
74
|
+
] })
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
accessorKey: "isActive",
|
|
78
|
+
header: t("cpq.wizards.table.active", "Active"),
|
|
79
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(Tag, { variant: row.original.isActive ? "success" : "neutral", dot: true, children: row.original.isActive ? "Yes" : "No" })
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
[t]
|
|
83
|
+
);
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
CpqListView,
|
|
86
|
+
{
|
|
87
|
+
title: t("cpq.wizards.list.title", "Wizards"),
|
|
88
|
+
tableId: "cpq.wizards.list",
|
|
89
|
+
data,
|
|
90
|
+
columns,
|
|
91
|
+
filters,
|
|
92
|
+
pageSize: PAGE_SIZE,
|
|
93
|
+
searchPlaceholder: t("cpq.wizards.search.placeholder", "Search wizards..."),
|
|
94
|
+
onRowClick: (row) => router.push(`/backend/cpq/wizards/${row.code}/detail`),
|
|
95
|
+
rowActions: (row) => /* @__PURE__ */ jsx(
|
|
96
|
+
RowActions,
|
|
97
|
+
{
|
|
98
|
+
items: [
|
|
99
|
+
{
|
|
100
|
+
id: "preview",
|
|
101
|
+
label: t("cpq.wizards.actions.preview", "Preview"),
|
|
102
|
+
onSelect: () => handlePreviewWizard(row.code)
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "details",
|
|
106
|
+
label: t("cpq.wizards.actions.details", "View details"),
|
|
107
|
+
href: `/backend/cpq/wizards/${row.code}/detail`
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
emptyState: /* @__PURE__ */ jsx("div", { className: "rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground", children: t("cpq.wizards.empty", "No wizard definitions yet. Create one via the API.") })
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
CpqWizardsPage as default
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/cpq/backend/cpq/wizards/page.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\"\nimport * as React from 'react'\nimport { useRouter } from 'next/navigation'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { RowActions } from '@open-mercato/ui/backend/RowActions'\nimport { Tag } from '@open-mercato/ui/primitives/tag'\nimport { CpqListView, useCpqListData } from '../../../components/CpqListView'\n\ntype WizardDefinition = {\n id: string\n code: string\n name: string\n description: string | null\n version: number\n surface: string\n isActive: boolean\n steps: Array<{ stepId: string; type: string; title: string }>\n createdAt: string\n}\n\nconst PAGE_SIZE = 50\n\nfunction buildFilterParams(values: FilterValues, params: URLSearchParams) {\n if (typeof values.surface === 'string' && values.surface.trim()) {\n params.set('surface', values.surface.trim())\n }\n if (values.isActive === true) params.set('isActive', 'true')\n if (values.isActive === false) params.set('isActive', 'false')\n}\n\nexport default function CpqWizardsPage() {\n const router = useRouter()\n const t = useT()\n\n const data = useCpqListData<WizardDefinition>({\n endpoint: '/api/cpq/wizards',\n pageSize: PAGE_SIZE,\n buildFilterParams,\n loadErrorMessage: t('cpq.wizards.list.error.load', 'Failed to load wizards'),\n })\n\n const filters = React.useMemo<FilterDef[]>(\n () => [\n {\n id: 'surface',\n label: t('cpq.wizards.filters.surface', 'Surface'),\n type: 'text',\n },\n {\n id: 'isActive',\n label: t('cpq.wizards.filters.isActive', 'Active'),\n type: 'checkbox',\n },\n ],\n [t],\n )\n\n const handlePreviewWizard = React.useCallback(\n (definitionCode: string) => {\n router.push(`/backend/cpq/wizards/${definitionCode}`)\n },\n [router],\n )\n\n const columns = React.useMemo<ColumnDef<WizardDefinition>[]>(\n () => [\n {\n accessorKey: 'name',\n header: t('cpq.wizards.table.name', 'Name'),\n cell: ({ row }) => <span className=\"font-medium\">{row.original.name}</span>,\n },\n {\n accessorKey: 'code',\n header: t('cpq.wizards.table.code', 'Code'),\n cell: ({ row }) => <span className=\"font-mono text-xs\">{row.original.code}</span>,\n },\n {\n accessorKey: 'surface',\n header: t('cpq.wizards.table.surface', 'Surface'),\n },\n {\n id: 'steps',\n header: t('cpq.wizards.table.steps', 'Steps'),\n cell: ({ row }) => <span>{row.original.steps.length}</span>,\n },\n {\n id: 'version',\n header: t('cpq.wizards.table.version', 'Version'),\n cell: ({ row }) => <span>v{row.original.version}</span>,\n },\n {\n accessorKey: 'isActive',\n header: t('cpq.wizards.table.active', 'Active'),\n cell: ({ row }) => (\n <Tag variant={row.original.isActive ? 'success' : 'neutral'} dot>\n {row.original.isActive ? 'Yes' : 'No'}\n </Tag>\n ),\n },\n ],\n [t],\n )\n\n return (\n <CpqListView<WizardDefinition>\n title={t('cpq.wizards.list.title', 'Wizards')}\n tableId=\"cpq.wizards.list\"\n data={data}\n columns={columns}\n filters={filters}\n pageSize={PAGE_SIZE}\n searchPlaceholder={t('cpq.wizards.search.placeholder', 'Search wizards...')}\n onRowClick={(row) => router.push(`/backend/cpq/wizards/${row.code}/detail`)}\n // Wizards are read-only in the admin UI for now: no Edit / Delete\n // entries \u2014 only `Preview` (run the wizard) and `View details`.\n rowActions={(row) => (\n <RowActions\n items={[\n {\n id: 'preview',\n label: t('cpq.wizards.actions.preview', 'Preview'),\n onSelect: () => handlePreviewWizard(row.code),\n },\n {\n id: 'details',\n label: t('cpq.wizards.actions.details', 'View details'),\n href: `/backend/cpq/wizards/${row.code}/detail`,\n },\n ]}\n />\n )}\n emptyState={\n <div className=\"rounded-lg border bg-card p-6 text-center text-sm text-muted-foreground\">\n {t('cpq.wizards.empty', 'No wizard definitions yet. Create one via the API.')}\n </div>\n }\n />\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAuE2B,cAmBA,YAnBA;AAtE3B,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAGrB,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AACpB,SAAS,aAAa,sBAAsB;AAc5C,MAAM,YAAY;AAElB,SAAS,kBAAkB,QAAsB,QAAyB;AACxE,MAAI,OAAO,OAAO,YAAY,YAAY,OAAO,QAAQ,KAAK,GAAG;AAC/D,WAAO,IAAI,WAAW,OAAO,QAAQ,KAAK,CAAC;AAAA,EAC7C;AACA,MAAI,OAAO,aAAa,KAAM,QAAO,IAAI,YAAY,MAAM;AAC3D,MAAI,OAAO,aAAa,MAAO,QAAO,IAAI,YAAY,OAAO;AAC/D;AAEe,SAAR,iBAAkC;AACvC,QAAM,SAAS,UAAU;AACzB,QAAM,IAAI,KAAK;AAEf,QAAM,OAAO,eAAiC;AAAA,IAC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I,MAAM,qBAAC,UAAK;AAAA;AAAA,UAAE,IAAI,SAAS;AAAA,WAAQ;AAAA,MAClD;AAAA,MACA;AAAA,QACE,aAAa;AAAA,QACb,QAAQ,EAAE,4BAA4B,QAAQ;AAAA,QAC9C,MAAM,CAAC,EAAE,IAAI,MACX,oBAAC,OAAI,SAAS,IAAI,SAAS,WAAW,YAAY,WAAW,KAAG,MAC7D,cAAI,SAAS,WAAW,QAAQ,MACnC;AAAA,MAEJ;AAAA,IACF;AAAA,IACA,CAAC,CAAC;AAAA,EACJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,0BAA0B,SAAS;AAAA,MAC5C,SAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,mBAAmB,EAAE,kCAAkC,mBAAmB;AAAA,MAC1E,YAAY,CAAC,QAAQ,OAAO,KAAK,wBAAwB,IAAI,IAAI,SAAS;AAAA,MAG1E,YAAY,CAAC,QACX;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL;AAAA,cACE,IAAI;AAAA,cACJ,OAAO,EAAE,+BAA+B,SAAS;AAAA,cACjD,UAAU,MAAM,oBAAoB,IAAI,IAAI;AAAA,YAC9C;AAAA,YACA;AAAA,cACE,IAAI;AAAA,cACJ,OAAO,EAAE,+BAA+B,cAAc;AAAA,cACtD,MAAM,wBAAwB,IAAI,IAAI;AAAA,YACxC;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MAEF,YACE,oBAAC,SAAI,WAAU,2EACZ,YAAE,qBAAqB,oDAAoD,GAC9E;AAAA;AAAA,EAEJ;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Wand2 } from "lucide-react";
|
|
3
|
+
const wizardsIcon = React.createElement(Wand2, { size: 16 });
|
|
4
|
+
const metadata = {
|
|
5
|
+
requireAuth: true,
|
|
6
|
+
requireFeatures: ["cpq.wizards.view"],
|
|
7
|
+
pageTitle: "Wizards",
|
|
8
|
+
pageTitleKey: "cpq.wizards.title",
|
|
9
|
+
pageGroup: "CPQ",
|
|
10
|
+
pageGroupKey: "customers~sales~cpq.nav.group",
|
|
11
|
+
pageOrder: 35,
|
|
12
|
+
icon: wizardsIcon,
|
|
13
|
+
breadcrumb: [{ label: "Wizards", labelKey: "cpq.wizards.title" }]
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
metadata
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=page.meta.js.map
|