@daffodil/cart 0.77.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/driver/in-memory/backend/cart/cart.service.d.ts +3 -2
  2. package/driver/in-memory/backend/cart-address/cart-address.service.d.ts +3 -2
  3. package/driver/in-memory/backend/cart-billing-address/cart-billing-address.service.d.ts +3 -2
  4. package/driver/in-memory/backend/cart-coupon/cart-coupon.service.d.ts +3 -2
  5. package/driver/in-memory/backend/cart-items/cart-items.service.d.ts +3 -2
  6. package/driver/in-memory/backend/cart-order/cart-order.service.d.ts +3 -2
  7. package/driver/in-memory/backend/cart-payment/cart-payment.service.d.ts +3 -2
  8. package/driver/in-memory/backend/cart-payment-methods/cart-payment-methods.service.d.ts +3 -2
  9. package/driver/in-memory/backend/cart-root.service.d.ts +7 -25
  10. package/driver/in-memory/backend/cart-shipping-address/cart-shipping-address.service.d.ts +3 -2
  11. package/driver/in-memory/backend/cart-shipping-information/cart-shipping-information.service.d.ts +3 -2
  12. package/driver/in-memory/backend/cart-shipping-methods/cart-shipping-methods.service.d.ts +3 -2
  13. package/driver/in-memory/collection-names.d.ts +11 -0
  14. package/driver/in-memory/drivers/cart/cart.service.d.ts +4 -6
  15. package/driver/in-memory/drivers/cart-address/cart-address.service.d.ts +4 -6
  16. package/driver/in-memory/drivers/cart-billing-address/cart-billing-address.service.d.ts +4 -6
  17. package/driver/in-memory/drivers/cart-coupon/cart-coupon.service.d.ts +4 -6
  18. package/driver/in-memory/drivers/cart-item/cart-item.service.d.ts +4 -6
  19. package/driver/in-memory/drivers/cart-order/cart-order.service.d.ts +4 -6
  20. package/driver/in-memory/drivers/cart-payment/cart-payment.service.d.ts +4 -6
  21. package/driver/in-memory/drivers/cart-payment-methods/cart-payment-methods.service.d.ts +4 -6
  22. package/driver/in-memory/drivers/cart-shipping-address/cart-shipping-address.service.d.ts +4 -6
  23. package/driver/in-memory/drivers/cart-shipping-information/cart-shipping-information.service.d.ts +4 -6
  24. package/driver/in-memory/drivers/cart-shipping-methods/cart-shipping-methods.service.d.ts +4 -6
  25. package/driver/in-memory/public_api.d.ts +1 -0
  26. package/esm2022/driver/in-memory/backend/cart/cart.service.mjs +3 -1
  27. package/esm2022/driver/in-memory/backend/cart-address/cart-address.service.mjs +3 -1
  28. package/esm2022/driver/in-memory/backend/cart-billing-address/cart-billing-address.service.mjs +3 -1
  29. package/esm2022/driver/in-memory/backend/cart-coupon/cart-coupon.service.mjs +3 -1
  30. package/esm2022/driver/in-memory/backend/cart-items/cart-items.service.mjs +3 -1
  31. package/esm2022/driver/in-memory/backend/cart-order/cart-order.service.mjs +5 -1
  32. package/esm2022/driver/in-memory/backend/cart-payment/cart-payment.service.mjs +3 -1
  33. package/esm2022/driver/in-memory/backend/cart-payment-methods/cart-payment-methods.service.mjs +5 -1
  34. package/esm2022/driver/in-memory/backend/cart-root.service.mjs +45 -77
  35. package/esm2022/driver/in-memory/backend/cart-shipping-address/cart-shipping-address.service.mjs +3 -1
  36. package/esm2022/driver/in-memory/backend/cart-shipping-information/cart-shipping-information.service.mjs +3 -1
  37. package/esm2022/driver/in-memory/backend/cart-shipping-methods/cart-shipping-methods.service.mjs +3 -1
  38. package/esm2022/driver/in-memory/collection-names.mjs +12 -0
  39. package/esm2022/driver/in-memory/drivers/cart/cart.service.mjs +10 -9
  40. package/esm2022/driver/in-memory/drivers/cart-address/cart-address.service.mjs +10 -9
  41. package/esm2022/driver/in-memory/drivers/cart-billing-address/cart-billing-address.service.mjs +10 -9
  42. package/esm2022/driver/in-memory/drivers/cart-coupon/cart-coupon.service.mjs +10 -9
  43. package/esm2022/driver/in-memory/drivers/cart-driver.module.mjs +4 -1
  44. package/esm2022/driver/in-memory/drivers/cart-item/cart-item.service.mjs +10 -9
  45. package/esm2022/driver/in-memory/drivers/cart-order/cart-order.service.mjs +10 -9
  46. package/esm2022/driver/in-memory/drivers/cart-payment/cart-payment.service.mjs +10 -9
  47. package/esm2022/driver/in-memory/drivers/cart-payment-methods/cart-payment-methods.service.mjs +10 -9
  48. package/esm2022/driver/in-memory/drivers/cart-shipping-address/cart-shipping-address.service.mjs +10 -9
  49. package/esm2022/driver/in-memory/drivers/cart-shipping-information/cart-shipping-information.service.mjs +10 -9
  50. package/esm2022/driver/in-memory/drivers/cart-shipping-methods/cart-shipping-methods.service.mjs +10 -9
  51. package/esm2022/driver/in-memory/public_api.mjs +2 -1
  52. package/fesm2022/daffodil-cart-driver-in-memory.mjs +203 -239
  53. package/fesm2022/daffodil-cart-driver-in-memory.mjs.map +1 -1
  54. package/package.json +1 -1
