Ensure confirmation is visible

This commit is contained in:
Manav Rathi
2024-11-07 19:14:07 +05:30
parent 7385d665d2
commit 33ec855b40

View File

@@ -746,20 +746,26 @@ const StripeSubscriptionOptions: React.FC<StripeSubscriptionOptionsProps> = ({
}),
continue: {
text: t("REACTIVATE_SUBSCRIPTION"),
action: reactivate,
action: async () => {
await activateStripeSubscription();
onClose();
// [Note: Chained MiniDialogs]
//
// The MiniDialog will automatically close when we the
// action promise resolves, so if we want to show another
// dialog, schedule it on the next run loop.
setTimeout(() => {
showMiniDialog({
title: t("success"),
message: t("SUBSCRIPTION_ACTIVATE_SUCCESS"),
continue: { action: onClose },
cancel: false,
});
}, 0);
},
},
});
const reactivate = async () => {
await activateStripeSubscription();
showMiniDialog({
title: t("success"),
message: t("SUBSCRIPTION_ACTIVATE_SUCCESS"),
continue: { action: onClose },
cancel: false,
});
};
const confirmCancel = () =>
showMiniDialog({
title: t("CANCEL_SUBSCRIPTION"),
@@ -771,24 +777,21 @@ const StripeSubscriptionOptions: React.FC<StripeSubscriptionOptionsProps> = ({
continue: {
text: t("CANCEL_SUBSCRIPTION"),
color: "critical",
action: cancel,
action: async () => {
await cancelStripeSubscription();
onClose();
// See: [Note: Chained MiniDialogs]
setTimeout(() => {
showMiniDialog({
message: t("SUBSCRIPTION_CANCEL_SUCCESS"),
cancel: t("ok"),
});
}, 0);
},
},
cancel: t("NEVERMIND"),
});
const cancel = async () => {
await cancelStripeSubscription();
showMiniDialog({
title: t("success"),
message: t("SUBSCRIPTION_CANCEL_SUCCESS"),
continue: {
color: "secondary",
action: onClose,
},
cancel: false,
});
};
const handleManageClick = useWrapAsyncOperation(redirectToCustomerPortal);
return (