@daffodil/payment 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.
@@ -1,50 +1,86 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, NgModule } from '@angular/core';
3
- import { BehaviorSubject } from 'rxjs';
4
- import { DaffPaymentPageFacade } from '@daffodil/payment/state';
1
+ import * as i0 from "@angular/core";
2
+ import { Injectable, NgModule, makeEnvironmentProviders } from "@angular/core";
3
+ import { BehaviorSubject } from "rxjs";
4
+ import { DaffPaymentPageFacade } from "@daffodil/payment/state";
5
+ var MockDaffPaymentPageFacade = class MockDaffPaymentPageFacade {
6
+ constructor() {
7
+ this.loading$ = new BehaviorSubject(null);
8
+ this.errors$ = new BehaviorSubject([]);
9
+ }
10
+ dispatch(action) {}
11
+ static {
12
+ this.ɵfac = i0.ɵɵngDeclareFactory({
13
+ minVersion: "12.0.0",
14
+ version: "22.2.4",
15
+ ngImport: i0,
16
+ type: MockDaffPaymentPageFacade,
17
+ deps: [],
18
+ target: i0.ɵɵFactoryTarget.Injectable
19
+ });
20
+ }
21
+ static {
22
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
23
+ minVersion: "12.0.0",
24
+ version: "22.2.4",
25
+ ngImport: i0,
26
+ type: MockDaffPaymentPageFacade,
27
+ providedIn: "root"
28
+ });
29
+ }
30
+ };
31
+ i0.ɵɵngDeclareClassMetadata({
32
+ minVersion: "12.0.0",
33
+ version: "22.2.4",
34
+ ngImport: i0,
35
+ type: MockDaffPaymentPageFacade,
36
+ decorators: [{
37
+ type: Injectable,
38
+ args: [{ providedIn: "root" }]
39
+ }]
40
+ });
41
+ const provideDaffPaymentStateTesting = () => makeEnvironmentProviders([{
42
+ provide: DaffPaymentPageFacade,
43
+ useExisting: MockDaffPaymentPageFacade
44
+ }]);
45
+ var DaffPaymentStateTestingModule = class DaffPaymentStateTestingModule {
46
+ static {
47
+ this.ɵfac = i0.ɵɵngDeclareFactory({
48
+ minVersion: "12.0.0",
49
+ version: "22.2.4",
50
+ ngImport: i0,
51
+ type: DaffPaymentStateTestingModule,
52
+ deps: [],
53
+ target: i0.ɵɵFactoryTarget.NgModule
54
+ });
55
+ }
56
+ static {
57
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
58
+ minVersion: "14.0.0",
59
+ version: "22.2.4",
60
+ ngImport: i0,
61
+ type: DaffPaymentStateTestingModule
62
+ });
63
+ }
64
+ static {
65
+ this.ɵinj = i0.ɵɵngDeclareInjector({
66
+ minVersion: "12.0.0",
67
+ version: "22.2.4",
68
+ ngImport: i0,
69
+ type: DaffPaymentStateTestingModule,
70
+ providers: [provideDaffPaymentStateTesting()]
71
+ });
72
+ }
73
+ };
74
+ i0.ɵɵngDeclareClassMetadata({
75
+ minVersion: "12.0.0",
76
+ version: "22.2.4",
77
+ ngImport: i0,
78
+ type: DaffPaymentStateTestingModule,
79
+ decorators: [{
80
+ type: NgModule,
81
+ args: [{ providers: [provideDaffPaymentStateTesting()] }]
82
+ }]
83
+ });
84
+ export { DaffPaymentStateTestingModule, MockDaffPaymentPageFacade, provideDaffPaymentStateTesting };
5
85
 
