|
@@ -15,8 +15,9 @@ import {
|
|
|
Plan,
|
|
Plan,
|
|
|
PriceForDisplayData,
|
|
PriceForDisplayData,
|
|
|
} from '../../../../../types/subscription/plan'
|
|
} from '../../../../../types/subscription/plan'
|
|
|
-import { Institution as ManagedInstitution } from '../components/dashboard/managed-institutions'
|
|
|
|
|
import { Institution } from '../../../../../types/institution'
|
|
import { Institution } from '../../../../../types/institution'
|
|
|
|
|
+import { Institution as ManagedInstitution } from '../components/dashboard/managed-institutions'
|
|
|
|
|
+import { Publisher as ManagedPublisher } from '../components/dashboard/managed-publishers'
|
|
|
import getMeta from '../../../utils/meta'
|
|
import getMeta from '../../../utils/meta'
|
|
|
import {
|
|
import {
|
|
|
loadDisplayPriceWithTaxPromise,
|
|
loadDisplayPriceWithTaxPromise,
|
|
@@ -40,6 +41,7 @@ type SubscriptionDashboardContextValue = {
|
|
|
institutionMemberships?: Institution[]
|
|
institutionMemberships?: Institution[]
|
|
|
managedGroupSubscriptions: ManagedGroupSubscription[]
|
|
managedGroupSubscriptions: ManagedGroupSubscription[]
|
|
|
managedInstitutions: ManagedInstitution[]
|
|
managedInstitutions: ManagedInstitution[]
|
|
|
|
|
+ managedPublishers: ManagedPublisher[]
|
|
|
updateManagedInstitution: (institution: ManagedInstitution) => void
|
|
updateManagedInstitution: (institution: ManagedInstitution) => void
|
|
|
modalIdShown?: SubscriptionDashModalIds
|
|
modalIdShown?: SubscriptionDashModalIds
|
|
|
personalSubscription?: Subscription
|
|
personalSubscription?: Subscription
|
|
@@ -106,13 +108,15 @@ export function SubscriptionDashboardProvider({
|
|
|
const [managedInstitutions, setManagedInstitutions] = useState<
|
|
const [managedInstitutions, setManagedInstitutions] = useState<
|
|
|
ManagedInstitution[]
|
|
ManagedInstitution[]
|
|
|
>(getMeta('ol-managedInstitutions'))
|
|
>(getMeta('ol-managedInstitutions'))
|
|
|
|
|
+ const managedPublishers = getMeta('ol-managedPublishers')
|
|
|
const recurlyApiKey = getMeta('ol-recurlyApiKey')
|
|
const recurlyApiKey = getMeta('ol-recurlyApiKey')
|
|
|
|
|
|
|
|
const hasDisplayedSubscription =
|
|
const hasDisplayedSubscription =
|
|
|
institutionMemberships?.length > 0 ||
|
|
institutionMemberships?.length > 0 ||
|
|
|
personalSubscription ||
|
|
personalSubscription ||
|
|
|
managedGroupSubscriptions?.length > 0 ||
|
|
managedGroupSubscriptions?.length > 0 ||
|
|
|
- managedInstitutions?.length > 0
|
|
|
|
|
|
|
+ managedInstitutions?.length > 0 ||
|
|
|
|
|
+ managedPublishers?.length > 0
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (!isRecurlyLoaded()) {
|
|
if (!isRecurlyLoaded()) {
|
|
@@ -224,6 +228,7 @@ export function SubscriptionDashboardProvider({
|
|
|
institutionMemberships,
|
|
institutionMemberships,
|
|
|
managedGroupSubscriptions,
|
|
managedGroupSubscriptions,
|
|
|
managedInstitutions,
|
|
managedInstitutions,
|
|
|
|
|
+ managedPublishers,
|
|
|
updateManagedInstitution,
|
|
updateManagedInstitution,
|
|
|
modalIdShown,
|
|
modalIdShown,
|
|
|
personalSubscription,
|
|
personalSubscription,
|
|
@@ -255,6 +260,7 @@ export function SubscriptionDashboardProvider({
|
|
|
institutionMemberships,
|
|
institutionMemberships,
|
|
|
managedGroupSubscriptions,
|
|
managedGroupSubscriptions,
|
|
|
managedInstitutions,
|
|
managedInstitutions,
|
|
|
|
|
+ managedPublishers,
|
|
|
updateManagedInstitution,
|
|
updateManagedInstitution,
|
|
|
modalIdShown,
|
|
modalIdShown,
|
|
|
personalSubscription,
|
|
personalSubscription,
|