@@ -1,27 +1,38 @@
1
1
  import * as i1 from '@angular/common/http';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, NgModule, InjectionToken, Inject } from '@angular/core';
4
- import { throwError } from 'rxjs';
3
+ import { Injectable, InjectionToken, Inject, NgModule } from '@angular/core';
4
+ import * as i2 from 'angular-in-memory-web-api';
5
+ import { STATUS } from 'angular-in-memory-web-api';
6
+ import { throwError, of } from 'rxjs';
5
7
  import { catchError, map } from 'rxjs/operators';
6
8
  import { DaffCartNotFoundError, DaffCartDriver, DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartItemDriver, DaffCartPaymentDriver, DaffCartPaymentMethodsDriver, DaffCartShippingAddressDriver, DaffCartShippingInformationDriver, DaffCartShippingMethodsDriver, DaffCartOrderDriver, DaffCartCouponDriver } from '@daffodil/cart/driver';
9
+ import { DaffInMemoryDriverBase, DaffInMemoryBackendDelegate, provideDaffInMemoryBackends } from '@daffodil/driver/in-memory';
7
10
  import { CommonModule } from '@angular/common';
8
- import { STATUS } from 'angular-in-memory-web-api';
9
11
  import * as i1$1 from '@daffodil/cart/testing';
10
- import * as i2 from '@daffodil/product/driver/in-memory';
12
+ import * as i2$1 from '@daffodil/product/driver/in-memory';
11
13
  import { faker } from '@faker-js/faker/locale/en_US';
12
14
  import { DaffCartTotalTypeEnum } from '@daffodil/cart';
13
15
  import { daffMultiply } from '@daffodil/core';
14
16
 
17
+ const DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME = 'cart';
18
+ const DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME = 'cart-items';
19
+ const DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME = 'cart-order';
20
+ const DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME = 'cart-coupon';
21
+ const DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME = 'cart-address';
22
+ const DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME = 'cart-shipping-address';
23
+ const DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME = 'cart-billing-address';
24
+ const DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME = 'cart-payment-methods';
25
+ const DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME = 'cart-shipping-methods';
26
+ const DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME = 'cart-payment';
27
+ const DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME = 'cart-shipping-information';
28
+
15
29
  /**
16
30
  * @inheritdoc
17
31
  */
18
- class DaffInMemoryCartService {
19
- constructor(http) {
32
+ class DaffInMemoryCartService extends DaffInMemoryDriverBase {
33
+ constructor(http, config) {
34
+ super(config, DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME);
20
35
  this.http = http;
21
- /**
22
- * The URL with which the driver makes calls to the backend.
23
- */
24
- this.url = '/api/cart';
25
36
  }
26
37
  get(cartId) {
27
38
  return this.http.get(`${this.url}/${cartId}`).pipe(catchError((error) => throwError(() => new DaffCartNotFoundError(error.message))), map(result => ({
@@ -47,7 +58,7 @@ class DaffInMemoryCartService {
47
58
  errors: [],
48
59
  })));
49
60
  }
50
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
61
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
51
62
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartService, providedIn: 'root' }); }
52
63
  }
