@metamask-previews/bridge-status-controller 68.0.0-preview-384cfdfef → 68.0.0-preview-15dd7d63f

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 CHANGED
@@ -7,9 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
- - Added optional `activeAbTests` context support so Unified SwapBridge events can include `active_ab_tests` independently of `ab_tests`. ([#8152](https://github.com/MetaMask/core/pull/8152))
12
-
13
10
  ### Changed
14
11
 
15
12
  - Bump `@metamask/transaction-controller` from `^62.19.0` to `^62.20.0` ([#8104](https://github.com/MetaMask/core/pull/8104))
@@ -208,7 +208,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
208
208
  });
209
209
  });
210
210
  _BridgeStatusController_addTxToHistory.set(this, (startPollingForBridgeTxStatusArgs, actionId) => {
211
- const { bridgeTxMeta, statusRequest, quoteResponse, startTime, slippagePercentage, initialDestAssetBalance, targetContractAddress, approvalTxId, isStxEnabled, location, abTests, activeAbTests, accountAddress: selectedAddress, } = startPollingForBridgeTxStatusArgs;
211
+ const { bridgeTxMeta, statusRequest, quoteResponse, startTime, slippagePercentage, initialDestAssetBalance, targetContractAddress, approvalTxId, isStxEnabled, location, abTests, accountAddress: selectedAddress, } = startPollingForBridgeTxStatusArgs;
212
212
  // Determine the key for this history item:
213
213
  // - For pre-submission (non-batch EVM): use actionId
214
214
  // - For post-submission or other cases: use bridgeTxMeta.id
@@ -250,7 +250,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
250
250
  featureId: quoteResponse.featureId,
251
251
  location,
252
252
  ...(abTests && { abTests }),
253
- ...(activeAbTests && { activeAbTests }),
254
253
  };
255
254
  this.update((state) => {
256
255
  // Use actionId as key for pre-submission, or txMeta.id for post-submission
@@ -715,11 +714,10 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
715
714
  * @param isStxEnabledOnClient - Whether smart transactions are enabled on the client, for example the getSmartTransactionsEnabled selector value from the extension
716
715
  * @param quotesReceivedContext - The context for the QuotesReceived event
717
716
  * @param location - The entry point from which the user initiated the swap or bridge (e.g. Main View, Token View, Trending Explore)
718
- * @param abTests - Legacy A/B test context for `ab_tests` (backward compatibility)
719
- * @param activeAbTests - New A/B test context for `active_ab_tests` (migration target). Attributes events to specific experiments.
717
+ * @param abTests - A/B test context to attribute events to specific experiments
720
718
  * @returns The transaction meta
721
719
  */
722
- this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient, quotesReceivedContext, location = bridge_controller_1.MetaMetricsSwapsEventSource.MainView, abTests, activeAbTests) => {
720
+ this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient, quotesReceivedContext, location = bridge_controller_1.MetaMetricsSwapsEventSource.MainView, abTests) => {
723
721
  this.messenger.call('BridgeController:stopPollingForQuotes', bridge_controller_1.AbortReason.TransactionSubmitted,
724
722
  // If trade is submitted before all quotes are loaded, the QuotesReceived event is published
725
723
  // If the trade has a featureId, it means it was submitted outside of the Unified Swap and Bridge experience, so no QuotesReceived event is published
@@ -729,7 +727,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
729
727
  throw new Error('Failed to submit cross-chain swap transaction: undefined multichain account');
730
728
  }
731
729
  const isHardwareAccount = (0, bridge_controller_1.isHardwareWallet)(selectedAccount);
732
- const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, isStxEnabledOnClient, isHardwareAccount, location, abTests, activeAbTests);
730
+ const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, isStxEnabledOnClient, isHardwareAccount, location, abTests);
733
731
  // Emit Submitted event after submit button is clicked
734
732
  !quoteResponse.featureId &&
735
733
  __classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Submitted, undefined, preConfirmationProperties);
@@ -852,7 +850,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
852
850
  approvalTxId,
853
851
  location,
854
852
  abTests,
855
- activeAbTests,
856
853
  }, actionId);
