@agg-build/ui 4.2.0 → 4.4.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.
Files changed (64) hide show
  1. package/README.md +21 -16
  2. package/dist/{chunk-DNPDXL2D.mjs → chunk-64BBTXFE.mjs} +333 -102
  3. package/dist/{chunk-WDCH4RRS.mjs → chunk-6STRIKUA.mjs} +1 -1
  4. package/dist/{chunk-FTL25XKE.mjs → chunk-734VTGCV.mjs} +1 -1
  5. package/dist/{chunk-QW7VFURU.mjs → chunk-N7UPPT5J.mjs} +53 -3
  6. package/dist/{chunk-6X6Y4INU.mjs → chunk-UCU2XCV5.mjs} +2 -2
  7. package/dist/{chunk-GNEFI4SO.mjs → chunk-V5CRUO6S.mjs} +637 -380
  8. package/dist/{chunk-UDBHAZJJ.mjs → chunk-WW5QKNIM.mjs} +270 -123
  9. package/dist/events.js +1061 -645
  10. package/dist/events.mjs +6 -4
  11. package/dist/index.js +2923 -2251
  12. package/dist/index.mjs +12 -8
  13. package/dist/modals.js +9 -2
  14. package/dist/modals.mjs +3 -3
  15. package/dist/pages.js +2391 -1721
  16. package/dist/pages.mjs +8 -6
  17. package/dist/primitives.js +30 -3
  18. package/dist/primitives.mjs +1 -1
  19. package/dist/styles.css +1 -1
  20. package/dist/tailwind.css +1 -1
  21. package/dist/trading.js +330 -99
  22. package/dist/trading.mjs +4 -4
  23. package/dist/types/events/index.d.mts +1 -0
  24. package/dist/types/events/index.d.ts +1 -0
  25. package/dist/types/events/item-details/event-list-item-details-market-selector.d.mts +4 -1
  26. package/dist/types/events/item-details/event-list-item-details-market-selector.d.ts +4 -1
  27. package/dist/types/events/item-details/event-list-item-details.types.d.mts +25 -1
  28. package/dist/types/events/item-details/event-list-item-details.types.d.ts +25 -1
  29. package/dist/types/events/item-details/index.d.mts +1 -1
  30. package/dist/types/events/item-details/index.d.ts +1 -1
  31. package/dist/types/events/market-details/index.d.mts +1 -1
  32. package/dist/types/events/market-details/index.d.ts +1 -1
  33. package/dist/types/events/market-details/market-details.types.d.mts +4 -0
  34. package/dist/types/events/market-details/market-details.types.d.ts +4 -0
  35. package/dist/types/events/shared/format-event-title.d.mts +9 -1
  36. package/dist/types/events/shared/format-event-title.d.ts +9 -1
  37. package/dist/types/events/shared/format-sports-event-time.d.mts +2 -0
  38. package/dist/types/events/shared/format-sports-event-time.d.ts +2 -0
  39. package/dist/types/events/shared/sports-live-score.d.mts +10 -0
  40. package/dist/types/events/shared/sports-live-score.d.ts +10 -0
  41. package/dist/types/pages/event-market/event-market.types.d.mts +4 -0
  42. package/dist/types/pages/event-market/event-market.types.d.ts +4 -0
  43. package/dist/types/pages/event-market/index.d.mts +1 -0
  44. package/dist/types/pages/event-market/index.d.ts +1 -0
  45. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -0
  46. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -0
  47. package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
  48. package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
  49. package/dist/types/pages/user-profile/components/positions-activity.d.mts +1 -1
  50. package/dist/types/pages/user-profile/components/positions-activity.d.ts +1 -1
  51. package/dist/types/pages/user-profile/user-profile.types.d.mts +1 -1
  52. package/dist/types/pages/user-profile/user-profile.types.d.ts +1 -1
  53. package/dist/types/trading/place-order/index.d.mts +1 -1
  54. package/dist/types/trading/place-order/index.d.ts +1 -1
  55. package/dist/types/trading/place-order/index.place-order.execution-steps.d.mts +13 -1
  56. package/dist/types/trading/place-order/index.place-order.execution-steps.d.ts +13 -1
  57. package/dist/types/trading/place-order/index.place-order.execution-view.d.mts +2 -1
  58. package/dist/types/trading/place-order/index.place-order.execution-view.d.ts +2 -1
  59. package/dist/types/trading/place-order/index.place-order.types.d.mts +9 -0
  60. package/dist/types/trading/place-order/index.place-order.types.d.ts +9 -0
  61. package/dist/types/trading/place-order/index.place-order.utils.d.mts +6 -0
  62. package/dist/types/trading/place-order/index.place-order.utils.d.ts +6 -0
  63. package/package.json +3 -3
  64. /package/dist/{chunk-KHHFHXXD.mjs → chunk-JH4B3ZHQ.mjs} +0 -0