6
- /**
7
- * Mocks out facade fields and methods for testing purposes.
8
- *
9
- * @inheritdoc
10
- */
11
- class MockDaffPaymentPageFacade {
12
- constructor() {
13
- this.loading$ = new BehaviorSubject(null);
14
- this.errors$ = new BehaviorSubject([]);
15
- }
16
- dispatch(action) { }
17
- ;
18
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MockDaffPaymentPageFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
19
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MockDaffPaymentPageFacade, providedIn: 'root' }); }
20
- }
21
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MockDaffPaymentPageFacade, decorators: [{
22
- type: Injectable,
23
- args: [{ providedIn: 'root' }]
24
- }] });
25
-
26
- /**
27
- * Provides the {@link MockDaffPaymentPageFacade} for {@link DaffPaymentPageFacade}.
28
- */
29
- class DaffPaymentStateTestingModule {
30
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
31
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateTestingModule }); }
32
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateTestingModule, providers: [
33
- { provide: DaffPaymentPageFacade, useExisting: MockDaffPaymentPageFacade },
34
- ] }); }
35
- }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateTestingModule, decorators: [{
37
- type: NgModule,
38
- args: [{
39
- providers: [
40
- { provide: DaffPaymentPageFacade, useExisting: MockDaffPaymentPageFacade },
41
- ],
42
- }]
43
- }] });
44
-
45
- /**
46
- * Generated bundle index. Do not edit.
47
- */
48
-
49
- export { DaffPaymentStateTestingModule, MockDaffPaymentPageFacade };
50
- //# sourceMappingURL=daffodil-payment-state-testing.mjs.map
86
+ //# sourceMappingURL=daffodil-payment-state-testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-payment-state-testing.mjs","sources":["../../../libs/payment/state/testing/src/mock-payment-facade.ts","../../../libs/payment/state/testing/src/payment-testing.module.ts","../../../libs/payment/state/testing/src/daffodil-payment-state-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Action } from '@ngrx/store';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffPaymentPageFacadeInterface } from '@daffodil/payment/state';\n\n/**\n * Mocks out facade fields and methods for testing purposes.\n *\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffPaymentPageFacade implements DaffPaymentPageFacadeInterface {\n loading$ = new BehaviorSubject<boolean>(null);\n errors$ = new BehaviorSubject<DaffStateError[]>([]);\n\n dispatch(action: Action) {};\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffPaymentPageFacade } from '@daffodil/payment/state';\n\nimport { MockDaffPaymentPageFacade } from './mock-payment-facade';\n\n/**\n * Provides the {@link MockDaffPaymentPageFacade} for {@link DaffPaymentPageFacade}.\n */\n@NgModule({\n providers: [\n { provide: DaffPaymentPageFacade, useExisting: MockDaffPaymentPageFacade },\n ],\n})\nexport class DaffPaymentStateTestingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAOA;;;;AAIG;MAEU,yBAAyB,CAAA;AADtC,IAAA,WAAA,GAAA;AAEE,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,eAAe,CAAU,IAAI,CAAC;AAC7C,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,eAAe,CAAmB,EAAE,CAAC;AAGpD,IAAA;IADC,QAAQ,CAAC,MAAc,EAAA,EAAG;;iIAJf,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAzB,uBAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,cADZ,MAAM,EAAA,CAAA,CAAA;;2FACnB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACNlC;;AAEG;MAMU,6BAA6B,CAAA;iIAA7B,6BAA6B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAA7B,6BAA6B,EAAA,CAAA,CAAA;AAA7B,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,EAAA,SAAA,EAJ7B;AACT,YAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,yBAAyB,EAAE;AAC3E,SAAA,EAAA,CAAA,CAAA;;2FAEU,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBALzC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;AACT,wBAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,yBAAyB,EAAE;AAC3E,qBAAA;AACF,iBAAA;;;ACbD;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-payment-state-testing.mjs","names":[],"sources":["../../../libs/payment/state/testing/src/mock-payment-facade.ts","../../../libs/payment/state/testing/src/provider.ts","../../../libs/payment/state/testing/src/payment-testing.module.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Action } from '@ngrx/store';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffStateError } from '@daffodil/core/state';\nimport { DaffPaymentPageFacadeInterface } from '@daffodil/payment/state';\n\n/**\n * Mocks out facade fields and methods for testing purposes.\n *\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffPaymentPageFacade implements DaffPaymentPageFacadeInterface {\n loading$ = new BehaviorSubject<boolean>(null);\n errors$ = new BehaviorSubject<DaffStateError[]>([]);\n\n dispatch(action: Action) {};\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport { DaffPaymentPageFacade } from '@daffodil/payment/state';\n\nimport { MockDaffPaymentPageFacade } from './mock-payment-facade';\n\n/**\n * Provides the {@link MockDaffPaymentPageFacade} for {@link DaffPaymentPageFacade}.\n */\nexport const provideDaffPaymentStateTesting = (): EnvironmentProviders => makeEnvironmentProviders([\n { provide: DaffPaymentPageFacade, useExisting: MockDaffPaymentPageFacade },\n]);\n","import { NgModule } from '@angular/core';\n\nimport { provideDaffPaymentStateTesting } from './provider';\n\n/**\n * Provides the {@link MockDaffPaymentPageFacade} for {@link DaffPaymentPageFacade}.\n *\n * @deprecated in favor of {@link provideDaffPaymentStateTesting} Deprecated in version 0.95.0. Will be removed in version 0.98.0.\n */\n@NgModule({\n providers: [\n provideDaffPaymentStateTesting(),\n ],\n})\nexport class DaffPaymentStateTestingModule {}\n"],"mappings":";;;;AAaA,IAAa,4BAAb,MAAa,0BAAyB;CADtC,cAAA;EAEE,KAAA,WAAW,IAAI,gBAAyB,IAAI;EAC5C,KAAA,UAAU,IAAI,gBAAkC,CAAA,CAAE;CAGnD;CADC,SAAS,QAAc,CAAG;CAJf;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAzB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,YADZ;EAAM,CAAA;CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAyB,YAAA,CAAA;EADrC,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE;;;ACAlC,MAAa,uCAA6D,yBAAyB,CACjG;CAAE,SAAS;CAAuB,aAAa;AAAyB,CACzE,CAAA;ACAD,IAAa,gCAAb,MAAa,8BAA6B;CAA7B;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA6B,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAA7B;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;EAA6B,CAAA;CAAA;CAA7B;EAAA,KAAA,OAAA,GAAA,oBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA6B,WAJ7B,CACT,+BAA8B,CAC/B;EAAA,CAAA;CAAA;;AAEU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA6B,YAAA,CAAA;EALzC,MAAA;EAAS,MAAA,CAAA,EACR,WAAW,CACT,+BAA8B,CAC/B,EACF,CAAA"}
@@ -1,250 +1,166 @@
1
- import { createMultiInjectionToken, createSingleInjectionToken, daffArrayToDict } from '@daffodil/core';
2
- import * as i1 from '@ngrx/store';
3
- import { defaultMemoize, createFeatureSelector, createSelector, select, combineReducers, StoreModule } from '@ngrx/store';
4
- import * as i0 from '@angular/core';
5
- import { Injectable, inject, NgModule } from '@angular/core';
6
- import { daffTransformErrorToStateError, daffComposeReducers } from '@daffodil/core/state';
7
-
8
- /**
9
- * The payment action types enum.
10
- */
1
+ import { createMultiInjectionToken, createSingleInjectionToken, daffArrayToDict } from "@daffodil/core";
2
+ import * as i1 from "@ngrx/store";
3
+ import { StoreModule, combineReducers, createFeatureSelector, createSelector, defaultMemoize, provideState, select } from "@ngrx/store";
4
+ import * as i0 from "@angular/core";
5
+ import { Injectable, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
6
+ import { daffComposeReducers, daffTransformErrorToStateError } from "@daffodil/core/state";
11
7
  var DaffPaymentActionTypes;
12
- (function (DaffPaymentActionTypes) {
13
- DaffPaymentActionTypes["GenerateTokenSuccessAction"] = "[@daffodil/payment] Generate Token Success Action";
14
- DaffPaymentActionTypes["GenerateTokenFailureAction"] = "[@daffodil/payment] Generate Token Failure Action";
8
+ (function(DaffPaymentActionTypes) {
9
+ DaffPaymentActionTypes["GenerateTokenSuccessAction"] = "[@daffodil/payment] Generate Token Success Action";
10
+ DaffPaymentActionTypes["GenerateTokenFailureAction"] = "[@daffodil/payment] Generate Token Failure Action";
15
11
  })(DaffPaymentActionTypes || (DaffPaymentActionTypes = {}));
16
- /**
17
- * Indicates a successful generation of a payment token.
18
- */
19
- class DaffPaymentGenerateTokenSuccess {
20
- constructor(payload) {
21
- this.payload = payload;
22
- this.type = DaffPaymentActionTypes.GenerateTokenSuccessAction;
23
- }
24
- }
25
- /**
26
- * A failed payment with the error message.
27
- */
28
- class DaffPaymentGenerateTokenFailure {
29
- constructor(payload) {
30
- this.payload = payload;
31
- this.type = DaffPaymentActionTypes.GenerateTokenFailureAction;
32
- }
33
- }
34
-
35
- /**
36
- * The key under which the payment feature state will be stored.
37
- */
38
- const DAFF_PAYMENT_STORE_FEATURE_KEY = 'daffPayment';
39
-
40
- const {
41
- /**
42
- * A token to hold the injectable extra reducers.
43
- *
44
- * Prefer using {@link daffPaymentProvideExtraReducers}.
45
- */
46
- token: DAFF_PAYMENT_EXTRA_REDUCERS,
47
- /**
48
- * Provides additional reducers that run after the standard Daffodil cart reducers.
49
- *
50
- * @example
51
- * ```ts
52
- * providers: [
53
- * ...daffPaymentProvideExtraReducers(
54
- * myReducer1,
55
- * myReducer2
56
- * )
57
- * ]
58
- * ```
59
- */
60
- provider: daffPaymentProvideExtraReducers, } = createMultiInjectionToken('DAFF_PAYMENT_EXTRA_REDUCERS', { providedIn: 'any' });
61
-
62
- /**
63
- * Manages {@link DaffPaymentReducerState}.
64
- */
65
- class DaffPaymentStateReducerAdapter {
66
- /**
67
- * Begins the payment operation flow.
68
- * Sets loading to true.
69
- */
70
- generateToken(state) {
71
- return {
72
- ...state,
73
- loading: true,
74
- };
75
- }
76
- /**
77
- * Sets loading to false and resets errors.
78
- */
79
- tokenGenerated(state) {
80
- return {
81
- ...state,
82
- loading: false,
83
- errors: [],
84
- };
85
- }
86
- /**
87
- * Stores the from a failed payment.
88
- * Also sets loading to false.
89
- */
90
- storeError(errors, state) {
91
- return {
92
- ...state,
93
- errors,
94
- loading: false,
95
- };
96
- }
97
- }
98
-
99
- /**
100
- * The initial state for the main payment state, see {@link DaffPaymentReducerState}.
101
- */
12
+ var DaffPaymentGenerateTokenSuccess = class {
13
+ constructor(payload) {
14
+ this.payload = payload;
15
+ this.type = DaffPaymentActionTypes.GenerateTokenSuccessAction;
16
+ }
17
+ };
18
+ var DaffPaymentGenerateTokenFailure = class {
19
+ constructor(payload) {
20
+ this.payload = payload;
21
+ this.type = DaffPaymentActionTypes.GenerateTokenFailureAction;
22
+ }
23
+ };
24
+ const DAFF_PAYMENT_STORE_FEATURE_KEY = "daffPayment";
25
+ const { token: DAFF_PAYMENT_EXTRA_REDUCERS, provider: daffPaymentProvideExtraReducers } = createMultiInjectionToken("DAFF_PAYMENT_EXTRA_REDUCERS", { providedIn: "any" });
26
+ var DaffPaymentStateReducerAdapter = class {
27
+ generateToken(state) {
28
+ return {
29
+ ...state,
30
+ loading: true
31
+ };
32
+ }
33
+ tokenGenerated(state) {
34
+ return {
35
+ ...state,
36
+ loading: false,
37
+ errors: []
38
+ };
39
+ }
40
+ storeError(errors, state) {
41
+ return {
42
+ ...state,
43
+ errors,
44
+ loading: false
45
+ };
46
+ }
47
+ };
102
48
  const daffPaymentInitialState = {
103
- loading: false,
104
- errors: [],
49
+ loading: false,
50
+ errors: []
105
51
  };
106
-
107
- /**
108
- * The reducer for the payment page state, see {@link DaffPaymentReducerState}.
109
- */
110
52
  const daffPaymentReducerFactory = (actions) => (state = daffPaymentInitialState, action) => {
111
- const adapter = new DaffPaymentStateReducerAdapter();
112
- switch (true) {
113
- case actions.includes(action.type):
114
- return adapter.generateToken(state);
115
- case action.type === DaffPaymentActionTypes.GenerateTokenSuccessAction:
116
- return adapter.tokenGenerated(state);
117
- case action.type === DaffPaymentActionTypes.GenerateTokenFailureAction:
118
- return adapter.storeError([action.payload], state);
119
- default:
120
- return state;
121
- }
53
+ const adapter = new DaffPaymentStateReducerAdapter();
54
+ switch (true) {
55
+ case actions.includes(action.type): return adapter.generateToken(state);
56
+ case action.type === DaffPaymentActionTypes.GenerateTokenSuccessAction: return adapter.tokenGenerated(state);
57
+ case action.type === DaffPaymentActionTypes.GenerateTokenFailureAction: return adapter.storeError([action.payload], state);
58
+ default: return state;
59
+ }
122
60
  };
123
-
124
- const getDaffPaymentReducersStateSelector = defaultMemoize(() => ({
125
- selectPaymentFeatureState: createFeatureSelector(DAFF_PAYMENT_STORE_FEATURE_KEY),
126
- })).memoized;
127
-
128
- /**
129
- * Creates a group of selectors for {@link DaffPaymentReducerState} that use the passed state selector as the basis.
130
- */
61
+ const getDaffPaymentReducersStateSelector = defaultMemoize(() => ({ selectPaymentFeatureState: createFeatureSelector(DAFF_PAYMENT_STORE_FEATURE_KEY) })).memoized;
131
62
  const daffPaymentCreateSelectors = () => {
132
- const { selectPaymentFeatureState } = getDaffPaymentReducersStateSelector();
133
- const selectPaymentState = createSelector(selectPaymentFeatureState, state => state.payment);
134
- const selectPaymentLoading = createSelector(selectPaymentState, state => state.loading);
135
- const selectPaymentErrors = createSelector(selectPaymentState, state => state.errors);
136
- return {
137
- selectPaymentLoading,
138
- selectPaymentErrors,
139
- };
63
+ const { selectPaymentFeatureState } = getDaffPaymentReducersStateSelector();
64
+ const selectPaymentState = createSelector(selectPaymentFeatureState, (state) => state.payment);
65
+ return {
66
+ selectPaymentLoading: createSelector(selectPaymentState, (state) => state.loading),
67
+ selectPaymentErrors: createSelector(selectPaymentState, (state) => state.errors)
68
+ };
140
69
  };
141
70
  const daffPaymentGetSelectors = defaultMemoize(() => daffPaymentCreateSelectors()).memoized;
142
-
143
- /**
144
- * @inheritdoc
145
- *
146
- * Serves as the base for a payment facade.
147
- * Extend this class and pass in the selectors for the specific state you wish to target.
148
- */
149
- class DaffPaymentPageFacade {
150
- constructor(store) {
151
- this.store = store;
152
- const { selectPaymentLoading, selectPaymentErrors, } = daffPaymentGetSelectors();
153
- this.loading$ = this.store.pipe(select(selectPaymentLoading));
154
- this.errors$ = this.store.pipe(select(selectPaymentErrors));
155
- }
156
- dispatch(action) {
157
- this.store.dispatch(action);
158
- }
159
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentPageFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
160
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentPageFacade, providedIn: 'root' }); }
161
- }
162
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentPageFacade, decorators: [{
163
- type: Injectable,
164
- args: [{
165
- providedIn: 'root',
166
- }]
167
- }], ctorParameters: () => [{ type: i1.Store }] });
168
-
169
- const {
170
- /**
171
- * A multi-provider injection token for registering payment processors.
172
- */
173
- token: DAFF_PAYMENT_AVAILABLE_PROCESSORS,
174
- /**
175
- * Provides a payment processor registration.
176
- *
177
- * See {@link DaffPaymentAvailableProcessor}.
178
- */
179
- provider: daffPaymentProvideAvailableProcessors, } = createMultiInjectionToken('DAFF_PAYMENT_AVAILABLE_PROCESSORS', { providedIn: 'any' });
180
-
181
- const {
182
- /**
183
- * An internal token to combine the available payment processors into a single collection.
184
- */
185
- token: DAFF_PAYMENT_PROCESSOR_COLLECTION,
186
- /**
187
- * Provider function for {@link DAFF_PAYMENT_PROCESSOR_COLLECTION}.
188
- */
189
- provider: provideDaffPaymentProcessorCollection, } = createSingleInjectionToken('DAFF_PAYMENT_PROCESSOR_COLLECTION', {
190
- factory: () => {
191
- const processors = inject(DAFF_PAYMENT_AVAILABLE_PROCESSORS);
192
- return daffArrayToDict(processors, ({ kind }) => kind);
193
- },
71
+ var DaffPaymentPageFacade = class DaffPaymentPageFacade {
72
+ constructor(store) {
73
+ this.store = store;
74
+ const { selectPaymentLoading, selectPaymentErrors } = daffPaymentGetSelectors();
75
+ this.loading$ = this.store.pipe(select(selectPaymentLoading));
76
+ this.errors$ = this.store.pipe(select(selectPaymentErrors));
77
+ }
78
+ dispatch(action) {
79
+ this.store.dispatch(action);
80
+ }
81
+ static {
82
+ this.ɵfac = i0.ɵɵngDeclareFactory({
83
+ minVersion: "12.0.0",
84
+ version: "22.2.4",
85
+ ngImport: i0,
86
+ type: DaffPaymentPageFacade,
87
+ deps: [{ token: i1.Store }],
88
+ target: i0.ɵɵFactoryTarget.Injectable
89
+ });
90
+ }
91
+ static {
92
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
93
+ minVersion: "12.0.0",
94
+ version: "22.2.4",
95
+ ngImport: i0,
96
+ type: DaffPaymentPageFacade,
97
+ providedIn: "root"
98
+ });
99
+ }
100
+ };
101
+ i0.ɵɵngDeclareClassMetadata({
102
+ minVersion: "12.0.0",
103
+ version: "22.2.4",
104
+ ngImport: i0,
105
+ type: DaffPaymentPageFacade,
106
+ decorators: [{
107
+ type: Injectable,
108
+ args: [{ providedIn: "root" }]
109
+ }],
110
+ ctorParameters: () => [{ type: i1.Store }]
194
111
  });