53
64
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartService, decorators: [{
@@ -55,18 +66,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
55
66
  args: [{
56
67
  providedIn: 'root',
57
68
  }]
58
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
69
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
59
70
 
60
71
  /**
61
72
  * @inheritdoc
62
73
  */
63
- class DaffInMemoryCartItemService {
64
- constructor(http) {
74
+ class DaffInMemoryCartItemService extends DaffInMemoryDriverBase {
75
+ constructor(http, config) {
76
+ super(config, DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME);
65
77
  this.http = http;
66
- /**
67
- * The URL with which the driver makes calls to the backend.
68
- */
69
- this.url = '/api/cart-items';
70
78
  }
71
79
  list(cartId) {
72
80
  return this.http.get(`${this.url}/${cartId}/`);
@@ -83,7 +91,7 @@ class DaffInMemoryCartItemService {
83
91
  delete(cartId, itemId) {
84
92
  return this.http.delete(`${this.url}/${cartId}/${itemId}`);
85
93
  }
86
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartItemService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
94
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartItemService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
87
95
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartItemService, providedIn: 'root' }); }
88
96
  }
89
97
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartItemService, decorators: [{
@@ -91,18 +99,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
91
99
  args: [{
92
100
  providedIn: 'root',
93
101
  }]
94
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
102
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
95
103
 
96
104
  /**
97
105
  * @inheritdoc
98
106
  */
99
- class DaffInMemoryCartBillingAddressService {
100
- constructor(http) {
107
+ class DaffInMemoryCartBillingAddressService extends DaffInMemoryDriverBase {
108
+ constructor(http, config) {
109
+ super(config, DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME);
101
110
  this.http = http;
102
- /**
103
- * The URL with which the driver makes calls to the backend.
104
- */
105
- this.url = '/api/cart-billing-address';
106
111
  }
107
112
  get(cartId) {
108
113
  return this.http.get(`${this.url}/${cartId}`);
@@ -110,7 +115,7 @@ class DaffInMemoryCartBillingAddressService {
110
115
  update(cartId, address) {
111
116
  return this.http.put(`${this.url}/${cartId}`, address);
112
117
  }
113
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartBillingAddressService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
118
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartBillingAddressService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
114
119
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartBillingAddressService, providedIn: 'root' }); }
115
120
  }
116
121
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartBillingAddressService, decorators: [{
@@ -118,18 +123,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
118
123
  args: [{
119
124
  providedIn: 'root',
120
125
  }]
121
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
126
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
122
127
 
123
128
  /**
124
129
  * @inheritdoc
125
130
  */
126
- class DaffInMemoryCartPaymentService {
127
- constructor(http) {
131
+ class DaffInMemoryCartPaymentService extends DaffInMemoryDriverBase {
132
+ constructor(http, config) {
133
+ super(config, DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME);
128
134
  this.http = http;
129
- /**
130
- * The URL with which the driver makes calls to the backend.
131
- */
132
- this.url = '/api/cart-payment';
133
135
  }
134
136
  get(cartId) {
135
137
  return this.http.get(`${this.url}/${cartId}`);
@@ -143,7 +145,7 @@ class DaffInMemoryCartPaymentService {
143
145
  remove(cartId) {
144
146
  return this.http.delete(`${this.url}/${cartId}`);
145
147
  }
146
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
148
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
147
149
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentService, providedIn: 'root' }); }
148
150
  }
149
151
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentService, decorators: [{
@@ -151,23 +153,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
151
153
  args: [{
152
154
  providedIn: 'root',
153
155
  }]
154
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
156
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
155
157
 
156
158
  /**
157
159
  * @inheritdoc
158
160
  */
159
- class DaffInMemoryCartPaymentMethodsService {
160
- constructor(http) {
161
+ class DaffInMemoryCartPaymentMethodsService extends DaffInMemoryDriverBase {
162
+ constructor(http, config) {
163
+ super(config, DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME);
161
164
  this.http = http;
162
- /**
163
- * The URL with which the driver makes calls to the backend.
164
- */
165
- this.url = '/api/cart-payment-methods';
166
165
  }
167
166
  list(cartId) {
168
167
  return this.http.get(`${this.url}/${cartId}`);
169
168
  }
170
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentMethodsService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
169
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentMethodsService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
171
170
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentMethodsService, providedIn: 'root' }); }
172
171
  }
173
172
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartPaymentMethodsService, decorators: [{
@@ -175,18 +174,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
175
174
  args: [{
176
175
  providedIn: 'root',
177
176
  }]
178
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
177
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
179
178
 
180
179
  /**
181
180
  * @inheritdoc
182
181
  */
183
- class DaffInMemoryCartShippingAddressService {
184
- constructor(http) {
182
+ class DaffInMemoryCartShippingAddressService extends DaffInMemoryDriverBase {
183
+ constructor(http, config) {
184
+ super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME);
185
185
  this.http = http;
186
- /**
187
- * The URL with which the driver makes calls to the backend.
188
- */
189
- this.url = '/api/cart-shipping-address';
190
186
  }
191
187
  get(cartId) {
192
188
  return this.http.get(`${this.url}/${cartId}`);
@@ -194,7 +190,7 @@ class DaffInMemoryCartShippingAddressService {
194
190
  update(cartId, address) {
195
191
  return this.http.put(`${this.url}/${cartId}`, address);
196
192
  }
197
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingAddressService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
193
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingAddressService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
198
194
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingAddressService, providedIn: 'root' }); }
199
195
  }
200
196
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingAddressService, decorators: [{
@@ -202,18 +198,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
202
198
  args: [{
203
199
  providedIn: 'root',
204
200
  }]
205
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
201
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
206
202
 
207
203
  /**
208
204
  * @inheritdoc
209
205
  */
210
- class DaffInMemoryCartShippingInformationService {
211
- constructor(http) {
206
+ class DaffInMemoryCartShippingInformationService extends DaffInMemoryDriverBase {
207
+ constructor(http, config) {
208
+ super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME);
212
209
  this.http = http;
213
- /**
214
- * The URL with which the driver makes calls to the backend.
215
- */
216
- this.url = '/api/cart-shipping-information';
217
210
  }
218
211
  get(cartId) {
219
212
  return this.http.get(`${this.url}/${cartId}`);
@@ -224,7 +217,7 @@ class DaffInMemoryCartShippingInformationService {
224
217
  delete(cartId) {
225
218
  return this.http.delete(`${this.url}/${cartId}`);
226
219
  }
227
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingInformationService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
220
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingInformationService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
228
221
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingInformationService, providedIn: 'root' }); }
229
222
  }
230
223
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingInformationService, decorators: [{
@@ -232,23 +225,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
232
225
  args: [{
233
226
  providedIn: 'root',
234
227
  }]
235
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
228
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
236
229
 
237
230
  /**
238
231
  * @inheritdoc
239
232
  */
240
- class DaffInMemoryCartShippingMethodsService {
241
- constructor(http) {
233
+ class DaffInMemoryCartShippingMethodsService extends DaffInMemoryDriverBase {
234
+ constructor(http, config) {
235
+ super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME);
242
236
  this.http = http;
243
- /**
244
- * The URL with which the driver makes calls to the backend.
245
- */
246
- this.url = '/api/cart-shipping-methods';
247
237
  }
248
238
  list(cartId) {
249
239
  return this.http.get(`${this.url}/${cartId}`);
250
240
  }
251
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingMethodsService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
241
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingMethodsService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
252
242
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingMethodsService, providedIn: 'root' }); }
253
243
  }
254
244
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartShippingMethodsService, decorators: [{
@@ -256,23 +246,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
256
246
  args: [{
257
247
  providedIn: 'root',
258
248
  }]
259
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
249
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
260
250
 
261
251
  /**
262
252
  * @inheritdoc
263
253
  */
264
- class DaffInMemoryCartOrderService {
265
- constructor(http) {
254
+ class DaffInMemoryCartOrderService extends DaffInMemoryDriverBase {
255
+ constructor(http, config) {
256
+ super(config, DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME);
266
257
  this.http = http;
267
- /**
268
- * The URL with which the driver makes calls to the backend.
269
- */
270
- this.url = '/api/cart-order';
271
258
  }
272
259
  placeOrder(cartId, payment) {
273
260
  return this.http.post(`${this.url}/${cartId}/`, { payment });
274
261
  }
275
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartOrderService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
262
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartOrderService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
276
263
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartOrderService, providedIn: 'root' }); }
277
264
  }
278
265
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartOrderService, decorators: [{
@@ -280,18 +267,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
280
267
  args: [{
281
268
  providedIn: 'root',
282
269
  }]
283
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
270
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
284
271
 
285
272
  /**
286
273
  * @inheritdoc
287
274
  */
288
- class DaffInMemoryCartCouponService {
289
- constructor(http) {
275
+ class DaffInMemoryCartCouponService extends DaffInMemoryDriverBase {
276
+ constructor(http, config) {
277
+ super(config, DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME);
290
278
  this.http = http;
291
- /**
292
- * The URL with which the driver makes calls to the backend.
293
- */
294
- this.url = '/api/cart-coupon';
295
279
  }
296
280
  list(cartId) {
297
281
  return this.http.get(`${this.url}/${cartId}/`);
@@ -305,7 +289,7 @@ class DaffInMemoryCartCouponService {
305
289
  removeAll(cartId) {
306
290
  return this.http.delete(`${this.url}/${cartId}/`);
307
291
  }
308
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartCouponService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
292
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartCouponService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
309
293
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartCouponService, providedIn: 'root' }); }
310
294
  }
311
295
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartCouponService, decorators: [{
@@ -313,23 +297,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
313
297
  args: [{
314
298
  providedIn: 'root',
315
299
  }]
316
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
300
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
317
301
 
318
302
  /**
319
303
  * @inheritdoc
320
304
  */
321
- class DaffInMemoryCartAddressService {
322
- constructor(http) {
305
+ class DaffInMemoryCartAddressService extends DaffInMemoryDriverBase {
306
+ constructor(http, config) {
307
+ super(config, DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME);
323
308
  this.http = http;
324
- /**
325
- * The URL with which the driver makes calls to the backend.
326
- */
327
- this.url = '/api/cart-address';
328
309
  }
329
310
  update(cartId, address) {
330
311
  return this.http.put(`${this.url}/${cartId}`, address);
331
312
  }
332
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartAddressService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
313
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartAddressService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
333
314
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartAddressService, providedIn: 'root' }); }
334
315
  }
335
316
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryCartAddressService, decorators: [{
@@ -337,72 +318,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
337
318
  args: [{
338
319
  providedIn: 'root',
339
320
  }]
340
- }], ctorParameters: () => [{ type: i1.HttpClient }] });
341
-
342
- class DaffCartInMemoryDriverModule {
343
- static forRoot() {
344
- return {
345
- ngModule: DaffCartInMemoryDriverModule,
346
- providers: [
347
- {
348
- provide: DaffCartDriver,
349
- useExisting: DaffInMemoryCartService,
350
- },
351
- {
352
- provide: DaffCartAddressDriver,
353
- useExisting: DaffInMemoryCartAddressService,
354
- },
355
- {
356
- provide: DaffCartBillingAddressDriver,
357
- useExisting: DaffInMemoryCartBillingAddressService,
358
- },
359
- {
360
- provide: DaffCartItemDriver,
361
- useExisting: DaffInMemoryCartItemService,
362
- },
363
- {
364
- provide: DaffCartPaymentDriver,
365
- useExisting: DaffInMemoryCartPaymentService,
366
- },
367
- {
368
- provide: DaffCartPaymentMethodsDriver,
369
- useExisting: DaffInMemoryCartPaymentMethodsService,
370
- },
371
- {
372
- provide: DaffCartShippingAddressDriver,
373
- useExisting: DaffInMemoryCartShippingAddressService,
374
- },
375
- {
376
- provide: DaffCartShippingInformationDriver,
377
- useExisting: DaffInMemoryCartShippingInformationService,
378
- },
379
- {
380
- provide: DaffCartShippingMethodsDriver,
381
- useExisting: DaffInMemoryCartShippingMethodsService,
382
- },
383
- {
384
- provide: DaffCartOrderDriver,
385
- useExisting: DaffInMemoryCartOrderService,
386
- },
387
- {
388
- provide: DaffCartCouponDriver,
389
- useExisting: DaffInMemoryCartCouponService,
390
- },
391
- ],
392
- };
393
- }
394
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
395
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, imports: [CommonModule] }); }
396
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, imports: [CommonModule] }); }
397
- }
398
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, decorators: [{
399
- type: NgModule,
400
- args: [{
401
- imports: [
402
- CommonModule,
403
- ],
404
- }]
405
- }] });
321
+ }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
406
322
 
407
323
  function daffCartInMemoryComputeCartTotals(cart, products) {
408
324
  const shipping = cart.shipping_information ? faker.datatype.number({ min: 0, max: 99 }) : 0;
@@ -478,6 +394,7 @@ class DaffInMemoryBackendCartService {
478
394
  this.cartFactory = cartFactory;
479
395
  this.extraFieldsHook = extraFieldsHook;
480
396
  this.productBackend = productBackend;
397
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME;
481
398
  }
482
399
  get(reqInfo) {
483
400
  return reqInfo.utils.createResponse$(() => this.getCart(reqInfo));
@@ -570,7 +487,7 @@ class DaffInMemoryBackendCartService {
570
487
  status: STATUS.NOT_FOUND,
571
488
  };
572
489
  }
573
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartService, deps: [{ token: i1$1.DaffCartFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable }); }
490
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartService, deps: [{ token: i1$1.DaffCartFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2$1.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable }); }
574
491
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartService, providedIn: 'root' }); }
575
492
  }
576
493
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartService, decorators: [{
@@ -581,7 +498,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
581
498
  }], ctorParameters: () => [{ type: i1$1.DaffCartFactory }, { type: undefined, decorators: [{
582
499
  type: Inject,
583
500
  args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
584
- }] }, { type: i2.DaffInMemoryBackendProductService }] });
501
+ }] }, { type: i2$1.DaffInMemoryBackendProductService }] });
585
502
 
