@daffodil/cart 0.94.1-rc.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/fesm2022/daffodil-cart-driver-in-memory.mjs +1618 -1198
  2. package/fesm2022/daffodil-cart-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-cart-driver-magento-2.4.7-testing.mjs +546 -0
  4. package/fesm2022/daffodil-cart-driver-magento-2.4.7-testing.mjs.map +1 -0
  5. package/fesm2022/daffodil-cart-driver-magento-2.4.7.mjs +2607 -0
  6. package/fesm2022/daffodil-cart-driver-magento-2.4.7.mjs.map +1 -0
  7. package/fesm2022/daffodil-cart-driver-magento-auto-testing.mjs +7 -0
  8. package/fesm2022/daffodil-cart-driver-magento-auto-testing.mjs.map +1 -0
  9. package/fesm2022/daffodil-cart-driver-magento-auto.mjs +7 -0
  10. package/fesm2022/daffodil-cart-driver-magento-auto.mjs.map +1 -0
  11. package/fesm2022/daffodil-cart-driver-testing.mjs +553 -335
  12. package/fesm2022/daffodil-cart-driver-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-cart-driver.mjs +167 -292
  14. package/fesm2022/daffodil-cart-driver.mjs.map +1 -1
  15. package/fesm2022/daffodil-cart-routing.mjs +741 -542
  16. package/fesm2022/daffodil-cart-routing.mjs.map +1 -1
  17. package/fesm2022/daffodil-cart-state-testing.mjs +288 -193
  18. package/fesm2022/daffodil-cart-state-testing.mjs.map +1 -1
  19. package/fesm2022/daffodil-cart-state.mjs +2571 -2800
  20. package/fesm2022/daffodil-cart-state.mjs.map +1 -1
  21. package/fesm2022/daffodil-cart-testing.mjs +542 -357
  22. package/fesm2022/daffodil-cart-testing.mjs.map +1 -1
  23. package/fesm2022/daffodil-cart.mjs +131 -200
  24. package/fesm2022/daffodil-cart.mjs.map +1 -1
  25. package/package.json +1 -1
  26. package/types/daffodil-cart-driver-in-memory.d.ts +273 -292
  27. package/types/daffodil-cart-driver-magento-2.4.7-testing.d.ts +176 -0
  28. package/types/daffodil-cart-driver-magento-2.4.7.d.ts +860 -0
  29. package/types/daffodil-cart-driver-magento-auto-testing.d.ts +1 -0
  30. package/types/daffodil-cart-driver-magento-auto.d.ts +1 -0
  31. package/types/daffodil-cart-driver-testing.d.ts +111 -118
  32. package/types/daffodil-cart-driver.d.ts +219 -262
  33. package/types/daffodil-cart-routing.d.ts +130 -149
  34. package/types/daffodil-cart-state-testing.d.ts +115 -114
  35. package/types/daffodil-cart-state.d.ts +1126 -1173
  36. package/types/daffodil-cart-testing.d.ts +146 -158
  37. package/types/daffodil-cart.d.ts +302 -321
  38. package/fesm2022/daffodil-cart-driver-magento-testing.mjs +0 -332
  39. package/fesm2022/daffodil-cart-driver-magento-testing.mjs.map +0 -1
  40. package/fesm2022/daffodil-cart-driver-magento.mjs +0 -2273
  41. package/fesm2022/daffodil-cart-driver-magento.mjs.map +0 -1
  42. package/types/daffodil-cart-driver-magento-testing.d.ts +0 -188
  43. package/types/daffodil-cart-driver-magento.d.ts +0 -999
