@dainamite/cpq 0.4.0 → 0.6.0
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/MIGRATION.md +101 -0
- package/dist/modules/cpq/acl.js +1 -0
- package/dist/modules/cpq/acl.js.map +2 -2
- package/dist/modules/cpq/api/_helpers/adjustmentCommandRoute.js +45 -0
- package/dist/modules/cpq/api/_helpers/adjustmentCommandRoute.js.map +7 -0
- package/dist/modules/cpq/api/_helpers/handleArcError.js +2 -2
- package/dist/modules/cpq/api/_helpers/handleArcError.js.map +2 -2
- package/dist/modules/cpq/api/_helpers/quoteMutationGuard.js +23 -0
- package/dist/modules/cpq/api/_helpers/quoteMutationGuard.js.map +7 -0
- package/dist/modules/cpq/api/_helpers/quoteRouteOpenApi.js +19 -0
- package/dist/modules/cpq/api/_helpers/quoteRouteOpenApi.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js +2 -2
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js.map +2 -2
- package/dist/modules/cpq/api/orders/[orderId]/route.js +19 -3
- package/dist/modules/cpq/api/orders/[orderId]/route.js.map +2 -2
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js +2 -2
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js.map +2 -2
- package/dist/modules/cpq/api/orders/route.js +49 -4
- package/dist/modules/cpq/api/orders/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/restore/route.js +54 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/restore/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js +45 -5
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js +27 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/[adjustmentId]/route.js +47 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/[adjustmentId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/preview/route.js +30 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/preview/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/route.js +47 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/price-adjustments/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js +34 -4
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js +33 -2
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/price/route.js +43 -3
- package/dist/modules/cpq/api/quotes/price/route.js.map +2 -2
- package/dist/modules/cpq/api/quotes/route.js +2 -2
- package/dist/modules/cpq/api/quotes/route.js.map +2 -2
- package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js +1 -1
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js +22 -8
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js.map +2 -2
- package/dist/modules/cpq/backend/cpq/offerings/page.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js +89 -232
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js.map +2 -2
- package/dist/modules/cpq/backend/cpq/orders/page.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js +1 -1
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/price-rules/page.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/pricing/page.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentDialog.js +205 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentDialog.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentsPanel.js +79 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentsPanel.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/arcLineRemoval.js +53 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/arcLineRemoval.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/priceAdjustmentContext.js +107 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/priceAdjustmentContext.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/usePriceAdjustments.js +130 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/usePriceAdjustments.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js +144 -221
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js.map +3 -3
- package/dist/modules/cpq/backend/cpq/quotes/page.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js +1 -1
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/specifications/page.js.map +1 -1
- package/dist/modules/cpq/backend/cpq/wizards/page.js.map +1 -1
- package/dist/modules/cpq/ce.js +8 -0
- package/dist/modules/cpq/ce.js.map +2 -2
- package/dist/modules/cpq/cli.js +34 -1
- package/dist/modules/cpq/cli.js.map +2 -2
- package/dist/modules/cpq/commands/price-adjustments.js +107 -0
- package/dist/modules/cpq/commands/price-adjustments.js.map +7 -0
- package/dist/modules/cpq/components/ArcLineDiff.js +53 -0
- package/dist/modules/cpq/components/ArcLineDiff.js.map +7 -0
- package/dist/modules/cpq/components/ChargeBreakdownTable.js +154 -0
- package/dist/modules/cpq/components/ChargeBreakdownTable.js.map +7 -0
- package/dist/modules/cpq/components/CpqListView.js.map +2 -2
- package/dist/modules/cpq/components/PriceWaterfall.js +66 -0
- package/dist/modules/cpq/components/PriceWaterfall.js.map +7 -0
- package/dist/modules/cpq/components/PricingSummaryCard.js +117 -0
- package/dist/modules/cpq/components/PricingSummaryCard.js.map +7 -0
- package/dist/modules/cpq/components/useGrantedFeatures.js +27 -0
- package/dist/modules/cpq/components/useGrantedFeatures.js.map +7 -0
- package/dist/modules/cpq/data/entities.js +97 -0
- package/dist/modules/cpq/data/entities.js.map +2 -2
- package/dist/modules/cpq/data/price-adjustments.js +70 -0
- package/dist/modules/cpq/data/price-adjustments.js.map +7 -0
- package/dist/modules/cpq/data/validators.js +4 -0
- package/dist/modules/cpq/data/validators.js.map +2 -2
- package/dist/modules/cpq/di.js +6 -0
- package/dist/modules/cpq/di.js.map +2 -2
- package/dist/modules/cpq/events.js +47 -0
- package/dist/modules/cpq/events.js.map +2 -2
- package/dist/modules/cpq/index.js +1 -1
- package/dist/modules/cpq/index.js.map +2 -2
- package/dist/modules/cpq/lib/auditActor.js +10 -0
- package/dist/modules/cpq/lib/auditActor.js.map +7 -0
- package/dist/modules/cpq/lib/formatMoney.js +7 -0
- package/dist/modules/cpq/lib/formatMoney.js.map +7 -0
- package/dist/modules/cpq/lib/priceAdjustmentDefaults.js +60 -0
- package/dist/modules/cpq/lib/priceAdjustmentDefaults.js.map +7 -0
- package/dist/modules/cpq/lib/priceAdjustmentView.js +169 -0
- package/dist/modules/cpq/lib/priceAdjustmentView.js.map +7 -0
- package/dist/modules/cpq/lib/quotePermissions.js +13 -0
- package/dist/modules/cpq/lib/quotePermissions.js.map +7 -0
- package/dist/modules/cpq/lib/quoteSummaryView.js +28 -0
- package/dist/modules/cpq/lib/quoteSummaryView.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20261110213052.js +22 -0
- package/dist/modules/cpq/migrations/Migration20261110213052.js.map +7 -0
- package/dist/modules/cpq/services/arcLineRemoval.js +53 -0
- package/dist/modules/cpq/services/arcLineRemoval.js.map +7 -0
- package/dist/modules/cpq/services/arcPriceFreeze.js +79 -0
- package/dist/modules/cpq/services/arcPriceFreeze.js.map +7 -0
- package/dist/modules/cpq/services/cpqOrderService.js +34 -30
- package/dist/modules/cpq/services/cpqOrderService.js.map +2 -2
- package/dist/modules/cpq/services/cpqPricingService.js +7 -0
- package/dist/modules/cpq/services/cpqPricingService.js.map +2 -2
- package/dist/modules/cpq/services/cpqQuotingService.js +339 -111
- package/dist/modules/cpq/services/cpqQuotingService.js.map +2 -2
- package/dist/modules/cpq/services/orderPricingSummary.js +26 -0
- package/dist/modules/cpq/services/orderPricingSummary.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/adjustmentService.js +264 -0
- package/dist/modules/cpq/services/priceAdjustments/adjustmentService.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/chargeWaterfall.js +25 -0
- package/dist/modules/cpq/services/priceAdjustments/chargeWaterfall.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/loadQuoteAdjustments.js +38 -0
- package/dist/modules/cpq/services/priceAdjustments/loadQuoteAdjustments.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/pricingSnapshot.js +104 -0
- package/dist/modules/cpq/services/priceAdjustments/pricingSnapshot.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/quoteAdjustmentLifecycle.js +102 -0
- package/dist/modules/cpq/services/priceAdjustments/quoteAdjustmentLifecycle.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/quotePricingEvents.js +52 -0
- package/dist/modules/cpq/services/priceAdjustments/quotePricingEvents.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/quotePricingWrite.js +37 -0
- package/dist/modules/cpq/services/priceAdjustments/quotePricingWrite.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/resolveManualAdjustments.js +107 -0
- package/dist/modules/cpq/services/priceAdjustments/resolveManualAdjustments.js.map +7 -0
- package/dist/modules/cpq/services/priceAdjustments/storedAdjustmentFailure.js +30 -0
- package/dist/modules/cpq/services/priceAdjustments/storedAdjustmentFailure.js.map +7 -0
- package/dist/modules/cpq/services/types.js.map +2 -2
- package/dist/modules/cpq/setup.js +6 -0
- package/dist/modules/cpq/setup.js.map +2 -2
- package/package.json +9 -9
- package/src/modules/cpq/__integration__/TC-CPQ-002.spec.ts +8 -5
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-012.spec.ts +134 -0
- package/src/modules/cpq/acl.ts +1 -0
- package/src/modules/cpq/api/__tests__/adjustmentRoutes.test.ts +79 -0
- package/src/modules/cpq/api/__tests__/quoteWriteGuards.test.ts +100 -0
- package/src/modules/cpq/api/_helpers/__tests__/quoteMutationGuard.test.ts +48 -0
- package/src/modules/cpq/api/_helpers/adjustmentCommandRoute.ts +45 -0
- package/src/modules/cpq/api/_helpers/handleArcError.ts +12 -12
- package/src/modules/cpq/api/_helpers/quoteMutationGuard.ts +38 -0
- package/src/modules/cpq/api/_helpers/quoteRouteOpenApi.ts +19 -0
- package/src/modules/cpq/api/orders/[orderId]/activate/route.ts +2 -2
- package/src/modules/cpq/api/orders/[orderId]/route.ts +20 -2
- package/src/modules/cpq/api/orders/[orderId]/status/route.ts +2 -2
- package/src/modules/cpq/api/orders/route.ts +53 -3
- package/src/modules/cpq/api/quotes/[quoteId]/clone/route.ts +2 -2
- package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/restore/route.ts +56 -0
- package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.ts +51 -4
- package/src/modules/cpq/api/quotes/[quoteId]/items/route.ts +31 -1
- package/src/modules/cpq/api/quotes/[quoteId]/price-adjustments/[adjustmentId]/route.ts +39 -0
- package/src/modules/cpq/api/quotes/[quoteId]/price-adjustments/preview/route.ts +24 -0
- package/src/modules/cpq/api/quotes/[quoteId]/price-adjustments/route.ts +40 -0
- package/src/modules/cpq/api/quotes/[quoteId]/recalculate/__tests__/route.test.ts +95 -0
- package/src/modules/cpq/api/quotes/[quoteId]/recalculate/route.ts +42 -3
- package/src/modules/cpq/api/quotes/[quoteId]/route.ts +2 -2
- package/src/modules/cpq/api/quotes/[quoteId]/status/__tests__/route.test.ts +74 -0
- package/src/modules/cpq/api/quotes/[quoteId]/status/route.ts +37 -1
- package/src/modules/cpq/api/quotes/price/__tests__/route.test.ts +37 -0
- package/src/modules/cpq/api/quotes/price/route.ts +28 -2
- package/src/modules/cpq/api/quotes/route.ts +2 -2
- package/src/modules/cpq/backend/cpq/inventory/AssetsTable.tsx +1 -1
- package/src/modules/cpq/backend/cpq/inventory/SubscriptionsTable.tsx +1 -1
- package/src/modules/cpq/backend/cpq/inventory/page.meta.ts +1 -1
- package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.tsx +32 -10
- package/src/modules/cpq/backend/cpq/offerings/page.tsx +1 -1
- package/src/modules/cpq/backend/cpq/orders/[id]/page.tsx +60 -269
- package/src/modules/cpq/backend/cpq/orders/page.meta.ts +1 -1
- package/src/modules/cpq/backend/cpq/orders/page.tsx +1 -1
- package/src/modules/cpq/backend/cpq/price-rules/page.tsx +1 -1
- package/src/modules/cpq/backend/cpq/pricing/page.tsx +1 -1
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentDialog.tsx +260 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/PriceAdjustmentsPanel.tsx +124 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/__tests__/PriceAdjustmentsPanel.test.tsx +76 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/arcLineRemoval.tsx +76 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/priceAdjustmentContext.tsx +133 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/usePriceAdjustments.tsx +165 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/page.tsx +178 -266
- package/src/modules/cpq/backend/cpq/quotes/page.meta.ts +1 -1
- package/src/modules/cpq/backend/cpq/quotes/page.tsx +1 -1
- package/src/modules/cpq/backend/cpq/specifications/page.tsx +1 -1
- package/src/modules/cpq/backend/cpq/wizards/page.tsx +1 -1
- package/src/modules/cpq/ce.ts +8 -0
- package/src/modules/cpq/cli.ts +48 -1
- package/src/modules/cpq/commands/__tests__/price-adjustments.test.ts +54 -0
- package/src/modules/cpq/commands/price-adjustments.ts +90 -0
- package/src/modules/cpq/components/ArcLineDiff.tsx +87 -0
- package/src/modules/cpq/components/ChargeBreakdownTable.tsx +201 -0
- package/src/modules/cpq/components/CpqListView.tsx +2 -1
- package/src/modules/cpq/components/PriceWaterfall.tsx +94 -0
- package/src/modules/cpq/components/PricingSummaryCard.tsx +128 -0
- package/src/modules/cpq/components/__tests__/PriceWaterfall.test.tsx +38 -0
- package/src/modules/cpq/components/useGrantedFeatures.ts +35 -0
- package/src/modules/cpq/data/__tests__/price-adjustment-migration.test.ts +11 -0
- package/src/modules/cpq/data/__tests__/price-adjustments.test.ts +26 -0
- package/src/modules/cpq/data/entities.ts +83 -0
- package/src/modules/cpq/data/price-adjustments.ts +67 -0
- package/src/modules/cpq/data/validators.ts +3 -0
- package/src/modules/cpq/di.ts +6 -0
- package/src/modules/cpq/events.ts +53 -2
- package/src/modules/cpq/index.ts +1 -1
- package/src/modules/cpq/lib/__tests__/auditActor.test.ts +12 -0
- package/src/modules/cpq/lib/__tests__/priceAdjustmentDefaults.test.ts +37 -0
- package/src/modules/cpq/lib/__tests__/priceAdjustmentView.test.ts +152 -0
- package/src/modules/cpq/lib/__tests__/quotePermissions.test.ts +30 -0
- package/src/modules/cpq/lib/__tests__/quoteSummaryView.test.ts +56 -0
- package/src/modules/cpq/lib/auditActor.ts +13 -0
- package/src/modules/cpq/lib/formatMoney.ts +4 -0
- package/src/modules/cpq/lib/priceAdjustmentDefaults.ts +36 -0
- package/src/modules/cpq/lib/priceAdjustmentView.ts +259 -0
- package/src/modules/cpq/lib/quotePermissions.ts +22 -0
- package/src/modules/cpq/lib/quoteSummaryView.ts +51 -0
- package/src/modules/cpq/migrations/.snapshot-open-mercato.json +3298 -2423
- package/src/modules/cpq/migrations/Migration20261110213052.ts +22 -0
- package/src/modules/cpq/services/__tests__/_helpers/mockEm.ts +9 -2
- package/src/modules/cpq/services/__tests__/adjustmentService.test.ts +183 -0
- package/src/modules/cpq/services/__tests__/arcLineRemoval.test.ts +109 -0
- package/src/modules/cpq/services/__tests__/arcPriceFreeze.test.ts +141 -0
- package/src/modules/cpq/services/__tests__/chargeWaterfall.test.ts +28 -0
- package/src/modules/cpq/services/__tests__/cpqOrderService.test.ts +35 -2
- package/src/modules/cpq/services/__tests__/cpqPricingService.test.ts +57 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.arc.test.ts +237 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.test.ts +58 -3
- package/src/modules/cpq/services/__tests__/errorBrands.test.ts +72 -0
- package/src/modules/cpq/services/__tests__/orderPricingSummary.test.ts +50 -0
- package/src/modules/cpq/services/__tests__/pricingSnapshot.test.ts +62 -0
- package/src/modules/cpq/services/__tests__/quoteAdjustmentLifecycle.test.ts +35 -0
- package/src/modules/cpq/services/__tests__/quoteAdjustmentPricing.test.ts +65 -0
- package/src/modules/cpq/services/__tests__/quoteCloneAdjustments.test.ts +45 -0
- package/src/modules/cpq/services/__tests__/quoteDetachTargetAdjustments.test.ts +54 -0
- package/src/modules/cpq/services/__tests__/quoteEventsService.test.ts +72 -0
- package/src/modules/cpq/services/__tests__/quotePricingEvents.test.ts +126 -0
- package/src/modules/cpq/services/__tests__/quotePricingIsolation.test.ts +52 -0
- package/src/modules/cpq/services/__tests__/quotePricingWrite.test.ts +74 -0
- package/src/modules/cpq/services/__tests__/resolveManualAdjustments.test.ts +90 -0
- package/src/modules/cpq/services/__tests__/storedAdjustmentFailure.test.ts +9 -0
- package/src/modules/cpq/services/arcLineRemoval.ts +87 -0
- package/src/modules/cpq/services/arcPriceFreeze.ts +165 -0
- package/src/modules/cpq/services/cpqOrderService.ts +32 -28
- package/src/modules/cpq/services/cpqPricingService.ts +8 -0
- package/src/modules/cpq/services/cpqQuotingService.ts +388 -125
- package/src/modules/cpq/services/orderPricingSummary.ts +47 -0
- package/src/modules/cpq/services/priceAdjustments/adjustmentService.ts +249 -0
- package/src/modules/cpq/services/priceAdjustments/chargeWaterfall.ts +28 -0
- package/src/modules/cpq/services/priceAdjustments/loadQuoteAdjustments.ts +25 -0
- package/src/modules/cpq/services/priceAdjustments/pricingSnapshot.ts +86 -0
- package/src/modules/cpq/services/priceAdjustments/quoteAdjustmentLifecycle.ts +68 -0
- package/src/modules/cpq/services/priceAdjustments/quotePricingEvents.ts +94 -0
- package/src/modules/cpq/services/priceAdjustments/quotePricingWrite.ts +51 -0
- package/src/modules/cpq/services/priceAdjustments/resolveManualAdjustments.ts +116 -0
- package/src/modules/cpq/services/priceAdjustments/storedAdjustmentFailure.ts +31 -0
- package/src/modules/cpq/services/types.ts +34 -1
- package/src/modules/cpq/setup.ts +7 -1
|
@@ -12,23 +12,20 @@ import {
|
|
|
12
12
|
orderCpqStatusMap
|
|
13
13
|
} from "../../../../components/statusMaps.js";
|
|
14
14
|
import { StatusPath } from "../../../../components/StatusPath.js";
|
|
15
|
+
import { ChargeBreakdownTable } from "../../../../components/ChargeBreakdownTable.js";
|
|
16
|
+
import { PricingSummaryCard } from "../../../../components/PricingSummaryCard.js";
|
|
17
|
+
import { ArcLineDiff, LineActionBadge } from "../../../../components/ArcLineDiff.js";
|
|
18
|
+
import { arcRecurringDelta } from "../../../../lib/quoteSummaryView.js";
|
|
19
|
+
import { isArcCancelledLine } from "../../../../services/arcLineRemoval.js";
|
|
20
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
21
|
+
function toChargeRow(c) {
|
|
22
|
+
return { ...c, chargeName: c.chargeName ?? "\u2014", chargeType: c.chargeType ?? "mrc", unitPrice: c.unitPrice ?? 0, totalPrice: c.totalPrice ?? null };
|
|
23
|
+
}
|
|
15
24
|
const ARC_BADGE_VARIANTS = {
|
|
16
25
|
amend: "brand",
|
|
17
26
|
renew: "success",
|
|
18
27
|
cancel: "error"
|
|
19
28
|
};
|
|
20
|
-
const RULE_TYPE_LABELS = {
|
|
21
|
-
discount_percent: "% discount",
|
|
22
|
-
discount_absolute: "fixed discount",
|
|
23
|
-
surcharge_percent: "% surcharge",
|
|
24
|
-
surcharge_absolute: "fixed surcharge",
|
|
25
|
-
price_override: "override"
|
|
26
|
-
};
|
|
27
|
-
function fmtRuleValue(adj, currency) {
|
|
28
|
-
if (adj.ruleType === "discount_percent" || adj.ruleType === "surcharge_percent") return `${adj.value}%`;
|
|
29
|
-
if (currency) return fmt(adj.value, currency);
|
|
30
|
-
return String(adj.value);
|
|
31
|
-
}
|
|
32
29
|
function fmt(amount, currency) {
|
|
33
30
|
return new Intl.NumberFormat("en-US", { style: "currency", currency }).format(amount);
|
|
34
31
|
}
|
|
@@ -277,23 +274,19 @@ function CpqOrderDetailPage(props) {
|
|
|
277
274
|
/* @__PURE__ */ jsx(MetaCard, { label: "Created", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: new Date(order.createdAt).toLocaleDateString() }) }),
|
|
278
275
|
/* @__PURE__ */ jsx(MetaCard, { label: "Currency", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: currency }) })
|
|
279
276
|
] }),
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Monthly Recurring (MRC)" }),
|
|
289
|
-
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold font-mono", children: fmt(order.pricingSummary.mrcTotal, currency) })
|
|
290
|
-
] })
|
|
291
|
-
] })
|
|
292
|
-
] }),
|
|
277
|
+
/* @__PURE__ */ jsx(
|
|
278
|
+
PricingSummaryCard,
|
|
279
|
+
{
|
|
280
|
+
summary: order.pricingSummary,
|
|
281
|
+
currency,
|
|
282
|
+
arcDelta: order.quoteType === "amend" || order.quoteType === "renew" ? arcRecurringDelta(order.lines.map((l) => ({ ...l, action: l.action }))) : null
|
|
283
|
+
}
|
|
284
|
+
),
|
|
293
285
|
/* @__PURE__ */ jsx(
|
|
294
286
|
OrderLineTree,
|
|
295
287
|
{
|
|
296
288
|
lines: order.lines,
|
|
289
|
+
quoteType: order.quoteType,
|
|
297
290
|
currency,
|
|
298
291
|
expandedLines,
|
|
299
292
|
pricingDetail,
|
|
@@ -311,6 +304,7 @@ function MetaCard({ label, children }) {
|
|
|
311
304
|
}
|
|
312
305
|
function OrderLineTree({
|
|
313
306
|
lines,
|
|
307
|
+
quoteType,
|
|
314
308
|
currency,
|
|
315
309
|
expandedLines,
|
|
316
310
|
pricingDetail,
|
|
@@ -345,6 +339,7 @@ function OrderLineTree({
|
|
|
345
339
|
{
|
|
346
340
|
line,
|
|
347
341
|
lineIdx,
|
|
342
|
+
quoteType,
|
|
348
343
|
currency,
|
|
349
344
|
isExpanded,
|
|
350
345
|
isBundle,
|
|
@@ -368,6 +363,7 @@ function OrderLineTree({
|
|
|
368
363
|
{
|
|
369
364
|
line: child,
|
|
370
365
|
lineIdx: childIdx,
|
|
366
|
+
quoteType,
|
|
371
367
|
currency,
|
|
372
368
|
isExpanded: expandedLines.has(child.lineId),
|
|
373
369
|
isBundle: false,
|
|
@@ -385,26 +381,37 @@ function OrderLineTree({
|
|
|
385
381
|
}) })
|
|
386
382
|
] });
|
|
387
383
|
}
|
|
388
|
-
function OrderLineRow({ line, lineIdx, currency, isExpanded, isBundle, childCount, indent, pricingDetail, onToggle, onTogglePricingDetail }) {
|
|
384
|
+
function OrderLineRow({ line, lineIdx, quoteType, currency, isExpanded, isBundle, childCount, indent, pricingDetail, onToggle, onTogglePricingDetail }) {
|
|
385
|
+
const t = useT();
|
|
389
386
|
const paddingLeft = indent > 0 ? `${indent * 2 + 1}rem` : void 0;
|
|
387
|
+
const isRemoved = isArcCancelledLine(line, quoteType);
|
|
390
388
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
391
389
|
/* @__PURE__ */ jsxs(
|
|
392
390
|
"div",
|
|
393
391
|
{
|
|
394
|
-
className:
|
|
392
|
+
className: `flex items-center gap-3 px-4 py-3 hover:bg-muted/30 transition-colors cursor-pointer ${isRemoved ? "bg-muted/20" : ""}`,
|
|
395
393
|
style: paddingLeft ? { paddingLeft } : void 0,
|
|
396
394
|
onClick: onToggle,
|
|
395
|
+
"data-testid": "cpq-order-line",
|
|
396
|
+
"data-removed": isRemoved ? "true" : void 0,
|
|
397
397
|
children: [
|
|
398
398
|
/* @__PURE__ */ jsx("button", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground", children: /* @__PURE__ */ jsx("svg", { className: `h-4 w-4 transition-transform ${isExpanded ? "rotate-90" : ""}`, fill: "none", viewBox: "0 0 24 24", strokeWidth: "2", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 4.5l7.5 7.5-7.5 7.5" }) }) }),
|
|
399
399
|
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
400
400
|
indent > 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: "\u2514" }),
|
|
401
401
|
isBundle && /* @__PURE__ */ jsx(Tag, { variant: "brand", className: "px-1.5 text-xs", children: "bundle" }),
|
|
402
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
402
|
+
/* @__PURE__ */ jsx("span", { className: `font-medium text-sm ${isRemoved ? "text-muted-foreground line-through" : ""}`, children: line.offeringName }),
|
|
403
403
|
line.quantity > 1 && /* @__PURE__ */ jsxs("span", { className: "rounded bg-muted px-1.5 py-0.5 text-xs font-medium", children: [
|
|
404
404
|
"\xD7",
|
|
405
405
|
line.quantity
|
|
406
406
|
] }),
|
|
407
|
-
/* @__PURE__ */ jsx(
|
|
407
|
+
/* @__PURE__ */ jsx(
|
|
408
|
+
LineActionBadge,
|
|
409
|
+
{
|
|
410
|
+
action: line.action,
|
|
411
|
+
label: isRemoved ? t("cpq.quotes.arc.lineRemoved", "remove") : void 0,
|
|
412
|
+
title: isRemoved ? t("cpq.quotes.arc.lineRemovedHint", "This item is cancelled on the subscription when the order is activated") : void 0
|
|
413
|
+
}
|
|
414
|
+
),
|
|
408
415
|
isBundle && /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
409
416
|
childCount,
|
|
410
417
|
" component",
|
|
@@ -412,6 +419,10 @@ function OrderLineRow({ line, lineIdx, currency, isExpanded, isBundle, childCoun
|
|
|
412
419
|
] })
|
|
413
420
|
] }) }),
|
|
414
421
|
/* @__PURE__ */ jsxs("div", { className: "shrink-0 text-right text-xs space-y-0.5", children: [
|
|
422
|
+
isRemoved && line.arcSource && line.arcSource.mrcAmount > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
423
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "MRC " }),
|
|
424
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-muted-foreground line-through", children: fmt(line.arcSource.mrcAmount, currency) })
|
|
425
|
+
] }),
|
|
415
426
|
line.nrcTotal > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
416
427
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "NRC " }),
|
|
417
428
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium", children: fmt(line.nrcTotal, currency) })
|
|
@@ -425,7 +436,7 @@ function OrderLineRow({ line, lineIdx, currency, isExpanded, isBundle, childCoun
|
|
|
425
436
|
}
|
|
426
437
|
),
|
|
427
438
|
isExpanded && (() => {
|
|
428
|
-
const internalKeys = /* @__PURE__ */ new Set(["_arcMirroredName", "_arcMirroredFromItemId", "offeringName"]);
|
|
439
|
+
const internalKeys = /* @__PURE__ */ new Set(["_arcMirroredName", "_arcMirroredFromItemId", "_arcPriceFrozen", "_arcRepriced", "offeringName"]);
|
|
429
440
|
const visibleConfigEntries = Object.entries(line.configuration).filter(
|
|
430
441
|
([key]) => !internalKeys.has(key)
|
|
431
442
|
);
|
|
@@ -435,174 +446,68 @@ function OrderLineRow({ line, lineIdx, currency, isExpanded, isBundle, childCoun
|
|
|
435
446
|
const hasArcDiff = !!line.arcSource;
|
|
436
447
|
const mirroredFromItemId = line.configuration?._arcMirroredFromItemId ?? null;
|
|
437
448
|
const isEmpty = !hasConfig && !hasCharges && !hasTerm && !hasArcDiff;
|
|
438
|
-
return /* @__PURE__ */
|
|
449
|
+
return /* @__PURE__ */ jsx(
|
|
439
450
|
"div",
|
|
440
451
|
{
|
|
441
452
|
className: "border-t bg-muted/10 px-12 py-3 space-y-3",
|
|
442
453
|
style: paddingLeft ? { paddingLeft: `calc(${paddingLeft} + 2rem)` } : void 0,
|
|
443
|
-
children: [
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
454
|
+
children: isEmpty ? /* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground space-y-1", children: [
|
|
455
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
456
|
+
"No detailed breakdown for this line.",
|
|
457
|
+
mirroredFromItemId && " Mirrored from existing subscription item."
|
|
458
|
+
] }),
|
|
459
|
+
(line.nrcTotal > 0 || line.mrcTotal > 0) && /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
460
|
+
line.nrcTotal > 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
461
|
+
"NRC ",
|
|
462
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-foreground", children: fmt(line.nrcTotal, currency) })
|
|
449
463
|
] }),
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-foreground", children: fmt(line.nrcTotal, currency) })
|
|
454
|
-
] }),
|
|
455
|
-
line.mrcTotal > 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
456
|
-
"MRC ",
|
|
457
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-foreground", children: fmt(line.mrcTotal, currency) })
|
|
458
|
-
] })
|
|
464
|
+
line.mrcTotal > 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
465
|
+
"MRC ",
|
|
466
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono font-medium text-foreground", children: fmt(line.mrcTotal, currency) })
|
|
459
467
|
] })
|
|
460
|
-
] })
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
468
|
+
] })
|
|
469
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
470
|
+
hasConfig && /* @__PURE__ */ jsxs("div", { children: [
|
|
471
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1", children: "Configuration" }),
|
|
472
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 gap-x-4 gap-y-1", children: visibleConfigEntries.map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "text-xs", children: [
|
|
473
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
474
|
+
key,
|
|
475
|
+
": "
|
|
476
|
+
] }),
|
|
477
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: String(value) })
|
|
478
|
+
] }, key)) })
|
|
479
|
+
] }),
|
|
480
|
+
hasCharges && /* @__PURE__ */ jsx(
|
|
481
|
+
ChargeBreakdownTable,
|
|
482
|
+
{
|
|
483
|
+
charges: line.charges.map(toChargeRow),
|
|
484
|
+
currency,
|
|
485
|
+
openDetailIndex: pricingDetail?.lineIdx === lineIdx ? pricingDetail.chargeIdx : null,
|
|
486
|
+
onToggleDetail: (chargeIdx) => onTogglePricingDetail(lineIdx, chargeIdx)
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
hasTerm && /* @__PURE__ */ jsxs("div", { className: "flex gap-4 text-xs text-muted-foreground", children: [
|
|
490
|
+
line.startDate && /* @__PURE__ */ jsxs("span", { children: [
|
|
491
|
+
"Start: ",
|
|
492
|
+
new Date(line.startDate).toLocaleDateString()
|
|
470
493
|
] }),
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
{
|
|
476
|
-
line,
|
|
477
|
-
lineIdx,
|
|
478
|
-
currency,
|
|
479
|
-
pricingDetail,
|
|
480
|
-
onTogglePricingDetail
|
|
481
|
-
}
|
|
482
|
-
)
|
|
494
|
+
line.termMonths && /* @__PURE__ */ jsxs("span", { children: [
|
|
495
|
+
"Term: ",
|
|
496
|
+
line.termMonths,
|
|
497
|
+
"mo"
|
|
483
498
|
] }),
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
new Date(line.startDate).toLocaleDateString()
|
|
488
|
-
] }),
|
|
489
|
-
line.termMonths && /* @__PURE__ */ jsxs("span", { children: [
|
|
490
|
-
"Term: ",
|
|
491
|
-
line.termMonths,
|
|
492
|
-
"mo"
|
|
493
|
-
] }),
|
|
494
|
-
line.endDate && /* @__PURE__ */ jsxs("span", { children: [
|
|
495
|
-
"End: ",
|
|
496
|
-
new Date(line.endDate).toLocaleDateString()
|
|
497
|
-
] })
|
|
499
|
+
line.endDate && /* @__PURE__ */ jsxs("span", { children: [
|
|
500
|
+
"End: ",
|
|
501
|
+
new Date(line.endDate).toLocaleDateString()
|
|
498
502
|
] })
|
|
499
|
-
] })
|
|
500
|
-
|
|
503
|
+
] }),
|
|
504
|
+
hasArcDiff && /* @__PURE__ */ jsx(ArcLineDiff, { line, currency })
|
|
505
|
+
] })
|
|
501
506
|
}
|
|
502
507
|
);
|
|
503
508
|
})()
|
|
504
509
|
] });
|
|
505
510
|
}
|
|
506
|
-
function ChargeBreakdown({ line, lineIdx, currency, pricingDetail, onTogglePricingDetail }) {
|
|
507
|
-
return /* @__PURE__ */ jsxs("table", { className: "w-full text-xs", children: [
|
|
508
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
509
|
-
/* @__PURE__ */ jsx("th", { className: "text-left py-1 font-medium", children: "Charge" }),
|
|
510
|
-
/* @__PURE__ */ jsx("th", { className: "text-left py-1 font-medium", children: "Type" }),
|
|
511
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-1 font-medium", children: "Unit Price" }),
|
|
512
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-1 font-medium", children: "Qty" }),
|
|
513
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-1 font-medium", children: "Total" }),
|
|
514
|
-
/* @__PURE__ */ jsx("th", { className: "w-8" })
|
|
515
|
-
] }) }),
|
|
516
|
-
/* @__PURE__ */ jsx("tbody", { children: line.charges.map((c, i) => {
|
|
517
|
-
const hasDetail = !!(c.breakdown?.tiers?.length || c.adjustments?.length);
|
|
518
|
-
const isDetailOpen = pricingDetail?.lineIdx === lineIdx && pricingDetail?.chargeIdx === i;
|
|
519
|
-
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
520
|
-
/* @__PURE__ */ jsxs("tr", { className: "border-t border-dashed border-border/50", children: [
|
|
521
|
-
/* @__PURE__ */ jsx("td", { className: "py-1", children: c.chargeName ?? "\u2014" }),
|
|
522
|
-
/* @__PURE__ */ jsx("td", { className: "py-1 uppercase", children: c.chargeType ?? "\u2014" }),
|
|
523
|
-
/* @__PURE__ */ jsx("td", { className: "py-1 text-right font-mono", children: c.unitPrice != null ? fmt(c.unitPrice, currency) : "\u2014" }),
|
|
524
|
-
/* @__PURE__ */ jsx("td", { className: "py-1 text-right font-mono", children: c.quantity ?? "\u2014" }),
|
|
525
|
-
/* @__PURE__ */ jsx("td", { className: "py-1 text-right font-mono", children: c.totalPrice != null ? fmt(c.totalPrice, currency) : c.note ?? "\u2014" }),
|
|
526
|
-
/* @__PURE__ */ jsx("td", { className: "py-1 text-center", children: hasDetail && /* @__PURE__ */ jsx(
|
|
527
|
-
"button",
|
|
528
|
-
{
|
|
529
|
-
onClick: () => onTogglePricingDetail(lineIdx, i),
|
|
530
|
-
className: "inline-flex items-center justify-center rounded p-0.5 hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",
|
|
531
|
-
title: "Show pricing breakdown",
|
|
532
|
-
children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) })
|
|
533
|
-
}
|
|
534
|
-
) })
|
|
535
|
-
] }),
|
|
536
|
-
isDetailOpen && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 6, className: "pb-3 pt-1", children: /* @__PURE__ */ jsxs("div", { className: "rounded border bg-background p-3 space-y-3 text-xs", children: [
|
|
537
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
538
|
-
/* @__PURE__ */ jsxs("span", { className: "font-semibold text-sm", children: [
|
|
539
|
-
"Pricing Details \u2014 ",
|
|
540
|
-
c.chargeName
|
|
541
|
-
] }),
|
|
542
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: c.pricingMethod ?? "flat" })
|
|
543
|
-
] }),
|
|
544
|
-
c.breakdown?.tiers && c.breakdown.tiers.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
545
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium text-muted-foreground mb-1", children: "Tier Breakdown" }),
|
|
546
|
-
/* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
547
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
548
|
-
/* @__PURE__ */ jsx("th", { className: "text-left py-0.5 font-medium", children: "Tier" }),
|
|
549
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Range" }),
|
|
550
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Price/Unit" }),
|
|
551
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Qty" }),
|
|
552
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Subtotal" })
|
|
553
|
-
] }) }),
|
|
554
|
-
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
555
|
-
c.breakdown.tiers.map((t) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-border/30", children: [
|
|
556
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5", children: t.tier }),
|
|
557
|
-
/* @__PURE__ */ jsxs("td", { className: "py-0.5 text-right font-mono", children: [
|
|
558
|
-
t.from,
|
|
559
|
-
"\u2013",
|
|
560
|
-
t.to
|
|
561
|
-
] }),
|
|
562
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(t.pricePerUnit, currency) }),
|
|
563
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: t.quantity }),
|
|
564
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(t.subtotal, currency) })
|
|
565
|
-
] }, t.tier)),
|
|
566
|
-
/* @__PURE__ */ jsxs("tr", { className: "border-t font-medium", children: [
|
|
567
|
-
/* @__PURE__ */ jsx("td", { colSpan: 4, className: "py-0.5 text-right", children: "Tiered Total" }),
|
|
568
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(c.breakdown.tiers.reduce((s, t) => s + t.subtotal, 0), currency) })
|
|
569
|
-
] })
|
|
570
|
-
] })
|
|
571
|
-
] })
|
|
572
|
-
] }),
|
|
573
|
-
c.adjustments && c.adjustments.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
574
|
-
/* @__PURE__ */ jsx("div", { className: "font-medium text-muted-foreground mb-1", children: "Applied Price Rules" }),
|
|
575
|
-
/* @__PURE__ */ jsxs("table", { className: "w-full", children: [
|
|
576
|
-
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
577
|
-
/* @__PURE__ */ jsx("th", { className: "text-left py-0.5 font-medium", children: "Rule" }),
|
|
578
|
-
/* @__PURE__ */ jsx("th", { className: "text-left py-0.5 font-medium", children: "Type" }),
|
|
579
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Value" }),
|
|
580
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Before" }),
|
|
581
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "After" }),
|
|
582
|
-
/* @__PURE__ */ jsx("th", { className: "text-right py-0.5 font-medium", children: "Delta" })
|
|
583
|
-
] }) }),
|
|
584
|
-
/* @__PURE__ */ jsx("tbody", { children: c.adjustments.map((adj, ai) => /* @__PURE__ */ jsxs("tr", { className: "border-t border-border/30", children: [
|
|
585
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5", children: adj.ruleName }),
|
|
586
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5", children: RULE_TYPE_LABELS[adj.ruleType] ?? adj.ruleType }),
|
|
587
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmtRuleValue(adj, currency) }),
|
|
588
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(adj.unitPriceBefore, currency) }),
|
|
589
|
-
/* @__PURE__ */ jsx("td", { className: "py-0.5 text-right font-mono", children: fmt(adj.unitPriceAfter, currency) }),
|
|
590
|
-
/* @__PURE__ */ jsxs("td", { className: `py-0.5 text-right font-mono ${adj.delta < 0 ? "text-destructive" : adj.delta > 0 ? "text-status-success-text" : ""}`, children: [
|
|
591
|
-
adj.delta > 0 ? "+" : "",
|
|
592
|
-
fmt(adj.delta, currency)
|
|
593
|
-
] })
|
|
594
|
-
] }, ai)) })
|
|
595
|
-
] })
|
|
596
|
-
] }),
|
|
597
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-1 border-t text-sm font-semibold", children: [
|
|
598
|
-
/* @__PURE__ */ jsx("span", { children: "Final Total" }),
|
|
599
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono", children: c.totalPrice != null ? fmt(c.totalPrice, currency) : "\u2014" })
|
|
600
|
-
] })
|
|
601
|
-
] }) }) })
|
|
602
|
-
] }, i);
|
|
603
|
-
}) })
|
|
604
|
-
] });
|
|
605
|
-
}
|
|
606
511
|
function Spinner() {
|
|
607
512
|
return /* @__PURE__ */ jsxs("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", children: [
|
|
608
513
|
/* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
@@ -623,54 +528,6 @@ function ErrorBanner({ message, onDismiss }) {
|
|
|
623
528
|
)
|
|
624
529
|
] });
|
|
625
530
|
}
|
|
626
|
-
function ArcLineDiff({ line, currency }) {
|
|
627
|
-
const src = line.arcSource;
|
|
628
|
-
if (!src) return null;
|
|
629
|
-
const isCancel = line.action === "cancel";
|
|
630
|
-
const beforeMrc = src.mrcAmount;
|
|
631
|
-
const beforeNrc = src.nrcAmount;
|
|
632
|
-
const beforeQty = src.quantity;
|
|
633
|
-
const afterMrc = isCancel ? 0 : line.mrcTotal;
|
|
634
|
-
const afterNrc = isCancel ? 0 : line.nrcTotal;
|
|
635
|
-
const afterQty = isCancel ? 0 : line.quantity;
|
|
636
|
-
const mrcDelta = afterMrc - beforeMrc;
|
|
637
|
-
const nrcDelta = afterNrc - beforeNrc;
|
|
638
|
-
const qtyDelta = afterQty - beforeQty;
|
|
639
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
640
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium text-muted-foreground mb-1.5", children: "Change Preview" }),
|
|
641
|
-
/* @__PURE__ */ jsx("div", { className: "rounded border bg-background overflow-hidden", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-xs", children: [
|
|
642
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-muted/40", children: /* @__PURE__ */ jsxs("tr", { className: "text-muted-foreground", children: [
|
|
643
|
-
/* @__PURE__ */ jsx("th", { className: "text-left px-3 py-1.5 font-medium" }),
|
|
644
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium", children: "Before" }),
|
|
645
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium", children: "After" }),
|
|
646
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium", children: "\u0394" })
|
|
647
|
-
] }) }),
|
|
648
|
-
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
649
|
-
/* @__PURE__ */ jsx(ArcDiffRow, { label: "Quantity", before: beforeQty, after: afterQty, delta: qtyDelta, currency: null, dimAfter: isCancel }),
|
|
650
|
-
/* @__PURE__ */ jsx(ArcDiffRow, { label: "MRC", before: beforeMrc, after: afterMrc, delta: mrcDelta, currency, dimAfter: isCancel }),
|
|
651
|
-
/* @__PURE__ */ jsx(ArcDiffRow, { label: "NRC", before: beforeNrc, after: afterNrc, delta: nrcDelta, currency, dimAfter: isCancel })
|
|
652
|
-
] })
|
|
653
|
-
] }) }),
|
|
654
|
-
isCancel && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1 italic", children: "Cancellation \u2014 item will be terminated on activation." })
|
|
655
|
-
] });
|
|
656
|
-
}
|
|
657
|
-
function ArcDiffRow({
|
|
658
|
-
label,
|
|
659
|
-
before,
|
|
660
|
-
after,
|
|
661
|
-
delta,
|
|
662
|
-
currency,
|
|
663
|
-
dimAfter
|
|
664
|
-
}) {
|
|
665
|
-
const fmtVal = (v) => currency ? fmt(v, currency) : String(v);
|
|
666
|
-
const showDelta = delta !== 0;
|
|
667
|
-
return /* @__PURE__ */ jsxs("tr", { className: "border-t border-dashed border-border/40", children: [
|
|
668
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-1 text-muted-foreground", children: label }),
|
|
669
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-1 text-right font-mono", children: fmtVal(before) }),
|
|
670
|
-
/* @__PURE__ */ jsx("td", { className: `px-3 py-1 text-right font-mono ${dimAfter ? "text-muted-foreground line-through" : ""}`, children: fmtVal(after) }),
|
|
671
|
-
/* @__PURE__ */ jsx("td", { className: `px-3 py-1 text-right font-mono font-medium ${showDelta ? delta > 0 ? "text-status-success-text" : "text-destructive" : "text-muted-foreground"}`, children: showDelta ? `${delta > 0 ? "+" : ""}${fmtVal(delta)}` : "\u2014" })
|
|
672
|
-
] });
|
|
673
|
-
}
|
|
674
531
|
export {
|
|
675
532
|
CpqOrderDetailPage as default
|
|
676
533
|
};
|