@daffodil/customer 0.66.0 → 0.67.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/{esm2020 → esm2022}/driver/in-memory/backend/address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/backend/customer.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/driver/address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/driver/customer-driver.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/driver/customer.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/customer-driver.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/customer.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/address.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/customer.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/customer-driver.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/customer.service.mjs +5 -5
- package/esm2022/routing/guards/clear-errors.guard.mjs +24 -0
- package/esm2022/routing/resolvers/customer.resolver.mjs +26 -0
- package/esm2022/state/customer.module.mjs +35 -0
- package/{esm2020 → esm2022}/state/effects/address.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/customer.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/facades/address/facade.mjs +5 -5
- package/{esm2020 → esm2022}/state/facades/customer/facade.mjs +5 -5
- package/{esm2020 → esm2022}/state/testing/customer-testing.module.mjs +8 -8
- package/{esm2020 → esm2022}/state/testing/factories/customer-address.factory.mjs +5 -5
- package/{esm2020 → esm2022}/state/testing/mock-address-facade.mjs +4 -4
- package/{esm2020 → esm2022}/state/testing/mock-customer-facade.mjs +4 -4
- package/{esm2020 → esm2022}/testing/factories/customer-address.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/customer.factory.mjs +5 -5
- package/{fesm2020 → fesm2022}/daffodil-customer-driver-in-memory.mjs +20 -20
- package/{fesm2020 → fesm2022}/daffodil-customer-driver-in-memory.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-customer-driver-magento-testing.mjs +8 -8
- package/fesm2022/daffodil-customer-driver-magento-testing.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/daffodil-customer-driver-magento.mjs +12 -12
- package/{fesm2015 → fesm2022}/daffodil-customer-driver-magento.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/daffodil-customer-driver-testing.mjs +12 -12
- package/{fesm2020 → fesm2022}/daffodil-customer-driver-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-customer-routing.mjs +8 -8
- package/fesm2022/daffodil-customer-routing.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/daffodil-customer-state-testing.mjs +17 -17
- package/{fesm2020 → fesm2022}/daffodil-customer-state-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-customer-state.mjs +27 -27
- package/{fesm2020 → fesm2022}/daffodil-customer-state.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/daffodil-customer-testing.mjs +8 -8
- package/{fesm2020 → fesm2022}/daffodil-customer-testing.mjs.map +1 -1
- package/package.json +1 -1
- package/routing/guards/clear-errors.guard.d.ts +2 -2
- package/routing/resolvers/customer.resolver.d.ts +1 -2
- package/state/actions/address.actions.d.ts +1 -1
- package/state/actions/customer.actions.d.ts +1 -1
- package/state/models/address.type.d.ts +1 -1
- package/state/reducers/address/type.d.ts +1 -1
- package/state/reducers/customer/reducer.d.ts +1 -1
- package/esm2020/routing/guards/clear-errors.guard.mjs +0 -24
- package/esm2020/routing/resolvers/customer.resolver.mjs +0 -26
- package/esm2020/state/customer.module.mjs +0 -35
- package/fesm2015/daffodil-customer-driver-in-memory.mjs +0 -321
- package/fesm2015/daffodil-customer-driver-in-memory.mjs.map +0 -1
- package/fesm2015/daffodil-customer-driver-magento-testing.mjs +0 -75
- package/fesm2015/daffodil-customer-driver-magento-testing.mjs.map +0 -1
- package/fesm2015/daffodil-customer-driver-magento.mjs +0 -462
- package/fesm2015/daffodil-customer-driver-testing.mjs.map +0 -1
- package/fesm2015/daffodil-customer-driver.mjs.map +0 -1
- package/fesm2015/daffodil-customer-routing.mjs +0 -53
- package/fesm2015/daffodil-customer-routing.mjs.map +0 -1
- package/fesm2015/daffodil-customer-state-testing.mjs +0 -109
- package/fesm2015/daffodil-customer-state-testing.mjs.map +0 -1
- package/fesm2015/daffodil-customer-state.mjs +0 -732
- package/fesm2015/daffodil-customer-state.mjs.map +0 -1
- package/fesm2015/daffodil-customer-testing.mjs.map +0 -1
- package/fesm2020/daffodil-customer-driver-magento-testing.mjs.map +0 -1
- package/fesm2020/daffodil-customer-driver-magento.mjs.map +0 -1
- package/fesm2020/daffodil-customer-driver-testing.mjs +0 -112
- package/fesm2020/daffodil-customer-driver.mjs +0 -84
- package/fesm2020/daffodil-customer-routing.mjs.map +0 -1
- package/fesm2020/daffodil-customer-testing.mjs +0 -76
- package/fesm2020/daffodil-customer.mjs +0 -4
- package/fesm2020/daffodil-customer.mjs.map +0 -1
- /package/{esm2020 → esm2022}/daffodil-customer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/daffodil-customer-driver.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/address-not-found.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/codes.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/default-billing-address-deletion.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/default-shipping-address-deletion.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/invalid-api-response.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/map.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/daffodil-customer-driver-in-memory.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/address-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/customer-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/daffodil-customer-driver-magento.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/errors/map.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/errors/transform.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/gender.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/address-attribute-input.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/address-input.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/address-region-input.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/customer-input.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/change-email.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/change-password.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/create-customer-address.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/customer-address.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/customer.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/delete-customer-address.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/get-customer-addresses.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/get-customer.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/update-customer-address.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/update-customer.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/change-password.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/create-customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/delete-customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/customer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-customer-addresses.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-customer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-customer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-email.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/daffodil-customer-driver-magento-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/factories/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/requests/address-input.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/requests/customer-input.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/requests/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/responses/customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/responses/customer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/responses/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/change-email.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/change-password.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/create-customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/delete-customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/get-customer-addresses.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/get-customer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/update-customer-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/validators/update-customer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/daffodil-customer-driver-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/drivers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/models/address.type.mjs +0 -0
- /package/{esm2020 → esm2022}/models/customer.type.mjs +0 -0
- /package/{esm2020 → esm2022}/models/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/daffodil-customer-routing.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/resolvers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/address.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/customer.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/daffodil-customer-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/facades/address/interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/facades/customer/interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/facades/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/index.mjs +0 -0
- /package/{esm2020 → esm2022}/state/injection-tokens/error-matcher.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/injection-tokens/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/models/address.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/models/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/address/initial-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/address/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/address/reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/address/type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/address-entities/adapter.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/address-entities/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/address-entities/reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/customer/adapter.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/customer/initial-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/customer/interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/customer/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/customer/reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/reducers.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/store-feature-key.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/extra.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/reducers.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/address/selector.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/customer/selector.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/feature.selector.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/daffodil-customer-state-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/factories/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/daffodil-customer-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/public_api.mjs +0 -0
- /package/{fesm2015 → fesm2022}/daffodil-customer-driver.mjs +0 -0
- /package/{fesm2020 → fesm2022}/daffodil-customer-driver.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/daffodil-customer.mjs +0 -0
- /package/{fesm2015 → fesm2022}/daffodil-customer.mjs.map +0 -0
|
@@ -1,732 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, Inject, inject, NgModule } from '@angular/core';
|
|
3
|
-
import { daffCompleteOperation, daffOperationInitialState, daffClearErrors, daffOperationFailed, daffStartMutation, daffStartResolution, daffCreateOperationEntityStateAdapter, daffOperationStateSelectorFactory, daffTransformErrorToStateError, daffComposeReducers } from '@daffodil/core/state';
|
|
4
|
-
import { createEntityAdapter } from '@ngrx/entity';
|
|
5
|
-
import * as i1 from '@ngrx/store';
|
|
6
|
-
import { createFeatureSelector, createSelector, select, combineReducers, StoreModule } from '@ngrx/store';
|
|
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 { DaffCustomerAddressDriver, DaffCustomerDriver } from '@daffodil/customer/driver';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The customer address action types enum.
|
|
15
|
-
*/
|
|
16
|
-
var DaffCustomerAddressActionTypes;
|
|
17
|
-
(function (DaffCustomerAddressActionTypes) {
|
|
18
|
-
DaffCustomerAddressActionTypes["AddressListAction"] = "[@daffodil/customer] Address List Action";
|
|
19
|
-
DaffCustomerAddressActionTypes["AddressListSuccessAction"] = "[@daffodil/customer] Address List Success Action";
|
|
20
|
-
DaffCustomerAddressActionTypes["AddressListFailureAction"] = "[@daffodil/customer] Address List Failure Action";
|
|
21
|
-
DaffCustomerAddressActionTypes["AddressLoadAction"] = "[@daffodil/customer] Address Load Action";
|
|
22
|
-
DaffCustomerAddressActionTypes["AddressLoadSuccessAction"] = "[@daffodil/customer] Address Load Success Action";
|
|
23
|
-
DaffCustomerAddressActionTypes["AddressLoadFailureAction"] = "[@daffodil/customer] Address Load Failure Action";
|
|
24
|
-
DaffCustomerAddressActionTypes["AddressAddAction"] = "[@daffodil/customer] Address Add Action";
|
|
25
|
-
DaffCustomerAddressActionTypes["AddressAddSuccessAction"] = "[@daffodil/customer] Address Add Success Action";
|
|
26
|
-
DaffCustomerAddressActionTypes["AddressAddFailureAction"] = "[@daffodil/customer] Address Add Failure Action";
|
|
27
|
-
DaffCustomerAddressActionTypes["AddressUpdateAction"] = "[@daffodil/customer] Address Update Action";
|
|
28
|
-
DaffCustomerAddressActionTypes["AddressUpdateSuccessAction"] = "[@daffodil/customer] Address Update Success Action";
|
|
29
|
-
DaffCustomerAddressActionTypes["AddressUpdateFailureAction"] = "[@daffodil/customer] Address Update Failure Action";
|
|
30
|
-
DaffCustomerAddressActionTypes["AddressDeleteAction"] = "[@daffodil/customer] Address Delete Action";
|
|
31
|
-
DaffCustomerAddressActionTypes["AddressDeleteSuccessAction"] = "[@daffodil/customer] Address Delete Success Action";
|
|
32
|
-
DaffCustomerAddressActionTypes["AddressDeleteFailureAction"] = "[@daffodil/customer] Address Delete Failure Action";
|
|
33
|
-
})(DaffCustomerAddressActionTypes || (DaffCustomerAddressActionTypes = {}));
|
|
34
|
-
/**
|
|
35
|
-
* Lists the addresses of the current customer.
|
|
36
|
-
*
|
|
37
|
-
* @param addressId The ID of the address.
|
|
38
|
-
*/
|
|
39
|
-
class DaffCustomerAddressList {
|
|
40
|
-
constructor() {
|
|
41
|
-
this.type = DaffCustomerAddressActionTypes.AddressListAction;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Indicates a successful listing of customer addresses.
|
|
46
|
-
*/
|
|
47
|
-
class DaffCustomerAddressListSuccess {
|
|
48
|
-
constructor(payload) {
|
|
49
|
-
this.payload = payload;
|
|
50
|
-
this.type = DaffCustomerAddressActionTypes.AddressListSuccessAction;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* A failed customer address list with the error message.
|
|
55
|
-
*/
|
|
56
|
-
class DaffCustomerAddressListFailure {
|
|
57
|
-
constructor(payload) {
|
|
58
|
-
this.payload = payload;
|
|
59
|
-
this.type = DaffCustomerAddressActionTypes.AddressListFailureAction;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Loads an address of the current customer.
|
|
64
|
-
*
|
|
65
|
-
* @param addressId The ID of the address.
|
|
66
|
-
*/
|
|
67
|
-
class DaffCustomerAddressLoad {
|
|
68
|
-
constructor(addressId) {
|
|
69
|
-
this.addressId = addressId;
|
|
70
|
-
this.type = DaffCustomerAddressActionTypes.AddressLoadAction;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Indicates a successful load of a customer address.
|
|
75
|
-
*/
|
|
76
|
-
class DaffCustomerAddressLoadSuccess {
|
|
77
|
-
constructor(payload) {
|
|
78
|
-
this.payload = payload;
|
|
79
|
-
this.type = DaffCustomerAddressActionTypes.AddressLoadSuccessAction;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* A failed customer address load with the error message.
|
|
84
|
-
*/
|
|
85
|
-
class DaffCustomerAddressLoadFailure {
|
|
86
|
-
constructor(payload, id) {
|
|
87
|
-
this.payload = payload;
|
|
88
|
-
this.id = id;
|
|
89
|
-
this.type = DaffCustomerAddressActionTypes.AddressLoadFailureAction;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Updates one of the currently logged-in customer's addresses.
|
|
94
|
-
*
|
|
95
|
-
* @param query The customer query.
|
|
96
|
-
*/
|
|
97
|
-
class DaffCustomerAddressUpdate {
|
|
98
|
-
constructor(address) {
|
|
99
|
-
this.address = address;
|
|
100
|
-
this.type = DaffCustomerAddressActionTypes.AddressUpdateAction;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Indicates a successful update of one of the currently logged-in customer's addresses.
|
|
105
|
-
*/
|
|
106
|
-
class DaffCustomerAddressUpdateSuccess {
|
|
107
|
-
constructor(payload) {
|
|
108
|
-
this.payload = payload;
|
|
109
|
-
this.type = DaffCustomerAddressActionTypes.AddressUpdateSuccessAction;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* A failed address update with the error message.
|
|
114
|
-
*/
|
|
115
|
-
class DaffCustomerAddressUpdateFailure {
|
|
116
|
-
constructor(payload, id) {
|
|
117
|
-
this.payload = payload;
|
|
118
|
-
this.id = id;
|
|
119
|
-
this.type = DaffCustomerAddressActionTypes.AddressUpdateFailureAction;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Adds one of the currently logged-in customer's addresses.
|
|
124
|
-
*
|
|
125
|
-
* @param query The customer query.
|
|
126
|
-
*/
|
|
127
|
-
class DaffCustomerAddressAdd {
|
|
128
|
-
constructor(address, placeholderId) {
|
|
129
|
-
this.address = address;
|
|
130
|
-
this.placeholderId = placeholderId;
|
|
131
|
-
this.type = DaffCustomerAddressActionTypes.AddressAddAction;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Indicates a successful addition of one of the currently logged-in customer's addresses.
|
|
136
|
-
*
|
|
137
|
-
* @param payload The updated list of customer addresses.
|
|
138
|
-
*/
|
|
139
|
-
class DaffCustomerAddressAddSuccess {
|
|
140
|
-
constructor(payload) {
|
|
141
|
-
this.payload = payload;
|
|
142
|
-
this.type = DaffCustomerAddressActionTypes.AddressAddSuccessAction;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* A failed address addition with the error message.
|
|
147
|
-
*/
|
|
148
|
-
class DaffCustomerAddressAddFailure {
|
|
149
|
-
constructor(payload, id) {
|
|
150
|
-
this.payload = payload;
|
|
151
|
-
this.id = id;
|
|
152
|
-
this.type = DaffCustomerAddressActionTypes.AddressAddFailureAction;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Deletes one of the currently logged-in customer's addresses.
|
|
157
|
-
*
|
|
158
|
-
* @param addressId The ID of the address.
|
|
159
|
-
*/
|
|
160
|
-
class DaffCustomerAddressDelete {
|
|
161
|
-
constructor(addressId) {
|
|
162
|
-
this.addressId = addressId;
|
|
163
|
-
this.type = DaffCustomerAddressActionTypes.AddressDeleteAction;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Indicates a successful deletion of one of the currently logged-in customer's addresses.
|
|
168
|
-
*
|
|
169
|
-
* @param payload The updated list of customer addresses.
|
|
170
|
-
*/
|
|
171
|
-
class DaffCustomerAddressDeleteSuccess {
|
|
172
|
-
constructor(payload) {
|
|
173
|
-
this.payload = payload;
|
|
174
|
-
this.type = DaffCustomerAddressActionTypes.AddressDeleteSuccessAction;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* A failed address deletion with the error message.
|
|
179
|
-
*/
|
|
180
|
-
class DaffCustomerAddressDeleteFailure {
|
|
181
|
-
constructor(payload, id) {
|
|
182
|
-
this.payload = payload;
|
|
183
|
-
this.id = id;
|
|
184
|
-
this.type = DaffCustomerAddressActionTypes.AddressDeleteFailureAction;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* The customer action types enum.
|
|
190
|
-
*/
|
|
191
|
-
var DaffCustomerActionTypes;
|
|
192
|
-
(function (DaffCustomerActionTypes) {
|
|
193
|
-
DaffCustomerActionTypes["CustomerLoadAction"] = "[@daffodil/customer] Customer Load Action";
|
|
194
|
-
DaffCustomerActionTypes["CustomerLoadSuccessAction"] = "[@daffodil/customer] Customer Load Success Action";
|
|
195
|
-
DaffCustomerActionTypes["CustomerLoadFailureAction"] = "[@daffodil/customer] Customer Load Failure Action";
|
|
196
|
-
DaffCustomerActionTypes["CustomerUpdateAction"] = "[@daffodil/customer] Customer Update Action";
|
|
197
|
-
DaffCustomerActionTypes["CustomerUpdateSuccessAction"] = "[@daffodil/customer] Customer Update Success Action";
|
|
198
|
-
DaffCustomerActionTypes["CustomerUpdateFailureAction"] = "[@daffodil/customer] Customer Update Failure Action";
|
|
199
|
-
DaffCustomerActionTypes["CustomerChangeEmailAction"] = "[@daffodil/customer] Customer Change Email Action";
|
|
200
|
-
DaffCustomerActionTypes["CustomerChangeEmailSuccessAction"] = "[@daffodil/customer] Customer Change Email Success Action";
|
|
201
|
-
DaffCustomerActionTypes["CustomerChangeEmailFailureAction"] = "[@daffodil/customer] Customer Change Email Failure Action";
|
|
202
|
-
DaffCustomerActionTypes["CustomerChangePasswordAction"] = "[@daffodil/customer] Customer Change Password Action";
|
|
203
|
-
DaffCustomerActionTypes["CustomerChangePasswordSuccessAction"] = "[@daffodil/customer] Customer Change Password Success Action";
|
|
204
|
-
DaffCustomerActionTypes["CustomerChangePasswordFailureAction"] = "[@daffodil/customer] Customer Change Password Failure Action";
|
|
205
|
-
DaffCustomerActionTypes["CustomerClearErrorsAction"] = "[@daffodil/customer] Customer Clear Errors Action";
|
|
206
|
-
})(DaffCustomerActionTypes || (DaffCustomerActionTypes = {}));
|
|
207
|
-
/**
|
|
208
|
-
* Loads the currently logged-in customer.
|
|
209
|
-
*
|
|
210
|
-
* @param query The customer query.
|
|
211
|
-
*/
|
|
212
|
-
class DaffCustomerLoad {
|
|
213
|
-
constructor() {
|
|
214
|
-
this.type = DaffCustomerActionTypes.CustomerLoadAction;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Indicates a successful load of the currently logged-in customer.
|
|
219
|
-
*/
|
|
220
|
-
class DaffCustomerLoadSuccess {
|
|
221
|
-
constructor(payload) {
|
|
222
|
-
this.payload = payload;
|
|
223
|
-
this.type = DaffCustomerActionTypes.CustomerLoadSuccessAction;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* A failed customer load with the error message.
|
|
228
|
-
*/
|
|
229
|
-
class DaffCustomerLoadFailure {
|
|
230
|
-
constructor(payload) {
|
|
231
|
-
this.payload = payload;
|
|
232
|
-
this.type = DaffCustomerActionTypes.CustomerLoadFailureAction;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Updates the currently logged-in customer.
|
|
237
|
-
*
|
|
238
|
-
* @param query The customer query.
|
|
239
|
-
*/
|
|
240
|
-
class DaffCustomerUpdate {
|
|
241
|
-
constructor(customer) {
|
|
242
|
-
this.customer = customer;
|
|
243
|
-
this.type = DaffCustomerActionTypes.CustomerUpdateAction;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Indicates a successful update of the currently logged-in customer.
|
|
248
|
-
*/
|
|
249
|
-
class DaffCustomerUpdateSuccess {
|
|
250
|
-
constructor(payload) {
|
|
251
|
-
this.payload = payload;
|
|
252
|
-
this.type = DaffCustomerActionTypes.CustomerUpdateSuccessAction;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* A failed customer update with the error message.
|
|
257
|
-
*/
|
|
258
|
-
class DaffCustomerUpdateFailure {
|
|
259
|
-
constructor(payload) {
|
|
260
|
-
this.payload = payload;
|
|
261
|
-
this.type = DaffCustomerActionTypes.CustomerUpdateFailureAction;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Changes the email of the currently logged-in customer.
|
|
266
|
-
*
|
|
267
|
-
* @param query The customer query.
|
|
268
|
-
*/
|
|
269
|
-
class DaffCustomerChangeEmail {
|
|
270
|
-
constructor(email, password) {
|
|
271
|
-
this.email = email;
|
|
272
|
-
this.password = password;
|
|
273
|
-
this.type = DaffCustomerActionTypes.CustomerChangeEmailAction;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Indicates a successful email change of the currently logged-in customer.
|
|
278
|
-
*/
|
|
279
|
-
class DaffCustomerChangeEmailSuccess {
|
|
280
|
-
constructor(payload) {
|
|
281
|
-
this.payload = payload;
|
|
282
|
-
this.type = DaffCustomerActionTypes.CustomerChangeEmailSuccessAction;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* A failed customer email change with the error message.
|
|
287
|
-
*/
|
|
288
|
-
class DaffCustomerChangeEmailFailure {
|
|
289
|
-
constructor(payload) {
|
|
290
|
-
this.payload = payload;
|
|
291
|
-
this.type = DaffCustomerActionTypes.CustomerChangeEmailFailureAction;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Changes the password of the currently logged-in customer.
|
|
296
|
-
*
|
|
297
|
-
* @param query The customer query.
|
|
298
|
-
*/
|
|
299
|
-
class DaffCustomerChangePassword {
|
|
300
|
-
constructor(newPassword, oldPassword) {
|
|
301
|
-
this.newPassword = newPassword;
|
|
302
|
-
this.oldPassword = oldPassword;
|
|
303
|
-
this.type = DaffCustomerActionTypes.CustomerChangePasswordAction;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Indicates a successful password change of the currently logged-in customer.
|
|
308
|
-
*/
|
|
309
|
-
class DaffCustomerChangePasswordSuccess {
|
|
310
|
-
constructor() {
|
|
311
|
-
this.type = DaffCustomerActionTypes.CustomerChangePasswordSuccessAction;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* A failed customer password change with the error message.
|
|
316
|
-
*/
|
|
317
|
-
class DaffCustomerChangePasswordFailure {
|
|
318
|
-
constructor(payload) {
|
|
319
|
-
this.payload = payload;
|
|
320
|
-
this.type = DaffCustomerActionTypes.CustomerChangePasswordFailureAction;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* An action to clear all customer errors in state.
|
|
325
|
-
*/
|
|
326
|
-
class DaffCustomerClearErrors {
|
|
327
|
-
constructor() {
|
|
328
|
-
this.type = DaffCustomerActionTypes.CustomerClearErrorsAction;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* The key under which the customer feature state will be stored.
|
|
334
|
-
*/
|
|
335
|
-
const DAFF_CUSTOMER_STORE_FEATURE_KEY = 'daffCustomer';
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* A token to hold the injectable extra reducers.
|
|
339
|
-
*
|
|
340
|
-
* Prefer using {@link daffCustomerProvideExtraReducers}.
|
|
341
|
-
*/
|
|
342
|
-
const DAFF_CUSTOMER_EXTRA_REDUCERS = new InjectionToken('DAFF_CUSTOMER_EXTRA_REDUCERS', {
|
|
343
|
-
factory: () => [],
|
|
344
|
-
providedIn: 'any',
|
|
345
|
-
});
|
|
346
|
-
/**
|
|
347
|
-
* Provides additional reducers that run after the standard Daffodil customer reducers.
|
|
348
|
-
*
|
|
349
|
-
* ```ts
|
|
350
|
-
* providers: [
|
|
351
|
-
* ...daffCustomerProvideExtraReducers(
|
|
352
|
-
* myReducer1,
|
|
353
|
-
* myReducer2
|
|
354
|
-
* )
|
|
355
|
-
* ]
|
|
356
|
-
* ```
|
|
357
|
-
*/
|
|
358
|
-
function daffCustomerProvideExtraReducers(...reducers) {
|
|
359
|
-
return reducers.map(reducer => ({
|
|
360
|
-
provide: DAFF_CUSTOMER_EXTRA_REDUCERS,
|
|
361
|
-
useValue: reducer,
|
|
362
|
-
multi: true,
|
|
363
|
-
}));
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Stores the customer in state.
|
|
368
|
-
* Sets loading to false and resets errors.
|
|
369
|
-
*/
|
|
370
|
-
function daffCustomerStateStoreCustomer(customer, state) {
|
|
371
|
-
return Object.assign(Object.assign(Object.assign({}, state), daffCompleteOperation(state)), { customer });
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Stores customer addresses.
|
|
375
|
-
* Sets loading to false and resets errors.
|
|
376
|
-
*/
|
|
377
|
-
function daffCustomerStateStoreAddresses(addresses, state) {
|
|
378
|
-
return Object.assign(Object.assign(Object.assign({}, state), daffCompleteOperation(state)), { customer: Object.assign(Object.assign({}, state.customer), { addresses }) });
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* The initial state for the main customer state, see {@link DaffCustomerReducerState}.
|
|
383
|
-
*/
|
|
384
|
-
const daffCustomerInitialState = Object.assign(Object.assign({}, daffOperationInitialState), { customer: null });
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* The reducer for the customer page state, see {@link DaffCustomerReducerState}.
|
|
388
|
-
*/
|
|
389
|
-
const daffCustomerReducer = (state = daffCustomerInitialState, action) => {
|
|
390
|
-
switch (action.type) {
|
|
391
|
-
case DaffCustomerActionTypes.CustomerLoadAction:
|
|
392
|
-
return daffStartResolution(state);
|
|
393
|
-
case DaffCustomerActionTypes.CustomerUpdateAction:
|
|
394
|
-
case DaffCustomerActionTypes.CustomerChangeEmailAction:
|
|
395
|
-
case DaffCustomerActionTypes.CustomerChangePasswordAction:
|
|
396
|
-
return daffStartMutation(state);
|
|
397
|
-
case DaffCustomerActionTypes.CustomerLoadSuccessAction:
|
|
398
|
-
case DaffCustomerActionTypes.CustomerUpdateSuccessAction:
|
|
399
|
-
case DaffCustomerActionTypes.CustomerChangeEmailSuccessAction:
|
|
400
|
-
return daffCustomerStateStoreCustomer(action.payload, state);
|
|
401
|
-
case DaffCustomerActionTypes.CustomerChangePasswordSuccessAction:
|
|
402
|
-
return daffCompleteOperation(state);
|
|
403
|
-
case DaffCustomerActionTypes.CustomerLoadFailureAction:
|
|
404
|
-
case DaffCustomerActionTypes.CustomerUpdateFailureAction:
|
|
405
|
-
case DaffCustomerActionTypes.CustomerChangeEmailFailureAction:
|
|
406
|
-
case DaffCustomerActionTypes.CustomerChangePasswordFailureAction:
|
|
407
|
-
return daffOperationFailed([action.payload], state);
|
|
408
|
-
case DaffCustomerActionTypes.CustomerClearErrorsAction:
|
|
409
|
-
return daffClearErrors(state);
|
|
410
|
-
case DaffCustomerAddressActionTypes.AddressDeleteSuccessAction:
|
|
411
|
-
case DaffCustomerAddressActionTypes.AddressAddSuccessAction:
|
|
412
|
-
return daffCustomerStateStoreAddresses(action.payload, state);
|
|
413
|
-
default:
|
|
414
|
-
return state;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* The initial state for the main customer state, see {@link DaffCustomerAddressReducerState}.
|
|
420
|
-
*/
|
|
421
|
-
const daffCustomerAddressInitialState = daffOperationInitialState;
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* The reducer for the customer page state, see {@link DaffCustomerAddressReducerState}.
|
|
425
|
-
*/
|
|
426
|
-
const daffCustomerAddressReducer = (state = daffCustomerAddressInitialState, action) => {
|
|
427
|
-
switch (true) {
|
|
428
|
-
case action.type === DaffCustomerAddressActionTypes.AddressListAction:
|
|
429
|
-
case action.type === DaffCustomerAddressActionTypes.AddressLoadAction:
|
|
430
|
-
return daffStartResolution(state);
|
|
431
|
-
case action.type === DaffCustomerAddressActionTypes.AddressUpdateAction:
|
|
432
|
-
case action.type === DaffCustomerAddressActionTypes.AddressAddAction:
|
|
433
|
-
case action.type === DaffCustomerAddressActionTypes.AddressDeleteAction:
|
|
434
|
-
return daffStartMutation(state);
|
|
435
|
-
case action.type === DaffCustomerAddressActionTypes.AddressListSuccessAction:
|
|
436
|
-
case action.type === DaffCustomerAddressActionTypes.AddressLoadSuccessAction:
|
|
437
|
-
case action.type === DaffCustomerAddressActionTypes.AddressUpdateSuccessAction:
|
|
438
|
-
case action.type === DaffCustomerAddressActionTypes.AddressAddSuccessAction:
|
|
439
|
-
case action.type === DaffCustomerAddressActionTypes.AddressDeleteSuccessAction:
|
|
440
|
-
case action.type === DaffCustomerAddressActionTypes.AddressUpdateFailureAction:
|
|
441
|
-
case action.type === DaffCustomerAddressActionTypes.AddressAddFailureAction:
|
|
442
|
-
case action.type === DaffCustomerAddressActionTypes.AddressDeleteFailureAction:
|
|
443
|
-
return daffCompleteOperation(state);
|
|
444
|
-
case action.type === DaffCustomerAddressActionTypes.AddressListFailureAction:
|
|
445
|
-
case action.type === DaffCustomerAddressActionTypes.AddressLoadFailureAction:
|
|
446
|
-
return daffOperationFailed([action.payload], state);
|
|
447
|
-
default:
|
|
448
|
-
return state;
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Customer Address Entities Adapter for changing/overwriting entity state.
|
|
454
|
-
*/
|
|
455
|
-
const daffCustomerAddressEntitiesAdapter = (() => {
|
|
456
|
-
let cache;
|
|
457
|
-
return () => cache = cache || daffCreateOperationEntityStateAdapter(createEntityAdapter({ selectId: item => item.id }));
|
|
458
|
-
})();
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Reducer function that catches actions and changes/overwrites product entities state.
|
|
462
|
-
*
|
|
463
|
-
* @param state current State of the redux store
|
|
464
|
-
* @param action CartItemGrid, BestSellers, or CartItem actions
|
|
465
|
-
* @returns CartItem entities state
|
|
466
|
-
*/
|
|
467
|
-
function daffCustomerAddressEntitiesReducer(state = daffCustomerAddressEntitiesAdapter().getInitialState(), action) {
|
|
468
|
-
const adapter = daffCustomerAddressEntitiesAdapter();
|
|
469
|
-
switch (action.type) {
|
|
470
|
-
case DaffCustomerAddressActionTypes.AddressLoadAction:
|
|
471
|
-
return adapter.preload(action.addressId, state);
|
|
472
|
-
case DaffCustomerAddressActionTypes.AddressAddAction:
|
|
473
|
-
return adapter.preadd(action.address, state, action.placeholderId);
|
|
474
|
-
case DaffCustomerAddressActionTypes.AddressDeleteAction:
|
|
475
|
-
return adapter.preremove(action.addressId, state);
|
|
476
|
-
case DaffCustomerAddressActionTypes.AddressUpdateAction:
|
|
477
|
-
return adapter.preupdate(action.address, state);
|
|
478
|
-
case DaffCustomerAddressActionTypes.AddressLoadSuccessAction:
|
|
479
|
-
return adapter.load(action.payload, state);
|
|
480
|
-
case DaffCustomerAddressActionTypes.AddressListSuccessAction:
|
|
481
|
-
return adapter.list(action.payload, state);
|
|
482
|
-
case DaffCustomerActionTypes.CustomerChangeEmailSuccessAction:
|
|
483
|
-
case DaffCustomerActionTypes.CustomerUpdateSuccessAction:
|
|
484
|
-
case DaffCustomerActionTypes.CustomerLoadSuccessAction:
|
|
485
|
-
return adapter.list(action.payload.addresses, state);
|
|
486
|
-
case DaffCustomerAddressActionTypes.AddressUpdateSuccessAction:
|
|
487
|
-
case DaffCustomerAddressActionTypes.AddressDeleteSuccessAction:
|
|
488
|
-
case DaffCustomerAddressActionTypes.AddressAddSuccessAction:
|
|
489
|
-
return adapter.list(action.payload, state);
|
|
490
|
-
case DaffCustomerAddressActionTypes.AddressDeleteFailureAction:
|
|
491
|
-
case DaffCustomerAddressActionTypes.AddressAddFailureAction:
|
|
492
|
-
case DaffCustomerAddressActionTypes.AddressLoadFailureAction:
|
|
493
|
-
case DaffCustomerAddressActionTypes.AddressUpdateFailureAction:
|
|
494
|
-
return adapter.operationFailed(action.id, [action.payload], state);
|
|
495
|
-
default:
|
|
496
|
-
return state;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
const getDaffCustomerReducersStateSelector = (() => {
|
|
501
|
-
let cache;
|
|
502
|
-
return () => cache = cache || {
|
|
503
|
-
selectCustomerFeatureState: createFeatureSelector(DAFF_CUSTOMER_STORE_FEATURE_KEY),
|
|
504
|
-
};
|
|
505
|
-
})();
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Creates a group of selectors for {@link DaffCustomerReducerState} that use the passed state selector as the basis.
|
|
509
|
-
*/
|
|
510
|
-
const daffCustomerCreateSelectors = () => {
|
|
511
|
-
const { selectCustomerFeatureState } = getDaffCustomerReducersStateSelector();
|
|
512
|
-
const selectCustomerState = createSelector(selectCustomerFeatureState, state => state.customer);
|
|
513
|
-
const selectCustomer = createSelector(selectCustomerState, state => state.customer);
|
|
514
|
-
return Object.assign(Object.assign({}, daffOperationStateSelectorFactory(selectCustomerState)), { selectCustomer });
|
|
515
|
-
};
|
|
516
|
-
const daffCustomerGetSelectors = (() => {
|
|
517
|
-
let cache;
|
|
518
|
-
return () => cache = cache || daffCustomerCreateSelectors();
|
|
519
|
-
})();
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Creates a group of selectors for {@link DaffCustomerAddressReducerState} that use the passed state selector as the basis.
|
|
523
|
-
*/
|
|
524
|
-
const daffCustomerAddressCreateSelectors = () => {
|
|
525
|
-
const { selectCustomerFeatureState } = getDaffCustomerReducersStateSelector();
|
|
526
|
-
const selectCustomerAddressState = createSelector(selectCustomerFeatureState, state => state.address);
|
|
527
|
-
const selectCustomerAddressEntitiesState = createSelector(selectCustomerFeatureState, state => state.addressEntities);
|
|
528
|
-
const { selectEntity, selectOptimisticList, } = daffCustomerAddressEntitiesAdapter().getSelectors(selectCustomerAddressEntitiesState);
|
|
529
|
-
return Object.assign(Object.assign({}, daffOperationStateSelectorFactory(selectCustomerAddressState)), { selectAddress: selectEntity, selectAddresses: selectOptimisticList });
|
|
530
|
-
};
|
|
531
|
-
const daffCustomerAddressGetSelectors = (() => {
|
|
532
|
-
let cache;
|
|
533
|
-
return () => cache = cache || daffCustomerAddressCreateSelectors();
|
|
534
|
-
})();
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* @inheritdoc
|
|
538
|
-
*
|
|
539
|
-
* Serves as the base for a customer facade.
|
|
540
|
-
* Extend this class and pass in the selectors for the specific state you wish to target.
|
|
541
|
-
*/
|
|
542
|
-
class DaffCustomerPageFacade {
|
|
543
|
-
constructor(store) {
|
|
544
|
-
this.store = store;
|
|
545
|
-
const { selectCustomer, selectErrors, selectHasErrors, selectLoading, selectLoadingState, selectMutating, selectResolving, } = daffCustomerGetSelectors();
|
|
546
|
-
this.customer$ = this.store.pipe(select(selectCustomer));
|
|
547
|
-
this.loadingState$ = this.store.pipe(select(selectLoadingState));
|
|
548
|
-
this.loading$ = this.store.pipe(select(selectLoading));
|
|
549
|
-
this.resolving$ = this.store.pipe(select(selectResolving));
|
|
550
|
-
this.mutating$ = this.store.pipe(select(selectMutating));
|
|
551
|
-
this.errors$ = this.store.pipe(select(selectErrors));
|
|
552
|
-
this.hasErrors$ = this.store.pipe(select(selectHasErrors));
|
|
553
|
-
}
|
|
554
|
-
dispatch(action) {
|
|
555
|
-
this.store.dispatch(action);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
/** @nocollapse */ DaffCustomerPageFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerPageFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
559
|
-
/** @nocollapse */ DaffCustomerPageFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerPageFacade, providedIn: 'root' });
|
|
560
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerPageFacade, decorators: [{
|
|
561
|
-
type: Injectable,
|
|
562
|
-
args: [{
|
|
563
|
-
providedIn: 'root',
|
|
564
|
-
}]
|
|
565
|
-
}], ctorParameters: function () { return [{ type: i1.Store }]; } });
|
|
566
|
-
|
|
567
|
-
// TODO: address entities?
|
|
568
|
-
/**
|
|
569
|
-
* @inheritdoc
|
|
570
|
-
*
|
|
571
|
-
* Serves as the base for a customer facade.
|
|
572
|
-
* Extend this class and pass in the selectors for the specific state you wish to target.
|
|
573
|
-
*/
|
|
574
|
-
class DaffCustomerAddressPageFacade {
|
|
575
|
-
constructor(store) {
|
|
576
|
-
this.store = store;
|
|
577
|
-
const { selectAddress, selectAddresses, selectErrors, selectHasErrors, selectLoading, selectLoadingState, selectMutating, selectResolving, } = daffCustomerAddressGetSelectors();
|
|
578
|
-
this._selectAddress = selectAddress;
|
|
579
|
-
this.addresses$ = this.store.pipe(select(selectAddresses));
|
|
580
|
-
this.loadingState$ = this.store.pipe(select(selectLoadingState));
|
|
581
|
-
this.loading$ = this.store.pipe(select(selectLoading));
|
|
582
|
-
this.resolving$ = this.store.pipe(select(selectResolving));
|
|
583
|
-
this.mutating$ = this.store.pipe(select(selectMutating));
|
|
584
|
-
this.errors$ = this.store.pipe(select(selectErrors));
|
|
585
|
-
this.hasErrors$ = this.store.pipe(select(selectHasErrors));
|
|
586
|
-
}
|
|
587
|
-
getAddress(id) {
|
|
588
|
-
return this.store.pipe(select(this._selectAddress(id)));
|
|
589
|
-
}
|
|
590
|
-
dispatch(action) {
|
|
591
|
-
this.store.dispatch(action);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
/** @nocollapse */ DaffCustomerAddressPageFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerAddressPageFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
595
|
-
/** @nocollapse */ DaffCustomerAddressPageFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerAddressPageFacade, providedIn: 'root' });
|
|
596
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerAddressPageFacade, decorators: [{
|
|
597
|
-
type: Injectable,
|
|
598
|
-
args: [{
|
|
599
|
-
providedIn: 'root',
|
|
600
|
-
}]
|
|
601
|
-
}], ctorParameters: function () { return [{ type: i1.Store }]; } });
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* Transforms `DaffError`s into `DaffStateError`s before they are serialized into state.
|
|
605
|
-
* Can be used to further refine Daffodil errors into more specific app errors.
|
|
606
|
-
*/
|
|
607
|
-
const DAFF_CUSTOMER_ERROR_MATCHER = new InjectionToken('DAFF_CUSTOMER_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
|
|
608
|
-
|
|
609
|
-
class DaffCustomerAddressEffects {
|
|
610
|
-
constructor(actions$, driver, errorMatcher) {
|
|
611
|
-
this.actions$ = actions$;
|
|
612
|
-
this.driver = driver;
|
|
613
|
-
this.errorMatcher = errorMatcher;
|
|
614
|
-
this.list$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerAddressActionTypes.AddressListAction), switchMap((action) => this.driver.list().pipe(map(resp => new DaffCustomerAddressListSuccess(resp)), catchError((error) => of(new DaffCustomerAddressListFailure(this.errorMatcher(error))))))));
|
|
615
|
-
/**
|
|
616
|
-
* An effect for loading a customer address.
|
|
617
|
-
*/
|
|
618
|
-
this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerAddressActionTypes.AddressLoadAction), switchMap((action) => this.driver.get(action.addressId).pipe(map(resp => new DaffCustomerAddressLoadSuccess(resp)), catchError((error) => of(new DaffCustomerAddressLoadFailure(this.errorMatcher(error), action.addressId)))))));
|
|
619
|
-
/**
|
|
620
|
-
* An effect for updating a customer address.
|
|
621
|
-
*/
|
|
622
|
-
this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerAddressActionTypes.AddressUpdateAction), switchMap((action) => this.driver.update(action.address).pipe(map(resp => new DaffCustomerAddressUpdateSuccess(resp)), catchError((error) => of(new DaffCustomerAddressUpdateFailure(this.errorMatcher(error), action.address.id)))))));
|
|
623
|
-
/**
|
|
624
|
-
* An effect for adding a new customer address.
|
|
625
|
-
*/
|
|
626
|
-
this.add$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerAddressActionTypes.AddressAddAction), switchMap((action) => this.driver.add(action.address).pipe(map(resp => new DaffCustomerAddressAddSuccess(resp)), catchError((error) => of(new DaffCustomerAddressAddFailure(this.errorMatcher(error), action.placeholderId)))))));
|
|
627
|
-
/**
|
|
628
|
-
* An effect for adding a new customer address.
|
|
629
|
-
*/
|
|
630
|
-
this.delete$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerAddressActionTypes.AddressDeleteAction), switchMap((action) => this.driver.delete(action.addressId).pipe(map(resp => new DaffCustomerAddressDeleteSuccess(resp)), catchError((error) => of(new DaffCustomerAddressDeleteFailure(this.errorMatcher(error), action.addressId)))))));
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
/** @nocollapse */ DaffCustomerAddressEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerAddressEffects, deps: [{ token: i1$1.Actions }, { token: DaffCustomerAddressDriver }, { token: DAFF_CUSTOMER_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
634
|
-
/** @nocollapse */ DaffCustomerAddressEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerAddressEffects });
|
|
635
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerAddressEffects, decorators: [{
|
|
636
|
-
type: Injectable
|
|
637
|
-
}], ctorParameters: function () {
|
|
638
|
-
return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
639
|
-
type: Inject,
|
|
640
|
-
args: [DaffCustomerAddressDriver]
|
|
641
|
-
}] }, { type: undefined, decorators: [{
|
|
642
|
-
type: Inject,
|
|
643
|
-
args: [DAFF_CUSTOMER_ERROR_MATCHER]
|
|
644
|
-
}] }];
|
|
645
|
-
} });
|
|
646
|
-
|
|
647
|
-
class DaffCustomerEffects {
|
|
648
|
-
constructor(actions$, driver, errorMatcher) {
|
|
649
|
-
this.actions$ = actions$;
|
|
650
|
-
this.driver = driver;
|
|
651
|
-
this.errorMatcher = errorMatcher;
|
|
652
|
-
/**
|
|
653
|
-
* An effect for the loading of an customer.
|
|
654
|
-
*/
|
|
655
|
-
this.get$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerActionTypes.CustomerLoadAction), switchMap((action) => this.driver.get().pipe(map(resp => new DaffCustomerLoadSuccess(resp)), catchError((error) => of(new DaffCustomerLoadFailure(this.errorMatcher(error))))))));
|
|
656
|
-
/**
|
|
657
|
-
* An effect for the updating of an customer.
|
|
658
|
-
*/
|
|
659
|
-
this.update$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerActionTypes.CustomerUpdateAction), switchMap((action) => this.driver.update(action.customer).pipe(map(resp => new DaffCustomerUpdateSuccess(resp)), catchError((error) => of(new DaffCustomerUpdateFailure(this.errorMatcher(error))))))));
|
|
660
|
-
/**
|
|
661
|
-
* An effect for changing a customer email.
|
|
662
|
-
*/
|
|
663
|
-
this.changeEmail$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerActionTypes.CustomerChangeEmailAction), switchMap((action) => this.driver.changeEmail(action.email, action.password).pipe(map(resp => new DaffCustomerChangeEmailSuccess(resp)), catchError((error) => of(new DaffCustomerChangeEmailFailure(this.errorMatcher(error))))))));
|
|
664
|
-
/**
|
|
665
|
-
* An effect for changing a customer password.
|
|
666
|
-
*/
|
|
667
|
-
this.changePassword$ = createEffect(() => this.actions$.pipe(ofType(DaffCustomerActionTypes.CustomerChangePasswordAction), switchMap((action) => this.driver.changePassword(action.oldPassword, action.newPassword).pipe(map(() => new DaffCustomerChangePasswordSuccess()), catchError((error) => of(new DaffCustomerChangePasswordFailure(this.errorMatcher(error))))))));
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
/** @nocollapse */ DaffCustomerEffects.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerEffects, deps: [{ token: i1$1.Actions }, { token: DaffCustomerDriver }, { token: DAFF_CUSTOMER_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
671
|
-
/** @nocollapse */ DaffCustomerEffects.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerEffects });
|
|
672
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerEffects, decorators: [{
|
|
673
|
-
type: Injectable
|
|
674
|
-
}], ctorParameters: function () {
|
|
675
|
-
return [{ type: i1$1.Actions }, { type: undefined, decorators: [{
|
|
676
|
-
type: Inject,
|
|
677
|
-
args: [DaffCustomerDriver]
|
|
678
|
-
}] }, { type: undefined, decorators: [{
|
|
679
|
-
type: Inject,
|
|
680
|
-
args: [DAFF_CUSTOMER_ERROR_MATCHER]
|
|
681
|
-
}] }];
|
|
682
|
-
} });
|
|
683
|
-
|
|
684
|
-
/**
|
|
685
|
-
* An internal token to hold the Daffodil customer reducers.
|
|
686
|
-
* Includes the extra and standard reducers.
|
|
687
|
-
*
|
|
688
|
-
* @docs-private
|
|
689
|
-
*/
|
|
690
|
-
const DAFF_CUSTOMER_REDUCERS = new InjectionToken('DAFF_CUSTOMER_REDUCERS', {
|
|
691
|
-
providedIn: 'any',
|
|
692
|
-
factory: () => daffComposeReducers([
|
|
693
|
-
combineReducers({
|
|
694
|
-
customer: daffCustomerReducer,
|
|
695
|
-
address: daffCustomerAddressReducer,
|
|
696
|
-
addressEntities: daffCustomerAddressEntitiesReducer,
|
|
697
|
-
}),
|
|
698
|
-
...inject(DAFF_CUSTOMER_EXTRA_REDUCERS),
|
|
699
|
-
]),
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* Creates the customer feature store.
|
|
704
|
-
*/
|
|
705
|
-
class DaffCustomerStateModule {
|
|
706
|
-
}
|
|
707
|
-
/** @nocollapse */ DaffCustomerStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
708
|
-
/** @nocollapse */ DaffCustomerStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerStateModule, imports: [i1.StoreFeatureModule, i1$1.EffectsFeatureModule] });
|
|
709
|
-
/** @nocollapse */ DaffCustomerStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerStateModule, imports: [StoreModule.forFeature(DAFF_CUSTOMER_STORE_FEATURE_KEY, DAFF_CUSTOMER_REDUCERS),
|
|
710
|
-
EffectsModule.forFeature([
|
|
711
|
-
DaffCustomerEffects,
|
|
712
|
-
DaffCustomerAddressEffects,
|
|
713
|
-
])] });
|
|
714
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCustomerStateModule, decorators: [{
|
|
715
|
-
type: NgModule,
|
|
716
|
-
args: [{
|
|
717
|
-
imports: [
|
|
718
|
-
StoreModule.forFeature(DAFF_CUSTOMER_STORE_FEATURE_KEY, DAFF_CUSTOMER_REDUCERS),
|
|
719
|
-
EffectsModule.forFeature([
|
|
720
|
-
DaffCustomerEffects,
|
|
721
|
-
DaffCustomerAddressEffects,
|
|
722
|
-
]),
|
|
723
|
-
],
|
|
724
|
-
}]
|
|
725
|
-
}] });
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* Generated bundle index. Do not edit.
|
|
729
|
-
*/
|
|
730
|
-
|
|
731
|
-
export { DAFF_CUSTOMER_ERROR_MATCHER, DAFF_CUSTOMER_EXTRA_REDUCERS, DAFF_CUSTOMER_STORE_FEATURE_KEY, DaffCustomerActionTypes, DaffCustomerAddressActionTypes, DaffCustomerAddressAdd, DaffCustomerAddressAddFailure, DaffCustomerAddressAddSuccess, DaffCustomerAddressDelete, DaffCustomerAddressDeleteFailure, DaffCustomerAddressDeleteSuccess, DaffCustomerAddressList, DaffCustomerAddressListFailure, DaffCustomerAddressListSuccess, DaffCustomerAddressLoad, DaffCustomerAddressLoadFailure, DaffCustomerAddressLoadSuccess, DaffCustomerAddressPageFacade, DaffCustomerAddressUpdate, DaffCustomerAddressUpdateFailure, DaffCustomerAddressUpdateSuccess, DaffCustomerChangeEmail, DaffCustomerChangeEmailFailure, DaffCustomerChangeEmailSuccess, DaffCustomerChangePassword, DaffCustomerChangePasswordFailure, DaffCustomerChangePasswordSuccess, DaffCustomerClearErrors, DaffCustomerLoad, DaffCustomerLoadFailure, DaffCustomerLoadSuccess, DaffCustomerPageFacade, DaffCustomerStateModule, DaffCustomerUpdate, DaffCustomerUpdateFailure, DaffCustomerUpdateSuccess, daffCustomerAddressEntitiesAdapter, daffCustomerAddressEntitiesReducer, daffCustomerAddressGetSelectors, daffCustomerAddressInitialState, daffCustomerAddressReducer, daffCustomerGetSelectors, daffCustomerInitialState, daffCustomerProvideExtraReducers, daffCustomerReducer, daffCustomerStateStoreCustomer, getDaffCustomerReducersStateSelector };
|
|
732
|
-
//# sourceMappingURL=daffodil-customer-state.mjs.map
|