586
503
  /**
587
504
  * @inheritdoc
@@ -589,6 +506,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
589
506
  class DaffInMemoryBackendCartAddressService {
590
507
  constructor(extraFieldsHook) {
591
508
  this.extraFieldsHook = extraFieldsHook;
509
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME;
592
510
  }
593
511
  put(reqInfo) {
594
512
  return reqInfo.utils.createResponse$(() => ({
@@ -628,6 +546,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
628
546
  class DaffInMemoryBackendCartBillingAddressService {
629
547
  constructor(extraFieldsHook) {
630
548
  this.extraFieldsHook = extraFieldsHook;
549
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME;
631
550
  }
632
551
  get(reqInfo) {
633
552
  return reqInfo.utils.createResponse$(() => ({
@@ -675,6 +594,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
675
594
  class DaffInMemoryBackendCartCouponService {
676
595
  constructor(extraFieldsHook) {
677
596
  this.extraFieldsHook = extraFieldsHook;
597
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME;
678
598
  }
679
599
  get(reqInfo) {
680
600
  return reqInfo.utils.createResponse$(() => ({
@@ -768,6 +688,7 @@ class DaffInMemoryBackendCartItemsService {
768
688
  this.cartItemFactory = cartItemFactory;
769
689
  this.extraFieldsHook = extraFieldsHook;
770
690
  this.productBackend = productBackend;
691
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME;
771
692
  }
772
693
  get(reqInfo) {
773
694
  return reqInfo.utils.createResponse$(() => {
@@ -879,7 +800,7 @@ class DaffInMemoryBackendCartItemsService {
879
800
  }, this.productBackend.products);
880
801
  return reqInfo.collection[cartIndex];
881
802
  }
882
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartItemsService, deps: [{ token: i1$1.DaffCartItemFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable }); }
803
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartItemsService, deps: [{ token: i1$1.DaffCartItemFactory }, { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2$1.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable }); }
883
804
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartItemsService, providedIn: 'root' }); }
884
805
  }
885
806
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartItemsService, decorators: [{
@@ -890,12 +811,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
890
811
  }], ctorParameters: () => [{ type: i1$1.DaffCartItemFactory }, { type: undefined, decorators: [{
891
812
  type: Inject,
892
813
  args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
893
- }] }, { type: i2.DaffInMemoryBackendProductService }] });
814
+ }] }, { type: i2$1.DaffInMemoryBackendProductService }] });
894
815
 
895
816
  /**
896
817
  * @inheritdoc
897
818
  */
