@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,374 +1,331 @@
1
- import * as _angular_core from '@angular/core';
2
- import * as rxjs from 'rxjs';
3
- import { Observable } from 'rxjs';
4
- import { DaffCart, DaffCartItemInput, DaffCartItem, DaffCartPaymentMethod, DaffCartShippingRate, DaffCartOrderResult, DaffCartCoupon, DaffCartStorageService } from '@daffodil/cart';
5
- import { DaffDriverResponse } from '@daffodil/driver';
6
- import { DaffInheritableError, DaffError } from '@daffodil/core';
7
-
1
+ import { Observable } from "rxjs";
2
+ import { DaffCart, DaffCartCoupon, DaffCartItem, DaffCartItemInput, DaffCartOrderResult, DaffCartPaymentMethod, DaffCartShippingRate, DaffCartStorageService } from "@daffodil/cart";
3
+ import { DaffDriverResponse } from "@daffodil/driver";
4
+ import { DaffError, DaffInheritableError } from "@daffodil/core";
5
+ import * as i0 from "@angular/core";
8
6
  /**
9
7
  * The interface responsible for managing a customer's cart.
10
8
  */
11
- interface DaffCartServiceInterface<T extends DaffCart = DaffCart> {
12
- /**
13
- * Retrieve a cart.
14
- *
15
- * @param id The cart ID.
16
- */
17
- get(id: T['id']): Observable<DaffDriverResponse<T>>;
18
- /**
19
- * Creates a cart.
20
- */
21
- create(): Observable<{
22
- id: T['id'];
23
- }>;
24
- /**
25
- * Remove all items from a cart.
26
- */
27
- clear(id: T['id']): Observable<Partial<T>>;
28
- /**
29
- * Merge a guest cart into a customer cart.
30
- */
31
- merge(guestCart: T['id'], customerCart?: T['id']): Observable<DaffDriverResponse<T>>;
9
+ export interface DaffCartServiceInterface<T extends DaffCart = DaffCart> {
10
+ /**
11
+ * Retrieve a cart.
12
+ *
13
+ * @param id The cart ID.
14
+ */
15
+ get(id: T['id']): Observable<DaffDriverResponse<T>>;
16
+ /**
17
+ * Creates a cart.
18
+ */
19
+ create(): Observable<{
20
+ id: T['id'];
21
+ }>;
22
+ /**
23
+ * Remove all items from a cart.
24
+ */
25
+ clear(id: T['id']): Observable<Partial<T>>;
26
+ /**
27
+ * Merge a guest cart into a customer cart.
28
+ */
29
+ merge(guestCart: T['id'], customerCart?: T['id']): Observable<DaffDriverResponse<T>>;
32
30
  }
33
- declare const DaffCartDriver: _angular_core.InjectionToken<DaffCartServiceInterface<DaffCart>>;
34
- declare const provideDaffCartDriver: <R extends DaffCartServiceInterface<DaffCart> = DaffCartServiceInterface<DaffCart>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
35
-
31
+ export declare const DaffCartDriver: import("@angular/core").InjectionToken<DaffCartServiceInterface<DaffCart>>, provideDaffCartDriver: <R extends DaffCartServiceInterface<DaffCart> = DaffCartServiceInterface<DaffCart>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
36
32
  /**
37
33
  * The interface responsible for managing the billing address of a cart.
38
34
  */
39
- interface DaffCartBillingAddressServiceInterface<T extends DaffCart = DaffCart> {
40
- /**
41
- * Retrieve the billing address of a cart
42
- */
43
- get(cartId: T['id']): Observable<T['billing_address']>;
44
- /**
45
- * Update the billing address of a cart
46
- */
47
- update(cartId: T['id'], address: Partial<T['billing_address']>): Observable<Partial<T>>;
35
+ export interface DaffCartBillingAddressServiceInterface<T extends DaffCart = DaffCart> {
36
+ /**
37
+ * Retrieve the billing address of a cart
38
+ */
39
+ get(cartId: T['id']): Observable<T['billing_address']>;
40
+ /**
41
+ * Update the billing address of a cart
42
+ */
43
+ update(cartId: T['id'], address: Partial<T['billing_address']>): Observable<Partial<T>>;
48
44
  }
49
- declare const DaffCartBillingAddressDriver: _angular_core.InjectionToken<DaffCartBillingAddressServiceInterface<DaffCart>>;
50
- declare const provideDaffCartBillingAddressDriver: <R extends DaffCartBillingAddressServiceInterface<DaffCart> = DaffCartBillingAddressServiceInterface<DaffCart>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
51
-
45
+ export declare const DaffCartBillingAddressDriver: import("@angular/core").InjectionToken<DaffCartBillingAddressServiceInterface<DaffCart>>, provideDaffCartBillingAddressDriver: <R extends DaffCartBillingAddressServiceInterface<DaffCart> = DaffCartBillingAddressServiceInterface<DaffCart>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
52
46
  /**
53
47
  * The interface responsible for managing the address of a cart.
54
48
  */
55
- interface DaffCartAddressServiceInterface<T extends DaffCart = DaffCart> {
56
- /**
57
- * Update the billing and shipping address of a cart
58
- */
59
- update(cartId: T['id'], address: Partial<T['shipping_address'] | T['billing_address']>): Observable<Partial<T>>;
49
+ export interface DaffCartAddressServiceInterface<T extends DaffCart = DaffCart> {
50
+ /**
51
+ * Update the billing and shipping address of a cart
52
+ */
53
+ update(cartId: T['id'], address: Partial<T['shipping_address'] | T['billing_address']>): Observable<Partial<T>>;
60
54
  }
61
- declare const DaffCartAddressDriver: _angular_core.InjectionToken<DaffCartAddressServiceInterface<DaffCart>>;
62
- declare const provideDaffCartAddressDriver: <R extends DaffCartAddressServiceInterface<DaffCart> = DaffCartAddressServiceInterface<DaffCart>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
63
-
55
+ export declare const DaffCartAddressDriver: import("@angular/core").InjectionToken<DaffCartAddressServiceInterface<DaffCart>>, provideDaffCartAddressDriver: <R extends DaffCartAddressServiceInterface<DaffCart> = DaffCartAddressServiceInterface<DaffCart>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
64
56
  /**
65
57
  * The interface responsible for applying a coupon to a cart.
66
58
  */
67
- interface DaffCartCouponServiceInterface<T extends DaffCart = DaffCart> {
68
- /**
69
- * Apply a coupon to the cart and return a partial of the cart.
70
- */
71
- apply(cartId: T['id'], coupon: T['coupons'][number]): Observable<Partial<T>>;
72
- /**
73
- * List coupon codes applied to a cart.
74
- */
75
- list(cartId: T['id']): Observable<T['coupons']>;
76
- /**
77
- * Remove a coupon from the cart and return a partial of the cart.
78
- */
79
- remove(cartId: T['id'], coupon: T['coupons'][number]): Observable<Partial<T>>;
80
- /**
81
- * Remove all coupons from the cart and return a partial of the cart.
82
- */
83
- removeAll(cartId: T['id']): Observable<Partial<T>>;
59
+ export interface DaffCartCouponServiceInterface<T extends DaffCart = DaffCart> {
60
+ /**
61
+ * Apply a coupon to the cart and return a partial of the cart.
62
+ */
63
+ apply(cartId: T['id'], coupon: T['coupons'][number]): Observable<Partial<T>>;
64
+ /**
65
+ * List coupon codes applied to a cart.
66
+ */
67
+ list(cartId: T['id']): Observable<T['coupons']>;
68
+ /**
69
+ * Remove a coupon from the cart and return a partial of the cart.
70
+ */
71
+ remove(cartId: T['id'], coupon: T['coupons'][number]): Observable<Partial<T>>;
72
+ /**
73
+ * Remove all coupons from the cart and return a partial of the cart.
74
+ */
75
+ removeAll(cartId: T['id']): Observable<Partial<T>>;
84
76
  }
85
- declare const DaffCartCouponDriver: _angular_core.InjectionToken<DaffCartCouponServiceInterface<DaffCart>>;
86
- declare const provideDaffCartCouponDriver: <R extends DaffCartCouponServiceInterface<DaffCart> = DaffCartCouponServiceInterface<DaffCart>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
87
-
77
+ export declare const DaffCartCouponDriver: import("@angular/core").InjectionToken<DaffCartCouponServiceInterface<DaffCart>>, provideDaffCartCouponDriver: <R extends DaffCartCouponServiceInterface<DaffCart> = DaffCartCouponServiceInterface<DaffCart>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
88
78
  /**
89
79
  * The interface responsible for managing the items of a cart.
90
80
  */
91
- interface DaffCartItemServiceInterface<T extends DaffCart = DaffCart, U extends DaffCartItemInput = DaffCartItemInput> {
92
- /**
93
- * List all of the available items of a cart
94
- */
95
- list(cartId: T['id']): Observable<T['items']>;
96
- /**
97
- * Get a specific cart item of a cart.
98
- */
99
- get(cartId: T['id'], item_id: DaffCartItem['id']): Observable<T['items'][number]>;
100
- /**
101
- * Add something to a cart.
102
- */
103
- add(id: T['id'], product: U): Observable<Partial<T>>;
104
- /**
105
- * Update an existing item in a cart
106
- */
107
- update(cartId: T['id'], itemId: T['items'][number]['id'], changes: Partial<T['items'][number]>): Observable<Partial<T>>;
108
- /**
109
- * Remove an item from a cart.
110
- */
111
- delete(cartId: T['id'], itemId: T['items'][number]['id']): Observable<Partial<T>>;
81
+ export interface DaffCartItemServiceInterface<T extends DaffCart = DaffCart, U extends DaffCartItemInput = DaffCartItemInput> {
82
+ /**
83
+ * List all of the available items of a cart
84
+ */
85
+ list(cartId: T['id']): Observable<T['items']>;
86
+ /**
87
+ * Get a specific cart item of a cart.
88
+ */
89
+ get(cartId: T['id'], item_id: DaffCartItem['id']): Observable<T['items'][number]>;
90
+ /**
91
+ * Add something to a cart.
92
+ */
93
+ add(id: T['id'], product: U): Observable<Partial<T>>;
94
+ /**
95
+ * Update an existing item in a cart
96
+ */
97
+ update(cartId: T['id'], itemId: T['items'][number]['id'], changes: Partial<T['items'][number]>): Observable<Partial<T>>;
98
+ /**
99
+ * Remove an item from a cart.
100
+ */
101
+ delete(cartId: T['id'], itemId: T['items'][number]['id']): Observable<Partial<T>>;
112
102
  }
113
- declare const DaffCartItemDriver: _angular_core.InjectionToken<DaffCartItemServiceInterface<DaffCart, DaffCartItemInput>>;
114
- declare const provideDaffCartItemDriver: <R extends DaffCartItemServiceInterface<DaffCart, DaffCartItemInput> = DaffCartItemServiceInterface<DaffCart, DaffCartItemInput>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
115
-
103
+ export declare const DaffCartItemDriver: import("@angular/core").InjectionToken<DaffCartItemServiceInterface<DaffCart, DaffCartItemInput>>, provideDaffCartItemDriver: <R extends DaffCartItemServiceInterface<DaffCart, DaffCartItemInput> = DaffCartItemServiceInterface<DaffCart, DaffCartItemInput>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
116
104
  /**
117
105
  * The interface responsible for retrieving the available payment methods of a cart.
118
106
  */
119
- interface DaffCartPaymentMethodsServiceInterface<T extends DaffCartPaymentMethod = DaffCartPaymentMethod> {
120
- /**
121
- * List the available payment methods of a cart.
122
- */
123
- list(cartId: DaffCart['id']): Observable<T[]>;
107
+ export interface DaffCartPaymentMethodsServiceInterface<T extends DaffCartPaymentMethod = DaffCartPaymentMethod> {
108
+ /**
109
+ * List the available payment methods of a cart.
110
+ */
111
+ list(cartId: DaffCart['id']): Observable<T[]>;
124
112
  }
125
- declare const DaffCartPaymentMethodsDriver: _angular_core.InjectionToken<DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod>>;
126
- declare const provideDaffCartPaymentMethodsDriver: <R extends DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod> = DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
127
-
113
+ export declare const DaffCartPaymentMethodsDriver: import("@angular/core").InjectionToken<DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod>>, provideDaffCartPaymentMethodsDriver: <R extends DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod> = DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
128
114
  /**
129
115
  * The interface responsible for managing the selected payment method of a cart.
130
116
  */
131
- interface DaffCartPaymentServiceInterface<T extends DaffCart = DaffCart> {
132
- /**
133
- * Get the currently applied payment method of a cart.
134
- */
135
- get(cartId: T['id']): Observable<T['payment']>;
136
- /**
137
- * Update the payment method applied to a cart.
138
- *
139
- * If a billing address is provided, the driver will update that simultaneously.
140
- */
141
- update(cartId: T['id'], payment: Partial<T['payment']>, billingAddress?: Partial<T['billing_address']>): Observable<Partial<T>>;
142
- /**
143
- * Remove the payment method applied to a cart.
144
- */
145
- remove(cartId: T['id']): Observable<void>;
117
+ export interface DaffCartPaymentServiceInterface<T extends DaffCart = DaffCart> {
118
+ /**
119
+ * Get the currently applied payment method of a cart.
120
+ */
121
+ get(cartId: T['id']): Observable<T['payment']>;
122
+ /**
123
+ * Update the payment method applied to a cart.
124
+ *
125
+ * If a billing address is provided, the driver will update that simultaneously.
126
+ */
127
+ update(cartId: T['id'], payment: Partial<T['payment']>, billingAddress?: Partial<T['billing_address']>): Observable<Partial<T>>;
128
+ /**
129
+ * Remove the payment method applied to a cart.
130
+ */
131
+ remove(cartId: T['id']): Observable<void>;
146
132
  }
147
- declare const DaffCartPaymentDriver: _angular_core.InjectionToken<DaffCartPaymentServiceInterface<DaffCart>>;
148
- declare const provideDaffCartPaymentDriver: <R extends DaffCartPaymentServiceInterface<DaffCart> = DaffCartPaymentServiceInterface<DaffCart>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
149
-
133
+ export declare const DaffCartPaymentDriver: import("@angular/core").InjectionToken<DaffCartPaymentServiceInterface<DaffCart>>, provideDaffCartPaymentDriver: <R extends DaffCartPaymentServiceInterface<DaffCart> = DaffCartPaymentServiceInterface<DaffCart>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
150
134
  /**
151
135
  * The interface responsible for managing the shipping address of a cart.
152
136
  */
153
- interface DaffCartShippingAddressServiceInterface<T extends DaffCart = DaffCart> {
154
- /**
155
- * Retrieve the shipping address of a cart.
156
- */
157
- get(cartId: T['id']): Observable<T['shipping_address']>;
158
- /**
159
- * Update the shipping address of a cart.
160
- */
161
- update(cartId: T['id'], address: Partial<T['shipping_address']>): Observable<Partial<T>>;
137
+ export interface DaffCartShippingAddressServiceInterface<T extends DaffCart = DaffCart> {
138
+ /**
139
+ * Retrieve the shipping address of a cart.
140
+ */
141
+ get(cartId: T['id']): Observable<T['shipping_address']>;
142
+ /**
143
+ * Update the shipping address of a cart.
144
+ */
145
+ update(cartId: T['id'], address: Partial<T['shipping_address']>): Observable<Partial<T>>;
162
146
  }
163
- declare const DaffCartShippingAddressDriver: _angular_core.InjectionToken<DaffCartShippingAddressServiceInterface<DaffCart>>;
164
- declare const provideDaffCartShippingAddressDriver: <R extends DaffCartShippingAddressServiceInterface<DaffCart> = DaffCartShippingAddressServiceInterface<DaffCart>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
165
-
147
+ export declare const DaffCartShippingAddressDriver: import("@angular/core").InjectionToken<DaffCartShippingAddressServiceInterface<DaffCart>>, provideDaffCartShippingAddressDriver: <R extends DaffCartShippingAddressServiceInterface<DaffCart> = DaffCartShippingAddressServiceInterface<DaffCart>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
166
148
  /**
167
149
  * The interface responsible for mediating the interaction of the shipping
168
150
  * information of a cart with a given platform.
169
151
  */
170
- interface DaffCartShippingInformationServiceInterface<T extends DaffCart = DaffCart> {
171
- /**
172
- * Get the currently selected shipping method of a cart.
173
- */
174
- get(cartId: T['id']): Observable<T['shipping_information']>;
175
- /**
176
- * Update the currently selected shipping method of a cart.
177
- */
178
- update(cartId: T['id'], shippingInfo: Partial<T['shipping_information']>): Observable<Partial<T>>;
179
- /**
180
- * Remove the currently selected shipping method from a cart.
181
- */
182
- delete(cartId: T['id'], id?: T['shipping_information']['id']): Observable<Partial<T>>;
152
+ export interface DaffCartShippingInformationServiceInterface<T extends DaffCart = DaffCart> {
153
+ /**
154
+ * Get the currently selected shipping method of a cart.
155
+ */
156
+ get(cartId: T['id']): Observable<T['shipping_information']>;
157
+ /**
158
+ * Update the currently selected shipping method of a cart.
159
+ */
160
+ update(cartId: T['id'], shippingInfo: Partial<T['shipping_information']>): Observable<Partial<T>>;
161
+ /**
162
+ * Remove the currently selected shipping method from a cart.
163
+ */
164
+ delete(cartId: T['id'], id?: T['shipping_information']['id']): Observable<Partial<T>>;
183
165
  }
184
- declare const DaffCartShippingInformationDriver: _angular_core.InjectionToken<DaffCartShippingInformationServiceInterface<DaffCart>>;
185
- declare const provideDaffCartShippingInformationDriver: <R extends DaffCartShippingInformationServiceInterface<DaffCart> = DaffCartShippingInformationServiceInterface<DaffCart>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
186
-
166
+ export declare const DaffCartShippingInformationDriver: import("@angular/core").InjectionToken<DaffCartShippingInformationServiceInterface<DaffCart>>, provideDaffCartShippingInformationDriver: <R extends DaffCartShippingInformationServiceInterface<DaffCart> = DaffCartShippingInformationServiceInterface<DaffCart>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
187
167
  /**
188
168
  * The interface responsible for retrieving the available shipping methods of a cart.
189
169
  */
190
- interface DaffCartShippingMethodsServiceInterface<T extends DaffCartShippingRate = DaffCartShippingRate> {
191
- /**
192
- * List the available shipping methods for a cart.
193
- */
194
- list(cartId: DaffCart['id']): Observable<T[]>;
170
+ export interface DaffCartShippingMethodsServiceInterface<T extends DaffCartShippingRate = DaffCartShippingRate> {
171
+ /**
172
+ * List the available shipping methods for a cart.
173
+ */
174
+ list(cartId: DaffCart['id']): Observable<T[]>;
195
175
  }
196
- declare const DaffCartShippingMethodsDriver: _angular_core.InjectionToken<DaffCartShippingMethodsServiceInterface<DaffCartShippingRate>>;
197
- declare const provideDaffCartShippingMethodsDriver: <R extends DaffCartShippingMethodsServiceInterface<DaffCartShippingRate> = DaffCartShippingMethodsServiceInterface<DaffCartShippingRate>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
198
-
176
+ export declare const DaffCartShippingMethodsDriver: import("@angular/core").InjectionToken<DaffCartShippingMethodsServiceInterface<DaffCartShippingRate>>, provideDaffCartShippingMethodsDriver: <R extends DaffCartShippingMethodsServiceInterface<DaffCartShippingRate> = DaffCartShippingMethodsServiceInterface<DaffCartShippingRate>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
199
177
  /**
200
178
  * The interface responsible for placing an order for the customer's cart.
201
179
  */
202
- interface DaffCartOrderServiceInterface<T extends DaffCart = DaffCart, R extends DaffCartOrderResult = DaffCartOrderResult> {
203
- /**
204
- * Place an order and return the order ID.
205
- */
206
- placeOrder(id: T['id'], payment?: T['payment']): Observable<R>;
180
+ export interface DaffCartOrderServiceInterface<T extends DaffCart = DaffCart, R extends DaffCartOrderResult = DaffCartOrderResult> {
181
+ /**
182
+ * Place an order and return the order ID.
183
+ */
184
+ placeOrder(id: T['id'], payment?: T['payment']): Observable<R>;
207
185
  }
208
- declare const DaffCartOrderDriver: _angular_core.InjectionToken<DaffCartOrderServiceInterface<DaffCart, DaffCartOrderResult>>;
209
- declare const provideDaffCartOrderDriver: <R extends DaffCartOrderServiceInterface<DaffCart, DaffCartOrderResult> = DaffCartOrderServiceInterface<DaffCart, DaffCartOrderResult>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
210
-
211
- declare const DAFF_CART_DRIVER_FREE_PAYMENT_METHOD: _angular_core.InjectionToken<Partial<DaffCartPaymentMethod>>;
212
- declare const daffCartDriverProvideFreePaymentMethod: <R extends Partial<DaffCartPaymentMethod> = Partial<DaffCartPaymentMethod>>(value: R) => _angular_core.ValueProvider;
213
-
214
- declare enum DaffCartDriverErrorCodes {
215
- CART_NOT_FOUND = "DAFF_CART_NOT_FOUND",
216
- PRODUCT_OUT_OF_STOCK = "DAFF_PRODUCT_OUT_OF_STOCK",
217
- PRODUCT_INSUFFICIENT_STOCK = "DAFF_PRODUCT_INSUFFICIENT_STOCK",
218
- INVALID_COUPON_CODE = "DAFF_INVALID_COUPON_CODE",
219
- INVALID_COUNTRY = "DAFF_INVALID_COUNTRY",
220
- INVALID_EMAIL = "DAFF_INVALID_EMAIL",
221
- INVALID_REGION = "DAFF_INVALID_REGION",
222
- INVALID_API_RESPONSE = "DAFF_INVALID_API_RESPONSE",
223
- EXPIRED_PAYMENT_METHOD = "DAFF_EXPIRED_PAYMENT_METHOD",
224
- ITEM_EXCEEDS_MAX_QTY = "ITEM_EXCEEDS_MAX_QTY",
225
- UNAUTHORIZED_FOR_CART = "DAFF_UNAUTHORIZED_FOR_CART"
186
+ export declare const DaffCartOrderDriver: import("@angular/core").InjectionToken<DaffCartOrderServiceInterface<DaffCart, DaffCartOrderResult>>, provideDaffCartOrderDriver: <R extends DaffCartOrderServiceInterface<DaffCart, DaffCartOrderResult> = DaffCartOrderServiceInterface<DaffCart, DaffCartOrderResult>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
187
+ export declare const DAFF_CART_DRIVER_FREE_PAYMENT_METHOD: import("@angular/core").InjectionToken<Partial<DaffCartPaymentMethod>>, daffCartDriverProvideFreePaymentMethod: <R extends Partial<DaffCartPaymentMethod> = Partial<DaffCartPaymentMethod>>(value: R) => import("@angular/core").ValueProvider;
188
+ export declare enum DaffCartDriverErrorCodes {
189
+ CART_NOT_FOUND = "DAFF_CART_NOT_FOUND",
190
+ PRODUCT_OUT_OF_STOCK = "DAFF_PRODUCT_OUT_OF_STOCK",
191
+ PRODUCT_INSUFFICIENT_STOCK = "DAFF_PRODUCT_INSUFFICIENT_STOCK",
192
+ INVALID_COUPON_CODE = "DAFF_INVALID_COUPON_CODE",
193
+ INVALID_COUNTRY = "DAFF_INVALID_COUNTRY",
194
+ INVALID_EMAIL = "DAFF_INVALID_EMAIL",
195
+ INVALID_REGION = "DAFF_INVALID_REGION",
196
+ INVALID_API_RESPONSE = "DAFF_INVALID_API_RESPONSE",
197
+ EXPIRED_PAYMENT_METHOD = "DAFF_EXPIRED_PAYMENT_METHOD",
198
+ ITEM_EXCEEDS_MAX_QTY = "ITEM_EXCEEDS_MAX_QTY",
199
+ UNAUTHORIZED_FOR_CART = "DAFF_UNAUTHORIZED_FOR_CART"
226
200
  }
227
-
228
201
  /**
229
202
  * An error thrown when a cart driver call is sent with a cart identifier
230
203
  * that cannot be found by the platform.
231
204
  */
232
- declare class DaffCartNotFoundError extends DaffInheritableError implements DaffError {
233
- readonly code: string;
234
- constructor(message?: string);
205
+ export declare class DaffCartNotFoundError extends DaffInheritableError implements DaffError {
206
+ readonly code: string;
207
+ constructor(message?: string);
235
208
  }
236
-
237
209
  /**
238
210
  * An error thrown when the payment token used for the payment method update has expired.
239
211
  * This happens when the a place order request happens too long after payment update.
240
212
  * The payment must be updated again before an order can be placed.
241
213
  */
242
- declare class DaffCartExpiredPaymentTokenError extends DaffInheritableError implements DaffError {
243
- message: string;
244
- readonly code: string;
245
- constructor(message: string);
214
+ export declare class DaffCartExpiredPaymentTokenError extends DaffInheritableError implements DaffError {
215
+ message: string;
216
+ readonly code: string;
217
+ constructor(message: string);
246
218
  }
247
-
248
219
  /**
249
220
  * An error thrown when the platform's API response is missing required information
250
221
  * or malformed in an unrecoverable way.
251
222
  */
252
- declare class DaffCartInvalidAPIResponseError extends DaffInheritableError implements DaffError {
253
- message: string;
254
- readonly code: string;
255
- constructor(message: string);
223
+ export declare class DaffCartInvalidAPIResponseError extends DaffInheritableError implements DaffError {
224
+ message: string;
225
+ readonly code: string;
226
+ constructor(message: string);
256
227
  }
257
-
258
228
  /**
259
229
  * An error thrown when the specified country is invalid for the specified address
260
230
  * or missing where it is required.
261
231
  */
262
- declare class DaffInvalidCountryError extends DaffInheritableError implements DaffError {
263
- readonly code: string;
264
- constructor(message?: string);
232
+ export declare class DaffInvalidCountryError extends DaffInheritableError implements DaffError {
233
+ readonly code: string;
234
+ constructor(message?: string);
265
235
  }
266
-
267
236
  /**
268
237
  * An error thrown when the specified coupon code cannot be applied to the cart.
269
238
  * Either the coupon code does not exist or the required conditions are not met.
270
239
  */
271
- declare class DaffInvalidCouponCodeError extends DaffInheritableError implements DaffError {
272
- coupon?: DaffCartCoupon['code'];
273
- readonly code: string;
274
- constructor(message?: string, coupon?: DaffCartCoupon['code']);
240
+ export declare class DaffInvalidCouponCodeError extends DaffInheritableError implements DaffError {
241
+ coupon?: DaffCartCoupon['code'];
242
+ readonly code: string;
243
+ constructor(message?: string, coupon?: DaffCartCoupon['code']);
275
244
  }
276
-
277
245
  /**
278
246
  * An error thrown when the email is not in the correct format.
279
247
  */
280
- declare class DaffInvalidEmailError extends DaffInheritableError implements DaffError {
281
- readonly code: string;
282
- constructor(message?: string);
248
+ export declare class DaffInvalidEmailError extends DaffInheritableError implements DaffError {
249
+ readonly code: string;
250
+ constructor(message?: string);
283
251
  }
284
-
285
252
  /**
286
253
  * An error thrown when the specified region is invalid for the specified address
287
254
  * or missing where it is required.
288
255
  */
289
- declare class DaffInvalidRegionError extends DaffInheritableError implements DaffError {
290
- readonly code: string;
291
- constructor(message?: string);
256
+ export declare class DaffInvalidRegionError extends DaffInheritableError implements DaffError {
257
+ readonly code: string;
258
+ constructor(message?: string);
292
259
  }
293
-
294
260
  /**
295
261
  * An error thrown when a cart item's requested quantity
296
262
  * exceeds the maximum allowed by the platform.
297
263
  */
298
- declare class DaffCartItemExceedsMaxQtyError extends DaffInheritableError implements DaffError {
299
- readonly code: string;
300
- constructor(message?: string);
264
+ export declare class DaffCartItemExceedsMaxQtyError extends DaffInheritableError implements DaffError {
265
+ readonly code: string;
266
+ constructor(message?: string);
301
267
  }
302
-
303
268
  /**
304
269
  * An error thrown when a cart item's requested quantity
305
270
  * exceeds the amount currently in stock.
306
271
  */
307
- declare class DaffProductInsufficientStockError extends DaffInheritableError implements DaffError {
308
- readonly code: string;
309
- constructor(message?: string);
272
+ export declare class DaffProductInsufficientStockError extends DaffInheritableError implements DaffError {
273
+ readonly code: string;
274
+ constructor(message?: string);
310
275
  }
311
-
312
276
  /**
313
277
  * An error thrown when a cart item's requested product is fully out of stock.
314
278
  */
315
- declare class DaffProductOutOfStockError extends DaffInheritableError implements DaffError {
316
- readonly code: string;
317
- constructor(message?: string);
279
+ export declare class DaffProductOutOfStockError extends DaffInheritableError implements DaffError {
280
+ readonly code: string;
281
+ constructor(message?: string);
318
282
  }
319
-
320
283
  /**
321
284
  * An error thrown when the current user is not authorized for the requested cart.
322
285
  */
323
- declare class DaffUnauthorizedForCartError extends DaffInheritableError implements DaffError {
324
- readonly code: string;
325
- constructor(message?: string);
286
+ export declare class DaffUnauthorizedForCartError extends DaffInheritableError implements DaffError {
287
+ readonly code: string;
288
+ constructor(message?: string);
326
289
  }
327
-
328
290
  /**
329
291
  * A mapping from error codes to error class constructors.
330
292
  */
331
- declare const DaffCartDriverErrorMap: {
332
- DAFF_CART_NOT_FOUND: typeof DaffCartNotFoundError;
333
- DAFF_PRODUCT_OUT_OF_STOCK: typeof DaffProductOutOfStockError;
334
- DAFF_PRODUCT_INSUFFICIENT_STOCK: typeof DaffProductInsufficientStockError;
335
- DAFF_INVALID_COUPON_CODE: typeof DaffInvalidCouponCodeError;
336
- DAFF_INVALID_COUNTRY: typeof DaffInvalidCountryError;
337
- DAFF_INVALID_EMAIL: typeof DaffInvalidEmailError;
338
- DAFF_INVALID_REGION: typeof DaffInvalidRegionError;
339
- DAFF_INVALID_API_RESPONSE: typeof DaffCartInvalidAPIResponseError;
340
- DAFF_EXPIRED_PAYMENT_METHOD: typeof DaffCartExpiredPaymentTokenError;
341
- ITEM_EXCEEDS_MAX_QTY: typeof DaffCartItemExceedsMaxQtyError;
342
- DAFF_UNAUTHORIZED_FOR_CART: typeof DaffUnauthorizedForCartError;
293
+ export declare const DaffCartDriverErrorMap: {
294
+ DAFF_CART_NOT_FOUND: typeof DaffCartNotFoundError;
295
+ DAFF_PRODUCT_OUT_OF_STOCK: typeof DaffProductOutOfStockError;
296
+ DAFF_PRODUCT_INSUFFICIENT_STOCK: typeof DaffProductInsufficientStockError;
297
+ DAFF_INVALID_COUPON_CODE: typeof DaffInvalidCouponCodeError;
298
+ DAFF_INVALID_COUNTRY: typeof DaffInvalidCountryError;
299
+ DAFF_INVALID_EMAIL: typeof DaffInvalidEmailError;
300
+ DAFF_INVALID_REGION: typeof DaffInvalidRegionError;
301
+ DAFF_INVALID_API_RESPONSE: typeof DaffCartInvalidAPIResponseError;
302
+ DAFF_EXPIRED_PAYMENT_METHOD: typeof DaffCartExpiredPaymentTokenError;
303
+ ITEM_EXCEEDS_MAX_QTY: typeof DaffCartItemExceedsMaxQtyError;
304
+ DAFF_UNAUTHORIZED_FOR_CART: typeof DaffUnauthorizedForCartError;
343
305
  };
344
-
345
306
  /**
346
307
  * A service for resolving the cart in a way that is tolerant of errors and invalid or missing cart IDs in storage.
347
308
  */
348
- declare class DaffCartDriverResolveService<T extends DaffCart = DaffCart> {
349
- private driver;
350
- private storage;
351
- constructor(driver: DaffCartServiceInterface<T>, storage: DaffCartStorageService);
352
- /**
353
- * Resolves the cart, creating if no ID is in storage.
354
- * If the cart cannot be found, removes the ID from storage.
355
- * If the cart cannot be resolved, throws an error.
356
- */
357
- getCartOrFail(): Observable<DaffDriverResponse<T>>;
358
- /**
359
- * Retrieves the cart ID, creating if no ID is in storage.
360
- */
361
- getCartIdOrFail(): Observable<DaffCart['id']>;
362
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DaffCartDriverResolveService<any>, never>;
363
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<DaffCartDriverResolveService<any>>;
309
+ export declare class DaffCartDriverResolveService<T extends DaffCart = DaffCart> {
310
+ private driver;
311
+ private storage;
312
+ constructor(driver: DaffCartServiceInterface<T>, storage: DaffCartStorageService);
313
+ /**
314
+ * Resolves the cart, creating if no ID is in storage.
315
+ * If the cart cannot be found, removes the ID from storage.
316
+ * If the cart cannot be resolved, throws an error.
317
+ */
318
+ getCartOrFail(): Observable<DaffDriverResponse<T>>;
319
+ /**
320
+ * Retrieves the cart ID, creating if no ID is in storage.
321
+ */
322
+ getCartIdOrFail(): Observable<DaffCart['id']>;
323
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCartDriverResolveService<any>, never>;
324
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
364
325
  }
365
-
366
326
  /**
367
327
  * If a {@link DaffCartNotFoundError} is thrown into the stream,
368
328
  * the cart ID is removed from storage.
369
329
  * All errors are thrown back into the stream.
370
330
  */
371
- declare const daffCartDriverHandleCartNotFound: <T>(storage: DaffCartStorageService) => rxjs.UnaryFunction<Observable<T>, Observable<T>>;
372
-
373
- export { DAFF_CART_DRIVER_FREE_PAYMENT_METHOD, DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartCouponDriver, DaffCartDriver, DaffCartDriverErrorCodes, DaffCartDriverErrorMap, DaffCartDriverResolveService, DaffCartExpiredPaymentTokenError, DaffCartInvalidAPIResponseError, DaffCartItemDriver, DaffCartItemExceedsMaxQtyError, DaffCartNotFoundError, DaffCartOrderDriver, DaffCartPaymentDriver, DaffCartPaymentMethodsDriver, DaffCartShippingAddressDriver, DaffCartShippingInformationDriver, DaffCartShippingMethodsDriver, DaffInvalidCountryError, DaffInvalidCouponCodeError, DaffInvalidEmailError, DaffInvalidRegionError, DaffProductInsufficientStockError, DaffProductOutOfStockError, DaffUnauthorizedForCartError, daffCartDriverHandleCartNotFound, daffCartDriverProvideFreePaymentMethod, provideDaffCartAddressDriver, provideDaffCartBillingAddressDriver, provideDaffCartCouponDriver, provideDaffCartDriver, provideDaffCartItemDriver, provideDaffCartOrderDriver, provideDaffCartPaymentDriver, provideDaffCartPaymentMethodsDriver, provideDaffCartShippingAddressDriver, provideDaffCartShippingInformationDriver, provideDaffCartShippingMethodsDriver };
374
- export type { DaffCartAddressServiceInterface, DaffCartBillingAddressServiceInterface, DaffCartCouponServiceInterface, DaffCartItemServiceInterface, DaffCartOrderServiceInterface, DaffCartPaymentMethodsServiceInterface, DaffCartPaymentServiceInterface, DaffCartServiceInterface, DaffCartShippingAddressServiceInterface, DaffCartShippingInformationServiceInterface, DaffCartShippingMethodsServiceInterface };
331
+ export declare const daffCartDriverHandleCartNotFound: <T>(storage: DaffCartStorageService) => import("rxjs").UnaryFunction<Observable<T>, Observable<T>>;