@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,652 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Alert } from "@open-mercato/ui/primitives/alert";
|
|
5
|
+
import { NumberInput as BaseNumberInput } from "../../../../../components/NumberInput.js";
|
|
6
|
+
const REASON_CODES = [
|
|
7
|
+
{ value: "upgrade", label: "Upgrade" },
|
|
8
|
+
{ value: "downgrade", label: "Downgrade" },
|
|
9
|
+
{ value: "config-change", label: "Configuration change" },
|
|
10
|
+
{ value: "price-adjustment", label: "Price adjustment" },
|
|
11
|
+
{ value: "term-extension", label: "Term extension" },
|
|
12
|
+
{ value: "term-reduction", label: "Term reduction" },
|
|
13
|
+
{ value: "consolidation", label: "Consolidation" },
|
|
14
|
+
{ value: "customer-request", label: "Customer request" },
|
|
15
|
+
{ value: "non-payment", label: "Non-payment" },
|
|
16
|
+
{ value: "contract-breach", label: "Contract breach" },
|
|
17
|
+
{ value: "other", label: "Other" }
|
|
18
|
+
];
|
|
19
|
+
function ArcQuoteConfigurator(props) {
|
|
20
|
+
const {
|
|
21
|
+
quoteId,
|
|
22
|
+
customerId,
|
|
23
|
+
customerName,
|
|
24
|
+
currencyCode,
|
|
25
|
+
initialType,
|
|
26
|
+
initialTargets,
|
|
27
|
+
editable,
|
|
28
|
+
onClose,
|
|
29
|
+
onChanged
|
|
30
|
+
} = props;
|
|
31
|
+
const [step, setStep] = React.useState(
|
|
32
|
+
initialType === "new" ? "pick-action" : "pick-targets"
|
|
33
|
+
);
|
|
34
|
+
const [type, setType] = React.useState(
|
|
35
|
+
initialType === "new" ? null : initialType
|
|
36
|
+
);
|
|
37
|
+
const [eligible, setEligible] = React.useState([]);
|
|
38
|
+
const [eligibleLoading, setEligibleLoading] = React.useState(false);
|
|
39
|
+
const [picked, setPicked] = React.useState(() => {
|
|
40
|
+
const seed = {};
|
|
41
|
+
for (const t of initialTargets) {
|
|
42
|
+
if (t.subscription) {
|
|
43
|
+
seed[t.subscriptionId] = {
|
|
44
|
+
id: t.subscriptionId,
|
|
45
|
+
code: t.subscription.code,
|
|
46
|
+
name: t.subscription.name,
|
|
47
|
+
status: "active",
|
|
48
|
+
currencyCode: t.subscription.currencyCode,
|
|
49
|
+
billingCycle: t.subscription.billingCycle,
|
|
50
|
+
currentTermEnd: null,
|
|
51
|
+
mrcAmount: t.subscription.mrcAmount
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return seed;
|
|
56
|
+
});
|
|
57
|
+
const [singleTerm, setSingleTerm] = React.useState(() => ({
|
|
58
|
+
start: initialTargets[0]?.newTermStart?.slice(0, 10) ?? "",
|
|
59
|
+
end: initialTargets[0]?.newTermEnd?.slice(0, 10) ?? "",
|
|
60
|
+
months: initialTargets[0]?.newTermMonths != null ? String(initialTargets[0].newTermMonths) : ""
|
|
61
|
+
}));
|
|
62
|
+
const [mergeTerm, setMergeTerm] = React.useState({
|
|
63
|
+
start: "",
|
|
64
|
+
end: "",
|
|
65
|
+
months: "",
|
|
66
|
+
code: "",
|
|
67
|
+
name: ""
|
|
68
|
+
});
|
|
69
|
+
const [cancelMeta, setCancelMeta] = React.useState({
|
|
70
|
+
reasonCode: "",
|
|
71
|
+
reasonText: "",
|
|
72
|
+
etfAmount: "",
|
|
73
|
+
etfCurrency: currencyCode
|
|
74
|
+
});
|
|
75
|
+
const [submitError, setSubmitError] = React.useState(null);
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
function onKey(e) {
|
|
78
|
+
if (e.key === "Escape") onClose();
|
|
79
|
+
}
|
|
80
|
+
window.addEventListener("keydown", onKey);
|
|
81
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
82
|
+
}, [onClose]);
|
|
83
|
+
React.useEffect(() => {
|
|
84
|
+
if (step !== "pick-targets") return;
|
|
85
|
+
setEligibleLoading(true);
|
|
86
|
+
fetch(`/api/cpq/inventory/subscriptions?customerId=${customerId}&pageSize=100`).then((r) => r.json()).then((data) => {
|
|
87
|
+
const items = (data.items ?? []).map((s) => ({
|
|
88
|
+
...s,
|
|
89
|
+
mrcAmount: Number(s.mrcAmount ?? 0)
|
|
90
|
+
}));
|
|
91
|
+
setEligible(items);
|
|
92
|
+
}).catch(() => setEligible([])).finally(() => setEligibleLoading(false));
|
|
93
|
+
}, [step, customerId]);
|
|
94
|
+
const pickedList = Object.values(picked);
|
|
95
|
+
const isMergeRenew = type === "renew" && pickedList.length >= 2;
|
|
96
|
+
const billingCycles = new Set(pickedList.map((s) => s.billingCycle));
|
|
97
|
+
const cyclesMatch = billingCycles.size <= 1;
|
|
98
|
+
const currenciesMatch = pickedList.every((s) => s.currencyCode === currencyCode);
|
|
99
|
+
const canProceedFromTargets = pickedList.length > 0 && currenciesMatch;
|
|
100
|
+
const canProceedFromRenew = isMergeRenew ? !!mergeTerm.start && !!mergeTerm.end && mergeTerm.start < mergeTerm.end && cyclesMatch : !!singleTerm.start && !!singleTerm.end && singleTerm.start < singleTerm.end;
|
|
101
|
+
const canProceedFromCancel = !!cancelMeta.reasonCode;
|
|
102
|
+
const submit = React.useCallback(async () => {
|
|
103
|
+
setStep("submitting");
|
|
104
|
+
setSubmitError(null);
|
|
105
|
+
try {
|
|
106
|
+
if (initialType === "new" && type) {
|
|
107
|
+
const r = await fetch(`/api/cpq/quotes/${quoteId}`, {
|
|
108
|
+
method: "PATCH",
|
|
109
|
+
headers: { "content-type": "application/json" },
|
|
110
|
+
body: JSON.stringify({ quoteType: type })
|
|
111
|
+
});
|
|
112
|
+
if (!r.ok) {
|
|
113
|
+
const body = await r.json().catch(() => ({}));
|
|
114
|
+
throw new Error(body.error ?? `PATCH /quotes/${quoteId} failed`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const initialTargetIds = new Set(initialTargets.map((t) => t.subscriptionId));
|
|
118
|
+
const pickedIds = new Set(pickedList.map((s) => s.id));
|
|
119
|
+
for (const t of initialTargets) {
|
|
120
|
+
if (!pickedIds.has(t.subscriptionId)) {
|
|
121
|
+
await fetch(`/api/cpq/quotes/${quoteId}/target-subscriptions/${t.id}`, { method: "DELETE" });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const s of pickedList) {
|
|
125
|
+
if (!initialTargetIds.has(s.id) && type) {
|
|
126
|
+
const body = {
|
|
127
|
+
subscriptionId: s.id,
|
|
128
|
+
quoteType: type
|
|
129
|
+
};
|
|
130
|
+
if (type === "renew" && !isMergeRenew) {
|
|
131
|
+
body.mergeAction = "standalone";
|
|
132
|
+
body.newTermStart = singleTerm.start;
|
|
133
|
+
body.newTermEnd = singleTerm.end;
|
|
134
|
+
if (singleTerm.months) body.newTermMonths = Number(singleTerm.months);
|
|
135
|
+
} else if (type === "renew" && isMergeRenew) {
|
|
136
|
+
body.mergeAction = "absorb";
|
|
137
|
+
}
|
|
138
|
+
const r = await fetch(`/api/cpq/quotes/${quoteId}/target-subscriptions`, {
|
|
139
|
+
method: "POST",
|
|
140
|
+
headers: { "content-type": "application/json" },
|
|
141
|
+
body: JSON.stringify(body)
|
|
142
|
+
});
|
|
143
|
+
if (!r.ok) {
|
|
144
|
+
const errBody = await r.json().catch(() => ({}));
|
|
145
|
+
throw new Error(errBody.error ?? `POST /target-subscriptions failed`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (type === "renew" && isMergeRenew) {
|
|
150
|
+
const body = {
|
|
151
|
+
newTermStart: mergeTerm.start,
|
|
152
|
+
newTermEnd: mergeTerm.end
|
|
153
|
+
};
|
|
154
|
+
if (mergeTerm.months) body.newTermMonths = Number(mergeTerm.months);
|
|
155
|
+
if (mergeTerm.code) body.newSubCode = mergeTerm.code;
|
|
156
|
+
if (mergeTerm.name) body.newSubName = mergeTerm.name;
|
|
157
|
+
const r = await fetch(`/api/cpq/quotes/${quoteId}/merge-meta`, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers: { "content-type": "application/json" },
|
|
160
|
+
body: JSON.stringify(body)
|
|
161
|
+
});
|
|
162
|
+
if (!r.ok) {
|
|
163
|
+
const errBody = await r.json().catch(() => ({}));
|
|
164
|
+
throw new Error(errBody.error ?? `POST /merge-meta failed`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (type === "cancel") {
|
|
168
|
+
const body = { reasonCode: cancelMeta.reasonCode };
|
|
169
|
+
if (cancelMeta.reasonText) body.reasonText = cancelMeta.reasonText;
|
|
170
|
+
if (cancelMeta.etfAmount) body.etfAmount = cancelMeta.etfAmount;
|
|
171
|
+
if (cancelMeta.etfCurrency) body.etfCurrency = cancelMeta.etfCurrency;
|
|
172
|
+
const r = await fetch(`/api/cpq/quotes/${quoteId}/cancel-meta`, {
|
|
173
|
+
method: "POST",
|
|
174
|
+
headers: { "content-type": "application/json" },
|
|
175
|
+
body: JSON.stringify(body)
|
|
176
|
+
});
|
|
177
|
+
if (!r.ok) {
|
|
178
|
+
const errBody = await r.json().catch(() => ({}));
|
|
179
|
+
throw new Error(errBody.error ?? `POST /cancel-meta failed`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
await onChanged();
|
|
183
|
+
setStep("done");
|
|
184
|
+
} catch (err) {
|
|
185
|
+
setSubmitError(err instanceof Error ? err.message : String(err));
|
|
186
|
+
setStep("review");
|
|
187
|
+
}
|
|
188
|
+
}, [
|
|
189
|
+
quoteId,
|
|
190
|
+
type,
|
|
191
|
+
initialType,
|
|
192
|
+
initialTargets,
|
|
193
|
+
pickedList,
|
|
194
|
+
isMergeRenew,
|
|
195
|
+
singleTerm,
|
|
196
|
+
mergeTerm,
|
|
197
|
+
cancelMeta,
|
|
198
|
+
onChanged
|
|
199
|
+
]);
|
|
200
|
+
return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex", role: "dialog", "aria-modal": "true", children: [
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
"aria-label": "Close drawer",
|
|
205
|
+
className: "absolute inset-0 bg-black/40",
|
|
206
|
+
onClick: onClose
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto h-full w-full max-w-2xl bg-card shadow-xl border-l overflow-y-auto relative flex flex-col", children: [
|
|
210
|
+
/* @__PURE__ */ jsxs("header", { className: "border-b px-5 py-4 flex items-start justify-between", children: [
|
|
211
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
212
|
+
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: "Modify subscription" }),
|
|
213
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground mt-0.5", children: [
|
|
214
|
+
customerName ?? customerId.slice(0, 12) + "\u2026",
|
|
215
|
+
" \u2022 ",
|
|
216
|
+
currencyCode
|
|
217
|
+
] })
|
|
218
|
+
] }),
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
onClick: onClose,
|
|
223
|
+
className: "text-sm text-muted-foreground hover:text-foreground",
|
|
224
|
+
children: "\u2715"
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 px-5 py-4 space-y-4", children: [
|
|
229
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
230
|
+
"Step: ",
|
|
231
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: step }),
|
|
232
|
+
type && /* @__PURE__ */ jsxs("span", { children: [
|
|
233
|
+
" \u2022 ",
|
|
234
|
+
type
|
|
235
|
+
] }),
|
|
236
|
+
pickedList.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
237
|
+
" \u2022 ",
|
|
238
|
+
pickedList.length,
|
|
239
|
+
" target(s)"
|
|
240
|
+
] })
|
|
241
|
+
] }),
|
|
242
|
+
step === "pick-action" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
243
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "Pick the kind of change you want to make:" }),
|
|
244
|
+
["amend", "renew", "cancel"].map((opt) => /* @__PURE__ */ jsxs(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
onClick: () => {
|
|
248
|
+
setType(opt);
|
|
249
|
+
setStep("pick-targets");
|
|
250
|
+
},
|
|
251
|
+
className: "block w-full text-left rounded-md border border-input px-4 py-3 hover:bg-muted",
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium capitalize", children: opt }),
|
|
254
|
+
/* @__PURE__ */ jsxs("span", { className: "block text-xs text-muted-foreground mt-0.5", children: [
|
|
255
|
+
opt === "amend" && "Add or remove items on existing subscriptions. Term untouched.",
|
|
256
|
+
opt === "renew" && "Extend term. With 2+ targets, merges them into a new contract.",
|
|
257
|
+
opt === "cancel" && "Terminate one or more subscriptions."
|
|
258
|
+
] })
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
opt
|
|
262
|
+
))
|
|
263
|
+
] }),
|
|
264
|
+
step === "pick-targets" && type && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
265
|
+
eligibleLoading ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Loading subscriptions\u2026" }) : eligible.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "No subscriptions for this customer." }) : /* @__PURE__ */ jsx("div", { className: "space-y-1", children: eligible.map((s) => {
|
|
266
|
+
const currencyMismatch = s.currencyCode !== currencyCode;
|
|
267
|
+
const isPicked = !!picked[s.id];
|
|
268
|
+
return /* @__PURE__ */ jsxs(
|
|
269
|
+
"label",
|
|
270
|
+
{
|
|
271
|
+
className: `flex items-start gap-2 rounded-md border px-3 py-2 ${currencyMismatch ? "opacity-50 border-dashed" : isPicked ? "border-primary bg-primary/5" : "border-input hover:bg-muted"}`,
|
|
272
|
+
children: [
|
|
273
|
+
/* @__PURE__ */ jsx(
|
|
274
|
+
"input",
|
|
275
|
+
{
|
|
276
|
+
type: "checkbox",
|
|
277
|
+
disabled: currencyMismatch,
|
|
278
|
+
checked: isPicked,
|
|
279
|
+
onChange: (e) => {
|
|
280
|
+
setPicked((prev) => {
|
|
281
|
+
const next = { ...prev };
|
|
282
|
+
if (e.target.checked) next[s.id] = s;
|
|
283
|
+
else delete next[s.id];
|
|
284
|
+
return next;
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
290
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm font-medium", children: [
|
|
291
|
+
s.name,
|
|
292
|
+
" ",
|
|
293
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-mono text-muted-foreground", children: s.code })
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
296
|
+
s.status,
|
|
297
|
+
" \u2022 ",
|
|
298
|
+
s.billingCycle,
|
|
299
|
+
" \u2022 MRC ",
|
|
300
|
+
s.mrcAmount.toFixed(2),
|
|
301
|
+
" ",
|
|
302
|
+
s.currencyCode,
|
|
303
|
+
s.currentTermEnd ? ` \u2022 Term ends ${new Date(s.currentTermEnd).toLocaleDateString()}` : ""
|
|
304
|
+
] }),
|
|
305
|
+
currencyMismatch && /* @__PURE__ */ jsxs("div", { className: "text-xs text-status-warning-text mt-1", children: [
|
|
306
|
+
"Currency mismatch (",
|
|
307
|
+
s.currencyCode,
|
|
308
|
+
" vs ",
|
|
309
|
+
currencyCode,
|
|
310
|
+
") \u2014 cannot include"
|
|
311
|
+
] })
|
|
312
|
+
] })
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
s.id
|
|
316
|
+
);
|
|
317
|
+
}) }),
|
|
318
|
+
!cyclesMatch && /* @__PURE__ */ jsx(Alert, { variant: "warning", className: "text-xs", children: "Picked targets have different billing cycles \u2014 merge requires matching cycles." }),
|
|
319
|
+
isMergeRenew && /* @__PURE__ */ jsxs(Alert, { variant: "warning", className: "text-xs", children: [
|
|
320
|
+
"Merging ",
|
|
321
|
+
pickedList.length,
|
|
322
|
+
" contracts into a new one \u2014 sources will be marked Merged at activation."
|
|
323
|
+
] })
|
|
324
|
+
] }),
|
|
325
|
+
step === "config-renew" && type === "renew" && !isMergeRenew && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
326
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
|
|
327
|
+
"New contract term for ",
|
|
328
|
+
pickedList[0]?.name,
|
|
329
|
+
":"
|
|
330
|
+
] }),
|
|
331
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
332
|
+
"Pre-filled with same length as the current term, starting at the current term end. Type a new value in ",
|
|
333
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Months" }),
|
|
334
|
+
" to auto-shift the end date, or edit start/end directly."
|
|
335
|
+
] }),
|
|
336
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-3", children: [
|
|
337
|
+
/* @__PURE__ */ jsx(
|
|
338
|
+
DateInput,
|
|
339
|
+
{
|
|
340
|
+
label: "Start",
|
|
341
|
+
value: singleTerm.start,
|
|
342
|
+
onChange: (v) => {
|
|
343
|
+
const months = singleTerm.months ? Number(singleTerm.months) : null;
|
|
344
|
+
const end = months && v ? addMonthsToIso(v, months) : singleTerm.end;
|
|
345
|
+
setSingleTerm({ ...singleTerm, start: v, end });
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
/* @__PURE__ */ jsx(
|
|
350
|
+
DateInput,
|
|
351
|
+
{
|
|
352
|
+
label: "End",
|
|
353
|
+
value: singleTerm.end,
|
|
354
|
+
onChange: (v) => setSingleTerm({ ...singleTerm, end: v })
|
|
355
|
+
}
|
|
356
|
+
),
|
|
357
|
+
/* @__PURE__ */ jsx(
|
|
358
|
+
NumberInput,
|
|
359
|
+
{
|
|
360
|
+
label: "Months",
|
|
361
|
+
value: singleTerm.months,
|
|
362
|
+
onChange: (v) => {
|
|
363
|
+
const months = v ? Number(v) : null;
|
|
364
|
+
const end = months && singleTerm.start ? addMonthsToIso(singleTerm.start, months) : singleTerm.end;
|
|
365
|
+
setSingleTerm({ ...singleTerm, months: v, end });
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
] })
|
|
370
|
+
] }),
|
|
371
|
+
step === "config-renew" && type === "renew" && isMergeRenew && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
372
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
|
|
373
|
+
"New contract details (merge of ",
|
|
374
|
+
pickedList.length,
|
|
375
|
+
" subscriptions):"
|
|
376
|
+
] }),
|
|
377
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
378
|
+
"Type a value into ",
|
|
379
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Months" }),
|
|
380
|
+
" to auto-fill both dates \u2014 start defaults to today, end is start + months."
|
|
381
|
+
] }),
|
|
382
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-3", children: [
|
|
383
|
+
/* @__PURE__ */ jsx(
|
|
384
|
+
DateInput,
|
|
385
|
+
{
|
|
386
|
+
label: "Start",
|
|
387
|
+
value: mergeTerm.start,
|
|
388
|
+
onChange: (v) => {
|
|
389
|
+
const months = mergeTerm.months ? Number(mergeTerm.months) : null;
|
|
390
|
+
const end = months && v ? addMonthsToIso(v, months) : mergeTerm.end;
|
|
391
|
+
setMergeTerm({ ...mergeTerm, start: v, end });
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
/* @__PURE__ */ jsx(
|
|
396
|
+
DateInput,
|
|
397
|
+
{
|
|
398
|
+
label: "End",
|
|
399
|
+
value: mergeTerm.end,
|
|
400
|
+
onChange: (v) => setMergeTerm({ ...mergeTerm, end: v })
|
|
401
|
+
}
|
|
402
|
+
),
|
|
403
|
+
/* @__PURE__ */ jsx(
|
|
404
|
+
NumberInput,
|
|
405
|
+
{
|
|
406
|
+
label: "Months",
|
|
407
|
+
value: mergeTerm.months,
|
|
408
|
+
onChange: (v) => {
|
|
409
|
+
const months = v ? Number(v) : null;
|
|
410
|
+
const start = mergeTerm.start || todayIso();
|
|
411
|
+
const end = months ? addMonthsToIso(start, months) : mergeTerm.end;
|
|
412
|
+
setMergeTerm({ ...mergeTerm, months: v, start, end });
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
] }),
|
|
417
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
418
|
+
/* @__PURE__ */ jsx(
|
|
419
|
+
TextInput,
|
|
420
|
+
{
|
|
421
|
+
label: "New contract code (optional \u2014 auto-generated if blank)",
|
|
422
|
+
value: mergeTerm.code,
|
|
423
|
+
onChange: (v) => setMergeTerm({ ...mergeTerm, code: v })
|
|
424
|
+
}
|
|
425
|
+
),
|
|
426
|
+
/* @__PURE__ */ jsx(
|
|
427
|
+
TextInput,
|
|
428
|
+
{
|
|
429
|
+
label: "New contract name (optional)",
|
|
430
|
+
value: mergeTerm.name,
|
|
431
|
+
onChange: (v) => setMergeTerm({ ...mergeTerm, name: v })
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
] })
|
|
435
|
+
] }),
|
|
436
|
+
step === "config-cancel" && type === "cancel" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
437
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "Reason for cancellation:" }),
|
|
438
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
439
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs text-muted-foreground", children: "Reason code" }),
|
|
440
|
+
/* @__PURE__ */ jsxs(
|
|
441
|
+
"select",
|
|
442
|
+
{
|
|
443
|
+
value: cancelMeta.reasonCode,
|
|
444
|
+
onChange: (e) => setCancelMeta({ ...cancelMeta, reasonCode: e.target.value }),
|
|
445
|
+
className: "w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm",
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "\u2014 pick one \u2014" }),
|
|
448
|
+
REASON_CODES.map((r) => /* @__PURE__ */ jsx("option", { value: r.value, children: r.label }, r.value))
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
] }),
|
|
453
|
+
/* @__PURE__ */ jsx(
|
|
454
|
+
TextInput,
|
|
455
|
+
{
|
|
456
|
+
label: "Free text (optional)",
|
|
457
|
+
value: cancelMeta.reasonText,
|
|
458
|
+
onChange: (v) => setCancelMeta({ ...cancelMeta, reasonText: v })
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
462
|
+
/* @__PURE__ */ jsx(
|
|
463
|
+
TextInput,
|
|
464
|
+
{
|
|
465
|
+
label: "ETF amount (optional)",
|
|
466
|
+
value: cancelMeta.etfAmount,
|
|
467
|
+
onChange: (v) => setCancelMeta({ ...cancelMeta, etfAmount: v })
|
|
468
|
+
}
|
|
469
|
+
),
|
|
470
|
+
/* @__PURE__ */ jsx(
|
|
471
|
+
TextInput,
|
|
472
|
+
{
|
|
473
|
+
label: "ETF currency",
|
|
474
|
+
value: cancelMeta.etfCurrency,
|
|
475
|
+
onChange: (v) => setCancelMeta({ ...cancelMeta, etfCurrency: v })
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
] })
|
|
479
|
+
] }),
|
|
480
|
+
step === "review" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
481
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "Review and submit:" }),
|
|
482
|
+
/* @__PURE__ */ jsxs("ul", { className: "text-sm space-y-1 list-disc pl-5", children: [
|
|
483
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
484
|
+
"Action: ",
|
|
485
|
+
type
|
|
486
|
+
] }),
|
|
487
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
488
|
+
"Targets: ",
|
|
489
|
+
pickedList.length
|
|
490
|
+
] }),
|
|
491
|
+
pickedList.map((s) => /* @__PURE__ */ jsxs("li", { className: "text-muted-foreground", children: [
|
|
492
|
+
s.code,
|
|
493
|
+
" \u2014 ",
|
|
494
|
+
s.name
|
|
495
|
+
] }, s.id)),
|
|
496
|
+
type === "renew" && !isMergeRenew && /* @__PURE__ */ jsxs("li", { children: [
|
|
497
|
+
"Term: ",
|
|
498
|
+
singleTerm.start,
|
|
499
|
+
" \u2192 ",
|
|
500
|
+
singleTerm.end,
|
|
501
|
+
singleTerm.months ? ` (${singleTerm.months}m)` : ""
|
|
502
|
+
] }),
|
|
503
|
+
type === "renew" && isMergeRenew && /* @__PURE__ */ jsxs("li", { children: [
|
|
504
|
+
"Merge term: ",
|
|
505
|
+
mergeTerm.start,
|
|
506
|
+
" \u2192 ",
|
|
507
|
+
mergeTerm.end,
|
|
508
|
+
mergeTerm.code ? ` \u2022 code=${mergeTerm.code}` : "",
|
|
509
|
+
mergeTerm.name ? ` \u2022 name=${mergeTerm.name}` : ""
|
|
510
|
+
] }),
|
|
511
|
+
type === "cancel" && /* @__PURE__ */ jsxs("li", { children: [
|
|
512
|
+
"Reason: ",
|
|
513
|
+
cancelMeta.reasonCode,
|
|
514
|
+
cancelMeta.etfAmount ? ` \u2022 ETF ${cancelMeta.etfAmount} ${cancelMeta.etfCurrency}` : ""
|
|
515
|
+
] })
|
|
516
|
+
] }),
|
|
517
|
+
/* @__PURE__ */ jsx(Alert, { variant: "warning", className: "text-xs", children: "Submitting locks the quote type. Lines will be edited on the host page after this completes." }),
|
|
518
|
+
submitError && /* @__PURE__ */ jsx(Alert, { variant: "destructive", className: "text-xs", children: submitError })
|
|
519
|
+
] }),
|
|
520
|
+
step === "submitting" && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Submitting\u2026" }),
|
|
521
|
+
step === "done" && /* @__PURE__ */ jsx("div", { className: "text-sm text-status-success-text", children: "Done \u2014 close to return to the quote." })
|
|
522
|
+
] }),
|
|
523
|
+
/* @__PURE__ */ jsxs("footer", { className: "border-t px-5 pt-3 pb-20 flex items-center justify-between", children: [
|
|
524
|
+
/* @__PURE__ */ jsx(
|
|
525
|
+
"button",
|
|
526
|
+
{
|
|
527
|
+
onClick: () => {
|
|
528
|
+
if (step === "pick-action") return;
|
|
529
|
+
if (step === "pick-targets") {
|
|
530
|
+
setStep(initialType === "new" ? "pick-action" : "pick-targets");
|
|
531
|
+
} else if (step === "config-renew" || step === "config-cancel") {
|
|
532
|
+
setStep("pick-targets");
|
|
533
|
+
} else if (step === "review") {
|
|
534
|
+
if (type === "renew") setStep("config-renew");
|
|
535
|
+
else if (type === "cancel") setStep("config-cancel");
|
|
536
|
+
else setStep("pick-targets");
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
disabled: step === "pick-action" || step === "submitting" || step === "done" || step === "pick-targets" && initialType !== "new",
|
|
540
|
+
className: "text-sm text-muted-foreground hover:text-foreground disabled:opacity-30",
|
|
541
|
+
children: "\u2190 Back"
|
|
542
|
+
}
|
|
543
|
+
),
|
|
544
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
545
|
+
/* @__PURE__ */ jsx(
|
|
546
|
+
"button",
|
|
547
|
+
{
|
|
548
|
+
onClick: onClose,
|
|
549
|
+
className: "rounded-md border border-input px-3 py-1.5 text-sm hover:bg-muted",
|
|
550
|
+
children: "Cancel"
|
|
551
|
+
}
|
|
552
|
+
),
|
|
553
|
+
step === "pick-targets" && /* @__PURE__ */ jsx(
|
|
554
|
+
"button",
|
|
555
|
+
{
|
|
556
|
+
disabled: !canProceedFromTargets || !editable,
|
|
557
|
+
onClick: () => {
|
|
558
|
+
if (type === "renew") setStep("config-renew");
|
|
559
|
+
else if (type === "cancel") setStep("config-cancel");
|
|
560
|
+
else setStep("review");
|
|
561
|
+
},
|
|
562
|
+
className: "rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground hover:bg-primary/90 disabled:opacity-50",
|
|
563
|
+
children: "Next"
|
|
564
|
+
}
|
|
565
|
+
),
|
|
566
|
+
(step === "config-renew" || step === "config-cancel") && /* @__PURE__ */ jsx(
|
|
567
|
+
"button",
|
|
568
|
+
{
|
|
569
|
+
disabled: step === "config-renew" && !canProceedFromRenew || step === "config-cancel" && !canProceedFromCancel,
|
|
570
|
+
onClick: () => setStep("review"),
|
|
571
|
+
className: "rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground hover:bg-primary/90 disabled:opacity-50",
|
|
572
|
+
children: "Next"
|
|
573
|
+
}
|
|
574
|
+
),
|
|
575
|
+
step === "review" && /* @__PURE__ */ jsx(
|
|
576
|
+
"button",
|
|
577
|
+
{
|
|
578
|
+
disabled: !editable,
|
|
579
|
+
onClick: submit,
|
|
580
|
+
className: "rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground hover:bg-primary/90 disabled:opacity-50",
|
|
581
|
+
children: "Submit"
|
|
582
|
+
}
|
|
583
|
+
),
|
|
584
|
+
step === "done" && /* @__PURE__ */ jsx(
|
|
585
|
+
"button",
|
|
586
|
+
{
|
|
587
|
+
onClick: onClose,
|
|
588
|
+
className: "rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground hover:bg-primary/90",
|
|
589
|
+
children: "Close"
|
|
590
|
+
}
|
|
591
|
+
)
|
|
592
|
+
] })
|
|
593
|
+
] })
|
|
594
|
+
] })
|
|
595
|
+
] });
|
|
596
|
+
}
|
|
597
|
+
function DateInput(props) {
|
|
598
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
599
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs text-muted-foreground mb-1", children: props.label }),
|
|
600
|
+
/* @__PURE__ */ jsx(
|
|
601
|
+
"input",
|
|
602
|
+
{
|
|
603
|
+
type: "date",
|
|
604
|
+
value: props.value,
|
|
605
|
+
onChange: (e) => props.onChange(e.target.value),
|
|
606
|
+
className: "w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm"
|
|
607
|
+
}
|
|
608
|
+
)
|
|
609
|
+
] });
|
|
610
|
+
}
|
|
611
|
+
function NumberInput(props) {
|
|
612
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
613
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs text-muted-foreground mb-1", children: props.label }),
|
|
614
|
+
/* @__PURE__ */ jsx(
|
|
615
|
+
BaseNumberInput,
|
|
616
|
+
{
|
|
617
|
+
integer: true,
|
|
618
|
+
min: 1,
|
|
619
|
+
value: props.value === "" ? null : Number(props.value),
|
|
620
|
+
onChange: (n) => props.onChange(n == null ? "" : String(n))
|
|
621
|
+
}
|
|
622
|
+
)
|
|
623
|
+
] });
|
|
624
|
+
}
|
|
625
|
+
function TextInput(props) {
|
|
626
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
627
|
+
/* @__PURE__ */ jsx("label", { className: "block text-xs text-muted-foreground mb-1", children: props.label }),
|
|
628
|
+
/* @__PURE__ */ jsx(
|
|
629
|
+
"input",
|
|
630
|
+
{
|
|
631
|
+
type: "text",
|
|
632
|
+
value: props.value,
|
|
633
|
+
onChange: (e) => props.onChange(e.target.value),
|
|
634
|
+
className: "w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm"
|
|
635
|
+
}
|
|
636
|
+
)
|
|
637
|
+
] });
|
|
638
|
+
}
|
|
639
|
+
function addMonthsToIso(iso, months) {
|
|
640
|
+
if (!iso) return iso;
|
|
641
|
+
const d = new Date(iso);
|
|
642
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
643
|
+
d.setMonth(d.getMonth() + months);
|
|
644
|
+
return d.toISOString().split("T")[0];
|
|
645
|
+
}
|
|
646
|
+
function todayIso() {
|
|
647
|
+
return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
648
|
+
}
|
|
649
|
+
export {
|
|
650
|
+
ArcQuoteConfigurator as default
|
|
651
|
+
};
|
|
652
|
+
//# sourceMappingURL=ArcQuoteConfigurator.js.map
|