898
819
  class DaffInMemoryBackendCartOrderService {
820
+ constructor() {
821
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME;
822
+ }
899
823
  post(reqInfo) {
900
824
  return reqInfo.utils.createResponse$(() => ({
901
825
  body: this.placeOrder(reqInfo),
@@ -925,6 +849,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
925
849
  class DaffInMemoryBackendCartPaymentService {
926
850
  constructor(extraFieldsHook) {
927
851
  this.extraFieldsHook = extraFieldsHook;
852
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME;
928
853
  }
929
854
  get(reqInfo) {
930
855
  return reqInfo.utils.createResponse$(() => ({
@@ -987,6 +912,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
987
912
  * @inheritdoc
988
913
  */
989
914
  class DaffInMemoryBackendCartPaymentMethodsService {
915
+ constructor() {
916
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME;
917
+ }
990
918
  get(reqInfo) {
991
919
  return reqInfo.utils.createResponse$(() => ({
992
920
  body: this.listPaymentMethods(reqInfo),
@@ -1015,6 +943,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
1015
943
  class DaffInMemoryBackendCartShippingAddressService {
1016
944
  constructor(extraFieldsHook) {
1017
945
  this.extraFieldsHook = extraFieldsHook;
946
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME;
1018
947
  }
1019
948
  get(reqInfo) {
1020
949
  return reqInfo.utils.createResponse$(() => ({
@@ -1063,6 +992,7 @@ class DaffInMemoryBackendCartShippingInformationService {
1063
992
  constructor(extraFieldsHook, productBackend) {
1064
993
  this.extraFieldsHook = extraFieldsHook;
1065
994
  this.productBackend = productBackend;
995
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME;
1066
996
  }
1067
997
  get(reqInfo) {
1068
998
  return reqInfo.utils.createResponse$(() => ({
@@ -1105,7 +1035,7 @@ class DaffInMemoryBackendCartShippingInformationService {
1105
1035
  extra_attributes: this.extraFieldsHook(reqInfo, cart),
1106
1036
  };
1107
1037
  }
1108
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1038
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2$1.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1109
1039
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, providedIn: 'root' }); }
1110
1040
  }
1111
1041
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, decorators: [{
@@ -1116,7 +1046,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
1116
1046
  }], ctorParameters: () => [{ type: undefined, decorators: [{
1117
1047
  type: Inject,
1118
1048
  args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
1119
- }] }, { type: i2.DaffInMemoryBackendProductService }] });
1049
+ }] }, { type: i2$1.DaffInMemoryBackendProductService }] });
1120
1050
 
1121
1051
  /**
1122
1052
  * @inheritdoc
@@ -1124,6 +1054,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
1124
1054
  class DaffInMemoryBackendCartShippingMethodsService {
1125
1055
  constructor(shippingMethodFactory) {
1126
1056
  this.shippingMethodFactory = shippingMethodFactory;
1057
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME;
1127
1058
  }
1128
1059
  get(reqInfo) {
1129
1060
  return reqInfo.utils.createResponse$(() => ({
@@ -1156,45 +1087,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
1156
1087
  }]
1157
1088
  }], ctorParameters: () => [{ type: i1$1.DaffCartShippingRateFactory }] });
1158
1089
 
1090
+ /**
1091
+ * The collections that the root service manages.
1092
+ * Useful for a higher-level backend that delegates to this one based on collection name.
1093
+ */
1094
+ const COLLECTION_NAMES = [
1095
+ 'cart',
1096
+ 'cart-items',
1097
+ 'cart-order',
1098
+ 'cart-coupon',
1099
+ 'cart-address',
1100
+ 'cart-shipping-address',
1101
+ 'cart-billing-address',
1102
+ 'cart-payment-methods',
1103
+ 'cart-shipping-methods',
1104
+ 'cart-payment',
1105
+ 'cart-shipping-information',
1106
+ ];
1159
1107
  /**
1160
1108
  * The root cart in-memory backend.
1161
1109
  * Creates the database and delegates requests to child backends.
1162
1110
  */
1163
- class DaffInMemoryBackendCartRootService {
1164
- /**
1165
- * The collections that the root service manages.
1166
- * Useful for a higher-level backend that delegates to this one based on collection name.
1167
- */
1168
- static { this.COLLECTION_NAMES = [
1169
- 'cart',
1170
- 'cart-items',
1171
- 'cart-order',
1172
- 'cart-coupon',
1173
- 'cart-address',
1174
- 'cart-shipping-address',
1175
- 'cart-billing-address',
1176
- 'cart-payment-methods',
1177
- 'cart-shipping-methods',
1178
- 'cart-payment',
1179
- 'cart-shipping-information',
1180
- ]; }
1111
+ class DaffInMemoryBackendCartRootService extends DaffInMemoryBackendDelegate {
1181
1112
  constructor(cartService, cartItemsService, cartOrderService, cartCouponService, cartAddressService, cartShippingAddressService, cartBillingAddressService, cartPaymentMethodsService, cartShippingMethodsService, cartPaymentService, cartShippingInformationService) {
1182
- this.cartService = cartService;
1183
- this.cartItemsService = cartItemsService;
1184
- this.cartOrderService = cartOrderService;
1185
- this.cartCouponService = cartCouponService;
1186
- this.cartAddressService = cartAddressService;
1187
- this.cartShippingAddressService = cartShippingAddressService;
1188
- this.cartBillingAddressService = cartBillingAddressService;
1189
- this.cartPaymentMethodsService = cartPaymentMethodsService;
1190
- this.cartShippingMethodsService = cartShippingMethodsService;
1191
- this.cartPaymentService = cartPaymentService;
1192
- this.cartShippingInformationService = cartShippingInformationService;
1113
+ super([
1114
+ cartService,
1115
+ cartItemsService,
1116
+ cartOrderService,
1117
+ cartCouponService,
1118
+ cartAddressService,
1119
+ cartShippingAddressService,
1120
+ cartBillingAddressService,
1121
+ cartPaymentMethodsService,
1122
+ cartShippingMethodsService,
1123
+ cartPaymentService,
1124
+ cartShippingInformationService,
1125
+ ]);
1193
1126
  /**
1194
1127
  * The collection of carts in the backend.
1195
1128
  */
1196
1129
  this.carts = [];
1197
1130
  }
1131
+ delegateRequest(reqInfo, method) {
1132
+ return super.delegateRequest({
1133
+ ...reqInfo,
1134
+ collection: this.carts,
1135
+ }, method);
1136
+ }
1137
+ canHandle(collectionName) {
1138
+ return COLLECTION_NAMES.includes(collectionName);
1139
+ }
1198
1140
  createDb(reqInfo) {
1199
1141
  if (reqInfo) {
1200
1142
  const seedData = reqInfo.utils.getJsonBody(reqInfo.req).carts;
@@ -1202,53 +1144,9 @@ class DaffInMemoryBackendCartRootService {
1202
1144
  this.carts = seedData;
1203
1145
  }
1204
1146
  }
1205
- return {
1147
+ return of({
1206
1148
  cart: this.carts,
1207
- };
1208
- }
1209
- get(reqInfo) {
1210
- return this.delegateRequest(reqInfo);
1211
- }
1212
- post(reqInfo) {
1213
- return this.delegateRequest(reqInfo);
1214
- }
1215
- put(reqInfo) {
1216
- return this.delegateRequest(reqInfo);
1217
- }
1218
- delete(reqInfo) {
1219
- return this.delegateRequest(reqInfo);
1220
- }
1221
- delegateRequest(reqInfo) {
1222
- reqInfo.collection = this.carts;
1223
- switch (reqInfo.collectionName) {
1224
- case 'cart':
1225
- return this.cartService[reqInfo.method](reqInfo);
1226
- case 'cart-items':
1227
- return this.cartItemsService[reqInfo.method](reqInfo);
1228
- case 'cart-order':
1229
- return this.cartOrderService[reqInfo.method](reqInfo);
1230
- case 'cart-coupon':
1231
- return this.cartCouponService[reqInfo.method](reqInfo);
1232
- case 'cart-address':
1233
- return this.cartAddressService[reqInfo.method](reqInfo);
1234
- case 'cart-shipping-address':
1235
- return this.cartShippingAddressService[reqInfo.method](reqInfo);
1236
- case 'cart-billing-address':
1237
- return this.cartBillingAddressService[reqInfo.method](reqInfo);
1238
- case 'cart-payment-methods':
1239
- return this.cartPaymentMethodsService[reqInfo.method](reqInfo);
1240
- case 'cart-shipping-methods':
1241
- return this.cartShippingMethodsService[reqInfo.method](reqInfo);
1242
- case 'cart-payment':
1243
- return this.cartPaymentService[reqInfo.method](reqInfo);
1244
- case 'cart-shipping-information':
1245
- return this.cartShippingInformationService[reqInfo.method](reqInfo);
1246
- default:
1247
- return reqInfo.utils.createResponse$(() => ({
1248
- body: {},
1249
- status: STATUS.OK,
1250
- }));
1251
- }
1149
+ });
1252
1150
  }
1253
1151
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartRootService, deps: [{ token: DaffInMemoryBackendCartService }, { token: DaffInMemoryBackendCartItemsService }, { token: DaffInMemoryBackendCartOrderService }, { token: DaffInMemoryBackendCartCouponService }, { token: DaffInMemoryBackendCartAddressService }, { token: DaffInMemoryBackendCartShippingAddressService }, { token: DaffInMemoryBackendCartBillingAddressService }, { token: DaffInMemoryBackendCartPaymentMethodsService }, { token: DaffInMemoryBackendCartShippingMethodsService }, { token: DaffInMemoryBackendCartPaymentService }, { token: DaffInMemoryBackendCartShippingInformationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1254
1152
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffInMemoryBackendCartRootService, providedIn: 'root' }); }
@@ -1260,9 +1158,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImpor
1260
1158
  }]
1261
1159
  }], ctorParameters: () => [{ type: DaffInMemoryBackendCartService }, { type: DaffInMemoryBackendCartItemsService }, { type: DaffInMemoryBackendCartOrderService }, { type: DaffInMemoryBackendCartCouponService }, { type: DaffInMemoryBackendCartAddressService }, { type: DaffInMemoryBackendCartShippingAddressService }, { type: DaffInMemoryBackendCartBillingAddressService }, { type: DaffInMemoryBackendCartPaymentMethodsService }, { type: DaffInMemoryBackendCartShippingMethodsService }, { type: DaffInMemoryBackendCartPaymentService }, { type: DaffInMemoryBackendCartShippingInformationService }] });
1262
1160
 
1161
+ class DaffCartInMemoryDriverModule {
1162
+ static forRoot() {
1163
+ return {
1164
+ ngModule: DaffCartInMemoryDriverModule,
1165
+ providers: [
1166
+ {
1167
+ provide: DaffCartDriver,
1168
+ useExisting: DaffInMemoryCartService,
1169
+ },
1170
+ {
1171
+ provide: DaffCartAddressDriver,
1172
+ useExisting: DaffInMemoryCartAddressService,
1173
+ },
1174
+ {
1175
+ provide: DaffCartBillingAddressDriver,
1176
+ useExisting: DaffInMemoryCartBillingAddressService,
1177
+ },
1178
+ {
1179
+ provide: DaffCartItemDriver,
1180
+ useExisting: DaffInMemoryCartItemService,
1181
+ },
1182
+ {
1183
+ provide: DaffCartPaymentDriver,
1184
+ useExisting: DaffInMemoryCartPaymentService,
1185
+ },
1186
+ {
1187
+ provide: DaffCartPaymentMethodsDriver,
1188
+ useExisting: DaffInMemoryCartPaymentMethodsService,
1189
+ },
1190
+ {
1191
+ provide: DaffCartShippingAddressDriver,
1192
+ useExisting: DaffInMemoryCartShippingAddressService,
1193
+ },
1194
+ {
1195
+ provide: DaffCartShippingInformationDriver,
1196
+ useExisting: DaffInMemoryCartShippingInformationService,
1197
+ },
1198
+ {
1199
+ provide: DaffCartShippingMethodsDriver,
1200
+ useExisting: DaffInMemoryCartShippingMethodsService,
1201
+ },
1202
+ {
1203
+ provide: DaffCartOrderDriver,
1204
+ useExisting: DaffInMemoryCartOrderService,
1205
+ },
1206
+ {
1207
+ provide: DaffCartCouponDriver,
1208
+ useExisting: DaffInMemoryCartCouponService,
1209
+ },
1210
+ provideDaffInMemoryBackends(DaffInMemoryBackendCartRootService),
1211
+ ],
1212
+ };
1213
+ }
1214
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1215
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, imports: [CommonModule] }); }
1216
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, imports: [CommonModule] }); }
1217
+ }
1218
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.2", ngImport: i0, type: DaffCartInMemoryDriverModule, decorators: [{
1219
+ type: NgModule,
1220
+ args: [{
1221
+ imports: [
1222
+ CommonModule,
1223
+ ],
1224
+ }]
1225
+ }] });
1226
+
1263
1227
  /**
1264
1228
  * Generated bundle index. Do not edit.
1265
1229
  */
