@daffodil/customer-store-credit 0.94.1 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/fesm2022/daffodil-customer-store-credit-driver-in-memory.mjs +147 -116
  2. package/fesm2022/daffodil-customer-store-credit-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs +51 -0
  4. package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs.map +1 -0
  5. package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7.mjs +157 -0
  6. package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7.mjs.map +1 -0
  7. package/fesm2022/daffodil-customer-store-credit-driver-magento-auto-testing.mjs +7 -0
  8. package/fesm2022/daffodil-customer-store-credit-driver-magento-auto-testing.mjs.map +1 -0
  9. package/fesm2022/daffodil-customer-store-credit-driver-magento-auto.mjs +7 -0
  10. package/fesm2022/daffodil-customer-store-credit-driver-magento-auto.mjs.map +1 -0
  11. package/fesm2022/daffodil-customer-store-credit-driver-testing.mjs +93 -60
  12. package/fesm2022/daffodil-customer-store-credit-driver-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-customer-store-credit-driver.mjs +13 -39
  14. package/fesm2022/daffodil-customer-store-credit-driver.mjs.map +1 -1
  15. package/fesm2022/daffodil-customer-store-credit-routing.mjs +86 -52
  16. package/fesm2022/daffodil-customer-store-credit-routing.mjs.map +1 -1
  17. package/fesm2022/daffodil-customer-store-credit-state-testing.mjs +86 -50
  18. package/fesm2022/daffodil-customer-store-credit-state-testing.mjs.map +1 -1
  19. package/fesm2022/daffodil-customer-store-credit-state.mjs +212 -231
  20. package/fesm2022/daffodil-customer-store-credit-state.mjs.map +1 -1
  21. package/fesm2022/daffodil-customer-store-credit-testing.mjs +49 -36
  22. package/fesm2022/daffodil-customer-store-credit-testing.mjs.map +1 -1
  23. package/fesm2022/daffodil-customer-store-credit.mjs +3 -7
  24. package/fesm2022/daffodil-customer-store-credit.mjs.map +1 -1
  25. package/package.json +1 -1
  26. package/types/daffodil-customer-store-credit-driver-in-memory.d.ts +54 -54
  27. package/types/daffodil-customer-store-credit-driver-magento-2.4.7-testing.d.ts +16 -0
  28. package/types/daffodil-customer-store-credit-driver-magento-2.4.7.d.ts +62 -0
  29. package/types/daffodil-customer-store-credit-driver-magento-auto-testing.d.ts +1 -0
  30. package/types/daffodil-customer-store-credit-driver-magento-auto.d.ts +1 -0
  31. package/types/daffodil-customer-store-credit-driver-testing.d.ts +24 -22
  32. package/types/daffodil-customer-store-credit-driver.d.ts +19 -28
  33. package/types/daffodil-customer-store-credit-routing.d.ts +18 -22
  34. package/types/daffodil-customer-store-credit-state-testing.d.ts +22 -19
  35. package/types/daffodil-customer-store-credit-state.d.ts +74 -86
  36. package/types/daffodil-customer-store-credit-testing.d.ts +10 -13
  37. package/types/daffodil-customer-store-credit.d.ts +6 -10
  38. package/fesm2022/daffodil-customer-store-credit-driver-magento-testing.mjs +0 -34
  39. package/fesm2022/daffodil-customer-store-credit-driver-magento-testing.mjs.map +0 -1
  40. package/fesm2022/daffodil-customer-store-credit-driver-magento.mjs +0 -154
  41. package/fesm2022/daffodil-customer-store-credit-driver-magento.mjs.map +0 -1
  42. package/types/daffodil-customer-store-credit-driver-magento-testing.d.ts +0 -20
  43. package/types/daffodil-customer-store-credit-driver-magento.d.ts +0 -67