package/dist/trading.js CHANGED
@@ -9445,18 +9445,15 @@ var resolvePlaceOrderFailureActions = ({
9445
9445
  canRetryRemaining = true,
9446
9446
  kind,
9447
9447
  labels,
9448
- terminalEvent
9448
+ terminalEvent: _terminalEvent
9449
9449
  }) => {
9450
- const parsedVenue = parseVenue(terminalEvent == null ? void 0 : terminalEvent.venue);
9451
- const venue = parsedVenue.success ? parsedVenue.data : void 0;
9452
- const venueLabel = getTradingVenueLabel(venue);
9453
9450
  if (kind === "partial_fill") {
9454
9451
  if (!canRetryRemaining) {
9455
9452
  return [
9456
9453
  {
9457
- id: "skip",
9458
- label: labels.orderSkip,
9459
- variant: "skip"
9454
+ id: "new-trade",
9455
+ label: labels.orderNewTrade,
9456
+ variant: "dismiss"
9460
9457
  }
9461
9458
  ];
9462
9459
  }
@@ -9467,9 +9464,9 @@ var resolvePlaceOrderFailureActions = ({
9467
9464
  variant: "retry"
9468
9465
  },
9469
9466
  {
9470
- id: "skip",
9471
- label: labels.orderSkip,
9472
- variant: "skip"
9467
+ id: "new-trade",
9468
+ label: labels.orderNewTrade,
9469
+ variant: "dismiss"
9473
9470
  }
9474
9471
  ];
9475
9472
  }
@@ -9477,12 +9474,12 @@ var resolvePlaceOrderFailureActions = ({
9477
9474
  return [
9478
9475
  {
9479
9476
  id: "retry",
9480
- label: labels.orderRetryVenue(venueLabel),
9477
+ label: labels.orderRetry,
9481
9478
  variant: "retry"
9482
9479
  },
9483
9480
  {
9484
- id: "dismiss",
9485
- label: labels.orderDismiss,
9481
+ id: "close",
9482
+ label: labels.orderClose,
9486
9483
  variant: "dismiss"
9487
9484
  }
9488
9485
  ];
@@ -9503,8 +9500,8 @@ var resolvePlaceOrderFailureActions = ({
9503
9500
  variant: "retry"
9504
9501
  },
9505
9502
  {
9506
- id: "dismiss",
9507
- label: labels.orderDone,
9503
+ id: "close",
9504
+ label: labels.orderClose,
9508
9505
  variant: "dismiss"
9509
9506
  }
9510
9507
  ];
@@ -9590,6 +9587,21 @@ var getPlaceOrderUnfilledRemaining = ({
9590
9587
  }, 0);
9591
9588
  return Math.max(0, originalAmount - filled);
9592
9589
  };
9590
+ var getCanonicalPlaceOrderUnfilledRemaining = ({
9591
+ originalAmount,
9592
+ tradeSide,
9593
+ terminalOrderEvents
9594
+ }) => {
9595
+ const fillEvents = (terminalOrderEvents != null ? terminalOrderEvents : []).filter(
9596
+ (event) => event.event === "filled" || event.event === "partial_fill"
9597
+ );
9598
+ if (fillEvents.length === 0) return null;
9599
+ const hasCanonicalFillUnits = fillEvents.every(
9600
+ (event) => tradeSide === "buy" ? event.filledAmountRaw != null : event.actualSharesRaw != null
9601
+ );
9602
+ if (!hasCanonicalFillUnits) return null;
9603
+ return getPlaceOrderUnfilledRemaining({ originalAmount, tradeSide, terminalOrderEvents });
9604
+ };
9593
9605
  var buildPlaceOrderFailureSummary = ({
9594
9606
  actionLabel,
9595
9607
  canRetryRemaining,
@@ -9603,7 +9615,7 @@ var buildPlaceOrderFailureSummary = ({
9603
9615
  submittedOrders,
9604
9616
  terminalOrderEvents
9605
9617
  }) => {
9606
- var _a;
9618
+ var _a, _b;
9607
9619
  const normalizedErrorMessage = normalizePlaceOrderErrorMessage({
9608
9620
  errorMessage,
9609
9621
  fallbackMessage: labels.orderFailed,
@@ -9649,7 +9661,7 @@ var buildPlaceOrderFailureSummary = ({
9649
9661
  });
9650
9662
  }
9651
9663
  const venueSteps = sortedEvents.flatMap((terminalEvent, index) => {
9652
- var _a2, _b, _c, _d, _e;
9664
+ var _a2, _b2, _c, _d, _e;
9653
9665
  const parsedVenue = parseVenue(terminalEvent.venue);
9654
9666
  const venue = parsedVenue.success ? parsedVenue.data : void 0;
9655
9667
  const venueLabel = getTradingVenueLabel(venue);
@@ -9657,7 +9669,7 @@ var buildPlaceOrderFailureSummary = ({
9657
9669
  (candidate) => candidate.orderId === terminalEvent.orderId
9658
9670
  );
9659
9671
  const fallbackPrice = (_a2 = quoteData == null ? void 0 : quoteData.fills[index]) == null ? void 0 : _a2.avgPrice;
9660
- const priceLabel = getTradingRoutePriceLabel((_c = (_b = submittedOrder == null ? void 0 : submittedOrder.price) != null ? _b : fallbackPrice) != null ? _c : 0);
9672
+ const priceLabel = getTradingRoutePriceLabel((_c = (_b2 = submittedOrder == null ? void 0 : submittedOrder.price) != null ? _b2 : fallbackPrice) != null ? _c : 0);
9661
9673
  const filledDollars = parseFilledAmountRawDollars(terminalEvent.filledAmountRaw);
9662
9674
  const amountLabel = filledDollars != null ? formatUsd(filledDollars) : null;
9663
9675
  const executingStep = {
@@ -9706,6 +9718,17 @@ var buildPlaceOrderFailureSummary = ({
9706
9718
  } : null;
9707
9719
  const primaryNonFilledEvent = (_a = sortedEvents.find((e) => e.event !== "filled")) != null ? _a : sortedEvents[0];
9708
9720
  const parsedRetryVenue = primaryNonFilledEvent ? parseVenue(primaryNonFilledEvent.venue) : null;
9721
+ const failedEventMessage = (_b = sortedEvents.find(
9722
+ (event) => {
9723
+ var _a2;
9724
+ return event.event === "failed" && ((_a2 = event.errorReason) == null ? void 0 : _a2.trim());
9725
+ }
9726
+ )) == null ? void 0 : _b.errorReason;
9727
+ const resolvedErrorMessage = failedEventMessage ? normalizePlaceOrderErrorMessage({
9728
+ errorMessage: failedEventMessage,
9729
+ fallbackMessage: labels.orderFailed,
9730
+ labels
9731
+ }) : overallFailureKind === "partial_fill" ? void 0 : normalizedErrorMessage;
9709
9732
  return __spreadProps(__spreadValues({
9710
9733
  actionLabel,
9711
9734
  actions: resolvePlaceOrderFailureActions({
@@ -9714,7 +9737,7 @@ var buildPlaceOrderFailureSummary = ({
9714
9737
  labels,
9715
9738
  terminalEvent: primaryNonFilledEvent
9716
9739
  }),
9717
- errorMessage: normalizedErrorMessage,
9740
+ errorMessage: resolvedErrorMessage,
9718
9741
  eventImage,
9719
9742
  eventSubtitle,
9720
9743
  eventTitle,
@@ -9940,7 +9963,8 @@ var resolveActualFillPresentation = ({
9940
9963
  };
9941
9964
  var resolveBackendStepStatus = (status) => {
9942
9965
  if (status === "completed" || status === "skipped") return "done";
9943
- if (status === "in_progress" || status === "failed") return "loading";
9966
+ if (status === "failed") return "failed";
9967
+ if (status === "in_progress") return "loading";
9944
9968
  return "not-started";
9945
9969
  };
9946
9970
  var resolveOrderFallbackFill = (quoteData, order, orderIndex) => {
@@ -10051,20 +10075,35 @@ var deriveBackendExecutionOrderGroups = ({
10051
10075
  });
10052
10076
  const usesBackendPendingLabel = step.groupStatus === "pending" || step.groupStatus === "in_progress" || step.groupStatus === "failed";
10053
10077
  const usesBackendCompletedLabel = step.groupStatus === "completed" || step.groupStatus === "skipped";
10078
+ const isPartialFillStep = step.kind === "fill" && order.event === "partial_fill";
10079
+ const partialFillLabel = labels.orderPartiallyFilledAtPriceWithAmount(
10080
+ presentation.venueLabel,
10081
+ presentation.priceLabel,
10082
+ presentation.amountLabel
10083
+ );
10054
10084
  return {
10055
10085
  id: `${order.orderId}:${step.groupId}`,
10056
10086
  kind: step.kind,
10057
- pendingLabel: usesBackendPendingLabel ? step.label : fallbackLabels.pendingLabel,
10058
- completedLabel: usesBackendCompletedLabel ? step.label : fallbackLabels.completedLabel,
10059
- realStatus: forceCompleted ? "done" : resolveBackendStepStatus(step.groupStatus)
10087
+ pendingLabel: isPartialFillStep ? partialFillLabel : usesBackendPendingLabel ? step.label : fallbackLabels.pendingLabel,
10088
+ completedLabel: isPartialFillStep ? partialFillLabel : usesBackendCompletedLabel ? step.label : fallbackLabels.completedLabel,
10089
+ realStatus: isPartialFillStep ? "warning" : forceCompleted ? "done" : resolveBackendStepStatus(step.groupStatus)
10060
10090
  };
10061
10091
  });
10062
10092
  if (steps.length === 0) return [];
10063
10093
  return [__spreadProps(__spreadValues({ id: order.orderId }, presentation), { steps })];
10064
10094
  });
10065
- return deriveSequentialDisplayGroups(realGroups);
10066
- };
10067
- var deriveSequentialDisplayGroups = (groups) => {
10095
+ const allOrdersTerminal = executionOrders.every((order) => order.event !== null);
10096
+ return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal);
10097
+ };
10098
+ var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) => {
10099
+ if (revealTerminalOutcomes) {
10100
+ return groups.map((group) => __spreadProps(__spreadValues({}, group), {
10101
+ steps: group.steps.map((_a) => {
10102
+ var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
10103
+ return __spreadProps(__spreadValues({}, step), { status: realStatus });
10104
+ })
10105
+ }));
10106
+ }
10068
10107
  let hasUnresolvedPredecessor = false;
10069
10108
  return groups.map((group) => __spreadProps(__spreadValues({}, group), {
10070
10109
  steps: group.steps.map((_a) => {
@@ -10130,6 +10169,9 @@ var deriveExecutionOrderGroups = ({
10130
10169
  const hasSuccessfulTerminalEvent = venueTerminalEvents.some(
10131
10170
  (event) => event.event === "filled" || event.event === "partial_fill"
10132
10171
  );
10172
+ const hasPartialTerminalEvent = venueTerminalEvents.some(
10173
+ (event) => event.event === "partial_fill"
10174
+ );
10133
10175
  const hasVenueExecutionProgress = venueRawSteps.some(isRawStepStarted);
10134
10176
  const quotedAmount = fill.venueQty * fill.avgPrice;
10135
10177
  const actualFill = resolveActualFillPresentation({
@@ -10139,6 +10181,11 @@ var deriveExecutionOrderGroups = ({
10139
10181
  });
10140
10182
  const completedAmountLabel = tradeSide === "buy" ? formatUsd(actualFill.amount) : labels.executionShares(formatTokenAmount(fill.venueQty));
10141
10183
  const completedPriceLabel = getTradingRoutePriceLabel(actualFill.price);
10184
+ const partialFillLabel = labels.orderPartiallyFilledAtPriceWithAmount(
10185
+ venueLabel,
10186
+ completedPriceLabel,
10187
+ completedAmountLabel
10188
+ );
10142
10189
  const setupRawSteps = rawExecutionSteps.filter(
10143
10190
  (step) => setupCosts.some((setupCost) => isSetupRawStep(step, setupCost))
10144
10191
  );
@@ -10150,7 +10197,7 @@ var deriveExecutionOrderGroups = ({
10150
10197
  steps: bridgeRawSteps,
10151
10198
  nextPhaseStarted: hasVenueExecutionProgress || hasSuccessfulTerminalEvent
10152
10199
  });
10153
- const executionStatus = forceCompleted || hasSuccessfulTerminalEvent ? "done" : resolveRawPhaseStatus({ steps: venueRawSteps });
10200
+ const executionStatus = hasPartialTerminalEvent ? "warning" : forceCompleted || hasSuccessfulTerminalEvent ? "done" : resolveRawPhaseStatus({ steps: venueRawSteps });
10154
10201
  const groupId = `${normalizeIdentity(fill.venue) || "venue"}-${fillIndex}`;
10155
10202
  const steps = [
10156
10203
  {
@@ -10182,8 +10229,8 @@ var deriveExecutionOrderGroups = ({
10182
10229
  {
10183
10230
  id: `${groupId}-execute`,
10184
10231
  kind: "fill",
10185
- pendingLabel: labels.fillingOnVenue(venueLabel),
10186
- completedLabel: labels.venueFilledAtPriceWithAmount(
10232
+ pendingLabel: hasPartialTerminalEvent ? partialFillLabel : labels.fillingOnVenue(venueLabel),
10233
+ completedLabel: hasPartialTerminalEvent ? partialFillLabel : labels.venueFilledAtPriceWithAmount(
10187
10234
  venueLabel,
10188
10235
  completedAmountLabel,
10189
10236
  completedPriceLabel
@@ -10200,7 +10247,92 @@ var deriveExecutionOrderGroups = ({
10200
10247
  steps
10201
10248
  };
10202
10249
  });
10203
- return deriveSequentialDisplayGroups(realGroups);
10250
+ return deriveSequentialDisplayGroups(
10251
+ realGroups,
10252
+ terminalOrderEvents.length >= quoteData.fills.length && quoteData.fills.length > 0
10253
+ );
10254
+ };
10255
+ var EXECUTION_MILESTONE_WEIGHTS = {
10256
+ submit: 20,
10257
+ setup: 20,
10258
+ bridge: 20,
10259
+ fill: 40
10260
+ };
10261
+ var COMPLETED_MILESTONE_GROUP_STATUSES = /* @__PURE__ */ new Set([
10262
+ "completed",
10263
+ "skipped"
10264
+ ]);
10265
+ var TERMINAL_EXECUTION_GROUP_STATUSES = /* @__PURE__ */ new Set([
10266
+ "completed",
10267
+ "failed",
10268
+ "skipped"
10269
+ ]);
10270
+ var uniqueGroupsForOrderAndKind = ({
10271
+ kind,
10272
+ orderId,
10273
+ steps
10274
+ }) => {
10275
+ var _a;
10276
+ const groups = /* @__PURE__ */ new Map();
10277
+ for (const step of steps) {
10278
+ if (step.kind !== kind || !((_a = step.orderIds) == null ? void 0 : _a.includes(orderId)) || groups.has(step.groupId))
10279
+ continue;
10280
+ groups.set(step.groupId, step);
10281
+ }
10282
+ return Array.from(groups.values());
10283
+ };
10284
+ var calculateExecutionProgress = ({
10285
+ orderIds,
10286
+ submittedOrderIds = [],
10287
+ executionSteps = [],
10288
+ executionOrders = [],
10289
+ minimumProgress = 0
10290
+ }) => {
10291
+ const resolvedOrderIds = orderIds.length > 0 ? orderIds : executionOrders.map((order) => order.orderId);
10292
+ if (resolvedOrderIds.length === 0) return 0;
10293
+ const submittedIds = new Set(submittedOrderIds);
10294
+ const orderById = new Map(executionOrders.map((order) => [order.orderId, order]));
10295
+ const hasAuthoritativeTopology = executionSteps.some(
10296
+ (step) => {
10297
+ var _a, _b;
10298
+ return step.kind !== "internal" && step.kind !== "submit" && ((_b = (_a = step.orderIds) == null ? void 0 : _a.length) != null ? _b : 0) > 0;
10299
+ }
10300
+ );
10301
+ let progress = 0;
10302
+ for (const orderId of resolvedOrderIds) {
10303
+ const order = orderById.get(orderId);
10304
+ const isOrderTerminal = (order == null ? void 0 : order.event) !== null && (order == null ? void 0 : order.event) !== void 0;
10305
+ const contributionScale = 1 / resolvedOrderIds.length;
10306
+ const submitGroups = uniqueGroupsForOrderAndKind({
10307
+ kind: "submit",
10308
+ orderId,
10309
+ steps: executionSteps
10310
+ });
10311
+ const setupGroups = uniqueGroupsForOrderAndKind({
10312
+ kind: "setup",
10313
+ orderId,
10314
+ steps: executionSteps
10315
+ });
10316
+ const bridgeGroups = uniqueGroupsForOrderAndKind({
10317
+ kind: "bridge",
10318
+ orderId,
10319
+ steps: executionSteps
10320
+ });
10321
+ const fillGroups = uniqueGroupsForOrderAndKind({
10322
+ kind: "fill",
10323
+ orderId,
10324
+ steps: executionSteps
10325
+ });
10326
+ const submissionComplete = isOrderTerminal || submittedIds.has(orderId) || submitGroups.some((step) => COMPLETED_MILESTONE_GROUP_STATUSES.has(step.groupStatus));
10327
+ const fundingComplete = isOrderTerminal || hasAuthoritativeTopology && (setupGroups.length === 0 || setupGroups.every((step) => COMPLETED_MILESTONE_GROUP_STATUSES.has(step.groupStatus)));
10328
+ const bridgingComplete = isOrderTerminal || hasAuthoritativeTopology && (bridgeGroups.length === 0 || bridgeGroups.every((step) => COMPLETED_MILESTONE_GROUP_STATUSES.has(step.groupStatus)));
10329
+ const executionComplete = isOrderTerminal || fillGroups.length > 0 && fillGroups.every((step) => TERMINAL_EXECUTION_GROUP_STATUSES.has(step.groupStatus));
10330
+ if (submissionComplete) progress += EXECUTION_MILESTONE_WEIGHTS.submit * contributionScale;
10331
+ if (fundingComplete) progress += EXECUTION_MILESTONE_WEIGHTS.setup * contributionScale;
10332
+ if (bridgingComplete) progress += EXECUTION_MILESTONE_WEIGHTS.bridge * contributionScale;
10333
+ if (executionComplete) progress += EXECUTION_MILESTONE_WEIGHTS.fill * contributionScale;
10334
+ }
10335
+ return Math.min(100, Math.max(0, minimumProgress, Math.round(progress)));
10204
10336
  };
10205
10337
 
10206
10338
  // src/trading/place-order/index.place-order.execution-view.tsx
@@ -10252,6 +10384,28 @@ var ExecutionStepIndicator = ({
10252
10384
  }
10253
10385
  ) });
10254
10386
  }
10387
+ if (step.status === "failed") {
10388
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
10389
+ Icon,
10390
+ {
10391
+ name: "error-filled",
10392
+ size: "xs",
10393
+ className: "h-3 w-3 shrink-0 text-agg-error",
10394
+ "aria-hidden": "true"
10395
+ }
10396
+ );
10397
+ }
10398
+ if (step.status === "warning") {
10399
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
10400
+ Icon,
10401
+ {
10402
+ name: "warning-filled",
10403
+ size: "xs",
10404
+ className: "h-3 w-3 shrink-0 text-agg-warning",
10405
+ "aria-hidden": "true"
10406
+ }
10407
+ );
10408
+ }
10255
10409
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
10256
10410
  "span",
10257
10411
  {
@@ -10315,10 +10469,9 @@ var PlaceOrderExecutionView = ({
10315
10469
  eventImage,
10316
10470
  eventTitle,
10317
10471
  groups,
10318
- labels
10472
+ labels,
10473
+ progress
10319
10474
  }) => {
10320
- const steps = groups.flatMap((group) => group.steps);
10321
- const completedStepCount = steps.filter((step) => step.status === "done").length;
10322
10475
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
10323
10476
  Card,
10324
10477
  {
@@ -10339,30 +10492,18 @@ var PlaceOrderExecutionView = ({
10339
10492
  }
10340
10493
  ),
10341
10494
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
10342
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex flex-col gap-2", children: [
10343
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.executingOrder }),
10495
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex items-center gap-3", children: [
10496
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("p", { className: "shrink-0 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
10497
+ progress,
10498
+ "%"
10499
+ ] }),
10344
10500
  /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
10345
- "div",
10501
+ "progress",
10346
10502
  {
10347
- role: "progressbar",
10348
10503
  "aria-label": labels.executingOrder,
10349
- "aria-valuemin": 0,
10350
- "aria-valuemax": steps.length,
10351
- "aria-valuenow": completedStepCount,
10352
- className: "flex h-1 w-full gap-0.5",
10353
- children: steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
10354
- "span",
10355
- {
10356
- "data-testid": "execution-progress-segment",
10357
- className: cn(
10358
- "h-1 min-w-0 flex-1 rounded-agg-full",
10359
- step.status === "done" ? "bg-agg-primary" : "bg-agg-separator"
10360
- ),
10361
- "aria-hidden": "true",
10362
- "data-status": step.status
10363
- },
10364
- step.id
10365
- ))
10504
+ className: "h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator text-agg-primary accent-agg-primary [&::-moz-progress-bar]:bg-agg-primary [&::-webkit-progress-bar]:bg-agg-separator [&::-webkit-progress-value]:bg-agg-primary",
10505
+ max: 100,
10506
+ value: progress
10366
10507
  }
10367
10508
  )
10368
10509
  ] }),
@@ -10425,7 +10566,7 @@ var PlaceOrderFailureView = ({
10425
10566
  onDone,
10426
10567
  onSkip
10427
10568
  }) => {
10428
- var _a, _b, _c;
10569
+ var _a, _b, _c, _d, _e;
10429
10570
  const shouldShowPartialFailureLayout = summary.kind === "partial_fill";
10430
10571
  const failureStepGroups = shouldShowPartialFailureLayout ? groupPlaceOrderFailureSteps(summary.steps) : [];
10431
10572
  if (shouldShowPartialFailureLayout) {
@@ -10444,14 +10585,42 @@ var PlaceOrderFailureView = ({
10444
10585
  ] }),
10445
10586
  summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
10446
10587
  ] }),
10447
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "flex flex-col gap-4", children: failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
10448
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "flex items-center gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10588
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "flex flex-col gap-4", children: ((_b = summary.executionGroups) == null ? void 0 : _b.length) ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10589
+ PlaceOrderExecutionGroups,
10590
+ {
10591
+ enableAnimations: false,
10592
+ groups: summary.executionGroups,
10593
+ labels: tradingLabels
10594
+ }
10595
+ ) : failureStepGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "flex flex-col gap-2", children: group.map((step) => renderPartialFailureStep(step)) }, `failure-group-${groupIndex}`)) }),
10596
+ summary.errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10597
+ InlineAlert,
10598
+ {
10599
+ tone: "error",
10600
+ variant: "surface",
10601
+ message: tradingLabels.orderFailureDescription(summary.errorMessage)
10602
+ }
10603
+ ) : null,
10604
+ summary.result ? /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex flex-col gap-4", children: [
10605
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
10606
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
10607
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPartiallyFilled }),
10608
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.result.averagePriceLabel) })
10609
+ ] }),
10610
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: summary.result.filledAmountLabel })
10611
+ ] }),
10612
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
10613
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
10614
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: summary.result.payoutLabel })
10615
+ ] })
10616
+ ] }) : null,
10617
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10449
10618
  Button,