@@ -1,1205 +1,1625 @@
1
- import * as i1 from '@angular/common/http';
2
- import * as i0 from '@angular/core';
3
- import { Injectable, 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';
7
- import { catchError, map } from 'rxjs/operators';
8
- import { DaffCartNotFoundError, provideDaffCartDriver, provideDaffCartAddressDriver, provideDaffCartBillingAddressDriver, provideDaffCartItemDriver, provideDaffCartPaymentDriver, provideDaffCartPaymentMethodsDriver, provideDaffCartShippingAddressDriver, provideDaffCartShippingInformationDriver, provideDaffCartShippingMethodsDriver, provideDaffCartOrderDriver, provideDaffCartCouponDriver } from '@daffodil/cart/driver';
9
- import { DaffInMemoryDriverBase, DaffInMemoryBackendDelegate, DAFF_IN_MEMORY_DRIVER_CONFIG, provideDaffInMemoryBackends } from '@daffodil/driver/in-memory';
10
- import { CommonModule } from '@angular/common';
11
- import * as i1$1 from '@daffodil/cart/testing';
12
- import * as i2$1 from '@daffodil/product/driver/in-memory';
13
- import { faker } from '@faker-js/faker/locale/en_US';
14
- import { DaffCartTotalTypeEnum } from '@daffodil/cart';
15
- import { createSingleInjectionToken, daffMultiply } from '@daffodil/core';
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
-
29
- /**
30
- * @inheritdoc
31
- */
32
- class DaffInMemoryCartService extends DaffInMemoryDriverBase {
33
- constructor(http, config) {
34
- super(config, DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME);
35
- this.http = http;
36
- }
37
- get(cartId) {
38
- return this.http.get(`${this.url}/${cartId}`).pipe(catchError((error) => throwError(() => new DaffCartNotFoundError(error.message))), map(result => ({
39
- response: result,
40
- errors: [],
41
- })));
42
- }
43
- addToCart(productId, qty) {
44
- return this.http.post(this.url + '/addToCart', { productId, qty });
45
- }
46
- clear(cartId) {
47
- return this.http.post(`${this.url}/${cartId}/clear`, {});
48
- }
49
- create() {
50
- return this.http.post(this.url, {});
51
- }
52
- merge(guestCart, customerCart) {
53
- return this.http.post(`${this.url}/${guestCart}/merge`, {
54
- source: guestCart,
55
- destination: customerCart,
56
- }).pipe(catchError((error) => throwError(() => new DaffCartNotFoundError(error.message))), map(result => ({
57
- response: result,
58
- errors: [],
59
- })));
60
- }
61
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
62
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartService, providedIn: 'root' }); }
63
- }
64
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartService, decorators: [{
65
- type: Injectable,
66
- args: [{
67
- providedIn: 'root',
68
- }]
69
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
70
-
71
- /**
72
- * @inheritdoc
73
- */
74
- class DaffInMemoryCartItemService extends DaffInMemoryDriverBase {
75
- constructor(http, config) {
76
- super(config, DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME);
77
- this.http = http;
78
- }
79
- list(cartId) {
80
- return this.http.get(`${this.url}/${cartId}/`);
81
- }
82
- get(cartId, itemId) {
83
- return this.http.get(`${this.url}/${cartId}/${itemId}`);
84
- }
85
- add(cartId, input) {
86
- return this.http.post(`${this.url}/${cartId}/`, input);
87
- }
88
- update(cartId, itemId, item) {
89
- return this.http.put(`${this.url}/${cartId}/${itemId}`, item);
90
- }
91
- delete(cartId, itemId) {
92
- return this.http.delete(`${this.url}/${cartId}/${itemId}`);
93
- }
94
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartItemService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
95
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartItemService, providedIn: 'root' }); }
96
- }
97
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartItemService, decorators: [{
98
- type: Injectable,
99
- args: [{
100
- providedIn: 'root',
101
- }]
102
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
103
-
104
- /**
105
- * @inheritdoc
106
- */
107
- class DaffInMemoryCartBillingAddressService extends DaffInMemoryDriverBase {
108
- constructor(http, config) {
109
- super(config, DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME);
110
- this.http = http;
111
- }
112
- get(cartId) {
113
- return this.http.get(`${this.url}/${cartId}`);
114
- }
115
- update(cartId, address) {
116
- return this.http.put(`${this.url}/${cartId}`, address);
117
- }
118
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartBillingAddressService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
119
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartBillingAddressService, providedIn: 'root' }); }
120
- }
121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartBillingAddressService, decorators: [{
122
- type: Injectable,
123
- args: [{
124
- providedIn: 'root',
125
- }]
126
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
127
-
128
- /**
129
- * @inheritdoc
130
- */
131
- class DaffInMemoryCartPaymentService extends DaffInMemoryDriverBase {
132
- constructor(http, config) {
133
- super(config, DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME);
134
- this.http = http;
135
- }
136
- get(cartId) {
137
- return this.http.get(`${this.url}/${cartId}`);
138
- }
139
- update(cartId, payment) {
140
- return this.http.put(`${this.url}/${cartId}`, { payment });
141
- }
142
- updateWithBilling(cartId, payment, address) {
143
- return this.http.put(`${this.url}/${cartId}`, { payment, address });
144
- }
145
- remove(cartId) {
146
- return this.http.delete(`${this.url}/${cartId}`);
147
- }
148
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartPaymentService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
149
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartPaymentService, providedIn: 'root' }); }
150
- }
151
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartPaymentService, decorators: [{
152
- type: Injectable,
153
- args: [{
154
- providedIn: 'root',
155
- }]
156
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
157
-
158
- /**
159
- * @inheritdoc
160
- */
161
- class DaffInMemoryCartPaymentMethodsService extends DaffInMemoryDriverBase {
162
- constructor(http, config) {
163
- super(config, DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME);
164
- this.http = http;
165
- }
166
- list(cartId) {
167
- return this.http.get(`${this.url}/${cartId}`);
168
- }
169
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartPaymentMethodsService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
170
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartPaymentMethodsService, providedIn: 'root' }); }
171
- }
172
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartPaymentMethodsService, decorators: [{
173
- type: Injectable,
174
- args: [{
175
- providedIn: 'root',
176
- }]
177
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
178
-
179
- /**
180
- * @inheritdoc
181
- */
182
- class DaffInMemoryCartShippingAddressService extends DaffInMemoryDriverBase {
183
- constructor(http, config) {
184
- super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME);
185
- this.http = http;
186
- }
187
- get(cartId) {
188
- return this.http.get(`${this.url}/${cartId}`);
189
- }
190
- update(cartId, address) {
191
- return this.http.put(`${this.url}/${cartId}`, address);
192
- }
193
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingAddressService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
194
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingAddressService, providedIn: 'root' }); }
195
- }
196
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingAddressService, decorators: [{
197
- type: Injectable,
198
- args: [{
199
- providedIn: 'root',
200
- }]
201
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
202
-
203
- /**
204
- * @inheritdoc
205
- */
206
- class DaffInMemoryCartShippingInformationService extends DaffInMemoryDriverBase {
207
- constructor(http, config) {
208
- super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME);
209
- this.http = http;
210
- }
211
- get(cartId) {
212
- return this.http.get(`${this.url}/${cartId}`);
213
- }
214
- update(cartId, info) {
215
- return this.http.put(`${this.url}/${cartId}`, info);
216
- }
217
- delete(cartId) {
218
- return this.http.delete(`${this.url}/${cartId}`);
219
- }
220
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingInformationService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
221
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingInformationService, providedIn: 'root' }); }
222
- }
223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingInformationService, decorators: [{
224
- type: Injectable,
225
- args: [{
226
- providedIn: 'root',
227
- }]
228
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
229
-
230
- /**
231
- * @inheritdoc
232
- */
233
- class DaffInMemoryCartShippingMethodsService extends DaffInMemoryDriverBase {
234
- constructor(http, config) {
235
- super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME);
236
- this.http = http;
237
- }
238
- list(cartId) {
239
- return this.http.get(`${this.url}/${cartId}`);
240
- }
241
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingMethodsService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
242
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingMethodsService, providedIn: 'root' }); }
243
- }
244
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartShippingMethodsService, decorators: [{
245
- type: Injectable,
246
- args: [{
247
- providedIn: 'root',
248
- }]
249
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
250
-
251
- /**
252
- * @inheritdoc
253
- */
254
- class DaffInMemoryCartOrderService extends DaffInMemoryDriverBase {
255
- constructor(http, config) {
256
- super(config, DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME);
257
- this.http = http;
258
- }
259
- placeOrder(cartId, payment) {
260
- return this.http.post(`${this.url}/${cartId}/`, { payment });
261
- }
262
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartOrderService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
263
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartOrderService, providedIn: 'root' }); }
264
- }
265
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartOrderService, decorators: [{
266
- type: Injectable,
267
- args: [{
268
- providedIn: 'root',
269
- }]
270
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
271
-
272
- /**
273
- * @inheritdoc
274
- */
275
- class DaffInMemoryCartCouponService extends DaffInMemoryDriverBase {
276
- constructor(http, config) {
277
- super(config, DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME);
278
- this.http = http;
279
- }
280
- list(cartId) {
281
- return this.http.get(`${this.url}/${cartId}/`);
282
- }
283
- apply(cartId, coupon) {
284
- return this.http.post(`${this.url}/${cartId}/`, coupon);
285
- }
286
- remove(cartId, coupon) {
287
- return this.http.delete(`${this.url}/${cartId}/${coupon.code}`);
288
- }
289
- removeAll(cartId) {
290
- return this.http.delete(`${this.url}/${cartId}/`);
291
- }
292
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartCouponService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
293
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartCouponService, providedIn: 'root' }); }
294
- }
295
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartCouponService, decorators: [{
296
- type: Injectable,
297
- args: [{
298
- providedIn: 'root',
299
- }]
300
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
301
-
302
- /**
303
- * @inheritdoc
304
- */
305
- class DaffInMemoryCartAddressService extends DaffInMemoryDriverBase {
306
- constructor(http, config) {
307
- super(config, DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME);
308
- this.http = http;
309
- }
310
- update(cartId, address) {
311
- return this.http.put(`${this.url}/${cartId}`, address);
312
- }
313
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartAddressService, deps: [{ token: i1.HttpClient }, { token: i2.InMemoryBackendConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
314
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartAddressService, providedIn: 'root' }); }
315
- }
316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryCartAddressService, decorators: [{
317
- type: Injectable,
318
- args: [{
319
- providedIn: 'root',
320
- }]
321
- }], ctorParameters: () => [{ type: i1.HttpClient }, { type: i2.InMemoryBackendConfig }] });
322
-
1
+ import * as i1$1 from "@angular/common/http";
2
+ import * as i0 from "@angular/core";
3
+ import { Inject, Injectable, NgModule, makeEnvironmentProviders } from "@angular/core";
4
+ import * as i2$1 from "angular-in-memory-web-api";
5
+ import { STATUS } from "angular-in-memory-web-api";
6
+ import { of, throwError } from "rxjs";
7
+ import { catchError, map } from "rxjs/operators";
8
+ import { DaffCartNotFoundError, provideDaffCartAddressDriver, provideDaffCartBillingAddressDriver, provideDaffCartCouponDriver, provideDaffCartDriver, provideDaffCartItemDriver, provideDaffCartOrderDriver, provideDaffCartPaymentDriver, provideDaffCartPaymentMethodsDriver, provideDaffCartShippingAddressDriver, provideDaffCartShippingInformationDriver, provideDaffCartShippingMethodsDriver } from "@daffodil/cart/driver";
9
+ import { DAFF_IN_MEMORY_DRIVER_CONFIG, DaffInMemoryBackendDelegate, DaffInMemoryDriverBase, provideDaffInMemoryBackends } from "@daffodil/driver/in-memory";
10
+ import { CommonModule } from "@angular/common";
11
+ import * as i1 from "@daffodil/cart/testing";
12
+ import * as i2 from "@daffodil/product/driver/in-memory";
13
+ import { faker } from "@faker-js/faker/locale/en_US";
14
+ import { DaffCartTotalTypeEnum } from "@daffodil/cart";
15
+ import { createSingleInjectionToken, daffMultiply } from "@daffodil/core";
16
+ const DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME = "cart";
17
+ const DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME = "cart-items";
18
+ const DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME = "cart-order";
19
+ const DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME = "cart-coupon";
20
+ const DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME = "cart-address";
21
+ const DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME = "cart-shipping-address";
22
+ const DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME = "cart-billing-address";
23
+ const DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME = "cart-payment-methods";
24
+ const DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME = "cart-shipping-methods";
25
+ const DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME = "cart-payment";
26
+ const DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME = "cart-shipping-information";
27
+ var DaffInMemoryCartService = class DaffInMemoryCartService extends DaffInMemoryDriverBase {
28
+ constructor(http, config) {
29
+ super(config, DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME);
30
+ this.http = http;
31
+ }
32
+ get(cartId) {
33
+ return this.http.get(`${this.url}/${cartId}`).pipe(catchError((error) => throwError(() => new DaffCartNotFoundError(error.message))), map((result) => ({
34
+ response: result,
35
+ errors: []
36
+ })));
37
+ }
38
+ addToCart(productId, qty) {
39
+ return this.http.post(this.url + "/addToCart", {
40
+ productId,
41
+ qty
42
+ });
43
+ }
44
+ clear(cartId) {
45
+ return this.http.post(`${this.url}/${cartId}/clear`, {});
46
+ }
47
+ create() {
48
+ return this.http.post(this.url, {});
49
+ }
50
+ merge(guestCart, customerCart) {
51
+ return this.http.post(`${this.url}/${guestCart}/merge`, {
52
+ source: guestCart,
53
+ destination: customerCart
54
+ }).pipe(catchError((error) => throwError(() => new DaffCartNotFoundError(error.message))), map((result) => ({
55
+ response: result,
56
+ errors: []
57
+ })));
58
+ }
59
+ static {
60
+ this.ɵfac = i0.ɵɵngDeclareFactory({
61
+ minVersion: "12.0.0",
62
+ version: "22.2.4",
63
+ ngImport: i0,
64
+ type: DaffInMemoryCartService,
65
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
66
+ target: i0.ɵɵFactoryTarget.Injectable
67
+ });
68
+ }
69
+ static {
70
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
71
+ minVersion: "12.0.0",
72
+ version: "22.2.4",
73
+ ngImport: i0,
74
+ type: DaffInMemoryCartService,
75
+ providedIn: "root"
76
+ });
77
+ }
78
+ };
79
+ i0.ɵɵngDeclareClassMetadata({
80
+ minVersion: "12.0.0",
81
+ version: "22.2.4",
82
+ ngImport: i0,
83
+ type: DaffInMemoryCartService,
84
+ decorators: [{
85
+ type: Injectable,
86
+ args: [{ providedIn: "root" }]
87
+ }],
88
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
89
+ });
90
+ var DaffInMemoryCartItemService = class DaffInMemoryCartItemService extends DaffInMemoryDriverBase {
91
+ constructor(http, config) {
92
+ super(config, DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME);
93
+ this.http = http;
94
+ }
95
+ list(cartId) {
96
+ return this.http.get(`${this.url}/${cartId}/`);
97
+ }
98
+ get(cartId, itemId) {
99
+ return this.http.get(`${this.url}/${cartId}/${itemId}`);
100
+ }
101
+ add(cartId, input) {
102
+ return this.http.post(`${this.url}/${cartId}/`, input);
103
+ }
104
+ update(cartId, itemId, item) {
105
+ return this.http.put(`${this.url}/${cartId}/${itemId}`, item);
106
+ }
107
+ delete(cartId, itemId) {
108
+ return this.http.delete(`${this.url}/${cartId}/${itemId}`);
109
+ }
110
+ static {
111
+ this.ɵfac = i0.ɵɵngDeclareFactory({
112
+ minVersion: "12.0.0",
113
+ version: "22.2.4",
114
+ ngImport: i0,
115
+ type: DaffInMemoryCartItemService,
116
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
117
+ target: i0.ɵɵFactoryTarget.Injectable
118
+ });
119
+ }
120
+ static {
121
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
122
+ minVersion: "12.0.0",
123
+ version: "22.2.4",
124
+ ngImport: i0,
125
+ type: DaffInMemoryCartItemService,
126
+ providedIn: "root"
127
+ });
128
+ }
129
+ };
130
+ i0.ɵɵngDeclareClassMetadata({
131
+ minVersion: "12.0.0",
132
+ version: "22.2.4",
133
+ ngImport: i0,
134
+ type: DaffInMemoryCartItemService,
135
+ decorators: [{
136
+ type: Injectable,
137
+ args: [{ providedIn: "root" }]
138
+ }],
139
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
140
+ });
141
+ var DaffInMemoryCartBillingAddressService = class DaffInMemoryCartBillingAddressService extends DaffInMemoryDriverBase {
142
+ constructor(http, config) {
143
+ super(config, DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME);
144
+ this.http = http;
145
+ }
146
+ get(cartId) {
147
+ return this.http.get(`${this.url}/${cartId}`);
148
+ }
149
+ update(cartId, address) {
150
+ return this.http.put(`${this.url}/${cartId}`, address);
151
+ }
152
+ static {
153
+ this.ɵfac = i0.ɵɵngDeclareFactory({
154
+ minVersion: "12.0.0",
155
+ version: "22.2.4",
156
+ ngImport: i0,
157
+ type: DaffInMemoryCartBillingAddressService,
158
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
159
+ target: i0.ɵɵFactoryTarget.Injectable
160
+ });
161
+ }
162
+ static {
163
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
164
+ minVersion: "12.0.0",
165
+ version: "22.2.4",
166
+ ngImport: i0,
167
+ type: DaffInMemoryCartBillingAddressService,
168
+ providedIn: "root"
169
+ });
170
+ }
171
+ };
172
+ i0.ɵɵngDeclareClassMetadata({
173
+ minVersion: "12.0.0",
174
+ version: "22.2.4",
175
+ ngImport: i0,
176
+ type: DaffInMemoryCartBillingAddressService,
177
+ decorators: [{
178
+ type: Injectable,
179
+ args: [{ providedIn: "root" }]
180
+ }],
181
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
182
+ });
183
+ var DaffInMemoryCartPaymentService = class DaffInMemoryCartPaymentService extends DaffInMemoryDriverBase {
184
+ constructor(http, config) {
185
+ super(config, DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME);
186
+ this.http = http;
187
+ }
188
+ get(cartId) {
189
+ return this.http.get(`${this.url}/${cartId}`);
190
+ }
191
+ update(cartId, payment) {
192
+ return this.http.put(`${this.url}/${cartId}`, { payment });
193
+ }
194
+ updateWithBilling(cartId, payment, address) {
195
+ return this.http.put(`${this.url}/${cartId}`, {
196
+ payment,
197
+ address
198
+ });
199
+ }
200
+ remove(cartId) {
201
+ return this.http.delete(`${this.url}/${cartId}`);
202
+ }
203
+ static {
204
+ this.ɵfac = i0.ɵɵngDeclareFactory({
205
+ minVersion: "12.0.0",
206
+ version: "22.2.4",
207
+ ngImport: i0,
208
+ type: DaffInMemoryCartPaymentService,
209
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
210
+ target: i0.ɵɵFactoryTarget.Injectable
211
+ });
212
+ }
213
+ static {
214
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
215
+ minVersion: "12.0.0",
216
+ version: "22.2.4",
217
+ ngImport: i0,
218
+ type: DaffInMemoryCartPaymentService,
219
+ providedIn: "root"
220
+ });
221
+ }
222
+ };
223
+ i0.ɵɵngDeclareClassMetadata({
224
+ minVersion: "12.0.0",
225
+ version: "22.2.4",
226
+ ngImport: i0,
227
+ type: DaffInMemoryCartPaymentService,
228
+ decorators: [{
229
+ type: Injectable,
230
+ args: [{ providedIn: "root" }]
231
+ }],
232
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
233
+ });
234
+ var DaffInMemoryCartPaymentMethodsService = class DaffInMemoryCartPaymentMethodsService extends DaffInMemoryDriverBase {
235
+ constructor(http, config) {
236
+ super(config, DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME);
237
+ this.http = http;
238
+ }
239
+ list(cartId) {
240
+ return this.http.get(`${this.url}/${cartId}`);
241
+ }
242
+ static {
243
+ this.ɵfac = i0.ɵɵngDeclareFactory({
244
+ minVersion: "12.0.0",
245
+ version: "22.2.4",
246
+ ngImport: i0,
247
+ type: DaffInMemoryCartPaymentMethodsService,
248
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
249
+ target: i0.ɵɵFactoryTarget.Injectable
250
+ });
251
+ }
252
+ static {
253
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
254
+ minVersion: "12.0.0",
255
+ version: "22.2.4",
256
+ ngImport: i0,
257
+ type: DaffInMemoryCartPaymentMethodsService,
258
+ providedIn: "root"
259
+ });
260
+ }
261
+ };
262
+ i0.ɵɵngDeclareClassMetadata({
263
+ minVersion: "12.0.0",
264
+ version: "22.2.4",
265
+ ngImport: i0,
266
+ type: DaffInMemoryCartPaymentMethodsService,
267
+ decorators: [{
268
+ type: Injectable,
269
+ args: [{ providedIn: "root" }]
270
+ }],
271
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
272
+ });
273
+ var DaffInMemoryCartShippingAddressService = class DaffInMemoryCartShippingAddressService extends DaffInMemoryDriverBase {
274
+ constructor(http, config) {
275
+ super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME);
276
+ this.http = http;
277
+ }
278
+ get(cartId) {
279
+ return this.http.get(`${this.url}/${cartId}`);
280
+ }
281
+ update(cartId, address) {
282
+ return this.http.put(`${this.url}/${cartId}`, address);
283
+ }
284
+ static {
285
+ this.ɵfac = i0.ɵɵngDeclareFactory({
286
+ minVersion: "12.0.0",
287
+ version: "22.2.4",
288
+ ngImport: i0,
289
+ type: DaffInMemoryCartShippingAddressService,
290
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
291
+ target: i0.ɵɵFactoryTarget.Injectable
292
+ });
293
+ }
294
+ static {
295
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
296
+ minVersion: "12.0.0",
297
+ version: "22.2.4",
298
+ ngImport: i0,
299
+ type: DaffInMemoryCartShippingAddressService,
300
+ providedIn: "root"
301
+ });
302
+ }
303
+ };
304
+ i0.ɵɵngDeclareClassMetadata({
305
+ minVersion: "12.0.0",
306
+ version: "22.2.4",
307
+ ngImport: i0,
308
+ type: DaffInMemoryCartShippingAddressService,
309
+ decorators: [{
310
+ type: Injectable,
311
+ args: [{ providedIn: "root" }]
312
+ }],
313
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
314
+ });
315
+ var DaffInMemoryCartShippingInformationService = class DaffInMemoryCartShippingInformationService extends DaffInMemoryDriverBase {
316
+ constructor(http, config) {
317
+ super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME);
318
+ this.http = http;
319
+ }
320
+ get(cartId) {
321
+ return this.http.get(`${this.url}/${cartId}`);
322
+ }
323
+ update(cartId, info) {
324
+ return this.http.put(`${this.url}/${cartId}`, info);
325
+ }
326
+ delete(cartId) {
327
+ return this.http.delete(`${this.url}/${cartId}`);
328
+ }
329
+ static {
330
+ this.ɵfac = i0.ɵɵngDeclareFactory({
331
+ minVersion: "12.0.0",
332
+ version: "22.2.4",
333
+ ngImport: i0,
334
+ type: DaffInMemoryCartShippingInformationService,
335
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
336
+ target: i0.ɵɵFactoryTarget.Injectable
337
+ });
338
+ }
339
+ static {
340
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
341
+ minVersion: "12.0.0",
342
+ version: "22.2.4",
343
+ ngImport: i0,
344
+ type: DaffInMemoryCartShippingInformationService,
345
+ providedIn: "root"
346
+ });
347
+ }
348
+ };
349
+ i0.ɵɵngDeclareClassMetadata({
350
+ minVersion: "12.0.0",
351
+ version: "22.2.4",
352
+ ngImport: i0,
353
+ type: DaffInMemoryCartShippingInformationService,
354
+ decorators: [{
355
+ type: Injectable,
356
+ args: [{ providedIn: "root" }]
357
+ }],
358
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
359
+ });
360
+ var DaffInMemoryCartShippingMethodsService = class DaffInMemoryCartShippingMethodsService extends DaffInMemoryDriverBase {
361
+ constructor(http, config) {
362
+ super(config, DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME);
363
+ this.http = http;
364
+ }
365
+ list(cartId) {
366
+ return this.http.get(`${this.url}/${cartId}`);
367
+ }
368
+ static {
369
+ this.ɵfac = i0.ɵɵngDeclareFactory({
370
+ minVersion: "12.0.0",
371
+ version: "22.2.4",
372
+ ngImport: i0,
373
+ type: DaffInMemoryCartShippingMethodsService,
374
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
375
+ target: i0.ɵɵFactoryTarget.Injectable
376
+ });
377
+ }
378
+ static {
379
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
380
+ minVersion: "12.0.0",
381
+ version: "22.2.4",
382
+ ngImport: i0,
383
+ type: DaffInMemoryCartShippingMethodsService,
384
+ providedIn: "root"
385
+ });
386
+ }
387
+ };
388
+ i0.ɵɵngDeclareClassMetadata({
389
+ minVersion: "12.0.0",
390
+ version: "22.2.4",
391
+ ngImport: i0,
392
+ type: DaffInMemoryCartShippingMethodsService,
393
+ decorators: [{
394
+ type: Injectable,
395
+ args: [{ providedIn: "root" }]
396
+ }],
397
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
398
+ });
399
+ var DaffInMemoryCartOrderService = class DaffInMemoryCartOrderService extends DaffInMemoryDriverBase {
400
+ constructor(http, config) {
401
+ super(config, DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME);
402
+ this.http = http;
403
+ }
404
+ placeOrder(cartId, payment) {
405
+ return this.http.post(`${this.url}/${cartId}/`, { payment });
406
+ }
407
+ static {
408
+ this.ɵfac = i0.ɵɵngDeclareFactory({
409
+ minVersion: "12.0.0",
410
+ version: "22.2.4",
411
+ ngImport: i0,
412
+ type: DaffInMemoryCartOrderService,
413
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
414
+ target: i0.ɵɵFactoryTarget.Injectable
415
+ });
416
+ }
417
+ static {
418
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
419
+ minVersion: "12.0.0",
420
+ version: "22.2.4",
421
+ ngImport: i0,
422
+ type: DaffInMemoryCartOrderService,
423
+ providedIn: "root"
424
+ });
425
+ }
426
+ };
427
+ i0.ɵɵngDeclareClassMetadata({
428
+ minVersion: "12.0.0",
429
+ version: "22.2.4",
430
+ ngImport: i0,
431
+ type: DaffInMemoryCartOrderService,
432
+ decorators: [{
433
+ type: Injectable,
434
+ args: [{ providedIn: "root" }]
435
+ }],
436
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
437
+ });
438
+ var DaffInMemoryCartCouponService = class DaffInMemoryCartCouponService extends DaffInMemoryDriverBase {
439
+ constructor(http, config) {
440
+ super(config, DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME);
441
+ this.http = http;
442
+ }
443
+ list(cartId) {
444
+ return this.http.get(`${this.url}/${cartId}/`);
445
+ }
446
+ apply(cartId, coupon) {
447
+ return this.http.post(`${this.url}/${cartId}/`, coupon);
448
+ }
449
+ remove(cartId, coupon) {
450
+ return this.http.delete(`${this.url}/${cartId}/${coupon.code}`);
451
+ }
452
+ removeAll(cartId) {
453
+ return this.http.delete(`${this.url}/${cartId}/`);
454
+ }
455
+ static {
456
+ this.ɵfac = i0.ɵɵngDeclareFactory({
457
+ minVersion: "12.0.0",
458
+ version: "22.2.4",
459
+ ngImport: i0,
460
+ type: DaffInMemoryCartCouponService,
461
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
462
+ target: i0.ɵɵFactoryTarget.Injectable
463
+ });
464
+ }
465
+ static {
466
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
467
+ minVersion: "12.0.0",
468
+ version: "22.2.4",
469
+ ngImport: i0,
470
+ type: DaffInMemoryCartCouponService,
471
+ providedIn: "root"
472
+ });
473
+ }
474
+ };
475
+ i0.ɵɵngDeclareClassMetadata({
476
+ minVersion: "12.0.0",
477
+ version: "22.2.4",
478
+ ngImport: i0,
479
+ type: DaffInMemoryCartCouponService,
480
+ decorators: [{
481
+ type: Injectable,
482
+ args: [{ providedIn: "root" }]
483
+ }],
484
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
485
+ });
486
+ var DaffInMemoryCartAddressService = class DaffInMemoryCartAddressService extends DaffInMemoryDriverBase {
487
+ constructor(http, config) {
488
+ super(config, DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME);
489
+ this.http = http;
490
+ }
491
+ update(cartId, address) {
492
+ return this.http.put(`${this.url}/${cartId}`, address);
493
+ }
494
+ static {
495
+ this.ɵfac = i0.ɵɵngDeclareFactory({
496
+ minVersion: "12.0.0",
497
+ version: "22.2.4",
498
+ ngImport: i0,
499
+ type: DaffInMemoryCartAddressService,
500
+ deps: [{ token: i1$1.HttpClient }, { token: i2$1.InMemoryBackendConfig }],
501
+ target: i0.ɵɵFactoryTarget.Injectable
502
+ });
503
+ }
504
+ static {
505
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
506
+ minVersion: "12.0.0",
507
+ version: "22.2.4",
508
+ ngImport: i0,
509
+ type: DaffInMemoryCartAddressService,
510
+ providedIn: "root"
511
+ });
512
+ }
513
+ };
514
+ i0.ɵɵngDeclareClassMetadata({
515
+ minVersion: "12.0.0",
516
+ version: "22.2.4",
517
+ ngImport: i0,
518
+ type: DaffInMemoryCartAddressService,
519
+ decorators: [{
520
+ type: Injectable,
521
+ args: [{ providedIn: "root" }]
522
+ }],
523
+ ctorParameters: () => [{ type: i1$1.HttpClient }, { type: i2$1.InMemoryBackendConfig }]
524
+ });
323
525
  function daffCartInMemoryComputeCartTotals(cart, products) {
324
- const shipping = cart.shipping_information ? faker.number.int({ min: 0, max: 99 }) : 0;
325
- const subtotalExcludingTax = cart.items?.reduce((acc, { product_id }) => acc + (products.find(({ id }) => id === product_id)?.price || 0), 0) || 0;
326
- const discount = faker.number.int({ min: 0, max: subtotalExcludingTax });
327
- const subtotalIncludingTax = subtotalExcludingTax + cart.totals[DaffCartTotalTypeEnum.tax].value;
328
- const subtotalWithDiscountExcludingTax = subtotalExcludingTax - discount;
329
- const subtotalWithDiscountIncludingTax = subtotalIncludingTax - discount;
330
- const grandTotal = subtotalWithDiscountIncludingTax + shipping;
331
- return {
332
- ...cart,
333
- totals: {
334
- ...cart.totals,
335
- [DaffCartTotalTypeEnum.shipping]: {
336
- ...cart.totals[DaffCartTotalTypeEnum.shipping],
337
- value: shipping,
338
- },
339
- [DaffCartTotalTypeEnum.subtotalExcludingTax]: {
340
- ...cart.totals[DaffCartTotalTypeEnum.subtotalExcludingTax],
341
- value: subtotalExcludingTax,
342
- },
343
- [DaffCartTotalTypeEnum.discount]: {
344
- ...cart.totals[DaffCartTotalTypeEnum.discount],
345
- value: discount,
346
- },
347
- [DaffCartTotalTypeEnum.subtotalIncludingTax]: {
348
- ...cart.totals[DaffCartTotalTypeEnum.subtotalIncludingTax],
349
- value: subtotalIncludingTax,
350
- },
351
- [DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax]: {
352
- ...cart.totals[DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax],
353
- value: subtotalWithDiscountExcludingTax,
354
- },
355
- [DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax]: {
356
- ...cart.totals[DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax],
357
- value: subtotalWithDiscountIncludingTax,
358
- },
359
- [DaffCartTotalTypeEnum.grandTotal]: {
360
- ...cart.totals[DaffCartTotalTypeEnum.grandTotal],
361
- value: grandTotal,
362
- },
363
- },
364
- };
365
- }
366
-
367
- const {
368
- /**
369
- * Allows an app dev to generate extra fields in the in-memory backend.
370
- * This enables the in-memory drivers to return responses similar to what the
371
- * frontend would expect from the production platform.
372
- *
373
- * The value returned by the hook function will be set to the returned cart's `extra_attributes` field
374
- * for driver calls that return a cart.
375
- *
376
- * Note that this and any `extra_attributes` features are for advanced users
377
- * and should be used with care.
378
- *
379
- * @example Adding the `numberOfCartItems` field to `extra_attributes`
380
- * ```ts
381
- * (reqInfo: RequestInfo, cart: DaffCart) => ({
382
- * numberOfCartItems: cart.items.length
383
- * })
384
- * ```
385
- */
386
- token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,
387
- /**
388
- * Provider function for {@link DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK}.
389
- */
390
- provider: provideDaffCartInMemoryExtraAttributesHook, } = createSingleInjectionToken('DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK', { factory: () => (reqInfo, cart) => ({}) });
391
-
392
- /**
393
- * @inheritdoc
394
- */
395
- class DaffInMemoryBackendCartService {
396
- constructor(cartFactory, extraFieldsHook, productBackend) {
397
- this.cartFactory = cartFactory;
398
- this.extraFieldsHook = extraFieldsHook;
399
- this.productBackend = productBackend;
400
- this.collectionName = DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME;
401
- }
402
- get(reqInfo) {
403
- return reqInfo.utils.createResponse$(() => this.getCart(reqInfo));
404
- }
405
- post(reqInfo) {
406
- return reqInfo.utils.createResponse$(() => {
407
- let ret;
408
- const action = this.getAction(reqInfo);
409
- if (reqInfo.id === 'addToCart') {
410
- // deprecated
411
- ret = {
412
- body: {},
413
- status: STATUS.OK,
414
- };
415
- }
416
- else if (action === 'clear') {
417
- ret = this.clear(reqInfo);
418
- }
419
- else if (action === 'merge') {
420
- ret = this.merge(reqInfo);
421
- }
422
- else {
423
- ret = this.create(reqInfo);
424
- }
425
- return ret;
426
- });
427
- }
428
- /**
429
- * Gets whatever follows the cart ID section of the request URL.
430
- */
431
- getAction(reqInfo) {
432
- return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');
433
- }
434
- clear(reqInfo) {
435
- const cart = this.getCart(reqInfo).body;
436
- cart.items = [];
437
- return {
438
- body: {
439
- ...cart,
440
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
441
- },
442
- status: STATUS.OK,
443
- };
444
- }
445
- create(reqInfo) {
446
- const cart = this.cartFactory.create();
447
- reqInfo.collection.push(cart);
448
- return {
449
- body: {
450
- id: cart.id,
451
- },
452
- status: STATUS.OK,
453
- };
454
- }
455
- merge(reqInfo) {
456
- const { source, destination, } = reqInfo.utils.getJsonBody(reqInfo.req);
457
- const sourceCart = reqInfo.utils.findById(reqInfo.collection, source);
458
- if (!sourceCart) {
459
- return {
460
- status: STATUS.NOT_FOUND,
461
- };
462
- }
463
- const destinationCart = reqInfo.utils.findById(reqInfo.collection, destination ? destination : this.create(reqInfo).body.id);
464
- if (!destinationCart) {
465
- return {
466
- status: STATUS.NOT_FOUND,
467
- };
468
- }
469
- destinationCart.items.push(...sourceCart.items);
470
- reqInfo.collection.push(destinationCart);
471
- return {
472
- body: {
473
- ...destinationCart,
474
- extra_attributes: this.extraFieldsHook(reqInfo, destinationCart),
475
- },
476
- status: STATUS.OK,
477
- };
478
- }
479
- getCart(reqInfo) {
480
- const cart = reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
481
- return cart
482
- ? {
483
- body: {
484
- ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
485
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
486
- },
487
- status: STATUS.OK,
488
- }
489
- : {
490
- status: STATUS.NOT_FOUND,
491
- };
492
- }
493
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", 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 }); }
494
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartService, providedIn: 'root' }); }
526
+ const shipping = cart.shipping_information ? faker.number.int({
527
+ min: 0,
528
+ max: 99
529
+ }) : 0;
530
+ const subtotalExcludingTax = cart.items?.reduce((acc, { product_id }) => acc + (products.find(({ id }) => id === product_id)?.price || 0), 0) || 0;
531
+ const discount = faker.number.int({
532
+ min: 0,
533
+ max: subtotalExcludingTax
534
+ });
535
+ const subtotalIncludingTax = subtotalExcludingTax + cart.totals[DaffCartTotalTypeEnum.tax].value;
536
+ const subtotalWithDiscountExcludingTax = subtotalExcludingTax - discount;
537
+ const subtotalWithDiscountIncludingTax = subtotalIncludingTax - discount;
538
+ const grandTotal = subtotalWithDiscountIncludingTax + shipping;
539
+ return {
540
+ ...cart,
541
+ totals: {
542
+ ...cart.totals,
543
+ [DaffCartTotalTypeEnum.shipping]: {
544
+ ...cart.totals[DaffCartTotalTypeEnum.shipping],
545
+ value: shipping
546
+ },
547
+ [DaffCartTotalTypeEnum.subtotalExcludingTax]: {
548
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalExcludingTax],
549
+ value: subtotalExcludingTax
550
+ },
551
+ [DaffCartTotalTypeEnum.discount]: {
552
+ ...cart.totals[DaffCartTotalTypeEnum.discount],
553
+ value: discount
554
+ },
555
+ [DaffCartTotalTypeEnum.subtotalIncludingTax]: {
556
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalIncludingTax],
557
+ value: subtotalIncludingTax
558
+ },
559
+ [DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax]: {
560
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax],
561
+ value: subtotalWithDiscountExcludingTax
562
+ },
563
+ [DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax]: {
564
+ ...cart.totals[DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax],
565
+ value: subtotalWithDiscountIncludingTax
566
+ },
567
+ [DaffCartTotalTypeEnum.grandTotal]: {
568
+ ...cart.totals[DaffCartTotalTypeEnum.grandTotal],
569
+ value: grandTotal
570
+ }
571
+ }
572
+ };
495
573
  }