857
854
  // Pass txFee when gasIncluded is true to use the quote's gas fees
858
855
  // instead of re-estimating (which would fail for max native token swaps)
@@ -894,7 +891,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
894
891
  approvalTxId,
895
892
  location,
896
893
  abTests,
897
- activeAbTests,
898
894
  });
899
895
  }
900
896
  if ((0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId)) {
@@ -919,17 +915,16 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
919
915
  * @param params.quoteResponse - Quote carrying intent data
920
916
  * @param params.accountAddress - The EOA submitting the order
921
917
  * @param params.location - The entry point from which the user initiated the swap or bridge
922
- * @param params.abTests - Legacy A/B test context for `ab_tests` (backward compatibility)
923
- * @param params.activeAbTests - New A/B test context for `active_ab_tests` (migration target). Attributes events to specific experiments.
918
+ * @param params.abTests - A/B test context to attribute events to specific experiments
924
919
  * @returns A lightweight TransactionMeta-like object for history linking
925
920
  */
926
921
  this.submitIntent = async (params) => {
927
- const { quoteResponse, accountAddress, location, abTests, activeAbTests } = params;
922
+ const { quoteResponse, accountAddress, location, abTests } = params;
928
923
  this.messenger.call('BridgeController:stopPollingForQuotes', bridge_controller_1.AbortReason.TransactionSubmitted);
929
924
  // Build pre-confirmation properties for error tracking parity with submitTx
930
925
  const account = __classPrivateFieldGet(this, _BridgeStatusController_instances, "m", _BridgeStatusController_getMultichainSelectedAccount).call(this, accountAddress);
931
926
  const isHardwareAccount = Boolean(account) && (0, bridge_controller_1.isHardwareWallet)(account);
932
- const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, false, isHardwareAccount, location, abTests, activeAbTests);
927
+ const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, false, isHardwareAccount, location, abTests);
933
928
  try {
934
929
  const intent = (0, transaction_1.getIntentFromQuote)(quoteResponse);
935
930
  // If backend provided an approval tx for this intent quote, submit it first (on-chain),
@@ -1029,7 +1024,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
1029
1024
  startTime,
1030
1025
  location,
1031
1026
  abTests,
1032
- activeAbTests,
1033
1027
  });
1034
1028
  // Start polling using the orderId key to route to intent manager
1035
1029
  __classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, bridgeHistoryKey);
@@ -1056,15 +1050,11 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
1056
1050
  * @param eventProperties - The properties for the event
1057
1051
  */
1058
1052
  _BridgeStatusController_trackUnifiedSwapBridgeEvent.set(this, (eventName, txMetaId, eventProperties) => {
1059
- // Legacy/new metrics fields are intentionally kept independent during migration.
1053
+ const { ab_tests: eventAbTests } = eventProperties ?? {};
1060
1054
  const historyAbTests = txMetaId
1061
1055
  ? this.state.txHistory?.[txMetaId]?.abTests
1062
1056
  : undefined;
1063
- const historyActiveAbTests = txMetaId
1064
- ? this.state.txHistory?.[txMetaId]?.activeAbTests
1065
- : undefined;
1066
- const resolvedAbTests = eventProperties?.ab_tests ?? historyAbTests;
1067
- const resolvedActiveAbTests = eventProperties?.active_ab_tests ?? historyActiveAbTests;
1057
+ const resolvedAbTests = eventAbTests ?? historyAbTests ?? undefined;
1068
1058
  const baseProperties = {
1069
1059
  action_type: bridge_controller_1.MetricsActionType.SWAPBRIDGE_V1,
1070
1060
  location: eventProperties?.location ??
@@ -1075,10 +1065,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
1075
1065
  Object.keys(resolvedAbTests).length > 0 && {
1076
1066
  ab_tests: resolvedAbTests,
1077
1067
  }),
1078
- ...(resolvedActiveAbTests &&
1079
- Object.keys(resolvedActiveAbTests).length > 0 && {
1080
- active_ab_tests: resolvedActiveAbTests,
1081
- }),
1082
1068
  };
1083
1069
  // This will publish events for PERPS dropped tx failures as well
1084
1070
  if (!txMetaId) {