10450
10619
  {
10451
- variant: "tertiary",
10620
+ variant: action.variant === "retry" ? "primary" : "secondary",
10452
10621
  size: "medium",
10453
10622
  "aria-label": action.label,
10454
- className: "text-agg-sm! leading-agg-5! text-agg-primary!",
10623
+ className: "w-full",
10455
10624
  onClick: resolveFailureActionHandler({ action, onDone, onRetry, onSkip }),
10456
10625
  children: action.label
10457
10626
  },
@@ -10465,7 +10634,7 @@ var PlaceOrderFailureView = ({
10465
10634
  /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10466
10635
  RemoteImage,
10467
10636
  {
10468
- src: (_b = summary.eventImage) != null ? _b : null,
10637
+ src: (_c = summary.eventImage) != null ? _c : null,
10469
10638
  alt: "",
10470
10639
  className: "h-12 w-12 shrink-0 overflow-hidden rounded-agg-lg object-cover"
10471
10640
  }
@@ -10474,21 +10643,29 @@ var PlaceOrderFailureView = ({
10474
10643
  ] }),
10475
10644
  summary.eventSubtitle ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: summary.eventSubtitle }) : null
10476
10645
  ] }),
10646
+ ((_d = summary.executionGroups) == null ? void 0 : _d.length) ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10647
+ PlaceOrderExecutionGroups,
10648
+ {
10649
+ enableAnimations: false,
10650
+ groups: summary.executionGroups,
10651
+ labels: tradingLabels
10652
+ }
10653
+ ) : null,
10477
10654
  /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10478