195
-
196
- const {
197
- /**
198
- * Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
199
- * Can be used to further refine Daffodil errors into more specific app errors.
200
- */
201
- token: DAFF_PAYMENT_ERROR_MATCHER,
202
- /**
203
- * Provider function for {@link DAFF_PAYMENT_ERROR_MATCHER}.
204
- */
205
- provider: provideDaffPaymentErrorMatcher, } = createSingleInjectionToken('DAFF_PAYMENT_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
206
-
207
- const {
208
- /**
209
- * An internal token to hold the Daffodil payment reducers.
210
- * Includes the extra and standard reducers.
211
- *
212
- * @docs-private
213
- */
214
- token: DAFF_PAYMENT_REDUCERS,
215
- /**
216
- * Provider function for {@link DAFF_PAYMENT_REDUCERS}.
217
- */
218
- provider: provideDaffPaymentReducers, } = createSingleInjectionToken('DAFF_PAYMENT_REDUCERS', {
219
- providedIn: 'any',
220
- factory: () => daffComposeReducers([
221
- combineReducers({
222
- payment: daffPaymentReducerFactory(inject(DAFF_PAYMENT_AVAILABLE_PROCESSORS).map(({ action }) => action)),
223
- }),
224
- ...inject(DAFF_PAYMENT_EXTRA_REDUCERS),
225
- ]),
112
+ const { token: DAFF_PAYMENT_AVAILABLE_PROCESSORS, provider: daffPaymentProvideAvailableProcessors } = createMultiInjectionToken("DAFF_PAYMENT_AVAILABLE_PROCESSORS", { providedIn: "any" });
113
+ const { token: DAFF_PAYMENT_PROCESSOR_COLLECTION, provider: provideDaffPaymentProcessorCollection } = createSingleInjectionToken("DAFF_PAYMENT_PROCESSOR_COLLECTION", { factory: () => {
114
+ const processors = inject(DAFF_PAYMENT_AVAILABLE_PROCESSORS);
115
+ return daffArrayToDict(processors, ({ kind }) => kind);
116
+ } });
117
+ const { token: DAFF_PAYMENT_ERROR_MATCHER, provider: provideDaffPaymentErrorMatcher } = createSingleInjectionToken("DAFF_PAYMENT_ERROR_MATCHER", { factory: () => daffTransformErrorToStateError });
118
+ const { token: DAFF_PAYMENT_REDUCERS, provider: provideDaffPaymentReducers, factoryProvider: provideDaffPaymentReducersFactory } = createSingleInjectionToken("DAFF_PAYMENT_REDUCERS");
119
+ var DaffPaymentStateModule = class DaffPaymentStateModule {
120
+ static {
121
+ this.ɵfac = i0.ɵɵngDeclareFactory({
122
+ minVersion: "12.0.0",
123
+ version: "22.2.4",
124
+ ngImport: i0,
125
+ type: DaffPaymentStateModule,
126
+ deps: [],
127
+ target: i0.ɵɵFactoryTarget.NgModule
128
+ });
129
+ }
130
+ static {
131
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
132
+ minVersion: "14.0.0",
133
+ version: "22.2.4",
134
+ ngImport: i0,
135
+ type: DaffPaymentStateModule,
136
+ imports: [i1.StoreFeatureModule]
137
+ });
138
+ }
139
+ static {
140
+ this.ɵinj = i0.ɵɵngDeclareInjector({
141
+ minVersion: "12.0.0",
142
+ version: "22.2.4",
143
+ ngImport: i0,
144
+ type: DaffPaymentStateModule,
145
+ providers: [provideDaffPaymentReducersFactory((() => daffComposeReducers([combineReducers({ payment: daffPaymentReducerFactory(inject(DAFF_PAYMENT_AVAILABLE_PROCESSORS).map((({ action }) => action))) }), ...inject(DAFF_PAYMENT_EXTRA_REDUCERS)])))],
146
+ imports: [StoreModule.forFeature(DAFF_PAYMENT_STORE_FEATURE_KEY, DAFF_PAYMENT_REDUCERS)]
147
+ });
148
+ }
149
+ };
150
+ i0.ɵɵngDeclareClassMetadata({
151
+ minVersion: "12.0.0",
152
+ version: "22.2.4",
153
+ ngImport: i0,
154
+ type: DaffPaymentStateModule,
155
+ decorators: [{
156
+ type: NgModule,
157
+ args: [{
158
+ imports: [StoreModule.forFeature(DAFF_PAYMENT_STORE_FEATURE_KEY, DAFF_PAYMENT_REDUCERS)],
159
+ providers: [provideDaffPaymentReducersFactory((() => daffComposeReducers([combineReducers({ payment: daffPaymentReducerFactory(inject(DAFF_PAYMENT_AVAILABLE_PROCESSORS).map((({ action }) => action))) }), ...inject(DAFF_PAYMENT_EXTRA_REDUCERS)])))]
160
+ }]
161
+ }]
226
162
  });
163
+ const provideDaffPaymentState = () => makeEnvironmentProviders([provideState(DAFF_PAYMENT_STORE_FEATURE_KEY, DAFF_PAYMENT_REDUCERS), provideDaffPaymentReducersFactory(() => daffComposeReducers([combineReducers({ payment: daffPaymentReducerFactory(inject(DAFF_PAYMENT_AVAILABLE_PROCESSORS).map(({ action }) => action)) }), ...inject(DAFF_PAYMENT_EXTRA_REDUCERS)]))]);
164
+ export { DAFF_PAYMENT_AVAILABLE_PROCESSORS, DAFF_PAYMENT_ERROR_MATCHER, DAFF_PAYMENT_EXTRA_REDUCERS, DAFF_PAYMENT_PROCESSOR_COLLECTION, DAFF_PAYMENT_STORE_FEATURE_KEY, DaffPaymentActionTypes, DaffPaymentGenerateTokenFailure, DaffPaymentGenerateTokenSuccess, DaffPaymentPageFacade, DaffPaymentStateModule, DaffPaymentStateReducerAdapter, daffPaymentGetSelectors, daffPaymentInitialState, daffPaymentProvideAvailableProcessors, daffPaymentProvideExtraReducers, daffPaymentReducerFactory, provideDaffPaymentErrorMatcher, provideDaffPaymentState };
227
165
 
228
- /**
229
- * Creates the payment feature store.
230
- */
231
- class DaffPaymentStateModule {
232
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
233
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateModule, imports: [i1.StoreFeatureModule] }); }
234
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateModule, imports: [StoreModule.forFeature(DAFF_PAYMENT_STORE_FEATURE_KEY, DAFF_PAYMENT_REDUCERS)] }); }
235
- }
236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffPaymentStateModule, decorators: [{
237
- type: NgModule,
238
- args: [{
239
- imports: [
240
- StoreModule.forFeature(DAFF_PAYMENT_STORE_FEATURE_KEY, DAFF_PAYMENT_REDUCERS),
241
- ],
242
- }]
243
- }] });
244
-
245
- /**
246
- * Generated bundle index. Do not edit.
247
- */
248
-
249
- export { DAFF_PAYMENT_AVAILABLE_PROCESSORS, DAFF_PAYMENT_ERROR_MATCHER, DAFF_PAYMENT_EXTRA_REDUCERS, DAFF_PAYMENT_PROCESSOR_COLLECTION, DAFF_PAYMENT_STORE_FEATURE_KEY, DaffPaymentActionTypes, DaffPaymentGenerateTokenFailure, DaffPaymentGenerateTokenSuccess, DaffPaymentPageFacade, DaffPaymentStateModule, DaffPaymentStateReducerAdapter, daffPaymentGetSelectors, daffPaymentInitialState, daffPaymentProvideAvailableProcessors, daffPaymentProvideExtraReducers, daffPaymentReducerFactory, provideDaffPaymentErrorMatcher };
250
- //# sourceMappingURL=daffodil-payment-state.mjs.map
166
+ //# sourceMappingURL=daffodil-payment-state.mjs.map