496
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartService, decorators: [{
497
- type: Injectable,
498
- args: [{
499
- providedIn: 'root',
500
- }]
501
- }], ctorParameters: () => [{ type: i1$1.DaffCartFactory }, { type: undefined, decorators: [{
502
- type: Inject,
503
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
504
- }] }, { type: i2$1.DaffInMemoryBackendProductService }] });
505
-
506
- /**
507
- * @inheritdoc
508
- */
509
- class DaffInMemoryBackendCartAddressService {
510
- constructor(extraFieldsHook) {
511
- this.extraFieldsHook = extraFieldsHook;
512
- this.collectionName = DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME;
513
- }
514
- put(reqInfo) {
515
- return reqInfo.utils.createResponse$(() => ({
516
- body: this.updateAddress(reqInfo),
517
- status: STATUS.OK,
518
- }));
519
- }
520
- getCart(reqInfo) {
521
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
522
- }
523
- updateAddress(reqInfo) {
524
- const cart = this.getCart(reqInfo);
525
- const address = reqInfo.utils.getJsonBody(reqInfo.req);
526
- cart.billing_address = address;
527
- cart.shipping_address = address;
528
- return {
529
- ...cart,
530
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
531
- };
532
- }
533
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartAddressService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable }); }
534
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartAddressService, providedIn: 'root' }); }
535
- }
536
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartAddressService, decorators: [{
537
- type: Injectable,
538
- args: [{
539
- providedIn: 'root',
540
- }]
541
- }], ctorParameters: () => [{ type: undefined, decorators: [{
542
- type: Inject,
543
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
544
- }] }] });
545
-
546
- /**
547
- * @inheritdoc
548
- */
549
- class DaffInMemoryBackendCartBillingAddressService {
550
- constructor(extraFieldsHook) {
551
- this.extraFieldsHook = extraFieldsHook;
552
- this.collectionName = DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME;
553
- }
554
- get(reqInfo) {
555
- return reqInfo.utils.createResponse$(() => ({
556
- body: this.getBillingAddress(reqInfo),
557
- status: STATUS.OK,
558
- }));
559
- }
560
- put(reqInfo) {
561
- return reqInfo.utils.createResponse$(() => ({
562
- body: this.updateBillingAddress(reqInfo),
563
- status: STATUS.OK,
564
- }));
565
- }
566
- getCart(reqInfo) {
567
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
568
- }
569
- getBillingAddress(reqInfo) {
570
- return this.getCart(reqInfo).billing_address;
571
- }
572
- updateBillingAddress(reqInfo) {
573
- const cart = this.getCart(reqInfo);
574
- const address = reqInfo.utils.getJsonBody(reqInfo.req);
575
- cart.billing_address = address;
576
- return {
577
- ...cart,
578
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
579
- };
580
- }
581
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartBillingAddressService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable }); }
582
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartBillingAddressService, providedIn: 'root' }); }
583
- }
584
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartBillingAddressService, decorators: [{
585
- type: Injectable,
586
- args: [{
587
- providedIn: 'root',
588
- }]
589
- }], ctorParameters: () => [{ type: undefined, decorators: [{
590
- type: Inject,
591
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
592
- }] }] });
593
-
594
- /**
595
- * @inheritdoc
596
- */
597
- class DaffInMemoryBackendCartCouponService {
598
- constructor(extraFieldsHook) {
599
- this.extraFieldsHook = extraFieldsHook;
600
- this.collectionName = DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME;
601
- }
602
- get(reqInfo) {
603
- return reqInfo.utils.createResponse$(() => ({
604
- body: this.listCoupons(reqInfo),
605
- status: STATUS.OK,
606
- }));
607
- }
608
- post(reqInfo) {
609
- return reqInfo.utils.createResponse$(() => ({
610
- body: this.applyCoupon(reqInfo),
611
- status: STATUS.OK,
612
- }));
613
- }
614
- delete(reqInfo) {
615
- return reqInfo.utils.createResponse$(() => {
616
- let body;
617
- const action = this.getAction(reqInfo);
618
- if (action) {
619
- body = this.removeCoupon(reqInfo, action);
620
- }
621
- else {
622
- body = this.removeAllCoupons(reqInfo);
623
- }
624
- return {
625
- body,
626
- status: STATUS.OK,
627
- };
628
- });
629
- }
630
- /**
631
- * Gets whatever follows the cart ID section of the request URL.
632
- */
633
- getAction(reqInfo) {
634
- return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');
635
- }
636
- getCart(reqInfo) {
637
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
638
- }
639
- listCoupons(reqInfo) {
640
- return this.getCart(reqInfo).coupons;
641
- }
642
- applyCoupon(reqInfo) {
643
- const cart = this.getCart(reqInfo);
644
- const coupon = reqInfo.utils.getJsonBody(reqInfo.req);
645
- cart.coupons.push(coupon);
646
- return {
647
- ...cart,
648
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
649
- };
650
- }
651
- removeCoupon(reqInfo, couponCode) {
652
- const cart = this.getCart(reqInfo);
653
- cart.coupons = cart.coupons.filter(({ code }) => code !== couponCode);
654
- return {
655
- ...cart,
656
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
657
- };
658
- }
659
- removeAllCoupons(reqInfo) {
660
- const cart = this.getCart(reqInfo);
661
- cart.coupons = [];
662
- return {
663
- ...cart,
664
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
665
- };
666
- }
667
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartCouponService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable }); }
668
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartCouponService, providedIn: 'root' }); }
669
- }
670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartCouponService, decorators: [{
671
- type: Injectable,
672
- args: [{
673
- providedIn: 'root',
674
- }]
675
- }], ctorParameters: () => [{ type: undefined, decorators: [{
676
- type: Inject,
677
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
678
- }] }] });
679
-
574
+ const { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK, provider: provideDaffCartInMemoryExtraAttributesHook } = createSingleInjectionToken("DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK", { factory: () => (reqInfo, cart) => ({}) });
575
+ var DaffInMemoryBackendCartService = class DaffInMemoryBackendCartService {
576
+ constructor(cartFactory, extraFieldsHook, productBackend) {
577
+ this.cartFactory = cartFactory;
578
+ this.extraFieldsHook = extraFieldsHook;
579
+ this.productBackend = productBackend;
580
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_COLLECTION_NAME;
581
+ }
582
+ get(reqInfo) {
583
+ return reqInfo.utils.createResponse$(() => this.getCart(reqInfo));
584
+ }
585
+ post(reqInfo) {
586
+ return reqInfo.utils.createResponse$(() => {
587
+ let ret;
588
+ const action = this.getAction(reqInfo);
589
+ if (reqInfo.id === "addToCart") ret = {
590
+ body: {},
591
+ status: STATUS.OK
592
+ };
593
+ else if (action === "clear") ret = this.clear(reqInfo);
594
+ else if (action === "merge") ret = this.merge(reqInfo);
595
+ else ret = this.create(reqInfo);
596
+ return ret;
597
+ });
598
+ }
599
+ getAction(reqInfo) {
600
+ return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, "");
601
+ }
602
+ clear(reqInfo) {
603
+ const cart = this.getCart(reqInfo).body;
604
+ cart.items = [];
605
+ return {
606
+ body: {
607
+ ...cart,
608
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
609
+ },
610
+ status: STATUS.OK
611
+ };
612
+ }
613
+ create(reqInfo) {
614
+ const cart = this.cartFactory.create();
615
+ reqInfo.collection.push(cart);
616
+ return {
617
+ body: { id: cart.id },
618
+ status: STATUS.OK
619
+ };
620
+ }
621
+ merge(reqInfo) {
622
+ const { source, destination } = reqInfo.utils.getJsonBody(reqInfo.req);
623
+ const sourceCart = reqInfo.utils.findById(reqInfo.collection, source);
624
+ if (!sourceCart) return { status: STATUS.NOT_FOUND };
625
+ const destinationCart = reqInfo.utils.findById(reqInfo.collection, destination ? destination : this.create(reqInfo).body.id);
626
+ if (!destinationCart) return { status: STATUS.NOT_FOUND };
627
+ destinationCart.items.push(...sourceCart.items);
628
+ reqInfo.collection.push(destinationCart);
629
+ return {
630
+ body: {
631
+ ...destinationCart,
632
+ extra_attributes: this.extraFieldsHook(reqInfo, destinationCart)
633
+ },
634
+ status: STATUS.OK
635
+ };
636
+ }
637
+ getCart(reqInfo) {
638
+ const cart = reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
639
+ return cart ? {
640
+ body: {
641
+ ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
642
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
643
+ },
644
+ status: STATUS.OK
645
+ } : { status: STATUS.NOT_FOUND };
646
+ }
647
+ static {
648
+ this.ɵfac = i0.ɵɵngDeclareFactory({
649
+ minVersion: "12.0.0",
650
+ version: "22.2.4",
651
+ ngImport: i0,
652
+ type: DaffInMemoryBackendCartService,
653
+ deps: [
654
+ { token: i1.DaffCartFactory },
655
+ { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK },
656
+ { token: i2.DaffInMemoryBackendProductService }
657
+ ],
658
+ target: i0.ɵɵFactoryTarget.Injectable
659
+ });
660
+ }
661
+ static {
662
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
663
+ minVersion: "12.0.0",
664
+ version: "22.2.4",
665
+ ngImport: i0,
666
+ type: DaffInMemoryBackendCartService,
667
+ providedIn: "root"
668
+ });
669
+ }
670
+ };
671
+ i0.ɵɵngDeclareClassMetadata({
672
+ minVersion: "12.0.0",
673
+ version: "22.2.4",
674
+ ngImport: i0,
675
+ type: DaffInMemoryBackendCartService,
676
+ decorators: [{
677
+ type: Injectable,
678
+ args: [{ providedIn: "root" }]
679
+ }],
680
+ ctorParameters: () => [
681
+ { type: i1.DaffCartFactory },
682
+ {
683
+ type: void 0,
684
+ decorators: [{
685
+ type: Inject,
686
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
687
+ }]
688
+ },
689
+ { type: i2.DaffInMemoryBackendProductService }
690
+ ]
691
+ });
692
+ var DaffInMemoryBackendCartAddressService = class DaffInMemoryBackendCartAddressService {
693
+ constructor(extraFieldsHook) {
694
+ this.extraFieldsHook = extraFieldsHook;
695
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_ADDRESS_COLLECTION_NAME;
696
+ }
697
+ put(reqInfo) {
698
+ return reqInfo.utils.createResponse$(() => ({
699
+ body: this.updateAddress(reqInfo),
700
+ status: STATUS.OK
701
+ }));
702
+ }
703
+ getCart(reqInfo) {
704
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
705
+ }
706
+ updateAddress(reqInfo) {
707
+ const cart = this.getCart(reqInfo);
708
+ const address = reqInfo.utils.getJsonBody(reqInfo.req);
709
+ cart.billing_address = address;
710
+ cart.shipping_address = address;
711
+ return {
712
+ ...cart,
713
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
714
+ };
715
+ }
716
+ static {
717
+ this.ɵfac = i0.ɵɵngDeclareFactory({
718
+ minVersion: "12.0.0",
719
+ version: "22.2.4",
720
+ ngImport: i0,
721
+ type: DaffInMemoryBackendCartAddressService,
722
+ deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }],
723
+ target: i0.ɵɵFactoryTarget.Injectable
724
+ });
725
+ }
726
+ static {
727
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
728
+ minVersion: "12.0.0",
729
+ version: "22.2.4",
730
+ ngImport: i0,
731
+ type: DaffInMemoryBackendCartAddressService,
732
+ providedIn: "root"
733
+ });
734
+ }
735
+ };
736
+ i0.ɵɵngDeclareClassMetadata({
737
+ minVersion: "12.0.0",
738
+ version: "22.2.4",
739
+ ngImport: i0,
740
+ type: DaffInMemoryBackendCartAddressService,
741
+ decorators: [{
742
+ type: Injectable,
743
+ args: [{ providedIn: "root" }]
744
+ }],
745
+ ctorParameters: () => [{
746
+ type: void 0,
747
+ decorators: [{
748
+ type: Inject,
749
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
750
+ }]
751
+ }]
752
+ });
753
+ var DaffInMemoryBackendCartBillingAddressService = class DaffInMemoryBackendCartBillingAddressService {
754
+ constructor(extraFieldsHook) {
755
+ this.extraFieldsHook = extraFieldsHook;
756
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_BILLING_ADDRESS_COLLECTION_NAME;
757
+ }
758
+ get(reqInfo) {
759
+ return reqInfo.utils.createResponse$(() => ({
760
+ body: this.getBillingAddress(reqInfo),
761
+ status: STATUS.OK
762
+ }));
763
+ }
764
+ put(reqInfo) {
765
+ return reqInfo.utils.createResponse$(() => ({
766
+ body: this.updateBillingAddress(reqInfo),
767
+ status: STATUS.OK
768
+ }));
769
+ }
770
+ getCart(reqInfo) {
771
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
772
+ }
773
+ getBillingAddress(reqInfo) {
774
+ return this.getCart(reqInfo).billing_address;
775
+ }
776
+ updateBillingAddress(reqInfo) {
777
+ const cart = this.getCart(reqInfo);
778
+ cart.billing_address = reqInfo.utils.getJsonBody(reqInfo.req);
779
+ return {
780
+ ...cart,
781
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
782
+ };
783
+ }
784
+ static {
785
+ this.ɵfac = i0.ɵɵngDeclareFactory({
786
+ minVersion: "12.0.0",
787
+ version: "22.2.4",
788
+ ngImport: i0,
789
+ type: DaffInMemoryBackendCartBillingAddressService,
790
+ deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }],
791
+ target: i0.ɵɵFactoryTarget.Injectable
792
+ });
793
+ }
794
+ static {
795
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
796
+ minVersion: "12.0.0",
797
+ version: "22.2.4",
798
+ ngImport: i0,
799
+ type: DaffInMemoryBackendCartBillingAddressService,
800
+ providedIn: "root"
801
+ });
802
+ }
803
+ };
804
+ i0.ɵɵngDeclareClassMetadata({
805
+ minVersion: "12.0.0",
806
+ version: "22.2.4",
807
+ ngImport: i0,
808
+ type: DaffInMemoryBackendCartBillingAddressService,
809
+ decorators: [{
810
+ type: Injectable,
811
+ args: [{ providedIn: "root" }]
812
+ }],
813
+ ctorParameters: () => [{
814
+ type: void 0,
815
+ decorators: [{
816
+ type: Inject,
817
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
818
+ }]
819
+ }]
820
+ });
821
+ var DaffInMemoryBackendCartCouponService = class DaffInMemoryBackendCartCouponService {
822
+ constructor(extraFieldsHook) {
823
+ this.extraFieldsHook = extraFieldsHook;
824
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_COUPON_COLLECTION_NAME;
825
+ }
826
+ get(reqInfo) {
827
+ return reqInfo.utils.createResponse$(() => ({
828
+ body: this.listCoupons(reqInfo),
829
+ status: STATUS.OK
830
+ }));
831
+ }
832
+ post(reqInfo) {
833
+ return reqInfo.utils.createResponse$(() => ({
834
+ body: this.applyCoupon(reqInfo),
835
+ status: STATUS.OK
836
+ }));
837
+ }
838
+ delete(reqInfo) {
839
+ return reqInfo.utils.createResponse$(() => {
840
+ let body;
841
+ const action = this.getAction(reqInfo);
842
+ if (action) body = this.removeCoupon(reqInfo, action);
843
+ else body = this.removeAllCoupons(reqInfo);
844
+ return {
845
+ body,
846
+ status: STATUS.OK
847
+ };
848
+ });
849
+ }
850
+ getAction(reqInfo) {
851
+ return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, "");
852
+ }
853
+ getCart(reqInfo) {
854
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
855
+ }
856
+ listCoupons(reqInfo) {
857
+ return this.getCart(reqInfo).coupons;
858
+ }
859
+ applyCoupon(reqInfo) {
860
+ const cart = this.getCart(reqInfo);
861
+ const coupon = reqInfo.utils.getJsonBody(reqInfo.req);
862
+ cart.coupons.push(coupon);
863
+ return {
864
+ ...cart,
865
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
866
+ };
867
+ }
868
+ removeCoupon(reqInfo, couponCode) {
869
+ const cart = this.getCart(reqInfo);
870
+ cart.coupons = cart.coupons.filter(({ code }) => code !== couponCode);
871
+ return {
872
+ ...cart,
873
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
874
+ };
875
+ }
876
+ removeAllCoupons(reqInfo) {
877
+ const cart = this.getCart(reqInfo);
878
+ cart.coupons = [];
879
+ return {
880
+ ...cart,
881
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
882
+ };
883
+ }
884
+ static {
885
+ this.ɵfac = i0.ɵɵngDeclareFactory({
886
+ minVersion: "12.0.0",
887
+ version: "22.2.4",
888
+ ngImport: i0,
889
+ type: DaffInMemoryBackendCartCouponService,
890
+ deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }],
891
+ target: i0.ɵɵFactoryTarget.Injectable
892
+ });
893
+ }
894
+ static {
895
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
896
+ minVersion: "12.0.0",
897
+ version: "22.2.4",
898
+ ngImport: i0,
899
+ type: DaffInMemoryBackendCartCouponService,
900
+ providedIn: "root"
901
+ });
902
+ }
903
+ };
904
+ i0.ɵɵngDeclareClassMetadata({
905
+ minVersion: "12.0.0",
906
+ version: "22.2.4",
907
+ ngImport: i0,
908
+ type: DaffInMemoryBackendCartCouponService,
909
+ decorators: [{
910
+ type: Injectable,
911
+ args: [{ providedIn: "root" }]
912
+ }],
913
+ ctorParameters: () => [{
914
+ type: void 0,
915
+ decorators: [{
916
+ type: Inject,
917
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
918
+ }]
919
+ }]
920
+ });
680
921
  function daffCartInMemoryComputeCartItemPrices(cartItem, products) {
681
- cartItem.price = products.find(({ id }) => id === cartItem.product_id)?.price || 0;
682
- cartItem.row_total = daffMultiply(cartItem.price, cartItem.qty);
683
- return cartItem;
684
- }
685
-
686
- /**
687
- * @inheritdoc
688
- */
689
- class DaffInMemoryBackendCartItemsService {
690
- constructor(cartItemFactory, extraFieldsHook, productBackend) {
691
- this.cartItemFactory = cartItemFactory;
692
- this.extraFieldsHook = extraFieldsHook;
693
- this.productBackend = productBackend;
694
- this.collectionName = DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME;
695
- }
696
- get(reqInfo) {
697
- return reqInfo.utils.createResponse$(() => {
698
- let body;
699
- const action = this.getAction(reqInfo);
700
- if (action) {
701
- body = this.getItem(reqInfo, action);
702
- }
703
- else {
704
- body = this.listItems(reqInfo);
705
- }
706
- return {
707
- body,
708
- status: STATUS.OK,
709
- };
710
- });
711
- }
712
- put(reqInfo) {
713
- return reqInfo.utils.createResponse$(() => ({
714
- body: this.updateItem(reqInfo, this.getAction(reqInfo)),
715
- status: STATUS.OK,
716
- }));
717
- }
718
- post(reqInfo) {
719
- return reqInfo.utils.createResponse$(() => ({
720
- body: this.addItem(reqInfo),
721
- status: STATUS.OK,
722
- }));
723
- }
724
- delete(reqInfo) {
725
- return reqInfo.utils.createResponse$(() => ({
726
- body: this.deleteItem(reqInfo, this.getAction(reqInfo)),
727
- status: STATUS.OK,
728
- }));
729
- }
730
- /**
731
- * Gets whatever follows the cart ID section of the request URL.
732
- */
733
- getAction(reqInfo) {
734
- return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');
735
- }
736
- getCart(reqInfo) {
737
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
738
- }
739
- transformItemInput(itemInput) {
740
- return {
741
- ...this.cartItemFactory.fromProduct(this.productBackend.products.find((product) => product.id === itemInput.productId)),
742
- ...itemInput,
743
- };
744
- }
745
- listItems(reqInfo) {
746
- return this.getCart(reqInfo).items;
747
- }
748
- getItem(reqInfo, itemId) {
749
- const cart = this.getCart(reqInfo);
750
- return cart.items.find(({ id }) => itemId === id);
751
- }
752
- updateItem(reqInfo, itemId) {
753
- const cart = this.getCart(reqInfo);
754
- const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);
755
- const itemChanges = reqInfo.utils.getJsonBody(reqInfo.req);
756
- const itemIndex = cart.items.findIndex((item) => itemId === item.id);
757
- reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
758
- ...cart,
759
- items: cart.items.map((item, index) => index === itemIndex ? daffCartInMemoryComputeCartItemPrices({
760
- ...cart.items[itemIndex],
761
- ...itemChanges,
762
- }, this.productBackend.products) : item),
763
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
764
- }, this.productBackend.products);
765
- return reqInfo.collection[cartIndex];
766
- }
767
- addItem(reqInfo) {
768
- const cart = this.getCart(reqInfo);
769
- const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);
770
- const itemInput = reqInfo.utils.getJsonBody(reqInfo.req);
771
- const existingCartItemIndex = cart.items.findIndex(item => item.product_id === itemInput.productId);
772
- if (existingCartItemIndex > -1) {
773
- const updatedCartItem = {
774
- ...cart.items[existingCartItemIndex],
775
- qty: cart.items[existingCartItemIndex].qty + itemInput.qty,
776
- };
777
- reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
778
- ...cart,
779
- items: cart.items.map((item, index) => index === existingCartItemIndex ? daffCartInMemoryComputeCartItemPrices(updatedCartItem, this.productBackend.products) : item),
780
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
781
- }, this.productBackend.products);
782
- }
783
- else {
784
- reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
785
- ...cart,
786
- items: [
787
- ...cart.items,
788
- daffCartInMemoryComputeCartItemPrices(this.transformItemInput(itemInput), this.productBackend.products),
789
- ],
790
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
791
- }, this.productBackend.products);
792
- }
793
- return reqInfo.collection[cartIndex];
794
- }
795
- deleteItem(reqInfo, itemId) {
796
- const cart = this.getCart(reqInfo);
797
- const itemIndex = cart.items.findIndex(({ id }) => itemId === id);
798
- const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);
799
- reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
800
- ...cart,
801
- items: cart.items.filter((item, index) => index !== itemIndex),
802
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
803
- }, this.productBackend.products);
804
- return reqInfo.collection[cartIndex];
805
- }
806
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", 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 }); }
807
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartItemsService, providedIn: 'root' }); }
808
- }
809
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartItemsService, decorators: [{
810
- type: Injectable,
811
- args: [{
812
- providedIn: 'root',
813
- }]
814
- }], ctorParameters: () => [{ type: i1$1.DaffCartItemFactory }, { type: undefined, decorators: [{
815
- type: Inject,
816
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
817
- }] }, { type: i2$1.DaffInMemoryBackendProductService }] });
818
-
819
- /**
820
- * @inheritdoc
821
- */
822
- class DaffInMemoryBackendCartOrderService {
823
- constructor() {
824
- this.collectionName = DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME;
825
- }
826
- post(reqInfo) {
827
- return reqInfo.utils.createResponse$(() => ({
828
- body: this.placeOrder(reqInfo),
829
- status: STATUS.OK,
830
- }));
831
- }
832
- placeOrder(reqInfo) {
833
- return {
834
- cartId: '89fdsa8sadf',
835
- orderId: '8235422034',
836
- };
837
- }
838
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartOrderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
839
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartOrderService, providedIn: 'root' }); }
840
- }
841
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartOrderService, decorators: [{
842
- type: Injectable,
843
- args: [{
844
- providedIn: 'root',
845
- }]
846
- }] });
847
-
848
- /**
849
- * @inheritdoc
850
- */
851
- class DaffInMemoryBackendCartPaymentService {
852
- constructor(extraFieldsHook) {
853
- this.extraFieldsHook = extraFieldsHook;
854
- this.collectionName = DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME;
855
- }
856
- get(reqInfo) {
857
- return reqInfo.utils.createResponse$(() => ({
858
- body: this.getPayment(reqInfo),
859
- status: STATUS.OK,
860
- }));
861
- }
862
- put(reqInfo) {
863
- return reqInfo.utils.createResponse$(() => ({
864
- body: this.updatePayment(reqInfo),
865
- status: STATUS.OK,
866
- }));
867
- }
868
- delete(reqInfo) {
869
- return reqInfo.utils.createResponse$(() => ({
870
- body: this.removePayment(reqInfo),
871
- status: STATUS.OK,
872
- }));
873
- }
874
- getCart(reqInfo) {
875
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
876
- }
877
- getPayment(reqInfo) {
878
- return this.getCart(reqInfo).payment;
879
- }
880
- updatePayment(reqInfo) {
881
- const cart = this.getCart(reqInfo);
882
- const { payment, address } = reqInfo.utils.getJsonBody(reqInfo.req);
883
- cart.payment = payment;
884
- if (address) {
885
- cart.billing_address = address;
886
- }
887
- return {
888
- ...cart,
889
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
890
- };
891
- }
892
- removePayment(reqInfo) {
893
- const cart = this.getCart(reqInfo);
894
- cart.payment = null;
895
- return {
896
- ...cart,
897
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
898
- };
899
- }
900
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartPaymentService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable }); }
901
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartPaymentService, providedIn: 'root' }); }
922
+ cartItem.price = products.find(({ id }) => id === cartItem.product_id)?.price || 0;
923
+ cartItem.row_total = daffMultiply(cartItem.price, cartItem.qty);
924
+ return cartItem;
902
925
  }
