-
-
-
+ <>
+
+
+
+
+
+
+
+
+
+ {this.props.isUserConnected && (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )}
+ {this.props.isOnCustomerLoginPage &&
}
- {this.props.isUserConnected && (
- <>
-
-
- >
+ {this.state.cancelAt && (
+
+ ;
+
+ Assurez vous de sauvegarder tout ce dont vous avez besoin avant la fin de votre abonnement le{" "}
+ {this.state.cancelAt.toLocaleDateString()}.
+
+
)}
- {this.props.isOnCustomerLoginPage &&
}
-
+ >
);
}
public override componentDidMount() {
this.onWindowResize = WindowStore.getInstance().onResize((window) => this.onResize(window));
+ this.loadSubscription();
}
public override componentWillUnmount() {
this.onWindowResize();
}
+ public async loadSubscription() {
+ const jwt = JwtService.getInstance().decodeJwt();
+ const subscription = await Subscriptions.getInstance().get({ where: { office: { uid: jwt?.office_Id } } });
+ if (subscription[0]) {
+ const stripeSubscription = await Stripe.getInstance().getStripeSubscriptionByUid(subscription[0].stripe_subscription_id!);
+ if (stripeSubscription.cancel_at !== null)
+ this.setState({
+ ...this.state,
+ cancelAt: new Date(stripeSubscription.cancel_at! * 1000),
+ });
+ }
+ }
private onResize(window: Window) {
if (window.innerWidth > this.headerBreakpoint && this.state.isBurgerMenuOpen) this.setState({ isBurgerMenuOpen: false });
if (window.innerWidth < this.headerBreakpoint && this.state.isProfileMenuOpen) this.setState({ isProfileMenuOpen: false });