@@ -1,242 +1,223 @@
1
- import { createMultiInjectionToken, createSingleInjectionToken } from '@daffodil/core';
2
- import { daffOperationInitialState, daffOperationFailed, daffCompleteOperation, daffStartResolution, daffOperationStateSelectorFactory, daffTransformErrorToStateError, daffComposeReducers } from '@daffodil/core/state';
3
- import * as i1 from '@ngrx/store';
4
- import { defaultMemoize, createFeatureSelector, createSelector, select, combineReducers, StoreModule } from '@ngrx/store';
5
- import * as i0 from '@angular/core';
6
- import { Injectable, Inject, inject, NgModule } from '@angular/core';
7
- import * as i1$1 from '@ngrx/effects';
8
- import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
9
- import { of } from 'rxjs';
10
- import { switchMap, map, catchError } from 'rxjs/operators';
11
- import { DaffCustomerStoreCreditDriver } from '@daffodil/customer-store-credit/driver';
12
-
13
- /**
14
- * The customer store credit action types enum.
15
- */
1
+ import { createMultiInjectionToken, createSingleInjectionToken } from "@daffodil/core";
2
+ import { daffCompleteOperation, daffComposeReducers, daffOperationFailed, daffOperationInitialState, daffOperationStateSelectorFactory, daffStartResolution, daffTransformErrorToStateError } from "@daffodil/core/state";
3
+ import * as i1$1 from "@ngrx/store";
4
+ import { StoreModule, combineReducers, createFeatureSelector, createSelector, defaultMemoize, provideState, select } from "@ngrx/store";
5
+ import * as i0 from "@angular/core";
6
+ import { Inject, Injectable, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
7
+ import * as i1 from "@ngrx/effects";
8
+ import { EffectsModule, createEffect, ofType, provideEffects } from "@ngrx/effects";
9
+ import { of } from "rxjs";
10
+ import { catchError, map, switchMap } from "rxjs/operators";
11
+ import { DaffCustomerStoreCreditDriver } from "@daffodil/customer-store-credit/driver";
16
12
  var DaffCustomerStoreCreditActionTypes;
17
- (function (DaffCustomerStoreCreditActionTypes) {
18
- DaffCustomerStoreCreditActionTypes["StoreCreditLoadAction"] = "[@daffodil/customer-store-credit] Store Credit Load Action";
19
- DaffCustomerStoreCreditActionTypes["StoreCreditLoadSuccessAction"] = "[@daffodil/customer-store-credit] Store Credit Load Success Action";
20
- DaffCustomerStoreCreditActionTypes["StoreCreditLoadFailureAction"] = "[@daffodil/customer-store-credit] Store Credit Load Failure Action";
21
- DaffCustomerStoreCreditActionTypes["StoreCreditClearErrorsAction"] = "[@daffodil/customer-store-credit] Store Credit Clear Errors Action";
13
+ (function(DaffCustomerStoreCreditActionTypes) {
14
+ DaffCustomerStoreCreditActionTypes["StoreCreditLoadAction"] = "[@daffodil/customer-store-credit] Store Credit Load Action";
15
+ DaffCustomerStoreCreditActionTypes["StoreCreditLoadSuccessAction"] = "[@daffodil/customer-store-credit] Store Credit Load Success Action";
16
+ DaffCustomerStoreCreditActionTypes["StoreCreditLoadFailureAction"] = "[@daffodil/customer-store-credit] Store Credit Load Failure Action";
17
+ DaffCustomerStoreCreditActionTypes["StoreCreditClearErrorsAction"] = "[@daffodil/customer-store-credit] Store Credit Clear Errors Action";
22
18
  })(DaffCustomerStoreCreditActionTypes || (DaffCustomerStoreCreditActionTypes = {}));
23
- /**
24
- * Loads the store credit of the current customer.
25
- */
26
- class DaffCustomerStoreCreditLoad {
27
- constructor() {
28
- this.type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction;
29
- }
30
- }
31
- /**
32
- * Indicates a successful load of the customer's store credit.
33
- */
34
- class DaffCustomerStoreCreditLoadSuccess {
35
- constructor(payload) {
36
- this.payload = payload;
37
- this.type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction;
38
- }
39
- }
40
- /**
41
- * A failed customer store credit load with the error message.
42
- */
43
- class DaffCustomerStoreCreditLoadFailure {
44
- constructor(payload) {
45
- this.payload = payload;
46
- this.type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction;
47
- }
48
- }
49
- /**
50
- * An action to clear all errors in state.
51
- */
52
- class DaffCustomerStoreCreditClearErrors {
53
- constructor() {
54
- this.type = DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction;
55
- }
56
- }
57
-
58
- /**
59
- * The key under which the customer store credit feature state will be stored.
60
- */
61
- const DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY = 'daffCustomerStoreCredit';
62
-
63
- const {
64
- /**
65
- * A token to hold the injectable extra reducers.
66
- *
67
- * Prefer using {@link daffCustomerStoreCreditProvideExtraReducers}.
68
- */
69
- token: DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS,
70
- /**
71
- * Provides additional reducers that run after the standard Daffodil customer reducers.
72
- *
73
- * @example
74
- * ```ts
75
- * providers: [
76
- * ...daffCustomerStoreCreditProvideExtraReducers(
77
- * myReducer1,
78
- * myReducer2
79
- * )
80
- * ]
81
- * ```
82
- */
83
- provider: daffCustomerStoreCreditProvideExtraReducers, } = createMultiInjectionToken('DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS', { providedIn: 'any' });
84
-
85
- /**
86
- * The initial state for the main customer store credit state, see {@link DaffCustomerStoreCreditReducerState}.
87
- */
19
+ var DaffCustomerStoreCreditLoad = class {
20
+ constructor() {
21
+ this.type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction;
22
+ }
23
+ };
24
+ var DaffCustomerStoreCreditLoadSuccess = class {
25
+ constructor(payload) {
26
+ this.payload = payload;
27
+ this.type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction;
28
+ }
29
+ };
30
+ var DaffCustomerStoreCreditLoadFailure = class {
31
+ constructor(payload) {
32
+ this.payload = payload;
33
+ this.type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction;
34
+ }
35
+ };
36
+ var DaffCustomerStoreCreditClearErrors = class {
37
+ constructor() {
38
+ this.type = DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction;
39
+ }
40
+ };
41
+ const DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY = "daffCustomerStoreCredit";
42
+ const { token: DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS, provider: daffCustomerStoreCreditProvideExtraReducers } = createMultiInjectionToken("DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS", { providedIn: "any" });
88
43
  const daffCustomerStoreCreditInitialState = {
89
- ...daffOperationInitialState,
90
- storeCredit: {
91
- balance: 0,
92
- },
44
+ ...daffOperationInitialState,
45
+ storeCredit: { balance: 0 }
93
46
  };
94
-
95
- /**
96
- * The reducer for the customer store credit page state, see {@link DaffCustomerStoreCreditReducerState}.
97
- */
98
47
  const daffCustomerStoreCreditReducer = (state = daffCustomerStoreCreditInitialState, action) => {
99
- switch (action.type) {
100
- case DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction:
101
- return daffStartResolution(state);
102
- case DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction:
103
- return {
104
- ...daffCompleteOperation(state),
105
- storeCredit: action.payload,
106
- };
107
- case DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction:
108
- return daffCompleteOperation(state);
109
- case DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction:
110
- return daffOperationFailed([action.payload], state);
111
- default:
112
- return state;
113
- }
48
+ switch (action.type) {
49
+ case DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction: return daffStartResolution(state);
50
+ case DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction: return {
51
+ ...daffCompleteOperation(state),
52
+ storeCredit: action.payload
53
+ };
54
+ case DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction: return daffCompleteOperation(state);
55
+ case DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction: return daffOperationFailed([action.payload], state);
56
+ default: return state;
57
+ }
114
58
  };
115
-
116
- const getDaffCustomerStoreCreditReducersStateSelector = defaultMemoize(() => ({
117
- selectCustomerStoreCreditFeatureState: createFeatureSelector(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY),
118
- })).memoized;
119
-
120
- /**
121
- * Creates a group of selectors for {@link DaffCustomerStoreCreditReducerState} that use the passed state selector as the basis.
122
- */
59
+ const getDaffCustomerStoreCreditReducersStateSelector = defaultMemoize(() => ({ selectCustomerStoreCreditFeatureState: createFeatureSelector(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY) })).memoized;
123
60
  const daffCustomerStoreCreditCreateSelectors = () => {
124
- const { selectCustomerStoreCreditFeatureState } = getDaffCustomerStoreCreditReducersStateSelector();
125
- const selectCustomerStoreCreditState = createSelector(selectCustomerStoreCreditFeatureState, state => state.storeCredit);
126
- const selectStoreCredit = createSelector(selectCustomerStoreCreditState, state => state.storeCredit);
127
- return {
128
- ...daffOperationStateSelectorFactory(selectCustomerStoreCreditState),
129
- selectStoreCredit,
130
- };
61
+ const { selectCustomerStoreCreditFeatureState } = getDaffCustomerStoreCreditReducersStateSelector();
62
+ const selectCustomerStoreCreditState = createSelector(selectCustomerStoreCreditFeatureState, (state) => state.storeCredit);
63
+ const selectStoreCredit = createSelector(selectCustomerStoreCreditState, (state) => state.storeCredit);
64
+ return {
65
+ ...daffOperationStateSelectorFactory(selectCustomerStoreCreditState),
66
+ selectStoreCredit
67
+ };
131
68
  };
132
69
  const daffCustomerStoreCreditGetSelectors = defaultMemoize(() => daffCustomerStoreCreditCreateSelectors()).memoized;
133
-
134
- /**
135
- * @inheritdoc
136
- */
137
- class DaffCustomerStoreCreditPageFacade {
138
- constructor(store) {
139
- this.store = store;
140
- const { selectStoreCredit, selectErrors, selectHasErrors, selectLoading, selectLoadingState, selectMutating, selectResolving, } = daffCustomerStoreCreditGetSelectors();
141
- this.storeCredit$ = this.store.pipe(select(selectStoreCredit));
142
- this.loadingState$ = this.store.pipe(select(selectLoadingState));
143
- this.loading$ = this.store.pipe(select(selectLoading));
144
- this.resolving$ = this.store.pipe(select(selectResolving));
145
- this.mutating$ = this.store.pipe(select(selectMutating));
146
- this.errors$ = this.store.pipe(select(selectErrors));
147
- this.hasErrors$ = this.store.pipe(select(selectHasErrors));
148
- }
149
- dispatch(action) {
150
- this.store.dispatch(action);
151
- }
152
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditPageFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
153
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditPageFacade, providedIn: 'root' }); }
154
- }
155
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditPageFacade, decorators: [{
156
- type: Injectable,
157
- args: [{
158
- providedIn: 'root',
159
- }]
160
- }], ctorParameters: () => [{ type: i1.Store }] });
161
-
162
- const {
163
- /**
164
- * Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
165
- * Can be used to further refine Daffodil errors into more specific app errors.
166
- */
167
- token: DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER,
168
- /**
169
- * Provider function for {@link DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER}.
170
- */
171
- provider: provideDaffCustomerStoreCreditErrorMatcher, } = createSingleInjectionToken('DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
172
-
173
- class DaffCustomerStoreCreditEffects {
174
- constructor(actions$, driver, errorMatcher) {
175
- this.actions$ = actions$;
176
- this.driver = driver;
177
- this.errorMatcher = errorMatcher;
178
- this.list$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction), switchMap((action) => this.driver.get().pipe(map(resp => new DaffCustomerStoreCreditLoadSuccess(resp)), catchError((error) => of(new DaffCustomerStoreCreditLoadFailure(this.errorMatcher(error))))))));
179
- }
180
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditEffects, deps: [{ token: i1$1.Actions }, { token: DaffCustomerStoreCreditDriver }, { token: DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable }); }
181
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditEffects }); }
182
- }
183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditEffects, decorators: [{
184
- type: Injectable
185
- }], ctorParameters: () => [{ type: i1$1.Actions }, { type: undefined, decorators: [{
186
- type: Inject,
187
- args: [DaffCustomerStoreCreditDriver]
188
- }] }, { type: undefined, decorators: [{
189
- type: Inject,
190
- args: [DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER]
191
- }] }] });
192
-
193
- const {
194
- /**
195
- * An internal token to hold the Daffodil customer reducers.
196
- * Includes the extra and standard reducers.
197
- *
198
- * @docs-private
199
- */
200
- token: DAFF_CUSTOMER_STORE_CREDIT_REDUCERS,
201
- /**
202
- * Provider function for {@link DAFF_CUSTOMER_STORE_CREDIT_REDUCERS}.
203
- */
204
- provider: provideDaffCustomerStoreCreditReducers, } = createSingleInjectionToken('DAFF_CUSTOMER_STORE_CREDIT_REDUCERS', {
205
- providedIn: 'any',
206
- factory: () => daffComposeReducers([
207
- combineReducers({
208
- storeCredit: daffCustomerStoreCreditReducer,
209
- }),
210
- ...inject(DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS),
211
- ]),
70
+ var DaffCustomerStoreCreditPageFacade = class DaffCustomerStoreCreditPageFacade {
71
+ constructor(store) {
72
+ this.store = store;
73
+ const { selectStoreCredit, selectErrors, selectHasErrors, selectLoading, selectLoadingState, selectMutating, selectResolving } = daffCustomerStoreCreditGetSelectors();
74
+ this.storeCredit$ = this.store.pipe(select(selectStoreCredit));
75
+ this.loadingState$ = this.store.pipe(select(selectLoadingState));
76
+ this.loading$ = this.store.pipe(select(selectLoading));
77
+ this.resolving$ = this.store.pipe(select(selectResolving));
78
+ this.mutating$ = this.store.pipe(select(selectMutating));
79
+ this.errors$ = this.store.pipe(select(selectErrors));
80
+ this.hasErrors$ = this.store.pipe(select(selectHasErrors));
81
+ }
82
+ dispatch(action) {
83
+ this.store.dispatch(action);
84
+ }
85
+ static {
86
+ this.ɵfac = i0.ɵɵngDeclareFactory({
87
+ minVersion: "12.0.0",
88
+ version: "22.2.4",
89
+ ngImport: i0,
90
+ type: DaffCustomerStoreCreditPageFacade,
91
+ deps: [{ token: i1$1.Store }],
92
+ target: i0.ɵɵFactoryTarget.Injectable
93
+ });
94
+ }
95
+ static {
96
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
97
+ minVersion: "12.0.0",
98
+ version: "22.2.4",
99
+ ngImport: i0,
100
+ type: DaffCustomerStoreCreditPageFacade,
101
+ providedIn: "root"
102
+ });
103
+ }
104
+ };
105
+ i0.ɵɵngDeclareClassMetadata({
106
+ minVersion: "12.0.0",
107
+ version: "22.2.4",
108
+ ngImport: i0,
109
+ type: DaffCustomerStoreCreditPageFacade,
110
+ decorators: [{
111
+ type: Injectable,
112
+ args: [{ providedIn: "root" }]
113
+ }],
114
+ ctorParameters: () => [{ type: i1$1.Store }]
212
115
  });