903
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartPaymentService, decorators: [{
904
- type: Injectable,
905
- args: [{
906
- providedIn: 'root',
907
- }]
908
- }], ctorParameters: () => [{ type: undefined, decorators: [{
909
- type: Inject,
910
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
911
- }] }] });
912
-
913
- /**
914
- * @inheritdoc
915
- */
916
- class DaffInMemoryBackendCartPaymentMethodsService {
917
- constructor() {
918
- this.collectionName = DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME;
919
- }
920
- get(reqInfo) {
921
- return reqInfo.utils.createResponse$(() => ({
922
- body: this.listPaymentMethods(reqInfo),
923
- status: STATUS.OK,
924
- }));
925
- }
926
- getCart(reqInfo) {
927
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
928
- }
929
- listPaymentMethods(reqInfo) {
930
- return this.getCart(reqInfo).available_payment_methods;
931
- }
932
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartPaymentMethodsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
933
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartPaymentMethodsService, providedIn: 'root' }); }
934
- }
935
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartPaymentMethodsService, decorators: [{
936
- type: Injectable,
937
- args: [{
938
- providedIn: 'root',
939
- }]
940
- }] });
941
-
942
- /**
943
- * @inheritdoc
944
- */
945
- class DaffInMemoryBackendCartShippingAddressService {
946
- constructor(extraFieldsHook) {
947
- this.extraFieldsHook = extraFieldsHook;
948
- this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME;
949
- }
950
- get(reqInfo) {
951
- return reqInfo.utils.createResponse$(() => ({
952
- body: this.getShippingAddress(reqInfo),
953
- status: STATUS.OK,
954
- }));
955
- }
956
- put(reqInfo) {
957
- return reqInfo.utils.createResponse$(() => ({
958
- body: this.updateShippingAddress(reqInfo),
959
- status: STATUS.OK,
960
- }));
961
- }
962
- getCart(reqInfo) {
963
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
964
- }
965
- getShippingAddress(reqInfo) {
966
- return this.getCart(reqInfo).shipping_address;
967
- }
968
- updateShippingAddress(reqInfo) {
969
- const cart = this.getCart(reqInfo);
970
- const address = reqInfo.utils.getJsonBody(reqInfo.req);
971
- cart.shipping_address = address;
972
- return {
973
- ...cart,
974
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
975
- };
976
- }
977
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingAddressService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }], target: i0.ɵɵFactoryTarget.Injectable }); }
978
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingAddressService, providedIn: 'root' }); }
979
- }
980
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingAddressService, decorators: [{
981
- type: Injectable,
982
- args: [{
983
- providedIn: 'root',
984
- }]
985
- }], ctorParameters: () => [{ type: undefined, decorators: [{
986
- type: Inject,
987
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
988
- }] }] });
989
-
990
- /**
991
- * @inheritdoc
992
- */
993
- class DaffInMemoryBackendCartShippingInformationService {
994
- constructor(extraFieldsHook, productBackend) {
995
- this.extraFieldsHook = extraFieldsHook;
996
- this.productBackend = productBackend;
997
- this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME;
998
- }
999
- get(reqInfo) {
1000
- return reqInfo.utils.createResponse$(() => ({
1001
- body: this.getShippingInformation(reqInfo),
1002
- status: STATUS.OK,
1003
- }));
1004
- }
1005
- put(reqInfo) {
1006
- return reqInfo.utils.createResponse$(() => ({
1007
- body: this.updateShippingInformation(reqInfo),
1008
- status: STATUS.OK,
1009
- }));
1010
- }
1011
- delete(reqInfo) {
1012
- return reqInfo.utils.createResponse$(() => ({
1013
- body: this.removeShippingInformation(reqInfo),
1014
- status: STATUS.OK,
1015
- }));
1016
- }
1017
- getCart(reqInfo) {
1018
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
1019
- }
1020
- getShippingInformation(reqInfo) {
1021
- return this.getCart(reqInfo).shipping_information;
1022
- }
1023
- updateShippingInformation(reqInfo) {
1024
- const cart = this.getCart(reqInfo);
1025
- const shippingInformation = reqInfo.utils.getJsonBody(reqInfo.req);
1026
- cart.shipping_information = shippingInformation;
1027
- return {
1028
- ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
1029
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
1030
- };
1031
- }
1032
- removeShippingInformation(reqInfo) {
1033
- const cart = this.getCart(reqInfo);
1034
- cart.shipping_information = null;
1035
- return {
1036
- ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
1037
- extra_attributes: this.extraFieldsHook(reqInfo, cart),
1038
- };
1039
- }
1040
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2$1.DaffInMemoryBackendProductService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1041
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, providedIn: 'root' }); }
1042
- }
1043
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingInformationService, decorators: [{
1044
- type: Injectable,
1045
- args: [{
1046
- providedIn: 'root',
1047
- }]
1048
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1049
- type: Inject,
1050
- args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
1051
- }] }, { type: i2$1.DaffInMemoryBackendProductService }] });
1052
-
1053
- /**
1054
- * @inheritdoc
1055
- */
1056
- class DaffInMemoryBackendCartShippingMethodsService {
1057
- constructor(shippingMethodFactory) {
1058
- this.shippingMethodFactory = shippingMethodFactory;
1059
- this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME;
1060
- }
1061
- get(reqInfo) {
1062
- return reqInfo.utils.createResponse$(() => ({
1063
- body: this.listShippingMethods(reqInfo),
1064
- status: STATUS.OK,
1065
- }));
1066
- }
1067
- getCart(reqInfo) {
1068
- return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
1069
- }
1070
- listShippingMethods(reqInfo) {
1071
- const cart = this.getCart(reqInfo);
1072
- if (cart.shipping_address) {
1073
- if (cart.available_shipping_methods?.length === 0) {
1074
- cart.available_shipping_methods = this.shippingMethodFactory.createMany(3);
1075
- }
1076
- }
1077
- else {
1078
- cart.available_shipping_methods = [];
1079
- }
1080
- return cart.available_shipping_methods;
1081
- }
1082
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingMethodsService, deps: [{ token: i1$1.DaffCartShippingRateFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
1083
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingMethodsService, providedIn: 'root' }); }
1084
- }
1085
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartShippingMethodsService, decorators: [{
1086
- type: Injectable,
1087
- args: [{
1088
- providedIn: 'root',
1089
- }]
1090
- }], ctorParameters: () => [{ type: i1$1.DaffCartShippingRateFactory }] });
1091
-
1092
- /**
1093
- * The collections that the root service manages.
1094
- * Useful for a higher-level backend that delegates to this one based on collection name.
1095
- */
926
+ var DaffInMemoryBackendCartItemsService = class DaffInMemoryBackendCartItemsService {
927
+ constructor(cartItemFactory, extraFieldsHook, productBackend) {
928
+ this.cartItemFactory = cartItemFactory;
929
+ this.extraFieldsHook = extraFieldsHook;
930
+ this.productBackend = productBackend;
931
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_ITEMS_COLLECTION_NAME;
932
+ }
933
+ get(reqInfo) {
934
+ return reqInfo.utils.createResponse$(() => {
935
+ let body;
936
+ const action = this.getAction(reqInfo);
937
+ if (action) body = this.getItem(reqInfo, action);
938
+ else body = this.listItems(reqInfo);
939
+ return {
940
+ body,
941
+ status: STATUS.OK
942
+ };
943
+ });
944
+ }
945
+ put(reqInfo) {
946
+ return reqInfo.utils.createResponse$(() => ({
947
+ body: this.updateItem(reqInfo, this.getAction(reqInfo)),
948
+ status: STATUS.OK
949
+ }));
950
+ }
951
+ post(reqInfo) {
952
+ return reqInfo.utils.createResponse$(() => ({
953
+ body: this.addItem(reqInfo),
954
+ status: STATUS.OK
955
+ }));
956
+ }
957
+ delete(reqInfo) {
958
+ return reqInfo.utils.createResponse$(() => ({
959
+ body: this.deleteItem(reqInfo, this.getAction(reqInfo)),
960
+ status: STATUS.OK
961
+ }));
962
+ }
963
+ getAction(reqInfo) {
964
+ return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, "");
965
+ }
966
+ getCart(reqInfo) {
967
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
968
+ }
969
+ transformItemInput(itemInput) {
970
+ return {
971
+ ...this.cartItemFactory.fromProduct(this.productBackend.products.find((product) => product.id === itemInput.productId)),
972
+ ...itemInput
973
+ };
974
+ }
975
+ listItems(reqInfo) {
976
+ return this.getCart(reqInfo).items;
977
+ }
978
+ getItem(reqInfo, itemId) {
979
+ return this.getCart(reqInfo).items.find(({ id }) => itemId === id);
980
+ }
981
+ updateItem(reqInfo, itemId) {
982
+ const cart = this.getCart(reqInfo);
983
+ const cartIndex = reqInfo.collection.findIndex((c) => c.id === reqInfo.id);
984
+ const itemChanges = reqInfo.utils.getJsonBody(reqInfo.req);
985
+ const itemIndex = cart.items.findIndex((item) => itemId === item.id);
986
+ reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
987
+ ...cart,
988
+ items: cart.items.map((item, index) => index === itemIndex ? daffCartInMemoryComputeCartItemPrices({
989
+ ...cart.items[itemIndex],
990
+ ...itemChanges
991
+ }, this.productBackend.products) : item),
992
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
993
+ }, this.productBackend.products);
994
+ return reqInfo.collection[cartIndex];
995
+ }
996
+ addItem(reqInfo) {
997
+ const cart = this.getCart(reqInfo);
998
+ const cartIndex = reqInfo.collection.findIndex((c) => c.id === reqInfo.id);
999
+ const itemInput = reqInfo.utils.getJsonBody(reqInfo.req);
1000
+ const existingCartItemIndex = cart.items.findIndex((item) => item.product_id === itemInput.productId);
1001
+ if (existingCartItemIndex > -1) {
1002
+ const updatedCartItem = {
1003
+ ...cart.items[existingCartItemIndex],
1004
+ qty: cart.items[existingCartItemIndex].qty + itemInput.qty
1005
+ };
1006
+ reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
1007
+ ...cart,
1008
+ items: cart.items.map((item, index) => index === existingCartItemIndex ? daffCartInMemoryComputeCartItemPrices(updatedCartItem, this.productBackend.products) : item),
1009
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1010
+ }, this.productBackend.products);
1011
+ } else reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
1012
+ ...cart,
1013
+ items: [...cart.items, daffCartInMemoryComputeCartItemPrices(this.transformItemInput(itemInput), this.productBackend.products)],
1014
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1015
+ }, this.productBackend.products);
1016
+ return reqInfo.collection[cartIndex];
1017
+ }
1018
+ deleteItem(reqInfo, itemId) {
1019
+ const cart = this.getCart(reqInfo);
1020
+ const itemIndex = cart.items.findIndex(({ id }) => itemId === id);
1021
+ const cartIndex = reqInfo.collection.findIndex((c) => c.id === reqInfo.id);
1022
+ reqInfo.collection[cartIndex] = daffCartInMemoryComputeCartTotals({
1023
+ ...cart,
1024
+ items: cart.items.filter((item, index) => index !== itemIndex),
1025
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1026
+ }, this.productBackend.products);
1027
+ return reqInfo.collection[cartIndex];
1028
+ }
1029
+ static {
1030
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1031
+ minVersion: "12.0.0",
1032
+ version: "22.2.4",
1033
+ ngImport: i0,
1034
+ type: DaffInMemoryBackendCartItemsService,
1035
+ deps: [
1036
+ { token: i1.DaffCartItemFactory },
1037
+ { token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK },
1038
+ { token: i2.DaffInMemoryBackendProductService }
1039
+ ],
1040
+ target: i0.ɵɵFactoryTarget.Injectable
1041
+ });
1042
+ }
1043
+ static {
1044
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1045
+ minVersion: "12.0.0",
1046
+ version: "22.2.4",
1047
+ ngImport: i0,
1048
+ type: DaffInMemoryBackendCartItemsService,
1049
+ providedIn: "root"
1050
+ });
1051
+ }
1052
+ };
1053
+ i0.ɵɵngDeclareClassMetadata({
1054
+ minVersion: "12.0.0",
1055
+ version: "22.2.4",
1056
+ ngImport: i0,
1057
+ type: DaffInMemoryBackendCartItemsService,
1058
+ decorators: [{
1059
+ type: Injectable,
1060
+ args: [{ providedIn: "root" }]
1061
+ }],
1062
+ ctorParameters: () => [
1063
+ { type: i1.DaffCartItemFactory },
1064
+ {
1065
+ type: void 0,
1066
+ decorators: [{
1067
+ type: Inject,
1068
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
1069
+ }]
1070
+ },
1071
+ { type: i2.DaffInMemoryBackendProductService }
1072
+ ]
1073
+ });
1074
+ var DaffInMemoryBackendCartOrderService = class DaffInMemoryBackendCartOrderService {
1075
+ constructor() {
1076
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_ORDER_COLLECTION_NAME;
1077
+ }
1078
+ post(reqInfo) {
1079
+ return reqInfo.utils.createResponse$(() => ({
1080
+ body: this.placeOrder(reqInfo),
1081
+ status: STATUS.OK
1082
+ }));
1083
+ }
1084
+ placeOrder(reqInfo) {
1085
+ return {
1086
+ cartId: "89fdsa8sadf",
1087
+ orderId: "8235422034"
1088
+ };
1089
+ }
1090
+ static {
1091
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1092
+ minVersion: "12.0.0",
1093
+ version: "22.2.4",
1094
+ ngImport: i0,
1095
+ type: DaffInMemoryBackendCartOrderService,
1096
+ deps: [],
1097
+ target: i0.ɵɵFactoryTarget.Injectable
1098
+ });
1099
+ }
1100
+ static {
1101
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1102
+ minVersion: "12.0.0",
1103
+ version: "22.2.4",
1104
+ ngImport: i0,
1105
+ type: DaffInMemoryBackendCartOrderService,
1106
+ providedIn: "root"
1107
+ });
1108
+ }
1109
+ };
1110
+ i0.ɵɵngDeclareClassMetadata({
1111
+ minVersion: "12.0.0",
1112
+ version: "22.2.4",
1113
+ ngImport: i0,
1114
+ type: DaffInMemoryBackendCartOrderService,
1115
+ decorators: [{
1116
+ type: Injectable,
1117
+ args: [{ providedIn: "root" }]
1118
+ }]
1119
+ });
1120
+ var DaffInMemoryBackendCartPaymentService = class DaffInMemoryBackendCartPaymentService {
1121
+ constructor(extraFieldsHook) {
1122
+ this.extraFieldsHook = extraFieldsHook;
1123
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_PAYMENT_COLLECTION_NAME;
1124
+ }
1125
+ get(reqInfo) {
1126
+ return reqInfo.utils.createResponse$(() => ({
1127
+ body: this.getPayment(reqInfo),
1128
+ status: STATUS.OK
1129
+ }));
1130
+ }
1131
+ put(reqInfo) {
1132
+ return reqInfo.utils.createResponse$(() => ({
1133
+ body: this.updatePayment(reqInfo),
1134
+ status: STATUS.OK
1135
+ }));
1136
+ }
1137
+ delete(reqInfo) {
1138
+ return reqInfo.utils.createResponse$(() => ({
1139
+ body: this.removePayment(reqInfo),
1140
+ status: STATUS.OK
1141
+ }));
1142
+ }
1143
+ getCart(reqInfo) {
1144
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
1145
+ }
1146
+ getPayment(reqInfo) {
1147
+ return this.getCart(reqInfo).payment;
1148
+ }
1149
+ updatePayment(reqInfo) {
1150
+ const cart = this.getCart(reqInfo);
1151
+ const { payment, address } = reqInfo.utils.getJsonBody(reqInfo.req);
1152
+ cart.payment = payment;
1153
+ if (address) cart.billing_address = address;
1154
+ return {
1155
+ ...cart,
1156
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1157
+ };
1158
+ }
1159
+ removePayment(reqInfo) {
1160
+ const cart = this.getCart(reqInfo);
1161
+ cart.payment = null;
1162
+ return {
1163
+ ...cart,
1164
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1165
+ };
1166
+ }
1167
+ static {
1168
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1169
+ minVersion: "12.0.0",
1170
+ version: "22.2.4",
1171
+ ngImport: i0,
1172
+ type: DaffInMemoryBackendCartPaymentService,
1173
+ deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }],
1174
+ target: i0.ɵɵFactoryTarget.Injectable
1175
+ });
1176
+ }
1177
+ static {
1178
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1179
+ minVersion: "12.0.0",
1180
+ version: "22.2.4",
1181
+ ngImport: i0,
1182
+ type: DaffInMemoryBackendCartPaymentService,
1183
+ providedIn: "root"
1184
+ });
1185
+ }
1186
+ };
1187
+ i0.ɵɵngDeclareClassMetadata({
1188
+ minVersion: "12.0.0",
1189
+ version: "22.2.4",
1190
+ ngImport: i0,
1191
+ type: DaffInMemoryBackendCartPaymentService,
1192
+ decorators: [{
1193
+ type: Injectable,
1194
+ args: [{ providedIn: "root" }]
1195
+ }],
1196
+ ctorParameters: () => [{
1197
+ type: void 0,
1198
+ decorators: [{
1199
+ type: Inject,
1200
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
1201
+ }]
1202
+ }]
1203
+ });
1204
+ var DaffInMemoryBackendCartPaymentMethodsService = class DaffInMemoryBackendCartPaymentMethodsService {
1205
+ constructor() {
1206
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_PAYMENT_METHODS_COLLECTION_NAME;
1207
+ }
1208
+ get(reqInfo) {
1209
+ return reqInfo.utils.createResponse$(() => ({
1210
+ body: this.listPaymentMethods(reqInfo),
1211
+ status: STATUS.OK
1212
+ }));
1213
+ }
1214
+ getCart(reqInfo) {
1215
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
1216
+ }
1217
+ listPaymentMethods(reqInfo) {
1218
+ return this.getCart(reqInfo).available_payment_methods;
1219
+ }
1220
+ static {
1221
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1222
+ minVersion: "12.0.0",
1223
+ version: "22.2.4",
1224
+ ngImport: i0,
1225
+ type: DaffInMemoryBackendCartPaymentMethodsService,
1226
+ deps: [],
1227
+ target: i0.ɵɵFactoryTarget.Injectable
1228
+ });
1229
+ }
1230
+ static {
1231
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1232
+ minVersion: "12.0.0",
1233
+ version: "22.2.4",
1234
+ ngImport: i0,
1235
+ type: DaffInMemoryBackendCartPaymentMethodsService,
1236
+ providedIn: "root"
1237
+ });
1238
+ }
1239
+ };
1240
+ i0.ɵɵngDeclareClassMetadata({
1241
+ minVersion: "12.0.0",
1242
+ version: "22.2.4",
1243
+ ngImport: i0,
1244
+ type: DaffInMemoryBackendCartPaymentMethodsService,
1245
+ decorators: [{
1246
+ type: Injectable,
1247
+ args: [{ providedIn: "root" }]
1248
+ }]
1249
+ });
1250
+ var DaffInMemoryBackendCartShippingAddressService = class DaffInMemoryBackendCartShippingAddressService {
1251
+ constructor(extraFieldsHook) {
1252
+ this.extraFieldsHook = extraFieldsHook;
1253
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_ADDRESS_COLLECTION_NAME;
1254
+ }
1255
+ get(reqInfo) {
1256
+ return reqInfo.utils.createResponse$(() => ({
1257
+ body: this.getShippingAddress(reqInfo),
1258
+ status: STATUS.OK
1259
+ }));
1260
+ }
1261
+ put(reqInfo) {
1262
+ return reqInfo.utils.createResponse$(() => ({
1263
+ body: this.updateShippingAddress(reqInfo),
1264
+ status: STATUS.OK
1265
+ }));
1266
+ }
1267
+ getCart(reqInfo) {
1268
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
1269
+ }
1270
+ getShippingAddress(reqInfo) {
1271
+ return this.getCart(reqInfo).shipping_address;
1272
+ }
1273
+ updateShippingAddress(reqInfo) {
1274
+ const cart = this.getCart(reqInfo);
1275
+ cart.shipping_address = reqInfo.utils.getJsonBody(reqInfo.req);
1276
+ return {
1277
+ ...cart,
1278
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1279
+ };
1280
+ }
1281
+ static {
1282
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1283
+ minVersion: "12.0.0",
1284
+ version: "22.2.4",
1285
+ ngImport: i0,
1286
+ type: DaffInMemoryBackendCartShippingAddressService,
1287
+ deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }],
1288
+ target: i0.ɵɵFactoryTarget.Injectable
1289
+ });
1290
+ }
1291
+ static {
1292
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1293
+ minVersion: "12.0.0",
1294
+ version: "22.2.4",
1295
+ ngImport: i0,
1296
+ type: DaffInMemoryBackendCartShippingAddressService,
1297
+ providedIn: "root"
1298
+ });
1299
+ }
1300
+ };
1301
+ i0.ɵɵngDeclareClassMetadata({
1302
+ minVersion: "12.0.0",
1303
+ version: "22.2.4",
1304
+ ngImport: i0,
1305
+ type: DaffInMemoryBackendCartShippingAddressService,
1306
+ decorators: [{
1307
+ type: Injectable,
1308
+ args: [{ providedIn: "root" }]
1309
+ }],
1310
+ ctorParameters: () => [{
1311
+ type: void 0,
1312
+ decorators: [{
1313
+ type: Inject,
1314
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
1315
+ }]
1316
+ }]
1317
+ });
1318
+ var DaffInMemoryBackendCartShippingInformationService = class DaffInMemoryBackendCartShippingInformationService {
1319
+ constructor(extraFieldsHook, productBackend) {
1320
+ this.extraFieldsHook = extraFieldsHook;
1321
+ this.productBackend = productBackend;
1322
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_COLLECTION_NAME;
1323
+ }
1324
+ get(reqInfo) {
1325
+ return reqInfo.utils.createResponse$(() => ({
1326
+ body: this.getShippingInformation(reqInfo),
1327
+ status: STATUS.OK
1328
+ }));
1329
+ }
1330
+ put(reqInfo) {
1331
+ return reqInfo.utils.createResponse$(() => ({
1332
+ body: this.updateShippingInformation(reqInfo),
1333
+ status: STATUS.OK
1334
+ }));
1335
+ }
1336
+ delete(reqInfo) {
1337
+ return reqInfo.utils.createResponse$(() => ({
1338
+ body: this.removeShippingInformation(reqInfo),
1339
+ status: STATUS.OK
1340
+ }));
1341
+ }
1342
+ getCart(reqInfo) {
1343
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
1344
+ }
1345
+ getShippingInformation(reqInfo) {
1346
+ return this.getCart(reqInfo).shipping_information;
1347
+ }
1348
+ updateShippingInformation(reqInfo) {
1349
+ const cart = this.getCart(reqInfo);
1350
+ cart.shipping_information = reqInfo.utils.getJsonBody(reqInfo.req);
1351
+ return {
1352
+ ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
1353
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1354
+ };
1355
+ }
1356
+ removeShippingInformation(reqInfo) {
1357
+ const cart = this.getCart(reqInfo);
1358
+ cart.shipping_information = null;
1359
+ return {
1360
+ ...daffCartInMemoryComputeCartTotals(cart, this.productBackend.products),
1361
+ extra_attributes: this.extraFieldsHook(reqInfo, cart)
1362
+ };
1363
+ }
1364
+ static {
1365
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1366
+ minVersion: "12.0.0",
1367
+ version: "22.2.4",
1368
+ ngImport: i0,
1369
+ type: DaffInMemoryBackendCartShippingInformationService,
1370
+ deps: [{ token: DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK }, { token: i2.DaffInMemoryBackendProductService }],
1371
+ target: i0.ɵɵFactoryTarget.Injectable
1372
+ });
1373
+ }
1374
+ static {
1375
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1376
+ minVersion: "12.0.0",
1377
+ version: "22.2.4",
1378
+ ngImport: i0,
1379
+ type: DaffInMemoryBackendCartShippingInformationService,
1380
+ providedIn: "root"
1381
+ });
1382
+ }
1383
+ };
1384
+ i0.ɵɵngDeclareClassMetadata({
1385
+ minVersion: "12.0.0",
1386
+ version: "22.2.4",
1387
+ ngImport: i0,
1388
+ type: DaffInMemoryBackendCartShippingInformationService,
1389
+ decorators: [{
1390
+ type: Injectable,
1391
+ args: [{ providedIn: "root" }]
1392
+ }],
1393
+ ctorParameters: () => [{
1394
+ type: void 0,
1395
+ decorators: [{
1396
+ type: Inject,
1397
+ args: [DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK]
1398
+ }]
1399
+ }, { type: i2.DaffInMemoryBackendProductService }]
1400
+ });
1401
+ var DaffInMemoryBackendCartShippingMethodsService = class DaffInMemoryBackendCartShippingMethodsService {
1402
+ constructor(shippingMethodFactory) {
1403
+ this.shippingMethodFactory = shippingMethodFactory;
1404
+ this.collectionName = DAFF_CART_IN_MEMORY_CART_SHIPPING_METHODS_COLLECTION_NAME;
1405
+ }
1406
+ get(reqInfo) {
1407
+ return reqInfo.utils.createResponse$(() => ({
1408
+ body: this.listShippingMethods(reqInfo),
1409
+ status: STATUS.OK
1410
+ }));
1411
+ }
1412
+ getCart(reqInfo) {
1413
+ return reqInfo.utils.findById(reqInfo.collection, reqInfo.id);
1414
+ }
1415
+ listShippingMethods(reqInfo) {
1416
+ const cart = this.getCart(reqInfo);
1417
+ if (cart.shipping_address) {
1418
+ if (cart.available_shipping_methods?.length === 0) cart.available_shipping_methods = this.shippingMethodFactory.createMany(3);
1419
+ } else cart.available_shipping_methods = [];
1420
+ return cart.available_shipping_methods;
1421
+ }
1422
+ static {
1423
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1424
+ minVersion: "12.0.0",
1425
+ version: "22.2.4",
1426
+ ngImport: i0,
1427
+ type: DaffInMemoryBackendCartShippingMethodsService,
1428
+ deps: [{ token: i1.DaffCartShippingRateFactory }],
1429
+ target: i0.ɵɵFactoryTarget.Injectable
1430
+ });
1431
+ }
1432
+ static {
1433
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1434
+ minVersion: "12.0.0",
1435
+ version: "22.2.4",
1436
+ ngImport: i0,
1437
+ type: DaffInMemoryBackendCartShippingMethodsService,
1438
+ providedIn: "root"
1439
+ });
1440
+ }
1441
+ };
1442
+ i0.ɵɵngDeclareClassMetadata({
1443
+ minVersion: "12.0.0",
1444
+ version: "22.2.4",
1445
+ ngImport: i0,
1446
+ type: DaffInMemoryBackendCartShippingMethodsService,
1447
+ decorators: [{
1448
+ type: Injectable,
1449
+ args: [{ providedIn: "root" }]
1450
+ }],
1451
+ ctorParameters: () => [{ type: i1.DaffCartShippingRateFactory }]
1452
+ });
1096
1453
  const COLLECTION_NAMES = [
1097
- 'cart',
1098
- 'cart-items',
1099
- 'cart-order',
1100
- 'cart-coupon',
1101
- 'cart-address',
1102
- 'cart-shipping-address',
1103
- 'cart-billing-address',
1104
- 'cart-payment-methods',
1105
- 'cart-shipping-methods',
1106
- 'cart-payment',
1107
- 'cart-shipping-information',
1454
+ "cart",
1455
+ "cart-items",
1456
+ "cart-order",
1457
+ "cart-coupon",
1458
+ "cart-address",
1459
+ "cart-shipping-address",
1460
+ "cart-billing-address",
1461
+ "cart-payment-methods",
1462
+ "cart-shipping-methods",
1463
+ "cart-payment",
1464
+ "cart-shipping-information"
1108
1465
  ];
