diff --git a/src/app/extensions/product-notifications/models/product-notification/product-notification.mapper.spec.ts b/src/app/extensions/product-notifications/models/product-notification/product-notification.mapper.spec.ts
index 40679115f1d..821d9d4cc42 100644
--- a/src/app/extensions/product-notifications/models/product-notification/product-notification.mapper.spec.ts
+++ b/src/app/extensions/product-notifications/models/product-notification/product-notification.mapper.spec.ts
@@ -3,7 +3,7 @@ import { TestBed } from '@angular/core/testing';
import { ProductNotificatioData } from './product-notification.interface';
import { ProductNotificatioMapper } from './product-notification.mapper';
-describe('Product Notificatio Mapper', () => {
+describe('Product Notification Mapper', () => {
let productNotificatioMapper: ProductNotificatioMapper;
beforeEach(() => {
@@ -19,6 +19,9 @@ describe('Product Notificatio Mapper', () => {
const data: ProductNotificatioData = {
incomingField: 'test',
otherField: false,
+ sku: 'product_sku',
+ notificationMailAddress: 'test@test.intershop.de',
+ price: { type: 'Money', value: 75, currencyMnemonic: 'USD', currency: 'USD' },
};
const mapped = productNotificatioMapper.fromData(data);
expect(mapped).toHaveProperty('id', 'test');
diff --git a/src/app/extensions/product-notifications/pages/account-product-notifications/account-product-notifications-page.component.html b/src/app/extensions/product-notifications/pages/account-product-notifications/account-product-notifications-page.component.html
index e1cf238dc36..9e691435f19 100644
--- a/src/app/extensions/product-notifications/pages/account-product-notifications/account-product-notifications-page.component.html
+++ b/src/app/extensions/product-notifications/pages/account-product-notifications/account-product-notifications-page.component.html
@@ -3,7 +3,7 @@
{{ 'account.notifications.heading' | translate }}
{{ 'account.notifications.price.heading' | translate }}
- 0" class="list-body">
+
{{ productNotification.sku }} | {{ productNotification.type }} |
@@ -15,7 +15,7 @@
{{ 'account.notifications.price.heading' | translate }}
{{ 'account.notifications.backinstock.heading' | translate }}
- 0" class="list-body">
+
{{ productNotification.sku }} | {{ productNotification.type }} |
diff --git a/src/app/extensions/product-notifications/pages/product-notifications-routing.module.ts b/src/app/extensions/product-notifications/pages/product-notifications-routing.module.ts
index 47a97f9f7a3..7fad879bb02 100644
--- a/src/app/extensions/product-notifications/pages/product-notifications-routing.module.ts
+++ b/src/app/extensions/product-notifications/pages/product-notifications-routing.module.ts
@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { FeatureToggleGuard } from 'ish-core/feature-toggle.module';
+import { AuthGuard } from 'ish-core/guards/auth.guard';
const routes: Routes = [
{
@@ -10,7 +11,7 @@ const routes: Routes = [
import('./account-product-notifications/account-product-notifications-page.module').then(
m => m.AccountProductNotificationsPageModule
),
- canActivate: [FeatureToggleGuard],
+ canActivate: [FeatureToggleGuard, AuthGuard],
data: { feature: 'productNotifications' },
},
];
diff --git a/src/app/extensions/product-notifications/services/product-notifications/product-notifications.service.ts b/src/app/extensions/product-notifications/services/product-notifications/product-notifications.service.ts
index ac60c720f2e..2fb27c69666 100644
--- a/src/app/extensions/product-notifications/services/product-notifications/product-notifications.service.ts
+++ b/src/app/extensions/product-notifications/services/product-notifications/product-notifications.service.ts
@@ -20,6 +20,13 @@ export class ProductNotificationsService {
private currentCustomer$ = this.store.pipe(select(getLoggedInCustomer), whenTruthy(), take(1));
+ /**
+ * Get all product notifications of a specific type from a customer.
+ *
+ * @param notificationType The type of the product notifications.
+ * Possible types are 'price' (a specific product price is reached) and 'stock' (product is back in stock)
+ * @returns All product notifications of a specific type from the customer.
+ */
getProductNotifications(notificationType: ProductNotificationType): Observable
{
return this.currentCustomer$.pipe(
switchMap(customer =>
diff --git a/src/app/extensions/product-notifications/store/product-notification/product-notification.actions.ts b/src/app/extensions/product-notifications/store/product-notification/product-notification.actions.ts
index 642aacc02ab..6d2caf6de77 100644
--- a/src/app/extensions/product-notifications/store/product-notification/product-notification.actions.ts
+++ b/src/app/extensions/product-notifications/store/product-notification/product-notification.actions.ts
@@ -13,11 +13,11 @@ export const loadProductNotifications = createAction(
);
export const loadProductNotificationsSuccess = createAction(
- '[ProductNotification] Load ProductNotifications Success',
+ '[ProductNotification API] Load ProductNotifications Success',
payload<{ productNotifications: ProductNotification[] }>()
);
export const loadProductNotificationsFail = createAction(
- '[ProductNotification] Load ProductNotifications Fail',
+ '[ProductNotification API] Load ProductNotifications Fail',
httpError()
);
diff --git a/src/app/extensions/product-notifications/store/product-notification/product-notification.effects.ts b/src/app/extensions/product-notifications/store/product-notification/product-notification.effects.ts
index 498a853759e..f0eee5a8848 100644
--- a/src/app/extensions/product-notifications/store/product-notification/product-notification.effects.ts
+++ b/src/app/extensions/product-notifications/store/product-notification/product-notification.effects.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { concatMap, map } from 'rxjs';
-import { mapErrorToAction, mapToPayload } from 'ish-core/utils/operators';
+import { mapErrorToAction, mapToPayloadProperty } from 'ish-core/utils/operators';
import { ProductNotificationsService } from '../../services/product-notifications/product-notifications.service';
@@ -19,8 +19,8 @@ export class ProductNotificationEffects {
loadProductNotifications$ = createEffect(() =>
this.actions$.pipe(
ofType(loadProductNotifications),
- mapToPayload(),
- concatMap(({ type }) =>
+ mapToPayloadProperty('type'),
+ concatMap(type =>
this.productNotificationsService.getProductNotifications(type).pipe(
map(productNotifications => loadProductNotificationsSuccess({ productNotifications })),
mapErrorToAction(loadProductNotificationsFail)
diff --git a/src/app/extensions/product-notifications/store/product-notifications-store.module.ts b/src/app/extensions/product-notifications/store/product-notifications-store.module.ts
index e31d79e8ae4..9cee3d0065f 100644
--- a/src/app/extensions/product-notifications/store/product-notifications-store.module.ts
+++ b/src/app/extensions/product-notifications/store/product-notifications-store.module.ts
@@ -1,8 +1,10 @@
-import { NgModule } from '@angular/core';
+import { Injectable, NgModule } from '@angular/core';
import { EffectsModule } from '@ngrx/effects';
-import { ActionReducerMap, StoreModule } from '@ngrx/store';
+import { ActionReducerMap, StoreConfig, StoreModule } from '@ngrx/store';
import { pick } from 'lodash-es';
+import { resetOnLogoutMeta } from 'ish-core/utils/meta-reducers';
+
import { ProductNotificationEffects } from './product-notification/product-notification.effects';
import { productNotificationReducer } from './product-notification/product-notification.reducer';
import { ProductNotificationsState } from './product-notifications-store';
@@ -13,7 +15,11 @@ const productNotificationsReducers: ActionReducerMap
const productNotificationsEffects = [ProductNotificationEffects];
-// not-dead-code
+@Injectable()
+export class ProductNotificationsConfig implements StoreConfig {
+ metaReducers = [resetOnLogoutMeta];
+}
+
@NgModule({
imports: [
EffectsModule.forFeature(productNotificationsEffects),