116
+ const { token: DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER, provider: provideDaffCustomerStoreCreditErrorMatcher } = createSingleInjectionToken("DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER", { factory: () => daffTransformErrorToStateError });
117
+ var DaffCustomerStoreCreditEffects = class DaffCustomerStoreCreditEffects {
118
+ constructor(actions$, driver, errorMatcher) {
119
+ this.actions$ = actions$;
120
+ this.driver = driver;
121
+ this.errorMatcher = errorMatcher;
122
+ this.list$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction), switchMap((action) => this.driver.get().pipe(map((resp) => new DaffCustomerStoreCreditLoadSuccess(resp)), catchError((error) => of(new DaffCustomerStoreCreditLoadFailure(this.errorMatcher(error))))))));
123
+ }
124
+ static {
125
+ this.ɵfac = i0.ɵɵngDeclareFactory({
126
+ minVersion: "12.0.0",
127
+ version: "22.2.4",
128
+ ngImport: i0,
129
+ type: DaffCustomerStoreCreditEffects,
130
+ deps: [
131
+ { token: i1.Actions },
132
+ { token: DaffCustomerStoreCreditDriver },
133
+ { token: DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER }
134
+ ],
135
+ target: i0.ɵɵFactoryTarget.Injectable
136
+ });
137
+ }
138
+ static {
139
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
140
+ minVersion: "12.0.0",
141
+ version: "22.2.4",
142
+ ngImport: i0,
143
+ type: DaffCustomerStoreCreditEffects
144
+ });
145
+ }
146
+ };
147
+ i0.ɵɵngDeclareClassMetadata({
148
+ minVersion: "12.0.0",
149
+ version: "22.2.4",
150
+ ngImport: i0,
151
+ type: DaffCustomerStoreCreditEffects,
152
+ decorators: [{ type: Injectable }],
153
+ ctorParameters: () => [
154
+ { type: i1.Actions },
155
+ {
156
+ type: void 0,
157
+ decorators: [{
158
+ type: Inject,
159
+ args: [DaffCustomerStoreCreditDriver]
160
+ }]
161
+ },
162
+ {
163
+ type: void 0,
164
+ decorators: [{
165
+ type: Inject,
166
+ args: [DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER]
167
+ }]
168
+ }
169
+ ]
170
+ });
171
+ const { token: DAFF_CUSTOMER_STORE_CREDIT_REDUCERS, provider: provideDaffCustomerStoreCreditReducers, factoryProvider: provideDaffCustomerStoreCreditReducersFactory } = createSingleInjectionToken("DAFF_CUSTOMER_STORE_CREDIT_REDUCERS");
172
+ var DaffCustomerStoreCreditStateModule = class DaffCustomerStoreCreditStateModule {
173
+ static {
174
+ this.ɵfac = i0.ɵɵngDeclareFactory({
175
+ minVersion: "12.0.0",
176
+ version: "22.2.4",
177
+ ngImport: i0,
178
+ type: DaffCustomerStoreCreditStateModule,
179
+ deps: [],
180
+ target: i0.ɵɵFactoryTarget.NgModule
181
+ });
182
+ }
183
+ static {
184
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
185
+ minVersion: "14.0.0",
186
+ version: "22.2.4",
187
+ ngImport: i0,
188
+ type: DaffCustomerStoreCreditStateModule,
189
+ imports: [i1$1.StoreFeatureModule, i1.EffectsFeatureModule]
190
+ });
191
+ }
192
+ static {
193
+ this.ɵinj = i0.ɵɵngDeclareInjector({
194
+ minVersion: "12.0.0",
195
+ version: "22.2.4",
196
+ ngImport: i0,
197
+ type: DaffCustomerStoreCreditStateModule,
198
+ providers: [provideDaffCustomerStoreCreditReducersFactory((() => daffComposeReducers([combineReducers({ storeCredit: daffCustomerStoreCreditReducer }), ...inject(DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS)])))],
199
+ imports: [StoreModule.forFeature(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS), EffectsModule.forFeature([DaffCustomerStoreCreditEffects])]
200
+ });
201
+ }
202
+ };
203
+ i0.ɵɵngDeclareClassMetadata({
204
+ minVersion: "12.0.0",
205
+ version: "22.2.4",
206
+ ngImport: i0,
207
+ type: DaffCustomerStoreCreditStateModule,
208
+ decorators: [{
209
+ type: NgModule,
210
+ args: [{
211
+ imports: [StoreModule.forFeature(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS), EffectsModule.forFeature([DaffCustomerStoreCreditEffects])],
212
+ providers: [provideDaffCustomerStoreCreditReducersFactory((() => daffComposeReducers([combineReducers({ storeCredit: daffCustomerStoreCreditReducer }), ...inject(DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS)])))]
213
+ }]
214
+ }]
215
+ });
216
+ const provideDaffCustomerStoreCreditState = () => makeEnvironmentProviders([
217
+ provideState(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS),
218
+ provideEffects(DaffCustomerStoreCreditEffects),
219
+ provideDaffCustomerStoreCreditReducersFactory(() => daffComposeReducers([combineReducers({ storeCredit: daffCustomerStoreCreditReducer }), ...inject(DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS)]))
220
+ ]);
221
+ export { DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER, DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS, DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DaffCustomerStoreCreditActionTypes, DaffCustomerStoreCreditClearErrors, DaffCustomerStoreCreditLoad, DaffCustomerStoreCreditLoadFailure, DaffCustomerStoreCreditLoadSuccess, DaffCustomerStoreCreditPageFacade, DaffCustomerStoreCreditStateModule, daffCustomerStoreCreditGetSelectors, daffCustomerStoreCreditInitialState, daffCustomerStoreCreditProvideExtraReducers, daffCustomerStoreCreditReducer, getDaffCustomerStoreCreditReducersStateSelector, provideDaffCustomerStoreCreditErrorMatcher, provideDaffCustomerStoreCreditState };
213
222
 