10655
  InlineAlert,
10479
10656
  {
10480
10657
  tone: "error",
10481
10658
  variant: "surface",
10482
10659
  title: tradingLabels.orderFailureTitle,
10483
- message: tradingLabels.orderFailureDescription((_c = summary.errorMessage) != null ? _c : "")
10660
+ message: tradingLabels.orderFailureDescription((_e = summary.errorMessage) != null ? _e : "")
10484
10661
  }
10485
10662
  ),
10486
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "agg-order-failure-actions flex items-center gap-3", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10663
+ /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "agg-order-failure-actions flex flex-col gap-4", children: summary.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
10487
10664
  Button,
10488
10665
  {
10489
10666
  variant: action.variant === "retry" ? "primary" : "secondary",
10490
10667
  size: "medium",
10491
- className: "flex-1",
10668
+ className: "w-full",
10492
10669
  "aria-label": action.label,
10493
10670
  onClick: resolveFailureActionHandler({ action, onDone, onRetry, onSkip }),
10494
10671
  children: action.label
@@ -10512,7 +10689,7 @@ var PlaceOrderSuccessView = ({
10512
10689
  onDone,
10513
10690
  onShare: _onShare
10514
10691
  }) => {
10515
- var _a, _b, _c, _d, _e, _f;
10692
+ var _a, _b, _c, _d, _e;
10516
10693
  const resolvedTradeSide = (_a = summary.tradeSide) != null ? _a : "buy";
10517
10694
  const resolvedAmountLabel = (_b = summary.amountLabel) != null ? _b : resolvedTradeSide === "sell" ? summary.shares : summary.estimatedCost;
10518
10695
  const resolvedPayoutLabel = (_c = summary.toWinLabel) != null ? _c : resolvedTradeSide === "sell" ? summary.estimatedCost : resolveBuyPayoutLabel(summary.shares);
@@ -10565,15 +10742,11 @@ var PlaceOrderSuccessView = ({
10565
10742
  },
10566
10743
  step.id
10567
10744
  )) }) : null,
