@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.
- package/fesm2022/daffodil-customer-store-credit-driver-in-memory.mjs +147 -116
- package/fesm2022/daffodil-customer-store-credit-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs +51 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7-testing.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7.mjs +157 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-2.4.7.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto-testing.mjs +7 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto-testing.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-customer-store-credit-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-customer-store-credit-driver-testing.mjs +93 -60
- package/fesm2022/daffodil-customer-store-credit-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-driver.mjs +13 -39
- package/fesm2022/daffodil-customer-store-credit-driver.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-routing.mjs +86 -52
- package/fesm2022/daffodil-customer-store-credit-routing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-state-testing.mjs +86 -50
- package/fesm2022/daffodil-customer-store-credit-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-state.mjs +212 -231
- package/fesm2022/daffodil-customer-store-credit-state.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit-testing.mjs +49 -36
- package/fesm2022/daffodil-customer-store-credit-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-store-credit.mjs +3 -7
- package/fesm2022/daffodil-customer-store-credit.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-customer-store-credit-driver-in-memory.d.ts +54 -54
- package/types/daffodil-customer-store-credit-driver-magento-2.4.7-testing.d.ts +16 -0
- package/types/daffodil-customer-store-credit-driver-magento-2.4.7.d.ts +62 -0
- package/types/daffodil-customer-store-credit-driver-magento-auto-testing.d.ts +1 -0
- package/types/daffodil-customer-store-credit-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-customer-store-credit-driver-testing.d.ts +24 -22
- package/types/daffodil-customer-store-credit-driver.d.ts +19 -28
- package/types/daffodil-customer-store-credit-routing.d.ts +18 -22
- package/types/daffodil-customer-store-credit-state-testing.d.ts +22 -19
- package/types/daffodil-customer-store-credit-state.d.ts +74 -86
- package/types/daffodil-customer-store-credit-testing.d.ts +10 -13
- package/types/daffodil-customer-store-credit.d.ts +6 -10
- package/fesm2022/daffodil-customer-store-credit-driver-magento-testing.mjs +0 -34
- package/fesm2022/daffodil-customer-store-credit-driver-magento-testing.mjs.map +0 -1
- package/fesm2022/daffodil-customer-store-credit-driver-magento.mjs +0 -154
- package/fesm2022/daffodil-customer-store-credit-driver-magento.mjs.map +0 -1
- package/types/daffodil-customer-store-credit-driver-magento-testing.d.ts +0 -20
- package/types/daffodil-customer-store-credit-driver-magento.d.ts +0 -67
|
@@ -1,150 +1,138 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Action, ActionReducer, MemoizedSelector, Store } from
|
|
3
|
-
import {
|
|
4
|
-
import { DaffCustomerStoreCredit } from
|
|
5
|
-
import
|
|
6
|
-
import * as
|
|
7
|
-
import {
|
|
8
|
-
import * as i2 from
|
|
9
|
-
|
|
1
|
+
import * as i1 from "@ngrx/store";
|
|
2
|
+
import { Action, ActionReducer, MemoizedSelector, Store } from "@ngrx/store";
|
|
3
|
+
import { DaffOperationState, DaffOperationStateFacadeInterface, DaffOperationStateSelectors, DaffStateError, daffTransformErrorToStateError } from "@daffodil/core/state";
|
|
4
|
+
import { DaffCustomerStoreCredit } from "@daffodil/customer-store-credit";
|
|
5
|
+
import { Observable } from "rxjs";
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import { EnvironmentProviders } from "@angular/core";
|
|
8
|
+
import * as i2 from "@ngrx/effects";
|
|
10
9
|
/**
|
|
11
10
|
* The customer store credit action types enum.
|
|
12
11
|
*/
|
|
13
|
-
declare enum DaffCustomerStoreCreditActionTypes {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
export declare enum DaffCustomerStoreCreditActionTypes {
|
|
13
|
+
StoreCreditLoadAction = "[@daffodil/customer-store-credit] Store Credit Load Action",
|
|
14
|
+
StoreCreditLoadSuccessAction = "[@daffodil/customer-store-credit] Store Credit Load Success Action",
|
|
15
|
+
StoreCreditLoadFailureAction = "[@daffodil/customer-store-credit] Store Credit Load Failure Action",
|
|
16
|
+
StoreCreditClearErrorsAction = "[@daffodil/customer-store-credit] Store Credit Clear Errors Action"
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Loads the store credit of the current customer.
|
|
21
20
|
*/
|
|
22
|
-
declare class DaffCustomerStoreCreditLoad implements Action {
|
|
23
|
-
|
|
21
|
+
export declare class DaffCustomerStoreCreditLoad implements Action {
|
|
22
|
+
readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadAction;
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
25
|
* Indicates a successful load of the customer's store credit.
|
|
27
26
|
*/
|
|
28
|
-
declare class DaffCustomerStoreCreditLoadSuccess<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements Action {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
export declare class DaffCustomerStoreCreditLoadSuccess<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements Action {
|
|
28
|
+
payload: T;
|
|
29
|
+
readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadSuccessAction;
|
|
30
|
+
constructor(payload: T);
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
33
|
* A failed customer store credit load with the error message.
|
|
35
34
|
*/
|
|
36
|
-
declare class DaffCustomerStoreCreditLoadFailure implements Action {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
export declare class DaffCustomerStoreCreditLoadFailure implements Action {
|
|
36
|
+
payload: DaffStateError;
|
|
37
|
+
readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditLoadFailureAction;
|
|
38
|
+
constructor(payload: DaffStateError);
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
42
41
|
* An action to clear all errors in state.
|
|
43
42
|
*/
|
|
44
|
-
declare class DaffCustomerStoreCreditClearErrors implements Action {
|
|
45
|
-
|
|
43
|
+
export declare class DaffCustomerStoreCreditClearErrors implements Action {
|
|
44
|
+
readonly type = DaffCustomerStoreCreditActionTypes.StoreCreditClearErrorsAction;
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
47
|
* A union of the customer action types.
|
|
49
48
|
*/
|
|
50
|
-
type DaffCustomerStoreCreditActions<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> = DaffCustomerStoreCreditLoad | DaffCustomerStoreCreditLoadSuccess<TStoreCredit> | DaffCustomerStoreCreditLoadFailure | DaffCustomerStoreCreditClearErrors;
|
|
51
|
-
|
|
49
|
+
export type DaffCustomerStoreCreditActions<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> = DaffCustomerStoreCreditLoad | DaffCustomerStoreCreditLoadSuccess<TStoreCredit> | DaffCustomerStoreCreditLoadFailure | DaffCustomerStoreCreditClearErrors;
|
|
52
50
|
/**
|
|
53
51
|
* The customer store credit state.
|
|
54
52
|
*/
|
|
55
|
-
interface DaffCustomerStoreCreditReducerState<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationState {
|
|
56
|
-
|
|
53
|
+
export interface DaffCustomerStoreCreditReducerState<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationState {
|
|
54
|
+
storeCredit: TStoreCredit;
|
|
57
55
|
}
|
|
58
|
-
|
|
59
56
|
/**
|
|
60
57
|
* The initial state for the main customer store credit state, see {@link DaffCustomerStoreCreditReducerState}.
|
|
61
58
|
*/
|
|
62
|
-
declare const daffCustomerStoreCreditInitialState: DaffCustomerStoreCreditReducerState;
|
|
63
|
-
|
|
59
|
+
export declare const daffCustomerStoreCreditInitialState: DaffCustomerStoreCreditReducerState;
|
|
64
60
|
/**
|
|
65
61
|
* The reducer for the customer store credit page state, see {@link DaffCustomerStoreCreditReducerState}.
|
|
66
62
|
*/
|
|
67
|
-
declare const daffCustomerStoreCreditReducer: <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>(state: DaffCustomerStoreCreditReducerState<DaffCustomerStoreCredit>, action: DaffCustomerStoreCreditActions<T>) => DaffCustomerStoreCreditReducerState;
|
|
68
|
-
|
|
63
|
+
export declare const daffCustomerStoreCreditReducer: <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>(state: DaffCustomerStoreCreditReducerState<DaffCustomerStoreCredit>, action: DaffCustomerStoreCreditActions<T>) => DaffCustomerStoreCreditReducerState;
|
|
69
64
|
/**
|
|
70
65
|
* The key under which the customer store credit feature state will be stored.
|
|
71
66
|
*/
|
|
72
|
-
declare const DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY = "daffCustomerStoreCredit";
|
|
73
|
-
|
|
67
|
+
export declare const DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY = "daffCustomerStoreCredit";
|
|
74
68
|
/**
|
|
75
69
|
* The feature state for customer store credit.
|
|
76
70
|
*/
|
|
77
|
-
interface DaffCustomerStoreCreditReducersState<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> {
|
|
78
|
-
|
|
71
|
+
export interface DaffCustomerStoreCreditReducersState<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> {
|
|
72
|
+
storeCredit: DaffCustomerStoreCreditReducerState<TStoreCredit>;
|
|
79
73
|
}
|
|
80
74
|
/**
|
|
81
75
|
* The footprint of customer store credit feature state in the root application state.
|
|
82
76
|
*/
|
|
83
|
-
interface DaffCustomerStoreCreditStateRootSlice<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> {
|
|
84
|
-
|
|
77
|
+
export interface DaffCustomerStoreCreditStateRootSlice<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> {
|
|
78
|
+
[DAFF_CUSTOMER_STORE_CREDIT_STORE_FEATURE_KEY]: DaffCustomerStoreCreditReducersState<TStoreCredit>;
|
|
85
79
|
}
|
|
86
|
-
|
|
87
|
-
declare const DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS: i0.InjectionToken<ActionReducer<DaffCustomerStoreCreditReducersState<_daffodil_customer_store_credit_types_daffodil_customer_store_credit.DaffCustomerStoreCredit>, _ngrx_store.Action<string>>[]>;
|
|
88
|
-
declare const daffCustomerStoreCreditProvideExtraReducers: <R extends ActionReducer<DaffCustomerStoreCreditReducersState<_daffodil_customer_store_credit_types_daffodil_customer_store_credit.DaffCustomerStoreCredit>, _ngrx_store.Action<string>> = ActionReducer<DaffCustomerStoreCreditReducersState<_daffodil_customer_store_credit_types_daffodil_customer_store_credit.DaffCustomerStoreCredit>, _ngrx_store.Action<string>>>(...values: R[]) => Array<i0.ValueProvider>;
|
|
89
|
-
|
|
80
|
+
export declare const DAFF_CUSTOMER_STORE_CREDIT_EXTRA_REDUCERS: import("@angular/core").InjectionToken<ActionReducer<DaffCustomerStoreCreditReducersState<import("@daffodil/customer-store-credit/types/daffodil-customer-store-credit").DaffCustomerStoreCredit>, import("@ngrx/store").Action<string>>[]>, daffCustomerStoreCreditProvideExtraReducers: <R extends ActionReducer<DaffCustomerStoreCreditReducersState<import("@daffodil/customer-store-credit/types/daffodil-customer-store-credit").DaffCustomerStoreCredit>, import("@ngrx/store").Action<string>> = ActionReducer<DaffCustomerStoreCreditReducersState<import("@daffodil/customer-store-credit/types/daffodil-customer-store-credit").DaffCustomerStoreCredit>, import("@ngrx/store").Action<string>>>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
|
|
90
81
|
/**
|
|
91
82
|
* Selectors for the main part of customer store credit state.
|
|
92
83
|
*/
|
|
93
|
-
interface DaffCustomerStoreCreditSelectors<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationStateSelectors<DaffCustomerStoreCreditStateRootSlice<T>, DaffCustomerStoreCreditReducerState<T>> {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
export interface DaffCustomerStoreCreditSelectors<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationStateSelectors<DaffCustomerStoreCreditStateRootSlice<T>, DaffCustomerStoreCreditReducerState<T>> {
|
|
85
|
+
/**
|
|
86
|
+
* Selects the customer's current store credit balance.
|
|
87
|
+
*/
|
|
88
|
+
selectStoreCredit: MemoizedSelector<DaffCustomerStoreCreditStateRootSlice<T>, T>;
|
|
98
89
|
}
|
|
99
|
-
declare const daffCustomerStoreCreditGetSelectors: <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditSelectors<T>;
|
|
100
|
-
|
|
90
|
+
export declare const daffCustomerStoreCreditGetSelectors: <T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditSelectors<T>;
|
|
101
91
|
/**
|
|
102
92
|
* Selector for the customer store credit feature state.
|
|
103
93
|
*/
|
|
104
|
-
interface DaffCustomerStoreCreditFeatureSelector<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> {
|
|
105
|
-
|
|
94
|
+
export interface DaffCustomerStoreCreditFeatureSelector<TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> {
|
|
95
|
+
selectCustomerStoreCreditFeatureState: MemoizedSelector<DaffCustomerStoreCreditStateRootSlice<TStoreCredit>, DaffCustomerStoreCreditReducersState<TStoreCredit>>;
|
|
106
96
|
}
|
|
107
|
-
declare const getDaffCustomerStoreCreditReducersStateSelector: <TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditFeatureSelector<TStoreCredit>;
|
|
108
|
-
|
|
97
|
+
export declare const getDaffCustomerStoreCreditReducersStateSelector: <TStoreCredit extends DaffCustomerStoreCredit = DaffCustomerStoreCredit>() => DaffCustomerStoreCreditFeatureSelector<TStoreCredit>;
|
|
109
98
|
/**
|
|
110
99
|
* Exposes the customer store credit state selectors.
|
|
111
100
|
*/
|
|
112
|
-
interface DaffCustomerStoreCreditPageFacadeInterface<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationStateFacadeInterface<DaffCustomerStoreCreditReducerState> {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
export interface DaffCustomerStoreCreditPageFacadeInterface<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> extends DaffOperationStateFacadeInterface<DaffCustomerStoreCreditReducerState> {
|
|
102
|
+
/**
|
|
103
|
+
* The customer's current store credit.
|
|
104
|
+
*/
|
|
105
|
+
storeCredit$: Observable<T>;
|
|
117
106
|
}
|
|
118
|
-
|
|
119
107
|
/**
|
|
120
108
|
* @inheritdoc
|
|
121
109
|
*/
|
|
122
|
-
declare class DaffCustomerStoreCreditPageFacade<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements DaffCustomerStoreCreditPageFacadeInterface<T> {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
110
|
+
export declare class DaffCustomerStoreCreditPageFacade<T extends DaffCustomerStoreCredit = DaffCustomerStoreCredit> implements DaffCustomerStoreCreditPageFacadeInterface<T> {
|
|
111
|
+
private store;
|
|
112
|
+
storeCredit$: Observable<T>;
|
|
113
|
+
loadingState$: Observable<DaffCustomerStoreCreditReducerState['daffState']>;
|
|
114
|
+
loading$: Observable<boolean>;
|
|
115
|
+
resolving$: Observable<boolean>;
|
|
116
|
+
mutating$: Observable<boolean>;
|
|
117
|
+
errors$: Observable<DaffCustomerStoreCreditReducerState['daffErrors']>;
|
|
118
|
+
hasErrors$: Observable<boolean>;
|
|
119
|
+
constructor(store: Store<DaffCustomerStoreCreditStateRootSlice>);
|
|
120
|
+
dispatch(action: Action): void;
|
|
121
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCustomerStoreCreditPageFacade<any>, never>;
|
|
122
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
135
123
|
}
|
|
136
|
-
|
|
137
|
-
declare const DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER: i0.InjectionToken<typeof daffTransformErrorToStateError>;
|
|
138
|
-
declare const provideDaffCustomerStoreCreditErrorMatcher: <R extends typeof daffTransformErrorToStateError = typeof daffTransformErrorToStateError>(value: R) => i0.ValueProvider;
|
|
139
|
-
|
|
124
|
+
export declare const DAFF_CUSTOMER_STORE_CREDIT_ERROR_MATCHER: import("@angular/core").InjectionToken<typeof daffTransformErrorToStateError>, provideDaffCustomerStoreCreditErrorMatcher: <R extends typeof daffTransformErrorToStateError = typeof daffTransformErrorToStateError>(value: R) => import("@angular/core").ValueProvider;
|
|
140
125
|
/**
|
|
141
126
|
* Creates the customer store credit feature store.
|
|
127
|
+
*
|
|
128
|
+
* @deprecated in favor of {@link provideDaffCustomerStoreCreditState} Deprecated in version 0.95.0. Will be removed in version 0.98.0.
|
|
142
129
|
*/
|
|
143
|
-
declare class DaffCustomerStoreCreditStateModule {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
130
|
+
export declare class DaffCustomerStoreCreditStateModule {
|
|
131
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCustomerStoreCreditStateModule, never>;
|
|
132
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCustomerStoreCreditStateModule, never, [typeof i1.StoreFeatureModule, typeof i2.EffectsFeatureModule], never>;
|
|
133
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffCustomerStoreCreditStateModule>;
|
|
147
134
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Provides the `@daffodil/customer-store-credit/state` feature state and effects.
|
|
137
|
+
*/
|
|
138
|
+
export declare const provideDaffCustomerStoreCreditState: () => EnvironmentProviders;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { DaffModelFactory } from
|
|
2
|
-
import { DaffCustomerStoreCredit } from
|
|
3
|
-
import * as i0 from
|
|
4
|
-
|
|
1
|
+
import { DaffModelFactory } from "@daffodil/core/testing";
|
|
2
|
+
import { DaffCustomerStoreCredit } from "@daffodil/customer-store-credit";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
5
4
|
/**
|
|
6
5
|
* Mock class for {@link DaffCustomerStoreCredit}.
|
|
7
6
|
*/
|
|
8
|
-
declare class MockDaffCustomerStoreCredit implements DaffCustomerStoreCredit {
|
|
9
|
-
|
|
7
|
+
export declare class MockDaffCustomerStoreCredit implements DaffCustomerStoreCredit {
|
|
8
|
+
balance: number;
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* Model factory for {@link DaffCustomerStoreCredit}.
|
|
13
12
|
*/
|
|
14
|
-
declare class DaffCustomerStoreCreditFactory extends DaffModelFactory<DaffCustomerStoreCredit> {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { DaffCustomerStoreCreditFactory, MockDaffCustomerStoreCredit };
|
|
13
|
+
export declare class DaffCustomerStoreCreditFactory extends DaffModelFactory<DaffCustomerStoreCredit> {
|
|
14
|
+
constructor();
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCustomerStoreCreditFactory, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
17
|
+
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A {@link DaffCustomer}'s store credit
|
|
3
3
|
*/
|
|
4
|
-
interface DaffCustomerStoreCredit {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export interface DaffCustomerStoreCredit {
|
|
5
|
+
/**
|
|
6
|
+
* The current balance of the customer's store credit.
|
|
7
|
+
*/
|
|
8
|
+
balance: number;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
declare const DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE = "storeCredit";
|
|
12
|
-
|
|
13
|
-
export { DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE };
|
|
14
|
-
export type { DaffCustomerStoreCredit };
|
|
10
|
+
export declare const DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE = "storeCredit";
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable } from '@angular/core';
|
|
3
|
-
import { faker } from '@faker-js/faker/locale/en_US';
|
|
4
|
-
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
5
|
-
import * as i1 from '@daffodil/driver/magento/testing';
|
|
6
|
-
|
|
7
|
-
class MockMagentoCustomerStoreCredit {
|
|
8
|
-
constructor(moneyFactory) {
|
|
9
|
-
this.moneyFactory = moneyFactory;
|
|
10
|
-
this.__typename = 'CustomerStoreCredit';
|
|
11
|
-
this.current_balance = this.moneyFactory.create();
|
|
12
|
-
this.enabled = faker.datatype.boolean();
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
class MagentoCustomerStoreCreditFactory extends DaffModelFactory {
|
|
16
|
-
constructor(moneyFactory) {
|
|
17
|
-
super(MockMagentoCustomerStoreCredit, moneyFactory);
|
|
18
|
-
}
|
|
19
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoCustomerStoreCreditFactory, deps: [{ token: i1.MagentoMoneyFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
20
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoCustomerStoreCreditFactory, providedIn: 'root' }); }
|
|
21
|
-
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoCustomerStoreCreditFactory, decorators: [{
|
|
23
|
-
type: Injectable,
|
|
24
|
-
args: [{
|
|
25
|
-
providedIn: 'root',
|
|
26
|
-
}]
|
|
27
|
-
}], ctorParameters: () => [{ type: i1.MagentoMoneyFactory }] });
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Generated bundle index. Do not edit.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
export { MagentoCustomerStoreCreditFactory, MockMagentoCustomerStoreCredit };
|
|
34
|
-
//# sourceMappingURL=daffodil-customer-store-credit-driver-magento-testing.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-customer-store-credit-driver-magento-testing.mjs","sources":["../../../libs/customer-store-credit/driver/magento/testing/src/factories/customer-store-credit.factory.ts","../../../libs/customer-store-credit/driver/magento/testing/src/daffodil-customer-store-credit-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { faker } from '@faker-js/faker/locale/en_US';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MagentoCustomerStoreCredit } from '@daffodil/customer-store-credit/driver/magento';\nimport { MagentoMoneyFactory } from '@daffodil/driver/magento/testing';\n\nexport class MockMagentoCustomerStoreCredit implements MagentoCustomerStoreCredit {\n __typename = <const>'CustomerStoreCredit';\n current_balance = this.moneyFactory.create();\n enabled = faker.datatype.boolean();\n\n constructor(\n protected moneyFactory: MagentoMoneyFactory,\n ) {}\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoCustomerStoreCreditFactory extends DaffModelFactory<MagentoCustomerStoreCredit> {\n constructor(\n moneyFactory: MagentoMoneyFactory,\n ) {\n super(MockMagentoCustomerStoreCredit, moneyFactory);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAOa,8BAA8B,CAAA;AAKzC,IAAA,WAAA,CACY,YAAiC,EAAA;QAAjC,IAAA,CAAA,YAAY,GAAZ,YAAY;QALxB,IAAA,CAAA,UAAU,GAAU,qBAAqB;AACzC,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;AAC5C,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE;IAI/B;AACJ;AAKK,MAAO,iCAAkC,SAAQ,gBAA4C,CAAA;AACjG,IAAA,WAAA,CACE,YAAiC,EAAA;AAEjC,QAAA,KAAK,CAAC,8BAA8B,EAAE,YAAY,CAAC;IACrD;iIALW,iCAAiC,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjC,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,iCAAiC,cAFhC,MAAM,EAAA,CAAA,CAAA;;2FAEP,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAH7C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE } from '@daffodil/customer-store-credit';
|
|
2
|
-
import * as i1 from 'apollo-angular';
|
|
3
|
-
import { gql } from 'apollo-angular';
|
|
4
|
-
import { magentoMoneyFragment, daffTransformMagentoError } from '@daffodil/driver/magento';
|
|
5
|
-
import { CombinedGraphQLErrors } from '@apollo/client';
|
|
6
|
-
import { DaffCustomerStoreCreditDriverErrorMap, DaffCustomerStoreCreditInvalidAPIResponseError, provideDaffCustomerStoreCreditDriver } from '@daffodil/customer-store-credit/driver';
|
|
7
|
-
import * as i0 from '@angular/core';
|
|
8
|
-
import { Injectable, NgModule } from '@angular/core';
|
|
9
|
-
import { throwError } from 'rxjs';
|
|
10
|
-
import { map, catchError } from 'rxjs/operators';
|
|
11
|
-
import { CommonModule } from '@angular/common';
|
|
12
|
-
import { provideDaffCustomerOrderMagentoExtraOrderFragments, provideDaffCustomerOrderMagentoExtraOrderTransforms } from '@daffodil/customer-order/driver/magento/2.4.6';
|
|
13
|
-
|
|
14
|
-
const magentoCustomerStoreCreditTransform = (storeCredit) => ({
|
|
15
|
-
balance: storeCredit.current_balance.value,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const magentoCustomerOrderWithStoreCreditTransform = (daffOrder, magentoOrder, email) => ({
|
|
19
|
-
...daffOrder,
|
|
20
|
-
totals: [
|
|
21
|
-
...daffOrder.totals,
|
|
22
|
-
{
|
|
23
|
-
type: DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE,
|
|
24
|
-
label: 'Store Credit',
|
|
25
|
-
value: magentoOrder.total?.total_store_credit.value,
|
|
26
|
-
// before grand total and after tax
|
|
27
|
-
sort_order: 35,
|
|
28
|
-
},
|
|
29
|
-
].sort((a, b) => a.sort_order - b.sort_order),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const magentoCustomerStoreCreditFragment = gql `
|
|
33
|
-
fragment magentoCustomerStoreCredit on CustomerStoreCredit {
|
|
34
|
-
current_balance {
|
|
35
|
-
...moneyFragment
|
|
36
|
-
}
|
|
37
|
-
enabled
|
|
38
|
-
}
|
|
39
|
-
${magentoMoneyFragment}
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
const magentoCustomerOrderStoreCreditTotalFragment = gql `
|
|
43
|
-
fragment magentoCustomerOrderStoreCreditTotal on CustomerOrder {
|
|
44
|
-
total {
|
|
45
|
-
total_store_credit {
|
|
46
|
-
...moneyFragment
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
${magentoMoneyFragment}
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
const MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME = 'MagentoGetCustomerStoreCredit';
|
|
54
|
-
const getCustomerStoreCredit = gql `
|
|
55
|
-
query ${MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME} {
|
|
56
|
-
customer {
|
|
57
|
-
store_credit {
|
|
58
|
-
...magentoCustomerStoreCredit
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
${magentoCustomerStoreCreditFragment}
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
const DaffCustomerStoreCreditMagentoErrorMessageRegexMap = {};
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Transforms a single GraphQL error.
|
|
69
|
-
* Optionally accepts a request payload which can be used in certain cases
|
|
70
|
-
* to add supplemental info to the error.
|
|
71
|
-
*/
|
|
72
|
-
function transformMagentoCartGraphQlError(error, requestPayload) {
|
|
73
|
-
// eslint-disable-next-line
|
|
74
|
-
for (const code in DaffCustomerStoreCreditMagentoErrorMessageRegexMap) {
|
|
75
|
-
const matchIndex = error.message.search(DaffCustomerStoreCreditMagentoErrorMessageRegexMap[code]);
|
|
76
|
-
if (matchIndex > -1 && DaffCustomerStoreCreditDriverErrorMap[code]) {
|
|
77
|
-
const errObj = new DaffCustomerStoreCreditDriverErrorMap[code](error.message);
|
|
78
|
-
return errObj;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return daffTransformMagentoError(error, {});
|
|
82
|
-
}
|
|
83
|
-
function transformMagentoReviewsError(error, requestPayload) {
|
|
84
|
-
if (CombinedGraphQLErrors.is(error)) {
|
|
85
|
-
return transformMagentoCartGraphQlError(error.errors[0], requestPayload);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
return daffTransformMagentoError(error, {}) || new DaffCustomerStoreCreditInvalidAPIResponseError(error.message);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const validateGetCustomerStoreCreditResponse = (response) => {
|
|
93
|
-
if (response.data.customer?.store_credit?.enabled) {
|
|
94
|
-
return response;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
throw new DaffCustomerStoreCreditInvalidAPIResponseError('The store credit feature is not enabled on this platform.');
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* A service for making Magento GraphQL queries for customers.
|
|
103
|
-
*
|
|
104
|
-
* @inheritdoc
|
|
105
|
-
*/
|
|
106
|
-
class DaffCustomerStoreCreditMagentoService {
|
|
107
|
-
constructor(apollo) {
|
|
108
|
-
this.apollo = apollo;
|
|
109
|
-
}
|
|
110
|
-
get() {
|
|
111
|
-
return this.apollo.query({
|
|
112
|
-
query: getCustomerStoreCredit,
|
|
113
|
-
}).pipe(map(validateGetCustomerStoreCreditResponse), map((response) => magentoCustomerStoreCreditTransform(response.data.customer.store_credit)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
114
|
-
}
|
|
115
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditMagentoService, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
116
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditMagentoService, providedIn: 'root' }); }
|
|
117
|
-
}
|
|
118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditMagentoService, decorators: [{
|
|
119
|
-
type: Injectable,
|
|
120
|
-
args: [{
|
|
121
|
-
providedIn: 'root',
|
|
122
|
-
}]
|
|
123
|
-
}], ctorParameters: () => [{ type: i1.Apollo }] });
|
|
124
|
-
|
|
125
|
-
class DaffCustomerStoreCreditMagentoDriverModule {
|
|
126
|
-
static forRoot() {
|
|
127
|
-
return {
|
|
128
|
-
ngModule: DaffCustomerStoreCreditMagentoDriverModule,
|
|
129
|
-
providers: [
|
|
130
|
-
provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditMagentoService),
|
|
131
|
-
provideDaffCustomerOrderMagentoExtraOrderFragments(magentoCustomerOrderStoreCreditTotalFragment),
|
|
132
|
-
provideDaffCustomerOrderMagentoExtraOrderTransforms(magentoCustomerOrderWithStoreCreditTransform),
|
|
133
|
-
],
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
137
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditMagentoDriverModule, imports: [CommonModule] }); }
|
|
138
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditMagentoDriverModule, imports: [CommonModule] }); }
|
|
139
|
-
}
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerStoreCreditMagentoDriverModule, decorators: [{
|
|
141
|
-
type: NgModule,
|
|
142
|
-
args: [{
|
|
143
|
-
imports: [
|
|
144
|
-
CommonModule,
|
|
145
|
-
],
|
|
146
|
-
}]
|
|
147
|
-
}] });
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Generated bundle index. Do not edit.
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
export { DaffCustomerStoreCreditMagentoDriverModule, DaffCustomerStoreCreditMagentoService, MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME, getCustomerStoreCredit, magentoCustomerOrderStoreCreditTotalFragment, magentoCustomerOrderWithStoreCreditTransform, magentoCustomerStoreCreditFragment, magentoCustomerStoreCreditTransform, transformMagentoReviewsError, validateGetCustomerStoreCreditResponse };
|
|
154
|
-
//# sourceMappingURL=daffodil-customer-store-credit-driver-magento.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-customer-store-credit-driver-magento.mjs","sources":["../../../libs/customer-store-credit/driver/magento/src/transforms/responses/customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/transforms/responses/customer-order.ts","../../../libs/customer-store-credit/driver/magento/src/queries/fragments/store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/queries/fragments/customer-order.ts","../../../libs/customer-store-credit/driver/magento/src/queries/get-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/errors/map.ts","../../../libs/customer-store-credit/driver/magento/src/errors/transform.ts","../../../libs/customer-store-credit/driver/magento/src/validators/get-customer-store-credit.ts","../../../libs/customer-store-credit/driver/magento/src/customer-store-credit.service.ts","../../../libs/customer-store-credit/driver/magento/src/driver.module.ts","../../../libs/customer-store-credit/driver/magento/src/daffodil-customer-store-credit-driver-magento.ts"],"sourcesContent":["import { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\n\nimport { MagentoCustomerStoreCredit } from '../../models/public_api';\n\nexport const magentoCustomerStoreCreditTransform = (storeCredit: MagentoCustomerStoreCredit): DaffCustomerStoreCredit => ({\n balance: storeCredit.current_balance.value,\n});\n","import { DaffMagentoCustomerOrderExtraTransform } from '@daffodil/customer-order/driver/magento/2.4.6';\nimport { DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE } from '@daffodil/customer-store-credit';\nimport { DaffOrder } from '@daffodil/order';\n\nimport { MagentoCustomerOrderWithStoreCredit } from '../../models/public_api';\n\nexport const magentoCustomerOrderWithStoreCreditTransform: DaffMagentoCustomerOrderExtraTransform<MagentoCustomerOrderWithStoreCredit> = (daffOrder: DaffOrder, magentoOrder: MagentoCustomerOrderWithStoreCredit, email: string): DaffOrder => ({\n ...daffOrder,\n totals: [\n ...daffOrder.totals,\n {\n type: DAFF_CUSTOMER_STORE_CREDIT_ORDER_TOTAL_TYPE,\n label: 'Store Credit',\n value: magentoOrder.total?.total_store_credit.value,\n // before grand total and after tax\n sort_order: 35,\n },\n ].sort((a, b) => a.sort_order - b.sort_order),\n});\n","import { gql } from 'apollo-angular';\n\nimport { magentoMoneyFragment } from '@daffodil/driver/magento';\n\nexport const magentoCustomerStoreCreditFragment = gql`\n fragment magentoCustomerStoreCredit on CustomerStoreCredit {\n current_balance {\n ...moneyFragment\n }\n enabled\n }\n ${magentoMoneyFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoMoneyFragment } from '@daffodil/driver/magento';\n\nexport const magentoCustomerOrderStoreCreditTotalFragment = gql`\n fragment magentoCustomerOrderStoreCreditTotal on CustomerOrder {\n total {\n total_store_credit {\n ...moneyFragment\n }\n }\n }\n ${magentoMoneyFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerStoreCreditFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME = 'MagentoGetCustomerStoreCredit';\n\nexport const getCustomerStoreCredit = gql`\n query ${MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME} {\n customer {\n store_credit {\n ...magentoCustomerStoreCredit\n }\n }\n }\n ${magentoCustomerStoreCreditFragment}\n`;\n","export const DaffCustomerStoreCreditMagentoErrorMessageRegexMap = {\n};\n","import { CombinedGraphQLErrors } from '@apollo/client';\nimport { GraphQLFormattedError } from 'graphql';\n\nimport { DaffError } from '@daffodil/core';\nimport {\n DaffCustomerStoreCreditDriverErrorMap,\n DaffCustomerStoreCreditInvalidAPIResponseError,\n} from '@daffodil/customer-store-credit/driver';\nimport { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffCustomerStoreCreditMagentoErrorMessageRegexMap } from './map';\n\n/**\n * Transforms a single GraphQL error.\n * Optionally accepts a request payload which can be used in certain cases\n * to add supplemental info to the error.\n */\nexport function transformMagentoCartGraphQlError(error: GraphQLFormattedError, requestPayload?: unknown): DaffError {\n // eslint-disable-next-line\n for (const code in DaffCustomerStoreCreditMagentoErrorMessageRegexMap) {\n const matchIndex = error.message.search(DaffCustomerStoreCreditMagentoErrorMessageRegexMap[code]);\n\n if (matchIndex > -1 && DaffCustomerStoreCreditDriverErrorMap[code]) {\n const errObj = new DaffCustomerStoreCreditDriverErrorMap[code](error.message);\n\n return errObj;\n }\n }\n\n return daffTransformMagentoError(error, {});\n}\n\nexport function transformMagentoReviewsError(error: any, requestPayload?: unknown) {\n if (CombinedGraphQLErrors.is(error)) {\n return transformMagentoCartGraphQlError(error.errors[0], requestPayload);\n } else {\n return daffTransformMagentoError(error, {}) || new DaffCustomerStoreCreditInvalidAPIResponseError(error.message);\n }\n}\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerStoreCreditInvalidAPIResponseError } from '@daffodil/customer-store-credit/driver';\n\nimport { MagentoGetCustomerStoreCreditResponse } from '../models/public_api';\n\nexport const validateGetCustomerStoreCreditResponse = (response: Apollo.QueryResult<MagentoGetCustomerStoreCreditResponse>) => {\n if (response.data.customer?.store_credit?.enabled) {\n return response;\n } else {\n throw new DaffCustomerStoreCreditInvalidAPIResponseError('The store credit feature is not enabled on this platform.');\n }\n};\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';\nimport { DaffCustomerStoreCreditDriverInterface } from '@daffodil/customer-store-credit/driver';\n\nimport { transformMagentoReviewsError } from './errors/transform';\nimport { MagentoGetCustomerStoreCreditResponse } from './models/public_api';\nimport { getCustomerStoreCredit } from './queries/public_api';\nimport { magentoCustomerStoreCreditTransform } from './transforms/public_api';\nimport { validateGetCustomerStoreCreditResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for customers.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerStoreCreditMagentoService implements DaffCustomerStoreCreditDriverInterface {\n constructor(\n private apollo: Apollo,\n ) {}\n\n get(): Observable<DaffCustomerStoreCredit> {\n return this.apollo.query<MagentoGetCustomerStoreCreditResponse>({\n query: getCustomerStoreCredit,\n }).pipe(\n map(validateGetCustomerStoreCreditResponse),\n map((response) => magentoCustomerStoreCreditTransform(response.data.customer.store_credit)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n provideDaffCustomerOrderMagentoExtraOrderFragments,\n provideDaffCustomerOrderMagentoExtraOrderTransforms,\n} from '@daffodil/customer-order/driver/magento/2.4.6';\nimport { provideDaffCustomerStoreCreditDriver } from '@daffodil/customer-store-credit/driver';\n\nimport { DaffCustomerStoreCreditMagentoService } from './customer-store-credit.service';\nimport { magentoCustomerOrderStoreCreditTotalFragment } from './queries/public_api';\nimport { magentoCustomerOrderWithStoreCreditTransform } from './transforms/public_api';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerStoreCreditMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerStoreCreditMagentoDriverModule> {\n return {\n ngModule: DaffCustomerStoreCreditMagentoDriverModule,\n providers: [\n provideDaffCustomerStoreCreditDriver(DaffCustomerStoreCreditMagentoService),\n provideDaffCustomerOrderMagentoExtraOrderFragments(\n magentoCustomerOrderStoreCreditTotalFragment,\n ),\n provideDaffCustomerOrderMagentoExtraOrderTransforms(\n magentoCustomerOrderWithStoreCreditTransform,\n ),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as _daffodil_driver_types_daffodil_driver_magento from '@daffodil/driver/types/daffodil-driver-magento';
|
|
2
|
-
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
3
|
-
import { MagentoCustomerStoreCredit } from '@daffodil/customer-store-credit/driver/magento';
|
|
4
|
-
import { MagentoMoneyFactory } from '@daffodil/driver/magento/testing';
|
|
5
|
-
import * as i0 from '@angular/core';
|
|
6
|
-
|
|
7
|
-
declare class MockMagentoCustomerStoreCredit implements MagentoCustomerStoreCredit {
|
|
8
|
-
protected moneyFactory: MagentoMoneyFactory;
|
|
9
|
-
__typename: "CustomerStoreCredit";
|
|
10
|
-
current_balance: _daffodil_driver_types_daffodil_driver_magento.MagentoMoney;
|
|
11
|
-
enabled: boolean;
|
|
12
|
-
constructor(moneyFactory: MagentoMoneyFactory);
|
|
13
|
-
}
|
|
14
|
-
declare class MagentoCustomerStoreCreditFactory extends DaffModelFactory<MagentoCustomerStoreCredit> {
|
|
15
|
-
constructor(moneyFactory: MagentoMoneyFactory);
|
|
16
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MagentoCustomerStoreCreditFactory, never>;
|
|
17
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MagentoCustomerStoreCreditFactory>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { MagentoCustomerStoreCreditFactory, MockMagentoCustomerStoreCredit };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';
|
|
2
|
-
import { MagentoMoney } from '@daffodil/driver/magento';
|
|
3
|
-
import { MagentoCustomerOrder, DaffMagentoCustomerOrderExtraTransform } from '@daffodil/customer-order/driver/magento/2.4.6';
|
|
4
|
-
import * as apollo_angular from 'apollo-angular';
|
|
5
|
-
import { Apollo } from 'apollo-angular';
|
|
6
|
-
import { DaffError } from '@daffodil/core';
|
|
7
|
-
import { DaffCustomerStoreCreditInvalidAPIResponseError, DaffCustomerStoreCreditDriverInterface } from '@daffodil/customer-store-credit/driver';
|
|
8
|
-
import { Observable } from 'rxjs';
|
|
9
|
-
import * as i0 from '@angular/core';
|
|
10
|
-
import { ModuleWithProviders } from '@angular/core';
|
|
11
|
-
import * as i1 from '@angular/common';
|
|
12
|
-
|
|
13
|
-
interface MagentoCustomerStoreCredit {
|
|
14
|
-
__typename?: 'CustomerStoreCredit';
|
|
15
|
-
current_balance?: MagentoMoney;
|
|
16
|
-
enabled?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface MagentoGetCustomerStoreCreditResponse {
|
|
20
|
-
customer: {
|
|
21
|
-
store_credit: MagentoCustomerStoreCredit;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface MagentoCustomerOrderWithStoreCredit extends MagentoCustomerOrder {
|
|
26
|
-
total: MagentoCustomerOrder['total'] & {
|
|
27
|
-
total_store_credit: MagentoMoney;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare const magentoCustomerStoreCreditTransform: (storeCredit: MagentoCustomerStoreCredit) => DaffCustomerStoreCredit;
|
|
32
|
-
|
|
33
|
-
declare const magentoCustomerOrderWithStoreCreditTransform: DaffMagentoCustomerOrderExtraTransform<MagentoCustomerOrderWithStoreCredit>;
|
|
34
|
-
|
|
35
|
-
declare const magentoCustomerStoreCreditFragment: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
36
|
-
|
|
37
|
-
declare const magentoCustomerOrderStoreCreditTotalFragment: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
38
|
-
|
|
39
|
-
declare const MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME = "MagentoGetCustomerStoreCredit";
|
|
40
|
-
declare const getCustomerStoreCredit: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
41
|
-
|
|
42
|
-
declare function transformMagentoReviewsError(error: any, requestPayload?: unknown): DaffError | DaffCustomerStoreCreditInvalidAPIResponseError;
|
|
43
|
-
|
|
44
|
-
declare const validateGetCustomerStoreCreditResponse: (response: Apollo.QueryResult<MagentoGetCustomerStoreCreditResponse>) => Apollo.QueryResult<MagentoGetCustomerStoreCreditResponse>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* A service for making Magento GraphQL queries for customers.
|
|
48
|
-
*
|
|
49
|
-
* @inheritdoc
|
|
50
|
-
*/
|
|
51
|
-
declare class DaffCustomerStoreCreditMagentoService implements DaffCustomerStoreCreditDriverInterface {
|
|
52
|
-
private apollo;
|
|
53
|
-
constructor(apollo: Apollo);
|
|
54
|
-
get(): Observable<DaffCustomerStoreCredit>;
|
|
55
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCustomerStoreCreditMagentoService, never>;
|
|
56
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCustomerStoreCreditMagentoService>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
declare class DaffCustomerStoreCreditMagentoDriverModule {
|
|
60
|
-
static forRoot(): ModuleWithProviders<DaffCustomerStoreCreditMagentoDriverModule>;
|
|
61
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCustomerStoreCreditMagentoDriverModule, never>;
|
|
62
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCustomerStoreCreditMagentoDriverModule, never, [typeof i1.CommonModule], never>;
|
|
63
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<DaffCustomerStoreCreditMagentoDriverModule>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { DaffCustomerStoreCreditMagentoDriverModule, DaffCustomerStoreCreditMagentoService, MAGENTO_GET_CUSTOMER_STORE_CREDIT_QUERY_NAME, getCustomerStoreCredit, magentoCustomerOrderStoreCreditTotalFragment, magentoCustomerOrderWithStoreCreditTransform, magentoCustomerStoreCreditFragment, magentoCustomerStoreCreditTransform, transformMagentoReviewsError, validateGetCustomerStoreCreditResponse };
|
|
67
|
-
export type { MagentoCustomerOrderWithStoreCredit, MagentoCustomerStoreCredit, MagentoGetCustomerStoreCreditResponse };
|