1266
1230
 
1267
- export { DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, DaffCartInMemoryDriverModule, DaffInMemoryBackendCartAddressService, DaffInMemoryBackendCartBillingAddressService, DaffInMemoryBackendCartCouponService, DaffInMemoryBackendCartItemsService, DaffInMemoryBackendCartOrderService, DaffInMemoryBackendCartPaymentMethodsService, DaffInMemoryBackendCartPaymentService, DaffInMemoryBackendCartRootService, DaffInMemoryBackendCartService, DaffInMemoryBackendCartShippingAddressService, DaffInMemoryBackendCartShippingInformationService, DaffInMemoryBackendCartShippingMethodsService, DaffInMemoryCartBillingAddressService, DaffInMemoryCartCouponService, DaffInMemoryCartItemService, DaffInMemoryCartOrderService, DaffInMemoryCartPaymentMethodsService, DaffInMemoryCartPaymentService, DaffInMemoryCartService, DaffInMemoryCartShippingAddressService, DaffInMemoryCartShippingInformationService, DaffInMemoryCartShippingMethodsService };
1231
+ export { DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME, DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME, DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, DaffCartInMemoryDriverModule, DaffInMemoryBackendCartAddressService, DaffInMemoryBackendCartBillingAddressService, DaffInMemoryBackendCartCouponService, DaffInMemoryBackendCartItemsService, DaffInMemoryBackendCartOrderService, DaffInMemoryBackendCartPaymentMethodsService, DaffInMemoryBackendCartPaymentService, DaffInMemoryBackendCartRootService, DaffInMemoryBackendCartService, DaffInMemoryBackendCartShippingAddressService, DaffInMemoryBackendCartShippingInformationService, DaffInMemoryBackendCartShippingMethodsService, DaffInMemoryCartBillingAddressService, DaffInMemoryCartCouponService, DaffInMemoryCartItemService, DaffInMemoryCartOrderService, DaffInMemoryCartPaymentMethodsService, DaffInMemoryCartPaymentService, DaffInMemoryCartService, DaffInMemoryCartShippingAddressService, DaffInMemoryCartShippingInformationService, DaffInMemoryCartShippingMethodsService };
1268
1232
  //# sourceMappingURL=daffodil-cart-driver-in-memory.mjs.map