web/satellite: Implement coupon code billing UI enabled flag

This flag was previously implemented, but when we reworked the billing
UI, we forgot to re-implement it with the new screens.

This change fixes that.

Change-Id: Ifad2b82f1080928b72d7e572796fcf4287e5ed3f
This commit is contained in:
Moby von Briesen 2023-03-30 11:34:23 -04:00
parent dc9cbe36ae
commit f8e8f3a4cc

View File

@ -17,6 +17,7 @@
<p class="coupon-area__wrapper__coupon__expiration">{{ expiration }}</p>
</div>
<div
v-if="couponCodeBillingUIEnabled"
class="coupon-area__wrapper__add-coupon"
@click="toggleCreateModal"
>
@ -94,10 +95,20 @@ const isActive = computed((): boolean => {
return !!c && (c.duration === 'forever' || (!!c.expiresAt && now < c.expiresAt.getTime()));
});
/**
* Returns the whether applying a new coupon is enabled.
*/
const couponCodeBillingUIEnabled = computed((): boolean => {
return store.state.appStateModule.couponCodeBillingUIEnabled;
});
/**
* Opens Add Coupon modal.
*/
function toggleCreateModal(): void {
if (!couponCodeBillingUIEnabled) {
return;
}
analytics.eventTriggered(AnalyticsEvent.APPLY_NEW_COUPON_CLICKED);
store.commit(APP_STATE_MUTATIONS.UPDATE_ACTIVE_MODAL, MODALS.newBillingAddCoupon);
}