Skip to content

Commit

Permalink
Remove type
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementPasteau committed Jan 16, 2025
1 parent 18a2e8b commit d51bd15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
type SubscriptionPlanPricingSystem,
} from '../../../Utils/GDevelopServices/Usage';
import { sendChoosePlanClicked } from '../../../Utils/Analytics/EventSender';
import { type PurchasablePlanId } from '../SubscriptionSuggestionContext';
import Window from '../../../Utils/Window';
import Text from '../../../UI/Text';
import { ColumnStackLayout, LineStackLayout } from '../../../UI/Layout';
Expand All @@ -26,7 +25,7 @@ import AlertMessage from '../../../UI/AlertMessage';
type Props = {|
onClose: Function,
subscriptionPlansWithPricingSystems: ?(SubscriptionPlanWithPricingSystems[]),
recommendedPlanId: PurchasablePlanId,
recommendedPlanId: string,
onOpenPendingDialog: (open: boolean) => void,
|};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@ import useSubscriptionPlans, {
} from '../../Utils/UseSubscriptionPlans';
import PromotionSubscriptionDialog from './PromotionSubscriptionDialog';
import SubscriptionPendingDialog from './SubscriptionPendingDialog';
import LoaderModal from '../../UI/LoaderModal';

export type SubscriptionType = 'individual' | 'team' | 'education';
export type PurchasablePlanId =
| 'gdevelop_silver'
| 'gdevelop_gold'
| 'gdevelop_startup'
| 'gdevelop_education';

export type SubscriptionAnalyticsMetadata = {|
reason: SubscriptionDialogDisplayReason,
recommendedPlanId?: PurchasablePlanId,
recommendedPlanId?: string,
preStep?: 'subscriptionChecker',
|};

Expand Down Expand Up @@ -171,8 +167,10 @@ export const SubscriptionSuggestionProvider = ({
/>
)}
{analyticsMetadata ? (
!hasValidSubscriptionPlan(authenticatedUser.subscription) &&
analyticsMetadata.recommendedPlanId ? (
authenticatedUser.loginState === 'loggingIn' ? (
<LoaderModal show />
) : !hasValidSubscriptionPlan(authenticatedUser.subscription) &&
analyticsMetadata.recommendedPlanId ? (
<PromotionSubscriptionDialog
subscriptionPlansWithPricingSystems={
availableSubscriptionPlansWithPrices
Expand Down
22 changes: 4 additions & 18 deletions newIDE/app/src/Utils/UseOpenInitialDialog.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// @flow
import * as React from 'react';
import RouterContext from '../MainFrame/RouterContext';
import {
SubscriptionSuggestionContext,
type PurchasablePlanId,
} from '../Profile/Subscription/SubscriptionSuggestionContext';
import { SubscriptionSuggestionContext } from '../Profile/Subscription/SubscriptionSuggestionContext';
import { FLING_GAME_IN_APP_TUTORIAL_ID } from './GDevelopServices/InAppTutorial';
import AuthenticatedUserContext from '../Profile/AuthenticatedUserContext';

Expand Down Expand Up @@ -37,24 +34,13 @@ const useOpenInitialDialog = ({
() => {
switch (routeArguments['initial-dialog']) {
case 'subscription':
let recommendedPlanId = routeArguments['recommended-plan-id'];
if (
![
'gdevelop_silver',
'gdevelop_gold',
'gdevelop_education',
'gdevelop_startup',
].includes(recommendedPlanId)
) {
recommendedPlanId = 'gdevelop_silver';
}
// $FlowFixMe - we know that recommendedPlanId is a valid PurchasablePlanId
const verifiedPlanId: PurchasablePlanId = recommendedPlanId;
let recommendedPlanId =
routeArguments['recommended-plan-id'] || 'gdevelop_silver';

openSubscriptionDialog({
analyticsMetadata: {
reason: 'Landing dialog at opening',
recommendedPlanId: verifiedPlanId,
recommendedPlanId,
},
});
removeRouteArguments(['initial-dialog', 'recommended-plan-id']);
Expand Down

0 comments on commit d51bd15

Please sign in to comment.