214
- /**
215
- * Creates the customer store credit feature store.
216
- */
217
- class DaffCustomerStoreCreditStateModule {
218
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
219
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditStateModule, imports: [i1.StoreFeatureModule, i1$1.EffectsFeatureModule] }); }
220
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditStateModule, imports: [StoreModule.forFeature(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS),
221
- EffectsModule.forFeature([
222
- DaffCustomerStoreCreditEffects,
223
- ])] }); }
224
- }
225
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditStateModule, decorators: [{
226
- type: NgModule,
227
- args: [{
228
- imports: [
229
- StoreModule.forFeature(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS),
230
- EffectsModule.forFeature([
231
- DaffCustomerStoreCreditEffects,
232
- ]),
233
- ],
234
- }]
235
- }] });
236
-
237
- /**
238
- * Generated bundle index. Do not edit.
239
- */
240
-
241
- export { DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER, DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS, DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DaffCustomerStoreCreditActionTypes, DaffCustomerStoreCreditClearErrors, DaffCustomerStoreCreditLoad, DaffCustomerStoreCreditLoadFailure, DaffCustomerStoreCreditLoadSuccess, DaffCustomerStoreCreditPageFacade, DaffCustomerStoreCreditStateModule, daffCustomerStoreCreditGetSelectors, daffCustomerStoreCreditInitialState, daffCustomerStoreCreditProvideExtraReducers, daffCustomerStoreCreditReducer, getDaffCustomerStoreCreditReducersStateSelector, provideDaffCustomerStoreCreditErrorMatcher };
242
- //# sourceMappingURL=daffodil-customer-store-credit-state.mjs.map
223
+ //# sourceMappingURL=daffodil-customer-store-credit-state.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-customer-store-credit-state.mjs","sources":["../../../libs/customer-store-credit/state/src/actions/store-credit.actions.ts","../../../libs/customer-store-credit/state/src/reducers/store-feature-key.ts","../../../libs/customer-store-credit/state/src/reducers/token/extra.token.ts","../../../libs/customer-store-credit/state/src/reducers/store-credit/initial-state.ts","../../../libs/customer-store-credit/state/src/reducers/store-credit/reducer.ts","../../../libs/customer-store-credit/state/src/selectors/feature.selector.ts","../../../libs/customer-store-credit/state/src/selectors/store-credit/selector.ts","../../../libs/customer-store-credit/state/src/facades/store-credit/facade.ts","../../../libs/customer-store-credit/state/src/injection-tokens/error-matcher.token.ts","../../../libs/customer-store-credit/state/src/effects/store-credit.effects.ts","../../../libs/customer-store-credit/state/src/reducers/token/reducers.token.ts","../../../libs/customer-store-credit/state/src/state.module.ts","../../../libs/customer-store-credit/state/src/daffodil-customer-store-credit-state.ts"],"sourcesContent":["import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\n/**\n * The customer store credit action types enum.\n */\nexport enum DaffCustomerStoreCreditActionTypes {\n StoreCreditLoadAction = '[@daffodil/customer-store-credit] Store Credit Load Action',\n StoreCreditLoadSuccessAction = '[@daffodil/customer-store-credit] Store Credit Load Success Action',\n StoreCreditLoadFailureAction = '[@daffodil/customer-store-credit] Store Credit Load Failure Action',\n StoreCreditClearErrorsAction = '[@daffodil/customer-store-credit] Store Credit Clear Errors Action',\n}\n\n/**\n * Loads the store credit of the current customer.\n */\nexport class DaffCustomerStoreCreditLoad implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction;\n}\n\n/**\n * Indicates a successful load of the customer's store credit.\n */\nexport class DaffCustomerStoreCreditLoadSuccess<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction;\n\n constructor(public payload: T) {}\n}\n\n/**\n * A failed customer store credit load with the error message.\n */\nexport class DaffCustomerStoreCreditLoadFailure implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\n/**\n * An action to clear all errors in state.\n */\nexport class DaffCustomerStoreCreditClearErrors implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction;\n}\n\n/**\n * A union of the customer action types.\n */\nexport type DaffCustomerStoreCreditActions<\n TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit,\n> =\n | DaffCustomerStoreCreditLoad\n | DaffCustomerStoreCreditLoadSuccess<TStoreCredit>\n | DaffCustomerStoreCreditLoadFailure\n | DaffCustomerStoreCreditClearErrors;\n","/**\n * The key under which the customer store credit feature state will be stored.\n */\nexport const DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY = 'daffCustomerStoreCredit';\n","import { ActionReducer } from '@ngrx/store';\n\nimport { createMultiInjectionToken } from '@daffodil/core';\n\nimport { DaffCustomerStoreCreditReducersState } from '../reducers.interface';\n\nexport const {\n /**\n * A token to hold the injectable extra reducers.\n *\n * Prefer using {@link daffCustomerStoreCreditProvideExtraReducers}.\n */\n token: DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS,\n\n /**\n * Provides additional reducers that run after the standard Daffodil customer reducers.\n *\n * @example\n * ```ts\n * providers: [\n * ...daffCustomerStoreCreditProvideExtraReducers(\n * myReducer1,\n * myReducer2\n * )\n * ]\n * ```\n */\n provider: daffCustomerStoreCreditProvideExtraReducers,\n} = createMultiInjectionToken<ActionReducer<DaffCustomerStoreCreditReducersState>>(\n 'DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS',\n { providedIn: 'any' },\n);\n","import { daffOperationInitialState } from '@daffodil/core/state';\n\nimport { DaffCustomerStoreCreditReducerState } from './type';\n\n/**\n * The initial state for the main customer store credit state, see {@link DaffCustomerStoreCreditReducerState}.\n */\nexport const daffCustomerStoreCreditInitialState: DaffCustomerStoreCreditReducerState = {\n ...daffOperationInitialState,\n storeCredit: {\n balance: 0,\n },\n};\n","import {\n daffCompleteOperation,\n daffOperationFailed,\n daffStartResolution,\n} from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport { daffCustomerStoreCreditInitialState } from './initial-state';\nimport { DaffCustomerStoreCreditReducerState } from './type';\nimport {\n DaffCustomerStoreCreditActions,\n DaffCustomerStoreCreditActionTypes,\n DaffCustomerStoreCreditLoadFailure,\n} from '../../actions/store-credit.actions';\n\n/**\n * The reducer for the customer store credit page state, see {@link DaffCustomerStoreCreditReducerState}.\n */\nexport const daffCustomerStoreCreditReducer = <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>(\n state = daffCustomerStoreCreditInitialState,\n action: DaffCustomerStoreCreditActions<T>,\n): DaffCustomerStoreCreditReducerState => {\n switch (action.type) {\n case DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction:\n return daffStartResolution(state);\n\n case DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction:\n return {\n ...daffCompleteOperation(state),\n storeCredit: action.payload,\n };\n\n case DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction:\n return daffCompleteOperation(state);\n\n case DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction:\n return daffOperationFailed([(<DaffCustomerStoreCreditLoadFailure>action).payload], state);\n\n default:\n return state;\n }\n};\n","import {\n createFeatureSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport {\n DaffCustomerStoreCreditStateRootSlice,\n DaffCustomerStoreCreditReducersState,\n DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY,\n} from '../reducers/public_api';\n\n/**\n * Selector for the customer store credit feature state.\n */\nexport interface DaffCustomerStoreCreditFeatureSelector<\n TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit\n> {\n selectCustomerStoreCreditFeatureState: MemoizedSelector<DaffCustomerStoreCreditStateRootSlice<TStoreCredit>, DaffCustomerStoreCreditReducersState<TStoreCredit>>;\n}\n\nexport const getDaffCustomerStoreCreditReducersStateSelector: <TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditFeatureSelector<TStoreCredit> = defaultMemoize(<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => ({\n selectCustomerStoreCreditFeatureState: createFeatureSelector<DaffCustomerStoreCreditReducersState<TStoreCredit>>(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY),\n})).memoized;\n","import {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n daffOperationStateSelectorFactory,\n DaffOperationStateSelectors,\n} from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport {\n DaffCustomerStoreCreditReducerState,\n DaffCustomerStoreCreditStateRootSlice,\n} from '../../reducers/public_api';\nimport { getDaffCustomerStoreCreditReducersStateSelector } from '../feature.selector';\n\n/**\n * Selectors for the main part of customer store credit state.\n */\nexport interface DaffCustomerStoreCreditSelectors<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationStateSelectors<DaffCustomerStoreCreditStateRootSlice<T>, DaffCustomerStoreCreditReducerState<T>> {\n /**\n * Selects the customer's current store credit balance.\n */\n selectStoreCredit: MemoizedSelector<DaffCustomerStoreCreditStateRootSlice<T>, T>;\n}\n\n/**\n * Creates a group of selectors for {@link DaffCustomerStoreCreditReducerState} that use the passed state selector as the basis.\n */\nconst daffCustomerStoreCreditCreateSelectors = <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>(): DaffCustomerStoreCreditSelectors<T> => {\n const { selectCustomerStoreCreditFeatureState } = getDaffCustomerStoreCreditReducersStateSelector<T>();\n const selectCustomerStoreCreditState = createSelector(\n selectCustomerStoreCreditFeatureState,\n state => state.storeCredit,\n );\n const selectStoreCredit = createSelector(\n selectCustomerStoreCreditState,\n state => state.storeCredit,\n );\n\n return {\n ...daffOperationStateSelectorFactory(selectCustomerStoreCreditState),\n selectStoreCredit,\n };\n};\n\nexport const daffCustomerStoreCreditGetSelectors: <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditSelectors<T> = defaultMemoize(<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => daffCustomerStoreCreditCreateSelectors<T>()).memoized;\n\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport { DaffCustomerStoreCreditPageFacadeInterface } from './interface';\nimport {\n DaffCustomerStoreCreditReducerState,\n DaffCustomerStoreCreditStateRootSlice,\n} from '../../reducers/public_api';\nimport { daffCustomerStoreCreditGetSelectors } from '../../selectors/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerStoreCreditPageFacade<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements DaffCustomerStoreCreditPageFacadeInterface<T> {\n storeCredit$: Observable<T>;\n loadingState$: Observable<DaffCustomerStoreCreditReducerState['daffState']>;\n loading$: Observable<boolean>;\n resolving$: Observable<boolean>;\n mutating$: Observable<boolean>;\n errors$: Observable<DaffCustomerStoreCreditReducerState['daffErrors']>;\n hasErrors$: Observable<boolean>;\n\n constructor(\n private store: Store<DaffCustomerStoreCreditStateRootSlice>,\n ) {\n const {\n selectStoreCredit,\n selectErrors,\n selectHasErrors,\n selectLoading,\n selectLoadingState,\n selectMutating,\n selectResolving,\n } = daffCustomerStoreCreditGetSelectors<T>();\n\n this.storeCredit$ = this.store.pipe(select(selectStoreCredit));\n this.loadingState$ = this.store.pipe(select(selectLoadingState));\n this.loading$ = this.store.pipe(select(selectLoading));\n this.resolving$ = this.store.pipe(select(selectResolving));\n this.mutating$ = this.store.pipe(select(selectMutating));\n this.errors$ = this.store.pipe(select(selectErrors));\n this.hasErrors$ = this.store.pipe(select(selectHasErrors));\n }\n\n dispatch(action: Action) {\n this.store.dispatch(action);\n }\n}\n","import { createSingleInjectionToken } from '@daffodil/core';\nimport { daffTransformErrorToStateError } from '@daffodil/core/state';\n\nexport const {\n /**\n * Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.\n * Can be used to further refine Daffodil errors into more specific app errors.\n */\n token: DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER,\n /**\n * Provider function for {@link DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER}.\n */\n provider: provideDaffCustomerStoreCreditErrorMatcher,\n} = createSingleInjectionToken<typeof daffTransformErrorToStateError>(\n 'DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER',\n { factory: () => daffTransformErrorToStateError },\n);\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport { of } from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\nimport {\n DaffCustomerStoreCreditDriver,\n DaffCustomerStoreCreditDriverInterface,\n} from '@daffodil/customer-store-credit/driver';\n\nimport {\n DaffCustomerStoreCreditActionTypes,\n DaffCustomerStoreCreditLoadFailure,\n DaffCustomerStoreCreditLoadSuccess,\n DaffCustomerStoreCreditActions,\n} from '../actions/store-credit.actions';\nimport { DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER } from '../injection-tokens/public_api';\n\n@Injectable()\nexport class DaffCustomerStoreCreditEffects<\n T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit,\n> {\n constructor(\n private actions$: Actions<DaffCustomerStoreCreditActions<T>>,\n @Inject(DaffCustomerStoreCreditDriver) private driver: DaffCustomerStoreCreditDriverInterface<T>,\n @Inject(DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n list$ = createEffect(() => this.actions$.pipe(\n ofType(DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction),\n switchMap((action) =>\n this.driver.get().pipe(\n map(resp => new DaffCustomerStoreCreditLoadSuccess<T>(resp)),\n catchError((error: DaffError) => of(new DaffCustomerStoreCreditLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n ));\n}\n","import { inject } from '@angular/core';\nimport {\n ActionReducer,\n combineReducers,\n} from '@ngrx/store';\n\nimport { createSingleInjectionToken } from '@daffodil/core';\nimport { daffComposeReducers } from '@daffodil/core/state';\n\nimport { DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS } from './extra.token';\nimport { DaffCustomerStoreCreditReducersState } from '../reducers.interface';\nimport { daffCustomerStoreCreditReducer } from '../store-credit/public_api';\n\nexport const {\n /**\n * An internal token to hold the Daffodil customer reducers.\n * Includes the extra and standard reducers.\n *\n * @docs-private\n */\n token: DAFF_CUSTOMER_STORE_CREDIT_REDUCERS,\n /**\n * Provider function for {@link DAFF_CUSTOMER_STORE_CREDIT_REDUCERS}.\n */\n provider: provideDaffCustomerStoreCreditReducers,\n} = createSingleInjectionToken<ActionReducer<DaffCustomerStoreCreditReducersState>>(\n 'DAFF_CUSTOMER_STORE_CREDIT_REDUCERS',\n {\n providedIn: 'any',\n factory: () => daffComposeReducers([\n combineReducers({\n storeCredit: daffCustomerStoreCreditReducer,\n }),\n ...inject(DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS),\n ]),\n },\n);\n","import { NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport { StoreModule } from '@ngrx/store';\n\nimport { DaffCustomerStoreCreditEffects } from './effects/store-credit.effects';\nimport { DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY } from './reducers/public_api';\nimport { DAFF_CUSTOMER_STORE_CREDIT_REDUCERS } from './reducers/token/reducers.token';\n\n/**\n * Creates the customer store credit feature store.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS),\n EffectsModule.forFeature([\n DaffCustomerStoreCreditEffects,\n ]),\n ],\n})\nexport class DaffCustomerStoreCreditStateModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2"],"mappings":";;;;;;;;;;;;AAKA;;AAEG;IACS;AAAZ,CAAA,UAAY,kCAAkC,EAAA;AAC5C,IAAA,kCAAA,CAAA,uBAAA,CAAA,GAAA,4DAAoF;AACpF,IAAA,kCAAA,CAAA,8BAAA,CAAA,GAAA,oEAAmG;AACnG,IAAA,kCAAA,CAAA,8BAAA,CAAA,GAAA,oEAAmG;AACnG,IAAA,kCAAA,CA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I,MAAM;2BAAC,6BAA6B;;0BACpC,MAAM;2BAAC,wCAAwC;;;AC1B7C,MAAM;AACX;;;;;AAKG;AACH,KAAK,EAAE,mCAAmC;AAC1C;;AAEG;AACH,QAAQ,EAAE,sCAAsC,GACjD,GAAG,0BAA0B,CAC5B,qCAAqC,EACrC;AACE,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjC,QAAA,eAAe,CAAC;AACd,YAAA,WAAW,EAAE,8BAA8B;SAC5C,CAAC;QACF,GAAG,MAAM,CAAC,yCAAyC,CAAC;KACrD,CAAC;AACH,CAAA,CACF;;AC5BD;;AAEG;MASU,kCAAkC,CAAA;iIAAlC,kCAAkC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAlC,kCAAkC,EAAA,OAAA,EAAA,CAAA,EAAA,CAAA,kBAAA,EAAAC,IAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,CAAA;kIAAlC,kCAAkC,EAAA,OAAA,EAAA,CAN3C,WAAW,CAAC,UAAU,CAAC,4CAA4C,EAAE,mCAAmC,CAAC;YACzG,aAAa,CAAC,UAAU,CAAC;gBACvB,8BAA8B;aAC/B,CAAC,CAAA,EAAA,CAAA,CAAA;;2FAGO,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAR9C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;AACP,wBAAA,WAAW,CAAC,UAAU,CAAC,4CAA4C,EAAE,mCAAmC,CAAC;wBACzG,aAAa,CAAC,UAAU,CAAC;4BACvB,8BAA8B;yBAC/B,CAAC;AACH,qBAAA;AACF,iBAAA;;;AClBD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-customer-store-credit-state.mjs","names":["i1","i1","i2"],"sources":["../../../libs/customer-store-credit/state/src/actions/store-credit.actions.ts","../../../libs/customer-store-credit/state/src/reducers/store-feature-key.ts","../../../libs/customer-store-credit/state/src/reducers/token/extra.token.ts","../../../libs/customer-store-credit/state/src/reducers/store-credit/initial-state.ts","../../../libs/customer-store-credit/state/src/reducers/store-credit/reducer.ts","../../../libs/customer-store-credit/state/src/selectors/feature.selector.ts","../../../libs/customer-store-credit/state/src/selectors/store-credit/selector.ts","../../../libs/customer-store-credit/state/src/facades/store-credit/facade.ts","../../../libs/customer-store-credit/state/src/injection-tokens/error-matcher.token.ts","../../../libs/customer-store-credit/state/src/effects/store-credit.effects.ts","../../../libs/customer-store-credit/state/src/reducers/token/reducers.token.ts","../../../libs/customer-store-credit/state/src/state.module.ts","../../../libs/customer-store-credit/state/src/provider.ts"],"sourcesContent":["import { Action } from '@ngrx/store';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\n/**\n * The customer store credit action types enum.\n */\nexport enum DaffCustomerStoreCreditActionTypes {\n StoreCreditLoadAction = '[@daffodil/customer-store-credit] Store Credit Load Action',\n StoreCreditLoadSuccessAction = '[@daffodil/customer-store-credit] Store Credit Load Success Action',\n StoreCreditLoadFailureAction = '[@daffodil/customer-store-credit] Store Credit Load Failure Action',\n StoreCreditClearErrorsAction = '[@daffodil/customer-store-credit] Store Credit Clear Errors Action',\n}\n\n/**\n * Loads the store credit of the current customer.\n */\nexport class DaffCustomerStoreCreditLoad implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction;\n}\n\n/**\n * Indicates a successful load of the customer's store credit.\n */\nexport class DaffCustomerStoreCreditLoadSuccess<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction;\n\n constructor(public payload: T) {}\n}\n\n/**\n * A failed customer store credit load with the error message.\n */\nexport class DaffCustomerStoreCreditLoadFailure implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction;\n\n constructor(public payload: DaffStateError) {}\n}\n\n/**\n * An action to clear all errors in state.\n */\nexport class DaffCustomerStoreCreditClearErrors implements Action {\n readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction;\n}\n\n/**\n * A union of the customer action types.\n */\nexport type DaffCustomerStoreCreditActions<\n TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit,\n> =\n | DaffCustomerStoreCreditLoad\n | DaffCustomerStoreCreditLoadSuccess<TStoreCredit>\n | DaffCustomerStoreCreditLoadFailure\n | DaffCustomerStoreCreditClearErrors;\n","/**\n * The key under which the customer store credit feature state will be stored.\n */\nexport const DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY = 'daffCustomerStoreCredit';\n","import { ActionReducer } from '@ngrx/store';\n\nimport { createMultiInjectionToken } from '@daffodil/core';\n\nimport { DaffCustomerStoreCreditReducersState } from '../reducers.interface';\n\nexport const {\n /**\n * A token to hold the injectable extra reducers.\n *\n * Prefer using {@link daffCustomerStoreCreditProvideExtraReducers}.\n */\n token: DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS,\n\n /**\n * Provides additional reducers that run after the standard Daffodil customer reducers.\n *\n * @example\n * ```ts\n * providers: [\n * ...daffCustomerStoreCreditProvideExtraReducers(\n * myReducer1,\n * myReducer2\n * )\n * ]\n * ```\n */\n provider: daffCustomerStoreCreditProvideExtraReducers,\n} = createMultiInjectionToken<ActionReducer<DaffCustomerStoreCreditReducersState>>(\n 'DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS',\n { providedIn: 'any' },\n);\n","import { daffOperationInitialState } from '@daffodil/core/state';\n\nimport { DaffCustomerStoreCreditReducerState } from './type';\n\n/**\n * The initial state for the main customer store credit state, see {@link DaffCustomerStoreCreditReducerState}.\n */\nexport const daffCustomerStoreCreditInitialState: DaffCustomerStoreCreditReducerState = {\n ...daffOperationInitialState,\n storeCredit: {\n balance: 0,\n },\n};\n","import {\n daffCompleteOperation,\n daffOperationFailed,\n daffStartResolution,\n} from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport { daffCustomerStoreCreditInitialState } from './initial-state';\nimport { DaffCustomerStoreCreditReducerState } from './type';\nimport {\n DaffCustomerStoreCreditActions,\n DaffCustomerStoreCreditActionTypes,\n DaffCustomerStoreCreditLoadFailure,\n} from '../../actions/store-credit.actions';\n\n/**\n * The reducer for the customer store credit page state, see {@link DaffCustomerStoreCreditReducerState}.\n */\nexport const daffCustomerStoreCreditReducer = <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>(\n state = daffCustomerStoreCreditInitialState,\n action: DaffCustomerStoreCreditActions<T>,\n): DaffCustomerStoreCreditReducerState => {\n switch (action.type) {\n case DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction:\n return daffStartResolution(state);\n\n case DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction:\n return {\n ...daffCompleteOperation(state),\n storeCredit: action.payload,\n };\n\n case DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction:\n return daffCompleteOperation(state);\n\n case DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction:\n return daffOperationFailed([(<DaffCustomerStoreCreditLoadFailure>action).payload], state);\n\n default:\n return state;\n }\n};\n","import {\n createFeatureSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport {\n DaffCustomerStoreCreditStateRootSlice,\n DaffCustomerStoreCreditReducersState,\n DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY,\n} from '../reducers/public_api';\n\n/**\n * Selector for the customer store credit feature state.\n */\nexport interface DaffCustomerStoreCreditFeatureSelector<\n TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit\n> {\n selectCustomerStoreCreditFeatureState: MemoizedSelector<DaffCustomerStoreCreditStateRootSlice<TStoreCredit>, DaffCustomerStoreCreditReducersState<TStoreCredit>>;\n}\n\nexport const getDaffCustomerStoreCreditReducersStateSelector: <TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditFeatureSelector<TStoreCredit> = defaultMemoize(<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => ({\n selectCustomerStoreCreditFeatureState: createFeatureSelector<DaffCustomerStoreCreditReducersState<TStoreCredit>>(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY),\n})).memoized;\n","import {\n createSelector,\n MemoizedSelector,\n defaultMemoize,\n} from '@ngrx/store';\n\nimport {\n daffOperationStateSelectorFactory,\n DaffOperationStateSelectors,\n} from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport {\n DaffCustomerStoreCreditReducerState,\n DaffCustomerStoreCreditStateRootSlice,\n} from '../../reducers/public_api';\nimport { getDaffCustomerStoreCreditReducersStateSelector } from '../feature.selector';\n\n/**\n * Selectors for the main part of customer store credit state.\n */\nexport interface DaffCustomerStoreCreditSelectors<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationStateSelectors<DaffCustomerStoreCreditStateRootSlice<T>, DaffCustomerStoreCreditReducerState<T>> {\n /**\n * Selects the customer's current store credit balance.\n */\n selectStoreCredit: MemoizedSelector<DaffCustomerStoreCreditStateRootSlice<T>, T>;\n}\n\n/**\n * Creates a group of selectors for {@link DaffCustomerStoreCreditReducerState} that use the passed state selector as the basis.\n */\nconst daffCustomerStoreCreditCreateSelectors = <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>(): DaffCustomerStoreCreditSelectors<T> => {\n const { selectCustomerStoreCreditFeatureState } = getDaffCustomerStoreCreditReducersStateSelector<T>();\n const selectCustomerStoreCreditState = createSelector(\n selectCustomerStoreCreditFeatureState,\n state => state.storeCredit,\n );\n const selectStoreCredit = createSelector(\n selectCustomerStoreCreditState,\n state => state.storeCredit,\n );\n\n return {\n ...daffOperationStateSelectorFactory(selectCustomerStoreCreditState),\n selectStoreCredit,\n };\n};\n\nexport const daffCustomerStoreCreditGetSelectors: <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditSelectors<T> = defaultMemoize(<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => daffCustomerStoreCreditCreateSelectors<T>()).memoized;\n\n","import { Injectable } from '@angular/core';\nimport {\n Store,\n select,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport { DaffCustomerStoreCreditPageFacadeInterface } from './interface';\nimport {\n DaffCustomerStoreCreditReducerState,\n DaffCustomerStoreCreditStateRootSlice,\n} from '../../reducers/public_api';\nimport { daffCustomerStoreCreditGetSelectors } from '../../selectors/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerStoreCreditPageFacade<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements DaffCustomerStoreCreditPageFacadeInterface<T> {\n storeCredit$: Observable<T>;\n loadingState$: Observable<DaffCustomerStoreCreditReducerState['daffState']>;\n loading$: Observable<boolean>;\n resolving$: Observable<boolean>;\n mutating$: Observable<boolean>;\n errors$: Observable<DaffCustomerStoreCreditReducerState['daffErrors']>;\n hasErrors$: Observable<boolean>;\n\n constructor(\n private store: Store<DaffCustomerStoreCreditStateRootSlice>,\n ) {\n const {\n selectStoreCredit,\n selectErrors,\n selectHasErrors,\n selectLoading,\n selectLoadingState,\n selectMutating,\n selectResolving,\n } = daffCustomerStoreCreditGetSelectors<T>();\n\n this.storeCredit$ = this.store.pipe(select(selectStoreCredit));\n this.loadingState$ = this.store.pipe(select(selectLoadingState));\n this.loading$ = this.store.pipe(select(selectLoading));\n this.resolving$ = this.store.pipe(select(selectResolving));\n this.mutating$ = this.store.pipe(select(selectMutating));\n this.errors$ = this.store.pipe(select(selectErrors));\n this.hasErrors$ = this.store.pipe(select(selectHasErrors));\n }\n\n dispatch(action: Action) {\n this.store.dispatch(action);\n }\n}\n","import { createSingleInjectionToken } from '@daffodil/core';\nimport { daffTransformErrorToStateError } from '@daffodil/core/state';\n\nexport const {\n /**\n * Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.\n * Can be used to further refine Daffodil errors into more specific app errors.\n */\n token: DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER,\n /**\n * Provider function for {@link DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER}.\n */\n provider: provideDaffCustomerStoreCreditErrorMatcher,\n} = createSingleInjectionToken<typeof daffTransformErrorToStateError>(\n 'DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER',\n { factory: () => daffTransformErrorToStateError },\n);\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport { of } from 'rxjs';\nimport {\n switchMap,\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffError } from '@daffodil/core';\nimport { ErrorTransformer } from '@daffodil/core/state';\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\nimport {\n DaffCustomerStoreCreditDriver,\n DaffCustomerStoreCreditDriverInterface,\n} from '@daffodil/customer-store-credit/driver';\n\nimport {\n DaffCustomerStoreCreditActionTypes,\n DaffCustomerStoreCreditLoadFailure,\n DaffCustomerStoreCreditLoadSuccess,\n DaffCustomerStoreCreditActions,\n} from '../actions/store-credit.actions';\nimport { DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER } from '../injection-tokens/public_api';\n\n@Injectable()\nexport class DaffCustomerStoreCreditEffects<\n T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit,\n> {\n constructor(\n private actions$: Actions<DaffCustomerStoreCreditActions<T>>,\n @Inject(DaffCustomerStoreCreditDriver) private driver: DaffCustomerStoreCreditDriverInterface<T>,\n @Inject(DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER) private errorMatcher: ErrorTransformer,\n ) {}\n\n list$ = createEffect(() => this.actions$.pipe(\n ofType(DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction),\n switchMap((action) =>\n this.driver.get().pipe(\n map(resp => new DaffCustomerStoreCreditLoadSuccess<T>(resp)),\n catchError((error: DaffError) => of(new DaffCustomerStoreCreditLoadFailure(this.errorMatcher(error)))),\n ),\n ),\n ));\n}\n","import { ActionReducer } from '@ngrx/store';\n\nimport { createSingleInjectionToken } from '@daffodil/core';\n\nimport { DaffCustomerStoreCreditReducersState } from '../reducers.interface';\n\nexport const {\n /**\n * An internal token to hold the Daffodil customer reducers.\n * Includes the extra and standard reducers.\n *\n * @docs-private\n */\n token: DAFF_CUSTOMER_STORE_CREDIT_REDUCERS,\n /**\n * Provider function for {@link DAFF_CUSTOMER_STORE_CREDIT_REDUCERS}.\n */\n provider: provideDaffCustomerStoreCreditReducers,\n /**\n * Factory provider function for {@link DAFF_CUSTOMER_STORE_CREDIT_REDUCERS}.\n */\n factoryProvider: provideDaffCustomerStoreCreditReducersFactory,\n} = createSingleInjectionToken<ActionReducer<DaffCustomerStoreCreditReducersState>>(\n 'DAFF_CUSTOMER_STORE_CREDIT_REDUCERS',\n);\n","import {\n inject,\n NgModule,\n} from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport {\n combineReducers,\n StoreModule,\n} from '@ngrx/store';\n\nimport { daffComposeReducers } from '@daffodil/core/state';\n\nimport { DaffCustomerStoreCreditEffects } from './effects/store-credit.effects';\nimport { DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY } from './reducers/public_api';\nimport { daffCustomerStoreCreditReducer } from './reducers/store-credit/public_api';\nimport { DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS } from './reducers/token/extra.token';\nimport {\n DAFF_CUSTOMER_STORE_CREDIT_REDUCERS,\n provideDaffCustomerStoreCreditReducersFactory,\n} from './reducers/token/reducers.token';\n\n/**\n * Creates the customer store credit feature store.\n *\n * @deprecated in favor of {@link provideDaffCustomerStoreCreditState} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n imports: [\n StoreModule.forFeature(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS),\n EffectsModule.forFeature([\n DaffCustomerStoreCreditEffects,\n ]),\n ],\n providers: [\n provideDaffCustomerStoreCreditReducersFactory(() => daffComposeReducers([\n combineReducers({\n storeCredit: daffCustomerStoreCreditReducer,\n }),\n ...inject(DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS),\n ])),\n ],\n})\nexport class DaffCustomerStoreCreditStateModule {}\n","import {\n EnvironmentProviders,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport { provideEffects } from '@ngrx/effects';\nimport {\n combineReducers,\n provideState,\n} from '@ngrx/store';\n\nimport { daffComposeReducers } from '@daffodil/core/state';\n\nimport { DaffCustomerStoreCreditEffects } from './effects/store-credit.effects';\nimport { DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY } from './reducers/public_api';\nimport { daffCustomerStoreCreditReducer } from './reducers/store-credit/public_api';\nimport { DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS } from './reducers/token/extra.token';\nimport {\n DAFF_CUSTOMER_STORE_CREDIT_REDUCERS,\n provideDaffCustomerStoreCreditReducersFactory,\n} from './reducers/token/reducers.token';\n\n/**\n * Provides the `@daffodil/customer-store-credit/state` feature state and effects.\n */\nexport const provideDaffCustomerStoreCreditState = (): EnvironmentProviders => makeEnvironmentProviders([\n provideState(DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY, DAFF_CUSTOMER_STORE_CREDIT_REDUCERS),\n provideEffects(\n DaffCustomerStoreCreditEffects,\n ),\n provideDaffCustomerStoreCreditReducersFactory(() => daffComposeReducers([\n combineReducers({\n storeCredit: daffCustomerStoreCreditReducer,\n }),\n ...inject(DAFF_CUSTOMER_STORE_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