|
@@ -40,6 +40,7 @@ type SubscriptionDashboardContextValue = {
|
|
|
planCode?: string
|
|
planCode?: string
|
|
|
) => void
|
|
) => void
|
|
|
hasDisplayedSubscription: boolean
|
|
hasDisplayedSubscription: boolean
|
|
|
|
|
+ hasValidActiveSubscription: boolean
|
|
|
institutionMemberships?: Institution[]
|
|
institutionMemberships?: Institution[]
|
|
|
managedGroupSubscriptions: ManagedGroupSubscription[]
|
|
managedGroupSubscriptions: ManagedGroupSubscription[]
|
|
|
memberGroupSubscriptions: MemberGroupSubscription[]
|
|
memberGroupSubscriptions: MemberGroupSubscription[]
|
|
@@ -132,6 +133,12 @@ export function SubscriptionDashboardProvider({
|
|
|
managedPublishers?.length > 0
|
|
managedPublishers?.length > 0
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ const hasValidActiveSubscription = Boolean(
|
|
|
|
|
+ ['active', 'canceled'].includes(personalSubscription?.recurly?.state) ||
|
|
|
|
|
+ institutionMemberships?.length > 0 ||
|
|
|
|
|
+ memberGroupSubscriptions?.length > 0
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (!isRecurlyLoaded()) {
|
|
if (!isRecurlyLoaded()) {
|
|
|
setRecurlyLoadError(true)
|
|
setRecurlyLoadError(true)
|
|
@@ -243,6 +250,7 @@ export function SubscriptionDashboardProvider({
|
|
|
handleCloseModal,
|
|
handleCloseModal,
|
|
|
handleOpenModal,
|
|
handleOpenModal,
|
|
|
hasDisplayedSubscription,
|
|
hasDisplayedSubscription,
|
|
|
|
|
+ hasValidActiveSubscription,
|
|
|
institutionMemberships,
|
|
institutionMemberships,
|
|
|
managedGroupSubscriptions,
|
|
managedGroupSubscriptions,
|
|
|
memberGroupSubscriptions,
|
|
memberGroupSubscriptions,
|
|
@@ -277,6 +285,7 @@ export function SubscriptionDashboardProvider({
|
|
|
handleCloseModal,
|
|
handleCloseModal,
|
|
|
handleOpenModal,
|
|
handleOpenModal,
|
|
|
hasDisplayedSubscription,
|
|
hasDisplayedSubscription,
|
|
|
|
|
+ hasValidActiveSubscription,
|
|
|
institutionMemberships,
|
|
institutionMemberships,
|
|
|
managedGroupSubscriptions,
|
|
managedGroupSubscriptions,
|
|
|
memberGroupSubscriptions,
|
|
memberGroupSubscriptions,
|