|
1 | | -import React, { useContext } from 'react'; |
| 1 | +import React, { useContext, useMemo } from 'react'; |
2 | 2 | import { useHistory } from 'react-router-dom'; |
3 | 3 | import { useDispatch, useSelector } from 'react-redux'; |
4 | 4 | ///: BEGIN:ONLY_INCLUDE_IF(build-experimental) |
@@ -97,7 +97,10 @@ import { |
97 | 97 | } from '../menu-items'; |
98 | 98 | import { getIsMultichainAccountsState2Enabled } from '../../../selectors/multichain-accounts/feature-flags'; |
99 | 99 | import { useUserSubscriptions } from '../../../hooks/subscription/useSubscription'; |
100 | | -import { getIsShieldSubscriptionActive } from '../../../../shared/lib/shield'; |
| 100 | +import { |
| 101 | + getIsShieldSubscriptionActive, |
| 102 | + getIsShieldSubscriptionPaused, |
| 103 | +} from '../../../../shared/lib/shield'; |
101 | 104 | import { useRewardsContext } from '../../../contexts/rewards'; |
102 | 105 |
|
103 | 106 | const METRICS_LOCATION = 'Global Menu'; |
@@ -127,6 +130,8 @@ export const GlobalMenu = ({ |
127 | 130 | const { subscriptions } = useUserSubscriptions(); |
128 | 131 | const isActiveShieldSubscription = |
129 | 132 | getIsShieldSubscriptionActive(subscriptions); |
| 133 | + const isPausedShieldSubscription = |
| 134 | + getIsShieldSubscriptionPaused(subscriptions); |
130 | 135 |
|
131 | 136 | const account = useSelector(getSelectedInternalAccount); |
132 | 137 |
|
@@ -165,6 +170,17 @@ export const GlobalMenu = ({ |
165 | 170 | const preferences = useSelector(getPreferences); |
166 | 171 | const isSidePanelDefault = preferences?.useSidePanelAsDefault ?? true; |
167 | 172 |
|
| 173 | + const showPriorityTag = useMemo( |
| 174 | + () => |
| 175 | + (isActiveShieldSubscription || isPausedShieldSubscription) && |
| 176 | + basicFunctionality, |
| 177 | + [ |
| 178 | + isActiveShieldSubscription, |
| 179 | + isPausedShieldSubscription, |
| 180 | + basicFunctionality, |
| 181 | + ], |
| 182 | + ); |
| 183 | + |
168 | 184 | /** |
169 | 185 | * Toggles between side panel and popup as the default extension behavior |
170 | 186 | */ |
@@ -469,7 +485,7 @@ export const GlobalMenu = ({ |
469 | 485 | justifyContent={JustifyContent.spaceBetween} |
470 | 486 | > |
471 | 487 | {supportText} |
472 | | - {isActiveShieldSubscription && basicFunctionality && ( |
| 488 | + {showPriorityTag && ( |
473 | 489 | <Tag |
474 | 490 | label={t('priority')} |
475 | 491 | labelProps={{ |
|
0 commit comments