1109
- /**
1110
- * The root cart in-memory backend.
1111
- * Creates the database and delegates requests to child backends.
1112
- */
1113
- class DaffInMemoryBackendCartRootService extends DaffInMemoryBackendDelegate {
1114
- constructor(cartService, cartItemsService, cartOrderService, cartCouponService, cartAddressService, cartShippingAddressService, cartBillingAddressService, cartPaymentMethodsService, cartShippingMethodsService, cartPaymentService, cartShippingInformationService, _config) {
1115
- super([
1116
- cartService,
1117
- cartItemsService,
1118
- cartOrderService,
1119
- cartCouponService,
1120
- cartAddressService,
1121
- cartShippingAddressService,
1122
- cartBillingAddressService,
1123
- cartPaymentMethodsService,
1124
- cartShippingMethodsService,
1125
- cartPaymentService,
1126
- cartShippingInformationService,
1127
- ], _config);
1128
- this._config = _config;
1129
- /**
1130
- * The collection of carts in the backend.
1131
- */
1132
- this.carts = [];
1133
- }
1134
- delegateRequest(reqInfo, method) {
1135
- return super.delegateRequest({
1136
- ...reqInfo,
1137
- collection: this.carts,
1138
- }, method);
1139
- }
1140
- canHandle(collectionName) {
1141
- return COLLECTION_NAMES.includes(collectionName);
1142
- }
1143
- createDb(reqInfo) {
1144
- if (reqInfo) {
1145
- const seedData = reqInfo.utils.getJsonBody(reqInfo.req).carts;
1146
- if (seedData) {
1147
- this.carts = seedData;
1148
- }
1149
- }
1150
- return of({
1151
- cart: this.carts,
1152
- });
1153
- }
1154
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", 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 }, { token: DAFF_IN_MEMORY_DRIVER_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
1155
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartRootService, providedIn: 'root' }); }
1156
- }
1157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffInMemoryBackendCartRootService, decorators: [{
1158
- type: Injectable,
1159
- args: [{
1160
- providedIn: 'root',
1161
- }]
1162
- }], ctorParameters: () => [{ type: DaffInMemoryBackendCartService }, { type: DaffInMemoryBackendCartItemsService }, { type: DaffInMemoryBackendCartOrderService }, { type: DaffInMemoryBackendCartCouponService }, { type: DaffInMemoryBackendCartAddressService }, { type: DaffInMemoryBackendCartShippingAddressService }, { type: DaffInMemoryBackendCartBillingAddressService }, { type: DaffInMemoryBackendCartPaymentMethodsService }, { type: DaffInMemoryBackendCartShippingMethodsService }, { type: DaffInMemoryBackendCartPaymentService }, { type: DaffInMemoryBackendCartShippingInformationService }, { type: undefined, decorators: [{
1163
- type: Inject,
1164
- args: [DAFF_IN_MEMORY_DRIVER_CONFIG]
1165
- }] }] });
1166
-
1167
- class DaffCartInMemoryDriverModule {
1168
- static forRoot() {
1169
- return {
1170
- ngModule: DaffCartInMemoryDriverModule,
1171
- providers: [
1172
- provideDaffCartDriver(DaffInMemoryCartService),
1173
- provideDaffCartAddressDriver(DaffInMemoryCartAddressService),
1174
- provideDaffCartBillingAddressDriver(DaffInMemoryCartBillingAddressService),
1175
- provideDaffCartItemDriver(DaffInMemoryCartItemService),
1176
- provideDaffCartPaymentDriver(DaffInMemoryCartPaymentService),
1177
- provideDaffCartPaymentMethodsDriver(DaffInMemoryCartPaymentMethodsService),
1178
- provideDaffCartShippingAddressDriver(DaffInMemoryCartShippingAddressService),
1179
- provideDaffCartShippingInformationDriver(DaffInMemoryCartShippingInformationService),
1180
- provideDaffCartShippingMethodsDriver(DaffInMemoryCartShippingMethodsService),
1181
- provideDaffCartOrderDriver(DaffInMemoryCartOrderService),
1182
- provideDaffCartCouponDriver(DaffInMemoryCartCouponService),
1183
- provideDaffInMemoryBackends(DaffInMemoryBackendCartRootService),
1184
- ],
1185
- };
1186
- }
1187
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCartInMemoryDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1188
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCartInMemoryDriverModule, imports: [CommonModule] }); }
1189
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCartInMemoryDriverModule, imports: [CommonModule] }); }
1190
- }
1191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCartInMemoryDriverModule, decorators: [{
1192
- type: NgModule,
1193
- args: [{
1194
- imports: [
1195
- CommonModule,
1196
- ],
1197
- }]
1198
- }] });
1199
-
1200
- /**
1201
- * Generated bundle index. Do not edit.
1202
- */
1466
+ var DaffInMemoryBackendCartRootService = class DaffInMemoryBackendCartRootService extends DaffInMemoryBackendDelegate {
1467
+ constructor(cartService, cartItemsService, cartOrderService, cartCouponService, cartAddressService, cartShippingAddressService, cartBillingAddressService, cartPaymentMethodsService, cartShippingMethodsService, cartPaymentService, cartShippingInformationService, _config) {
1468
+ super([
1469
+ cartService,
1470
+ cartItemsService,
1471
+ cartOrderService,
1472
+ cartCouponService,
1473
+ cartAddressService,
1474
+ cartShippingAddressService,
1475
+ cartBillingAddressService,
1476
+ cartPaymentMethodsService,
1477
+ cartShippingMethodsService,
1478
+ cartPaymentService,
1479
+ cartShippingInformationService
1480
+ ], _config);
1481
+ this._config = _config;
1482
+ this.carts = [];
1483
+ }
1484
+ delegateRequest(reqInfo, method) {
1485
+ return super.delegateRequest({
1486
+ ...reqInfo,
1487
+ collection: this.carts
1488
+ }, method);
1489
+ }
1490
+ canHandle(collectionName) {
1491
+ return COLLECTION_NAMES.includes(collectionName);
1492
+ }
1493
+ createDb(reqInfo) {
1494
+ if (reqInfo) {
1495
+ const seedData = reqInfo.utils.getJsonBody(reqInfo.req).carts;
1496
+ if (seedData) this.carts = seedData;
1497
+ }
1498
+ return of({ cart: this.carts });
1499
+ }
1500
+ static {
1501
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1502
+ minVersion: "12.0.0",
1503
+ version: "22.2.4",
1504
+ ngImport: i0,
1505
+ type: DaffInMemoryBackendCartRootService,
1506
+ deps: [
1507
+ { token: DaffInMemoryBackendCartService },
1508
+ { token: DaffInMemoryBackendCartItemsService },
1509
+ { token: DaffInMemoryBackendCartOrderService },
1510
+ { token: DaffInMemoryBackendCartCouponService },
1511
+ { token: DaffInMemoryBackendCartAddressService },
1512
+ { token: DaffInMemoryBackendCartShippingAddressService },
1513
+ { token: DaffInMemoryBackendCartBillingAddressService },
1514
+ { token: DaffInMemoryBackendCartPaymentMethodsService },
1515
+ { token: DaffInMemoryBackendCartShippingMethodsService },
1516
+ { token: DaffInMemoryBackendCartPaymentService },
1517
+ { token: DaffInMemoryBackendCartShippingInformationService },
1518
+ { token: DAFF_IN_MEMORY_DRIVER_CONFIG }
1519
+ ],
1520
+ target: i0.ɵɵFactoryTarget.Injectable
1521
+ });
1522
+ }
1523
+ static {
1524
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1525
+ minVersion: "12.0.0",
1526
+ version: "22.2.4",
1527
+ ngImport: i0,
1528
+ type: DaffInMemoryBackendCartRootService,
1529
+ providedIn: "root"
1530
+ });
1531
+ }
1532
+ };
1533
+ i0.ɵɵngDeclareClassMetadata({
1534
+ minVersion: "12.0.0",
1535
+ version: "22.2.4",
1536
+ ngImport: i0,
1537
+ type: DaffInMemoryBackendCartRootService,
1538
+ decorators: [{
1539
+ type: Injectable,
1540
+ args: [{ providedIn: "root" }]
1541
+ }],
1542
+ ctorParameters: () => [
1543
+ { type: DaffInMemoryBackendCartService },
1544
+ { type: DaffInMemoryBackendCartItemsService },
1545
+ { type: DaffInMemoryBackendCartOrderService },
1546
+ { type: DaffInMemoryBackendCartCouponService },
1547
+ { type: DaffInMemoryBackendCartAddressService },
1548
+ { type: DaffInMemoryBackendCartShippingAddressService },
1549
+ { type: DaffInMemoryBackendCartBillingAddressService },
1550
+ { type: DaffInMemoryBackendCartPaymentMethodsService },
1551
+ { type: DaffInMemoryBackendCartShippingMethodsService },
1552
+ { type: DaffInMemoryBackendCartPaymentService },
1553
+ { type: DaffInMemoryBackendCartShippingInformationService },
1554
+ {
1555
+ type: void 0,
1556
+ decorators: [{
1557
+ type: Inject,
1558
+ args: [DAFF_IN_MEMORY_DRIVER_CONFIG]
1559
+ }]
1560
+ }
1561
+ ]
1562
+ });
1563
+ const provideDaffCartInMemoryDriver = () => makeEnvironmentProviders([
1564
+ provideDaffCartDriver(DaffInMemoryCartService),
1565
+ provideDaffCartAddressDriver(DaffInMemoryCartAddressService),
1566
+ provideDaffCartBillingAddressDriver(DaffInMemoryCartBillingAddressService),
1567
+ provideDaffCartItemDriver(DaffInMemoryCartItemService),
1568
+ provideDaffCartPaymentDriver(DaffInMemoryCartPaymentService),
1569
+ provideDaffCartPaymentMethodsDriver(DaffInMemoryCartPaymentMethodsService),
1570
+ provideDaffCartShippingAddressDriver(DaffInMemoryCartShippingAddressService),
1571
+ provideDaffCartShippingInformationDriver(DaffInMemoryCartShippingInformationService),
1572
+ provideDaffCartShippingMethodsDriver(DaffInMemoryCartShippingMethodsService),
1573
+ provideDaffCartOrderDriver(DaffInMemoryCartOrderService),
1574
+ provideDaffCartCouponDriver(DaffInMemoryCartCouponService),
1575
+ provideDaffInMemoryBackends(DaffInMemoryBackendCartRootService)
1576
+ ]);
1577
+ var DaffCartInMemoryDriverModule = class DaffCartInMemoryDriverModule {
1578
+ static forRoot() {
1579
+ return {
1580
+ ngModule: DaffCartInMemoryDriverModule,
1581
+ providers: [provideDaffCartInMemoryDriver()]
1582
+ };
1583
+ }
1584
+ static {
1585
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1586
+ minVersion: "12.0.0",
1587
+ version: "22.2.4",
1588
+ ngImport: i0,
1589
+ type: DaffCartInMemoryDriverModule,
1590
+ deps: [],
1591
+ target: i0.ɵɵFactoryTarget.NgModule
1592
+ });
1593
+ }
1594
+ static {
1595
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
1596
+ minVersion: "14.0.0",
1597
+ version: "22.2.4",
1598
+ ngImport: i0,
1599
+ type: DaffCartInMemoryDriverModule,
1600
+ imports: [CommonModule]
1601
+ });
1602
+ }
1603
+ static {
1604
+ this.ɵinj = i0.ɵɵngDeclareInjector({
1605
+ minVersion: "12.0.0",
1606
+ version: "22.2.4",
1607
+ ngImport: i0,
1608
+ type: DaffCartInMemoryDriverModule,
1609
+ imports: [CommonModule]
1610
+ });
1611
+ }
1612
+ };
1613
+ i0.ɵɵngDeclareClassMetadata({
1614
+ minVersion: "12.0.0",
1615
+ version: "22.2.4",
1616
+ ngImport: i0,
1617
+ type: DaffCartInMemoryDriverModule,
1618
+ decorators: [{
1619
+ type: NgModule,
1620
+ args: [{ imports: [CommonModule] }]
1621
+ }]
1622
+ });
1623
+ 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, provideDaffCartInMemoryDriver };
1203
1624
 
1204
- 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 };
1205
- //# sourceMappingURL=daffodil-cart-driver-in-memory.mjs.map
1625
+ //# sourceMappingURL=daffodil-cart-driver-in-memory.mjs.map