10568
- /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-order-success-pill flex h-11 w-full items-center justify-center gap-2 rounded-agg-full bg-agg-success px-6 py-2.5 text-center text-agg-base font-agg-bold leading-agg-6 text-agg-on-primary", children: [
10569
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Icon, { name: "success-check", size: "xs", className: "h-3 w-3 shrink-0 text-current" }),
10570
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("span", { children: (_f = summary.actionLabel) != null ? _f : tradingLabels.orderSuccessTitle })
10571
- ] }),
10572
10745
  /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "agg-order-success-summary flex flex-col gap-4", children: [
10573
10746
  /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
10574
10747
  /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
10575
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: summary.requestedAmountLabel ? resolvedTradeSide === "buy" ? tradingLabels.orderAmountFilled : tradingLabels.amount(resolvedTradeSide) : tradingLabels.amount(resolvedTradeSide) }),
10576
- summary.requestedAmountLabel ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAmountFilledOf(summary.requestedAmountLabel) }) : null
10748
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: summary.resultState === "partial" ? tradingLabels.orderPartiallyFilled : tradingLabels.orderFullyFilled }),
10749
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-muted-foreground", children: tradingLabels.orderAveragePrice(summary.avgPrice) })
10577
10750
  ] }),
10578
10751
  /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-foreground", children: resolvedAmountLabel })
