Feature/migrate coupon redemption prompt dialog (#4150)
* Migrate coupon redemption prompt dialog * Update changelog
This commit is contained in:
parent
28f7781fa2
commit
ff7caf9c5c
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Improved support for automatic deletion of unused asset profiles when deleting activities
|
- Improved support for automatic deletion of unused asset profiles when deleting activities
|
||||||
|
- Migrated the coupon redemption to the notification service for prompt dialogs
|
||||||
- Improved the language localization for German (`de`)
|
- Improved the language localization for German (`de`)
|
||||||
- Eliminated `body-parser` in favor of using `@nestjs/platform-express`
|
- Eliminated `body-parser` in favor of using `@nestjs/platform-express`
|
||||||
- Upgraded the _Stripe_ dependencies
|
- Upgraded the _Stripe_ dependencies
|
||||||
|
@ -164,50 +164,54 @@ export class UserAccountMembershipComponent implements OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onRedeemCoupon() {
|
public onRedeemCoupon() {
|
||||||
let couponCode = prompt($localize`Please enter your coupon code:`);
|
this.notificationService.prompt({
|
||||||
couponCode = couponCode?.trim();
|
confirmFn: (value) => {
|
||||||
|
const couponCode = value?.trim();
|
||||||
|
|
||||||
if (couponCode) {
|
if (couponCode) {
|
||||||
this.dataService
|
this.dataService
|
||||||
.redeemCoupon(couponCode)
|
.redeemCoupon(couponCode)
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
this.snackBar.open(
|
this.snackBar.open(
|
||||||
'😞 ' + $localize`Could not redeem coupon code`,
|
'😞 ' + $localize`Could not redeem coupon code`,
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
duration: ms('3 seconds')
|
duration: ms('3 seconds')
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
}),
|
}),
|
||||||
takeUntil(this.unsubscribeSubject)
|
takeUntil(this.unsubscribeSubject)
|
||||||
)
|
)
|
||||||
.subscribe(() => {
|
|
||||||
this.snackBarRef = this.snackBar.open(
|
|
||||||
'✅ ' + $localize`Coupon code has been redeemed`,
|
|
||||||
$localize`Reload`,
|
|
||||||
{
|
|
||||||
duration: 3000
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this.snackBarRef
|
|
||||||
.afterDismissed()
|
|
||||||
.pipe(takeUntil(this.unsubscribeSubject))
|
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
window.location.reload();
|
this.snackBarRef = this.snackBar.open(
|
||||||
});
|
'✅ ' + $localize`Coupon code has been redeemed`,
|
||||||
|
$localize`Reload`,
|
||||||
|
{
|
||||||
|
duration: 3000
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
this.snackBarRef
|
this.snackBarRef
|
||||||
.onAction()
|
.afterDismissed()
|
||||||
.pipe(takeUntil(this.unsubscribeSubject))
|
.pipe(takeUntil(this.unsubscribeSubject))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.snackBarRef
|
||||||
|
.onAction()
|
||||||
|
.pipe(takeUntil(this.unsubscribeSubject))
|
||||||
|
.subscribe(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
},
|
||||||
|
title: $localize`Please enter your coupon code.`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnDestroy() {
|
public ngOnDestroy() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user