10579
10752
  ] }),
@@ -10991,13 +11164,14 @@ var PlaceOrderResolvedView = ({
10991
11164
  resolutionTimestamp,
10992
11165
  resolvedClaim,
10993
11166
  className,
10994
- isSportsEvent = false
11167
+ isSportsEvent = false,
11168
+ showResolvingState = false
10995
11169
  }) => {
10996
11170
  var _a, _b;
10997
11171
  const labels = (0, import_hooks38.useLabels)();
10998
11172
  const tradingLabels = labels.trading;
10999
11173
  const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
11000
- const isResolvingMarket = false;
11174
+ const isResolvingMarket = showResolvingState && !tradingState.winningOutcome;
11001
11175
  const resolvingSubtitle = tradingState.market ? (() => {
11002
11176
  const endDateLabel = isSportsEvent ? formatSportsEventTimeEt(resolvingTimestamp != null ? resolvingTimestamp : "") : getTradingDateLabel(resolvingTimestamp != null ? resolvingTimestamp : "");
11003
11177
  return endDateLabel ? `${tradingState.market.question} \xB7 ${endDateLabel}` : tradingState.market.question;
@@ -11277,6 +11451,7 @@ var PlaceOrder = ({
11277
11451
  onError,
11278
11452
  onExecutionStateChange,
11279
11453
  resolvedClaim,
11454
+ showResolvingState = false,
11280
11455
  midpointsResult
11281
11456
  }) => {
11282
11457
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha;
@@ -11340,7 +11515,7 @@ var PlaceOrder = ({
11340
11515
  const resolvedReadOnlyTradingState = (0, import_react15.useMemo)(() => {
11341
11516
  return (0, import_hooks38.resolveMarketTradingState)(resolvedReadOnlyMarket);
11342
11517
  }, [resolvedReadOnlyMarket]);
11343
- const isEndedWithoutKnownWinner = false;
11518
+ const isEndedWithoutKnownWinner = showResolvingState && !resolvedEventTradingState.winningOutcome && !resolvedReadOnlyTradingState.winningOutcome;
11344
11519
  const orderEligibility = (0, import_react15.useMemo)(
11345
11520
  () => (0, import_hooks38.resolveOrderEligibility)({
11346
11521
  event: scopedSelectedEvent,
@@ -11976,6 +12151,10 @@ var PlaceOrder = ({
11976
12151
  mode: isPaperMode ? "paper" : void 0,
11977
12152
  enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_N = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _N.length)
11978
12153
  });
12154
+ const executionProgressFloorRef = (0, import_react15.useRef)({
12155
+ quoteId: null,
12156
+ value: 0
12157
+ });
11979
12158
  const selectedOutcomeLabel = (_Q = (_P = (_O = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _O.label) != null ? _P : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _Q : "";
11980
12159
  const headerImage = (_S = (_R = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _R : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _S : null;
11981
12160
  const headerTitle = (_U = (_T = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _T : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _U : "";
@@ -12006,6 +12185,26 @@ var PlaceOrder = ({
12006
12185
  (_Z = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _Z.length,
12007
12186
  tradingLabels
12008
12187
  ]);
12188
+ const executionProgressPercent = (0, import_react15.useMemo)(() => {
12189
+ var _a2, _b2, _c2;
12190
+ const quoteId = (_a2 = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _a2 : null;
12191
+ const previousProgress = executionProgressFloorRef.current.quoteId === quoteId ? executionProgressFloorRef.current.value : 0;
12192
+ const nextProgress = calculateExecutionProgress({
12193
+ orderIds: (_b2 = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _b2 : [],
12194
+ submittedOrderIds: executionProgress.submittedOrders.map((order) => order.orderId),
12195
+ executionSteps: executionProgress.executionSteps,
12196
+ executionOrders: (_c2 = executionProgress.executionOrders) != null ? _c2 : [],
12197
+ minimumProgress: previousProgress
12198
+ });
12199
+ executionProgressFloorRef.current = { quoteId, value: nextProgress };
12200
+ return nextProgress;
12201
+ }, [
12202
+ executionProgress.executionOrders,
12203
+ executionProgress.executionSteps,
12204
+ executionProgress.submittedOrders,
12205
+ submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
12206
+ submissionProgressState == null ? void 0 : submissionProgressState.quoteId
12207
+ ]);
12009
12208
  const buildExecutionSummary = (0, import_react15.useCallback)(
12010
12209
  (quoteData, executionVenue, orderId, partialFillSummary) => {
12011
12210
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
@@ -12034,6 +12233,7 @@ var PlaceOrder = ({
12034
12233
  const eventTitle = (_f2 = (_e2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _e2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _f2 : "";
12035
12234
  const eventDateSource = (_g2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _g2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
12036
12235
  return {
12236
+ resultState: partialFillSummary ? "partial" : "success",
12037
12237
  tradeSide: internalTab,
12038
12238
  shares: sharesLabel,
12039
12239
  avgPrice: avgPriceLabel,
@@ -12374,31 +12574,30 @@ var PlaceOrder = ({
12374
12574
  });
12375
12575
  }, [isSell, orderedRouteCards.length, smartRoute.error, tradingLabels, venueSellQuotes.error]);
12376
12576
  const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
12377
- const canRetryRemaining = (0, import_react15.useMemo)(() => {
12378
- const remaining = getPlaceOrderUnfilledRemaining({
12577
+ const retryRemainingAmount = (0, import_react15.useMemo)(() => {
12578
+ return getCanonicalPlaceOrderUnfilledRemaining({
12379
12579
  originalAmount: internalAmount,
12380
12580
  tradeSide: internalTab,
12381
12581
  terminalOrderEvents: executionProgress.terminalOrderEvents
12382
12582
  });
12583
+ }, [executionProgress.terminalOrderEvents, internalAmount, internalTab]);
12584
+ const canRetryRemaining = (0, import_react15.useMemo)(() => {
12585
+ if (retryRemainingAmount == null) return false;
12383
12586
  const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
12384
- return remaining >= minRemainder;
12385
- }, [executionProgress.terminalOrderEvents, internalAmount, internalTab, isSell]);
12587
+ return retryRemainingAmount >= minRemainder;
12588
+ }, [isSell, retryRemainingAmount]);
12386
12589
  const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
12387
12590
  const shouldAutoSkipPartialFill = (0, import_react15.useMemo)(() => {
12388
- if (internalAmount <= 0) return false;
12389
- const remaining = getPlaceOrderUnfilledRemaining({
12390
- originalAmount: internalAmount,
12391
- tradeSide: internalTab,
12392
- terminalOrderEvents: executionProgress.terminalOrderEvents
12393
- });
12394
- const filled = Math.max(0, internalAmount - remaining);
12591
+ if (internalAmount <= 0 || retryRemainingAmount == null) return false;
12592
+ const filled = Math.max(0, internalAmount - retryRemainingAmount);
12395
12593
  const fillRatio = filled / internalAmount;
12396
12594
  return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
12397
- }, [canRetryRemaining, executionProgress.terminalOrderEvents, internalAmount, internalTab]);
12595
+ }, [canRetryRemaining, internalAmount, retryRemainingAmount]);
12398
12596
  const failureSummary = (0, import_react15.useMemo)(() => {
12399
12597
  var _a2;
12400
12598
  if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
12401
- return buildPlaceOrderFailureSummary({
12599
+ const quoteData = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _a2 : activeQuoteData;
12600
+ const baseSummary = buildPlaceOrderFailureSummary({
12402
12601
  actionLabel: progressActionLabel,
12403
12602
  canRetryRemaining,
12404
12603
  errorMessage: submissionProgressState.errorMessage,
@@ -12407,19 +12606,53 @@ var PlaceOrder = ({
12407
12606
  eventTitle: headerTitle || tradingLabels.orderFailureTitle,
12408
12607
  labels: tradingLabels,
12409
12608
  orderId: submissionProgressState.orderId,
12410
- quoteData: (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _a2 : activeQuoteData,
12609
+ quoteData,
12411
12610
  submittedOrders: executionProgress.submittedOrders,
12412
12611
  terminalOrderEvents: executionProgress.terminalOrderEvents
12413
12612
  });
12613
+ const summaryWithGroups = __spreadValues(__spreadValues({}, baseSummary), executionOrderGroups.length > 0 ? { executionGroups: executionOrderGroups } : {});
12614
+ if (baseSummary.kind !== "partial_fill") return summaryWithGroups;
12615
+ const actualEconomics = resolveActualExecutionEconomics({
12616
+ quoteData,
12617
+ tradeSide: internalTab,
12618
+ terminalOrderEvents: executionProgress.terminalOrderEvents,
12619
+ submittedOrders: executionProgress.submittedOrders
12620
+ });
12621
+ if (!actualEconomics.hasActualFillData) return summaryWithGroups;
12622
+ if (retryRemainingAmount == null) return summaryWithGroups;
12623
+ const remaining = retryRemainingAmount;
12624
+ const remainingLabel = isSell ? tradingLabels.executionShares(
12625
+ remaining.toLocaleString("en-US", { maximumFractionDigits: 2 })
12626
+ ) : formatUsd(remaining);
12627
+ const filledAmountLabel = isSell ? tradingLabels.executionShares(
12628
+ actualEconomics.actualTotalFilled.toLocaleString("en-US", {
12629
+ maximumFractionDigits: 2
12630
+ })
12631
+ ) : formatUsd(actualEconomics.actualRawExecCost);
12632
+ const payoutLabel = isSell ? formatUsd(actualEconomics.actualRawExecCost) : formatUsd(actualEconomics.actualTotalFilled);
12633
+ return __spreadProps(__spreadValues({}, summaryWithGroups), {
12634
+ actions: summaryWithGroups.actions.map(
12635
+ (action) => action.variant === "retry" ? __spreadProps(__spreadValues({}, action), { label: tradingLabels.orderTryRemaining(remainingLabel) }) : action
12636
+ ),
12637
+ result: {
12638
+ averagePriceLabel: getTradingRoutePriceLabel(actualEconomics.avgExecutionPrice),
12639
+ filledAmountLabel,
12640
+ payoutLabel
12641
+ }
12642
+ });
12414
12643
  }, [
12415
12644
  activeQuoteData,
12416
12645
  canRetryRemaining,
12646
+ executionOrderGroups,
12417
12647
  executionProgress.submittedOrders,
12418
12648
  executionProgress.terminalOrderEvents,
12419
12649
  headerImage,
12420
12650
  headerSubtitle,
12421
12651
  headerTitle,
12652
+ internalTab,
12653
+ isSell,
12422
12654
  progressActionLabel,
12655
+ retryRemainingAmount,
12423
12656
  selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData,
12424
12657
  submissionProgressState,
12425
12658
  tradingLabels
@@ -12943,7 +13176,7 @@ var PlaceOrder = ({
12943
13176
  if (!shouldAutoSkipPartialFill) return;
12944
13177
  handleSkipToSuccess();
12945
13178
  }, [
12946
- failureSummary == null ? void 0 : failureSummary.kind,
13179
+ failureSummary,
12947
13180
  handleSkipToSuccess,
12948
13181
  shouldAutoSkipPartialFill,
12949
13182
  submissionProgressState == null ? void 0 : submissionProgressState.phase
@@ -12957,12 +13190,8 @@ var PlaceOrder = ({
12957
13190
  setSubmissionFeedback(null);
12958
13191
  let retryAmount = internalAmount;
12959
13192
  let useRemainderRoute = false;
12960
- if ((failureSummary == null ? void 0 : failureSummary.kind) === "partial_fill" && internalAmount > 0) {
12961
- const remaining = getPlaceOrderUnfilledRemaining({
12962
- originalAmount: internalAmount,
12963
- tradeSide: internalTab,
12964
- terminalOrderEvents: executionProgress.terminalOrderEvents
12965
- });
13193
+ if ((failureSummary == null ? void 0 : failureSummary.kind) === "partial_fill" && internalAmount > 0 && retryRemainingAmount != null) {
13194
+ const remaining = retryRemainingAmount;
12966
13195
  if (remaining > 0) {
12967
13196
  retryAmount = remaining;
12968
13197
  useRemainderRoute = true;
@@ -13082,8 +13311,7 @@ var PlaceOrder = ({
13082
13311
  }), [
13083
13312
  aggClient,
13084
13313
  chainBalancesOverride,
13085
- executionProgress.terminalOrderEvents,
13086
- failureSummary == null ? void 0 : failureSummary.kind,
13314
+ failureSummary,
13087
13315
  handleExecuteQuote,
13088
13316
  handleReturnToOrderForm,
13089
13317
  internalAmount,
@@ -13093,6 +13321,7 @@ var PlaceOrder = ({
13093
13321
  onAmountChange,
13094
13322
  orderEligibility.canPlaceOrder,
13095
13323
  orderedRouteCards,
13324
+ retryRemainingAmount,
13096
13325
  scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets,
13097
13326
  scopedSelectedOutcomeId,
13098
13327
  selectedRouteCardId,
@@ -13148,7 +13377,8 @@ var PlaceOrder = ({
13148
13377
  eventImage: headerImage,
13149
13378
  eventTitle: headerTitle,
13150
13379
  groups: executionOrderGroups,
13151
- labels: tradingLabels
13380
+ labels: tradingLabels,
13381
+ progress: executionProgressPercent
13152
13382
  }
13153
13383
  );
13154
13384
  }
@@ -13363,7 +13593,8 @@ var PlaceOrder = ({
13363
13593
  resolvedClaim,
13364
13594
  classNames,
13365
13595
  className,
13366
- isSportsEvent: (scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.structureType) === "sport" && !!(scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.sport) && scopedSelectedEvent.sport !== "other_sport"
13596
+ isSportsEvent: (scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.structureType) === "sport" && !!(scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.sport) && scopedSelectedEvent.sport !== "other_sport",
13597
+ showResolvingState
13367
13598
  }
13368
13599
  );
13369
13600
  }
@@ -14432,7 +14663,7 @@ function useResolvedMarketClaim(options = {}) {
14432
14663
  });
14433
14664
  } : void 0
14434
14665
  };
14435
- }, [claimWinnings, marketId, positions, shouldFetch]);
14666
+ }, [claimWinnings, market, marketId, positions, shouldFetch]);
14436
14667
  }
14437
14668
  // Annotate the CommonJS export names for ESM import in node:
14438
14669
  0 && (module.exports = {